Merge "Issue #1538 Federated registry fixes/modifications" into development

Former-commit-id: 539a6ee3236de6863cb6111c07ccc34fddd5e613
This commit is contained in:
Richard Peter 2013-08-28 13:28:20 -05:00 committed by Gerrit Code Review
commit 79c3b08e64
24 changed files with 241 additions and 181 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="cxf-2.5.10.jar"/> <classpathentry exported="true" kind="lib" path="cxf-2.5.10.jar" sourcepath="apache-cxf-2.5.10-src.jar"/>
<classpathentry exported="true" kind="lib" path="FastInfoset-1.2.9.jar"/> <classpathentry exported="true" kind="lib" path="FastInfoset-1.2.9.jar"/>
<classpathentry exported="true" kind="lib" path="geronimo-activation_1.1_spec-1.1.jar"/> <classpathentry exported="true" kind="lib" path="geronimo-activation_1.1_spec-1.1.jar"/>
<classpathentry exported="true" kind="lib" path="geronimo-annotation_1.0_spec-1.1.1.jar"/> <classpathentry exported="true" kind="lib" path="geronimo-annotation_1.0_spec-1.1.1.jar"/>

View file

@ -0,0 +1,6 @@
#!/bin/bash
# DR #1538 Expand the name column in the slot table
PSQL="/awips2/psql/bin/psql"
${PSQL} -U awips -d metadata -c "ALTER TABLE ebxml.slot ALTER COLUMN name TYPE character varying(1024)"

View file

@ -29,6 +29,7 @@ package com.raytheon.uf.common.comm;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 3, 2013 1786 mpduff Initial creation * Apr 3, 2013 1786 mpduff Initial creation
* 8/28/2013 1538 bphillip Added nonProxyHosts field
* *
* </pre> * </pre>
* *
@ -42,6 +43,8 @@ public class ProxyConfiguration {
private int port; private int port;
private String nonProxyHosts;
/** /**
* Default constructor. * Default constructor.
*/ */
@ -62,6 +65,20 @@ public class ProxyConfiguration {
this.port = Integer.parseInt(port); this.port = Integer.parseInt(port);
} }
/**
* Constructor.
*
* @param host
* The host string
* @param port
* The port string
*/
public ProxyConfiguration(String host, String port, String nonProxyHosts) {
this.host = host;
this.port = Integer.parseInt(port);
this.nonProxyHosts = nonProxyHosts;
}
/** /**
* @return the host * @return the host
*/ */
@ -100,4 +117,13 @@ public class ProxyConfiguration {
public String getPortString() { public String getPortString() {
return String.valueOf(port); return String.valueOf(port);
} }
public String getNonProxyHosts() {
return nonProxyHosts;
}
public void setNonProxyHosts(String nonProxyHosts) {
this.nonProxyHosts = nonProxyHosts;
}
} }

View file

@ -35,6 +35,7 @@ import com.raytheon.uf.common.util.PropertiesUtil;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 1, 2013 1786 mpduff Initial creation * Apr 1, 2013 1786 mpduff Initial creation
* 8/28/2013 1538 bphillip Add handling of nonProxyHosts
* *
* </pre> * </pre>
* *
@ -49,6 +50,9 @@ public class ProxyUtil {
/** Proxy port environment variable name */ /** Proxy port environment variable name */
public static final String HTTP_PROXY_PORT = "http.proxyPort"; public static final String HTTP_PROXY_PORT = "http.proxyPort";
/** Hosts that bypass the proxy over http */
public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
/** /**
* Get the proxy server settings if any are present. * Get the proxy server settings if any are present.
* *
@ -57,9 +61,14 @@ public class ProxyUtil {
public static ProxyConfiguration getProxySettings() { public static ProxyConfiguration getProxySettings() {
String host = System.getProperty(HTTP_PROXY_HOST); String host = System.getProperty(HTTP_PROXY_HOST);
String port = System.getProperty(HTTP_PROXY_PORT); String port = System.getProperty(HTTP_PROXY_PORT);
String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS);
if (host != null && port != null) { if (host != null && port != null) {
return new ProxyConfiguration(host, port); ProxyConfiguration proxyConfig = new ProxyConfiguration(host, port);
if (nonProxyHosts != null && !nonProxyHosts.trim().isEmpty()) {
proxyConfig.setNonProxyHosts(nonProxyHosts);
}
return proxyConfig;
} }
return null; return null;
@ -80,9 +89,14 @@ public class ProxyUtil {
Properties properties = PropertiesUtil.read(proxyFile); Properties properties = PropertiesUtil.read(proxyFile);
String host = properties.getProperty(HTTP_PROXY_HOST); String host = properties.getProperty(HTTP_PROXY_HOST);
String port = properties.getProperty(HTTP_PROXY_PORT); String port = properties.getProperty(HTTP_PROXY_PORT);
String nonProxyHosts = properties.getProperty(HTTP_NON_PROXY_HOSTS);
if (host != null && port != null) { if (host != null && port != null) {
proxySettings = new ProxyConfiguration(host, port); ProxyConfiguration proxyConfig = new ProxyConfiguration(host, port);
if (nonProxyHosts != null && !nonProxyHosts.trim().isEmpty()) {
proxyConfig.setNonProxyHosts(nonProxyHosts);
}
return proxyConfig;
} }
return proxySettings; return proxySettings;

View file

@ -65,7 +65,7 @@ public class Provider implements ISerializableObject {
public enum ServiceType { public enum ServiceType {
// TODO: Only OPENDAP and WFS have the correct amounts // TODO: Only OPENDAP and WFS have the correct amounts
OPENDAP(5000, BYTES_IN_FLOAT), WCS(5000, BYTES_IN_FLOAT), WFS(2411724, OPENDAP(5000, BYTES_IN_FLOAT), WCS(5000, BYTES_IN_FLOAT), WFS(1411724,
OneByOneBox), WMS(5000, BYTES_IN_FLOAT), WXXM(5000, OneByOneBox), WMS(5000, BYTES_IN_FLOAT), WXXM(5000,
BYTES_IN_FLOAT); BYTES_IN_FLOAT);
@ -85,12 +85,11 @@ public class Provider implements ISerializableObject {
} }
/** /**
* Takes in a WFS request and gives you a nominal byte size based * Takes in a WFS request and gives you a nominal byte size based on the
* on the size in lat/lon of the bounding box and the interval in multiples of * size in lat/lon of the bounding box and the interval in multiples of
* 5 min intervals. * 5 min intervals.
* *
* timeSpan ~ minutes * timeSpan ~ minutes latSpan ~ span in degrees of lat for bounding box
* latSpan ~ span in degrees of lat for bounding box
* lonSpan ~ span in degrees of lon for bounding box * lonSpan ~ span in degrees of lon for bounding box
* *
* @param latSpan * @param latSpan
@ -101,7 +100,7 @@ public class Provider implements ISerializableObject {
public long getRequestBytesPerLatLonBoxAndTime(double latSpan, public long getRequestBytesPerLatLonBoxAndTime(double latSpan,
double lonSpan, int timeSpan) { double lonSpan, int timeSpan) {
// increments are in 5 minutes so 5/5 = 1 // increments are in 5 minutes so 5/5 = 1
return (long) (latSpan * lonSpan * timeSpan/5 * requestOverheadInBytes); return (long) (latSpan * lonSpan * timeSpan / 5 * requestOverheadInBytes);
} }
} }

View file

@ -29,6 +29,7 @@ Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
org.springframework;bundle-version="2.5.6", org.springframework;bundle-version="2.5.6",
org.apache.commons.lang;bundle-version="2.3.0", org.apache.commons.lang;bundle-version="2.3.0",
org.apache.commons.cxf;bundle-version="1.0.0" org.apache.commons.cxf;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.12.1174"
Import-Package: com.sun.xml.bind.marshaller, Import-Package: com.sun.xml.bind.marshaller,
com.vividsolutions.jts.geom com.vividsolutions.jts.geom

View file

@ -19,12 +19,12 @@
**/ **/
package com.raytheon.uf.common.registry.services; package com.raytheon.uf.common.registry.services;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
@ -43,15 +43,20 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.headers.Header; import org.apache.cxf.headers.Header;
import org.apache.cxf.jaxb.JAXBDataBinding; import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.ConnectionType;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import com.google.common.cache.CacheBuilder; import com.raytheon.uf.common.comm.ProxyConfiguration;
import com.google.common.cache.CacheLoader; import com.raytheon.uf.common.comm.ProxyUtil;
import com.google.common.cache.LoadingCache; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
/** /**
* *
@ -65,6 +70,7 @@ import com.raytheon.uf.common.status.UFStatus;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 4/9/2013 1802 bphillip Initial implementation * 4/9/2013 1802 bphillip Initial implementation
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum. * Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
* 8/28/2013 1538 bphillip Removed caches, add http client preferences
* *
* </pre> * </pre>
* *
@ -98,50 +104,22 @@ public class RegistrySOAPServices {
/** The name of the validator service */ /** The name of the validator service */
private static final String VALIDATOR_SERVICE_NAME = "validator"; private static final String VALIDATOR_SERVICE_NAME = "validator";
/** Cache of known notification services */ private static final ProxyConfiguration proxyConfig;
private static LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
.build(new CacheLoader<String, NotificationListener>() {
public NotificationListener load(String key) {
return getPort(key, NotificationListener.class);
}
});
/** Cache of known lifecycle manager services */ private static final HTTPClientPolicy httpClientPolicy;
private static LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder static {
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS) proxyConfig = getProxyConfiguration();
.build(new CacheLoader<String, LifecycleManager>() { httpClientPolicy = new HTTPClientPolicy();
public LifecycleManager load(String key) { httpClientPolicy.setReceiveTimeout(TimeUtil.MILLIS_PER_MINUTE * 2);
return getPort(key, LifecycleManager.class); httpClientPolicy.setConnectionTimeout(10000);
} httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE);
}); httpClientPolicy.setMaxRetransmits(5);
if (proxyConfig != null) {
/** Cache of known cataloger services */ httpClientPolicy.setProxyServer(proxyConfig.getHost());
private static LoadingCache<String, Cataloger> catalogerServices = CacheBuilder httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS) httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
.build(new CacheLoader<String, Cataloger>() { }
public Cataloger load(String key) { }
return getPort(key, Cataloger.class);
}
});
/** Cache of known query services */
private static LoadingCache<String, QueryManager> queryServices = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
.build(new CacheLoader<String, QueryManager>() {
public QueryManager load(String key) {
return getPort(key, QueryManager.class);
}
});
/** Cache of known validator services */
private static LoadingCache<String, Validator> validatorServices = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
.build(new CacheLoader<String, Validator>() {
public Validator load(String key) {
return getPort(key, Validator.class);
}
});
/** /**
* Gets the notification listener service URL for the given host * Gets the notification listener service URL for the given host
@ -184,12 +162,7 @@ public class RegistrySOAPServices {
*/ */
public static NotificationListener getNotificationListenerServiceForUrl( public static NotificationListener getNotificationListenerServiceForUrl(
final String url) throws RegistryServiceException { final String url) throws RegistryServiceException {
try { return getPort(url, NotificationListener.class);
return notificationManagerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting notification manager at [" + url + "]", e);
}
} }
/** /**
@ -218,12 +191,7 @@ public class RegistrySOAPServices {
*/ */
public static LifecycleManager getLifecycleManagerServiceForUrl( public static LifecycleManager getLifecycleManagerServiceForUrl(
final String url) throws RegistryServiceException { final String url) throws RegistryServiceException {
try { return getPort(url, LifecycleManager.class);
return lifecycleManagerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting lifecycle manager at [" + url + "]", e);
}
} }
/** /**
@ -252,12 +220,7 @@ public class RegistrySOAPServices {
*/ */
public static Cataloger getCatalogerServiceForUrl(final String url) public static Cataloger getCatalogerServiceForUrl(final String url)
throws RegistryServiceException { throws RegistryServiceException {
try { return getPort(url, Cataloger.class);
return catalogerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException("Error getting cataloger at ["
+ url + "]", e);
}
} }
/** /**
@ -285,12 +248,7 @@ public class RegistrySOAPServices {
*/ */
public static QueryManager getQueryServiceForUrl(final String url) public static QueryManager getQueryServiceForUrl(final String url)
throws RegistryServiceException { throws RegistryServiceException {
try { return getPort(url, QueryManager.class);
return queryServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting query manager at [" + url + "]", e);
}
} }
/** /**
@ -319,12 +277,7 @@ public class RegistrySOAPServices {
*/ */
public static Validator getValidatorServiceForUrl(final String url) public static Validator getValidatorServiceForUrl(final String url)
throws RegistryServiceException { throws RegistryServiceException {
try { return getPort(url, Validator.class);
return validatorServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException("Error getting validator at ["
+ url + "]", e);
}
} }
/** /**
@ -387,6 +340,9 @@ public class RegistrySOAPServices {
W3CEndpointReference ref = endpointBuilder.build(); W3CEndpointReference ref = endpointBuilder.build();
T port = (T) ref.getPort(serviceInterface); T port = (T) ref.getPort(serviceInterface);
((HTTPConduit) ClientProxy.getClient(port).getConduit())
.setClient(httpClientPolicy);
if (RegistryUtil.LOCAL_REGISTRY_ADDRESS != null) { if (RegistryUtil.LOCAL_REGISTRY_ADDRESS != null) {
List<Header> headerList = new ArrayList<Header>(1); List<Header> headerList = new ArrayList<Header>(1);
Header header = null; Header header = null;
@ -403,7 +359,28 @@ public class RegistrySOAPServices {
BindingProvider bindingProvider = (BindingProvider) port; BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext().put(Header.HEADER_LIST, bindingProvider.getRequestContext().put(Header.HEADER_LIST,
headerList); headerList);
} }
return port; return port;
} }
/**
* Gets the proxy configuration
*
* @return The proxy configuration
*/
private static ProxyConfiguration getProxyConfiguration() {
ProxyConfiguration proxyConfig = null;
File proxyFile = PathManagerFactory.getPathManager().getStaticFile(
"datadelivery" + File.separator + "proxy.properties");
if (proxyFile != null) {
try {
proxyConfig = ProxyUtil.getProxySettings(proxyFile);
} catch (IOException e) {
throw new RegistryServiceException(
"Error reading proxy properties", e);
}
}
return proxyConfig;
}
} }

View file

@ -23,7 +23,6 @@ package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
@ -78,7 +77,7 @@ public class NotificationType extends RegistryObjectType {
@XmlElement(name = "Event", required = true) @XmlElement(name = "Event", required = true)
@DynamicSerializeElement @DynamicSerializeElement
@ManyToMany(cascade = CascadeType.DETACH) @ManyToMany(cascade = {})
@JoinTable(schema = "ebxml") @JoinTable(schema = "ebxml")
protected List<AuditableEventType> event; protected List<AuditableEventType> event;

View file

@ -24,6 +24,7 @@ import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -104,6 +105,7 @@ public class SlotType extends ExtensibleObjectType implements
@XmlAttribute(required = true) @XmlAttribute(required = true)
@DynamicSerializeElement @DynamicSerializeElement
@Index(name = "slot_name_idx") @Index(name = "slot_name_idx")
@Column(length = 1024)
protected String name; protected String name;
@XmlAttribute @XmlAttribute

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.edex.datadelivery.registry.federation; package com.raytheon.uf.edex.datadelivery.registry.federation;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
@ -139,11 +140,12 @@ public abstract class RegistryFederationManager {
* If errors occur when creating the jaxb manager * If errors occur when creating the jaxb manager
* @throws SerializationException * @throws SerializationException
* If errors occur when unmarshalling the federation properties * If errors occur when unmarshalling the federation properties
* @throws MalformedURLException
*/ */
protected RegistryFederationManager(boolean federationEnabled, protected RegistryFederationManager(boolean federationEnabled,
LifecycleManager lcm, String federationPropertiesFileName, LifecycleManager lcm, String federationPropertiesFileName,
RegistryReplicationManager replicationManager) RegistryReplicationManager replicationManager)
throws JAXBException, SerializationException { throws JAXBException, SerializationException, MalformedURLException {
this.federationEnabled = federationEnabled; this.federationEnabled = federationEnabled;
this.lcm = lcm; this.lcm = lcm;
this.replicationManager = replicationManager; this.replicationManager = replicationManager;

View file

@ -127,6 +127,7 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
this.replicationManager.setSubscriptionProcessingEnabled(false); this.replicationManager.setSubscriptionProcessingEnabled(false);
} else { } else {
scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler = Executors.newSingleThreadScheduledExecutor();
} }
} }

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.edex.datadelivery.registry.replication; package com.raytheon.uf.edex.datadelivery.registry.replication;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
@ -158,12 +159,13 @@ public class RegistryReplicationManager {
* @throws JAXBException * @throws JAXBException
* If errors occur while creating the JAXBManager * If errors occur while creating the JAXBManager
* @throws SerializationException * @throws SerializationException
* @throws MalformedURLException
*/ */
public RegistryReplicationManager(boolean subscriptionProcessingEnabled, public RegistryReplicationManager(boolean subscriptionProcessingEnabled,
String notificationServerConfigFileName, RegistryObjectDao dao, String notificationServerConfigFileName, RegistryObjectDao dao,
FederatedRegistryMonitor availabilityMonitor, FederatedRegistryMonitor availabilityMonitor,
TransactionTemplate txTemplate, int registrySyncThreads) TransactionTemplate txTemplate, int registrySyncThreads)
throws JAXBException, SerializationException { throws JAXBException, SerializationException, MalformedURLException {
this.subscriptionProcessingEnabled = subscriptionProcessingEnabled; this.subscriptionProcessingEnabled = subscriptionProcessingEnabled;
this.replicationConfigFileName = notificationServerConfigFileName; this.replicationConfigFileName = notificationServerConfigFileName;
this.dao = dao; this.dao = dao;

View file

@ -69,6 +69,7 @@ public class ConnectionUtil {
static void clearSettings() { static void clearSettings() {
System.clearProperty(ProxyUtil.HTTP_PROXY_HOST); System.clearProperty(ProxyUtil.HTTP_PROXY_HOST);
System.clearProperty(ProxyUtil.HTTP_PROXY_PORT); System.clearProperty(ProxyUtil.HTTP_PROXY_PORT);
System.clearProperty(ProxyUtil.HTTP_NON_PROXY_HOSTS);
instance = new ConnectionUtil(); instance = new ConnectionUtil();
initialized = false; initialized = false;
} }
@ -108,8 +109,6 @@ public class ConnectionUtil {
return instance.getProxyInformation(); return instance.getProxyInformation();
} }
private static synchronized void initialize() { private static synchronized void initialize() {
ProxyConfiguration proxyInformation = instance.getProxyInformation(); ProxyConfiguration proxyInformation = instance.getProxyInformation();
@ -118,6 +117,8 @@ public class ConnectionUtil {
proxyInformation.getHost()); proxyInformation.getHost());
System.setProperty(ProxyUtil.HTTP_PROXY_PORT, System.setProperty(ProxyUtil.HTTP_PROXY_PORT,
proxyInformation.getPortString()); proxyInformation.getPortString());
System.setProperty(ProxyUtil.HTTP_NON_PROXY_HOSTS,
proxyInformation.getNonProxyHosts());
} }
initialized = true; initialized = true;
} }

View file

@ -3,3 +3,4 @@
#http.proxyHost=proxy.ext.ray.com #http.proxyHost=proxy.ext.ray.com
#http.proxyPort=80 #http.proxyPort=80
#http.nonProxyHosts=

View file

@ -1,20 +1,26 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="ebxml-notification" <!-- This bean has the name of the processSubscriptionsFromVM endpoint (vm:processSubscriptions)
xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"> hard coded due to spring dependency issues. If the endpoint name is changed
<endpoint id="processReplicationSubscriptions" here, it must also be changed in this class -->
uri="clusteredquartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" /> <bean id="registrySubscriptionManagerInvoker"
<route id="processSubscriptionsFromQuartz"> class="com.raytheon.uf.edex.registry.ebxml.dao.EsbRouteRegistrySubscriptionManagerInvocation" />
<from uri="processReplicationSubscriptions" />
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" /> <camelContext id="ebxml-notification" xmlns="http://camel.apache.org/schema/spring"
</route> errorHandlerRef="errorHandler">
<route id="processSubscriptionsFromVM"> <endpoint id="processReplicationSubscriptions"
<from uri="vm:processSubscriptions" /> uri="clusteredquartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" />
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" /> <route id="processSubscriptionsFromQuartz">
</route> <from uri="processReplicationSubscriptions" />
</camelContext> <bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
</route>
<route id="processSubscriptionsFromVM">
<from uri="vm:processSubscriptions?concurrentConsumers=2" />
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
</route>
</camelContext>
</beans> </beans>

View file

@ -7,8 +7,8 @@
<property name="threadPool"> <property name="threadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool"> <bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="1" /> <property name="minThreads" value="5" />
<property name="maxThreads" value="10" /> <property name="maxThreads" value="20" />
</bean> </bean>
</property> </property>
@ -16,7 +16,7 @@
<list> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector"> <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="${EBXML_REGISTRY_WEBSERVER_PORT}" /> <property name="port" value="${EBXML_REGISTRY_WEBSERVER_PORT}" />
<property name="maxIdleTime" value="30000" /> <property name="maxIdleTime" value="300000" />
<property name="acceptors" value="2" /> <property name="acceptors" value="2" />
<property name="confidentialPort" <property name="confidentialPort"
value="${EBXML_REGISTRY_WEBSERVER_CONFIDENTIAL_PORT}" /> value="${EBXML_REGISTRY_WEBSERVER_CONFIDENTIAL_PORT}" />

View file

@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBElement;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
@ -57,7 +59,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/2312013 2191 bphillip Initial implementation * 8/5/2013 2191 bphillip Initial implementation
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -127,9 +129,9 @@ public class ObjectReferenceResolver {
} }
// Check for each reference type // Check for each reference type
if (!isStaticReference(regObj, propertyValue) if (!isStaticReference(propertyValue)
&& !isDynamicReference(regObj, field, propertyValue) && !isDynamicReference(propertyValue)
&& !isRESTReference(regObj, propertyValue)) { && !isRESTReference(propertyValue)) {
continue; continue;
} }
returnMessage.append("Object [").append(regObj.getId()) returnMessage.append("Object [").append(regObj.getId())
@ -171,9 +173,9 @@ public class ObjectReferenceResolver {
} }
// Check for each reference type // Check for each reference type
if (isStaticReference(regObj, propertyValue) if (isStaticReference(propertyValue)
|| isDynamicReference(regObj, field, propertyValue) || isDynamicReference(propertyValue)
|| isRESTReference(regObj, propertyValue)) { || isRESTReference(propertyValue)) {
continue; continue;
} }
returnMessage.append("Object [").append(regObj.getId()) returnMessage.append("Object [").append(regObj.getId())
@ -192,15 +194,17 @@ public class ObjectReferenceResolver {
* Checks if the object specified by ref on the object obj is a static * Checks if the object specified by ref on the object obj is a static
* reference * reference
* *
* @param obj
* The object being checked
* @param ref * @param ref
* The string to check if it is a static reference * The string to check if it is a static reference
* @return true if the item is a static reference and the object exists. * @return true if the item is a static reference and the object exists.
* False if the object is not a static reference * False if the object is not a static reference
*/ */
private boolean isStaticReference(RegistryObjectType obj, String ref) { private boolean isStaticReference(String ref) {
return registryObjectDao.getById(ref) != null; return getStaticReferencedObject(ref) != null;
}
public RegistryObjectType getStaticReferencedObject(String ref) {
return registryObjectDao.getById(ref);
} }
/** /**
@ -221,33 +225,33 @@ public class ObjectReferenceResolver {
* If too many results were returned by the dynamic reference * If too many results were returned by the dynamic reference
* query * query
*/ */
private boolean isDynamicReference(RegistryObjectType obj, private boolean isDynamicReference(String ref) throws MsgRegistryException,
String propertyName, String ref) throws MsgRegistryException,
EbxmlRegistryException { EbxmlRegistryException {
return getDynamicReferencedObject(ref) != null;
}
public RegistryObjectType getDynamicReferencedObject(String ref)
throws EbxmlRegistryException, MsgRegistryException {
DynamicObjectRefType dynamicRef = dynamicRefDao.getById(ref); DynamicObjectRefType dynamicRef = dynamicRefDao.getById(ref);
if (dynamicRef != null) { if (dynamicRef != null) {
QueryType refQuery = dynamicRef.getQuery(); QueryType refQuery = dynamicRef.getQuery();
if (refQuery != null) { if (refQuery != null) {
QueryRequest queryRequest = new QueryRequest(); QueryRequest queryRequest = new QueryRequest();
queryRequest queryRequest.setId("Resolving reference [" + ref + "]");
.setId("Dynamic reference resolution query request");
queryRequest.setComment("Resolving property [" + propertyName
+ " -> " + ref + "] on object [" + obj.getId() + "]");
queryRequest.setQuery(refQuery); queryRequest.setQuery(refQuery);
QueryResponse queryResponse = queryManager QueryResponse queryResponse = queryManager
.executeQuery(queryRequest); .executeQuery(queryRequest);
return responseOk(queryResponse); if (responseOk(queryResponse)) {
return queryResponse.getRegistryObjects().get(0);
}
} }
} }
return false; return null;
} }
/** /**
* Checks if this is a object reference which references a REST service * Checks if this is a object reference which references a REST service
* *
* @param obj
* The object being checked
* @param ref * @param ref
* The value being checked * The value being checked
* @return True if this is a REST reference and the object being referenced * @return True if this is a REST reference and the object being referenced
@ -256,24 +260,40 @@ public class ObjectReferenceResolver {
* If too many results were returned by the REST call or an * If too many results were returned by the REST call or an
* unexpected type was returned by the REST call * unexpected type was returned by the REST call
*/ */
private boolean isRESTReference(RegistryObjectType obj, String ref) private boolean isRESTReference(String ref) throws EbxmlRegistryException {
return getRESTReferencedObject(ref) != null;
}
public RegistryObjectType getRESTReferencedObject(String ref)
throws EbxmlRegistryException { throws EbxmlRegistryException {
RegistryObjectType retVal = null;
if (urlValidator.isValid(ref)) { if (urlValidator.isValid(ref)) {
Object restResponse = RegistryRESTServices Object restResponse = RegistryRESTServices
.accessXMLRestService(ref); .accessXMLRestService(ref);
if (restResponse instanceof QueryResponse) { if (restResponse instanceof QueryResponse) {
return responseOk((QueryResponse) restResponse); QueryResponse queryResponse = (QueryResponse) restResponse;
if (responseOk(queryResponse)) {
retVal = queryResponse.getRegistryObjects().get(0);
}
} else if (restResponse instanceof RegistryObjectType) { } else if (restResponse instanceof RegistryObjectType) {
return true; retVal = (RegistryObjectType) restResponse;
} else { } else if (restResponse instanceof JAXBElement<?>) {
return (RegistryObjectType) ((JAXBElement<?>) restResponse)
.getValue();
}
else {
throw new EbxmlRegistryException("Unexpected response from " throw new EbxmlRegistryException("Unexpected response from "
+ ref + ". Received response of type: " + ref + ". Received response of type: "
+ restResponse.getClass()); + restResponse.getClass());
} }
} else {
return false;
} }
return retVal;
}
public boolean isValidURL(String url) {
return urlValidator.isValid(url);
} }
/** /**

View file

@ -305,7 +305,8 @@ public class RegistrySubscriptionManager implements
.values(); .values();
for (SubscriptionNotificationListeners subNotificationListener : subs) { for (SubscriptionNotificationListeners subNotificationListener : subs) {
SubscriptionType sub = subNotificationListener.subscription; SubscriptionType sub = subscriptionDao
.getById(subNotificationListener.subscription.getId());
try { try {
if (subscriptionShouldRun(sub)) { if (subscriptionShouldRun(sub)) {
try { try {
@ -424,13 +425,14 @@ public class RegistrySubscriptionManager implements
private void processSubscription( private void processSubscription(
final SubscriptionNotificationListeners subscriptionNotificationsListeners) final SubscriptionNotificationListeners subscriptionNotificationsListeners)
throws MsgRegistryException, EbxmlRegistryException { throws MsgRegistryException, EbxmlRegistryException {
updateLastRunTime(subscriptionNotificationsListeners.subscription, SubscriptionType subscription = subscriptionDao
TimeUtil.currentTimeMillis()); .getById(subscriptionNotificationsListeners.subscription
SubscriptionType subscription = subscriptionNotificationsListeners.subscription; .getId());
updateLastRunTime(subscription, TimeUtil.currentTimeMillis());
statusHandler.info("Processing subscription [" + subscription.getId() statusHandler.info("Processing subscription [" + subscription.getId()
+ "]..."); + "]...");
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscriptionNotificationsListeners.subscription); List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
if (!objectsOfInterest.isEmpty()) { if (!objectsOfInterest.isEmpty()) {
notificationManager.sendNotifications( notificationManager.sendNotifications(
subscriptionNotificationsListeners, objectsOfInterest); subscriptionNotificationsListeners, objectsOfInterest);
@ -443,7 +445,8 @@ public class RegistrySubscriptionManager implements
throws MsgRegistryException, EbxmlRegistryException { throws MsgRegistryException, EbxmlRegistryException {
SubscriptionNotificationListeners subscriptionListener = listeners SubscriptionNotificationListeners subscriptionListener = listeners
.get(subscriptionId); .get(subscriptionId);
SubscriptionType subscription = subscriptionListener.subscription; SubscriptionType subscription = subscriptionDao
.getById(subscriptionListener.subscription.getId());
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription); List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
List<AuditableEventType> eventsOfInterest = notificationManager List<AuditableEventType> eventsOfInterest = notificationManager
.getEventsOfInterest(startTime, null, objectsOfInterest); .getEventsOfInterest(startTime, null, objectsOfInterest);

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDes
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 16, 2013 1672 djohnson Extracted from RegistryNotificationManager. * Apr 16, 2013 1672 djohnson Extracted from RegistryNotificationManager.
* 8/28/2013 1538 bphillip Changed to catch a Throwable instead of just EbxmlRegistryException
* *
* </pre> * </pre>
* *
@ -67,7 +68,7 @@ public class WebServiceNotificationListener implements NotificationListener {
public void onNotification(NotificationType notification) { public void onNotification(NotificationType notification) {
try { try {
sendNotificationViaSoap(notification, destination); sendNotificationViaSoap(notification, destination);
} catch (EbxmlRegistryException e) { } catch (Throwable e) {
throw new RuntimeException( throw new RuntimeException(
"Error sending subscription notification.", e); "Error sending subscription notification.", e);
} }

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.uf.edex.registry.ebxml.services.rest; package com.raytheon.uf.edex.registry.ebxml.services.rest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.ws.rs.GET; import javax.ws.rs.GET;
@ -28,12 +27,9 @@ import javax.ws.rs.PathParam;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DeliveryInfoType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -96,41 +92,23 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
if (subscriptions.isEmpty()) { if (subscriptions.isEmpty()) {
statusHandler.info("No subscriptions present for site: " + siteId); statusHandler.info("No subscriptions present for site: " + siteId);
} else { } else {
List<Integer> deliveryInfoKeys = new ArrayList<Integer>();
ObjectRefListType refList = new ObjectRefListType(); ObjectRefListType refList = new ObjectRefListType();
for (SubscriptionType sub : subscriptions) { for (SubscriptionType sub : subscriptions) {
refList.getObjectRef().add(new ObjectRefType(sub.getId())); refList.getObjectRef().add(new ObjectRefType(sub.getId()));
for (DeliveryInfoType deliveryInfo : sub.getDeliveryInfo()) {
deliveryInfoKeys.add(deliveryInfo.getKey());
}
} }
RemoveObjectsRequest removeRequest = new RemoveObjectsRequest(); RemoveObjectsRequest removeRequest = new RemoveObjectsRequest();
removeRequest.setDeleteChildren(true);
removeRequest.setId("Remote subscription removal request for " removeRequest.setId("Remote subscription removal request for "
+ siteId); + siteId);
removeRequest.setComment("Removal of remote subscriptions for " removeRequest.setComment("Removal of remote subscriptions for "
+ siteId); + siteId);
removeRequest.setObjectRefList(refList); removeRequest.setObjectRefList(refList);
try { try {
RegistryResponseType response = lcm lcm.removeObjects(removeRequest);
.removeObjects(removeRequest);
if (response.getStatus().equals(RegistryResponseStatus.SUCCESS)) {
registryObjectDao
.executeHQLStatement(
"DELETE FROM DeliveryInfoType deliveryInfo where deliveryInfo.key in (:keys)",
"keys", deliveryInfoKeys);
statusHandler
.info("Successfully removed subscriptions for site "
+ siteId);
} else {
statusHandler
.info("Failed to remove subscriptions for site "
+ siteId);
}
} catch (Exception e) { } catch (Exception e) {
throw new RegistryException( throw new RegistryException(
"Error removing subscriptions for site " + siteId, e); "Error removing subscriptions for site " + siteId, e);
} }
} }
} }

View file

@ -85,6 +85,12 @@ public class EbxmlObjectUtil {
/** The name of the slot designated to hold the email notification formatter */ /** The name of the slot designated to hold the email notification formatter */
public static final String EMAIL_NOTIFICATION_FORMATTER_SLOT = "urn:oasis:names:tc:ebxml-regrep:rim:DeliveryInfo:emailNotificationFormatter"; public static final String EMAIL_NOTIFICATION_FORMATTER_SLOT = "urn:oasis:names:tc:ebxml-regrep:rim:DeliveryInfo:emailNotificationFormatter";
/**
* The name of the environment variable used to configure which hosts to
* ignore using http
*/
public static final String NON_PROXY_HOSTS = "http.nonProxyHosts";
/** /**
* Slot name of the slot on the subscription object that holds the last run * Slot name of the slot on the subscription object that holds the last run
* time * time

View file

@ -12,10 +12,10 @@
version="2.4"> version="2.4">
<display-name>Data Delivery Web Services</display-name> <display-name>Data Delivery Web Services</display-name>
<context-param> <context-param>
<param-name>webAppRootKey</param-name> <param-name>webAppRootKey</param-name>
<param-value>registryEbxml</param-value> <param-value>registryEbxml</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
@ -23,11 +23,18 @@
</context-param> </context-param>
<listener> <listener>
<listener-class> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener> </listener>
<filter>
<filter-name>QoSFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.QoSFilter</filter-class>
<init-param>
<param-name>maxRequests</param-name>
<param-value>100</param-value>
</init-param>
</filter>
<filter> <filter>
<filter-name>hibernateFilter</filter-name> <filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
@ -45,6 +52,12 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<filter-mapping>
<filter-name>QoSFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet> <servlet>
<servlet-name>RegistryWebServiceServlet</servlet-name> <servlet-name>RegistryWebServiceServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>

View file

@ -15,9 +15,11 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest; import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest;
@Ignore
public abstract class LifecycleManagerTest extends AbstractRegistryTest { public abstract class LifecycleManagerTest extends AbstractRegistryTest {
protected static final String TEST_SLOT_NAME_1 = "Test Slot 1"; protected static final String TEST_SLOT_NAME_1 = "Test Slot 1";