Issue #1538 Moved data delivery specific web services out of registry plugins

-- Added registry federation admin page
            -- Made registry service clients non-static

Change-Id: I9672f11b4886019dcd8834b4bae417a0aa4809ad

Former-commit-id: 81991679b4 [formerly 311fa32377] [formerly 98b56cf02a] [formerly 98b56cf02a [formerly a7e53870fb]] [formerly 81991679b4 [formerly 311fa32377] [formerly 98b56cf02a] [formerly 98b56cf02a [formerly a7e53870fb]] [formerly d8de923f8b [formerly 98b56cf02a [formerly a7e53870fb] [formerly d8de923f8b [formerly 0a67c8d68548ed8daa76d782ca3213956b984795]]]]]
Former-commit-id: d8de923f8b
Former-commit-id: 2f601adfcb [formerly e9b49b288f] [formerly 7cb19682c1] [formerly 8a1ff304ef4f59b4d1cabc8ee7e91b05a9ba4f42 [formerly 628fd3115dbabe88f9d202b5257352679e5c521b] [formerly 7cb19682c1 [formerly 221d197c01]]]
Former-commit-id: 31ccf857ac4790adc1ede89930c35b2658cfb03d [formerly 8e5cdd4d72fc495f2978e8dd7305962714cf62b8] [formerly c3f684e7fb [formerly 73c53ed846]]
Former-commit-id: c3f684e7fb
Former-commit-id: 32725adb31
This commit is contained in:
Benjamin Phillippe 2013-10-30 13:37:09 -05:00
parent fa59156200
commit 1106076287
57 changed files with 1329 additions and 475 deletions

View file

@ -24,9 +24,11 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0",
org.apache.commons.codec;bundle-version="1.4.0"
org.apache.commons.codec;bundle-version="1.4.0",
org.apache.commons.cxf;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.common.datadelivery.registry,
com.raytheon.uf.common.datadelivery.registry.ebxml,
com.raytheon.uf.common.datadelivery.registry.handlers
com.raytheon.uf.common.datadelivery.registry.handlers,
com.raytheon.uf.common.datadelivery.registry.web

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry.services.rest;
package com.raytheon.uf.common.datadelivery.registry.web;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@ -34,14 +34,17 @@ import javax.ws.rs.Produces;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation
* 10/30/2013 1538 bphillip Moved data delivery specific servics out of registry plugin
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/registryAvailable")
@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX)
public interface IRegistryAvailableRestService {
public static final String REGISTRY_AVAILABILITY_PATH_PREFIX = "/registryAvailable";
/**
* Method that simply returns a string. This method is called to see if
* registry services are available for a registry

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry.services.rest;
package com.raytheon.uf.common.datadelivery.registry.web;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@ -40,14 +40,17 @@ import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResp
* 9/20/2013 2385 bphillip Added subscription backup functions
* 10/8/2013 1682 bphillip Added rest functions for use with the query web interface
* 10/23/2013 2385 bphillip restoreSubscriptions throws JAXBException
* 10/30/2013 1538 bphillip Moved data delivery specific servics out of registry plugin
* </pre>
*
* @author bphillip
* @version 1
*/
@Path(IRegistryDataAccessService.DATA_ACCESS_PATH_PREFIX)
public interface IRegistryDataAccessService {
public static final String DATA_ACCESS_PATH_PREFIX = "/rest/dataAccess/";
/** Root path to this set of services */
public static final String DATA_ACCESS_PATH_PREFIX = "/dataAccess";
/**
* Gets the ids of registry objects of the given object type
@ -57,7 +60,7 @@ public interface IRegistryDataAccessService {
* @return List of ids for registry objects of the given type
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getRegistryObjectIds/{objectType}")
@Path("getRegistryObjectIds/{objectType}")
public RestCollectionResponse<String> getRegistryObjectIdsOfType(
@PathParam("objectType") String objectType);
@ -67,7 +70,7 @@ public interface IRegistryDataAccessService {
* @return The query definitions currently contained in the registry
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getQueries")
@Path("getQueries")
public String getValidQueries();
/**
@ -78,7 +81,7 @@ public interface IRegistryDataAccessService {
* @return The parameters for a given query definition
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getParametersForQuery/{queryId}")
@Path("getParametersForQuery/{queryId}")
public String getParametersForQuery(@PathParam("queryId") String queryId);
/**
@ -90,7 +93,7 @@ public interface IRegistryDataAccessService {
* If errors occur while removing the subscriptions
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "removeSubscriptionsFor/{siteId}")
@Path("removeSubscriptionsFor/{siteId}")
public void removeSubscriptionsForSite(@PathParam("siteId") String siteId)
throws RegistryException;
@ -101,7 +104,7 @@ public interface IRegistryDataAccessService {
* @return The page containing the subscriptions
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getSubscriptions")
@Path("getSubscriptions")
public String getSubscriptions();
/**
@ -113,7 +116,7 @@ public interface IRegistryDataAccessService {
* @return Status message about whether the backup was successful
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "backupSubscription/{subscriptionName}")
@Path("backupSubscription/{subscriptionName}")
public String backupSubscription(
@PathParam("subscriptionName") String subscriptionName);
@ -123,7 +126,7 @@ public interface IRegistryDataAccessService {
* @return Status message about whether the backup was successful
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "backupAllSubscriptions/")
@Path("backupAllSubscriptions/")
public String backupAllSubscriptions();
/**
@ -134,7 +137,7 @@ public interface IRegistryDataAccessService {
* @return Status message about whether the backup was successful
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscription/{subscriptionName}")
@Path("restoreSubscription/{subscriptionName}")
public String restoreSubscription(
@PathParam("subscriptionName") String subscriptionName);
@ -144,7 +147,7 @@ public interface IRegistryDataAccessService {
* @return Status messages relating to the success or failure of the restore
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscriptions/")
@Path("restoreSubscriptions/")
public String restoreSubscriptions();
/**
@ -153,7 +156,7 @@ public interface IRegistryDataAccessService {
* @return Status message
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "clearSubscriptionBackupFiles/")
@Path("clearSubscriptionBackupFiles/")
public String clearSubscriptionBackupFiles();
}

View file

@ -1,57 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
/**
*
* Web service interface accessible to process Thrift serialized server requests
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/3/2013 1948 bphillip Initial implementation
* </pre>
*
* @author bphillip
* @version 1
*/
@WebService(serviceName = "RegistryRequestService")
@SOAPBinding(style = Style.RPC)
public interface IRegistryRequestService {
/**
* Process the Thrift serialized request and return the Thrift serialized
* response
*
* @param data
* The Thrift serialized request
* @return The Thrift serialized response
*/
@WebMethod
public byte[] request(byte[] data);
}

View file

@ -1,80 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
/**
*
*
* Service class for submitting registry requests to the EDEX ebxml registry via
* JAX-WS
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/3/2013 1948 bphillip Initial implementation
* </pre>
*
* @author bphillip
* @version 1
*/
public class RegistryRequestService extends Service {
/** The service name */
private static final QName SERVICE_NAME = new QName(
"http://registry.common.uf.raytheon.com/", "RegistryRequestService");
/** The location of the wsdl */
private static final String WSDL_LOCATION = "/registryRequest?wsdl";
/**
* Creates a new RegistryRequestService service residing on the given server
* on the given port
*
* @param server
* The server
* @param port
* The port number
* @throws MalformedURLException
* If errors occur constructing the service URL
*/
public RegistryRequestService(String server, String port)
throws MalformedURLException {
super(new URL("http://" + server + ":" + port + WSDL_LOCATION),
SERVICE_NAME);
}
/**
* Gets the IRegistryRequestService port
*
* @return The IRegistryRequestService port
*/
public IRegistryRequestService getService() {
return super.getPort(IRegistryRequestService.class);
}
}

View file

@ -30,7 +30,6 @@ import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.cxf.jaxrs.client.Client;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
@ -40,14 +39,9 @@ import com.google.common.cache.LoadingCache;
import com.google.common.io.Resources;
import com.raytheon.uf.common.registry.RegistryJaxbManager;
import com.raytheon.uf.common.registry.RegistryNamespaceMapper;
import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService;
import com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService;
import com.raytheon.uf.common.registry.services.rest.IRegistryObjectsRestService;
import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
*
@ -63,6 +57,7 @@ import com.raytheon.uf.common.status.UFStatus;
* 7/29/2013 2191 bphillip Implemented registry data access service
* 8/1/2013 1693 bphillip Modified getregistry objects method to correctly handle response
* 9/5/2013 1538 bphillip Changed cache expiration timeout and added http header
* 10/30/2013 1538 bphillip Moved data delivery services out of registry plugin
* </pre>
*
* @author bphillip
@ -70,56 +65,32 @@ import com.raytheon.uf.common.status.UFStatus;
*/
public class RegistryRESTServices {
private static final String REGISTRY_REST_SERVICE_PATH = "/rest";
/** Map of known registry object request services */
private static LoadingCache<String, IRegistryObjectsRestService> registryObjectServiceMap = CacheBuilder
private LoadingCache<String, IRegistryObjectsRestService> registryObjectServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRegistryObjectsRestService>() {
public IRegistryObjectsRestService load(String url) {
return getPort(url, IRegistryObjectsRestService.class);
return getPort(url + REGISTRY_REST_SERVICE_PATH,
IRegistryObjectsRestService.class);
}
});
/** Map of known repository item request services */
private static LoadingCache<String, IRepositoryItemsRestService> repositoryItemServiceMap = CacheBuilder
private LoadingCache<String, IRepositoryItemsRestService> repositoryItemServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRepositoryItemsRestService>() {
public IRepositoryItemsRestService load(String url) {
return getPort(url, IRepositoryItemsRestService.class);
return getPort(url + REGISTRY_REST_SERVICE_PATH,
IRepositoryItemsRestService.class);
}
});
/** Map of known registry availability services */
private static LoadingCache<String, IRegistryAvailableRestService> registryAvailabilityServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRegistryAvailableRestService>() {
public IRegistryAvailableRestService load(String url) {
return getPort(url, IRegistryAvailableRestService.class);
}
});
private RegistryJaxbManager jaxbManager;
/** Map of known registry data access services */
private static LoadingCache<String, IRegistryDataAccessService> registryDataAccessServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRegistryDataAccessService>() {
public IRegistryDataAccessService load(String url) {
return getPort(url, IRegistryDataAccessService.class);
}
});
/**
* The logger
*/
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryRESTServices.class);
private static RegistryJaxbManager jaxbManager;
static {
try {
public RegistryRESTServices() throws JAXBException {
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
} catch (JAXBException e) {
statusHandler.error("Error creating Registry jaxb manager!", e);
}
}
/**
@ -129,8 +100,7 @@ public class RegistryRESTServices {
* The base URL of the registry
* @return The service implementation
*/
public static IRegistryObjectsRestService getRegistryObjectService(
String baseURL) {
public IRegistryObjectsRestService getRegistryObjectService(String baseURL) {
try {
return registryObjectServiceMap.get(baseURL);
} catch (ExecutionException e) {
@ -153,7 +123,7 @@ public class RegistryRESTServices {
* If errors occur while serializing the object
*/
@SuppressWarnings("unchecked")
public static <T extends RegistryObjectType> T getRegistryObject(
public <T extends RegistryObjectType> T getRegistryObject(
Class<T> expectedType, String baseURL, String objectId)
throws JAXBException, RegistryServiceException {
String objStr = getRegistryObjectService(baseURL).getRegistryObject(
@ -172,8 +142,7 @@ public class RegistryRESTServices {
* The base URL of the registry
* @return The service implementation
*/
public static IRepositoryItemsRestService getRepositoryItemService(
String baseURL) {
public IRepositoryItemsRestService getRepositoryItemService(String baseURL) {
try {
return repositoryItemServiceMap.get(baseURL);
} catch (ExecutionException e) {
@ -191,75 +160,11 @@ public class RegistryRESTServices {
* The id of the object
* @return The repository item
*/
public static byte[] getRepositoryItem(String baseURL,
String repositoryItemId) {
public byte[] getRepositoryItem(String baseURL, String repositoryItemId) {
return getRepositoryItemService(baseURL).getRepositoryItem(
repositoryItemId);
}
/**
* Gets the registry available service implementation
*
* @param baseURL
* The base URL of the registry
* @return THe registry available service implementation
*/
public static IRegistryAvailableRestService getRegistryAvailableService(
String baseURL) {
try {
return registryAvailabilityServiceMap.get(baseURL);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting Registry Availability Rest Service", e);
}
}
/**
* Check if the registry at the given URL is available
*
* @param baseURL
* The base URL of the registry
* @return True if the registry services are available
*/
public static boolean isRegistryAvailable(String baseURL) {
String response = null;
try {
response = getRegistryAvailableService(baseURL)
.isRegistryAvailable();
if (RegistryAvailability.AVAILABLE.equals(response)) {
return true;
} else {
statusHandler.info("Registry at [" + baseURL
+ "] not available: " + response);
}
return RegistryAvailability.AVAILABLE.equals(response);
} catch (Throwable t) {
if (response == null) {
response = ExceptionUtils.getRootCauseMessage(t);
}
statusHandler.error("Registry at [" + baseURL + "] not available: "
+ response);
return false;
}
}
/**
* Gets the data access service for the specified registry URL
*
* @param baseURL
* The baseURL of the registry
* @return The data access service for the specified registry URL
*/
public static IRegistryDataAccessService getRegistryDataAccessService(
String baseURL) {
try {
return registryDataAccessServiceMap.get(baseURL);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting Registry Availability Rest Service", e);
}
}
/**
* Accesses a rest service at the provided URL. This method is primarily
* used for resolving remote object references which use a REST service
@ -268,7 +173,7 @@ public class RegistryRESTServices {
* The URL of the rest service
* @return
*/
public static Object accessXMLRestService(String url) {
public Object accessXMLRestService(String url) {
String response = null;
try {
response = Resources
@ -286,8 +191,7 @@ public class RegistryRESTServices {
}
}
private static <T extends Object> T getPort(String url,
Class<T> serviceClass) {
protected <T extends Object> T getPort(String url, Class<T> serviceClass) {
T service = JAXRSClientFactory.create(url, serviceClass);
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
// Create HTTP header containing the calling registry

View file

@ -75,6 +75,7 @@ import com.raytheon.uf.common.status.UFStatus;
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
* 8/28/2013 1538 bphillip Removed caches, add http client preferences
* 9/5/2013 1538 bphillip Add HTTP header information
* 10/30/2013 1538 bphillip Made methods in this class non-static
*
* </pre>
*
@ -143,7 +144,7 @@ public class RegistrySOAPServices {
}
/** Cache of known notification services */
private static LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
private LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, NotificationListener>() {
public NotificationListener load(String key) {
@ -152,7 +153,7 @@ public class RegistrySOAPServices {
});
/** Cache of known lifecycle manager services */
private static LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
private LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, LifecycleManager>() {
public LifecycleManager load(String key) {
@ -161,7 +162,7 @@ public class RegistrySOAPServices {
});
/** Cache of known cataloger services */
private static LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
private LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, Cataloger>() {
public Cataloger load(String key) {
@ -170,7 +171,7 @@ public class RegistrySOAPServices {
});
/** Cache of known query services */
private static LoadingCache<String, QueryManager> queryServices = CacheBuilder
private LoadingCache<String, QueryManager> queryServices = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, QueryManager>() {
public QueryManager load(String key) {
@ -179,7 +180,7 @@ public class RegistrySOAPServices {
});
/** Cache of known validator services */
private static LoadingCache<String, Validator> validatorServices = CacheBuilder
private LoadingCache<String, Validator> validatorServices = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, Validator>() {
public Validator load(String key) {
@ -196,7 +197,7 @@ public class RegistrySOAPServices {
* @throws MalformedURLException
* If errors occur creating the URL object
*/
public static String getNotificationListenerServiceUrl(final String baseURL)
public String getNotificationListenerServiceUrl(final String baseURL)
throws MalformedURLException {
return new URL(baseURL + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME)
.toString();
@ -211,7 +212,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static NotificationListener getNotificationListenerServiceForHost(
public NotificationListener getNotificationListenerServiceForHost(
final String host) throws RegistryServiceException {
return getNotificationListenerServiceForUrl(host + PATH_SEPARATOR
+ NOTIFICATION_SERVICE_NAME);
@ -226,7 +227,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static NotificationListener getNotificationListenerServiceForUrl(
public NotificationListener getNotificationListenerServiceForUrl(
final String url) throws RegistryServiceException {
try {
return notificationManagerServices.get(url);
@ -245,8 +246,8 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static LifecycleManager getLifecycleManagerServiceForHost(
final String host) throws RegistryServiceException {
public LifecycleManager getLifecycleManagerServiceForHost(final String host)
throws RegistryServiceException {
return getLifecycleManagerServiceForUrl(host + PATH_SEPARATOR
+ LIFECYCLE_MANAGER_SERVICE_NAME);
}
@ -260,8 +261,8 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static LifecycleManager getLifecycleManagerServiceForUrl(
final String url) throws RegistryServiceException {
public LifecycleManager getLifecycleManagerServiceForUrl(final String url)
throws RegistryServiceException {
try {
return lifecycleManagerServices.get(url);
} catch (ExecutionException e) {
@ -279,7 +280,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static Cataloger getCatalogerServiceForHost(final String host)
public Cataloger getCatalogerServiceForHost(final String host)
throws RegistryServiceException {
return getCatalogerServiceForUrl(host + PATH_SEPARATOR
+ CATALOGER_SERVICE_NAME);
@ -294,7 +295,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static Cataloger getCatalogerServiceForUrl(final String url)
public Cataloger getCatalogerServiceForUrl(final String url)
throws RegistryServiceException {
try {
return catalogerServices.get(url);
@ -313,7 +314,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static QueryManager getQueryServiceForHost(final String host)
public QueryManager getQueryServiceForHost(final String host)
throws RegistryServiceException {
return getQueryServiceForUrl(host + PATH_SEPARATOR + QUERY_SERVICE_NAME);
}
@ -327,7 +328,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static QueryManager getQueryServiceForUrl(final String url)
public QueryManager getQueryServiceForUrl(final String url)
throws RegistryServiceException {
try {
return queryServices.get(url);
@ -346,7 +347,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static Validator getValidatorServiceForHost(final String host)
public Validator getValidatorServiceForHost(final String host)
throws RegistryServiceException {
return getValidatorServiceForUrl(host + PATH_SEPARATOR
+ VALIDATOR_SERVICE_NAME);
@ -361,7 +362,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur creating the URL object
*/
public static Validator getValidatorServiceForUrl(final String url)
public Validator getValidatorServiceForUrl(final String url)
throws RegistryServiceException {
try {
return validatorServices.get(url);
@ -383,7 +384,7 @@ public class RegistrySOAPServices {
* @throws RegistryServiceException
* If errors occur during request submission
*/
public static void sendSubmitObjectsRequest(SubmitObjectsRequest request,
public void sendSubmitObjectsRequest(SubmitObjectsRequest request,
String host) throws RegistryServiceException {
LifecycleManager lcm;
@ -423,7 +424,7 @@ public class RegistrySOAPServices {
}
@SuppressWarnings("unchecked")
private static <T extends Object> T getPort(String serviceUrl,
private <T extends Object> T getPort(String serviceUrl,
Class<?> serviceInterface) throws RegistryServiceException {
W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder();
endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL);

View file

@ -39,12 +39,13 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryExceptio
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation
* 10/30/2013 1538 bphillip Changed REST path
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/search")
@Path("/search")
public interface IQueryProtocolRestService {
/**

View file

@ -36,12 +36,13 @@ import javax.xml.bind.JAXBException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation
* 10/30/2013 1538 bphillip Changed REST service paths
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/registryObjects/{objectId}")
@Path("/registryObjects/{objectId}")
public interface IRegistryObjectsRestService {
/**

View file

@ -35,12 +35,13 @@ import javax.ws.rs.Produces;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation
* 10/30/2013 1538 bphillip Changed REST service paths
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/repositoryItems/{repositoryItemId}")
@Path("/repositoryItems/{repositoryItemId}")
public interface IRepositoryItemsRestService {
@GET

View file

@ -17,4 +17,8 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
org.springframework;bundle-version="2.5.6",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
com.google.guava;bundle-version="1.0.0"
com.google.guava;bundle-version="1.0.0",
org.apache.commons.cxf;bundle-version="1.0.0",
org.reflections;bundle-version="0.9.9",
com.raytheon.uf.common.datadelivery.registry;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0"

View file

@ -3,7 +3,6 @@
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">
<bean name="replicationConfigFileName" class="java.lang.String">
<constructor-arg value="ebxml/notification/notificationServers_NCF.xml" />
</bean>
<bean id="dataDeliveryRestClient" class="com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices"/>
</beans>

View file

@ -11,5 +11,6 @@
<constructor-arg ref="RegistryReplicationManager"/>
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="registryDao" ref="registryDao"/>
<property name="registrySoapServices" ref="registryWebServiceClient"/>
</bean>
</beans>

View file

@ -9,9 +9,10 @@
<constructor-arg ref="lcmServiceImpl" />
<constructor-arg value="ebxml/federation/federationConfig.xml"/>
<constructor-arg ref="RegistryReplicationManager"/>
<constructor-arg value="${NCF_ADDRESS}" />
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="registryDao" ref="registryDao"/>
<property name="txTemplate" ref="metadataTxTemplate"/>
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
<property name="registrySoapServices" ref="registryWebServiceClient"/>
</bean>
</beans>

View file

@ -1,9 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
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
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean name="replicationConfigFileName" class="java.lang.String">
<constructor-arg value="ebxml/notification/notificationServers_WFO.xml" />
</bean>
</beans>

View file

@ -10,11 +10,11 @@
<bean id="RegistryReplicationManager" class="com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager">
<constructor-arg ref="ebxmlSubscriptionsEnabled"/>
<constructor-arg ref="replicationConfigFileName"/>
<constructor-arg ref="registryObjectDao"/>
<constructor-arg ref="FederatedRegistryMonitor"/>
<constructor-arg ref="metadataTxTemplate"/>
<constructor-arg value="${ebxml-federation-sync-threads}"/>
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
<property name="registrySoapClient" ref="registryWebServiceClient"/>
</bean>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

View file

@ -0,0 +1,47 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:res/spring/registry-datadelivery.xml" />
<import resource="classpath:res/spring/registry-replication-datadelivery.xml"/>
<bean id="registryDataAccessService"
class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryDataAccessService">
<property name="registryObjectDao" ref="registryObjectDao" />
<property name="lcm" ref="lcmServiceImpl" />
<property name="queryDefinitionDao" ref="queryDefinitionDao" />
</bean>
<bean id="registryAvailabilityService"
class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryAvailableRestService" />
<bean id="registryStatus" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryFederationStatus">
<property name="registryDao" ref="registryDao"/>
<property name="subscriptionDao" ref="subscriptionTypeDao"/>
<property name="replicationManager" ref="RegistryReplicationManager"/>
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
<property name="registrySoapServices" ref="registryWebServiceClient"/>
</bean>
<!-- REST Service Definitions -->
<jaxrs:server id="dataDeliveryRestServices" address="/dataDelivery">
<jaxrs:inInterceptors>
<ref bean="webServiceInInterceptor" />
</jaxrs:inInterceptors>
<jaxrs:serviceBeans>
<ref bean="registryDataAccessService" />
<ref bean="registryAvailabilityService" />
<ref bean="registryStatus"/>
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>

View file

@ -26,10 +26,14 @@ import java.util.List;
import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
@ -54,6 +58,7 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
* ------------ ---------- ----------- --------------------------
* 5/22/2013 1707 bphillip Initial implementation
* 7/29/2013 2191 bphillip Implemented registry sync for registries that have been down for an extended period of time
* 10/30/2013 1538 bphillip Override submitObjects method
* </pre>
*
* @author bphillip
@ -124,6 +129,21 @@ public class NcfRegistryFederationManager extends RegistryFederationManager
}
}
protected void submitObjects(List<RegistryObjectType> objects)
throws EbxmlRegistryException {
SubmitObjectsRequest submitObjectsRequest2 = new SubmitObjectsRequest(
"Federation Objects submission",
"Submitting federation related objects", null,
new RegistryObjectListType(objects), false,
Mode.CREATE_OR_REPLACE);
try {
lcm.submitObjects(submitObjectsRequest2);
} catch (MsgRegistryException e) {
throw new EbxmlRegistryException(
"Error submitting federation objects to registry", e);
}
}
protected FederationType getFederation() throws EbxmlRegistryException {
FederationType federation = new FederationType();
federation.setId(FEDERATION_ID);

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -66,6 +67,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* ------------ ---------- ----------- --------------------------
* 5/22/2013 1707 bphillip Initial implementation
* 7/29/2013 2191 bphillip Implemented registry sync for registries that have been down for an extended period of time
* 10/30/2013 1538 bphillip Changed submitObjects method to submit objects to NCF by default
* </pre>
*
* @author bphillip
@ -79,6 +81,9 @@ public abstract class RegistryFederationManager {
protected static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryFederationManager.class);
/** The address of the NCF */
protected String ncfAddress = System.getenv("NCF_ADDRESS");
/**
* The scheduler service used for registering this registry with the
* federation
@ -109,6 +114,9 @@ public abstract class RegistryFederationManager {
/** Data Access object for RegistryType objects */
protected RegistryDao registryDao;
/** Registry SOAP Service Client */
protected RegistrySOAPServices registrySoapServices;
/**
* Gets the federation object for this federation
*
@ -195,6 +203,16 @@ public abstract class RegistryFederationManager {
return association;
}
/**
* Submits objects necessary for the registry/federation to operate properly
* to the registry. This method first submits it locally, then submits the
* objects to the NCF
*
* @param objects
* The objects to submit
* @throws EbxmlRegistryException
* If object submission fails
*/
protected void submitObjects(List<RegistryObjectType> objects)
throws EbxmlRegistryException {
SubmitObjectsRequest submitObjectsRequest2 = new SubmitObjectsRequest(
@ -209,6 +227,14 @@ public abstract class RegistryFederationManager {
"Error submitting federation objects to registry", e);
}
try {
registrySoapServices.getLifecycleManagerServiceForHost(ncfAddress)
.submitObjects(submitObjectsRequest2);
} catch (MsgRegistryException e) {
throw new EbxmlRegistryException(
"Error submitting federation objects to registry", e);
}
}
public void setRegistryObjectDao(RegistryObjectDao registryObjectDao) {
@ -219,4 +245,9 @@ public abstract class RegistryFederationManager {
this.registryDao = registryDao;
}
public void setRegistrySoapServices(
RegistrySOAPServices registrySoapServices) {
this.registrySoapServices = registrySoapServices;
}
}

View file

@ -47,12 +47,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -70,6 +69,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
* 5/22/2013 1707 bphillip Initial implementation
* 7/29/2013 2191 bphillip Implemented registry sync for registries that have been down for an extended period of time
* 10/20/2013 1682 bphillip Fixed query invocation
* 10/30/2013 1538 bphillip This class now uses non-static rest/soap clients
* </pre>
*
* @author bphillip
@ -80,12 +80,12 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
public class WfoRegistryFederationManager extends RegistryFederationManager
implements RegistryInitializedListener {
/** The address of the NCF */
private String ncfAddress;
/** The transaction template used to manually handle transactions */
private TransactionTemplate txTemplate;
/** Data Delivery rest client services */
private DataDeliveryRESTServices dataDeliveryRestClient;
/**
* Creates a new WfoRegistryFederationManager
*/
@ -112,11 +112,10 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
*/
protected WfoRegistryFederationManager(boolean federationEnabled,
LifecycleManager lcm, String federationPropertiesFileName,
RegistryReplicationManager replicationManager, String ncfAddress)
RegistryReplicationManager replicationManager)
throws JAXBException, IOException, SerializationException {
super(federationEnabled, lcm, federationPropertiesFileName,
replicationManager);
this.ncfAddress = ncfAddress;
if (this.replicationManager.getServers() == null
|| CollectionUtil.isNullOrEmpty(replicationManager.getServers()
.getRegistryReplicationServers())) {
@ -198,7 +197,7 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
request.setQuery(query);
QueryResponse response = null;
try {
response = RegistrySOAPServices.getQueryServiceForHost(ncfAddress)
response = registrySoapServices.getQueryServiceForHost(ncfAddress)
.executeQuery(request);
} catch (Exception e) {
throw new EbxmlRegistryException(
@ -253,7 +252,7 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
if (!success) {
try {
try {
if (RegistryRESTServices
if (dataDeliveryRestClient
.isRegistryAvailable(ncfAddress)) {
statusHandler
.info("NCF Registry is available. Attempting to join federation...");
@ -285,4 +284,9 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
this.txTemplate = txTemplate;
}
public void setDataDeliveryRestClient(
DataDeliveryRESTServices dataDeliveryRestClient) {
this.dataDeliveryRestClient = dataDeliveryRestClient;
}
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.edex.datadelivery.registry.replication;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@ -41,6 +42,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* 4/9/2013 1802 bphillip Initial implementation
* 5/21/2013 1707 bphillip Removed unused fields
* 6/4/2013 1707 bphillip Renamed and changed fields for clarity
* 10/30/2013 1538 bphillip getRegistryReplicationServers returns empty list if no servers are specified
* </pre>
*
* @author bphillip
@ -55,6 +57,9 @@ public class NotificationServers {
private List<NotificationHostConfiguration> registryReplicationServers;
public List<NotificationHostConfiguration> getRegistryReplicationServers() {
if (registryReplicationServers == null) {
registryReplicationServers = new ArrayList<NotificationHostConfiguration>();
}
return registryReplicationServers;
}

View file

@ -23,6 +23,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@ -41,7 +42,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DeliveryInfoType;
@ -60,7 +60,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.RegistryException;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
@ -70,15 +76,16 @@ import com.raytheon.uf.common.registry.constants.QueryLanguages;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistryMonitor;
import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.exception.NoReplicationServersAvailableException;
@ -101,6 +108,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 8/1/2013 1693 bphillip Switch to use rest service instead of query manager for federation synchronization
* 9/5/2013 1538 bphillip Changed when the registry availability monitor is started
* 10/20/2013 1682 bphillip Fixed query invocation
* 10/30/2013 1538 bphillip Changed method visibility, added add/remove/save notification servers and updated to use non-static rest/soap clients
* </pre>
*
* @author bphillip
@ -147,12 +155,19 @@ public class RegistryReplicationManager {
/**
* When a federation sync is necessary, this is the number of threads that
* will be used for synchronization. Configurable in the
* com.raytheon.uf.edex.registry.ebxml.properties file. Default is 25
* com.raytheon.uf.edex.registry.ebxml.properties file. Default is 5
*/
private int registrySyncThreads = 5;
/** Maximum times this registry will try to sync data before failure */
private int maxSyncRetries = 3;
/** Data Delivery REST services client */
private DataDeliveryRESTServices dataDeliveryRestClient;
/** REgistry Soap client */
private RegistrySOAPServices registrySoapClient;
/**
* Creates a new RegistryReplicationManager
*
@ -166,16 +181,23 @@ public class RegistryReplicationManager {
* @throws MalformedURLException
*/
public RegistryReplicationManager(boolean subscriptionProcessingEnabled,
String notificationServerConfigFileName, RegistryObjectDao dao,
RegistryObjectDao dao,
FederatedRegistryMonitor availabilityMonitor,
TransactionTemplate txTemplate, int registrySyncThreads)
throws JAXBException, SerializationException, MalformedURLException {
TransactionTemplate txTemplate) throws JAXBException,
SerializationException, MalformedURLException {
this.subscriptionProcessingEnabled = subscriptionProcessingEnabled;
this.replicationConfigFileName = notificationServerConfigFileName;
if (System.getProperty("edex.run.mode").equals("centralRegistry")) {
this.replicationConfigFileName = "ebxml/notification/notificationServers_NCF.xml";
} else {
this.replicationConfigFileName = "ebxml/notification/notificationServers_WFO.xml";
}
this.dao = dao;
this.txTemplate = txTemplate;
this.federatedRegistryMonitor = availabilityMonitor;
this.registrySyncThreads = registrySyncThreads;
if (System.getProperty("ebxml-federation-sync-threads") != null) {
registrySyncThreads = Integer.valueOf(System
.getProperty("ebxml-federation-sync-threads"));
}
jaxbManager = new JAXBManager(NotificationServers.class,
SubscriptionType.class);
File notificationServerConfigFile = PathManagerFactory.getPathManager()
@ -187,11 +209,68 @@ public class RegistryReplicationManager {
this.subscriptionProcessingEnabled = false;
return;
}
servers = (NotificationServers) jaxbManager
.unmarshalFromXmlFile(notificationServerConfigFile);
servers = jaxbManager.unmarshalFromXmlFile(NotificationServers.class,
notificationServerConfigFile);
scheduler = Executors.newSingleThreadScheduledExecutor();
}
/**
* Removes a notificationServer based on the URL.
*
* @param baseURL
* The URL of the server to be removed
*/
public void removeNotificationServer(String baseURL) {
NotificationHostConfiguration toRemove = null;
for (NotificationHostConfiguration hostConfig : this.servers
.getRegistryReplicationServers()) {
if (hostConfig.getRegistryBaseURL().equals(baseURL)) {
toRemove = hostConfig;
}
}
if (toRemove != null) {
this.servers.getRegistryReplicationServers().remove(toRemove);
}
}
/**
* Adds a notification server to the list.
*
* @param host
* The host to be added
*/
public void addNotificationServer(NotificationHostConfiguration host) {
for (NotificationHostConfiguration hostConfig : this.servers
.getRegistryReplicationServers()) {
if (hostConfig.getRegistryBaseURL().equals(
host.getRegistryBaseURL())) {
return;
}
}
this.servers.getRegistryReplicationServers().add(host);
}
/**
* Persists the list of notification servers to the localized file
*/
public void saveNotificationServers() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.EDEX_STATIC,
LocalizationLevel.CONFIGURED);
LocalizationFile lf = pm.getLocalizationFile(lc,
this.replicationConfigFileName);
File file = lf.getFile();
try {
jaxbManager.marshalToXmlFile(this.servers, file.getAbsolutePath());
lf.save();
} catch (SerializationException e) {
statusHandler.error("Unable to update replication server file!", e);
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
}
}
/**
* Checks how long a registry has been down. If the registry has been down
* for over 2 days, the registry is synchronized with one of the federation
@ -234,7 +313,8 @@ public class RegistryReplicationManager {
statusHandler
.info("Checking availability of registry at: "
+ config.getRegistryBaseURL());
if (RegistryRESTServices.isRegistryAvailable(config
if (dataDeliveryRestClient
.isRegistryAvailable(config
.getRegistryBaseURL())) {
registryToSyncFrom = config;
break;
@ -281,8 +361,16 @@ public class RegistryReplicationManager {
TimeUnit.MINUTES);
}
private void synchronizeRegistryWithFederation(String remoteRegistryUrl)
throws MsgRegistryException, EbxmlRegistryException {
/**
* Synchronizes this registry's data with the registry at the specified URL
*
* @param remoteRegistryUrl
* The URL of the registry to sync with
* @throws EbxmlRegistryException
* If the thread executor fails to shut down properly
*/
public void synchronizeRegistryWithFederation(String remoteRegistryUrl)
throws EbxmlRegistryException {
ExecutorService executor = Executors
.newFixedThreadPool(this.registrySyncThreads);
for (String objectType : objectTypes) {
@ -290,7 +378,7 @@ public class RegistryReplicationManager {
Set<String> remoteIds = new HashSet<String>();
statusHandler
.info("Getting registry object Ids from local registry...");
Collection<String> response = RegistryRESTServices
Collection<String> response = dataDeliveryRestClient
.getRegistryDataAccessService(
RegistryUtil.LOCAL_REGISTRY_ADDRESS)
.getRegistryObjectIdsOfType(objectType).getPayload();
@ -301,7 +389,7 @@ public class RegistryReplicationManager {
+ objectType + " present in local registry.");
statusHandler.info("Getting registry object Ids from "
+ remoteRegistryUrl + "...");
response = RegistryRESTServices
response = dataDeliveryRestClient
.getRegistryDataAccessService(remoteRegistryUrl)
.getRegistryObjectIdsOfType(objectType).getPayload();
if (response != null) {
@ -321,7 +409,7 @@ public class RegistryReplicationManager {
for (String localId : localIds) {
if (remoteIds.contains(localId)) {
executor.submit(new RegistrySubmitTask(txTemplate, dao,
localId, remoteRegistryUrl));
localId, remoteRegistryUrl, dataDeliveryRestClient));
} else {
RegistryRemoveTask removeTask = new RegistryRemoveTask(
txTemplate, dao, localId);
@ -337,7 +425,7 @@ public class RegistryReplicationManager {
for (String remoteId : remoteIds) {
if (!localIds.contains(remoteId)) {
executor.submit(new RegistrySubmitTask(txTemplate, dao,
remoteId, remoteRegistryUrl));
remoteId, remoteRegistryUrl, dataDeliveryRestClient));
}
}
}
@ -438,8 +526,8 @@ public class RegistryReplicationManager {
* The object describing the destination server to make registry
* replication subscriptions to
*/
private void submitSubscriptionsToHost(
NotificationHostConfiguration config, RegistryType localRegistry) {
public void submitSubscriptionsToHost(NotificationHostConfiguration config,
RegistryType localRegistry) {
statusHandler
.info("Generating registry replication subscriptions for registry at ["
+ config.getRegistrySiteName()
@ -462,7 +550,7 @@ public class RegistryReplicationManager {
"Subscription Submission", "Subscription Submission", null,
new RegistryObjectListType(subscriptions), false,
Mode.CREATE_OR_REPLACE);
RegistrySOAPServices.sendSubmitObjectsRequest(request,
registrySoapClient.sendSubmitObjectsRequest(request,
config.getRegistryBaseURL());
}
@ -526,7 +614,7 @@ public class RegistryReplicationManager {
String endpointType = DeliveryMethodTypes.SOAP;
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.address(RegistrySOAPServices.getNotificationListenerServiceUrl(
builder.address(registrySoapClient.getNotificationListenerServiceUrl(
registry.getBaseURL()).toString());
W3CEndpointReference ref = builder.build();
DOMResult dom = new DOMResult();
@ -603,7 +691,7 @@ public class RegistryReplicationManager {
statusHandler.info("Checking if remote registry at ["
+ remoteRegistryBaseURL + "] is available...");
if (RegistryRESTServices
if (dataDeliveryRestClient
.isRegistryAvailable(remoteRegistryBaseURL)) {
statusHandler.info("Registry at [" + remoteRegistryBaseURL
+ "] is available!");
@ -616,7 +704,7 @@ public class RegistryReplicationManager {
try {
statusHandler
.info("Removing remote subscriptions prior to submission of new subscriptions");
RegistryRESTServices.getRegistryDataAccessService(
dataDeliveryRestClient.getRegistryDataAccessService(
config.getRegistryBaseURL())
.removeSubscriptionsForSite(registry.getOwner());
submitSubscriptionsToHost(config, registry);
@ -630,7 +718,8 @@ public class RegistryReplicationManager {
statusHandler
.info("Registry shutting down. Removing subscriptions from: ["
+ remoteRegistryBaseURL + "]");
RegistryRESTServices.getRegistryDataAccessService(
dataDeliveryRestClient
.getRegistryDataAccessService(
remoteRegistryBaseURL)
.removeSubscriptionsForSite(
registry.getOwner());
@ -647,7 +736,10 @@ public class RegistryReplicationManager {
}
}
}
}
public static List<String> getObjectTypes() {
return Collections.unmodifiableList(objectTypes);
}
public void setSubscriptionProcessingEnabled(
@ -659,4 +751,13 @@ public class RegistryReplicationManager {
return servers;
}
public void setDataDeliveryRestClient(
DataDeliveryRESTServices dataDeliveryRestClient) {
this.dataDeliveryRestClient = dataDeliveryRestClient;
}
public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) {
this.registrySoapClient = registrySoapClient;
}
}

View file

@ -23,10 +23,10 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.support.TransactionTemplate;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
@ -41,6 +41,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/29/2013 2191 bphillip Initial implementation
* 10/30/2013 1538 bphillip Updated to use non-static rest client
* </pre>
*
* @author bphillip
@ -60,20 +61,24 @@ public class RegistrySubmitTask extends RunnableWithTransaction {
/** The URL of the remote server to get the object from */
private String remoteURL;
private DataDeliveryRESTServices restClient;
public RegistrySubmitTask(TransactionTemplate txTemplate,
RegistryObjectDao dao, String objectId, String remoteURL) {
RegistryObjectDao dao, String objectId, String remoteURL,
DataDeliveryRESTServices restClient) {
super(txTemplate);
this.dao = dao;
this.objectId = objectId;
this.remoteURL = remoteURL;
this.restClient = restClient;
}
@Override
public void runWithTransaction() {
try {
RegistryObjectType objectToSubmit = RegistryRESTServices
.getRegistryObject(RegistryObjectType.class, remoteURL,
RegistryObjectType objectToSubmit = restClient.getRegistryObject(
RegistryObjectType.class, remoteURL,
escapeObjectId(objectId));
if (objectToSubmit.getSlotByName(EbxmlObjectUtil.HOME_SLOT_NAME) == null) {

View file

@ -0,0 +1,152 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.web;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException;
import org.apache.commons.lang.exception.ExceptionUtils;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService;
import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.registry.services.RegistryServiceException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* <pre>
*
* Set of Data Delivery specific REST services
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 10/30/2013 1538 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
public class DataDeliveryRESTServices extends RegistryRESTServices {
/** Path to these services */
private static final String DATA_DELIVERY_REST_SERVICE_PATH = "/dataDelivery";
/**
* The logger
*/
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryRESTServices.class);
/** Map of known registry availability services */
private LoadingCache<String, IRegistryAvailableRestService> registryAvailabilityServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRegistryAvailableRestService>() {
public IRegistryAvailableRestService load(String url) {
return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH,
IRegistryAvailableRestService.class);
}
});
/** Map of known registry data access services */
private LoadingCache<String, IRegistryDataAccessService> registryDataAccessServiceMap = CacheBuilder
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
.build(new CacheLoader<String, IRegistryDataAccessService>() {
public IRegistryDataAccessService load(String url) {
return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH,
IRegistryDataAccessService.class);
}
});
public DataDeliveryRESTServices() throws JAXBException {
super();
}
/**
* Gets the registry available service implementation
*
* @param baseURL
* The base URL of the registry
* @return THe registry available service implementation
*/
public IRegistryAvailableRestService getRegistryAvailableService(
String baseURL) {
try {
return registryAvailabilityServiceMap.get(baseURL);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting Registry Availability Rest Service", e);
}
}
/**
* Check if the registry at the given URL is available
*
* @param baseURL
* The base URL of the registry
* @return True if the registry services are available
*/
public boolean isRegistryAvailable(String baseURL) {
String response = null;
try {
response = getRegistryAvailableService(baseURL)
.isRegistryAvailable();
if (RegistryAvailability.AVAILABLE.equals(response)) {
return true;
} else {
statusHandler.info("Registry at [" + baseURL
+ "] not available: " + response);
}
return RegistryAvailability.AVAILABLE.equals(response);
} catch (Throwable t) {
if (response == null) {
response = ExceptionUtils.getRootCauseMessage(t);
}
statusHandler.error("Registry at [" + baseURL + "] not available: "
+ response);
return false;
}
}
/**
* Gets the data access service for the specified registry URL
*
* @param baseURL
* The baseURL of the registry
* @return The data access service for the specified registry URL
*/
public IRegistryDataAccessService getRegistryDataAccessService(
String baseURL) {
try {
return registryDataAccessServiceMap.get(baseURL);
} catch (ExecutionException e) {
throw new RegistryServiceException(
"Error getting Registry Availability Rest Service", e);
}
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.registry.ebxml.services.rest;
package com.raytheon.uf.edex.datadelivery.registry.web;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@ -26,8 +26,8 @@ import javax.ws.rs.Produces;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService;
import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService;
import com.raytheon.uf.edex.registry.ebxml.dao.DbInit;
/**
@ -42,12 +42,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.DbInit;
* ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation
* 9/5/2013 1538 bphillip Removed log message
* 10/30/2013 1538 bphillip Moved data delivery specific services out of registry plugin
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/registryAvailable")
@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX)
@Service
@Transactional
public class RegistryAvailableRestService implements

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.registry.ebxml.services.rest;
package com.raytheon.uf.edex.datadelivery.registry.web;
import java.io.File;
import java.util.List;
@ -48,8 +48,8 @@ import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService;
import com.raytheon.uf.common.registry.RegistryException;
import com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService;
import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResponse;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -63,8 +63,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
/**
*
* Implementation of the registry data access service interface <br>
* TODO: This class really needs to be moved to a data delivery specific plugin
* Implementation of the registry data access service interface
*
* <pre>
*
@ -76,13 +75,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
* 9/20/2013 2385 bphillip Added subscription backup functions
* 10/2/2013 2385 bphillip Fixed subscription backup queries
* 10/8/2013 1682 bphillip Added query queries
* 10/23/2013 2385 bphillip Restored subscriptions are now scheduled in the bandwidth manager
* </pre>
*
* @author bphillip
* @version 1
*/
@Transactional
@Path(IRegistryDataAccessService.DATA_ACCESS_PATH_PREFIX)
public class RegistryDataAccessService implements IRegistryDataAccessService {
/** The logger */
@ -113,6 +112,10 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
/** Lifecyclemanager */
private LifecycleManager lcm;
public RegistryDataAccessService() {
}
/**
* @see
* com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService
@ -120,7 +123,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getRegistryObjectIds/{objectType}")
@Path("getRegistryObjectIds/{objectType}")
public RestCollectionResponse<String> getRegistryObjectIdsOfType(
@PathParam("objectType") String objectType) {
statusHandler.info("Getting registry object ids of type [" + objectType
@ -133,7 +136,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getQueries")
@Path("getQueries")
public String getValidQueries() {
statusHandler.debug("Getting valid queries...");
List<String> ids = queryDefinitionDao.getQueryIds();
@ -146,7 +149,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getParametersForQuery/{queryId}")
@Path("getParametersForQuery/{queryId}")
public String getParametersForQuery(@PathParam("queryId") String queryId) {
statusHandler.debug("Getting query parameters for query: " + queryId
+ "...");
@ -168,7 +171,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "removeSubscriptionsFor/{siteId}")
@Path("removeSubscriptionsFor/{siteId}")
public void removeSubscriptionsForSite(@PathParam("siteId") String siteId) {
statusHandler.info("Removing subscriptions for: " + siteId);
List<SubscriptionType> subscriptions = registryObjectDao
@ -205,7 +208,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "getSubscriptions")
@Path("getSubscriptions")
public String getSubscriptions() {
String[] slotNames = new String[] { "name", "owner", "dataSetName",
"provider", "dataSetType", "route", "active", "groupName",
@ -245,7 +248,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "backupSubscription/{subscriptionName}")
@Path("backupSubscription/{subscriptionName}")
public String backupSubscription(
@PathParam("subscriptionName") String subscriptionName) {
StringBuilder response = new StringBuilder();
@ -288,7 +291,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "backupAllSubscriptions/")
@Path("backupAllSubscriptions/")
public String backupAllSubscriptions() {
StringBuilder response = new StringBuilder();
List<RegistryObjectType> subs = registryObjectDao
@ -310,7 +313,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscription/{subscriptionName}")
@Path("restoreSubscription/{subscriptionName}")
public String restoreSubscription(
@PathParam("subscriptionName") String subscriptionName) {
StringBuilder response = new StringBuilder();
@ -367,7 +370,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
*/
@Override
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscriptions/")
@Path("restoreSubscriptions/")
public String restoreSubscriptions() {
StringBuilder response = new StringBuilder();
if (SUBSCRIPTION_BACKUP_DIR.exists()) {
@ -391,7 +394,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
* .clearSubscriptionBackupFiles()
*/
@GET
@Path(DATA_ACCESS_PATH_PREFIX + "clearSubscriptionBackupFiles/")
@Path("clearSubscriptionBackupFiles/")
public String clearSubscriptionBackupFiles() {
StringBuilder response = new StringBuilder();
if (SUBSCRIPTION_BACKUP_DIR.exists()) {

View file

@ -0,0 +1,446 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.web;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DeliveryInfoType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.registry.constants.QueryLanguages;
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager;
import com.raytheon.uf.edex.datadelivery.registry.replication.NotificationHostConfiguration;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistrySubscriptionManager;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
/**
* <pre>
* Set of services used by the federation status web interface to modify federation associations
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 10/30/2013 1538 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
@Path(RegistryFederationStatus.REGISTRY_FEDERATION_STATUS_PATH)
@Transactional
public class RegistryFederationStatus {
/** The path to these set of services */
protected static final String REGISTRY_FEDERATION_STATUS_PATH = "/status/";
/** The logger instance */
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryFederationStatus.class);
/** Comparator to sort registry instances */
private static final Comparator<RegistryObjectType> REGISTRY_COMPARATOR = new Comparator<RegistryObjectType>() {
@Override
public int compare(RegistryObjectType o1, RegistryObjectType o2) {
return o1.getId().compareTo(o2.getId());
}
};
/** Data Access object for registry objects */
private RegistryDao registryDao;
/** Data Access object for registry subscription objects */
private SubscriptionDao subscriptionDao;
/** The registry replication manager */
private RegistryReplicationManager replicationManager;
/** Data Delivery rest services client */
private DataDeliveryRESTServices dataDeliveryRestClient;
/** Registry soap services client */
private RegistrySOAPServices registrySoapServices;
/**
* The address to the NCF registry loaded from the NCF_ADDRESS item in
* setup.env
*/
private String ncfAddress = System.getenv("NCF_ADDRESS");
/**
* Gets if this registry is participating in the federation
*
* @return The value of the EBXML_REGISTRY_FEDERATION_ENABLED environment
* variable
*/
@GET
@Path("isFederated")
public String isFederated() {
return System.getenv("EBXML_REGISTRY_FEDERATION_ENABLED");
}
/**
* Gets if this registry is processing registry replication subscriptions
*
* @return The value of the EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED environment
* variable
*/
@GET
@Path("isProcessingSubscriptions")
public String isProcessingSubscriptions() {
return System.getenv("EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED");
}
/**
* Gets information about this registry
*
* @return Information pertaining to the local registry
*/
@GET
@Path("getMyRegistryInfo")
public String getMyRegistryInfo() {
StringBuilder builder = new StringBuilder();
RegistryType myRegistry = registryDao
.getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS);
appendRegistryInfo(myRegistry, builder);
return builder.toString();
}
/**
* Queries the NCF registry to get a list of registries in the federation
*
* @return The list of registries in the federation
* @throws MsgRegistryException
* If an error occurs while querying the NCF registry
*/
@GET
@Path("getFederationMembers")
public String getFederationMembers() throws MsgRegistryException {
StringBuilder builder = new StringBuilder();
QueryType query = new QueryType(
CanonicalQueryTypes.FIND_ASSOCIATED_OBJECTS);
query.getSlot().add(
new SlotType(QueryConstants.ASSOCIATION_TYPE,
new StringValueType(
AssociationTypes.HAS_FEDERATION_MEMBER)));
query.getSlot().add(
new SlotType(QueryConstants.SOURCE_OBJECT_ID,
new StringValueType(
RegistryFederationManager.FEDERATION_ID)));
QueryRequest queryRequest = new QueryRequest("Get Federation Members",
query, new ResponseOptionType(QueryReturnTypes.REGISTRY_OBJECT,
true));
List<RegistryObjectType> federationMembers = registrySoapServices
.getQueryServiceForHost(ncfAddress).executeQuery(queryRequest)
.getRegistryObjects();
Collections.sort(federationMembers, REGISTRY_COMPARATOR);
for (RegistryObjectType obj : federationMembers) {
if (obj instanceof RegistryType) {
RegistryType registry = (RegistryType) obj;
appendRegistryInfo(registry, builder);
}
}
return builder.toString();
}
/**
* Gets the list of registry that the local registry is subscribed to
*
* @return The list of registries that the local registry is subscribed to
*/
@GET
@Path("getRegistriesSubscribedTo")
public String getRegistriesSubscribedTo() {
StringBuilder builder = new StringBuilder();
if (this.replicationManager.getServers() != null
&& !CollectionUtil.isNullOrEmpty(this.replicationManager
.getServers().getRegistryReplicationServers())) {
List<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
for (NotificationHostConfiguration hostConfig : this.replicationManager
.getServers().getRegistryReplicationServers()) {
SlotType queryLanguageSlot = new SlotType(
QueryConstants.QUERY_LANGUAGE, new StringValueType(
QueryLanguages.HQL));
SlotType queryExpressionSlot = new SlotType(
QueryConstants.QUERY_EXPRESSION, new StringValueType(
"FROM SubscriptionType sub where sub.id like 'Replication Subscription for%"
+ RegistryUtil.LOCAL_REGISTRY_ADDRESS
+ "%'"));
QueryType query = new QueryType();
query.setQueryDefinition(CanonicalQueryTypes.ADHOC_QUERY);
query.getSlot().add(queryLanguageSlot);
query.getSlot().add(queryExpressionSlot);
QueryRequest request = new QueryRequest();
request.setResponseOption(new ResponseOptionType(
QueryReturnTypes.REGISTRY_OBJECT, true));
request.setId("Replication Subscription Verification Query");
request.setQuery(query);
try {
if (!registrySoapServices
.getQueryServiceForHost(
hostConfig.getRegistryBaseURL())
.executeQuery(request).getRegistryObjects()
.isEmpty()) {
RegistryType registry = registryDao
.getRegistryByBaseURL(hostConfig
.getRegistryBaseURL());
if (registry != null) {
registries.add(registry);
}
}
} catch (Exception e) {
statusHandler.error("Error querying remote registry", e);
}
}
Collections.sort(registries, REGISTRY_COMPARATOR);
for (RegistryObjectType reg : registries) {
appendRegistryInfo((RegistryType) reg, builder);
}
}
return builder.toString();
}
/**
* Gets a list of registries that are subscribing to the local registry
*
* @return The list of registries that are subscribing to the local registry
*/
@GET
@Path("getRegistrySubscribing")
public String getRegistrySubscribing() {
StringBuilder builder = new StringBuilder();
List<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
for (SubscriptionType sub : subscriptionDao.getAll()) {
DeliveryInfoType deliveryInfo = sub.getDeliveryInfo().get(0);
W3CEndpointReference endpointReference = deliveryInfo.getNotifyTo();
DOMResult dom = new DOMResult();
endpointReference.writeTo(dom);
Document doc = (Document) dom.getNode();
NodeList nodes = doc.getElementsByTagNameNS(
EbxmlNamespaces.ADDRESSING_URI,
RegistrySubscriptionManager.ADDRESS_TAG);
Node addressNode = nodes.item(0);
String serviceAddress = addressNode.getTextContent().trim();
String endpointType = addressNode
.getAttributes()
.getNamedItemNS(EbxmlNamespaces.RIM_URI,
RegistrySubscriptionManager.ENDPOINT_TAG)
.getNodeValue();
if (endpointType.equals(DeliveryMethodTypes.SOAP)) {
RegistryType registry = registryDao
.getRegistryByBaseURL(serviceAddress.replace(
"/notificationListener", ""));
if (registry != null && !registries.contains(registry)) {
registries.add(registry);
}
}
}
Collections.sort(registries, REGISTRY_COMPARATOR);
for (RegistryObjectType reg : registries) {
appendRegistryInfo((RegistryType) reg, builder);
}
return builder.toString();
}
/**
* Gets the list of object types that are currently being replicated
*
* @return The object list
*/
@GET
@Path("getObjectTypesReplicated")
public String getObjectTypesReplicated() {
StringBuilder builder = new StringBuilder();
for (String objectType : RegistryReplicationManager.getObjectTypes()) {
builder.append(objectType).append(StringUtil.NEWLINE);
}
return builder.toString();
}
/**
* Kicks of a full registry sync with the specified registry
*
* @param registryId
* The registry ID to sync with
* @return status message
*/
@GET
@Path("syncWithRegistry/{registryId}")
public String syncWithRegistry(@PathParam("registryId") String registryId) {
StringBuilder builder = new StringBuilder();
RegistryType registry = registryDao.getById(registryId);
if (registry == null) {
builder.append("Registry [" + registryId
+ "] not in federation. Unable to synchronize.");
} else {
try {
replicationManager.synchronizeRegistryWithFederation(registry
.getBaseURL());
} catch (Exception e) {
statusHandler.error("Error synchronizing registry!", e);
builder.append("Error synchronizing registry [" + registryId
+ "]: " + e.getLocalizedMessage());
}
}
return builder.toString();
}
/**
* Subscribes to replication notifications from the specified registry
*
* @param registryId
* The ID of the registry to subscribe to
* @return Status message
*/
@GET
@Path("subscribeToRegistry/{registryId}")
public String subscribeToRegistry(@PathParam("registryId") String registryId) {
StringBuilder builder = new StringBuilder();
RegistryType registry = registryDao.getById(registryId);
if (registry == null) {
builder.append("Registry [" + registryId
+ "] not in federation. Unable to submit subscriptions.");
} else {
RegistryType localRegistry = registryDao
.getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS);
NotificationHostConfiguration config = new NotificationHostConfiguration(
registry.getId(), registry.getId(), registry.getBaseURL());
replicationManager.submitSubscriptionsToHost(config, localRegistry);
builder.append("Successfully subscribed to registry [" + registryId
+ "]");
this.replicationManager.addNotificationServer(config);
replicationManager.saveNotificationServers();
}
return builder.toString();
}
/**
* Unsubscribes from the specified registry
*
* @param registryId
* The ID of the registry to unsubscribe from
* @return The status message
*/
@GET
@Path("unsubscribeFromRegistry/{registryId}")
public String unsubscribeFromRegistry(
@PathParam("registryId") String registryId) {
StringBuilder builder = new StringBuilder();
RegistryType registry = registryDao.getById(registryId);
if (registry == null) {
builder.append("Registry [" + registryId
+ "] not in federation. Unable to unsubscribe.");
} else {
RegistryType localRegistry = registryDao
.getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS);
dataDeliveryRestClient.getRegistryDataAccessService(
registry.getBaseURL()).removeSubscriptionsForSite(
localRegistry.getOwner());
builder.append("Successfully unsubscribed from registry ["
+ registryId + "]");
replicationManager.removeNotificationServer(registry.getBaseURL());
replicationManager.saveNotificationServers();
}
return builder.toString();
}
/**
* Appends registry information to the stringbuilder
*
* @param registry
* The registry to get information for
* @param builder
* The string builder to append to
*/
private void appendRegistryInfo(RegistryType registry, StringBuilder builder) {
builder.append(registry).append(",");
builder.append(registry.getBaseURL()).append(",");
builder.append(registry.getConformanceProfile()).append(",");
builder.append(registry.getSpecificationVersion());
builder.append(StringUtil.NEWLINE);
}
public void setReplicationManager(
RegistryReplicationManager replicationManager) {
this.replicationManager = replicationManager;
}
public void setRegistryDao(RegistryDao registryDao) {
this.registryDao = registryDao;
}
public void setSubscriptionDao(SubscriptionDao subscriptionDao) {
this.subscriptionDao = subscriptionDao;
}
public void setDataDeliveryRestClient(
DataDeliveryRESTServices dataDeliveryRestClient) {
this.dataDeliveryRestClient = dataDeliveryRestClient;
}
public void setRegistrySoapServices(
RegistrySOAPServices registrySoapServices) {
this.registrySoapServices = registrySoapServices;
}
}

View file

@ -34,8 +34,7 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0",
javax.mail;bundle-version="1.0.0",
org.apache.commons.validator;bundle-version="1.2.0",
com.sun.xml.bind;bundle-version="1.0.0",
org.reflections;bundle-version="0.9.9"
com.sun.xml.bind;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.edex.registry.ebxml.acp,
com.raytheon.uf.edex.registry.ebxml.dao,
com.raytheon.uf.edex.registry.ebxml.exception,

View file

@ -44,6 +44,7 @@
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="dynamicRefDao" ref="dynamicObjectRefDao"/>
<property name="queryManager" ref="queryServiceImpl"/>
<property name="registryRestClient" ref="registryRestClient"/>
</bean>
<bean id="registryXpathProcessor" class="com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor">

View file

@ -139,6 +139,7 @@
value="urn:oasis:names:tc:ebxml-regrep:query:GetReferencedObject" />
<property name="classificationNodeDao" ref="classificationNodeDao" />
<property name="referenceResolver" ref="objectReferenceResolver" />
<property name="registrySoapClient" ref="registryWebServiceClient"/>
</bean>
</beans>

View file

@ -5,6 +5,7 @@
<bean id="notificationListenerFactory"
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerFactory">
<constructor-arg ref="EmailSender" />
<constructor-arg ref="registryWebServiceClient"/>
</bean>
<bean name="EmailSender"

View file

@ -7,8 +7,8 @@
<property name="threadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="2" />
<property name="maxThreads" value="5" />
<property name="minThreads" value="${ebxml-webserver-min-threads}" />
<property name="maxThreads" value="${ebxml-webserver-max-threads}" />
</bean>
</property>

View file

@ -2,6 +2,12 @@
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">
<bean id="registryRestClient" class="com.raytheon.uf.common.registry.services.RegistryRESTServices"/>
<bean id="registryWebServiceClient" class="com.raytheon.uf.common.registry.services.RegistrySOAPServices"/>
<bean id="webServiceInInterceptor"
class="com.raytheon.uf.edex.registry.ebxml.services.RegistryServiceInInterceptor" />
<!-- QUERY -->
<!-- Define concrete implementation of the service -->
<bean id="queryServiceImpl"
@ -12,6 +18,7 @@
<property name="classificationNodeDao" ref="classificationNodeDao"/>
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="sessionFactory" ref="metadataSessionFactory"/>
<property name="registrySoapClient" ref="registryWebServiceClient"/>
</bean>
<!-- NOTIFICATION LISTENER -->
@ -21,6 +28,7 @@
<property name="lcm" ref="lcmServiceImpl" />
<property name="registryObjectDao" ref="registryObjectDao" />
<property name="registryDao" ref="registryDao" />
<property name="registrySoapClient" ref="registryWebServiceClient"/>
</bean>
@ -75,15 +83,6 @@
<property name="webUtil" ref="RegistryWebUtil" />
</bean>
<bean id="registryDataAccessService" class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryDataAccessService">
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="lcm" ref="lcmServiceImpl"/>
<property name="queryDefinitionDao" ref="queryDefinitionDao"/>
</bean>
<bean id="registryAvailabilityService"
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryAvailableRestService" />
<bean id="registryObjectsRestService"
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryObjectsRestService">
<property name="registryObjectDao" ref="registryObjectDao" />

View file

@ -12,3 +12,6 @@ ebxml-email.enabled=false
# The maximum number of events that will be batched and send
# in a registry replication notification
ebxml-notification-batch-size=50
# Configuration of thread pool used to handle web service requests
ebxml-webserver-min-threads=2
ebxml-webserver-max-threads=10

View file

@ -21,9 +21,6 @@ package com.raytheon.uf.edex.registry.ebxml;
import java.io.ByteArrayInputStream;
import javax.jws.WebService;
import com.raytheon.uf.common.registry.IRegistryRequestService;
import com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper;
/**
@ -37,18 +34,16 @@ import com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 5/3/2013 1948 bphillip Initial implementation
* 7/26/2031 2232 mpduff Don't override executeThrift.
* 7/26/2013 2232 mpduff Don't override executeThrift.
* 10/30/2013 1538 bphillip Removed unused IRegistryRequestService interface
*
* </pre>
*
* @author bphillip
* @version 1
*/
@WebService(endpointInterface = "com.raytheon.uf.common.registry.IRegistryRequestService")
public class RegistryRemoteRequestWrapper extends RemoteRequestRouteWrapper
implements IRegistryRequestService {
public class RegistryRemoteRequestWrapper extends RemoteRequestRouteWrapper {
@Override
public byte[] request(byte[] data) {
return executeThrift(new ByteArrayInputStream(data));
}

View file

@ -63,6 +63,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
* ------------ ---------- ----------- --------------------------
* 8/5/2013 2191 bphillip Initial implementation
* 10/8/2013 1682 bphillip Added getReferenced objects methods
* 10/30/2013 1538 bphillip Changed to use non-static rest/soap clients
* </pre>
*
* @author bphillip
@ -86,6 +87,8 @@ public class ObjectReferenceResolver {
/** Validator for validating REST endpoint addresses */
private UrlValidator urlValidator = new UrlValidator();
private RegistryRESTServices registryRestClient;
/** Cache holding the fields in each class that are object references */
private static LoadingCache<Class<?>, List<String>> OBJECT_REFERENCE_FIELD_CACHE = CacheBuilder
.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES)
@ -386,8 +389,7 @@ public class ObjectReferenceResolver {
RegistryObjectType retVal = null;
if (urlValidator.isValid(ref)) {
Object restResponse = RegistryRESTServices
.accessXMLRestService(ref);
Object restResponse = registryRestClient.accessXMLRestService(ref);
if (restResponse instanceof QueryResponse) {
QueryResponse queryResponse = (QueryResponse) restResponse;
if (responseOk(queryResponse)) {
@ -459,4 +461,8 @@ public class ObjectReferenceResolver {
this.queryManager = queryManager;
}
public void setRegistryRestClient(RegistryRESTServices registryRestClient) {
this.registryRestClient = registryRestClient;
}
}

View file

@ -31,6 +31,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import com.google.common.annotations.VisibleForTesting;
import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.EmailNotificationListener;
@ -48,6 +49,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.WebSe
* ------------ ---------- ----------- --------------------------
* Apr 17, 2013 1672 djohnson Initial creation
* 10/20/2013 1682 bphillip Added synchronous notification delivery
* 10/30/2013 1538 bphillip Changed to use non-static web service clients
*
* </pre>
*
@ -94,16 +96,22 @@ public class NotificationListenerFactory implements
}
}
/** Email sender */
private final EmailSender emailSender;
/** Registry soap service client */
private final RegistrySOAPServices registrySoapClient;
/**
* Constructor.
*
* @param emailSender
* the email sender
*/
public NotificationListenerFactory(EmailSender emailSender) {
public NotificationListenerFactory(EmailSender emailSender,
RegistrySOAPServices registrySoapClient) {
this.emailSender = emailSender;
this.registrySoapClient = registrySoapClient;
}
/**
@ -134,7 +142,8 @@ public class NotificationListenerFactory implements
@VisibleForTesting
NotificationListener getWebServiceNotificationListener(
final NotificationDestination destination) {
return new WebServiceNotificationListener(destination);
return new WebServiceNotificationListener(destination,
registrySoapClient);
}
/**

View file

@ -88,6 +88,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 9/11/2013 2254 bphillip Cleaned up handling of notifications and removed unneccessary code
* 10/20/2013 1682 bphillip Added synchronous notification delivery
* 10/23/2013 1538 bphillip Added log message denoting when processing is complete and time duration
* 10/30/2013 1538 bphillip Changed to use non-static registry soap service client
*
* </pre>
*
@ -117,6 +118,9 @@ public class NotificationListenerImpl implements NotificationListener {
/** Data access object for getting RegistryType objects */
private RegistryDao registryDao;
/** Registry soap service client */
private RegistrySOAPServices registrySoapClient;
@Override
public void onNotification(NotificationType notification) {
long startTime = TimeUtil.currentTimeMillis();
@ -250,7 +254,7 @@ public class NotificationListenerImpl implements NotificationListener {
Collection<String> objIds, Mode mode) throws EbxmlRegistryException {
try {
// Get a the remote query service
QueryManager queryManager = RegistrySOAPServices
QueryManager queryManager = registrySoapClient
.getQueryServiceForHost(clientBaseURL);
// Create a query to get the current state of the affected objects
QueryRequest queryRequest = createGetCurrentStateQuery(
@ -343,4 +347,9 @@ public class NotificationListenerImpl implements NotificationListener {
public void setRegistryDao(RegistryDao registryDao) {
this.registryDao = registryDao;
}
public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) {
this.registrySoapClient = registrySoapClient;
}
}

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
* Apr 16, 2013 1672 djohnson Extracted from RegistryNotificationManager.
* 8/28/2013 1538 bphillip Changed to catch a Throwable instead of just EbxmlRegistryException
* 10/20/2013 1682 bphillip Added synchronous notification delivery
* 10/30/2013 1538 bphillip Changed to use non-static soap service client
*
* </pre>
*
@ -63,13 +64,19 @@ public class WebServiceNotificationListener implements NotificationListener {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(WebServiceNotificationListener.class);
/** The destination of notifications sent via this listener */
private final String destination;
/** Registry soap service client */
private RegistrySOAPServices registrySoapClient;
/**
* @param destination
*/
public WebServiceNotificationListener(NotificationDestination destination) {
public WebServiceNotificationListener(NotificationDestination destination,
RegistrySOAPServices registrySoapClient) {
this.destination = destination.getDestination();
this.registrySoapClient = registrySoapClient;
}
/**
@ -120,8 +127,8 @@ public class WebServiceNotificationListener implements NotificationListener {
RegistryServiceException, MsgRegistryException {
statusHandler.info("Sending notification [" + notification.getId()
+ "]");
RegistrySOAPServices.getNotificationListenerServiceForUrl(
serviceAddress).synchronousNotification(notification);
registrySoapClient.getNotificationListenerServiceForUrl(serviceAddress)
.synchronousNotification(notification);
statusHandler.info("Notification [" + notification.getId() + "] sent!");
}
}

View file

@ -122,6 +122,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 10/8/2013 1682 bphillip Refactored querying
* 10/2013 1682 bphillip Fixed federated query invocation
* 10/23/2013 1538 bphillip Remove extra executeQuery method
* 10/30/2013 1538 bphillip Changed to use non-static soap service client
*
* </pre>
*
@ -192,6 +193,8 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
*/
private ObjectReferenceResolver referenceResolver;
private RegistrySOAPServices registrySoapClient;
/**
* Creates a new QueryManagerImpl
*/
@ -795,7 +798,7 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
statusHandler.info("Submitting federated query to ["
+ registryToQuery.getId() + "] at ["
+ registryToQuery.getBaseURL() + "]...");
return RegistrySOAPServices.getQueryServiceForHost(
return registrySoapClient.getQueryServiceForHost(
registryToQuery.getBaseURL()).executeQuery(queryRequest);
}
@ -859,4 +862,8 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
this.sessionFactory = sessionFactory;
}
public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) {
this.registrySoapClient = registrySoapClient;
}
}

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
* ------------ ---------- ----------- --------------------------
* 9/18/2013 1705 bphillip Initial implementation
* 10/8/2013 1682 bphillip Refactored querying
* 10/30/2013 1538 bphillip Changed to use non-static soap service client
* </pre>
*
* @author bphillip
@ -67,6 +68,9 @@ public class GetReferencedObject extends RegistryQueryPlugin {
/** Object used to resolve object references */
private ObjectReferenceResolver referenceResolver;
/** Registry soap service client */
private RegistrySOAPServices registrySoapClient;
@Override
@WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@ -108,7 +112,7 @@ public class GetReferencedObject extends RegistryQueryPlugin {
query.setQuery(queryObj);
query.setResponseOption(new ResponseOptionType(
QueryReturnTypes.REGISTRY_OBJECT, true));
QueryManager remoteQueryManager = RegistrySOAPServices
QueryManager remoteQueryManager = registrySoapClient
.getQueryServiceForHost(remoteAddress);
QueryResponse remoteResponse = remoteQueryManager
@ -130,4 +134,8 @@ public class GetReferencedObject extends RegistryQueryPlugin {
this.referenceResolver = referenceResolver;
}
public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) {
this.registrySoapClient = registrySoapClient;
}
}

View file

@ -66,12 +66,13 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
* 4/19/2013 1931 bphillip Initial implementation
* 5/21/2013 2022 bphillip Added interface and moved constants
* 10/8/2013 1682 bphillip Refactored to use parameter definitions from the registry
* 10/30/2013 1538 bphillip Changed root REST service path
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/search")
@Path("/search")
@Service
@Transactional
public class QueryProtocolRestService implements IQueryProtocolRestService {

View file

@ -73,12 +73,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
* ------------ ---------- ----------- --------------------------
* 4/19/2013 1931 bphillip Initial implementation
* 5/21/2013 2022 bphillip Added interface
* 10/30/2013 1538 bphillip Changed root REST service path
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/registryObjects/{objectId}")
@Path("/registryObjects/{objectId}")
@Service
@Transactional
public class RegistryObjectsRestService implements IRegistryObjectsRestService {

View file

@ -46,12 +46,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
* ------------ ---------- ----------- --------------------------
* 4/19/2013 1931 bphillip Initial implementation
* 5/21/2013 2022 bphillip Added interface and changed method name
* 10/30/2013 1538 bphillip Changed root REST service path
* </pre>
*
* @author bphillip
* @version 1
*/
@Path("/rest/repositoryItems/{repositoryItemId}")
@Path("/repositoryItems/{repositoryItemId}")
@Service
@Transactional
public class RepositoryItemsRestService implements IRepositoryItemsRestService {

View file

@ -119,7 +119,7 @@
}
function callRESTService(func){
var url = "http://"+window.location.host+"/rest/dataAccess/"+func;
var url = "http://"+window.location.host+"/dataDelivery/dataAccess/"+func;
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "text/plain");

View file

@ -23,9 +23,7 @@
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
@ -50,12 +48,16 @@
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<init-param>
<param-name>static-welcome-file</param-name>
<param-value>/RegistryUserMenu.html</param-value>
<param-value>/registry/RegistryInterface.html</param-value>
</init-param>
<init-param>
<param-name>static-resources-list</param-name>
<param-value>.*\.html .*\.js .*\.css</param-value>
</init-param>
<init-param>
<param-name>disable-address-updates</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

View file

@ -279,6 +279,19 @@ function addOptionToList(selectBoxName,text,value){
selectBox.options.add(optn);
}
/*
* Removes an entry from the select box with the provided name
*/
function removeOptionFromList(selectBoxName,value){
var selectBox = document.getElementById(selectBoxName)
for(var i = 0; i < selectBox.options.length;i++){
if(selectBox.options[i].value == value){
selectBox.options.remove(selectBox.options[i])
break;
}
}
}
/*
* Sets the currently selected index of a select box element with
* the given name
@ -917,4 +930,3 @@ Array.prototype.contains = function(item){
}

View file

@ -51,13 +51,14 @@ Date Ticket# Engineer Description
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src='/registry/registryUtil.js'></script>
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
<title>EDEX EBXML Registry Interface</title>
</head>
<FRAMESET cols="15%, 85%">
<FRAME id="navFram" name="navFrame" src=navigation.html>
<FRAME id="actionFrame" name="actionFrame" src="services/query/Query.html">
<FRAME id="navFram" name="navFrame" src=/registry/navigation.html>
<FRAME id="actionFrame" name="actionFrame" src="/registry/services/query/Query.html">
</FRAMESET>

View file

@ -0,0 +1,207 @@
<html>
<head>
<style type="text/css">
span {font-weight:bold;}
a {font-weight:bold;}
td {width:200px; background: #A9A9A9;}
th {width:200px; background: #A9A9A9;}
button {width:190px;}
input{width:300px;}
table {border:0;}
select {width:200px;}
body { font-family: Helvetica;
margin-left: 75px;
margin-right: 75px;
background: #D3D3D3;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src='/registry/registryUtil.js'></script>
<script type="text/javascript" src='/dataDeliveryUtil.js'></script>
<title>Federation Status</title>
</head>
<body onload="populate()">
<h3>Federation Status</h3>
<table>
<tr>
<td>Federated:</td>
<td><span id="federatedSpan">[Unknown]</span></td>
</tr>
<tr>
<td>Processing Subscriptions:</td>
<td><span id="processSubscriptionsSpan">[Unknown]</span></td>
</tr>
<tr>
<td>My Registry ID:</td>
<td><span id="myRegistryIdSpan">[Unknown]</span></td>
</tr>
</table>
<br><br>
<table border ="1">
<tr>
<td>Resubmit Subscriptions To:</td>
<td><select id="resubmitSubsToRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick='resubmitSubs()'>Resubmit</button></td>
</tr>
<tr>
<td>Synchronize with Registry:</td>
<td><select id="syncWithRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="sync()">Sync</button></td>
</tr>
<tr>
<td>Subscribe To Registry:</td>
<td><select id="subscribeToRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="subscribe()">Subscribe</button></td>
</tr>
<tr>
<td>Unsubscribe From Registry:</td>
<td><select id="unsubscribeFromRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="unsubscribe()">Unsubscribe</button></td>
</tr>
</table>
<br>
<b>My Registry is Subscribed To:</b>
<span id="subscribedToRegistriesSpan"></span>
<br>
<br>
<b>Registries Subscribing to My Registry:</b>
<span id="subscribedToRegistries"></span>
<br>
<br>
<b>Federation Members:<b>
<span id="federationMembersSpan"></span>
<br>
<br>
<b>Object Types Currently Replicated:</b>
<span id="replicatedObjectListSpan"></span>
<br>
<br>
</body>
<script language="JavaScript">
function subscribe(){
var registryId = getComboValue("subscribeToRegistrySelect")
callRestService("dataDelivery/status/subscribeToRegistry",registryId);
location.reload(false)
}
function resubmitSubs(){
var registryId = getComboValue("resubmitSubsToRegistrySelect")
callRestService("dataDelivery/status/subscribeToRegistry",registryId);
}
function unsubscribe(){
var registryId = getComboValue("unsubscribeFromRegistrySelect")
callRestService("dataDelivery/status/unsubscribeFromRegistry",registryId);
location.reload(false)
}
function sync(){
var registryId = getComboValue("syncWithRegistrySelect")
callRestService("dataDelivery/status/syncWithRegistry",registryId);
}
function populate(){
var isFederated = callRestService("dataDelivery/status/isFederated")
document.getElementById("federatedSpan").innerHTML=isFederated
document.getElementById("processSubscriptionsSpan").innerHTML=callRestService("dataDelivery/status/isProcessingSubscriptions")
if(isFederated == "true"){
var myRegistryId=callRestService("dataDelivery/status/getMyRegistryInfo").split("\n")[0].split(",")[0]
document.getElementById("myRegistryIdSpan").innerHTML=myRegistryId
var subscriptionCandidates = new Array();
var memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
var registries = callRestService("dataDelivery/status/getFederationMembers").split("\n")
var federationMembers = new Array()
var subscribedTo=new Array()
var subscribedFrom=new Array()
for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",")
memberHTML+="<tr>"
memberHTML+="<td>"+tokens[0]+"</td>"
memberHTML+="<td>"+tokens[1]+"</td>"
memberHTML+="<td>"+tokens[2]+"</td>"
memberHTML+="<td>"+tokens[3]+"</td>"
memberHTML+="</tr>"
federationMembers[i]=tokens[0]
}
memberHTML+="</table>"
document.getElementById("federationMembersSpan").innerHTML=memberHTML
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
registries = callRestService("dataDelivery/status/getRegistriesSubscribedTo").split("\n")
for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",")
memberHTML+="<tr>"
memberHTML+="<td>"+tokens[0]+"</td>"
memberHTML+="<td>"+tokens[1]+"</td>"
memberHTML+="<td>"+tokens[2]+"</td>"
memberHTML+="<td>"+tokens[3]+"</td>"
memberHTML+="</tr>"
subscribedTo[i] = tokens[0]
}
memberHTML+="</table>"
document.getElementById("subscribedToRegistriesSpan").innerHTML=memberHTML
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
registries = callRestService("dataDelivery/status/getRegistrySubscribing").split("\n")
for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",")
memberHTML+="<tr>"
memberHTML+="<td>"+tokens[0]+"</td>"
memberHTML+="<td>"+tokens[1]+"</td>"
memberHTML+="<td>"+tokens[2]+"</td>"
memberHTML+="<td>"+tokens[3]+"</td>"
memberHTML+="</tr>"
subscribedFrom[i]=tokens[0]
}
memberHTML+="</table>"
document.getElementById("subscribedToRegistries").innerHTML=memberHTML
var objectTypes = callRestService("dataDelivery/status/getObjectTypesReplicated").split("\n")
var objectTypeHTML = "<table border='1'><tr><th style='width:30px;'></th><th>Object Type</th></tr>"
for(var i = 0; i < objectTypes.length-1;i++){
objectTypeHTML+="<tr>"
objectTypeHTML+="<td style='width:30px;'>"+(i+1)+"</td>"
objectTypeHTML+="<td>"+objectTypes[i]+"</td>"
objectTypeHTML+="</tr>"
}
for(var i = 0; i < federationMembers.length;i++){
var member=federationMembers[i]
if(subscribedTo.indexOf(member)== -1 && member!=myRegistryId){
addOptionToList("subscribeToRegistrySelect",member,member)
}
if(member!=myRegistryId){
addOptionToList("syncWithRegistrySelect",member,member)
}
if(subscribedTo.indexOf(member) != -1){
addOptionToList("unsubscribeFromRegistrySelect",member,member)
addOptionToList("resubmitSubsToRegistrySelect",member,member)
}
}
objectTypeHTML+="</table>";
document.getElementById("replicatedObjectListSpan").innerHTML=objectTypeHTML
}
}
</script>
</html>

View file

@ -48,14 +48,17 @@ Date Ticket# Engineer Description
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src='/registry/registryUtil.js'></script>
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
<title>NAVIGATION LINKS</title>
</head>
<body>
<a href="services/query/Query.html" target="actionFrame">Query Interface</a>
<a href="/registry/services/query/Query.html" target="actionFrame">Query Interface</a>
<br>
<a href="../RegistrySubscriptionBackup.html" target="actionFrame">Subscription Backup</a>
<a href="/RegistrySubscriptionBackup.html" target="actionFrame">Subscription Backup</a>
<br>
<a href="/registry/federation/status.html" target="actionFrame">Federation Status</a>
</body>

View file

@ -0,0 +1,21 @@
function callRestService(url,arg){
var url = "http://"+window.location.host+"/"+url
if(arg != null){
url+="/"+arg;
}
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "text/plain");
client.send();
return client.responseText
}
function callDataAccessServiceWithArg(func,arg){
return callRestService("dataDelivery/dataAccess/"+func+"/"+arg);
}
function callDataAccessService(func){
return callRestService("dataDelivery/dataAccess/"+func);
}

View file

@ -48,6 +48,7 @@ Date Ticket# Engineer Description
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src='/registry/registryUtil.js'></script>
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
<title>Registry Query Interface</title>
</head>

View file

@ -35,7 +35,7 @@
* @version 1
*/
function getValidQueryTypes(){
var tokens = callDataAccessService("getQueries","").split("\n")
var tokens = callDataAccessService("getQueries").split("\n")
var selectBox = document.getElementById("queryTypeInput")
for(var i=0;i<tokens.length;i++){
if(tokens[i].length != 0){
@ -52,7 +52,7 @@
function getQueryParameters(){
var selectBox = document.getElementById("queryTypeInput")
var value = selectBox.options[selectBox.selectedIndex].value
var responseTokens = callDataAccessService("getParametersForQuery",value).split("\n")
var responseTokens = callDataAccessServiceWithArg("getParametersForQuery",value).split("\n")
var gen = "<table>"
var paramType=""
@ -84,21 +84,3 @@
gen+="</table><br><input type=\"submit\" value=\"Submit\"/>"
document.getElementById("querySpecificSpan").innerHTML = gen
}
function callRestService(url,arg){
var url = "http://"+url+"/"+arg;
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "text/plain");
client.send();
return client.responseText
}
function callDataAccessService(func,arg){
var url = "http://"+window.location.host+"/rest/dataAccess/"+func+"/"+arg;
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "text/plain");
client.send();
return client.responseText
}

View file

@ -8,10 +8,12 @@
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="file:///${edex.home}/conf/spring/edex-db.xml" />
<import resource="classpath:res/spring/eventbus-common.xml" />
<import resource="classpath:res/spring/ebxml.xml" />
<import resource="classpath:res/spring/ebxml-webservices.xml" />
<import resource="classpath:res/spring/ebxml-validator-plugins.xml" />
<import resource="classpath:res/spring/ebxml-querytypes.xml" />
<import resource="classpath:res/spring/ebxml-registry-dao.xml" />
@ -20,12 +22,8 @@
<import resource="classpath:res/spring/ebxml-thrift-client.xml" />
<import resource="classpath:res/spring/ebxml-xacml.xml" />
<import resource="classpath:res/spring/ebxml-impl.xml" />
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="webServiceInInterceptor"
class="com.raytheon.uf.edex.registry.ebxml.services.RegistryServiceInInterceptor" />
<import resource="classpath:res/spring/ebxml-webservices.xml" />
<import resource="classpath*:res/spring/webservices.xml"/>
<bean id="QueryServiceWrapper"
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImplWrapper">
@ -48,17 +46,6 @@
<constructor-arg ref="catalogerServiceImpl" />
</bean>
<jaxws:server id="RegistryRequest"
serviceClass="com.raytheon.uf.common.registry.IRegistryRequestService"
address="/registryRequest">
<jaxws:inInterceptors>
<ref bean="webServiceInInterceptor" />
</jaxws:inInterceptors>
<jaxws:serviceBean>
<ref bean="routeWrapper" />
</jaxws:serviceBean>
</jaxws:server>
<!-- SOAP Service definitions -->
<jaxws:server id="QueryService" address="/queryManager">
<jaxws:inInterceptors>
@ -107,13 +94,11 @@
<!-- End Soap Service Definitions -->
<!-- REST Service Definitions -->
<jaxrs:server id="registryRestServices" address="/">
<jaxrs:server id="registryRestServices" address="/rest">
<jaxrs:inInterceptors>
<ref bean="webServiceInInterceptor" />
</jaxrs:inInterceptors>
<jaxrs:serviceBeans>
<ref bean="registryDataAccessService" />
<ref bean="registryAvailabilityService" />
<ref bean="registryObjectsRestService" />
<ref bean="repositoryObjectsRestService" />
<ref bean="queryProtocolRestService" />
@ -123,5 +108,4 @@
</jaxrs:serviceBeans>
</jaxrs:server>
<!-- End REST Endpoint definitions -->
</beans>

View file

@ -82,6 +82,9 @@ public class GetNotificationTest extends QueryTest {
@Autowired
private GetNotification getNotification;
@Autowired
private RegistrySOAPServices registrySoapClient;
@Before
public void createSubscription() throws Exception {
// Set normal registry object fields
@ -112,7 +115,7 @@ public class GetNotificationTest extends QueryTest {
String endpointType = DeliveryMethodTypes.SOAP;
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.address(RegistrySOAPServices.getNotificationListenerServiceUrl(
builder.address(registrySoapClient.getNotificationListenerServiceUrl(
"http://someaddress.com").toString());
W3CEndpointReference ref = builder.build();
DOMResult dom = new DOMResult();

View file

@ -6,6 +6,7 @@
<bean id="notificationListenerFactory"
class="com.raytheon.uf.edex.registry.ebxml.services.notification.MockNotificationListenerFactory">
<constructor-arg ref="EmailSender" />
<constructor-arg ref="registryWebServiceClient"/>
</bean>
</beans>

View file

@ -26,9 +26,7 @@ import java.util.Map;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import com.raytheon.uf.edex.registry.ebxml.services.notification.EmailSender;
import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDestination;
import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerFactory;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.WebServiceNotificationListener;
/**
@ -57,8 +55,9 @@ public class MockNotificationListenerFactory extends
*
* @param emailSender
*/
public MockNotificationListenerFactory(EmailSender emailSender) {
super(emailSender);
public MockNotificationListenerFactory(EmailSender emailSender,
RegistrySOAPServices registrySoapClient) {
super(emailSender, registrySoapClient);
}
private final Map<String, NotificationListener> mockListeners = new HashMap<String, NotificationListener>();