Issue #2022 Added registry federation capabilities
Change-Id: Ifbebc9b5487c34d41af613b869a0cc8384191028 Former-commit-id:7a908bbeaf
[formerlyb9f2bde20e
] [formerly7a908bbeaf
[formerlyb9f2bde20e
] [formerlyc3a376475b
[formerly 44c567e7c74cb4e8f27a5ea1435f3f7819efd7aa]]] Former-commit-id:c3a376475b
Former-commit-id:1c50a8b9d3
[formerlyad039bae0c
] Former-commit-id:5fe0928121
This commit is contained in:
parent
7d73a32b0a
commit
bb8c38e9c0
64 changed files with 1669 additions and 539 deletions
|
@ -40,6 +40,7 @@ Export-Package: javax.servlet,
|
|||
org.apache.cxf.databinding,
|
||||
org.apache.cxf.helpers,
|
||||
org.apache.cxf.interceptor,
|
||||
org.apache.cxf.jaxrs.client,
|
||||
org.apache.cxf.jaxrs.ext.xml,
|
||||
org.apache.cxf.message,
|
||||
org.apache.cxf.phase,
|
||||
|
|
|
@ -32,12 +32,14 @@ export BROKER_ADDR=localhost
|
|||
export PYPIES_SERVER=http://localhost:9582
|
||||
|
||||
# data delivery specific variables, used below in the localization section
|
||||
export NCF_ADDRESS=http://0.0.0.0:8084
|
||||
export DATADELIVERY_HOST=localhost
|
||||
export DATADELIVERY_PORT=9588
|
||||
# Currently the registry is hosted on datadelivery, but this could be changed in the future
|
||||
export EBXML_REGISTRY_HOST=${DATADELIVERY_HOST}
|
||||
export EBXML_REGISTRY_PORT=${DATADELIVERY_PORT}
|
||||
export EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED=True
|
||||
export EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED=false
|
||||
export EBXML_REGISTRY_FEDERATION_ENABLED=false
|
||||
|
||||
# moved here from environment.xml
|
||||
# these values are returned to clients that contact the localization service
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="metadataTxTemplate" class="org.springframework.transaction.support.TransactionTemplate">
|
||||
<property name="transactionManager" ref="metadataTxManager"/>
|
||||
</bean>
|
||||
|
||||
<bean id="mapsSessionFactory"
|
||||
class="com.raytheon.uf.edex.database.DatabaseSessionFactoryBean">
|
||||
|
|
|
@ -146,6 +146,8 @@ wrapper.java.additional.45=-Dedex.tmp=${TEMP_DIR}
|
|||
wrapper.java.additional.46=-Dncf.bandwidth.manager.service=${NCF_BANDWIDTH_MANAGER_SERVICE}
|
||||
wrapper.java.additional.52=-DinitializeHibernatables=true
|
||||
wrapper.java.additional.53=-Dorg.apache.camel.jmx.disabled=true
|
||||
wrapper.java.additional.54=-DebxmlFederationEnabled=${EBXML_REGISTRY_FEDERATION_ENABLED}
|
||||
wrapper.java.additional.55=-DebxmlSubscriptionsEnabled=${EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED}
|
||||
|
||||
# Initial Java Heap Size (in MB)
|
||||
wrapper.java.initmemory=${INIT_MEM}
|
||||
|
|
|
@ -12,7 +12,8 @@ Export-Package: com.raytheon.uf.common.registry,
|
|||
com.raytheon.uf.common.registry.ebxml.encoder,
|
||||
com.raytheon.uf.common.registry.ebxml.slots,
|
||||
com.raytheon.uf.common.registry.handler,
|
||||
com.raytheon.uf.common.registry.services
|
||||
com.raytheon.uf.common.registry.services,
|
||||
com.raytheon.uf.common.registry.services.rest
|
||||
Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
|
@ -26,5 +27,6 @@ Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
|
|||
org.apache.http;bundle-version="4.1.2",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
org.springframework;bundle-version="2.5.6",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
org.apache.commons.cxf;bundle-version="1.0.0"
|
||||
Import-Package: com.vividsolutions.jts.geom
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* 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.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Service data formats
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class Format {
|
||||
|
||||
public static final String EBRIM = "application/ebrim+xml";
|
||||
|
||||
}
|
|
@ -45,6 +45,8 @@ public class RegistryObjectTypes {
|
|||
|
||||
public static final String ASSOCIATION = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association";
|
||||
|
||||
public static final String ASSOCIATION_PATH = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:AssociationType/HasFederationMember";
|
||||
|
||||
public static final String AUDITABLE_EVENT = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:AuditableEvent";
|
||||
|
||||
public static final String CLASSIFICATION = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification";
|
||||
|
|
|
@ -90,7 +90,7 @@ public final class RegistryUtil {
|
|||
/**
|
||||
* The default internal owner
|
||||
*/
|
||||
public static final String DEFAULT_OWNER = "EDEX_Internal_User";
|
||||
public static final String DEFAULT_OWNER = "NCF";
|
||||
|
||||
// A private mapping of attribute types to slot types, used when storing an
|
||||
// object to the registry to map QueryableAttributes to SlotConverters.
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
/**
|
||||
* 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.services;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService;
|
||||
import com.raytheon.uf.common.registry.services.rest.IRegistryObjectsRestService;
|
||||
import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class used to access REST services provided by the registry
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class RegistryRESTServices {
|
||||
|
||||
/** Map of known registry object request services */
|
||||
private static LoadingCache<String, IRegistryObjectsRestService> registryObjectServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, IRegistryObjectsRestService>() {
|
||||
public IRegistryObjectsRestService load(String key) {
|
||||
return JAXRSClientFactory.create(key,
|
||||
IRegistryObjectsRestService.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known repository item request services */
|
||||
private static LoadingCache<String, IRepositoryItemsRestService> repositoryItemServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, IRepositoryItemsRestService>() {
|
||||
public IRepositoryItemsRestService load(String key) {
|
||||
return JAXRSClientFactory.create(key,
|
||||
IRepositoryItemsRestService.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known registry availability services */
|
||||
private static LoadingCache<String, IRegistryAvailableRestService> registryAvailabilityServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, IRegistryAvailableRestService>() {
|
||||
public IRegistryAvailableRestService load(String key) {
|
||||
return JAXRSClientFactory.create(key,
|
||||
IRegistryAvailableRestService.class);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistryRESTServices.class);
|
||||
|
||||
/**
|
||||
* Gets the registry object rest service implementation
|
||||
*
|
||||
* @param baseURL
|
||||
* The base URL of the registry
|
||||
* @return The service implementation
|
||||
* @throws RegistryServiceException
|
||||
* If an invalid URL is provided
|
||||
*/
|
||||
public static IRegistryObjectsRestService getRegistryObjectService(
|
||||
String baseURL) throws RegistryServiceException {
|
||||
try {
|
||||
return registryObjectServiceMap.get(baseURL);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting Registry Object Rest Service", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a registry object via the rest service
|
||||
*
|
||||
* @param <T>
|
||||
* Type of object extending RegistryObjectType
|
||||
* @param baseURL
|
||||
* The base URL of the registry
|
||||
* @param objectId
|
||||
* The id of the object to retrieve
|
||||
* @return The object
|
||||
* @throws JAXBException
|
||||
* If errors occur while serializing the object
|
||||
* @throws RegistryServiceException
|
||||
* If an invalid URL is provided
|
||||
*/
|
||||
public static <T extends RegistryObjectType> T getRegistryObject(
|
||||
Class<T> expectedType, String baseURL, String objectId)
|
||||
throws JAXBException, RegistryServiceException {
|
||||
return SerializationUtil.unmarshalFromXml(expectedType,
|
||||
getRegistryObjectService(baseURL).getRegistryObject(objectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the repository item rest service implementation
|
||||
*
|
||||
* @param baseURL
|
||||
* The base URL of the registry
|
||||
* @return The service implementation
|
||||
* @throws RegistryServiceException
|
||||
* If an invalid URL is provided
|
||||
*/
|
||||
public static IRepositoryItemsRestService getRepositoryItemService(
|
||||
String baseURL) throws RegistryServiceException {
|
||||
try {
|
||||
return repositoryItemServiceMap.get(baseURL);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting Repository Item Rest Service", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a repository item via the rest service
|
||||
*
|
||||
* @param baseURL
|
||||
* The base URL of the registry
|
||||
* @param repositoryItemId
|
||||
* The id of the object
|
||||
* @return The repository item
|
||||
* @throws RegistryServiceException
|
||||
* If an invalid URL is provided
|
||||
*/
|
||||
public static byte[] getRepositoryItem(String baseURL,
|
||||
String repositoryItemId) throws RegistryServiceException {
|
||||
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
|
||||
* @throws RegistryServiceException
|
||||
* If an invalid URL is provided
|
||||
*/
|
||||
public static IRegistryAvailableRestService getRegistryAvailableService(
|
||||
String baseURL) throws RegistryServiceException {
|
||||
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) {
|
||||
try {
|
||||
getRegistryAvailableService(baseURL).isRegistryAvailable();
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
statusHandler.error(
|
||||
"Registry at [" + baseURL + "] not available: ",
|
||||
t.getLocalizedMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,9 +21,8 @@ package com.raytheon.uf.common.registry.services;
|
|||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
|
||||
|
@ -34,20 +33,14 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryExceptio
|
|||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Validator;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
||||
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.ExtensibleObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
|
@ -72,12 +65,9 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
public class RegistrySOAPServices {
|
||||
|
||||
/** The logger */
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistrySOAPServices.class);
|
||||
|
||||
/** The HTTP prefix */
|
||||
private static final String HTTP = "http://";
|
||||
|
||||
/** Path separator */
|
||||
private static final String PATH_SEPARATOR = "/";
|
||||
|
||||
|
@ -99,20 +89,50 @@ public class RegistrySOAPServices {
|
|||
/** The name of the validator service */
|
||||
private static final String VALIDATOR_SERVICE_NAME = "validator";
|
||||
|
||||
/** Map of known notification services */
|
||||
private static Map<URL, NotificationListener> notificationServiceMap = new ConcurrentHashMap<URL, NotificationListener>();
|
||||
/** Cache of known notification services */
|
||||
private static LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, NotificationListener>() {
|
||||
public NotificationListener load(String key) {
|
||||
return getPort(key, NotificationListener.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known lifecycle manager services */
|
||||
private static Map<URL, LifecycleManager> lifecycleManagerServiceMap = new ConcurrentHashMap<URL, LifecycleManager>();
|
||||
/** Cache of known lifecycle manager services */
|
||||
private static LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, LifecycleManager>() {
|
||||
public LifecycleManager load(String key) {
|
||||
return getPort(key, LifecycleManager.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known cataloger services */
|
||||
private static Map<URL, Cataloger> catalogerServiceMap = new ConcurrentHashMap<URL, Cataloger>();
|
||||
/** Cache of known cataloger services */
|
||||
private static LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, Cataloger>() {
|
||||
public Cataloger load(String key) {
|
||||
return getPort(key, Cataloger.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known query services */
|
||||
private static Map<URL, QueryManager> queryServiceMap = new ConcurrentHashMap<URL, QueryManager>();
|
||||
/** Cache of known query services */
|
||||
private static LoadingCache<String, QueryManager> queryServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, QueryManager>() {
|
||||
public QueryManager load(String key) {
|
||||
return getPort(key, QueryManager.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known validator services */
|
||||
private static Map<URL, Validator> validatorServiceMap = new ConcurrentHashMap<URL, Validator>();
|
||||
/** Cache of known validator services */
|
||||
private static LoadingCache<String, Validator> validatorServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, Validator>() {
|
||||
public Validator load(String key) {
|
||||
return getPort(key, Validator.class);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the notification listener service URL for the given host
|
||||
|
@ -123,9 +143,9 @@ public class RegistrySOAPServices {
|
|||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static String getNotificationListenerServiceUrl(final String host)
|
||||
public static String getNotificationListenerServiceUrl(final String baseURL)
|
||||
throws MalformedURLException {
|
||||
return new URL(HTTP + host + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME)
|
||||
return new URL(baseURL + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
@ -135,43 +155,32 @@ public class RegistrySOAPServices {
|
|||
* @param host
|
||||
* The host to get the notification listener service for
|
||||
* @return The notification listener service for the given host
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static NotificationListener getNotificationListenerServiceForHost(
|
||||
final String host) throws MalformedURLException {
|
||||
return getNotificationListenerServiceForUrl(getNotificationListenerServiceUrl(host));
|
||||
final String host) throws RegistryServiceException {
|
||||
return getNotificationListenerServiceForUrl(host + PATH_SEPARATOR
|
||||
+ NOTIFICATION_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notification listener service at the given URL string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* @param url
|
||||
* The url
|
||||
* @return The notification listener service at the given URL
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static NotificationListener getNotificationListenerServiceForUrl(
|
||||
final String url) throws MalformedURLException {
|
||||
return getNotificationListener(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notification listener service at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The notification listener service URL
|
||||
* @return The notification listener service at the given URL
|
||||
*/
|
||||
private static NotificationListener getNotificationListener(URL url) {
|
||||
NotificationListener notificationListener = notificationServiceMap
|
||||
.get(url);
|
||||
if (notificationListener == null) {
|
||||
notificationListener = getPort(url, NotificationListener.class);
|
||||
notificationServiceMap.put(url, notificationListener);
|
||||
final String url) throws RegistryServiceException {
|
||||
try {
|
||||
return notificationManagerServices.get(url);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting notification manager at [" + url + "]", e);
|
||||
}
|
||||
return notificationListener;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,43 +189,32 @@ public class RegistrySOAPServices {
|
|||
* @param host
|
||||
* The host to get the lifecycle manager service for
|
||||
* @return The lifecycle manager service for the given host
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static LifecycleManager getLifecycleManagerServiceForHost(
|
||||
final String host) throws MalformedURLException {
|
||||
return getLifecycleManager(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ LIFECYCLE_MANAGER_SERVICE_NAME));
|
||||
final String host) throws RegistryServiceException {
|
||||
return getLifecycleManagerServiceForUrl(host + PATH_SEPARATOR
|
||||
+ LIFECYCLE_MANAGER_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lifecycle manager service for the given URL string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* @param url
|
||||
* The service URL
|
||||
* @return The lifecycle manager service at the given URL string
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static LifecycleManager getLifecycleManagerServiceForUrl(
|
||||
final String url) throws MalformedURLException {
|
||||
return getLifecycleManager(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lifecycle manager service for at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The url
|
||||
* @return The lifecycle manager service at the given URL
|
||||
*/
|
||||
private static LifecycleManager getLifecycleManager(URL url) {
|
||||
LifecycleManager lcm = lifecycleManagerServiceMap.get(url);
|
||||
if (lcm == null) {
|
||||
lcm = getPort(url, LifecycleManager.class);
|
||||
lifecycleManagerServiceMap.put(url, lcm);
|
||||
final String url) throws RegistryServiceException {
|
||||
try {
|
||||
return lifecycleManagerServices.get(url);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting lifecycle manager at [" + url + "]", e);
|
||||
}
|
||||
return lcm;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,43 +223,32 @@ public class RegistrySOAPServices {
|
|||
* @param host
|
||||
* The host to get the cataloger service for
|
||||
* @return The cataloger service at the given host
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Cataloger getCatalogerServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getCataloger(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ CATALOGER_SERVICE_NAME));
|
||||
throws RegistryServiceException {
|
||||
return getCatalogerServiceForUrl(host + PATH_SEPARATOR
|
||||
+ CATALOGER_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cataloger service for the given url string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* @param url
|
||||
* the url string
|
||||
* @return The cataloger service
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Cataloger getCatalogerServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getCataloger(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cataloger service at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The URL
|
||||
* @return The cataloger service at the given URL
|
||||
*/
|
||||
private static Cataloger getCataloger(URL url) {
|
||||
Cataloger cataloger = catalogerServiceMap.get(url);
|
||||
if (cataloger == null) {
|
||||
cataloger = getPort(url, Cataloger.class);
|
||||
catalogerServiceMap.put(url, cataloger);
|
||||
throws RegistryServiceException {
|
||||
try {
|
||||
return catalogerServices.get(url);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException("Error getting cataloger at ["
|
||||
+ url + "]", e);
|
||||
}
|
||||
return cataloger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,13 +257,12 @@ public class RegistrySOAPServices {
|
|||
* @param host
|
||||
* The host name
|
||||
* @return The query manager service
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static QueryManager getQueryServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getQueryManager(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ QUERY_SERVICE_NAME));
|
||||
throws RegistryServiceException {
|
||||
return getQueryServiceForUrl(host + PATH_SEPARATOR + QUERY_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,28 +271,17 @@ public class RegistrySOAPServices {
|
|||
* @param serviceUrl
|
||||
* The url string
|
||||
* @return The query manager service at the given url string
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static QueryManager getQueryServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getQueryManager(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query manager service at the given url
|
||||
*
|
||||
* @param url
|
||||
* The url
|
||||
* @return The query manager service at the give URL
|
||||
*/
|
||||
private static QueryManager getQueryManager(URL url) {
|
||||
QueryManager queryManager = queryServiceMap.get(url);
|
||||
if (queryManager == null) {
|
||||
queryManager = getPort(url, QueryManager.class);
|
||||
queryServiceMap.put(url, queryManager);
|
||||
throws RegistryServiceException {
|
||||
try {
|
||||
return queryServices.get(url);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting query manager at [" + url + "]", e);
|
||||
}
|
||||
return queryManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,13 +290,13 @@ public class RegistrySOAPServices {
|
|||
* @param host
|
||||
* The host
|
||||
* @return The validator service for the given host
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Validator getValidatorServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getValidator(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ VALIDATOR_SERVICE_NAME));
|
||||
throws RegistryServiceException {
|
||||
return getValidatorServiceForUrl(host + PATH_SEPARATOR
|
||||
+ VALIDATOR_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,28 +305,17 @@ public class RegistrySOAPServices {
|
|||
* @param serviceUrl
|
||||
* The url string
|
||||
* @return The validator service for the given url string
|
||||
* @throws MalformedURLException
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Validator getValidatorServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getValidator(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validator service for the given URL
|
||||
*
|
||||
* @param url
|
||||
* The URL
|
||||
* @return The validator service at the given URL
|
||||
*/
|
||||
private static Validator getValidator(URL url) {
|
||||
Validator validator = validatorServiceMap.get(url);
|
||||
if (validator == null) {
|
||||
validator = getPort(url, Validator.class);
|
||||
validatorServiceMap.put(url, validator);
|
||||
throws RegistryServiceException {
|
||||
try {
|
||||
return validatorServices.get(url);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RegistryServiceException("Error getting validator at ["
|
||||
+ url + "]", e);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -372,7 +336,7 @@ public class RegistrySOAPServices {
|
|||
LifecycleManager lcm;
|
||||
try {
|
||||
lcm = getLifecycleManagerServiceForHost(host);
|
||||
} catch (MalformedURLException e) {
|
||||
} catch (RegistryServiceException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting lifecyclemanager for host at [" + host + "]",
|
||||
e);
|
||||
|
@ -405,76 +369,8 @@ public class RegistrySOAPServices {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SubmitObjectsRequest with the given parameters
|
||||
*/
|
||||
public static SubmitObjectsRequest createSubmitObjectRequest(String id,
|
||||
Mode mode, String comment, boolean checkReferences,
|
||||
RegistryObjectListType objectList, Object... slotValues) {
|
||||
SubmitObjectsRequest request = new SubmitObjectsRequest();
|
||||
request.setId(id);
|
||||
request.setMode(mode);
|
||||
request.setRegistryObjectList(objectList);
|
||||
request.setComment(comment);
|
||||
request.setCheckReferences(checkReferences);
|
||||
addSlots(request, slotValues);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a RemoveObjectsRequest with the given parameters
|
||||
*/
|
||||
public static RemoveObjectsRequest createRemoveObjectsRequest(String id,
|
||||
String comment, boolean deleteChildren, String deletionScope,
|
||||
ObjectRefListType objectRefs, QueryType query,
|
||||
Collection<SlotType> slots) {
|
||||
RemoveObjectsRequest request = new RemoveObjectsRequest();
|
||||
request.setId(id);
|
||||
request.setComment(comment);
|
||||
request.setDeleteChildren(deleteChildren);
|
||||
request.setDeletionScope(deletionScope);
|
||||
request.setObjectRefList(objectRefs);
|
||||
if (query != null) {
|
||||
request.setQuery(query);
|
||||
}
|
||||
if (slots != null) {
|
||||
request.getSlot().addAll(slots);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a QueryRequest with the given parameters
|
||||
*/
|
||||
public static QueryRequest createQueryRequest(String id, String comment,
|
||||
QueryType query, ResponseOptionType responseOption) {
|
||||
QueryRequest request = new QueryRequest();
|
||||
request.setId(id);
|
||||
request.setComment(comment);
|
||||
request.setQuery(query);
|
||||
request.setResponseOption(responseOption);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a QueryType object with the given parameters
|
||||
*/
|
||||
public static QueryType createQueryType(String queryDefinition,
|
||||
Object... slotValues) {
|
||||
QueryType query = new QueryType();
|
||||
query.setQueryDefinition(queryDefinition);
|
||||
addSlots(query, slotValues);
|
||||
return query;
|
||||
}
|
||||
|
||||
private static void addSlots(ExtensibleObjectType obj, Object... slotValues) {
|
||||
for (int i = 0; i < slotValues.length; i += 2) {
|
||||
obj.addSlot((String) slotValues[i], slotValues[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Object> T getPort(URL serviceUrl,
|
||||
private static <T extends Object> T getPort(String serviceUrl,
|
||||
Class<?> serviceInterface) {
|
||||
W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder();
|
||||
endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL);
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* 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.services.rest;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the QueryProtocol rest service
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/search")
|
||||
public interface IQueryProtocolRestService {
|
||||
|
||||
/**
|
||||
* Executes a query based on the submitted query parameters
|
||||
*
|
||||
* @param info
|
||||
* The UriInfo containing the query parameters
|
||||
* @return The marshalled QueryResponse
|
||||
* @throws JAXBException
|
||||
* If errors occur while marshalling the response
|
||||
* @throws MsgRegistryException
|
||||
* If errors occur in the registry while querying for the
|
||||
* objects
|
||||
*/
|
||||
@GET
|
||||
@Produces("text/xml")
|
||||
public String executeQuery(@Context UriInfo info) throws JAXBException,
|
||||
MsgRegistryException;
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* 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.services.rest;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the registry available service
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryAvailable")
|
||||
public interface IRegistryAvailableRestService {
|
||||
|
||||
/**
|
||||
* Method that simply returns a string. This method is called to see if
|
||||
* registry services are available for a registry
|
||||
*
|
||||
* @return A string
|
||||
*/
|
||||
@GET
|
||||
@Produces("text/plain")
|
||||
public String isRegistryAvailable();
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* 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.services.rest;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the registry objects rest service
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryObjects/{objectId}")
|
||||
public interface IRegistryObjectsRestService {
|
||||
|
||||
/**
|
||||
* Gets a registry object based on the object ID specified in the path
|
||||
*
|
||||
* @param objectId
|
||||
* The object Id of the object
|
||||
* @return The marshalled object
|
||||
* @throws JAXBException
|
||||
* If errors occur marshalling the object
|
||||
*/
|
||||
@GET
|
||||
@Produces("text/xml")
|
||||
public String getRegistryObject(@PathParam("objectId") String objectId)
|
||||
throws JAXBException;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* 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.services.rest;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the repository items rest service
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/repositoryItems/{repositoryItemId}")
|
||||
public interface IRepositoryItemsRestService {
|
||||
|
||||
@GET
|
||||
@Produces("application/octet-stream")
|
||||
public byte[] getRepositoryItem(
|
||||
@PathParam("repositoryItemId") String repositoryItemId);
|
||||
}
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.lcm.v4;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -30,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -92,6 +95,22 @@ public class RemoveObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected String username;
|
||||
|
||||
public RemoveObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public RemoveObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots, QueryType query,
|
||||
ObjectRefListType objectRefList, Boolean checkReferences,
|
||||
Boolean deleteChildren, String deletionScope) {
|
||||
super(id, comment, slots);
|
||||
this.query = query;
|
||||
this.objectRefList = objectRefList;
|
||||
this.checkReferences = checkReferences;
|
||||
this.deleteChildren = deleteChildren;
|
||||
this.deletionScope = deletionScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the query property.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.lcm.v4;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -31,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
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.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -78,6 +80,20 @@ public class SubmitObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected Mode mode;
|
||||
|
||||
public SubmitObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public SubmitObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots,
|
||||
RegistryObjectListType registryObjectList, Boolean checkReferences,
|
||||
Mode mode) {
|
||||
super(id, comment, slots);
|
||||
this.registryObjectList = registryObjectList;
|
||||
this.checkReferences = checkReferences;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the registryObjectList property.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.lcm.v4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -32,6 +33,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -89,6 +91,23 @@ public class UpdateObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected Mode mode;
|
||||
|
||||
public UpdateObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public UpdateObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots, QueryType query,
|
||||
ObjectRefListType objectRefList,
|
||||
List<UpdateActionType> updateAction, Boolean checkReferences,
|
||||
Mode mode) {
|
||||
super(id, comment, slots);
|
||||
this.query = query;
|
||||
this.objectRefList = objectRefList;
|
||||
this.updateAction = updateAction;
|
||||
this.checkReferences = checkReferences;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the query property.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.query.v4;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -31,6 +32,7 @@ import javax.xml.bind.annotation.XmlSchemaType;
|
|||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -73,6 +75,33 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@DynamicSerialize
|
||||
public class QueryRequest extends RegistryRequestType {
|
||||
|
||||
/** The queryID canonical query parameter name */
|
||||
public static final String QUERY_ID = "queryId";
|
||||
|
||||
/** The depth canonical query parameter name */
|
||||
public static final String DEPTH = "depth";
|
||||
|
||||
/** The format canonical query parameter name */
|
||||
public static final String FORMAT = "format";
|
||||
|
||||
/** The federated canonical query parameter name */
|
||||
public static final String FEDERATED = "federated";
|
||||
|
||||
/** The federation canonical query parameter name */
|
||||
public static final String FEDERATION = "federation";
|
||||
|
||||
/** The matchOlderVersion canonical query parameter name */
|
||||
public static final String MATCH_OLDER_VERSIONS = "matchOlderVersions";
|
||||
|
||||
/** The startIndex canonical query parameter name */
|
||||
public static final String START_INDEX = "startIndex";
|
||||
|
||||
/** The lang canonical query parameter name */
|
||||
public static final String LANG = "lang";
|
||||
|
||||
/** The maxResults canonical query parameter name */
|
||||
public static final String MAX_RESULTS = "maxResults";
|
||||
|
||||
@XmlElement(name = "ResponseOption", required = true)
|
||||
@DynamicSerializeElement
|
||||
protected ResponseOptionType responseOption;
|
||||
|
@ -114,6 +143,46 @@ public class QueryRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected Boolean matchOlderVersions;
|
||||
|
||||
public QueryRequest() {
|
||||
|
||||
}
|
||||
|
||||
public QueryRequest(String id, String comment, Collection<SlotType> slots,
|
||||
ResponseOptionType responseOption, QueryType query,
|
||||
Boolean federated, String federation, String format, String lang,
|
||||
Integer startIndex, Integer maxResults, Integer depth,
|
||||
Boolean matchOlderVersions) {
|
||||
super(id, comment, slots);
|
||||
this.responseOption = responseOption;
|
||||
this.query = query;
|
||||
this.federated = federated;
|
||||
this.federation = federation;
|
||||
this.format = format;
|
||||
this.lang = lang;
|
||||
this.startIndex = BigInteger.valueOf(startIndex.longValue());
|
||||
this.maxResults = BigInteger.valueOf(maxResults.longValue());
|
||||
this.depth = BigInteger.valueOf(depth.longValue());
|
||||
this.matchOlderVersions = matchOlderVersions;
|
||||
}
|
||||
|
||||
public QueryRequest(String id, String comment,
|
||||
ResponseOptionType responseOption, QueryType query,
|
||||
Boolean federated, String federation, String format, String lang,
|
||||
Integer startIndex, Integer maxResults, Integer depth,
|
||||
Boolean matchOlderVersions) {
|
||||
super(id, comment, null);
|
||||
this.responseOption = responseOption;
|
||||
this.query = query;
|
||||
this.federated = federated;
|
||||
this.federation = federation;
|
||||
this.format = format;
|
||||
this.lang = lang;
|
||||
this.startIndex = BigInteger.valueOf(startIndex.longValue());
|
||||
this.maxResults = BigInteger.valueOf(maxResults.longValue());
|
||||
this.depth = BigInteger.valueOf(depth.longValue());
|
||||
this.matchOlderVersions = matchOlderVersions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder strBuilder = new StringBuilder();
|
||||
|
|
|
@ -76,6 +76,15 @@ public class ResponseOptionType {
|
|||
@DynamicSerializeElement
|
||||
protected Boolean returnComposedObjects;
|
||||
|
||||
public ResponseOptionType() {
|
||||
|
||||
}
|
||||
|
||||
public ResponseOptionType(String returnType, Boolean returnComposedObjects) {
|
||||
this.returnType = returnType;
|
||||
this.returnComposedObjects = returnComposedObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the returnType property.
|
||||
*
|
||||
|
|
|
@ -65,7 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
*/
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AnyValueType", propOrder = { "anyValue" })
|
||||
|
@ -80,6 +80,14 @@ public class AnyValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "anyValue";
|
||||
|
||||
public AnyValueType() {
|
||||
|
||||
}
|
||||
|
||||
public AnyValueType(Object anyValue) {
|
||||
this.anyValue = anyValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -66,7 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "BooleanValueType", propOrder = { "booleanValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "BooleanValue")
|
||||
public class BooleanValueType extends ValueType {
|
||||
|
||||
|
@ -77,6 +77,14 @@ public class BooleanValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "booleanValue";
|
||||
|
||||
public BooleanValueType() {
|
||||
|
||||
}
|
||||
|
||||
public BooleanValueType(Boolean booleanValue) {
|
||||
this.booleanValue = booleanValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -92,6 +92,16 @@ public class CollectionValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "collectionValue";
|
||||
|
||||
public CollectionValueType() {
|
||||
|
||||
}
|
||||
|
||||
public CollectionValueType(List<ValueType> collectionValue,
|
||||
String collectionType) {
|
||||
this.collectionValue = collectionValue;
|
||||
this.collectionType = collectionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -69,7 +69,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "DateTimeValueType", propOrder = { "dateTimeValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "DateTimeValue")
|
||||
public class DateTimeValueType extends ValueType {
|
||||
|
||||
|
@ -82,6 +82,14 @@ public class DateTimeValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "dateTimeValue";
|
||||
|
||||
public DateTimeValueType() {
|
||||
|
||||
}
|
||||
|
||||
public DateTimeValueType(XMLGregorianCalendar dateTimeValue) {
|
||||
this.dateTimeValue = dateTimeValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -80,6 +80,14 @@ public class DurationValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "durationValue";
|
||||
|
||||
public DurationValueType() {
|
||||
|
||||
}
|
||||
|
||||
public DurationValueType(Duration durationValue) {
|
||||
this.durationValue = durationValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -95,6 +96,13 @@ public abstract class ExtensibleObjectType {
|
|||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ExtensibleObjectType.class);
|
||||
|
||||
@BatchSize(size = 500)
|
||||
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
@JoinTable(schema = "ebxml", inverseJoinColumns = @JoinColumn(name = "child_slot_key"))
|
||||
@XmlElement(name = "Slot")
|
||||
@DynamicSerializeElement
|
||||
protected Set<SlotType> slot;
|
||||
|
||||
private static final Map<Class<?>, Class<?>> SLOT_VALUE_TYPE_MAP;
|
||||
|
||||
static {
|
||||
|
@ -106,6 +114,26 @@ public abstract class ExtensibleObjectType {
|
|||
|
||||
}
|
||||
|
||||
protected ExtensibleObjectType() {
|
||||
|
||||
}
|
||||
|
||||
protected ExtensibleObjectType(Collection<SlotType> slots) {
|
||||
if (slots != null) {
|
||||
getSlot().addAll(slots);
|
||||
}
|
||||
}
|
||||
|
||||
protected ExtensibleObjectType(Object... slotNameValues) {
|
||||
if (slotNameValues.length % 2 != 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Incorrect number of arguments submitted to ExtensibleObjectType constructor");
|
||||
}
|
||||
for (int i = 0; i < slotNameValues.length; i += 2) {
|
||||
addSlot((String) slotNameValues[i], slotNameValues[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
public SlotType createSlot(String slotName, Object slotValue) {
|
||||
SlotType slot = new SlotType();
|
||||
slot.setName(slotName);
|
||||
|
@ -141,13 +169,6 @@ public abstract class ExtensibleObjectType {
|
|||
addSlot(slotName, slotValue);
|
||||
}
|
||||
|
||||
@BatchSize(size = 500)
|
||||
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
@JoinTable(schema = "ebxml", inverseJoinColumns = @JoinColumn(name = "child_slot_key"))
|
||||
@XmlElement(name = "Slot")
|
||||
@DynamicSerializeElement
|
||||
protected Set<SlotType> slot;
|
||||
|
||||
/**
|
||||
* Gets the value of the slot property.
|
||||
*
|
||||
|
|
|
@ -66,7 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "FloatValueType", propOrder = { "floatValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "FloatValue")
|
||||
public class FloatValueType extends ValueType {
|
||||
@Column(name = COLUMN_NAME)
|
||||
|
@ -76,6 +76,14 @@ public class FloatValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "floatValue";
|
||||
|
||||
public FloatValueType() {
|
||||
|
||||
}
|
||||
|
||||
public FloatValueType(Float floatValue) {
|
||||
this.floatValue = floatValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -78,6 +78,22 @@ public class IntegerValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "integerValue";
|
||||
|
||||
public IntegerValueType() {
|
||||
|
||||
}
|
||||
|
||||
public IntegerValueType(BigInteger integerValue) {
|
||||
this.integerValue = integerValue;
|
||||
}
|
||||
|
||||
public IntegerValueType(Integer integerValue) {
|
||||
this.integerValue = BigInteger.valueOf(integerValue.longValue());
|
||||
}
|
||||
|
||||
public IntegerValueType(int integerValue) {
|
||||
this.integerValue = BigInteger.valueOf(integerValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -98,6 +98,18 @@ public class InternationalStringType implements Serializable {
|
|||
@JoinTable(schema = "ebxml")
|
||||
protected List<LocalizedStringType> localizedString;
|
||||
|
||||
public InternationalStringType() {
|
||||
|
||||
}
|
||||
|
||||
public InternationalStringType(String lang, String value) {
|
||||
this.localizedString.add(new LocalizedStringType(lang, value));
|
||||
}
|
||||
|
||||
public InternationalStringType(String value) {
|
||||
this.localizedString.add(new LocalizedStringType(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the localizedString property.
|
||||
*
|
||||
|
|
|
@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "InternationalStringValueType", propOrder = { "internationalStringValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "InternationalStringValue")
|
||||
public class InternationalStringValueType extends ValueType {
|
||||
|
||||
|
@ -79,6 +79,26 @@ public class InternationalStringValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "internationalStringValue";
|
||||
|
||||
public InternationalStringValueType() {
|
||||
|
||||
}
|
||||
|
||||
public InternationalStringValueType(
|
||||
InternationalStringType internationalStringValue) {
|
||||
this.internationalStringValue = internationalStringValue;
|
||||
}
|
||||
|
||||
public InternationalStringValueType(String internationalStringValue) {
|
||||
this.internationalStringValue = new InternationalStringType(
|
||||
internationalStringValue);
|
||||
}
|
||||
|
||||
public InternationalStringValueType(String lang,
|
||||
String internationalStringValue) {
|
||||
this.internationalStringValue = new InternationalStringType(lang,
|
||||
internationalStringValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -90,6 +90,19 @@ public class LocalizedStringType {
|
|||
@DynamicSerializeElement
|
||||
protected String value;
|
||||
|
||||
public LocalizedStringType() {
|
||||
|
||||
}
|
||||
|
||||
public LocalizedStringType(String lang, String value) {
|
||||
this.lang = lang;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public LocalizedStringType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,14 @@ public class MapType implements Serializable {
|
|||
@JoinTable(schema = "ebxml")
|
||||
protected List<EntryType> entry;
|
||||
|
||||
public MapType() {
|
||||
|
||||
}
|
||||
|
||||
public MapType(List<EntryType> entry) {
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the entry property.
|
||||
*
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
*/
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "MapValueType", propOrder = { "mapValue" })
|
||||
|
@ -77,6 +77,14 @@ public class MapValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "mapValue";
|
||||
|
||||
public MapValueType() {
|
||||
|
||||
}
|
||||
|
||||
public MapValueType(MapType mapValue) {
|
||||
this.mapValue = mapValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
@ -81,6 +83,22 @@ public class QueryType extends ExtensibleObjectType {
|
|||
@DynamicSerializeElement
|
||||
protected String queryDefinition;
|
||||
|
||||
public QueryType() {
|
||||
|
||||
}
|
||||
|
||||
public QueryType(String queryDefinition, Collection<SlotType> slots) {
|
||||
super(slots);
|
||||
this.queryDefinition = queryDefinition;
|
||||
}
|
||||
|
||||
public QueryType(String queryDefinition, SlotType... slots) {
|
||||
this.queryDefinition = queryDefinition;
|
||||
for (SlotType slot : slots) {
|
||||
this.getSlot().add(slot);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the queryDefinition property.
|
||||
*
|
||||
|
|
|
@ -113,6 +113,12 @@ public class RegistryObjectListType implements Serializable {
|
|||
this.registryObject = new ArrayList<RegistryObjectType>(registryObjects);
|
||||
}
|
||||
|
||||
public RegistryObjectListType(RegistryObjectType registryObject) {
|
||||
List<RegistryObjectType> list = new ArrayList<RegistryObjectType>(1);
|
||||
list.add(registryObject);
|
||||
this.registryObject = list;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -111,6 +112,24 @@ public class SlotType extends ExtensibleObjectType implements Serializable {
|
|||
@DynamicSerializeElement
|
||||
protected String type;
|
||||
|
||||
public SlotType() {
|
||||
|
||||
}
|
||||
|
||||
public SlotType(String name, ValueType slotValue) {
|
||||
super();
|
||||
this.slotValue = slotValue;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SlotType(Collection<SlotType> slots, String name, String type,
|
||||
ValueType slotValue) {
|
||||
super(slots);
|
||||
this.slotValue = slotValue;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,14 @@ public class SlotValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "slotValue";
|
||||
|
||||
public SlotValueType() {
|
||||
|
||||
}
|
||||
|
||||
public SlotValueType(SlotType slotValue) {
|
||||
this.slotValue = slotValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "StringValueType", propOrder = { "stringValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "StringValue")
|
||||
public class StringValueType extends ValueType {
|
||||
|
||||
|
@ -76,6 +76,14 @@ public class StringValueType extends ValueType {
|
|||
@DynamicSerializeElement
|
||||
protected String stringValue;
|
||||
|
||||
public StringValueType() {
|
||||
|
||||
}
|
||||
|
||||
public StringValueType(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*
|
||||
|
|
|
@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "VocabularyTermValueType", propOrder = { "vocabularyTermValue" })
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "VocabularyTermValue")
|
||||
public class VocabularyTermValueType extends ValueType {
|
||||
|
||||
|
@ -80,6 +80,14 @@ public class VocabularyTermValueType extends ValueType {
|
|||
|
||||
private static final String COLUMN_NAME = "vocabularyTermValue";
|
||||
|
||||
public VocabularyTermValueType() {
|
||||
|
||||
}
|
||||
|
||||
public VocabularyTermValueType(VocabularyTermType vocabularyTermValue) {
|
||||
this.vocabularyTermValue = vocabularyTermValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return COLUMN_NAME;
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.rs.v4;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -32,6 +35,7 @@ import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtensibleObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.FilterObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest;
|
||||
|
@ -80,6 +84,22 @@ public class RegistryRequestType extends ExtensibleObjectType {
|
|||
@DynamicSerializeElement
|
||||
protected String comment;
|
||||
|
||||
public RegistryRequestType() {
|
||||
|
||||
}
|
||||
|
||||
public RegistryRequestType(String id, String comment,
|
||||
Collection<SlotType> slots) {
|
||||
super(slots);
|
||||
this.id = id;
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public RegistryRequestType(String id, String comment) {
|
||||
this(id, comment, Collections.<SlotType> emptySet());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.spi.v4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -33,6 +34,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtrinsicObjectType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -86,6 +88,22 @@ public class CatalogObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected List<ExtrinsicObjectType> invocationControlFile;
|
||||
|
||||
public CatalogObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public CatalogObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots, QueryType query,
|
||||
ObjectRefListType objectRefList,
|
||||
RegistryObjectListType originalObjects,
|
||||
List<ExtrinsicObjectType> invocationControlFile) {
|
||||
super(id, comment, slots);
|
||||
this.query = query;
|
||||
this.objectRefList = objectRefList;
|
||||
this.originalObjects = originalObjects;
|
||||
this.invocationControlFile = invocationControlFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the query property.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.spi.v4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -31,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtrinsicObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -73,6 +75,18 @@ public class FilterObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected List<ExtrinsicObjectType> invocationControlFile;
|
||||
|
||||
public FilterObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public FilterObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots, RegistryObjectListType originalObjects,
|
||||
List<ExtrinsicObjectType> invocationControlFile) {
|
||||
super(id, comment, slots);
|
||||
this.originalObjects = originalObjects;
|
||||
this.invocationControlFile = invocationControlFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the originalObjects property.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.spi.v4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -34,6 +35,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -87,6 +89,22 @@ public class ValidateObjectsRequest extends RegistryRequestType {
|
|||
@DynamicSerializeElement
|
||||
protected List<ExtrinsicObjectType> invocationControlFile;
|
||||
|
||||
public ValidateObjectsRequest() {
|
||||
|
||||
}
|
||||
|
||||
public ValidateObjectsRequest(String id, String comment,
|
||||
Collection<SlotType> slots, QueryType query,
|
||||
ObjectRefListType objectRefList,
|
||||
RegistryObjectListType originalObjects,
|
||||
List<ExtrinsicObjectType> invocationControlFile) {
|
||||
super(id, comment, slots);
|
||||
this.query = query;
|
||||
this.objectRefList = objectRefList;
|
||||
this.originalObjects = originalObjects;
|
||||
this.invocationControlFile = invocationControlFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the query property.
|
||||
*
|
||||
|
|
|
@ -121,4 +121,11 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.datadelivery.registry"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<bean id="ebxmlFederationEnabled" class="java.lang.Boolean">
|
||||
<constructor-arg value="${ebxmlFederationEnabled}" />
|
||||
</bean>
|
||||
|
||||
<bean id="ebxmlSubscriptionsEnabled" class="java.lang.Boolean">
|
||||
<constructor-arg value="${env:EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED}" />
|
||||
<constructor-arg value="${ebxmlSubscriptionsEnabled}" />
|
||||
</bean>
|
||||
|
||||
<bean id="ebxmlEmailEnabled" class="java.lang.Boolean">
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
class="com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao">
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryDao" class="com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao">
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="federationDao" class="com.raytheon.uf.edex.registry.ebxml.dao.FederationDao">
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="extrinsicObjectDao"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao">
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
<bean id="DbInit" class="com.raytheon.uf.edex.registry.ebxml.dao.DbInit">
|
||||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="xacmlAdmin" ref="XACMLPolicyAdministrator" />
|
||||
<property name="dao" ref="registryObjectDao" />
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="txTemplate" ref="metadataTxTemplate"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ebxmlDbValidationStrategy"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<!-- QUERY -->
|
||||
<!-- QUERY -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="queryServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl">
|
||||
|
@ -15,6 +16,7 @@
|
|||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="classificationNodeDao" ref="classificationNodeDao" />
|
||||
<property name="registryDao" ref="registryDao" />
|
||||
</bean>
|
||||
|
||||
|
||||
|
@ -29,14 +31,14 @@
|
|||
<property name="cataloger" ref="catalogerServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<!-- VALIDATOR -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="validatorServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.validator.ValidatorImpl">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="registryObjectTypeValidator" ref="registryObjectTypeValidator" />
|
||||
</bean>
|
||||
<!-- VALIDATOR -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="validatorServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.validator.ValidatorImpl">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="registryObjectTypeValidator" ref="registryObjectTypeValidator" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- CATALOGER -->
|
||||
|
@ -45,7 +47,7 @@
|
|||
class="com.raytheon.uf.edex.registry.ebxml.services.cataloger.CatalogerImpl">
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- REST Service Beans -->
|
||||
<bean name="AddRegistryParty"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.web.AddRegistryParty">
|
||||
|
@ -67,6 +69,9 @@
|
|||
<property name="webUtil" ref="RegistryWebUtil" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryAvailabilityService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryAvailableRestService" />
|
||||
|
||||
<bean id="registryObjectsRestService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryObjectsRestService">
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
|
@ -78,9 +83,9 @@
|
|||
</bean>
|
||||
|
||||
<bean id="queryProtocolRestService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.QueryProtocolRestService" >
|
||||
<property name="queryManager" ref="queryServiceImpl"/>
|
||||
</bean>
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.QueryProtocolRestService">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<bean id="RegistryWebUtil" class="com.raytheon.uf.edex.registry.ebxml.web.RegistryWebUtil">
|
||||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
|
@ -96,10 +101,11 @@
|
|||
<property name="personDao" ref="personDao" />
|
||||
<property name="roleDao" ref="roleDao" />
|
||||
</bean>
|
||||
|
||||
<bean id="AuditableEventService" class="com.raytheon.uf.edex.registry.ebxml.services.AuditableEventService">
|
||||
<constructor-arg ref="AuditableEventTypeDao" />
|
||||
<constructor-arg ref="registrySubscriptionManagerInvoker" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
<bean id="AuditableEventService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.AuditableEventService">
|
||||
<constructor-arg ref="AuditableEventTypeDao" />
|
||||
<constructor-arg ref="registrySubscriptionManagerInvoker" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -49,6 +49,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.edex.registry.acp.xacml.util.XACMLParser;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
|
||||
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.lifecycle.LifecycleManagerImpl;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
|
@ -65,6 +66,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 8/17/2012 724 bphillip Initial Coding
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Import changes due to moved constant classes
|
||||
* 5/21/2013 2022 bphillip Implemented RegistryInitializedListener
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -72,7 +74,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class XACMLPolicyAdministrator {
|
||||
public class XACMLPolicyAdministrator implements RegistryInitializedListener {
|
||||
|
||||
/** The status handler */
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -84,8 +86,10 @@ public class XACMLPolicyAdministrator {
|
|||
/** The map of policy sets known to the system */
|
||||
private Map<String, PolicySetType> policySetMap = new HashMap<String, PolicySetType>();
|
||||
|
||||
/** Data access object for extrinsic objects */
|
||||
private ExtrinsicObjectDao extrinsicObjectDao;
|
||||
|
||||
/** The lifecycle manager instance */
|
||||
private LifecycleManagerImpl lcm;
|
||||
|
||||
/**
|
||||
|
@ -178,6 +182,16 @@ public class XACMLPolicyAdministrator {
|
|||
return policySet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeAfterRegistryInit() throws EbxmlRegistryException {
|
||||
try {
|
||||
loadAccessControlPolicies();
|
||||
} catch (MsgRegistryException e) {
|
||||
throw new EbxmlRegistryException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the access control policies from the file system folder
|
||||
*
|
||||
|
|
|
@ -46,9 +46,10 @@ import org.hibernate.cfg.AnnotationConfiguration;
|
|||
import org.hibernate.jdbc.Work;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
|
@ -60,7 +61,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.util.ReflectionUtil;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
||||
import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyAdministrator;
|
||||
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.lifecycle.LifecycleManagerImpl;
|
||||
|
@ -80,14 +80,15 @@ import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerIm
|
|||
* 4/9/2013 1802 bphillip Changed submitObjects method call from submitObjectsInternal
|
||||
* Apr 15, 2013 1693 djohnson Use a strategy to verify the database is up to date.
|
||||
* Apr 30, 2013 1960 djohnson Extend the generalized DbInit.
|
||||
* 5/21/2013 2022 bphillip Using TransactionTemplate for database initialization
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Repository
|
||||
@Transactional
|
||||
public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements ApplicationListener {
|
||||
public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
||||
ApplicationListener {
|
||||
|
||||
private static volatile boolean INITIALIZED = false;
|
||||
|
||||
|
@ -98,11 +99,14 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
/** Query to check which tables exist in the ebxml database */
|
||||
private static final String TABLE_CHECK_QUERY = "SELECT tablename FROM pg_tables where schemaname = 'ebxml';";
|
||||
|
||||
/** The lifecycle manager instance */
|
||||
private LifecycleManagerImpl lcm;
|
||||
|
||||
/** Hibernate session factory */
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
private XACMLPolicyAdministrator xacmlAdmin;
|
||||
/** Transaction template */
|
||||
private TransactionTemplate txTemplate;
|
||||
|
||||
/**
|
||||
* Creates a new instance of DbInit. This constructor should only be called
|
||||
|
@ -292,8 +296,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
* this Hibernate SessionFactory is aware of
|
||||
*/
|
||||
AnnotationConfiguration aConfig = new AnnotationConfiguration();
|
||||
for (Object obj : sessionFactory.getAllClassMetadata()
|
||||
.keySet()) {
|
||||
for (Object obj : sessionFactory.getAllClassMetadata().keySet()) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName((String) obj);
|
||||
if (clazz.getName().startsWith("oasis")) {
|
||||
|
@ -307,26 +310,45 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
}
|
||||
return aConfig;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (!INITIALIZED) {
|
||||
try {
|
||||
initDb();
|
||||
xacmlAdmin.loadAccessControlPolicies();
|
||||
} catch (Exception e) {
|
||||
statusHandler.fatal("Error initializing EBXML database!", e);
|
||||
}
|
||||
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||
@Override
|
||||
protected void doInTransactionWithoutResult(
|
||||
TransactionStatus status) {
|
||||
try {
|
||||
initDb();
|
||||
} catch (Exception e) {
|
||||
statusHandler.fatal(
|
||||
"Error initializing EBXML database!", e);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
statusHandler.info("Executing post initialization actions");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, RegistryInitializedListener> beans = EDEXUtil
|
||||
.getSpringContext().getBeansOfType(
|
||||
RegistryInitializedListener.class);
|
||||
for (RegistryInitializedListener listener : beans.values()) {
|
||||
listener.executeAfterRegistryInit();
|
||||
}
|
||||
|
||||
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||
@Override
|
||||
protected void doInTransactionWithoutResult(
|
||||
TransactionStatus status) {
|
||||
try {
|
||||
Map<String, RegistryInitializedListener> beans = EDEXUtil
|
||||
.getSpringContext().getBeansOfType(
|
||||
RegistryInitializedListener.class);
|
||||
for (RegistryInitializedListener listener : beans
|
||||
.values()) {
|
||||
listener.executeAfterRegistryInit();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(
|
||||
"Error initializing EBXML database!", t);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
INITIALIZED = true;
|
||||
}
|
||||
}
|
||||
|
@ -355,11 +377,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xacmlAdmin
|
||||
* the xacmlAdmin to set
|
||||
*/
|
||||
public void setXacmlAdmin(XACMLPolicyAdministrator xacmlAdmin) {
|
||||
this.xacmlAdmin = xacmlAdmin;
|
||||
public void setTxTemplate(TransactionTemplate txTemplate) {
|
||||
this.txTemplate = txTemplate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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.registry.ebxml.dao;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType;
|
||||
|
||||
/**
|
||||
* Data access object for FederationType objects
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class FederationDao extends RegistryObjectTypeDao<FederationType> {
|
||||
|
||||
@Override
|
||||
protected Class<FederationType> getEntityClass() {
|
||||
return FederationType.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* 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.registry.ebxml.dao;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Data access object for RegistryType objects
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class RegistryDao extends RegistryObjectTypeDao<RegistryType> {
|
||||
|
||||
private static final String QUERY_BY_BASE_URL = "FROM RegistryType reg where reg.baseURL=:baseURL";
|
||||
|
||||
public RegistryType getRegistryByBaseURL(String baseURL) {
|
||||
return this.uniqueResult(QUERY_BY_BASE_URL, "baseURL", baseURL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<RegistryType> getEntityClass() {
|
||||
return RegistryType.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.init;
|
||||
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
* Interface that classes may implement to execute code that must be executed
|
||||
* after the database is initialzed. DbInit will load all classes implementing
|
||||
|
@ -44,5 +46,5 @@ public interface RegistryInitializedListener {
|
|||
* Executes code that must be executed after the ebxml database is
|
||||
* initialized
|
||||
*/
|
||||
public void executeAfterRegistryInit();
|
||||
public void executeAfterRegistryInit() throws EbxmlRegistryException;
|
||||
}
|
||||
|
|
|
@ -43,17 +43,24 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
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;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ActionTypes;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.registry.constants.DeletionScope;
|
||||
import com.raytheon.uf.common.registry.constants.Format;
|
||||
import com.raytheon.uf.common.registry.constants.Languages;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
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.edex.registry.ebxml.dao.ClassificationNodeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
|
||||
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.services.lifecycle.LifecycleManagerImpl;
|
||||
|
@ -70,6 +77,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/18/2013 1082 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Implemented notification handling
|
||||
* 5/21/2013 2022 bphillip Reworked how notifications are handled
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -95,18 +103,41 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
||||
private RegistryDao registryDao;
|
||||
|
||||
/** The classification node data access object */
|
||||
private ClassificationNodeDao classificationNodeDao;
|
||||
|
||||
@Override
|
||||
public void onNotification(NotificationType notification) {
|
||||
String clientIP = EbxmlObjectUtil.getClientHost(wsContext);
|
||||
statusHandler.info("Received Notification: [" + notification.getId()
|
||||
+ "] from [" + clientIP + "]");
|
||||
String clientBaseURL = notification
|
||||
.getSlotValue(EbxmlObjectUtil.NOTIFICATION_SOURCE_URL_SLOT_NAME);
|
||||
if (clientBaseURL == null) {
|
||||
clientBaseURL = "http://"
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext);
|
||||
statusHandler.info("Received notification from unknown source at "
|
||||
+ clientBaseURL);
|
||||
} else {
|
||||
RegistryType sourceRegistry = registryDao
|
||||
.getRegistryByBaseURL(clientBaseURL);
|
||||
if (sourceRegistry == null) {
|
||||
clientBaseURL = "http://"
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext);
|
||||
statusHandler
|
||||
.info("Received notification from unknown source at "
|
||||
+ clientBaseURL);
|
||||
} else {
|
||||
clientBaseURL = sourceRegistry.getBaseURL();
|
||||
statusHandler
|
||||
.info("Received notification from Registry Federation member at ["
|
||||
+ sourceRegistry.getId() + "]");
|
||||
}
|
||||
}
|
||||
List<AuditableEventType> events = notification.getEvent();
|
||||
|
||||
// Process the received auditable events and add them to the appropriate
|
||||
// list based on the action performed
|
||||
RegistryObjectActionList objActionList = new RegistryObjectActionList();
|
||||
for (AuditableEventType event : events) {
|
||||
List<ActionType> actions = event.getAction();
|
||||
for (ActionType action : actions) {
|
||||
|
@ -119,73 +150,62 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
continue;
|
||||
}
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
if (action.getAffectedObjectRefs() != null) {
|
||||
for (ObjectRefType ref : action.getAffectedObjectRefs()
|
||||
.getObjectRef()) {
|
||||
ids.add(ref.getId());
|
||||
|
||||
objActionList.addAction(eventType, ref.getId());
|
||||
}
|
||||
} else if (action.getAffectedObjects() != null) {
|
||||
for (RegistryObjectType regObj : action
|
||||
.getAffectedObjects().getRegistryObject()) {
|
||||
ids.add(regObj.getId());
|
||||
objActionList.addAction(eventType, regObj.getId());
|
||||
}
|
||||
} else {
|
||||
statusHandler.info("Event " + event.getId()
|
||||
+ " contains not affected objects ");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
if (eventType.equals(ActionTypes.create)) {
|
||||
|
||||
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|
||||
clientIP, notification.getId(), ids,
|
||||
Mode.CREATE_OR_REPLACE);
|
||||
lcm.submitObjects(submitRequest);
|
||||
|
||||
} else if (eventType.equals(ActionTypes.update)) {
|
||||
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|
||||
clientIP, notification.getId(), ids,
|
||||
Mode.CREATE_OR_REPLACE);
|
||||
// TODO: When object update is implemented, this will
|
||||
// have to be
|
||||
// changed to call lcm.update
|
||||
lcm.submitObjects(submitRequest);
|
||||
} else if (eventType.equals(ActionTypes.delete)) {
|
||||
for (String id : ids) {
|
||||
RegistryObjectType object = registryObjectDao
|
||||
.getById(id);
|
||||
String replicaHome = object
|
||||
.getSlotValue(EbxmlObjectUtil.HOME_SLOT_NAME);
|
||||
if (clientIP.equals(replicaHome)) {
|
||||
ObjectRefType ref = new ObjectRefType();
|
||||
ref.setId(id);
|
||||
ObjectRefListType refList = new ObjectRefListType();
|
||||
refList.getObjectRef().add(ref);
|
||||
RemoveObjectsRequest request = RegistrySOAPServices
|
||||
.createRemoveObjectsRequest(
|
||||
"Remove Objects for notification ["
|
||||
+ notification.getId()
|
||||
+ "]",
|
||||
"Notification delete object submission",
|
||||
false,
|
||||
DeletionScope.DELETE_ALL,
|
||||
refList, null, null);
|
||||
lcm.removeObjects(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Error getting remote objects to create", e);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error("Error creating objects in registry!",
|
||||
e);
|
||||
+ " contains 0 affected objects ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RegistryObjectAction regObjAction : objActionList.getActionList()) {
|
||||
String action = regObjAction.getAction();
|
||||
try {
|
||||
if (action.equals(ActionTypes.create)
|
||||
|| action.equals(ActionTypes.update)) {
|
||||
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|
||||
clientBaseURL, notification.getId(),
|
||||
regObjAction.getObjIds(), Mode.CREATE_OR_REPLACE);
|
||||
lcm.submitObjects(submitRequest);
|
||||
} else if (action.equals(ActionTypes.delete)) {
|
||||
ObjectRefListType refList = new ObjectRefListType();
|
||||
for (String id : regObjAction.getObjIds()) {
|
||||
RegistryObjectType object = registryObjectDao
|
||||
.getById(id);
|
||||
String replicaHome = object
|
||||
.getSlotValue(EbxmlObjectUtil.HOME_SLOT_NAME);
|
||||
if (clientBaseURL.equals(replicaHome)) {
|
||||
ObjectRefType ref = new ObjectRefType();
|
||||
ref.setId(id);
|
||||
refList.getObjectRef().add(ref);
|
||||
}
|
||||
}
|
||||
RemoveObjectsRequest request = new RemoveObjectsRequest(
|
||||
"Remove Objects for notification ["
|
||||
+ notification.getId() + "]",
|
||||
"Notification delete object submission", null,
|
||||
null, refList, false, false,
|
||||
DeletionScope.DELETE_ALL);
|
||||
lcm.removeObjects(request);
|
||||
}
|
||||
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler
|
||||
.error("Error getting remote objects to create", e);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error("Error creating objects in registry!", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,13 +225,13 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur while creating the SubmitObjectsRequest
|
||||
*/
|
||||
private SubmitObjectsRequest createSubmitObjectsRequest(String clientIP,
|
||||
String notificationId, Collection<String> objIds, Mode mode)
|
||||
throws EbxmlRegistryException {
|
||||
private SubmitObjectsRequest createSubmitObjectsRequest(
|
||||
String clientBaseURL, String notificationId,
|
||||
Collection<String> objIds, Mode mode) throws EbxmlRegistryException {
|
||||
try {
|
||||
// Get a the remote query service
|
||||
QueryManager queryManager = RegistrySOAPServices
|
||||
.getQueryServiceForHost(clientIP);
|
||||
.getQueryServiceForHost(clientBaseURL);
|
||||
// Create a query to get the current state of the affected objects
|
||||
QueryRequest queryRequest = createGetCurrentStateQuery(
|
||||
notificationId, objIds);
|
||||
|
@ -222,7 +242,7 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
// Set the home server slot on the object denoting the home server
|
||||
// of the received object.
|
||||
for (RegistryObjectType object : remoteObjects) {
|
||||
object.updateSlot(EbxmlObjectUtil.HOME_SLOT_NAME, clientIP);
|
||||
object.updateSlot(EbxmlObjectUtil.HOME_SLOT_NAME, clientBaseURL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -231,16 +251,15 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
* notfications will not ping pong back and forth between servers if
|
||||
* they have identical subscriptions with one another
|
||||
*/
|
||||
RegistryObjectListType objectList = EbxmlObjectUtil
|
||||
.createRegistryObjectList(remoteObjects);
|
||||
// Create the submit objects request object
|
||||
SubmitObjectsRequest request = RegistrySOAPServices
|
||||
.createSubmitObjectRequest(
|
||||
"Submit Objects for notification ["
|
||||
+ notificationId + "]", mode,
|
||||
"Notification object submission", false,
|
||||
objectList, EbxmlObjectUtil.HOME_SLOT_NAME,
|
||||
clientIP);
|
||||
SubmitObjectsRequest request = new SubmitObjectsRequest(
|
||||
"Submit Objects for notification [" + notificationId + "]",
|
||||
"Notification object submission",
|
||||
CollectionUtil.asSet(new SlotType(
|
||||
EbxmlObjectUtil.HOME_SLOT_NAME,
|
||||
new StringValueType(clientBaseURL))),
|
||||
new RegistryObjectListType(remoteObjects), false,
|
||||
Mode.CREATE_OR_REPLACE);
|
||||
return request;
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException("Error processing notification", e);
|
||||
|
@ -278,13 +297,17 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
responseOption.setReturnComposedObjects(true);
|
||||
responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
|
||||
|
||||
QueryType selectorQuery = RegistrySOAPServices.createQueryType(
|
||||
CanonicalQueryTypes.ADHOC_QUERY, "queryLanguage", "HQL",
|
||||
"queryExpression", queryExpression.toString());
|
||||
return RegistrySOAPServices.createQueryRequest(
|
||||
"Query Request for notification [" + notificationId + "]",
|
||||
"Querying for current state of objects", selectorQuery,
|
||||
responseOption);
|
||||
SlotType queryLanguageSlot = new SlotType("queryLanguage",
|
||||
new StringValueType("HQL"));
|
||||
SlotType queryExpressionSlot = new SlotType("queryExpression",
|
||||
new StringValueType(queryExpression.toString()));
|
||||
QueryType selectorQuery = new QueryType(
|
||||
CanonicalQueryTypes.ADHOC_QUERY, queryLanguageSlot,
|
||||
queryExpressionSlot);
|
||||
return new QueryRequest("NotificationListener object update",
|
||||
"NotificationListener object Update", new ResponseOptionType(
|
||||
QueryReturnTypes.REGISTRY_OBJECT, true), selectorQuery,
|
||||
false, null, Format.EBRIM, Languages.EN_US, 0, 0, 0, false);
|
||||
}
|
||||
|
||||
public void setLcm(LifecycleManagerImpl lcm) {
|
||||
|
@ -300,4 +323,62 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
this.classificationNodeDao = classificationNodeDao;
|
||||
}
|
||||
|
||||
public void setRegistryDao(RegistryDao registryDao) {
|
||||
this.registryDao = registryDao;
|
||||
}
|
||||
|
||||
private class RegistryObjectActionList {
|
||||
|
||||
List<RegistryObjectAction> actionList = new ArrayList<RegistryObjectAction>();
|
||||
|
||||
public void addAction(String action, String objId) {
|
||||
if (actionList.isEmpty()
|
||||
|| !actionList.get(actionList.size() - 1).getAction()
|
||||
.equals(action)) {
|
||||
RegistryObjectAction newAction = new RegistryObjectAction(
|
||||
action);
|
||||
newAction.addObj(objId);
|
||||
actionList.add(newAction);
|
||||
} else {
|
||||
actionList.get(actionList.size() - 1).addObj(objId);
|
||||
}
|
||||
}
|
||||
|
||||
public List<RegistryObjectAction> getActionList() {
|
||||
return actionList;
|
||||
}
|
||||
}
|
||||
|
||||
private class RegistryObjectAction {
|
||||
|
||||
private String action;
|
||||
|
||||
private List<String> objIds = new ArrayList<String>();
|
||||
|
||||
public RegistryObjectAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void addObj(String obj) {
|
||||
this.objIds.add(obj);
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public List<String> getObjIds() {
|
||||
return objIds;
|
||||
}
|
||||
|
||||
public void setObjIds(List<String> objIds) {
|
||||
this.objIds = objIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.NotificationTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
@ -66,6 +65,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 4/9/2013 1802 bphillip Initial Coding
|
||||
* 4/15/2013 1905 bphillip Implemented notification to email endpoints
|
||||
* Apr 17, 2013 1672 djohnson No longer cares about notification protocol.
|
||||
* 5/21/2013 2022 bphillip Cleaned up unused method parameters and batching of notifications
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -113,9 +113,11 @@ public class RegistryNotificationManager {
|
|||
List<AuditableEventType> eventsOfInterest)
|
||||
throws EbxmlRegistryException {
|
||||
// Create the notification object
|
||||
NotificationType notification = createNotification(subscription,
|
||||
address, objectsOfInterest, eventsOfInterest);
|
||||
NotificationType notification = createNotification(
|
||||
subscription.getId(), eventsOfInterest);
|
||||
checkNotification(notification, objectsOfInterest, address);
|
||||
notification.addSlot(EbxmlObjectUtil.NOTIFICATION_SOURCE_URL_SLOT_NAME,
|
||||
EbxmlObjectUtil.REGISTRY_BASE_URL);
|
||||
return notification;
|
||||
}
|
||||
|
||||
|
@ -124,13 +126,14 @@ public class RegistryNotificationManager {
|
|||
}
|
||||
|
||||
protected void sendNotification(NotificationListenerWrapper listener,
|
||||
NotificationType notification, String address)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
listener.notificationListener.onNotification(notification);
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException("Error sending notification", e);
|
||||
}
|
||||
NotificationType notification, String address) {
|
||||
|
||||
statusHandler.info("Sending notification [" + notification.getId()
|
||||
+ "] to address [" + address + "]");
|
||||
listener.notificationListener.onNotification(notification);
|
||||
statusHandler.info("Notification [" + notification.getId()
|
||||
+ " successfully sent to address [" + address + "]");
|
||||
|
||||
// Keep a record of when the auditable event was sent to
|
||||
// the target
|
||||
auditableEventDao.persistSendDate(notification.getEvent(),
|
||||
|
@ -154,6 +157,7 @@ public class RegistryNotificationManager {
|
|||
SubscriptionNotificationListeners notificationListeners,
|
||||
final List<ObjectRefType> objectsOfInterest)
|
||||
throws EbxmlRegistryException {
|
||||
int SIZE_LIMIT = 100;
|
||||
|
||||
final List<NotificationListenerWrapper> listeners = notificationListeners.listeners;
|
||||
final SubscriptionType subscription = notificationListeners.subscription;
|
||||
|
@ -164,25 +168,39 @@ public class RegistryNotificationManager {
|
|||
if (!eventsOfInterest.isEmpty()) {
|
||||
try {
|
||||
for (NotificationListenerWrapper listener : listeners) {
|
||||
NotificationType notification = getNotification(
|
||||
subscription, listener.address, objectsOfInterest,
|
||||
eventsOfInterest);
|
||||
if (notification.getEvent().isEmpty()) {
|
||||
statusHandler.info("No events to send to ["
|
||||
+ listener.address + "] for subscription ["
|
||||
+ subscription.getId() + "]");
|
||||
continue;
|
||||
} else {
|
||||
sendNotification(listener, notification,
|
||||
listener.address);
|
||||
int subListCount = eventsOfInterest.size() / SIZE_LIMIT;
|
||||
int lastListSize = eventsOfInterest.size() % SIZE_LIMIT;
|
||||
for (int i = 0; i < subListCount; i++) {
|
||||
NotificationType notification = getNotification(
|
||||
subscription, listener.address,
|
||||
objectsOfInterest, eventsOfInterest.subList(
|
||||
SIZE_LIMIT * i, SIZE_LIMIT * i
|
||||
+ SIZE_LIMIT));
|
||||
if (!notification.getEvent().isEmpty()) {
|
||||
sendNotification(listener, notification,
|
||||
listener.address);
|
||||
}
|
||||
}
|
||||
if (lastListSize > 0) {
|
||||
NotificationType notification = getNotification(
|
||||
subscription,
|
||||
listener.address,
|
||||
objectsOfInterest,
|
||||
eventsOfInterest.subList(SIZE_LIMIT
|
||||
* subListCount, SIZE_LIMIT
|
||||
* subListCount + lastListSize));
|
||||
if (!notification.getEvent().isEmpty()) {
|
||||
sendNotification(listener, notification,
|
||||
listener.address);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to determine notification destinations.", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void checkNotification(NotificationType notification,
|
||||
|
@ -192,7 +210,6 @@ public class RegistryNotificationManager {
|
|||
List<AuditableEventType> eventsToSend = new ArrayList<AuditableEventType>();
|
||||
List<RegistryObjectType> objectsToRemove = new ArrayList<RegistryObjectType>();
|
||||
List<ObjectRefType> refsToRemove = new ArrayList<ObjectRefType>();
|
||||
long start = TimeUtil.currentTimeMillis();
|
||||
for (AuditableEventType event : notification.getEvent()) {
|
||||
// Check to see if this is a reciprocal notification. We don't want
|
||||
// to send a notification back to the server who sent us the object
|
||||
|
@ -253,11 +270,11 @@ public class RegistryNotificationManager {
|
|||
}
|
||||
}
|
||||
notification.setEvent(eventsToSend);
|
||||
statusHandler.info("Filtering of auditable events took: "
|
||||
+ (TimeUtil.currentTimeMillis() - start) + " ms");
|
||||
statusHandler.info(eventsToSend.size()
|
||||
+ " applicable events found for subscription ["
|
||||
+ notification.getSubscription() + "]");
|
||||
if (!eventsToSend.isEmpty()) {
|
||||
statusHandler.info(eventsToSend.size()
|
||||
+ " applicable events found for subscription ["
|
||||
+ notification.getSubscription() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,9 +293,7 @@ public class RegistryNotificationManager {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur while creating the notification
|
||||
*/
|
||||
protected NotificationType createNotification(
|
||||
SubscriptionType subscription, String serviceAddress,
|
||||
List<ObjectRefType> objectsOfInterest,
|
||||
protected NotificationType createNotification(String subscriptionId,
|
||||
List<AuditableEventType> eventsOfInterest)
|
||||
throws EbxmlRegistryException {
|
||||
|
||||
|
@ -292,11 +307,11 @@ public class RegistryNotificationManager {
|
|||
.getInternationalString("Subscription Notification"));
|
||||
notification.setDescription(RegistryUtil
|
||||
.getInternationalString("Notification for subscription ["
|
||||
+ subscription.getId() + "]"));
|
||||
+ subscriptionId + "]"));
|
||||
notification.setObjectType(RegistryObjectTypes.NOTIFICATION);
|
||||
notification.setStatus(StatusTypes.APPROVED);
|
||||
notification.setOwner(RegistryUtil.DEFAULT_OWNER);
|
||||
notification.setSubscription(subscription.getId());
|
||||
notification.setSubscription(subscriptionId);
|
||||
notification.setEvent(eventsOfInterest);
|
||||
return notification;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
@ -80,6 +81,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* Apr 17, 2013 1672 djohnson Keeps track of the notification listeners.
|
||||
* 5/21/2013 2022 bphillip Made logging less verbose. added running boolean so subscriptions are not process on every single
|
||||
* event.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -94,6 +97,9 @@ public class RegistrySubscriptionManager implements
|
|||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistrySubscriptionManager.class);
|
||||
|
||||
/** Boolean used to denote if subscriptions should be processed */
|
||||
private AtomicBoolean running = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Associates a {@link SubscriptionType} with its
|
||||
* {@link NotificationListenerWrapper} instances.
|
||||
|
@ -287,44 +293,51 @@ public class RegistrySubscriptionManager implements
|
|||
if (!subscriptionProcessingEnabled) {
|
||||
return;
|
||||
}
|
||||
statusHandler.info("Processing Registry Subscriptions...");
|
||||
long start = TimeUtil.currentTimeMillis();
|
||||
if (!running.compareAndSet(false, true)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
long start = TimeUtil.currentTimeMillis();
|
||||
|
||||
Collection<SubscriptionNotificationListeners> subs = listeners.values();
|
||||
if (subs.isEmpty()) {
|
||||
statusHandler.info("No subscriptions to process.");
|
||||
}
|
||||
for (SubscriptionNotificationListeners subNotificationListener : subs) {
|
||||
SubscriptionType sub = subNotificationListener.subscription;
|
||||
try {
|
||||
if (subscriptionShouldRun(sub)) {
|
||||
updateLastRunTime(sub,
|
||||
new Integer((int) TimeUtil.currentTimeMillis()));
|
||||
try {
|
||||
processSubscription(subNotificationListener);
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Errors occurred while processing subscription ["
|
||||
+ sub.getId() + "]", e);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Errors occurred while processing subscription ["
|
||||
+ sub.getId() + "]", e);
|
||||
Collection<SubscriptionNotificationListeners> subs = listeners
|
||||
.values();
|
||||
|
||||
for (SubscriptionNotificationListeners subNotificationListener : subs) {
|
||||
SubscriptionType sub = subNotificationListener.subscription;
|
||||
try {
|
||||
if (subscriptionShouldRun(sub)) {
|
||||
updateLastRunTime(sub,
|
||||
new Integer((int) TimeUtil.currentTimeMillis()));
|
||||
try {
|
||||
processSubscription(subNotificationListener);
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Errors occurred while processing subscription ["
|
||||
+ sub.getId() + "]", e);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Errors occurred while processing subscription ["
|
||||
+ sub.getId() + "]", e);
|
||||
}
|
||||
} else {
|
||||
statusHandler
|
||||
.info("Skipping subscription ["
|
||||
+ sub.getId()
|
||||
+ "]. Required notification frequency interval has not elapsed.");
|
||||
}
|
||||
} else {
|
||||
statusHandler
|
||||
.info("Skipping subscription ["
|
||||
+ sub.getId()
|
||||
+ "]. Required notification frequency interval has not elapsed.");
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Error processing subscription [" + sub.getId()
|
||||
+ "]", e);
|
||||
}
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Error processing subscription [" + sub.getId() + "]",
|
||||
e);
|
||||
}
|
||||
if (!subs.isEmpty()) {
|
||||
statusHandler.info("Registry subscriptions processed in "
|
||||
+ (TimeUtil.currentTimeMillis() - start) + " ms.");
|
||||
}
|
||||
} finally {
|
||||
running.set(false);
|
||||
}
|
||||
statusHandler.info("Registry subscriptions processed in "
|
||||
+ (TimeUtil.currentTimeMillis() - start) + " ms.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,19 +427,9 @@ public class RegistrySubscriptionManager implements
|
|||
+ "]...");
|
||||
|
||||
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscriptionNotificationsListeners.subscription);
|
||||
if (objectsOfInterest.isEmpty()) {
|
||||
statusHandler.info("Selector query for subscription ["
|
||||
+ subscription.getId() + "] returned "
|
||||
+ objectsOfInterest.size()
|
||||
+ " objects. Notification transmission unneccessary.");
|
||||
} else {
|
||||
statusHandler.info("Selector query for subscription ["
|
||||
+ subscription.getId() + "] returned "
|
||||
+ objectsOfInterest.size() + " objects of interest.");
|
||||
if (!objectsOfInterest.isEmpty()) {
|
||||
notificationManager.sendNotifications(
|
||||
subscriptionNotificationsListeners, objectsOfInterest);
|
||||
statusHandler.info("Notifications sent for subscription ["
|
||||
+ subscription.getId() + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.services.notification.listeners;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
|
||||
|
@ -87,16 +85,10 @@ public class WebServiceNotificationListener implements NotificationListener {
|
|||
*/
|
||||
protected void sendNotificationViaSoap(NotificationType notification,
|
||||
String serviceAddress) throws EbxmlRegistryException {
|
||||
try {
|
||||
statusHandler.info("Sending notification [" + notification.getId()
|
||||
+ "]");
|
||||
RegistrySOAPServices.getNotificationListenerServiceForUrl(
|
||||
serviceAddress).onNotification(notification);
|
||||
statusHandler.info("Notification [" + notification.getId()
|
||||
+ "] sent!");
|
||||
} catch (MalformedURLException e) {
|
||||
throw new EbxmlRegistryException("Error parsing service address!",
|
||||
e);
|
||||
}
|
||||
statusHandler.info("Sending notification [" + notification.getId()
|
||||
+ "]");
|
||||
RegistrySOAPServices.getNotificationListenerServiceForUrl(
|
||||
serviceAddress).onNotification(notification);
|
||||
statusHandler.info("Notification [" + notification.getId() + "] sent!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.CanonicalEbxmlQu
|
|||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
|
||||
* 4/9/2013 1802 bphillip Changed abstract method signature, modified return processing, and changed static variables
|
||||
* Apr 23, 2013 1910 djohnson Don't allow NPE on registry object list, remove non ANSI Javadoc.
|
||||
* 5/21/2013 2022 bphillip Set return type on call to findAssociations
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -147,6 +148,7 @@ public class FindAssociatedObjects extends CanonicalEbxmlQuery {
|
|||
"Both sourceObjectType and targetObjectType MUST NOT be specified.");
|
||||
}
|
||||
QueryResponse findAssociationsResponse = new QueryResponse();
|
||||
findAssociations.setReturnType(returnType);
|
||||
findAssociations.query(queryType, findAssociationsResponse, client);
|
||||
List<RegistryObjectType> associations = findAssociationsResponse
|
||||
.getRegistryObjectList().getRegistryObject();
|
||||
|
|
|
@ -74,8 +74,10 @@ public class GetNotification extends CanonicalEbxmlQuery {
|
|||
QUERY_PARAMETERS.add(QueryConstants.START_TIME);
|
||||
}
|
||||
|
||||
/** The subscription manager */
|
||||
private RegistrySubscriptionManager subscriptionManager;
|
||||
|
||||
/** Data access object for accessing registry subscriptions */
|
||||
private SubscriptionDao subscriptionDao;
|
||||
|
||||
@Override
|
||||
|
@ -131,7 +133,8 @@ public class GetNotification extends CanonicalEbxmlQuery {
|
|||
|
||||
try {
|
||||
NotificationType notification = subscriptionManager
|
||||
.getOnDemandNotification(client, subscriptionId, startTime);
|
||||
.getOnDemandNotification("http://" + client,
|
||||
subscriptionId, startTime);
|
||||
List<Object> retVal = new ArrayList<Object>();
|
||||
retVal.add(notification);
|
||||
setResponsePayload(queryResponse, retVal);
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.raytheon.uf.common.registry.constants.Languages;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.services.rest.IQueryProtocolRestService;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
|
||||
/**
|
||||
|
@ -57,6 +58,7 @@ import com.raytheon.uf.common.serialization.JAXBManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/19/2013 1931 bphillip Initial implementation
|
||||
* 5/21/2013 2022 bphillip Added interface and moved constants
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -65,49 +67,22 @@ import com.raytheon.uf.common.serialization.JAXBManager;
|
|||
@Path("/rest/search")
|
||||
@Service
|
||||
@Transactional
|
||||
public class QueryProtocolRestService {
|
||||
|
||||
/** The queryID canonical query parameter name */
|
||||
private static final String QUERY_ID = "queryId";
|
||||
|
||||
/** The depth canonical query parameter name */
|
||||
private static final String DEPTH = "depth";
|
||||
|
||||
/** The format canonical query parameter name */
|
||||
private static final String FORMAT = "format";
|
||||
|
||||
/** The federated canonical query parameter name */
|
||||
private static final String FEDERATED = "federated";
|
||||
|
||||
/** The federation canonical query parameter name */
|
||||
private static final String FEDERATION = "federation";
|
||||
|
||||
/** The matchOlderVersion canonical query parameter name */
|
||||
private static final String MATCH_OLDER_VERSIONS = "matchOlderVersions";
|
||||
|
||||
/** The startIndex canonical query parameter name */
|
||||
private static final String START_INDEX = "startIndex";
|
||||
|
||||
/** The lang canonical query parameter name */
|
||||
private static final String LANG = "lang";
|
||||
|
||||
/** The maxResults canonical query parameter name */
|
||||
private static final String MAX_RESULTS = "maxResults";
|
||||
public class QueryProtocolRestService implements IQueryProtocolRestService {
|
||||
|
||||
/** Convenience list of all the canonical query parameter names */
|
||||
private static final List<String> CANONICAL_QUERY_PARAMETERS;
|
||||
|
||||
static {
|
||||
CANONICAL_QUERY_PARAMETERS = new ArrayList<String>();
|
||||
CANONICAL_QUERY_PARAMETERS.add(QUERY_ID);
|
||||
CANONICAL_QUERY_PARAMETERS.add(DEPTH);
|
||||
CANONICAL_QUERY_PARAMETERS.add(FORMAT);
|
||||
CANONICAL_QUERY_PARAMETERS.add(FEDERATED);
|
||||
CANONICAL_QUERY_PARAMETERS.add(FEDERATION);
|
||||
CANONICAL_QUERY_PARAMETERS.add(MATCH_OLDER_VERSIONS);
|
||||
CANONICAL_QUERY_PARAMETERS.add(START_INDEX);
|
||||
CANONICAL_QUERY_PARAMETERS.add(LANG);
|
||||
CANONICAL_QUERY_PARAMETERS.add(MAX_RESULTS);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.QUERY_ID);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.DEPTH);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.FORMAT);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.FEDERATED);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.FEDERATION);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.MATCH_OLDER_VERSIONS);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.START_INDEX);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.LANG);
|
||||
CANONICAL_QUERY_PARAMETERS.add(QueryRequest.MAX_RESULTS);
|
||||
|
||||
}
|
||||
|
||||
|
@ -127,18 +102,11 @@ public class QueryProtocolRestService {
|
|||
responseJaxb = new JAXBManager(QueryResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a query based on the submitted query parameters
|
||||
*
|
||||
* @param info
|
||||
* The UriInfo containing the query parameters
|
||||
* @return The marshalled QueryResponse
|
||||
* @throws JAXBException
|
||||
* If errors occur while marshalling the response
|
||||
* @throws MsgRegistryException
|
||||
* If errors occur in the registry while querying for the
|
||||
* objects
|
||||
*/
|
||||
public String executeQuery() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces("text/xml")
|
||||
public String executeQuery(@Context UriInfo info) throws JAXBException,
|
||||
|
@ -148,31 +116,37 @@ public class QueryProtocolRestService {
|
|||
*/
|
||||
MultivaluedMap<String, String> queryParameters = info
|
||||
.getQueryParameters();
|
||||
String queryId = queryParameters.getFirst(QUERY_ID) == null ? "urn:oasis:names:tc:ebxml-regrep:query:GetObjectById"
|
||||
: queryParameters.getFirst(QUERY_ID);
|
||||
String queryId = queryParameters.getFirst(QueryRequest.QUERY_ID) == null ? "urn:oasis:names:tc:ebxml-regrep:query:GetObjectById"
|
||||
: queryParameters.getFirst(QueryRequest.QUERY_ID);
|
||||
|
||||
BigInteger depth = queryParameters.getFirst(DEPTH) == null ? null
|
||||
: new BigInteger(queryParameters.getFirst(DEPTH));
|
||||
BigInteger depth = queryParameters.getFirst(QueryRequest.DEPTH) == null ? null
|
||||
: new BigInteger(queryParameters.getFirst(QueryRequest.DEPTH));
|
||||
|
||||
String format = queryParameters.getFirst(FORMAT);
|
||||
String format = queryParameters.getFirst(QueryRequest.FORMAT);
|
||||
|
||||
boolean federated = queryParameters.getFirst(FEDERATED) == null ? false
|
||||
: Boolean.parseBoolean(queryParameters.getFirst(FEDERATED));
|
||||
boolean federated = queryParameters.getFirst(QueryRequest.FEDERATED) == null ? false
|
||||
: Boolean.parseBoolean(queryParameters
|
||||
.getFirst(QueryRequest.FEDERATED));
|
||||
|
||||
String federation = queryParameters.getFirst(FEDERATION);
|
||||
String federation = queryParameters.getFirst(QueryRequest.FEDERATION);
|
||||
|
||||
boolean matchOlderVersions = queryParameters
|
||||
.getFirst(MATCH_OLDER_VERSIONS) == null ? true : Boolean
|
||||
.parseBoolean(queryParameters.getFirst(MATCH_OLDER_VERSIONS));
|
||||
.getFirst(QueryRequest.MATCH_OLDER_VERSIONS) == null ? true
|
||||
: Boolean.parseBoolean(queryParameters
|
||||
.getFirst(QueryRequest.MATCH_OLDER_VERSIONS));
|
||||
|
||||
BigInteger startIndex = queryParameters.getFirst(START_INDEX) == null ? new BigInteger(
|
||||
"0") : new BigInteger(queryParameters.getFirst(START_INDEX));
|
||||
BigInteger startIndex = queryParameters
|
||||
.getFirst(QueryRequest.START_INDEX) == null ? new BigInteger(
|
||||
"0") : new BigInteger(
|
||||
queryParameters.getFirst(QueryRequest.START_INDEX));
|
||||
|
||||
String lang = queryParameters.getFirst(LANG) == null ? Languages.EN_US
|
||||
: queryParameters.getFirst(LANG);
|
||||
String lang = queryParameters.getFirst(QueryRequest.LANG) == null ? Languages.EN_US
|
||||
: queryParameters.getFirst(QueryRequest.LANG);
|
||||
|
||||
BigInteger maxResults = queryParameters.getFirst(MAX_RESULTS) == null ? new BigInteger(
|
||||
"0") : new BigInteger(queryParameters.getFirst(MAX_RESULTS));
|
||||
BigInteger maxResults = queryParameters
|
||||
.getFirst(QueryRequest.MAX_RESULTS) == null ? new BigInteger(
|
||||
"0") : new BigInteger(
|
||||
queryParameters.getFirst(QueryRequest.MAX_RESULTS));
|
||||
|
||||
/*
|
||||
* Create the query request object
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* 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.registry.ebxml.services.rest;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* Rest service used to check availability of a registry
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/21/2013 2022 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryAvailable")
|
||||
@Service
|
||||
@Transactional
|
||||
public class RegistryAvailableRestService implements
|
||||
IRegistryAvailableRestService {
|
||||
|
||||
/** The logger */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistryAvailableRestService.class);
|
||||
|
||||
/** Arbitrary message retured from this service */
|
||||
private static final String REGISTRY_AVAILABLE_MESSAGE = "Registry services available.";
|
||||
|
||||
/**
|
||||
* Creates a new RegistryAvailableRestService
|
||||
*/
|
||||
public RegistryAvailableRestService() {
|
||||
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces("text/plain")
|
||||
public String isRegistryAvailable() {
|
||||
statusHandler.info("Received request checking registry availability");
|
||||
return REGISTRY_AVAILABLE_MESSAGE;
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.WorkflowActionType;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.services.rest.IRegistryObjectsRestService;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
|
||||
|
@ -71,6 +72,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/19/2013 1931 bphillip Initial implementation
|
||||
* 5/21/2013 2022 bphillip Added interface
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -79,7 +81,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
|||
@Path("/rest/registryObjects/{objectId}")
|
||||
@Service
|
||||
@Transactional
|
||||
public class RegistryObjectsRestService {
|
||||
public class RegistryObjectsRestService implements IRegistryObjectsRestService {
|
||||
|
||||
/** The data access object for getting registry objects */
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
@ -109,15 +111,6 @@ public class RegistryObjectsRestService {
|
|||
ClassificationSchemeType.class, WorkflowActionType.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a registry object based on the object ID specified in the path
|
||||
*
|
||||
* @param objectId
|
||||
* The object Id of the object
|
||||
* @return The marshalled object
|
||||
* @throws JAXBException
|
||||
* If errors occur marshalling the object
|
||||
*/
|
||||
@GET
|
||||
@Produces("text/xml")
|
||||
public String getRegistryObject(@PathParam("objectId") String objectId)
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.edex.registry.ebxml.services.rest;
|
|||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
|
||||
|
@ -30,6 +29,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtrinsicObjectType;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/19/2013 1931 bphillip Initial implementation
|
||||
* 5/21/2013 2022 bphillip Added interface and changed method name
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -52,7 +53,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
|
|||
@Path("/rest/repositoryItems/{repositoryItemId}")
|
||||
@Service
|
||||
@Transactional
|
||||
public class RepositoryItemsRestService {
|
||||
public class RepositoryItemsRestService implements IRepositoryItemsRestService {
|
||||
|
||||
/**
|
||||
* The data access object for getting extrinsic objects containing
|
||||
|
@ -69,8 +70,7 @@ public class RepositoryItemsRestService {
|
|||
*/
|
||||
@GET
|
||||
@Produces("application/octet-stream")
|
||||
public byte[] getRegistryObject(
|
||||
@PathParam("repositoryItemId") String repositoryItemId) {
|
||||
public byte[] getRepositoryItem(String repositoryItemId) {
|
||||
ExtrinsicObjectType obj = extrinsicObjectDao.getById(repositoryItemId);
|
||||
if (obj == null) {
|
||||
throw new WebApplicationException(404);
|
||||
|
|
|
@ -48,7 +48,6 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
|
||||
|
||||
import com.google.common.net.HttpHeaders;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
|
||||
/**
|
||||
|
@ -72,6 +71,14 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
|||
|
||||
public class EbxmlObjectUtil {
|
||||
|
||||
/** Default registry base URL */
|
||||
public static final String REGISTRY_BASE_URL = "http://"
|
||||
+ System.getenv("EBXML_REGISTRY_HOST") + ":"
|
||||
+ System.getenv("EBXML_REGISTRY_WEBSERVER_PORT");
|
||||
|
||||
/** Slot name that holds the source of the notification */
|
||||
public static final String NOTIFICATION_SOURCE_URL_SLOT_NAME = "NotificationSourceURL";
|
||||
|
||||
/**
|
||||
* The name of the slot designated to hold the home server address of a
|
||||
* registry object
|
||||
|
@ -348,6 +355,16 @@ public class EbxmlObjectUtil {
|
|||
EMAIL_NOTIFICATION_FORMATTER_SLOT);
|
||||
}
|
||||
|
||||
private static List<String> HTTP_HEADERS;
|
||||
static {
|
||||
HTTP_HEADERS = new ArrayList<String>(5);
|
||||
HTTP_HEADERS.add("X-Forwarded-For");
|
||||
HTTP_HEADERS.add("Proxy-Client-IP");
|
||||
HTTP_HEADERS.add("WL-Proxy-Client-IP");
|
||||
HTTP_HEADERS.add("HTTP_CLIENT_IP");
|
||||
HTTP_HEADERS.add("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
|
||||
public static String getClientHost(WebServiceContext wsContext) {
|
||||
if (wsContext == null) {
|
||||
return "INTERNAL";
|
||||
|
@ -356,13 +373,19 @@ public class EbxmlObjectUtil {
|
|||
if (mc == null) {
|
||||
return "INTERNAL";
|
||||
}
|
||||
HttpServletRequest req = (HttpServletRequest) mc
|
||||
HttpServletRequest request = (HttpServletRequest) mc
|
||||
.get(MessageContext.SERVLET_REQUEST);
|
||||
String host = req.getHeader(HttpHeaders.HOST);
|
||||
if (host == null) {
|
||||
return "Host name not available";
|
||||
} else {
|
||||
return host;
|
||||
String ip = null;
|
||||
request.getHeader("X-Forwarded-For");
|
||||
|
||||
for (int i = 0; (i < 5)
|
||||
&& (ip == null || ip.isEmpty() || "unknown"
|
||||
.equalsIgnoreCase(ip)); i++) {
|
||||
ip = request.getHeader(HTTP_HEADERS.get(i));
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
<!-- REST Service Definitions -->
|
||||
<jaxrs:server id="registryRestServices" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="registryAvailabilityService"/>
|
||||
<ref bean="registryObjectsRestService" />
|
||||
<ref bean="repositoryObjectsRestService" />
|
||||
<ref bean="queryProtocolRestService" />
|
||||
|
|
Loading…
Add table
Reference in a new issue