diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF index e9f65cb151..5249d58877 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java similarity index 82% rename from edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java index ea17639d56..cc4dde94be 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java @@ -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 * * * @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 diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java similarity index 84% rename from edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java index 8234045d26..2b7f9ef988 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java @@ -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 * * * @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 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(); } diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java deleted file mode 100644 index ed767bb84e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 5/3/2013     1948        bphillip    Initial implementation
- * 
- * - * @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); -} diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java deleted file mode 100644 index dcb395fb3e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 5/3/2013     1948        bphillip    Initial implementation
- * 
- * - * @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); - } -} diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java index 4821f57b46..268758471d 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java @@ -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 * * * @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 registryObjectServiceMap = CacheBuilder + private LoadingCache registryObjectServiceMap = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { 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 repositoryItemServiceMap = CacheBuilder + private LoadingCache repositoryItemServiceMap = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { 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 registryAvailabilityServiceMap = CacheBuilder - .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) - .build(new CacheLoader() { - public IRegistryAvailableRestService load(String url) { - return getPort(url, IRegistryAvailableRestService.class); - } - }); + private RegistryJaxbManager jaxbManager; - /** Map of known registry data access services */ - private static LoadingCache registryDataAccessServiceMap = CacheBuilder - .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) - .build(new CacheLoader() { - 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 { - jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper()); - } catch (JAXBException e) { - statusHandler.error("Error creating Registry jaxb manager!", e); - } + public RegistryRESTServices() throws JAXBException { + jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper()); } /** @@ -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 getRegistryObject( + public T getRegistryObject( Class 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 getPort(String url, - Class serviceClass) { + protected T getPort(String url, Class serviceClass) { T service = JAXRSClientFactory.create(url, serviceClass); Client client = (Client) Proxy.getInvocationHandler((Proxy) service); // Create HTTP header containing the calling registry diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java index e8128662f7..36afcfcbc3 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java @@ -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 * * * @@ -143,7 +144,7 @@ public class RegistrySOAPServices { } /** Cache of known notification services */ - private static LoadingCache notificationManagerServices = CacheBuilder + private LoadingCache notificationManagerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public NotificationListener load(String key) { @@ -152,7 +153,7 @@ public class RegistrySOAPServices { }); /** Cache of known lifecycle manager services */ - private static LoadingCache lifecycleManagerServices = CacheBuilder + private LoadingCache lifecycleManagerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public LifecycleManager load(String key) { @@ -161,7 +162,7 @@ public class RegistrySOAPServices { }); /** Cache of known cataloger services */ - private static LoadingCache catalogerServices = CacheBuilder + private LoadingCache catalogerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public Cataloger load(String key) { @@ -170,7 +171,7 @@ public class RegistrySOAPServices { }); /** Cache of known query services */ - private static LoadingCache queryServices = CacheBuilder + private LoadingCache queryServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public QueryManager load(String key) { @@ -179,7 +180,7 @@ public class RegistrySOAPServices { }); /** Cache of known validator services */ - private static LoadingCache validatorServices = CacheBuilder + private LoadingCache validatorServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { 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 getPort(String serviceUrl, + private T getPort(String serviceUrl, Class serviceInterface) throws RegistryServiceException { W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder(); endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL); diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java index 8c60278f57..3443e3f95e 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/search") +@Path("/search") public interface IQueryProtocolRestService { /** diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java index 6a68f42c39..62c14177e1 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/registryObjects/{objectId}") +@Path("/registryObjects/{objectId}") public interface IRegistryObjectsRestService { /** diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java index 9df46cb6bd..d379df5d19 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/repositoryItems/{repositoryItemId}") +@Path("/repositoryItems/{repositoryItemId}") public interface IRepositoryItemsRestService { @GET diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF index d0af5e773b..a226668242 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF @@ -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" diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml similarity index 69% rename from edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml index 93389743c6..ff513c5867 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml @@ -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"> - - - + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml index c1aa4e7067..68f42faeba 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml index 735a7eef05..b1f0c5a143 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml @@ -9,9 +9,10 @@ - + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml deleted file mode 100644 index 7dcfc5add5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml index 91c76aa249..d873ff99c7 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml @@ -10,11 +10,11 @@ - - + + diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml new file mode 100644 index 0000000000..da959022fa --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java index 62da08541f..e08a3c036b 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java @@ -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 * * * @author bphillip @@ -124,6 +129,21 @@ public class NcfRegistryFederationManager extends RegistryFederationManager } } + protected void submitObjects(List 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); diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java index 237ced6002..a610f00deb 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java @@ -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 * * * @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 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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java index 906c15c161..7c611ddfae 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java @@ -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 * * * @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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java index 846b1c9887..8a59f0d943 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java @@ -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 * * * @author bphillip @@ -55,6 +57,9 @@ public class NotificationServers { private List registryReplicationServers; public List getRegistryReplicationServers() { + if (registryReplicationServers == null) { + registryReplicationServers = new ArrayList(); + } return registryReplicationServers; } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java index 95600aa37d..31035cd435 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java @@ -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 * * * @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,8 +313,9 @@ public class RegistryReplicationManager { statusHandler .info("Checking availability of registry at: " + config.getRegistryBaseURL()); - if (RegistryRESTServices.isRegistryAvailable(config - .getRegistryBaseURL())) { + 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 remoteIds = new HashSet(); statusHandler .info("Getting registry object Ids from local registry..."); - Collection response = RegistryRESTServices + Collection 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,8 +718,9 @@ public class RegistryReplicationManager { statusHandler .info("Registry shutting down. Removing subscriptions from: [" + remoteRegistryBaseURL + "]"); - RegistryRESTServices.getRegistryDataAccessService( - remoteRegistryBaseURL) + dataDeliveryRestClient + .getRegistryDataAccessService( + remoteRegistryBaseURL) .removeSubscriptionsForSite( registry.getOwner()); statusHandler.info("Subscriptions removed from: [" @@ -647,7 +736,10 @@ public class RegistryReplicationManager { } } } + } + public static List 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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java index 383de1a25f..4e61335fbb 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java @@ -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 * * * @author bphillip @@ -60,21 +61,25 @@ 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, - escapeObjectId(objectId)); + RegistryObjectType objectToSubmit = restClient.getRegistryObject( + RegistryObjectType.class, remoteURL, + escapeObjectId(objectId)); if (objectToSubmit.getSlotByName(EbxmlObjectUtil.HOME_SLOT_NAME) == null) { objectToSubmit.addSlot(EbxmlObjectUtil.HOME_SLOT_NAME, diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java new file mode 100644 index 0000000000..6afa47f548 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java @@ -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; + +/** + *
+ * 
+ * Set of Data Delivery specific REST services
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * ------------ ----------  ----------- --------------------------
+ * 10/30/2013    1538       bphillip    Initial Creation
+ * 
+ * + * @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 registryAvailabilityServiceMap = CacheBuilder + .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) + .build(new CacheLoader() { + public IRegistryAvailableRestService load(String url) { + return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH, + IRegistryAvailableRestService.class); + } + }); + + /** Map of known registry data access services */ + private LoadingCache registryDataAccessServiceMap = CacheBuilder + .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) + .build(new CacheLoader() { + 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); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java similarity index 86% rename from edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java index 5037e79fd8..a6f0674c2d 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/registryAvailable") +@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX) @Service @Transactional public class RegistryAvailableRestService implements diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java similarity index 94% rename from edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java index 09ffd01fb7..facfc8c8ca 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java @@ -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
- * TODO: This class really needs to be moved to a data delivery specific plugin + * Implementation of the registry data access service interface * *
  * 
@@ -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
  * 
* * @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 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 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 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 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()) { diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java new file mode 100644 index 0000000000..4643169c6a --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java @@ -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; + +/** + *
+ * 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
+ * 
+ * + * @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 REGISTRY_COMPARATOR = new Comparator() { + @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 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 registries = new ArrayList(); + 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 registries = new ArrayList(); + 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; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF index 1a9b10b1ff..b867831290 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml index 204a44b0b3..d8d09cac58 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml @@ -44,6 +44,7 @@ +
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml index fbdbdfd0d8..1637b27e5e 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml @@ -139,6 +139,7 @@ value="urn:oasis:names:tc:ebxml-regrep:query:GetReferencedObject" /> + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml index e8d76be31f..d0d5c6c7ef 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml @@ -5,6 +5,7 @@ + - - + +
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml index 9b2254dc37..de004cce8e 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml @@ -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"> + + + + + + @@ -21,6 +28,7 @@ + @@ -74,15 +82,6 @@ - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties index 54063de7cc..bac6c8310d 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties @@ -11,4 +11,7 @@ ebxml-federation-sync-threads=3 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 \ No newline at end of file +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 \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java index 9b82aaf745..2dc99b9112 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java @@ -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 * * * * @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)); } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java index 7c8d94568d..10b7ab92d4 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java @@ -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 * * * @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, List> 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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java index fb37c5f3e0..a6bfad0cc8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java @@ -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 * * * @@ -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); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java index c42891d8eb..3b8e8e736c 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java @@ -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 * * * @@ -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 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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java index 60d0742319..f97e9e3d00 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java @@ -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 * * * @@ -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!"); } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java index a171a8e307..4af077512e 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java @@ -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 * * * @@ -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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java index c9c0175b84..60ba241641 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java @@ -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 * * * @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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java index cb97c2c478..df1981b448 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/search") +@Path("/search") @Service @Transactional public class QueryProtocolRestService implements IQueryProtocolRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java index 96bd37b01c..a8fa407dc4 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/registryObjects/{objectId}") +@Path("/registryObjects/{objectId}") @Service @Transactional public class RegistryObjectsRestService implements IRegistryObjectsRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java index 9bc3a88b3b..aa1ea5c5d3 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java @@ -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 * * * @author bphillip * @version 1 */ -@Path("/rest/repositoryItems/{repositoryItemId}") +@Path("/repositoryItems/{repositoryItemId}") @Service @Transactional public class RepositoryItemsRestService implements IRepositoryItemsRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html index 9c6bb8c14d..c9b88c4a72 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html @@ -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"); diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml index 8d6af6a551..906d5501e8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml @@ -11,21 +11,19 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> Data Delivery Web Services - - - webAppRootKey - registryEbxml - - + + + webAppRootKey + registryEbxml + + contextConfigLocation /webServiceBeans.xml - - org.springframework.web.context.ContextLoaderListener - + org.springframework.web.context.ContextLoaderListener @@ -50,12 +48,16 @@ org.apache.cxf.transport.servlet.CXFServlet static-welcome-file - /RegistryUserMenu.html + /registry/RegistryInterface.html static-resources-list .*\.html .*\.js .*\.css + + disable-address-updates + true + 1 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js index 5cb554ea33..99a72fc2bf 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js @@ -261,7 +261,7 @@ function enableElement(elemName){ */ function splitArray(data){ if (data == null){ - return new Array(); + return new Array(); }else{ var tokens = String(data).split(",") return tokens @@ -271,7 +271,7 @@ function splitArray(data){ /* * Adds an entry into the select box with the provided name */ -function addOptionToList(selectBoxName,text,value){ +function addOptionToList(selectBoxName,text,value){ var selectBox = document.getElementById(selectBoxName) var optn = document.createElement("OPTION"); optn.text = text; @@ -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 @@ -916,5 +929,4 @@ Array.prototype.contains = function(item){ return this.indexOf(item)!=-1 } - - + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html index e5774bfc69..1337ef3cc2 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html @@ -51,13 +51,14 @@ Date Ticket# Engineer Description + EDEX EBXML Registry Interface - - + + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html new file mode 100644 index 0000000000..f061c21e30 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html @@ -0,0 +1,207 @@ + + + + + + + + + Federation Status + + + +

Federation Status

+ + + + + + + + + + + + + + + +
Federated:[Unknown]
Processing Subscriptions:[Unknown]
My Registry ID:[Unknown]
+ +

+ + + + + + + + + + + + + + + + + + + + + + +
Resubmit Subscriptions To:
Synchronize with Registry:
Subscribe To Registry:
Unsubscribe From Registry:
+
+ +My Registry is Subscribed To: + + +
+
+ + + +Registries Subscribing to My Registry: + +
+
+ +Federation Members: + + +
+
+ +Object Types Currently Replicated: + +
+
+ + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html index 6037bbe008..b6c188b673 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html @@ -10,11 +10,11 @@ an export license or other authorization. Contractor Name: Raytheon Company Contractor Address: 6825 Pine Street, Suite 340 - Mail Stop B8 + Mail Stop B8 Omaha, NE 68106 402.291.0100 -See the AWIPS II Master Rights File ("Master Rights File.pdf") for +See the AWIPS II Master Rights File ("Master Rights File.pdf") for further licensing information. --> @@ -35,7 +35,7 @@ Date Ticket# Engineer Description - + NAVIGATION LINKS - Query Interface + Query Interface
- Subscription Backup + Subscription Backup +
+ Federation Status - + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js new file mode 100644 index 0000000000..d18e21c681 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js @@ -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); + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html index a5a4c33b5f..45a09d5de2 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html @@ -48,6 +48,7 @@ Date Ticket# Engineer Description + Registry Query Interface diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js index 890456d2b3..3ab0d37301 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js @@ -9,7 +9,7 @@ * an export license or other authorization. * * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 + * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 @@ -34,12 +34,12 @@ * @author bphillip * @version 1 */ - function getValidQueryTypes(){ - var tokens = callDataAccessService("getQueries","").split("\n") - var selectBox = document.getElementById("queryTypeInput") + function getValidQueryTypes(){ + var tokens = callDataAccessService("getQueries").split("\n") + var selectBox = document.getElementById("queryTypeInput") for(var i=0;i" 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 - } \ No newline at end of file + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml index 0c64d45399..5efaf8934f 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml @@ -8,10 +8,12 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> + + + - @@ -20,12 +22,8 @@ - - - - - + + @@ -48,17 +46,6 @@ - - - - - - - - - @@ -107,13 +94,11 @@ - + - - @@ -123,5 +108,4 @@ - \ No newline at end of file diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java index 1c63ab5475..88f96d26ae 100644 --- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java @@ -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(); diff --git a/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml b/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml index 2ee9c7da85..63b93c59ad 100644 --- a/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml +++ b/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml @@ -6,6 +6,7 @@ + \ No newline at end of file diff --git a/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java b/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java index 5ce2477af0..d276c690b9 100644 --- a/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java +++ b/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java @@ -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 mockListeners = new HashMap();