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"?>
<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="geronimo-activation_1.1_spec-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
* ------------ ---------- ----------- --------------------------
* Apr 3, 2013 1786 mpduff Initial creation
* 8/28/2013 1538 bphillip Added nonProxyHosts field
*
* </pre>
*
@ -42,6 +43,8 @@ public class ProxyConfiguration {
private int port;
private String nonProxyHosts;
/**
* Default constructor.
*/
@ -62,6 +65,20 @@ public class ProxyConfiguration {
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
*/
@ -100,4 +117,13 @@ public class ProxyConfiguration {
public String getPortString() {
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
* ------------ ---------- ----------- --------------------------
* Apr 1, 2013 1786 mpduff Initial creation
* 8/28/2013 1538 bphillip Add handling of nonProxyHosts
*
* </pre>
*
@ -49,6 +50,9 @@ public class ProxyUtil {
/** Proxy port environment variable name */
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.
*
@ -57,9 +61,14 @@ public class ProxyUtil {
public static ProxyConfiguration getProxySettings() {
String host = System.getProperty(HTTP_PROXY_HOST);
String port = System.getProperty(HTTP_PROXY_PORT);
String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS);
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;
@ -80,9 +89,14 @@ public class ProxyUtil {
Properties properties = PropertiesUtil.read(proxyFile);
String host = properties.getProperty(HTTP_PROXY_HOST);
String port = properties.getProperty(HTTP_PROXY_PORT);
String nonProxyHosts = properties.getProperty(HTTP_NON_PROXY_HOSTS);
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;

View file

@ -65,7 +65,7 @@ public class Provider implements ISerializableObject {
public enum ServiceType {
// 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,
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
* on the size in lat/lon of the bounding box and the interval in multiples of
* Takes in a WFS request and gives you a nominal byte size based on the
* size in lat/lon of the bounding box and the interval in multiples of
* 5 min intervals.
*
* timeSpan ~ minutes
* latSpan ~ span in degrees of lat for bounding box
* timeSpan ~ minutes latSpan ~ span in degrees of lat for bounding box
* lonSpan ~ span in degrees of lon for bounding box
*
* @param latSpan
@ -101,7 +100,7 @@ public class Provider implements ISerializableObject {
public long getRequestBytesPerLatLonBoxAndTime(double latSpan,
double lonSpan, int timeSpan) {
// 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",
org.springframework;bundle-version="2.5.6",
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,
com.vividsolutions.jts.geom

View file

@ -19,12 +19,12 @@
**/
package com.raytheon.uf.common.registry.services;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException;
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.RegistryResponseType;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.headers.Header;
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.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.raytheon.uf.common.comm.ProxyConfiguration;
import com.raytheon.uf.common.comm.ProxyUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
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
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
* 8/28/2013 1538 bphillip Removed caches, add http client preferences
*
* </pre>
*
@ -98,50 +104,22 @@ public class RegistrySOAPServices {
/** The name of the validator service */
private static final String VALIDATOR_SERVICE_NAME = "validator";
/** Cache of known notification services */
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);
}
});
private static final ProxyConfiguration proxyConfig;
/** Cache of known lifecycle manager services */
private static LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
.build(new CacheLoader<String, LifecycleManager>() {
public LifecycleManager load(String key) {
return getPort(key, LifecycleManager.class);
private static final HTTPClientPolicy httpClientPolicy;
static {
proxyConfig = getProxyConfiguration();
httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setReceiveTimeout(TimeUtil.MILLIS_PER_MINUTE * 2);
httpClientPolicy.setConnectionTimeout(10000);
httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE);
httpClientPolicy.setMaxRetransmits(5);
if (proxyConfig != null) {
httpClientPolicy.setProxyServer(proxyConfig.getHost());
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
}
});
/** Cache of known cataloger services */
private static LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
.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
@ -184,12 +162,7 @@ public class RegistrySOAPServices {
*/
public static NotificationListener getNotificationListenerServiceForUrl(
final String url) throws RegistryServiceException {
try {
return notificationManagerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting notification manager at [" + url + "]", e);
}
return getPort(url, NotificationListener.class);
}
/**
@ -218,12 +191,7 @@ public class RegistrySOAPServices {
*/
public static LifecycleManager getLifecycleManagerServiceForUrl(
final String url) throws RegistryServiceException {
try {
return lifecycleManagerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting lifecycle manager at [" + url + "]", e);
}
return getPort(url, LifecycleManager.class);
}
/**
@ -252,12 +220,7 @@ public class RegistrySOAPServices {
*/
public static Cataloger getCatalogerServiceForUrl(final String url)
throws RegistryServiceException {
try {
return catalogerServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException("Error getting cataloger at ["
+ url + "]", e);
}
return getPort(url, Cataloger.class);
}
/**
@ -285,12 +248,7 @@ public class RegistrySOAPServices {
*/
public static QueryManager getQueryServiceForUrl(final String url)
throws RegistryServiceException {
try {
return queryServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting query manager at [" + url + "]", e);
}
return getPort(url, QueryManager.class);
}
/**
@ -319,12 +277,7 @@ public class RegistrySOAPServices {
*/
public static Validator getValidatorServiceForUrl(final String url)
throws RegistryServiceException {
try {
return validatorServices.get(url);
} catch (ExecutionException e) {
throw new RegistryServiceException("Error getting validator at ["
+ url + "]", e);
}
return getPort(url, Validator.class);
}
/**
@ -387,6 +340,9 @@ public class RegistrySOAPServices {
W3CEndpointReference ref = endpointBuilder.build();
T port = (T) ref.getPort(serviceInterface);
((HTTPConduit) ClientProxy.getClient(port).getConduit())
.setClient(httpClientPolicy);
if (RegistryUtil.LOCAL_REGISTRY_ADDRESS != null) {
List<Header> headerList = new ArrayList<Header>(1);
Header header = null;
@ -403,7 +359,28 @@ public class RegistrySOAPServices {
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext().put(Header.HEADER_LIST,
headerList);
}
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.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
@ -78,7 +77,7 @@ public class NotificationType extends RegistryObjectType {
@XmlElement(name = "Event", required = true)
@DynamicSerializeElement
@ManyToMany(cascade = CascadeType.DETACH)
@ManyToMany(cascade = {})
@JoinTable(schema = "ebxml")
protected List<AuditableEventType> event;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,8 +3,14 @@
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">
<camelContext id="ebxml-notification"
xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<!-- This bean has the name of the processSubscriptionsFromVM endpoint (vm:processSubscriptions)
hard coded due to spring dependency issues. If the endpoint name is changed
here, it must also be changed in this class -->
<bean id="registrySubscriptionManagerInvoker"
class="com.raytheon.uf.edex.registry.ebxml.dao.EsbRouteRegistrySubscriptionManagerInvocation" />
<camelContext id="ebxml-notification" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<endpoint id="processReplicationSubscriptions"
uri="clusteredquartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" />
<route id="processSubscriptionsFromQuartz">
@ -12,7 +18,7 @@
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
</route>
<route id="processSubscriptionsFromVM">
<from uri="vm:processSubscriptions" />
<from uri="vm:processSubscriptions?concurrentConsumers=2" />
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
</route>
</camelContext>

View file

@ -7,8 +7,8 @@
<property name="threadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="1" />
<property name="maxThreads" value="10" />
<property name="minThreads" value="5" />
<property name="maxThreads" value="20" />
</bean>
</property>
@ -16,7 +16,7 @@
<list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<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="confidentialPort"
value="${EBXML_REGISTRY_WEBSERVER_CONFIDENTIAL_PORT}" />

View file

@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List;
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.QueryManager;
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
* ------------ ---------- ----------- --------------------------
* 7/2312013 2191 bphillip Initial implementation
* 8/5/2013 2191 bphillip Initial implementation
* </pre>
*
* @author bphillip
@ -127,9 +129,9 @@ public class ObjectReferenceResolver {
}
// Check for each reference type
if (!isStaticReference(regObj, propertyValue)
&& !isDynamicReference(regObj, field, propertyValue)
&& !isRESTReference(regObj, propertyValue)) {
if (!isStaticReference(propertyValue)
&& !isDynamicReference(propertyValue)
&& !isRESTReference(propertyValue)) {
continue;
}
returnMessage.append("Object [").append(regObj.getId())
@ -171,9 +173,9 @@ public class ObjectReferenceResolver {
}
// Check for each reference type
if (isStaticReference(regObj, propertyValue)
|| isDynamicReference(regObj, field, propertyValue)
|| isRESTReference(regObj, propertyValue)) {
if (isStaticReference(propertyValue)
|| isDynamicReference(propertyValue)
|| isRESTReference(propertyValue)) {
continue;
}
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
* reference
*
* @param obj
* The object being checked
* @param ref
* The string to check if it is a static reference
* @return true if the item is a static reference and the object exists.
* False if the object is not a static reference
*/
private boolean isStaticReference(RegistryObjectType obj, String ref) {
return registryObjectDao.getById(ref) != null;
private boolean isStaticReference(String ref) {
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
* query
*/
private boolean isDynamicReference(RegistryObjectType obj,
String propertyName, String ref) throws MsgRegistryException,
private boolean isDynamicReference(String ref) throws MsgRegistryException,
EbxmlRegistryException {
return getDynamicReferencedObject(ref) != null;
}
public RegistryObjectType getDynamicReferencedObject(String ref)
throws EbxmlRegistryException, MsgRegistryException {
DynamicObjectRefType dynamicRef = dynamicRefDao.getById(ref);
if (dynamicRef != null) {
QueryType refQuery = dynamicRef.getQuery();
if (refQuery != null) {
QueryRequest queryRequest = new QueryRequest();
queryRequest
.setId("Dynamic reference resolution query request");
queryRequest.setComment("Resolving property [" + propertyName
+ " -> " + ref + "] on object [" + obj.getId() + "]");
queryRequest.setId("Resolving reference [" + ref + "]");
queryRequest.setQuery(refQuery);
QueryResponse queryResponse = queryManager
.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
*
* @param obj
* The object being checked
* @param ref
* The value being checked
* @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
* 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 {
RegistryObjectType retVal = null;
if (urlValidator.isValid(ref)) {
Object restResponse = RegistryRESTServices
.accessXMLRestService(ref);
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) {
return true;
} else {
retVal = (RegistryObjectType) restResponse;
} else if (restResponse instanceof JAXBElement<?>) {
return (RegistryObjectType) ((JAXBElement<?>) restResponse)
.getValue();
}
else {
throw new EbxmlRegistryException("Unexpected response from "
+ ref + ". Received response of type: "
+ 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();
for (SubscriptionNotificationListeners subNotificationListener : subs) {
SubscriptionType sub = subNotificationListener.subscription;
SubscriptionType sub = subscriptionDao
.getById(subNotificationListener.subscription.getId());
try {
if (subscriptionShouldRun(sub)) {
try {
@ -424,13 +425,14 @@ public class RegistrySubscriptionManager implements
private void processSubscription(
final SubscriptionNotificationListeners subscriptionNotificationsListeners)
throws MsgRegistryException, EbxmlRegistryException {
updateLastRunTime(subscriptionNotificationsListeners.subscription,
TimeUtil.currentTimeMillis());
SubscriptionType subscription = subscriptionNotificationsListeners.subscription;
SubscriptionType subscription = subscriptionDao
.getById(subscriptionNotificationsListeners.subscription
.getId());
updateLastRunTime(subscription, TimeUtil.currentTimeMillis());
statusHandler.info("Processing subscription [" + subscription.getId()
+ "]...");
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscriptionNotificationsListeners.subscription);
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
if (!objectsOfInterest.isEmpty()) {
notificationManager.sendNotifications(
subscriptionNotificationsListeners, objectsOfInterest);
@ -443,7 +445,8 @@ public class RegistrySubscriptionManager implements
throws MsgRegistryException, EbxmlRegistryException {
SubscriptionNotificationListeners subscriptionListener = listeners
.get(subscriptionId);
SubscriptionType subscription = subscriptionListener.subscription;
SubscriptionType subscription = subscriptionDao
.getById(subscriptionListener.subscription.getId());
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
List<AuditableEventType> eventsOfInterest = notificationManager
.getEventsOfInterest(startTime, null, objectsOfInterest);

View file

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

View file

@ -19,7 +19,6 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services.rest;
import java.util.ArrayList;
import java.util.List;
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.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.ObjectRefType;
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;
@ -96,41 +92,23 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
if (subscriptions.isEmpty()) {
statusHandler.info("No subscriptions present for site: " + siteId);
} else {
List<Integer> deliveryInfoKeys = new ArrayList<Integer>();
ObjectRefListType refList = new ObjectRefListType();
for (SubscriptionType sub : subscriptions) {
refList.getObjectRef().add(new ObjectRefType(sub.getId()));
for (DeliveryInfoType deliveryInfo : sub.getDeliveryInfo()) {
deliveryInfoKeys.add(deliveryInfo.getKey());
}
}
RemoveObjectsRequest removeRequest = new RemoveObjectsRequest();
removeRequest.setDeleteChildren(true);
removeRequest.setId("Remote subscription removal request for "
+ siteId);
removeRequest.setComment("Removal of remote subscriptions for "
+ siteId);
removeRequest.setObjectRefList(refList);
try {
RegistryResponseType response = lcm
.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);
}
lcm.removeObjects(removeRequest);
} catch (Exception e) {
throw new RegistryException(
"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 */
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
* time

View file

@ -23,11 +23,18 @@
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</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-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
@ -45,6 +52,12 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>QoSFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>RegistryWebServiceServlet</servlet-name>
<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 org.junit.Before;
import org.junit.Ignore;
import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest;
@Ignore
public abstract class LifecycleManagerTest extends AbstractRegistryTest {
protected static final String TEST_SLOT_NAME_1 = "Test Slot 1";