Issue #2769: Registry database deadlocking fixes/performance improvements

Change-Id: I7a1a0b5397ff179d60d7303f2f22e4cd95940df0

Former-commit-id: ea31c5b370 [formerly d339e232f4] [formerly ed050996a2] [formerly 5483d6d7ae [formerly ed050996a2 [formerly a4e02448e88b8b0bbad62794b41d0ef1bd1c6b6e]]]
Former-commit-id: 5483d6d7ae
Former-commit-id: d73e719f11d2bc9e27c664078a07b85c55da2615 [formerly 15a5e7c4a4]
Former-commit-id: 603e433054
This commit is contained in:
Benjamin Phillippe 2014-02-20 12:17:32 -06:00
parent c03650a0ee
commit 71d5fbda33
69 changed files with 1970 additions and 2331 deletions

View file

@ -0,0 +1,109 @@
/**
* 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.datadelivery.registry.web;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
/**
*
* Interface for the registry federation manager for exposing web services for
* the web interface
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 2/27/2014 2769 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
@Path(IRegistryFederationManager.REGISTRY_FEDERATION_MANAGER_PATH)
public interface IRegistryFederationManager {
/** The path to these set of services */
public static final String REGISTRY_FEDERATION_MANAGER_PATH = "/federation/";
/**
* Gets if this registry is participating in the federation
*
* @return The value of the EBXML_REGISTRY_FEDERATION_ENABLED environment
* variable
*/
@GET
@Path("isFederated")
public String isFederated();
@GET
@Path("dataDeliveryId")
public String dataDeliveryId();
@GET
@Path("siteId")
public String siteId();
@GET
@Path("getObjectTypesReplicated")
public String getObjectTypesReplicated();
@GET
@Path("getFederationMembers")
public String getFederationMembers() throws Exception;
@GET
@Path("getReplicatingTo")
public String getReplicatingTo();
@GET
@Path("getReplicatingFrom")
public String getReplicatingFrom() throws Exception;
@GET
@Path("subscribeToRegistry/{registryId}")
public void subscribeToRegistry(@PathParam("registryId") String registryId)
throws Exception;
@GET
@Path("unsubscribeFromRegistry/{registryId}")
public void unsubscribeFromRegistry(
@PathParam("registryId") String registryId) throws Exception;
@GET
@Path("addReplicationServer/{registryId}")
public void addReplicationServer(@PathParam("registryId") String registryId)
throws Exception;
@GET
@Path("removeReplicationServer/{registryId}")
public void removeReplicationServer(
@PathParam("registryId") String registryId) throws Exception;
@GET
@Path("synchronizeWithRegistry/{registryId}")
public void synchronizeWithRegistry(
@PathParam("registryId") String registryId) throws Exception;
}

View file

@ -1,145 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.registry.web;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import com.raytheon.uf.common.registry.services.RegistryServiceException;
/**
* <pre>
* Interface for Registry federation status
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/20/2013 2534 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
@Path(IRegistryFederationService.REGISTRY_FEDERATION_STATUS_PATH)
public interface IRegistryFederationService {
/** The path to these set of services */
public static final String REGISTRY_FEDERATION_STATUS_PATH = "/status/";
/**
* Gets if this registry is participating in the federation
*
* @return The value of the EBXML_REGISTRY_FEDERATION_ENABLED environment
* variable
*/
@GET
@Path("isFederated")
public String isFederated();
/**
* Gets information about this registry
*
* @return Information pertaining to the local registry
*/
@GET
@Path("getMyRegistryInfo")
public String getMyRegistryInfo();
/**
* Queries the NCF registry to get a list of registries in the federation
*
* @return The list of registries in the federation
* @throws MsgRegistryException
* If an error occurs while querying the NCF registry
*/
@GET
@Path("getFederationMembers")
public String getFederationMembers() throws MsgRegistryException;
/**
* Gets the list of registry that the local registry is subscribed to
*
* @return The list of registries that the local registry is subscribed to
*/
@GET
@Path("getRegistriesSubscribedTo")
public String getRegistriesSubscribedTo();
/**
* Gets a list of registries that are subscribing to the local registry
*
* @return The list of registries that are subscribing to the local registry
*/
@GET
@Path("getRegistrySubscribing")
public String getRegistrySubscribing();
/**
* Gets the list of object types that are currently being replicated
*
* @return The object list
*/
@GET
@Path("getObjectTypesReplicated")
public String getObjectTypesReplicated();
/**
* Kicks of a full registry sync with the specified registry
*
* @param registryId
* The registry ID to sync with
* @return status message
*/
@GET
@Path("syncWithRegistry/{registryId}")
public String syncWithRegistry(@PathParam("registryId") String registryId);
/**
* Subscribes to replication notifications from the specified registry
*
* @param registryId
* The ID of the registry to subscribe to
* @return Status message
* @throws JAXBException
* @throws RegistryServiceException
*/
@GET
@Path("subscribeToRegistry/{registryId}")
public String subscribeToRegistry(@PathParam("registryId") String registryId)
throws RegistryServiceException, JAXBException;
/**
* Unsubscribes from the specified registry
*
* @param registryId
* The ID of the registry to unsubscribe from
* @return The status message
*/
@GET
@Path("unsubscribeFromRegistry/{registryId}")
public String unsubscribeFromRegistry(
@PathParam("registryId") String registryId);
}

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService
* 11/20/2013 2534 bphillip Added HTTPClient policy for rest connections. Eliminated service caching. * 11/20/2013 2534 bphillip Added HTTPClient policy for rest connections. Eliminated service caching.
* 12/2/2013 1829 bphillip Removed expectedType argument on getRegistryObject method * 12/2/2013 1829 bphillip Removed expectedType argument on getRegistryObject method
* 1/15/2014 2613 bphillip Removed Service cache due to unexpected behavior * 1/15/2014 2613 bphillip Removed Service cache due to unexpected behavior
* 2/19/2014 2769 bphillip Added service cache
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -105,7 +106,7 @@ public class RegistryRESTServices {
* @return The service implementation * @return The service implementation
*/ */
public IRegistryObjectsRestService getRegistryObjectService(String baseURL) { public IRegistryObjectsRestService getRegistryObjectService(String baseURL) {
return getPort(baseURL + REGISTRY_REST_SERVICE_PATH, return createService(baseURL + REGISTRY_REST_SERVICE_PATH,
IRegistryObjectsRestService.class); IRegistryObjectsRestService.class);
} }
@ -142,7 +143,7 @@ public class RegistryRESTServices {
* @return The service implementation * @return The service implementation
*/ */
public IRepositoryItemsRestService getRepositoryItemService(String baseURL) { public IRepositoryItemsRestService getRepositoryItemService(String baseURL) {
return getPort(baseURL + REGISTRY_REST_SERVICE_PATH, return createService(baseURL + REGISTRY_REST_SERVICE_PATH,
IRepositoryItemsRestService.class); IRepositoryItemsRestService.class);
} }
@ -171,7 +172,8 @@ public class RegistryRESTServices {
public Object accessXMLRestService(String url) { public Object accessXMLRestService(String url) {
String response = null; String response = null;
try { try {
response = Resources.toString(new URL(url), Charset.forName("UTF8")); response = Resources
.toString(new URL(url), Charset.forName("UTF8"));
} catch (Exception e) { } catch (Exception e) {
throw new RegistryServiceException( throw new RegistryServiceException(
"Error accessing REST service at URL: [" + url + "]", e); "Error accessing REST service at URL: [" + url + "]", e);
@ -185,11 +187,6 @@ public class RegistryRESTServices {
} }
} }
protected <T extends Object> T getPort(String serviceUrl,
final Class<T> serviceInterface) {
return createService(serviceUrl, serviceInterface);
}
protected <T extends Object> T createService(String url, protected <T extends Object> T createService(String url,
Class<T> serviceClass) { Class<T> serviceClass) {
T service = JAXRSClientFactory.create(url, serviceClass); T service = JAXRSClientFactory.create(url, serviceClass);

View file

@ -73,6 +73,7 @@ import com.raytheon.uf.common.status.UFStatus;
* 10/30/2013 1538 bphillip Made methods in this class non-static * 10/30/2013 1538 bphillip Made methods in this class non-static
* 11/20/2013 2534 bphillip Eliminated service caching * 11/20/2013 2534 bphillip Eliminated service caching
* 1/15/2014 2613 bphillip Eliminated service caching...again * 1/15/2014 2613 bphillip Eliminated service caching...again
* 2/19/2014 2769 bphillip Renamed getPort method
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -81,37 +82,37 @@ import com.raytheon.uf.common.status.UFStatus;
public class RegistrySOAPServices { public class RegistrySOAPServices {
/** The logger */ /** The logger */
private static final IUFStatusHandler statusHandler = UFStatus protected static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistrySOAPServices.class); .getHandler(RegistrySOAPServices.class);
/** Default timeout for receiving HTTP data */ /** Default timeout for receiving HTTP data */
private static final long DEFAULT_RECEIVE_TIMEOUT = 60000; protected static final long DEFAULT_RECEIVE_TIMEOUT = 60000;
/** Default value for establishing an HTTP connection */ /** Default value for establishing an HTTP connection */
private static final long DEFAULT_CONNECT_TIMEOUT = 10000; protected static final long DEFAULT_CONNECT_TIMEOUT = 10000;
/** Path separator */ /** Path separator */
private static final String PATH_SEPARATOR = "/"; protected static final String PATH_SEPARATOR = "/";
/** WSDL suffix */ /** WSDL suffix */
private static final String WSDL = "?wsdl"; protected static final String WSDL = "?wsdl";
/** The name of the notification listener service */ /** The name of the notification listener service */
private static final String NOTIFICATION_SERVICE_NAME = "notificationListener"; protected static final String NOTIFICATION_SERVICE_NAME = "notificationListener";
/** The name of the lifecycle manager service */ /** The name of the lifecycle manager service */
private static final String LIFECYCLE_MANAGER_SERVICE_NAME = "lifecycleManager"; protected static final String LIFECYCLE_MANAGER_SERVICE_NAME = "lifecycleManager";
/** The name of the cataloger service */ /** The name of the cataloger service */
private static final String CATALOGER_SERVICE_NAME = "cataloger"; protected static final String CATALOGER_SERVICE_NAME = "cataloger";
/** The name of the query service */ /** The name of the query service */
private static final String QUERY_SERVICE_NAME = "queryManager"; protected static final String QUERY_SERVICE_NAME = "queryManager";
/** The name of the validator service */ /** The name of the validator service */
private static final String VALIDATOR_SERVICE_NAME = "validator"; protected static final String VALIDATOR_SERVICE_NAME = "validator";
private static final ProxyConfiguration proxyConfig; protected static final ProxyConfiguration proxyConfig;
protected static final HTTPClientPolicy httpClientPolicy; protected static final HTTPClientPolicy httpClientPolicy;
@ -187,7 +188,7 @@ public class RegistrySOAPServices {
*/ */
public NotificationListener getNotificationListenerServiceForUrl( public NotificationListener getNotificationListenerServiceForUrl(
final String url) throws RegistryServiceException { final String url) throws RegistryServiceException {
return getPort(url, NotificationListener.class); return createService(url, NotificationListener.class);
} }
/** /**
@ -210,7 +211,7 @@ public class RegistrySOAPServices {
* @return The lifecycle manager service at the given URL string * @return The lifecycle manager service at the given URL string
*/ */
public LifecycleManager getLifecycleManagerServiceForUrl(final String url) { public LifecycleManager getLifecycleManagerServiceForUrl(final String url) {
return getPort(url, LifecycleManager.class); return createService(url, LifecycleManager.class);
} }
/** /**
@ -233,7 +234,7 @@ public class RegistrySOAPServices {
* @return The cataloger service * @return The cataloger service
*/ */
public Cataloger getCatalogerServiceForUrl(final String url) { public Cataloger getCatalogerServiceForUrl(final String url) {
return getPort(url, Cataloger.class); return createService(url, Cataloger.class);
} }
/** /**
@ -255,7 +256,7 @@ public class RegistrySOAPServices {
* @return The query manager service at the given url string * @return The query manager service at the given url string
*/ */
public QueryManager getQueryServiceForUrl(final String url) { public QueryManager getQueryServiceForUrl(final String url) {
return getPort(url, QueryManager.class); return createService(url, QueryManager.class);
} }
/** /**
@ -281,7 +282,7 @@ public class RegistrySOAPServices {
*/ */
public Validator getValidatorServiceForUrl(final String url) public Validator getValidatorServiceForUrl(final String url)
throws RegistryServiceException { throws RegistryServiceException {
return getPort(url, Validator.class); return createService(url, Validator.class);
} }
/** /**
@ -336,7 +337,7 @@ public class RegistrySOAPServices {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private <T extends Object> T createService(String serviceUrl, protected <T extends Object> T createService(String serviceUrl,
Class<?> serviceInterface) throws RegistryServiceException { Class<?> serviceInterface) throws RegistryServiceException {
W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder(); W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder();
endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL); endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL);
@ -354,11 +355,6 @@ public class RegistrySOAPServices {
return port; return port;
} }
private <T extends Object> T getPort(String serviceUrl,
final Class<T> serviceInterface) {
return createService(serviceUrl, serviceInterface);
}
/** /**
* Gets the proxy configuration * Gets the proxy configuration
* *

View file

@ -31,6 +31,8 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import org.apache.cxf.annotations.FastInfoset; import org.apache.cxf.annotations.FastInfoset;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
@ -44,6 +46,7 @@ import com.raytheon.uf.common.registry.EbxmlNamespaces;
* 2012 bphillip Initial implementation * 2012 bphillip Initial implementation
* 10/17/2013 1682 bphillip Added software history * 10/17/2013 1682 bphillip Added software history
* 12/9/2013 2613 bphillip Changed to use FastInfoset * 12/9/2013 2613 bphillip Changed to use FastInfoset
* 2/19/2014 2769 bphillip Added Transactional annotation to executeQuery method
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -71,6 +74,7 @@ public interface QueryManager {
*/ */
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException; throws MsgRegistryException;

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 13, 2013 1543 djohnson Initial creation * Feb 13, 2013 1543 djohnson Initial creation
* 2/19/2014 2769 bphillip Added loadById method
* *
* </pre> * </pre>
* *
@ -110,6 +111,17 @@ public interface ISessionManagedDao<IDENTIFIER extends Serializable, ENTITY exte
*/ */
ENTITY getById(IDENTIFIER id); ENTITY getById(IDENTIFIER id);
/**
* Load an entity by its id. This method differs from the getById method in
* that it only returns a proxy. The database is not actually hit until the
* object is used.
*
* @param id
* the id
* @return the entity
*/
ENTITY loadById(IDENTIFIER id);
/** /**
* Get all of the entities of this type. * Get all of the entities of this type.
* *

View file

@ -64,6 +64,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* 10/8/2013 1682 bphillip Added the createCriteria method * 10/8/2013 1682 bphillip Added the createCriteria method
* 12/9/2013 2613 bphillip Added flushAndClearSession method * 12/9/2013 2613 bphillip Added flushAndClearSession method
* Jan 17, 2014 2459 mpduff Added null check to prevent NPE. * Jan 17, 2014 2459 mpduff Added null check to prevent NPE.
* 2/13/2014 2769 bphillip Added read-only flag to query methods and loadById method
* *
* </pre> * </pre>
* *
@ -148,21 +149,34 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public ENTITY getById(IDENTIFIER id) { public ENTITY getById(IDENTIFIER id) {
final Class<ENTITY> entityClass = getEntityClass(); final Class<ENTITY> entityClass = getEntityClass();
return entityClass.cast(template.get(entityClass, id)); return entityClass.cast(template.get(entityClass, id));
} }
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public ENTITY loadById(IDENTIFIER id) {
final Class<ENTITY> entityClass = getEntityClass();
return entityClass.cast(template.load(entityClass, id));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getAll() { public List<ENTITY> getAll() {
return query("from " + getEntityClass().getSimpleName()); return query("from " + getEntityClass().getSimpleName());
} }
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> loadAll() {
return this.template.loadAll(getEntityClass());
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public ENTITY uniqueResult(String queryString) { public ENTITY uniqueResult(String queryString) {
return uniqueResult(queryString, new Object[0]); return uniqueResult(queryString, new Object[0]);
} }
@ -174,7 +188,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* @param params * @param params
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
protected ENTITY uniqueResult(String queryString, Object... params) { protected ENTITY uniqueResult(String queryString, Object... params) {
final List<ENTITY> results = executeHQLQuery(queryString, params); final List<ENTITY> results = executeHQLQuery(queryString, params);
if (results.isEmpty()) { if (results.isEmpty()) {
@ -186,6 +200,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
return results.get(0); return results.get(0);
} }
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> query(String queryString) { public List<ENTITY> query(String queryString) {
return executeHQLQuery(queryString); return executeHQLQuery(queryString);
} }
@ -197,12 +212,12 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* @param params * @param params
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> query(String queryString, Object... params) { public List<ENTITY> query(String queryString, Object... params) {
return executeHQLQuery(queryString, 0, params); return executeHQLQuery(queryString, 0, params);
} }
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> query(String queryString, Integer maxResults, public List<ENTITY> query(String queryString, Integer maxResults,
Object... params) { Object... params) {
return executeHQLQuery(queryString, maxResults, params); return executeHQLQuery(queryString, maxResults, params);
@ -220,7 +235,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* @throws DataAccessLayerException * @throws DataAccessLayerException
* If errors are encountered during the HQL query * If errors are encountered during the HQL query
*/ */
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public <T extends Object> List<T> executeHQLQuery(String queryString) { public <T extends Object> List<T> executeHQLQuery(String queryString) {
return executeHQLQuery(queryString, 0); return executeHQLQuery(queryString, 0);
} }
@ -242,7 +257,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* @throws DataAccessLayerException * @throws DataAccessLayerException
* If Hibernate errors occur during the execution of the query * If Hibernate errors occur during the execution of the query
*/ */
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public <T extends Object> List<T> executeHQLQuery(String queryString, public <T extends Object> List<T> executeHQLQuery(String queryString,
Object... params) { Object... params) {
return executeHQLQuery(queryString, 0, params); return executeHQLQuery(queryString, 0, params);
@ -270,7 +285,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* @return The results of the query * @return The results of the query
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public <T extends Object> List<T> executeHQLQuery(final String queryString, public <T extends Object> List<T> executeHQLQuery(final String queryString,
Integer maxResults, Object... params) { Integer maxResults, Object... params) {
if (params.length % 2 != 0) { if (params.length % 2 != 0) {
@ -297,7 +312,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public <T extends Object> Iterator<T> getQueryIterator( public <T extends Object> Iterator<T> getQueryIterator(
final String queryString, Object... params) { final String queryString, Object... params) {
if (params.length == 0) { if (params.length == 0) {
@ -391,7 +406,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
* If errors occur in Hibernate while executing the query * If errors occur in Hibernate while executing the query
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public <T extends Object> List<T> executeCriteriaQuery( public <T extends Object> List<T> executeCriteriaQuery(
final DetachedCriteria criteria) { final DetachedCriteria criteria) {
if (criteria == null) { if (criteria == null) {
@ -404,6 +419,11 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
this.getSessionFactory().getCurrentSession().evict(entity); this.getSessionFactory().getCurrentSession().evict(entity);
} }
public ENTITY load(Serializable id) {
return this.template.load(getEntityClass(), id);
}
/** /**
* Low-level method to execute a unit of work. * Low-level method to execute a unit of work.
* *

View file

@ -0,0 +1,50 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="ebxml-federation" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<endpoint id="replicationMonitor"
uri="quartz://registry/replicationMonitor/?cron=0+0+0/1+*+*+?"/>
<endpoint id="updateUptime"
uri="quartz://registry/updateUptime/?cron=0+0/1+*+*+*+?" />
<endpoint id="purgeExpiredReplicationEvents"
uri="quartz://registry/purgeExpiredReplicationEvents/?cron=0+0+0/1+*+*+?" />
<endpoint id="processReplicationSubscriptions"
uri="quartz://registry/registryReplicationQuartz/?cron=${ebxml-replication-process.cron}" />
<endpoint id="processReplicationVMQueue" uri="vm:processReplication?concurrentConsumers=2"/>
<route id="replicationMonitorRoute">
<from uri="replicationMonitor"/>
<bean ref="RegistryFederationManager" method="verifyReplication"/>
</route>
<route id="updateUptimeRoute">
<from uri="updateUptime" />
<bean ref="RegistryFederationManager" method="updateUpTime" />
</route>
<route id="forwardReplication">
<from uri="processReplicationSubscriptions"/>
<to uri="processReplicationVMQueue"/>
</route>
<route id="processReplication">
<from uri="processReplicationVMQueue"/>
<bean ref="RegistryFederationManager" method="processReplicationEvents"/>
</route>
<route id="purgeExpiredReplicationEventsRoute">
<from uri="purgeExpiredReplicationEvents"/>
<bean ref="RegistryFederationManager" method="deleteExpiredEvents"/>
</route>
</camelContext>
</beans>

View file

@ -4,18 +4,28 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="FederatedRegistryMonitor" class="com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistryMonitor"> <bean id="FederatedRegistryMonitor" class="com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistryMonitor">
<constructor-arg ref="metadataTxTemplate"/>
<constructor-arg ref="registryObjectDao"/> <constructor-arg ref="registryObjectDao"/>
</bean> </bean>
<bean id="replicationEventDao"
class="com.raytheon.uf.edex.datadelivery.registry.dao.ReplicationEventDao">
<property name="sessionFactory" ref="metadataSessionFactory" />
</bean>
<bean id="FederationDbInit" class="com.raytheon.uf.edex.datadelivery.registry.federation.FederationDbInit">
<property name="dao" ref="registryObjectDao" />
</bean>
<bean id="RegistryFederationManager" class="com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager"> <bean id="RegistryFederationManager" class="com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager">
<constructor-arg ref="lcmServiceImpl"/> <property name="replicationEventDao" ref="replicationEventDao"/>
<constructor-arg ref="FederatedRegistryMonitor"/>
<constructor-arg ref="metadataTxTemplate"/>
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="registryDao" ref="registryDao"/> <property name="registryDao" ref="registryDao"/>
<property name="registrySoapServices" ref="registryWebServiceClient"/> <property name="txTemplate" ref="metadataTxTemplate"/>
<property name="soapService" ref="registryWebServiceClient"/>
<property name="localLifecycleManager" ref="lcmServiceImpl"/>
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/> <property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
<property name="registryObjectDao" ref="registryObjectDao"/>
<property name="federatedRegistryMonitor" ref="FederatedRegistryMonitor"/>
<property name="federationDbInit" ref="FederationDbInit"/>
</bean> </bean>

View file

@ -23,19 +23,21 @@
<bean id="registryAvailabilityService" <bean id="registryAvailabilityService"
class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryAvailableRestService" /> class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryAvailableRestService" />
<bean id="registryStatus" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryFederationStatus">
<property name="registryDao" ref="registryDao"/>
<property name="subscriptionDao" ref="subscriptionTypeDao"/>
<property name="federationManager" ref="RegistryFederationManager"/>
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
<property name="registrySoapServices" ref="registryWebServiceClient"/>
</bean>
<bean id="defineRegistryQuery" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryQueryDefinitionService"> <bean id="defineRegistryQuery" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryQueryDefinitionService">
<property name="registryObjectDao" ref="registryObjectDao"/> <property name="registryObjectDao" ref="registryObjectDao"/>
</bean> </bean>
<!-- SOAP Service definitions -->
<jaxws:server id="RegistryFederationManagerService" address="/registryFederationManager">
<jaxws:inInterceptors>
<ref bean="webServiceInInterceptor" />
</jaxws:inInterceptors>
<jaxws:serviceBean>
<ref bean="RegistryFederationManager" />
</jaxws:serviceBean>
</jaxws:server>
<!-- REST Service Definitions --> <!-- REST Service Definitions -->
<jaxrs:server id="dataDeliveryRestServices" address="/dataDelivery"> <jaxrs:server id="dataDeliveryRestServices" address="/dataDelivery">
@ -45,7 +47,7 @@
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="registryDataAccessService" /> <ref bean="registryDataAccessService" />
<ref bean="registryAvailabilityService" /> <ref bean="registryAvailabilityService" />
<ref bean="registryStatus"/> <ref bean="RegistryFederationManager"/>
<ref bean="defineRegistryQuery"/> <ref bean="defineRegistryQuery"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
</jaxrs:server> </jaxrs:server>

View file

@ -26,14 +26,13 @@ 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.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
@ -53,12 +52,14 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/29/2013 2191 bphillip Initial implementation * 7/29/2013 2191 bphillip Initial implementation
* 12/2/2013 1829 bphillip Uses correct getter for getting date time value * 12/2/2013 1829 bphillip Uses correct getter for getting date time value
* 2/19/2014 2769 bphillip Refactored to no longer extend Runnable
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
public class FederatedRegistryMonitor extends RunnableWithTransaction { @Transactional
public class FederatedRegistryMonitor {
/** The logger instance */ /** The logger instance */
private static final IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
@ -74,9 +75,7 @@ public class FederatedRegistryMonitor extends RunnableWithTransaction {
super(); super();
} }
public FederatedRegistryMonitor(TransactionTemplate txTemplate, public FederatedRegistryMonitor(RegistryObjectDao registryObjectDao) {
RegistryObjectDao registryObjectDao) {
super(txTemplate);
this.registryObjectDao = registryObjectDao; this.registryObjectDao = registryObjectDao;
} }
@ -95,9 +94,9 @@ public class FederatedRegistryMonitor extends RunnableWithTransaction {
return cal.getTimeInMillis(); return cal.getTimeInMillis();
} }
@Override public void updateTime() {
public void runWithTransaction() {
try { try {
statusHandler.info("Updating registry uptime");
RegistryObjectType regObj = registryObjectDao RegistryObjectType regObj = registryObjectDao
.getById(REGISTRY_AVAILABLE_ID); .getById(REGISTRY_AVAILABLE_ID);
if (regObj == null) { if (regObj == null) {

View file

@ -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.edex.datadelivery.registry.dao;
import java.util.List;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
import com.raytheon.uf.edex.datadelivery.registry.federation.ReplicationEvent;
/**
* <pre>
*
* Data Access object for interactions with ReplicationEvent objects
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 2/19/2014 2769 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
public class ReplicationEventDao extends
SessionManagedDao<Long, ReplicationEvent> {
private static final String GET_REPLICATION_EVENT_QUERY = "from ReplicationEvent event where (event.source is null or event.source != '%s') and (event.replicatedTo is null or event.replicatedTo not like '%%%s%%') order by event.eventTime asc";
@Override
protected Class<ReplicationEvent> getEntityClass() {
return ReplicationEvent.class;
}
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public List<ReplicationEvent> getReplicationEvents(String remoteRegistry) {
return this.executeHQLQuery(String.format(GET_REPLICATION_EVENT_QUERY,
remoteRegistry, remoteRegistry));
}
}

View file

@ -0,0 +1,65 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.federation;
import org.hibernate.cfg.AnnotationConfiguration;
import com.raytheon.uf.edex.database.init.DbInit;
/**
* <pre>
*
* Creates the database tables necessary for federation replication to function
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 2/19/2014 2769 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
public class FederationDbInit extends DbInit {
/** Query to check which tables exist in the ebxml database */
private static final String TABLE_CHECK_QUERY = "SELECT tablename FROM pg_tables where schemaname = 'awips' and tablename='registryreplicationevents';";
protected FederationDbInit() {
super("Data Delivery Federation");
}
@Override
protected String getTableCheckQuery() {
return TABLE_CHECK_QUERY;
}
@Override
protected AnnotationConfiguration getAnnotationConfiguration() {
/*
* Create a new configuration object which holds all the classes that
* this Hibernate SessionFactory is aware of
*/
AnnotationConfiguration aConfig = new AnnotationConfiguration();
aConfig.addAnnotatedClass(ReplicationEvent.class);
return aConfig;
}
}

View file

@ -25,6 +25,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.datatype.Duration; import javax.xml.datatype.Duration;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonNameType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonNameType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType;
@ -32,6 +34,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PostalAddressType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TelephoneNumberType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TelephoneNumberType;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes; import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
@ -50,6 +53,7 @@ import com.raytheon.uf.edex.datadelivery.util.DataDeliveryIdUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 5/22/2013 1707 bphillip Initial implementation * 5/22/2013 1707 bphillip Initial implementation
* Feb 11, 2014 2771 bgonzale Removed siteIdentifier field and use Data Delivery ID instead. * Feb 11, 2014 2771 bgonzale Removed siteIdentifier field and use Data Delivery ID instead.
* 2/19/2014 2769 bphillip Moved getFederationAssociation from RegistryFederationManager
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -59,6 +63,9 @@ import com.raytheon.uf.edex.datadelivery.util.DataDeliveryIdUtil;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class FederationProperties { public class FederationProperties {
/** Constant used for names of registries in the registry database */
public static final String REGISTRY_SUFFIX = " Registry";
/** /**
* A RegistryType instance MAY have an attribute named conformanceProfile * A RegistryType instance MAY have an attribute named conformanceProfile
* that declares the conformance profile that the server supports. The * that declares the conformance profile that the server supports. The
@ -180,11 +187,11 @@ public class FederationProperties {
*/ */
public RegistryType createRegistryObject() { public RegistryType createRegistryObject() {
RegistryType registryObj = new RegistryType(); RegistryType registryObj = new RegistryType();
registryObj.setId(DataDeliveryIdUtil.getId() + " Registry"); registryObj.setId(DataDeliveryIdUtil.getId() + REGISTRY_SUFFIX);
registryObj.setLid(registryObj.getId()); registryObj.setLid(registryObj.getId());
registryObj.setName(RegistryUtil registryObj.setName(RegistryUtil
.getInternationalString(DataDeliveryIdUtil.getId() .getInternationalString(DataDeliveryIdUtil.getId()
+ " Registry Specification")); + " Registry Specification"));
registryObj.setObjectType(RegistryObjectTypes.REGISTRY); registryObj.setObjectType(RegistryObjectTypes.REGISTRY);
registryObj.setDescription(registryObj.getName()); registryObj.setDescription(registryObj.getName());
registryObj.setOwner(DataDeliveryIdUtil.getId()); registryObj.setOwner(DataDeliveryIdUtil.getId());
@ -271,6 +278,24 @@ public class FederationProperties {
return siteAddress; return siteAddress;
} }
protected AssociationType getFederationAssociation(RegistryType registry,
FederationType federation) {
AssociationType association = new AssociationType();
association.setId(registry.getId()
+ " Federation Membership Association");
association.setLid(association.getId());
association.setObjectType(RegistryObjectTypes.ASSOCIATION);
association.setOwner(DataDeliveryIdUtil.getId());
association.setType(AssociationTypes.HAS_FEDERATION_MEMBER);
association.setStatus(StatusTypes.APPROVED);
association.setName(RegistryUtil.getInternationalString(registry
.getId() + " Federation Membership"));
association.setDescription(association.getName());
association.setTargetObject(registry.getId());
association.setSourceObject(federation.getId());
return association;
}
public String getConformanceProfile() { public String getConformanceProfile() {
return conformanceProfile; return conformanceProfile;
} }

View file

@ -0,0 +1,77 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.federation;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
/**
*
* Exception class used by the registry federation manager for when a registry
* is not found in the federation
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 2/24/2014 2769 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
public class RegistryNotFoundException extends EbxmlRegistryException {
private static final long serialVersionUID = -8058778534952899091L;
/**
* Creates a new exception with the given message
*
* @param message
* The message to attach to the exception
*/
public RegistryNotFoundException(String message) {
super(message);
}
/**
* Creates a new exception with the given message and cause
*
* @param message
* The message to attach to the exception
* @param cause
* The underlying cause of the exception
*/
public RegistryNotFoundException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new exception with the given cause
*
* @param cause
* The underlying cause of the exception
*/
public RegistryNotFoundException(Throwable cause) {
super(cause);
}
}

View file

@ -0,0 +1,154 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.federation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
/**
* <pre>
*
* Class encapsulating a registry event
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 2/19/2014 2769 bphillip Initial Creation
* </pre>
*
* @author bphillip
* @version 1
**/
@Entity
@Table(name = "registryreplicationevents")
public class ReplicationEvent implements IPersistableDataObject<Long> {
@Id
@GeneratedValue
private Long id;
@Column
private String source;
@Column
private String eventType;
@Column
private long eventTime;
@Column
private String objectId;
@Column
private String objectType;
@Column
private String replicatedTo;
public ReplicationEvent() {
super();
}
public ReplicationEvent(String eventType, long eventTime, String objectId,
String objectType, String source) {
super();
this.eventType = eventType;
this.eventTime = eventTime;
this.objectId = objectId;
this.objectType = objectType;
this.source = source;
}
@Override
public Long getIdentifier() {
return getId();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setSource(String source) {
this.source = source;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public long getEventTime() {
return eventTime;
}
public void setEventTime(long eventTime) {
this.eventTime = eventTime;
}
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getReplicatedTo() {
return replicatedTo;
}
public void setReplicatedTo(String replicatedTo) {
this.replicatedTo = replicatedTo;
}
public void addReplicatedTo(String recipient) {
if (this.replicatedTo == null) {
this.replicatedTo = ":" + recipient + ":";
} else if (!this.replicatedTo.contains(recipient)) {
this.replicatedTo += ":" + recipient + ":";
}
}
public String getSource() {
return source;
}
}

View file

@ -1,105 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.replication;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
/**
*
* Host configuration information
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 4/9/2013 1802 bphillip Initial implementation
* 6/4/2013 1707 bphillip Renamed and changed fields for clarity
* 11/20/2013 2534 bphillip Added reciprocate field
* </pre>
*
* @author bphillip
* @version 1
*/
@XmlAccessorType(XmlAccessType.NONE)
public class NotificationHostConfiguration {
/** The site that this registry is running at */
@XmlElement
private String registrySiteName;
/** Descripion of the host */
@XmlElement
private String registryDescription;
/** The name of the host */
@XmlElement
private String registryBaseURL;
/** True if subscriptions should be reciprocated */
@XmlElement
private boolean reciprocate = false;
public NotificationHostConfiguration() {
}
public NotificationHostConfiguration(String registrySiteName,
String registryDescription, String registryBaseURL) {
this.registrySiteName = registrySiteName;
this.registryDescription = registryDescription;
this.registryBaseURL = registryBaseURL;
}
public String getRegistrySiteName() {
return registrySiteName;
}
public void setRegistrySiteName(String registrySiteName) {
this.registrySiteName = registrySiteName;
}
public String getRegistryDescription() {
return registryDescription;
}
public void setRegistryDescription(String registryDescription) {
this.registryDescription = registryDescription;
}
public String getRegistryBaseURL() {
return registryBaseURL;
}
public void setRegistryBaseURL(String registryBaseURL) {
this.registryBaseURL = registryBaseURL;
}
public boolean isReciprocate() {
return reciprocate;
}
public void setReciprocate(boolean reciprocate) {
this.reciprocate = reciprocate;
}
}

View file

@ -19,8 +19,8 @@
**/ **/
package com.raytheon.uf.edex.datadelivery.registry.replication; package com.raytheon.uf.edex.datadelivery.registry.replication;
import java.util.List; import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
@ -43,6 +43,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* 5/21/2013 1707 bphillip Removed unused fields * 5/21/2013 1707 bphillip Removed unused fields
* 6/4/2013 1707 bphillip Renamed and changed fields for clarity * 6/4/2013 1707 bphillip Renamed and changed fields for clarity
* 10/30/2013 1538 bphillip getRegistryReplicationServers returns empty list if no servers are specified * 10/30/2013 1538 bphillip getRegistryReplicationServers returns empty list if no servers are specified
* 2/27/2014 2769 bphillip Changed replicationservers variable to set of strings
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -53,19 +54,27 @@ import javax.xml.bind.annotation.XmlRootElement;
public class NotificationServers { public class NotificationServers {
/** The server located upstream from this server */ /** The server located upstream from this server */
@XmlElements({ @XmlElement(name = "registry", type = NotificationHostConfiguration.class) }) @XmlElements({ @XmlElement(name = "registry") })
private CopyOnWriteArrayList<NotificationHostConfiguration> registryReplicationServers; private CopyOnWriteArraySet<String> registryReplicationServers;
public List<NotificationHostConfiguration> getRegistryReplicationServers() { public Set<String> getRegistryReplicationServers() {
if (registryReplicationServers == null) { if (registryReplicationServers == null) {
registryReplicationServers = new CopyOnWriteArrayList<NotificationHostConfiguration>(); registryReplicationServers = new CopyOnWriteArraySet<String>();
} }
return registryReplicationServers; return registryReplicationServers;
} }
public void setRegistryReplicationServers( public void setRegistryReplicationServers(
List<NotificationHostConfiguration> registryReplicationServers) { Set<String> registryReplicationServers) {
this.registryReplicationServers = new CopyOnWriteArrayList<NotificationHostConfiguration>( this.registryReplicationServers = new CopyOnWriteArraySet<String>(
registryReplicationServers); registryReplicationServers);
} }
public void addReplicationServer(String registryId) {
this.getRegistryReplicationServers().add(registryId);
}
public void removeReplicationServer(String registryId) {
this.getRegistryReplicationServers().remove(registryId);
}
} }

View file

@ -25,7 +25,7 @@ import org.apache.commons.lang.exception.ExceptionUtils;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService; import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService; import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryFederationService; import com.raytheon.uf.common.datadelivery.registry.web.IRegistryFederationManager;
import com.raytheon.uf.common.registry.constants.RegistryAvailability; import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.common.registry.services.RegistryRESTServices; import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -42,6 +42,7 @@ import com.raytheon.uf.common.status.UFStatus;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 10/30/2013 1538 bphillip Initial Creation * 10/30/2013 1538 bphillip Initial Creation
* 11/20/2013 2534 bphillip Eliminated service caching * 11/20/2013 2534 bphillip Eliminated service caching
* 2/27/2014 2769 bphillip Add RegistryFederationManager to exposed REST services
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -62,9 +63,10 @@ public class DataDeliveryRESTServices extends RegistryRESTServices {
super(); super();
} }
public IRegistryFederationService getFederationService(String baseURL) { public IRegistryFederationManager getRegistryFederationManager(
return getPort(baseURL + DATA_DELIVERY_REST_SERVICE_PATH, String baseURL) {
IRegistryFederationService.class); return createService(baseURL + DATA_DELIVERY_REST_SERVICE_PATH,
IRegistryFederationManager.class);
} }
/** /**
@ -76,7 +78,7 @@ public class DataDeliveryRESTServices extends RegistryRESTServices {
*/ */
public IRegistryAvailableRestService getRegistryAvailableService( public IRegistryAvailableRestService getRegistryAvailableService(
String baseURL) { String baseURL) {
return getPort(baseURL + DATA_DELIVERY_REST_SERVICE_PATH, return createService(baseURL + DATA_DELIVERY_REST_SERVICE_PATH,
IRegistryAvailableRestService.class); IRegistryAvailableRestService.class);
} }
@ -118,7 +120,7 @@ public class DataDeliveryRESTServices extends RegistryRESTServices {
*/ */
public IRegistryDataAccessService getRegistryDataAccessService( public IRegistryDataAccessService getRegistryDataAccessService(
String baseURL) { String baseURL) {
return getPort(baseURL + DATA_DELIVERY_REST_SERVICE_PATH, return createService(baseURL + DATA_DELIVERY_REST_SERVICE_PATH,
IRegistryDataAccessService.class); IRegistryDataAccessService.class);
} }

View file

@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService; import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService;
import com.raytheon.uf.common.registry.constants.RegistryAvailability; import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager;
import com.raytheon.uf.edex.registry.ebxml.dao.DbInit; import com.raytheon.uf.edex.registry.ebxml.dao.DbInit;
/** /**
@ -64,7 +65,8 @@ public class RegistryAvailableRestService implements
@GET @GET
@Produces("text/plain") @Produces("text/plain")
public String isRegistryAvailable() { public String isRegistryAvailable() {
if (DbInit.isDbInitialized()) { if (DbInit.isDbInitialized()
&& RegistryFederationManager.initialized.get()) {
return RegistryAvailability.AVAILABLE; return RegistryAvailability.AVAILABLE;
} else { } else {
return RegistryAvailability.DB_NOT_INITIALIZED; return RegistryAvailability.DB_NOT_INITIALIZED;

View file

@ -1,349 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.registry.web;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.JAXBException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DeliveryInfoType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryFederationService;
import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.registry.services.RegistryServiceException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager;
import com.raytheon.uf.edex.datadelivery.registry.replication.NotificationHostConfiguration;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistrySubscriptionManager;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
/**
* <pre>
* Set of services used by the federation status web interface to modify federation associations
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 10/30/2013 1538 bphillip Initial Creation
* 11/20/2013 2534 bphillip Added interface
* 12/2/2013 1829 bphillip Changed to use modified call to getRegistryObject
* 12/9/2013 2613 bphillip Changed getRegistriesSubscribedTo to not execute remote queries
* </pre>
*
* @author bphillip
* @version 1
**/
@Path(IRegistryFederationService.REGISTRY_FEDERATION_STATUS_PATH)
@Transactional
public class RegistryFederationStatus implements IRegistryFederationService {
/** The logger instance */
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryFederationStatus.class);
/** Comparator to sort registry instances */
private static final Comparator<RegistryObjectType> REGISTRY_COMPARATOR = new Comparator<RegistryObjectType>() {
@Override
public int compare(RegistryObjectType o1, RegistryObjectType o2) {
return o1.getId().compareTo(o2.getId());
}
};
/** Data Access object for registry objects */
private RegistryDao registryDao;
/** Data Access object for registry subscription objects */
private SubscriptionDao subscriptionDao;
/** The registry replication manager */
private RegistryFederationManager federationManager;
/** Data Delivery rest services client */
private DataDeliveryRESTServices dataDeliveryRestClient;
/** Registry soap services client */
private RegistrySOAPServices registrySoapServices;
/**
* The address to the NCF registry loaded from the NCF_ADDRESS item in
* setup.env
*/
private String ncfAddress = System.getenv("NCF_ADDRESS");
@GET
@Path("isFederated")
public String isFederated() {
return System.getenv("EBXML_REGISTRY_FEDERATION_ENABLED");
}
@GET
@Path("getMyRegistryInfo")
public String getMyRegistryInfo() {
StringBuilder builder = new StringBuilder();
RegistryType myRegistry = registryDao
.getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS);
appendRegistryInfo(myRegistry, builder);
return builder.toString();
}
@GET
@Path("getFederationMembers")
public String getFederationMembers() throws MsgRegistryException {
StringBuilder builder = new StringBuilder();
QueryType query = new QueryType(
CanonicalQueryTypes.FIND_ASSOCIATED_OBJECTS);
query.getSlot().add(
new SlotType(QueryConstants.ASSOCIATION_TYPE,
new StringValueType(
AssociationTypes.HAS_FEDERATION_MEMBER)));
query.getSlot().add(
new SlotType(QueryConstants.SOURCE_OBJECT_ID,
new StringValueType(
RegistryFederationManager.FEDERATION_ID)));
QueryRequest queryRequest = new QueryRequest("Get Federation Members",
query, new ResponseOptionType(QueryReturnTypes.REGISTRY_OBJECT,
true));
List<RegistryObjectType> federationMembers = registrySoapServices
.getQueryServiceForHost(ncfAddress).executeQuery(queryRequest)
.getRegistryObjects();
Collections.sort(federationMembers, REGISTRY_COMPARATOR);
for (RegistryObjectType obj : federationMembers) {
if (obj instanceof RegistryType) {
RegistryType registry = (RegistryType) obj;
appendRegistryInfo(registry, builder);
}
}
return builder.toString();
}
@GET
@Path("getRegistriesSubscribedTo")
public String getRegistriesSubscribedTo() {
StringBuilder builder = new StringBuilder();
if (this.federationManager.getServers() != null
&& !CollectionUtil.isNullOrEmpty(this.federationManager
.getServers().getRegistryReplicationServers())) {
List<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
for (NotificationHostConfiguration hostConfig : this.federationManager
.getServers().getRegistryReplicationServers()) {
RegistryType reg = registryDao.getRegistryByBaseURL(hostConfig
.getRegistryBaseURL());
if (reg != null) {
registries.add(reg);
}
}
Collections.sort(registries, REGISTRY_COMPARATOR);
for (RegistryObjectType reg : registries) {
appendRegistryInfo((RegistryType) reg, builder);
}
}
return builder.toString();
}
@GET
@Path("getRegistrySubscribing")
public String getRegistrySubscribing() {
StringBuilder builder = new StringBuilder();
List<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
for (SubscriptionType sub : subscriptionDao.getAll()) {
DeliveryInfoType deliveryInfo = sub.getDeliveryInfo().get(0);
W3CEndpointReference endpointReference = deliveryInfo.getNotifyTo();
DOMResult dom = new DOMResult();
endpointReference.writeTo(dom);
Document doc = (Document) dom.getNode();
NodeList nodes = doc.getElementsByTagNameNS(
EbxmlNamespaces.ADDRESSING_URI,
RegistrySubscriptionManager.ADDRESS_TAG);
Node addressNode = nodes.item(0);
String serviceAddress = addressNode.getTextContent().trim();
String endpointType = addressNode
.getAttributes()
.getNamedItemNS(EbxmlNamespaces.RIM_URI,
RegistrySubscriptionManager.ENDPOINT_TAG)
.getNodeValue();
if (endpointType.equals(DeliveryMethodTypes.SOAP)) {
RegistryType registry = registryDao
.getRegistryByBaseURL(serviceAddress.replace(
"/notificationListener", ""));
if (registry != null && !registries.contains(registry)) {
registries.add(registry);
}
}
}
Collections.sort(registries, REGISTRY_COMPARATOR);
for (RegistryObjectType reg : registries) {
appendRegistryInfo((RegistryType) reg, builder);
}
return builder.toString();
}
@GET
@Path("getObjectTypesReplicated")
public String getObjectTypesReplicated() {
StringBuilder builder = new StringBuilder();
for (String objectType : RegistryFederationManager.getObjectTypes()) {
builder.append(objectType).append(StringUtil.NEWLINE);
}
return builder.toString();
}
@GET
@Path("syncWithRegistry/{registryId}")
public String syncWithRegistry(@PathParam("registryId") String registryId) {
StringBuilder builder = new StringBuilder();
RegistryType registry = registryDao.getById(registryId);
if (registry == null) {
builder.append("Registry [" + registryId
+ "] not in federation. Unable to synchronize.");
} else {
try {
federationManager.synchronizeRegistryWithFederation(registry
.getBaseURL());
} catch (Exception e) {
statusHandler.error("Error synchronizing registry!", e);
builder.append("Error synchronizing registry [" + registryId
+ "]: " + e.getLocalizedMessage());
}
}
return builder.toString();
}
@GET
@Path("subscribeToRegistry/{registryId}")
public String subscribeToRegistry(@PathParam("registryId") String registryId)
throws RegistryServiceException, JAXBException {
StringBuilder builder = new StringBuilder();
RegistryType registry = dataDeliveryRestClient.getRegistryObject(
ncfAddress, registryId);
if (registry == null) {
builder.append("Registry [")
.append(registryId)
.append("] not in federation. Unable to submit subscriptions.");
} else {
if (!federationManager.isSubscribedTo(registry)) {
federationManager.submitSubscriptionsToRegistry(registry);
builder.append("Successfully subscribed to registry [")
.append(registryId).append("]");
this.federationManager.addNotificationServer(registry);
federationManager.saveNotificationServers();
}
}
return builder.toString();
}
@GET
@Path("unsubscribeFromRegistry/{registryId}")
public String unsubscribeFromRegistry(
@PathParam("registryId") String registryId) {
StringBuilder builder = new StringBuilder();
RegistryType registry = registryDao.getById(registryId);
if (registry == null) {
builder.append("Registry [" + registryId
+ "] not in federation. Unable to unsubscribe.");
} else {
RegistryType localRegistry = registryDao
.getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS);
dataDeliveryRestClient.getRegistryDataAccessService(
registry.getBaseURL()).removeSubscriptionsForSite(
localRegistry.getOwner());
builder.append("Successfully unsubscribed from registry ["
+ registryId + "]");
federationManager.removeNotificationServer(registry.getBaseURL());
federationManager.saveNotificationServers();
}
return builder.toString();
}
/**
* Appends registry information to the stringbuilder
*
* @param registry
* The registry to get information for
* @param builder
* The string builder to append to
*/
private void appendRegistryInfo(RegistryType registry, StringBuilder builder) {
builder.append(registry.getId()).append(",");
builder.append(registry.getBaseURL()).append(",");
builder.append(registry.getConformanceProfile()).append(",");
builder.append(registry.getSpecificationVersion());
builder.append(StringUtil.NEWLINE);
}
public void setFederationManager(RegistryFederationManager federationManager) {
this.federationManager = federationManager;
}
public void setRegistryDao(RegistryDao registryDao) {
this.registryDao = registryDao;
}
public void setSubscriptionDao(SubscriptionDao subscriptionDao) {
this.subscriptionDao = subscriptionDao;
}
public void setDataDeliveryRestClient(
DataDeliveryRESTServices dataDeliveryRestClient) {
this.dataDeliveryRestClient = dataDeliveryRestClient;
}
public void setRegistrySoapServices(
RegistrySOAPServices registrySoapServices) {
this.registrySoapServices = registrySoapServices;
}
}

View file

@ -1,19 +1,10 @@
<!-- This file is intended to be overridden by sites. It contains the list of <!-- This file is intended to be overridden by sites. It contains the list of
registries that this registry wishes to subscribe to registries that this registry wishes to subscribe to. Each entry is a data delivery ID.
The data delivery ID is generally the same as the WFO or regional headquarters such as
The Registry site name is the WFO identifier of the target registry. OAX, DMX, BCQ, etc.
The registry description is an arbitrary description of that registry
The registry base URL is the base URL of the registry of the form http://HOST_NAME:8082
The reciprocate field instructs the target registry to subscribe to this registry.
--> -->
<NotificationServers> <NotificationServers>
<!-- Default configuration for the NCF does not define any servers --> <!-- <registry>DataDelivery ID 1</registry> -->
<!-- These are defined at the site level --> <!-- <registry>DataDelivery ID 2</registry> -->
<!-- <registry>-->
<!-- <registrySiteName>SITE_NAME</registrySiteName>-->
<!-- <registryDescription>Description of registry</registryDescription>-->
<!-- <registryBaseURL>BASE_URL</registryBaseURL>-->
<!-- <reciprocate>false</reciprocate> -->
<!-- </registry>-->
</NotificationServers> </NotificationServers>

View file

@ -5,6 +5,10 @@
<bean factory-bean="eventBus" factory-method="register"> <bean factory-bean="eventBus" factory-method="register">
<constructor-arg ref="RegistrySubscriptionManager" /> <constructor-arg ref="RegistrySubscriptionManager" />
</bean> </bean>
<bean factory-bean="eventBus" factory-method="register">
<constructor-arg ref="RegistryFederationManager" />
</bean>
<bean factory-bean="eventBus" factory-method="register"> <bean factory-bean="eventBus" factory-method="register">
<constructor-arg ref="AuditableEventService" /> <constructor-arg ref="AuditableEventService" />

View file

@ -36,7 +36,6 @@
<bean id="RegistryGarbageCollector" <bean id="RegistryGarbageCollector"
class="com.raytheon.uf.edex.registry.ebxml.services.RegistryGarbageCollector"> class="com.raytheon.uf.edex.registry.ebxml.services.RegistryGarbageCollector">
<constructor-arg ref="AuditableEventTypeDao" /> <constructor-arg ref="AuditableEventTypeDao" />
<constructor-arg ref="metadataTxTemplate"/>
</bean> </bean>
<bean id="objectReferenceResolver" class="com.raytheon.uf.edex.registry.ebxml.services.lifecycle.ObjectReferenceResolver"> <bean id="objectReferenceResolver" class="com.raytheon.uf.edex.registry.ebxml.services.lifecycle.ObjectReferenceResolver">

View file

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

View file

@ -1,7 +1,7 @@
# The period which registry subscriptions are processed # The period which registry replication occurs
ebxml-subscription-process.cron=0/20+*+*+*+*+? ebxml-replication-process.cron=0/10+*+*+*+*+?
# The period which the registry runs the garbage collection # The period which the registry runs the garbage collection
ebxml-garbage-collect-process.cron=0+0/5+*+*+*+? ebxml-garbage-collect-process.cron=0+0+0/1+*+*+?
# When a federation synchonization is necessary, this is the number of threads # When a federation synchonization is necessary, this is the number of threads
# that will be used for synchronization # that will be used for synchronization
ebxml-federation-sync-threads=3 ebxml-federation-sync-threads=3

View file

@ -24,6 +24,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
/** /**
@ -38,6 +41,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 7/30/2012 724 bphillip Initial creation * 7/30/2012 724 bphillip Initial creation
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection * 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -57,6 +61,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getByTargetAndType(String target, String type) { public List<AssociationType> getByTargetAndType(String target, String type) {
return executeHQLQuery("from AssociationType obj where obj.targetObject='" return executeHQLQuery("from AssociationType obj where obj.targetObject='"
+ target + "' and obj.type='" + type + "'"); + target + "' and obj.type='" + type + "'");
@ -73,6 +78,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getBySourceAndType(String source, String type) { public List<AssociationType> getBySourceAndType(String source, String type) {
return executeHQLQuery("from AssociationType obj where obj.sourceObject='" return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
+ source + "' and obj.type='" + type + "'"); + source + "' and obj.type='" + type + "'");
@ -91,6 +97,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getBySourceTargetAndType(String source, public List<AssociationType> getBySourceTargetAndType(String source,
String target, String type) { String target, String type) {
return executeHQLQuery("from AssociationType obj where obj.sourceObject='" return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
@ -109,6 +116,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getAllAssociations(String objReferenced) { public List<AssociationType> getAllAssociations(String objReferenced) {
return executeHQLQuery("from AssociationType obj where obj.sourceObject='" return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
+ objReferenced + objReferenced
@ -126,6 +134,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getAssociationsTo(String objReferenced) { public List<AssociationType> getAssociationsTo(String objReferenced) {
return executeHQLQuery("from AssociationType obj where obj.targetObject='" return executeHQLQuery("from AssociationType obj where obj.targetObject='"
+ objReferenced + "'"); + objReferenced + "'");
@ -140,6 +149,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AssociationType> getAssociationsFrom(String objReferenced) { public List<AssociationType> getAssociationsFrom(String objReferenced) {
return executeHQLQuery("from AssociationType obj where obj.sourceObject='" return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
+ objReferenced + "'"); + objReferenced + "'");

View file

@ -107,7 +107,7 @@ public class AuditableEventTypeDao extends
private static final String ORDER_CLAUSE = " order by event.timestamp asc"; private static final String ORDER_CLAUSE = " order by event.timestamp asc";
/** The number of hours to retain auditable events */ /** The number of hours to retain auditable events */
private static final int AUDITABLE_EVENT_RETENTION_TIME = 48; public static final int AUDITABLE_EVENT_RETENTION_TIME = 48;
/** Cutoff parameter for the query to get the expired events */ /** Cutoff parameter for the query to get the expired events */
private static final String GET_EXPIRED_EVENTS_QUERY_CUTOFF_PARAMETER = "cutoff"; private static final String GET_EXPIRED_EVENTS_QUERY_CUTOFF_PARAMETER = "cutoff";
@ -146,7 +146,7 @@ public class AuditableEventTypeDao extends
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur purging auditable events * If errors occur purging auditable events
*/ */
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public List<AuditableEventType> getExpiredEvents(int limit) public List<AuditableEventType> getExpiredEvents(int limit)
throws EbxmlRegistryException { throws EbxmlRegistryException {
Calendar cutoffTime = TimeUtil.newGmtCalendar(); Calendar cutoffTime = TimeUtil.newGmtCalendar();
@ -174,6 +174,7 @@ public class AuditableEventTypeDao extends
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* @throws MsgRegistryException * @throws MsgRegistryException
*/ */
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public List<AuditableEventType> getEventsOfInterest( public List<AuditableEventType> getEventsOfInterest(
SubscriptionType subscription, String serviceAddress, SubscriptionType subscription, String serviceAddress,
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
@ -336,6 +337,7 @@ public class AuditableEventTypeDao extends
* The delivery address to check * The delivery address to check
* @return The last sent date in millis * @return The last sent date in millis
*/ */
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public Long getSendTime(AuditableEventType auditableEvent, public Long getSendTime(AuditableEventType auditableEvent,
String subscriptionId, String deliveryAddress) { String subscriptionId, String deliveryAddress) {
SlotType slot = auditableEvent.getSlotByName(subscriptionId SlotType slot = auditableEvent.getSlotByName(subscriptionId

View file

@ -23,6 +23,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Data access object for retrieving ClassificationNodeTypes * Data access object for retrieving ClassificationNodeTypes
* *
@ -36,6 +39,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
* 8/3/2012 724 bphillip Added more methods for getting classification nodes * 8/3/2012 724 bphillip Added more methods for getting classification nodes
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection * 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -45,19 +49,23 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
public class ClassificationNodeDao extends public class ClassificationNodeDao extends
RegistryObjectTypeDao<ClassificationNodeType> { RegistryObjectTypeDao<ClassificationNodeType> {
/** Regex to use when querying for telephone types */ private static final String GET_BY_PATH_QUERY = "select obj from ClassificationNodeType obj where obj.path=:path";
public static final String TELEPHONE_TYPE_REGEX = "urn:oasis:names:tc:ebxml-regrep:PhoneType:%";
/** Regex to use when querying for postal address types */ private static final String GET_NODE_FROM_CODE_QUERY = "select obj.id from ClassificationNodeType obj where obj.code=:code";
public static final String ADDRESS_TYPE_REGEX = "urn:oasis:names:tc:ebxml-regrep:PostalAddressType%";
/** Regex to use when querying for email types */ private static final String GET_CODE_FROM_NODE_QUERY = "select obj.code from ClassificationNodeType obj where obj.id=:id";
public static final String EMAIL_TYPE_REGEX = "urn:oasis:names:tc:ebxml-regrep:EmailType:%";
private static final String GET_TELEPHONE_TYPES_QUERY = "select obj.code from ClassificationNodeType obj where obj.lid like 'urn:oasis:names:tc:ebxml-regrep:PhoneType:%'";
private static final String GET_ADDRESS_TYPES_QUERY = "select obj.code from ClassificationNodeType obj where obj.lid like 'urn:oasis:names:tc:ebxml-regrep:PostalAddressType%'";
private static final String GET_EMAIL_TYPES_QUERY = "select obj.code from ClassificationNodeType obj where obj.lid like 'urn:oasis:names:tc:ebxml-regrep:EmailType:%'";
public ClassificationNodeDao() { public ClassificationNodeDao() {
} }
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public boolean isValidNode(String id) { public boolean isValidNode(String id) {
return getById(id) != null; return getById(id) != null;
} }
@ -69,10 +77,10 @@ public class ClassificationNodeDao extends
* The path to get the classification node type for * The path to get the classification node type for
* @return The ClassificationNode object with the specified path * @return The ClassificationNode object with the specified path
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public ClassificationNodeType getByPath(String path) { public ClassificationNodeType getByPath(String path) {
List<ClassificationNodeType> result = this List<ClassificationNodeType> result = this.executeHQLQuery(
.executeHQLQuery("select obj from ClassificationNodeType obj where obj.path='" GET_BY_PATH_QUERY, "path", path);
+ path + "'");
if (result.isEmpty()) { if (result.isEmpty()) {
return null; return null;
} else { } else {
@ -87,10 +95,10 @@ public class ClassificationNodeDao extends
* The code of the classification node * The code of the classification node
* @return The ID of the classification node with the given code * @return The ID of the classification node with the given code
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public String getNodeFromCode(String code) { public String getNodeFromCode(String code) {
List<String> results = this List<String> results = this.executeHQLQuery(GET_NODE_FROM_CODE_QUERY,
.executeHQLQuery("select obj.id from ClassificationNodeType obj where obj.code='" "code", code);
+ code + "'");
if (results.isEmpty()) { if (results.isEmpty()) {
return null; return null;
@ -106,10 +114,10 @@ public class ClassificationNodeDao extends
* The object ID of the classification node * The object ID of the classification node
* @return The code of the classification node with the given ID * @return The code of the classification node with the given ID
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public String getCodeFromNode(String id) { public String getCodeFromNode(String id) {
List<String> results = this List<String> results = this.executeHQLQuery(GET_CODE_FROM_NODE_QUERY,
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.id='" "id", id);
+ id + "'");
if (results.isEmpty()) { if (results.isEmpty()) {
return null; return null;
@ -123,11 +131,10 @@ public class ClassificationNodeDao extends
* *
* @return The codes of the telephone types in the registry * @return The codes of the telephone types in the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<String> getTelephoneTypes() { public List<String> getTelephoneTypes() {
return this return this.executeHQLQuery(GET_TELEPHONE_TYPES_QUERY);
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
+ TELEPHONE_TYPE_REGEX + "'");
} }
@ -136,11 +143,10 @@ public class ClassificationNodeDao extends
* *
* @return The codes of the address types in the registry * @return The codes of the address types in the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<String> getAddressTypes() { public List<String> getAddressTypes() {
return this return this.executeHQLQuery(GET_ADDRESS_TYPES_QUERY);
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
+ ADDRESS_TYPE_REGEX + "'");
} }
@ -149,10 +155,9 @@ public class ClassificationNodeDao extends
* *
* @return The codes dmail types in the registry * @return The codes dmail types in the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<String> getEmailTypes() { public List<String> getEmailTypes() {
return this return this.executeHQLQuery(GET_EMAIL_TYPES_QUERY);
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
+ EMAIL_TYPE_REGEX + "'");
} }
@Override @Override

View file

@ -21,6 +21,9 @@ package com.raytheon.uf.edex.registry.ebxml.dao;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Data access object for FederationType objects * Data access object for FederationType objects
* *
@ -32,6 +35,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 5/21/2013 2022 bphillip Initial implementation * 5/21/2013 2022 bphillip Initial implementation
* 2/13/2014 2769 bphillip Added read only flags to query methods
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -46,10 +50,12 @@ public class FederationDao extends RegistryObjectTypeDao<FederationType> {
return FederationType.class; return FederationType.class;
} }
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public long getFederationCount() { public long getFederationCount() {
return (Long) this.executeHQLQuery(COUNT_QUERY).get(0); return (Long) this.executeHQLQuery(COUNT_QUERY).get(0);
} }
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public boolean federationsExist() { public boolean federationsExist() {
return getFederationCount() > 0; return getFederationCount() > 0;
} }

View file

@ -27,6 +27,8 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.IdentifiableType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.IdentifiableType;
import org.hibernate.criterion.Property; import org.hibernate.criterion.Property;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -44,6 +46,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 10/08/2013 1682 bphillip Added the id like query * 10/08/2013 1682 bphillip Added the id like query
* 12/2/2013 1829 bphillip Now extends ExtensibleObjectTypeDao * 12/2/2013 1829 bphillip Now extends ExtensibleObjectTypeDao
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -68,6 +71,7 @@ public class IdentifiableTypeDao<ENTITY extends IdentifiableType> extends
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If the query encounters errors * If the query encounters errors
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getById(String... ids) throws EbxmlRegistryException { public List<ENTITY> getById(String... ids) throws EbxmlRegistryException {
return getById(Arrays.asList(ids)); return getById(Arrays.asList(ids));
} }
@ -84,6 +88,7 @@ public class IdentifiableTypeDao<ENTITY extends IdentifiableType> extends
* If the query encounters errors * If the query encounters errors
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getById(List<String> ids) throws EbxmlRegistryException { public List<ENTITY> getById(List<String> ids) throws EbxmlRegistryException {
return createCriteria() return createCriteria()
.add(Property.forName(QueryConstants.ID).in(ids)).list(); .add(Property.forName(QueryConstants.ID).in(ids)).list();
@ -97,6 +102,7 @@ public class IdentifiableTypeDao<ENTITY extends IdentifiableType> extends
* @return All IdentifiableType objects matching the given id * @return All IdentifiableType objects matching the given id
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByIdUsingLike(String id) { public List<ENTITY> getByIdUsingLike(String id) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.ID).like(id)).list(); Property.forName(QueryConstants.ID).like(id)).list();

View file

@ -25,6 +25,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -40,6 +43,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 7/30/2012 724 bphillip Initial creation * 7/30/2012 724 bphillip Initial creation
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries * 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -48,6 +52,8 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
*/ */
public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> { public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
private static final String GET_ORGANIZATION_BY_NAME_QUERY = "select obj from OrganizationType obj inner join obj.name.localizedString as theName where lower(obj.id) like :name1 or lower(theName.value) like :name2 order by obj.id asc";
/** The Association data access object */ /** The Association data access object */
private AssociationDao associationDao; private AssociationDao associationDao;
@ -65,6 +71,7 @@ public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<OrganizationType> getAllOrganizations() { public List<OrganizationType> getAllOrganizations() {
return getAll(); return getAll();
} }
@ -79,11 +86,12 @@ public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<OrganizationType> getOrganizationByName(String name) { public List<OrganizationType> getOrganizationByName(String name) {
List<OrganizationType> orgs = executeHQLQuery("select obj from OrganizationType obj inner join obj.name.localizedString as theName where lower(obj.id) like '%" List<OrganizationType> orgs = executeHQLQuery(
+ name.toLowerCase() GET_ORGANIZATION_BY_NAME_QUERY, "name1",
+ "%' or lower(theName.value) like '%" "%" + name.toLowerCase() + "%", "name2",
+ name.toLowerCase() + "%' order by obj.id asc"); "%" + name.toLowerCase() + "%");
return orgs; return orgs;
} }
@ -96,6 +104,7 @@ public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public OrganizationType getOrganizationForUser(String user) public OrganizationType getOrganizationForUser(String user)
throws EbxmlRegistryException { throws EbxmlRegistryException {
List<AssociationType> associations = associationDao.getBySourceAndType( List<AssociationType> associations = associationDao.getBySourceAndType(

View file

@ -26,6 +26,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -41,6 +44,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 7/30/2012 724 bphillip Initial creation * 7/30/2012 724 bphillip Initial creation
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries * 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -49,6 +53,15 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
*/ */
public class PersonDao extends RegistryObjectTypeDao<PersonType> { public class PersonDao extends RegistryObjectTypeDao<PersonType> {
private static final String GET_BY_FIRST_NAME_QUERY = "select obj from PersonType obj where lower(obj.personName.firstName) like :firstName order by obj.personName.lastName asc, obj.personName.firstName asc";
private static final String GET_BY_LAST_NAME_QUERY = "select obj from PersonType obj where lower(obj.personName.lastName) like :lastName order by obj.personName.lastName asc, obj.personName.firstName asc";
private static final String GET_BY_FIRST_AND_LAST_NAME_QUERY = "select obj from PersonType obj where lower(obj.personName.firstName) like :firstname and lower(obj.personName.lastName) like :lastName order by obj.personName.lastName asc, obj.personName.firstName asc";
private static final String GET_ALL_USER_NAMES_QUERY = "select obj.id, obj.personName.firstName, obj.personName.lastName from PersonType obj "
+ "order by obj.personName.lastName asc, obj.personName.firstName asc";
private AssociationDao associationDao; private AssociationDao associationDao;
/** /**
@ -65,14 +78,13 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* The first name * The first name
* @return The matching users * @return The matching users
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<PersonType> getByFirstName(String firstName) { public List<PersonType> getByFirstName(String firstName) {
if (firstName == null || firstName.trim().isEmpty()) { if (firstName == null || firstName.trim().isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
return this return this.executeHQLQuery(GET_BY_FIRST_NAME_QUERY, ":firstName", "%"
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%" + firstName.toLowerCase() + "%");
+ firstName.toLowerCase()
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
} }
@ -84,14 +96,13 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* The last name * The last name
* @return The matching users * @return The matching users
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<PersonType> getByLastName(String lastName) { public List<PersonType> getByLastName(String lastName) {
if (lastName == null || lastName.trim().isEmpty()) { if (lastName == null || lastName.trim().isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
return this return this.executeHQLQuery(GET_BY_LAST_NAME_QUERY, "lastName", "%"
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.lastName) like '%" + lastName.toLowerCase() + "%");
+ lastName.toLowerCase()
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
} }
@ -105,6 +116,7 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* The last name * The last name
* @return The matching users * @return The matching users
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<PersonType> getByFirstAndLastName(String firstName, public List<PersonType> getByFirstAndLastName(String firstName,
String lastName) { String lastName) {
if (firstName.trim().isEmpty() && lastName.trim().isEmpty()) { if (firstName.trim().isEmpty() && lastName.trim().isEmpty()) {
@ -115,12 +127,9 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
} else if (lastName == null || lastName.trim().isEmpty()) { } else if (lastName == null || lastName.trim().isEmpty()) {
return getByFirstName(firstName); return getByFirstName(firstName);
} }
return this return this.executeHQLQuery(GET_BY_FIRST_AND_LAST_NAME_QUERY,
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%" "firstName", "%" + firstName.toLowerCase() + "%", "lastName",
+ firstName.toLowerCase() "%" + lastName.toLowerCase() + "%");
+ "%' and lower(obj.personName.lastName) like '%"
+ lastName.toLowerCase()
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
} }
@ -131,6 +140,7 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* The organization ID * The organization ID
* @return The users associated with the organization * @return The users associated with the organization
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<PersonType> getEmployeesOfOrganization(String orgId) { public List<PersonType> getEmployeesOfOrganization(String orgId) {
List<PersonType> employees = new ArrayList<PersonType>(); List<PersonType> employees = new ArrayList<PersonType>();
List<AssociationType> associations = associationDao.getByTargetAndType( List<AssociationType> associations = associationDao.getByTargetAndType(
@ -149,10 +159,9 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* the id, first name, and last name for each PersonType object in * the id, first name, and last name for each PersonType object in
* the registry * the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public Object getAllUserNames() throws EbxmlRegistryException { public Object getAllUserNames() throws EbxmlRegistryException {
return this return this.executeHQLQuery(GET_ALL_USER_NAMES_QUERY);
.executeHQLQuery("select obj.id, obj.personName.firstName, obj.personName.lastName from PersonType obj "
+ "order by obj.personName.lastName asc, obj.personName.firstName asc");
} }
@ -161,6 +170,7 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* *
* @return All personType objects in the registry * @return All personType objects in the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<PersonType> getAllUsers() throws EbxmlRegistryException { public List<PersonType> getAllUsers() throws EbxmlRegistryException {
return getByFirstAndLastName("", ""); return getByFirstAndLastName("", "");
} }
@ -172,6 +182,7 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
* The ID of the person * The ID of the person
* @return The person with the given ID * @return The person with the given ID
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public PersonType getByUserId(String userId) { public PersonType getByUserId(String userId) {
return this.getById(userId); return this.getById(userId);
} }

View file

@ -24,6 +24,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ParameterType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ParameterType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryDefinitionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryDefinitionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* *
* Data access object for QueryDefinitionType objects * Data access object for QueryDefinitionType objects
@ -36,6 +39,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryDefinitionType;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 10/8/2013 1682 bphillip Initial implementation * 10/8/2013 1682 bphillip Initial implementation
* 12/2/2013 1829 bphillip Changed get parameters for query method * 12/2/2013 1829 bphillip Changed get parameters for query method
* 2/13/2014 2769 bphillip Added read only flags to query methods
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -55,6 +59,7 @@ public class QueryDefinitionDao extends
* *
* @return The ids of the query definitions in the registry * @return The ids of the query definitions in the registry
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<String> getQueryIds() { public List<String> getQueryIds() {
return executeHQLQuery(GET_QUERY_IDS_QUERY); return executeHQLQuery(GET_QUERY_IDS_QUERY);
} }
@ -66,6 +71,7 @@ public class QueryDefinitionDao extends
* The query id to get the parameters for * The query id to get the parameters for
* @return The parameters for the specified query * @return The parameters for the specified query
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ParameterType> getParametersForQuery(String queryId) { public List<ParameterType> getParametersForQuery(String queryId) {
return this.getById(queryId).getParameter(); return this.getById(queryId).getParameter();
} }

View file

@ -21,6 +21,9 @@ package com.raytheon.uf.edex.registry.ebxml.dao;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* *
* Data access object for RegistryType objects * Data access object for RegistryType objects
@ -41,6 +44,7 @@ public class RegistryDao extends RegistryObjectTypeDao<RegistryType> {
private static final String QUERY_BY_BASE_URL = "FROM RegistryType reg where reg.baseURL=:baseURL"; private static final String QUERY_BY_BASE_URL = "FROM RegistryType reg where reg.baseURL=:baseURL";
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public RegistryType getRegistryByBaseURL(String baseURL) { public RegistryType getRegistryByBaseURL(String baseURL) {
return this.uniqueResult(QUERY_BY_BASE_URL, "baseURL", baseURL); return this.uniqueResult(QUERY_BY_BASE_URL, "baseURL", baseURL);
} }

View file

@ -24,6 +24,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; 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.rim.v4.SlotType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -41,6 +44,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 6/4/2013 2022 bphillip Added delete objects of type method * 6/4/2013 2022 bphillip Added delete objects of type method
* 7/29/2013 2191 bphillip Added new methods to support registry synchronization * 7/29/2013 2191 bphillip Added new methods to support registry synchronization
* 8/1/2013 1693 bphillip Added methods to facilitate implementation of the lifecyclemanager according to the 4.0 spec * 8/1/2013 1693 bphillip Added methods to facilitate implementation of the lifecyclemanager according to the 4.0 spec
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -96,6 +100,7 @@ public class RegistryObjectDao extends
* The object to get the next version number for * The object to get the next version number for
* @return The next version number * @return The next version number
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public String getNextVersion(RegistryObjectType objectToVersion) { public String getNextVersion(RegistryObjectType objectToVersion) {
String lid = objectToVersion.getLid(); String lid = objectToVersion.getLid();
String version = objectToVersion.getVersionInfo().getVersionName(); String version = objectToVersion.getVersionInfo().getVersionName();
@ -126,6 +131,7 @@ public class RegistryObjectDao extends
* The id to check * The id to check
* @return True if the id exists, else false * @return True if the id exists, else false
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public boolean idExists(String id) { public boolean idExists(String id) {
return ((Long) this.executeHQLQuery(ID_EXISTS_QUERY, "id", id).get(0)) != 0; return ((Long) this.executeHQLQuery(ID_EXISTS_QUERY, "id", id).get(0)) != 0;
} }
@ -137,6 +143,7 @@ public class RegistryObjectDao extends
* The lid to check * The lid to check
* @return Treu if the lid exists, else false * @return Treu if the lid exists, else false
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public boolean lidExists(String lid) { public boolean lidExists(String lid) {
return ((Long) this.executeHQLQuery(LID_EXISTS_QUERY, "lid", lid) return ((Long) this.executeHQLQuery(LID_EXISTS_QUERY, "lid", lid)
.get(0)) != 0; .get(0)) != 0;
@ -149,6 +156,7 @@ public class RegistryObjectDao extends
* The object type to get the ids for * The object type to get the ids for
* @return The list of object ids of objects of the given type * @return The list of object ids of objects of the given type
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<String> getRegistryObjectIdsOfType(String objectType) { public List<String> getRegistryObjectIdsOfType(String objectType) {
return this.executeHQLQuery(GET_IDS_BY_OBJECT_TYPE, "objectType", return this.executeHQLQuery(GET_IDS_BY_OBJECT_TYPE, "objectType",
objectType); objectType);
@ -180,6 +188,7 @@ public class RegistryObjectDao extends
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If the HQL query fails * If the HQL query fails
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<RegistryObjectType> getAllRegistryObjects() { public List<RegistryObjectType> getAllRegistryObjects() {
return getAll(); return getAll();
} }

View file

@ -27,6 +27,8 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.criterion.Property; import org.hibernate.criterion.Property;
import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -44,6 +46,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
* 4/9/2013 1802 bphillip Removed exception catching. Added merge method. * 4/9/2013 1802 bphillip Removed exception catching. Added merge method.
* 8/1/2013 1693 bphillip Moved the merge method down to RegistryObjectDao * 8/1/2013 1693 bphillip Moved the merge method down to RegistryObjectDao
* 10/8/2013 1682 bphillip Added like lid method, changed to use criteria queries for simple operations * 10/8/2013 1682 bphillip Added like lid method, changed to use criteria queries for simple operations
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -70,6 +73,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByLid(List<String> lids) { public List<ENTITY> getByLid(List<String> lids) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.LID).in(lids)).list(); Property.forName(QueryConstants.LID).in(lids)).list();
@ -84,6 +88,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* The list of lids to query for * The list of lids to query for
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByLid(String... lids) { public List<ENTITY> getByLid(String... lids) {
return getByLid(Arrays.asList(lids)); return getByLid(Arrays.asList(lids));
} }
@ -96,6 +101,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* @return All IdentifiableType objects matching the given lid * @return All IdentifiableType objects matching the given lid
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByLidUsingLike(String lid) { public List<ENTITY> getByLidUsingLike(String lid) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.LID).like(lid)).list(); Property.forName(QueryConstants.LID).like(lid)).list();
@ -111,6 +117,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByObjectType(List<String> objTypes) { public List<ENTITY> getByObjectType(List<String> objTypes) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.OBJECT_TYPE).in(objTypes)) Property.forName(QueryConstants.OBJECT_TYPE).in(objTypes))
@ -127,6 +134,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByStatus(List<String> status) { public List<ENTITY> getByStatus(List<String> status) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.STATUS).in(status)).list(); Property.forName(QueryConstants.STATUS).in(status)).list();
@ -142,6 +150,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByOwner(List<String> owner) { public List<ENTITY> getByOwner(List<String> owner) {
return createCriteria().add( return createCriteria().add(
Property.forName(QueryConstants.OWNER).in(owner)).list(); Property.forName(QueryConstants.OWNER).in(owner)).list();
@ -156,6 +165,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* The list of owners to query for * The list of owners to query for
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByOwner(String... owner) { public List<ENTITY> getByOwner(String... owner) {
return getByOwner(Arrays.asList(owner)); return getByOwner(Arrays.asList(owner));
} }
@ -169,6 +179,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* The list of names to query for * The list of names to query for
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByName(List<String> names) { public List<ENTITY> getByName(List<String> names) {
StringBuilder str = new StringBuilder( StringBuilder str = new StringBuilder(
"select obj from RegistryObjectType obj inner join obj.name.localizedString as Strings where Strings.value in "); "select obj from RegistryObjectType obj inner join obj.name.localizedString as Strings where Strings.value in ");
@ -185,6 +196,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* The list of descriptions to query for * The list of descriptions to query for
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByDescription(List<String> descriptions) { public List<ENTITY> getByDescription(List<String> descriptions) {
StringBuilder str = new StringBuilder( StringBuilder str = new StringBuilder(
"select obj from RegistryObjectType obj inner join obj.description.localizedString as Strings where Strings.value in "); "select obj from RegistryObjectType obj inner join obj.description.localizedString as Strings where Strings.value in ");
@ -201,6 +213,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
* The list of classificationNodes to query for * The list of classificationNodes to query for
* @return The list of registry objects; * @return The list of registry objects;
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<ENTITY> getByClassification(List<String> classifications) { public List<ENTITY> getByClassification(List<String> classifications) {
StringBuilder str = new StringBuilder( StringBuilder str = new StringBuilder(
"select obj from RegistryObjectType obj inner join obj.classification as Classifications where "); "select obj from RegistryObjectType obj inner join obj.classification as Classifications where ");
@ -236,6 +249,7 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public ENTITY getById(String id) { public ENTITY getById(String id) {
return super.getById(id); return super.getById(id);
} }

View file

@ -24,6 +24,9 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RoleType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RoleType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -39,6 +42,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 7/30/2012 724 bphillip Initial creation * 7/30/2012 724 bphillip Initial creation
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries * 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
* 4/9/2013 1802 bphillip Removed exception catching * 4/9/2013 1802 bphillip Removed exception catching
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -65,6 +69,7 @@ public class RoleDao extends RegistryObjectTypeDao<RoleType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur during interaction with the database * If errors occur during interaction with the database
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public RoleType getUserRole(String user) throws EbxmlRegistryException { public RoleType getUserRole(String user) throws EbxmlRegistryException {
List<AssociationType> associations = associationDao.getBySourceAndType( List<AssociationType> associations = associationDao.getBySourceAndType(
user, AssociationTypes.HAS_ROLE); user, AssociationTypes.HAS_ROLE);

View file

@ -25,6 +25,9 @@ import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.serialization.JAXBManager; import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -40,6 +43,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 3/13/2013 1082 bphillip Initial creation * 3/13/2013 1082 bphillip Initial creation
* 9/5/2013 1538 bphillip Added eagerLoadAll method * 9/5/2013 1538 bphillip Added eagerLoadAll method
* 2/13/2014 2769 bphillip Added read only flags to query methods
* *
* </pre> * </pre>
* *
@ -72,6 +76,7 @@ public class SubscriptionDao extends RegistryObjectTypeDao<SubscriptionType> {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur while querying * If errors occur while querying
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<SubscriptionType> eagerLoadAll() throws EbxmlRegistryException { public List<SubscriptionType> eagerLoadAll() throws EbxmlRegistryException {
List<SubscriptionType> subs = this.template List<SubscriptionType> subs = this.template
.loadAll(SubscriptionType.class); .loadAll(SubscriptionType.class);
@ -103,6 +108,7 @@ public class SubscriptionDao extends RegistryObjectTypeDao<SubscriptionType> {
* If errors occur while eagerly fetching all attributes using * If errors occur while eagerly fetching all attributes using
* jaxb * jaxb
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public SubscriptionType eagerGetById(String subscriptionId) public SubscriptionType eagerGetById(String subscriptionId)
throws EbxmlRegistryException { throws EbxmlRegistryException {
List<SubscriptionType> result = this.query(EAGER_LOAD_QUERY, "id", List<SubscriptionType> result = this.query(EAGER_LOAD_QUERY, "id",

View file

@ -20,21 +20,15 @@
package com.raytheon.uf.edex.registry.ebxml.services; package com.raytheon.uf.edex.registry.ebxml.services;
import java.util.List; import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao; import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -54,6 +48,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* 7/29/2013 2191 bphillip Added executors to remove orphaned slots and expired events * 7/29/2013 2191 bphillip Added executors to remove orphaned slots and expired events
* 1/15/2014 2613 bphillip Added Hibernate flush() call * 1/15/2014 2613 bphillip Added Hibernate flush() call
* 2/4/2014 2769 bphillip Removed flush and clear call * 2/4/2014 2769 bphillip Removed flush and clear call
* 2/13/2014 2769 bphillip Refactored to no longer use executor threads
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -70,23 +65,16 @@ public class RegistryGarbageCollector {
/** Sentinel to denote if the garbage collection is currently running */ /** Sentinel to denote if the garbage collection is currently running */
private AtomicBoolean running = new AtomicBoolean(false); private AtomicBoolean running = new AtomicBoolean(false);
/** The executor service to remove expired events */
private ThreadPoolExecutor expiredEventExecutor;
/** The transaction template to use for asynchronous tasks */
private TransactionTemplate txTemplate;
/** Data access object for AuditableEventType */ /** Data access object for AuditableEventType */
private AuditableEventTypeDao eventDao; private AuditableEventTypeDao eventDao;
private static final int QUEUE_MAX_SIZE = 500; /** The number of events to delete per batch */
private static final int DELETE_BATCH_SIZE = 100;
/** /**
* Creates a new GarbageCollector object * Creates a new GarbageCollector object
*/ */
public RegistryGarbageCollector() { public RegistryGarbageCollector() {
expiredEventExecutor = new ThreadPoolExecutor(1, 3, 1L,
TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(250));
} }
/** /**
@ -97,11 +85,9 @@ public class RegistryGarbageCollector {
* @param eventDao * @param eventDao
* The auditable event dao to use * The auditable event dao to use
*/ */
public RegistryGarbageCollector(AuditableEventTypeDao eventDao, public RegistryGarbageCollector(AuditableEventTypeDao eventDao) {
TransactionTemplate txTemplate) {
this(); this();
this.eventDao = eventDao; this.eventDao = eventDao;
this.txTemplate = txTemplate;
} }
@ -129,41 +115,15 @@ public class RegistryGarbageCollector {
* If errors occur while enqueuing events to be deleted * If errors occur while enqueuing events to be deleted
*/ */
private void purgeExpiredEvents() throws EbxmlRegistryException { private void purgeExpiredEvents() throws EbxmlRegistryException {
int limit = expiredEventExecutor.getQueue().remainingCapacity();
if (limit > QUEUE_MAX_SIZE * .25) { List<AuditableEventType> expiredEvents = null;
List<AuditableEventType> expiredEvents = eventDao do {
.getExpiredEvents(limit); expiredEvents = eventDao.getExpiredEvents(DELETE_BATCH_SIZE);
for (AuditableEventType event : expiredEvents) { if (!expiredEvents.isEmpty()) {
try { statusHandler.info("Deleting " + expiredEvents.size()
expiredEventExecutor.submit(new RemoveExpiredEvent( + " expired Auditable Events");
txTemplate, event)); eventDao.deleteAll(expiredEvents);
} catch (RejectedExecutionException e) {
// Could not add more to the queue since it is full
}
} }
} } while (!expiredEvents.isEmpty());
}
/**
* Task to remove expired auditable eventss
*
* @author bphillip
*
*/
private class RemoveExpiredEvent extends RunnableWithTransaction {
/** The event to be removed */
private AuditableEventType event;
public RemoveExpiredEvent(TransactionTemplate txTemplate,
AuditableEventType event) {
super(txTemplate);
this.event = event;
}
@Override
public void runWithTransaction() {
eventDao.delete(event);
}
} }
} }

View file

@ -33,6 +33,7 @@ import org.apache.cxf.transport.http.AbstractHTTPDestination;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
/** /**
@ -46,6 +47,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 9/5/2013 1538 bphillip Initial implementation * 9/5/2013 1538 bphillip Initial implementation
* 2/27/2014 2769 bphillip Changed verbose output to debug level
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -64,28 +66,31 @@ public class RegistryServiceInInterceptor extends
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void handleMessage(Message message) throws Fault { public void handleMessage(Message message) throws Fault {
StringBuilder logMessage = new StringBuilder(); if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
HttpServletRequest request = (HttpServletRequest) message StringBuilder logMessage = new StringBuilder();
.get(AbstractHTTPDestination.HTTP_REQUEST); HttpServletRequest request = (HttpServletRequest) message
Map<String, List<String>> headers = (Map<String, List<String>>) message .get(AbstractHTTPDestination.HTTP_REQUEST);
.get(Message.PROTOCOL_HEADERS); Map<String, List<String>> headers = (Map<String, List<String>>) message
List<String> callingRegistryList = headers .get(Message.PROTOCOL_HEADERS);
.get(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME); List<String> callingRegistryList = headers
if (request.getRequestURI().startsWith("/rest")) { .get(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME);
logMessage.append("REST: "); if (request.getRequestURI().startsWith("/rest")) {
} else { logMessage.append("REST: ");
logMessage.append("WS: "); } else {
logMessage.append("WS: ");
}
logMessage.append("Request from [");
if (CollectionUtil.isNullOrEmpty(callingRegistryList)) {
logMessage.append(request.getRemoteAddr()).append("]: ")
.append(request.getMethod()).append(" ")
.append(request.getRequestURI());
} else {
logMessage.append(callingRegistryList.get(0)).append("]: ")
.append(request.getMethod()).append(" ")
.append(request.getRequestURI());
}
statusHandler.debug(logMessage.toString());
} }
logMessage.append("Request from [");
if (CollectionUtil.isNullOrEmpty(callingRegistryList)) {
logMessage.append(request.getRemoteAddr()).append("]: ")
.append(request.getMethod()).append(" ")
.append(request.getRequestURI());
} else {
logMessage.append(callingRegistryList.get(0)).append("]: ")
.append(request.getMethod()).append(" ")
.append(request.getRequestURI());
}
statusHandler.info(logMessage.toString());
} }
} }

View file

@ -108,6 +108,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent;
* Separate update from create notifications. * Separate update from create notifications.
* 12/2/2013 1829 bphillip Auditable events are not genereted via messages on the event bus * 12/2/2013 1829 bphillip Auditable events are not genereted via messages on the event bus
* 01/21/2014 2613 bphillip Removed verbose log message from removeObjects * 01/21/2014 2613 bphillip Removed verbose log message from removeObjects
* 2/19/2014 2769 bphillip Added current time to audit trail events
* *
* *
* </pre> * </pre>
@ -302,7 +303,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
} }
EventBus.publish(new CreateAuditTrailEvent(request.getId(), request, EventBus.publish(new CreateAuditTrailEvent(request.getId(), request,
ActionTypes.delete, objectsToRemove)); ActionTypes.delete, objectsToRemove, TimeUtil
.currentTimeMillis()));
return response; return response;
} }
@ -463,6 +465,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
// gives a close estimate to amount taken on each object // gives a close estimate to amount taken on each object
// individually, this will be millis in most cases, hopefully // individually, this will be millis in most cases, hopefully
long avTimePerRecord = objs.isEmpty() ? 0 : totalTime / objs.size(); long avTimePerRecord = objs.isEmpty() ? 0 : totalTime / objs.size();
long currentTime = TimeUtil.currentTimeMillis();
if (!objsCreated.isEmpty()) { if (!objsCreated.isEmpty()) {
for (RegistryObjectType obj : objsCreated) { for (RegistryObjectType obj : objsCreated) {
EventBus.publish(new InsertRegistryEvent(obj.getId(), obj EventBus.publish(new InsertRegistryEvent(obj.getId(), obj
@ -472,7 +475,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
avTimePerRecord)); avTimePerRecord));
} }
EventBus.publish(new CreateAuditTrailEvent(request.getId(), EventBus.publish(new CreateAuditTrailEvent(request.getId(),
request, ActionTypes.create, objsCreated)); request, ActionTypes.create, objsCreated, currentTime));
} }
if (!objsUpdated.isEmpty()) { if (!objsUpdated.isEmpty()) {
for (RegistryObjectType obj : objsUpdated) { for (RegistryObjectType obj : objsUpdated) {
@ -483,7 +486,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
avTimePerRecord)); avTimePerRecord));
} }
EventBus.publish(new CreateAuditTrailEvent(request.getId(), EventBus.publish(new CreateAuditTrailEvent(request.getId(),
request, ActionTypes.update, objsUpdated)); request, ActionTypes.update, objsUpdated, currentTime));
} }
return response; return response;
@ -738,7 +741,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
} }
if (!objectsToUpdate.isEmpty()) { if (!objectsToUpdate.isEmpty()) {
EventBus.publish(new CreateAuditTrailEvent(request.getId(), EventBus.publish(new CreateAuditTrailEvent(request.getId(),
request, ActionTypes.update, objectsToUpdate)); request, ActionTypes.update, objectsToUpdate, TimeUtil
.currentTimeMillis()));
} }
long totalTime = System.currentTimeMillis() - startTime; long totalTime = System.currentTimeMillis() - startTime;

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.edex.registry.ebxml.services.notification; package com.raytheon.uf.edex.registry.ebxml.services.notification;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -35,6 +36,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
@ -75,6 +77,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* AuditableEvents instead of integer * AuditableEvents instead of integer
* 12/9/2013 2613 bphillip Changed start time boundary of get auditable events to be the last run time of the subscription * 12/9/2013 2613 bphillip Changed start time boundary of get auditable events to be the last run time of the subscription
* 01/21/2014 2613 bphillip Changed start time boundary again and also a few minor cleanup items * 01/21/2014 2613 bphillip Changed start time boundary again and also a few minor cleanup items
* 2/13/2014 2769 bphillip Optimized sendNotifications method
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -117,13 +120,14 @@ public class RegistryNotificationManager {
public List<ObjectRefType> getObjectsOfInterest( public List<ObjectRefType> getObjectsOfInterest(
SubscriptionType subscription) throws MsgRegistryException { SubscriptionType subscription) throws MsgRegistryException {
// Get objects that match selector query // Get objects that match selector query
return queryManager QueryRequest queryRequest = new QueryRequest(
.executeQuery( "Objects of Interest Query for [" + subscription.getId() + "]",
new QueryRequest("Objects of Interest Query for [" subscription.getSelector(), new ResponseOptionType(
+ subscription.getId() + "]", subscription QueryReturnTypes.OBJECT_REF, false));
.getSelector(), new ResponseOptionType( queryRequest.setMaxResults(new BigInteger(System
QueryReturnTypes.OBJECT_REF, false))) .getProperty("ebxml-notification-batch-size")));
.getObjectRefList().getObjectRef(); return queryManager.executeQuery(queryRequest).getObjectRefList()
.getObjectRef();
} }
/** /**
@ -140,6 +144,7 @@ public class RegistryNotificationManager {
* @throws MsgRegistryException * @throws MsgRegistryException
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<AuditableEventType> getEventsOfInterest( public List<AuditableEventType> getEventsOfInterest(
SubscriptionType subscription, String serviceAddress, SubscriptionType subscription, String serviceAddress,
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
@ -164,6 +169,7 @@ public class RegistryNotificationManager {
* @throws EbxmlRegistryException * @throws EbxmlRegistryException
* If errors occur while creating or checking the notification * If errors occur while creating or checking the notification
*/ */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public NotificationType getNotification(SubscriptionType subscription, public NotificationType getNotification(SubscriptionType subscription,
String address, List<ObjectRefType> objectsOfInterest, String address, List<ObjectRefType> objectsOfInterest,
List<AuditableEventType> eventsOfInterest) List<AuditableEventType> eventsOfInterest)
@ -226,53 +232,35 @@ public class RegistryNotificationManager {
* If errors occur while sending the notifications * If errors occur while sending the notifications
* @throws MsgRegistryException * @throws MsgRegistryException
*/ */
protected XMLGregorianCalendar sendNotifications( protected void sendNotifications(
SubscriptionNotificationListeners notificationListeners, SubscriptionNotificationListeners notificationListeners,
XMLGregorianCalendar startTime) throws EbxmlRegistryException, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime)
MsgRegistryException { throws EbxmlRegistryException, MsgRegistryException {
// Object to hold the last timestampe of the latest event in order to
// update the subscription last run time correctly
XMLGregorianCalendar lastTime = null;
final List<NotificationListenerWrapper> listeners = notificationListeners.listeners; final List<NotificationListenerWrapper> listeners = notificationListeners.listeners;
final SubscriptionType subscription = notificationListeners.subscription; final SubscriptionType subscription = notificationListeners.subscription;
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription); List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
for (NotificationListenerWrapper listener : listeners) { for (NotificationListenerWrapper listener : listeners) {
List<AuditableEventType> eventsOfInterest = getEventsOfInterest(
subscription, listener.address, startTime,
subscription.getEndTime(), objectsOfInterest);
if (!eventsOfInterest.isEmpty()) {
lastTime = eventsOfInterest.get(eventsOfInterest.size() - 1)
.getTimestamp();
int subListCount = eventsOfInterest.size()
/ notificationBatchSize;
int lastListSize = eventsOfInterest.size()
% notificationBatchSize;
try {
for (int i = 0; i < subListCount; i++) {
NotificationType notification = getNotification( List<AuditableEventType> eventsOfInterest = getEventsOfInterest(
subscription, subscription, listener.address, startTime, endTime,
listener.address, objectsOfInterest);
objectsOfInterest,
eventsOfInterest.subList(notificationBatchSize if (!eventsOfInterest.isEmpty()) {
* i, notificationBatchSize * i try {
+ notificationBatchSize)); int totalEvents = eventsOfInterest.size();
if (!notification.getEvent().isEmpty()) { int endIndex = 0;
sendNotification(listener, notification, for (int startIndex = 0; startIndex < totalEvents; startIndex += notificationBatchSize) {
listener.address); endIndex = startIndex + notificationBatchSize;
if (endIndex >= totalEvents) {
endIndex = totalEvents;
} }
}
if (lastListSize > 0) {
NotificationType notification = getNotification( NotificationType notification = getNotification(
subscription, subscription, listener.address,
listener.address,
objectsOfInterest, objectsOfInterest,
eventsOfInterest.subList(notificationBatchSize eventsOfInterest.subList(startIndex, endIndex));
* subListCount, notificationBatchSize
* subListCount + lastListSize));
if (!notification.getEvent().isEmpty()) { if (!notification.getEvent().isEmpty()) {
sendNotification(listener, notification, sendNotification(listener, notification,
listener.address); listener.address);
@ -284,7 +272,6 @@ public class RegistryNotificationManager {
} }
} }
return lastTime;
} }
/** /**

View file

@ -20,10 +20,7 @@
package com.raytheon.uf.edex.registry.ebxml.services.notification; package com.raytheon.uf.edex.registry.ebxml.services.notification;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import javax.xml.datatype.Duration; import javax.xml.datatype.Duration;
@ -43,17 +40,12 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.registry.ebxml.dao.DbInit;
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao; import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; 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.IRegistrySubscriptionManager; import com.raytheon.uf.edex.registry.ebxml.services.IRegistrySubscriptionManager;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
@ -83,16 +75,15 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 1/15/2014 2613 bphillip Added Hibernate flush and clear after subscription processing * 1/15/2014 2613 bphillip Added Hibernate flush and clear after subscription processing
* 01/21/2014 2613 bphillip Changed how last run time is updated for replication subscriptions * 01/21/2014 2613 bphillip Changed how last run time is updated for replication subscriptions
* 2/4/2014 2769 bphillip Removed flush and clear call * 2/4/2014 2769 bphillip Removed flush and clear call
* 2/13/2014 2769 bphillip Removed caching of subscriptions
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
@Transactional
@Component @Component
public class RegistrySubscriptionManager implements public class RegistrySubscriptionManager implements
IRegistrySubscriptionManager, ApplicationContextAware, IRegistrySubscriptionManager, ApplicationContextAware {
RegistryInitializedListener {
/** The logger instance */ /** The logger instance */
private static final IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
@ -153,63 +144,12 @@ public class RegistrySubscriptionManager implements
private INotificationListenerFactory notificationListenerFactory; private INotificationListenerFactory notificationListenerFactory;
private final ConcurrentMap<String, SubscriptionNotificationListeners> listeners = new ConcurrentHashMap<String, SubscriptionNotificationListeners>();
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
public RegistrySubscriptionManager() { public RegistrySubscriptionManager() {
} }
@Override
public void executeAfterRegistryInit() throws EbxmlRegistryException {
for (SubscriptionType subscription : subscriptionDao.eagerLoadAll()) {
statusHandler.info("Adding Subscription: " + subscription.getId());
addSubscriptionListener(subscription);
}
}
private void addSubscriptionListener(SubscriptionType subscription)
throws EbxmlRegistryException {
final List<NotificationListenerWrapper> subscriptionListeners = getNotificationListenersForSubscription(subscription);
listeners.put(subscription.getId(),
new SubscriptionNotificationListeners(subscription,
subscriptionListeners));
}
/**
* Adds subscription notification listeners for any subscriptions.
*/
@Subscribe
public void addSubscriptionNotificationListeners(InsertRegistryEvent re) {
final String objectType = re.getObjectType();
if (RegistryObjectTypes.SUBSCRIPTION.equals(objectType)) {
final String id = re.getId();
try {
final SubscriptionType subscription = subscriptionDao
.eagerGetById(id);
addSubscriptionListener(subscription);
} catch (EbxmlRegistryException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
}
/**
* Removes subscription notification listeners for any subscriptions.
*/
@Subscribe
public void removeSubscriptionNotificationListeners(RemoveRegistryEvent re) {
final String objectType = re.getObjectType();
if (RegistryObjectTypes.SUBSCRIPTION.equals(objectType)) {
listeners.remove(re.getId());
}
}
/** /**
* Get the notification listeners for a subscription. * Get the notification listeners for a subscription.
* *
@ -249,29 +189,22 @@ public class RegistrySubscriptionManager implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
@Transactional
public void processSubscriptions() { public void processSubscriptions() {
if (!running.compareAndSet(false, true)) {
if (DbInit.isDbInitialized() && !running.compareAndSet(false, true)) {
return; return;
} }
try { try {
statusHandler.info("Processing registry subscriptions...");
long start = TimeUtil.currentTimeMillis(); long start = TimeUtil.currentTimeMillis();
Collection<SubscriptionNotificationListeners> subs = listeners List<SubscriptionType> subs = subscriptionDao.loadAll();
.values();
for (SubscriptionNotificationListeners subNotificationListener : subs) { for (SubscriptionType subscription : subs) {
if (subscriptionDao
.getById(subNotificationListener.subscription.getId()) == null) {
statusHandler
.info("Registry subscription removed. Cancelling processing of subscription: "
+ subNotificationListener.subscription
.getId());
continue;
}
RegistrySubscriptionManager myself = (RegistrySubscriptionManager) applicationContext RegistrySubscriptionManager myself = (RegistrySubscriptionManager) applicationContext
.getBean("RegistrySubscriptionManager"); .getBean("RegistrySubscriptionManager");
myself.processSubscription(subNotificationListener.subscription myself.processSubscription(subscription.getId());
.getId());
} }
if (!subs.isEmpty()) { if (!subs.isEmpty()) {
@ -373,14 +306,10 @@ public class RegistrySubscriptionManager implements
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void processSubscription(final String subscriptionName) { public void processSubscription(final String subscriptionName) {
try { try {
XMLGregorianCalendar currentTime = EbxmlObjectUtil
.getTimeAsXMLGregorianCalendar(TimeUtil.currentTimeMillis());
SubscriptionType subscription = subscriptionDao SubscriptionType subscription = subscriptionDao
.getById(subscriptionName); .load(subscriptionName);
if (subscription == null) {
statusHandler
.info("Registry subscription removed. Cancelling processing of subscription: "
+ subscriptionName);
return;
}
if (!subscriptionShouldRun(subscription)) { if (!subscriptionShouldRun(subscription)) {
statusHandler statusHandler
.info("Skipping subscription [" .info("Skipping subscription ["
@ -388,21 +317,28 @@ public class RegistrySubscriptionManager implements
+ "]. Required notification frequency interval has not elapsed."); + "]. Required notification frequency interval has not elapsed.");
return; return;
} }
statusHandler.info("Processing subscription [" + subscriptionName
+ "]...");
XMLGregorianCalendar startTime = subscription XMLGregorianCalendar startTime = subscription
.getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME); .getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME);
XMLGregorianCalendar endTime = subscription.getEndTime();
if (startTime == null) { if (startTime == null) {
startTime = subscription.getStartTime(); startTime = subscription.getStartTime();
} }
XMLGregorianCalendar lastEventTime = notificationManager
.sendNotifications(listeners.get(subscriptionName), if (endTime == null) {
startTime); endTime = currentTime;
if (lastEventTime != null) {
updateLastRunTime(subscription, lastEventTime
.toGregorianCalendar().getTimeInMillis());
} }
notificationManager
.sendNotifications(
new SubscriptionNotificationListeners(
subscription,
getNotificationListenersForSubscription(subscription)),
startTime, endTime);
updateLastRunTime(subscription, currentTime.toGregorianCalendar()
.getTimeInMillis());
} catch (Throwable e) { } catch (Throwable e) {
statusHandler.error( statusHandler.error(
"Errors occurred while processing subscription [" "Errors occurred while processing subscription ["

View file

@ -123,13 +123,13 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 10/2013 1682 bphillip Fixed federated query invocation * 10/2013 1682 bphillip Fixed federated query invocation
* 10/23/2013 1538 bphillip Remove extra executeQuery method * 10/23/2013 1538 bphillip Remove extra executeQuery method
* 10/30/2013 1538 bphillip Changed to use non-static soap service client * 10/30/2013 1538 bphillip Changed to use non-static soap service client
* 2/19/2014 2769 bphillip Moved Transactional Annotation, fixed plugin cache usage
* *
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional(propagation = Propagation.MANDATORY)
public class QueryManagerImpl implements QueryManager, ApplicationContextAware { public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
/** The logger */ /** The logger */
@ -223,6 +223,7 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
* The QueryResponse contains a set of objects that match the query. * The QueryResponse contains a set of objects that match the query.
*/ */
@Override @Override
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery(QueryRequest queryRequest) public QueryResponse executeQuery(QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {
String client = EbxmlObjectUtil.getClientHost(wsContext); String client = EbxmlObjectUtil.getClientHost(wsContext);
@ -518,7 +519,7 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
String queryDefinition = query.getQueryDefinition(); String queryDefinition = query.getQueryDefinition();
RegistryQueryPlugin plugin = queryPlugins.get(queryDefinition); RegistryQueryPlugin plugin = queryPlugins.get(queryDefinition);
if (plugin == null) { if (plugin == null) {
QueryDefinitionType queryDef = queryDefinitionDao.getById(query QueryDefinitionType queryDef = queryDefinitionDao.loadById(query
.getQueryDefinition()); .getQueryDefinition());
if (queryDef == null) { if (queryDef == null) {
throw EbxmlExceptionUtil.createQueryExceptionType( throw EbxmlExceptionUtil.createQueryExceptionType(
@ -551,7 +552,6 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
.executeHQLQuery(queryString, queryParameters); .executeHQLQuery(queryString, queryParameters);
queryResponse.addRegistryObjects(results); queryResponse.addRegistryObjects(results);
} else { } else {
queryPlugins.put(queryDefinition, plugin);
checkQueryParameters(queryRequest.getQuery()); checkQueryParameters(queryRequest.getQuery());
QueryResponse response = plugin.executeQuery(queryRequest); QueryResponse response = plugin.executeQuery(queryRequest);
consolidateQueryResponse(queryResponse, response); consolidateQueryResponse(queryResponse, response);

View file

@ -28,6 +28,7 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
@ -43,12 +44,13 @@ import com.raytheon.uf.common.registry.EbxmlNamespaces;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/11/2013 1707 bphillip Initial implementation * 7/11/2013 1707 bphillip Initial implementation
* 2/19/2014 2769 bphillip Added readOnly flag to Transactional annotation
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
@Transactional @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public class QueryManagerImplWrapper implements QueryManager { public class QueryManagerImplWrapper implements QueryManager {
private QueryManagerImpl queryManager; private QueryManagerImpl queryManager;

View file

@ -30,6 +30,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -78,6 +81,7 @@ public class AdhocQuery extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -34,6 +34,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
@ -114,6 +117,7 @@ public class BasicQuery extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -36,6 +36,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -85,6 +88,7 @@ public class ClassificationSchemeSelector extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -33,6 +33,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
@ -108,6 +111,7 @@ public class FindAssociatedObjects extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -32,6 +32,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.dao.AssociationDao; import com.raytheon.uf.edex.registry.ebxml.dao.AssociationDao;
@ -99,6 +102,7 @@ public class FindAssociations extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -32,6 +32,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
@ -73,6 +76,7 @@ public class GarbageCollectorQueryPlugin extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -32,6 +32,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao; import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -93,6 +96,7 @@ public class GetAuditTrailById extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -39,6 +39,9 @@ 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.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
@ -73,7 +76,6 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
public class GetAuditTrailByLid extends RegistryQueryPlugin { public class GetAuditTrailByLid extends RegistryQueryPlugin {
/** Data access object for accessing registry objects */ /** Data access object for accessing registry objects */
@ -85,6 +87,7 @@ public class GetAuditTrailByLid extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -31,6 +31,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -98,6 +101,7 @@ public class GetAuditTrailByTimeInterval extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -36,6 +36,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryPackageType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryPackageType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
@ -158,6 +161,7 @@ public class GetChildrenByParentId extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -30,6 +30,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -69,6 +72,7 @@ public class GetClassificationSchemesById extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -36,6 +36,9 @@ 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.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao; import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
@ -85,6 +88,7 @@ public class GetNotification extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -19,7 +19,9 @@
**/ **/
package com.raytheon.uf.edex.registry.ebxml.services.query.plugins; package com.raytheon.uf.edex.registry.ebxml.services.query.plugins;
import javax.jws.WebMethod;
import javax.jws.WebParam; import javax.jws.WebParam;
import javax.jws.WebResult;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
@ -56,12 +58,14 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.RegistryQueryUtil;
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional(propagation = Propagation.REQUIRED)
public class GetObjectById extends RegistryQueryPlugin { public class GetObjectById extends RegistryQueryPlugin {
private RegistryObjectDao registryObjectDao; private RegistryObjectDao registryObjectDao;
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -30,6 +30,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -64,6 +67,7 @@ public class GetObjectsByLid extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -36,6 +36,9 @@ 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.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.QueryReturnTypes; import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
@ -74,6 +77,7 @@ public class GetReferencedObject extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -30,6 +30,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -76,6 +79,7 @@ public class GetRegistryPackagesByMemberId extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -37,6 +37,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -204,6 +207,7 @@ public class KeywordSearch extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -34,6 +34,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryPackageType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryPackageType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
@ -78,6 +81,7 @@ public class RegistryPackageSelector extends RegistryQueryPlugin {
@Override @Override
@WebMethod(action = EXECUTE_QUERY_ACTION) @WebMethod(action = EXECUTE_QUERY_ACTION)
@WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse")
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
public QueryResponse executeQuery( public QueryResponse executeQuery(
@WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest) @WebParam(name = "QueryRequest", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryRequest") QueryRequest queryRequest)
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -9,13 +9,9 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.registry.ebxml.dao.ClassificationNodeDao; import com.raytheon.uf.edex.registry.ebxml.dao.ClassificationNodeDao;
@Transactional(propagation = Propagation.REQUIRED)
public abstract class RegistryQueryPlugin implements QueryManager { public abstract class RegistryQueryPlugin implements QueryManager {
protected String queryDefinition; protected String queryDefinition;

View file

@ -93,6 +93,8 @@ public class EbxmlObjectUtil {
*/ */
public static final String HOME_SLOT_NAME = "urn:oasis:names:tc:ebxml-regrep:rim:RegistryObject:home"; public static final String HOME_SLOT_NAME = "urn:oasis:names:tc:ebxml-regrep:rim:RegistryObject:home";
public static final String EVENT_SOURCE_SLOT = "EventSource";
/** The name of the slot designated to hold the email notification formatter */ /** The name of the slot designated to hold the email notification formatter */
public static final String EMAIL_NOTIFICATION_FORMATTER_SLOT = "urn:oasis:names:tc:ebxml-regrep:rim:DeliveryInfo:emailNotificationFormatter"; public static final String EMAIL_NOTIFICATION_FORMATTER_SLOT = "urn:oasis:names:tc:ebxml-regrep:rim:DeliveryInfo:emailNotificationFormatter";

View file

@ -49,12 +49,16 @@ public class CreateAuditTrailEvent extends Event {
private List<RegistryObjectType> objectsAffected; private List<RegistryObjectType> objectsAffected;
private long eventTime;
public CreateAuditTrailEvent(String id, RegistryRequestType request, public CreateAuditTrailEvent(String id, RegistryRequestType request,
String actionType, List<RegistryObjectType> objectsAffected) { String actionType, List<RegistryObjectType> objectsAffected,
long eventTime) {
super(id); super(id);
this.request = request; this.request = request;
this.actionType = actionType; this.actionType = actionType;
this.objectsAffected = objectsAffected; this.objectsAffected = objectsAffected;
this.eventTime = eventTime;
} }
public RegistryRequestType getRequest() { public RegistryRequestType getRequest() {
@ -69,4 +73,8 @@ public class CreateAuditTrailEvent extends Event {
return objectsAffected; return objectsAffected;
} }
public long getEventTime() {
return eventTime;
}
} }

View file

@ -62,61 +62,55 @@ Date Ticket# Engineer Description
<table> <table>
<tr> <tr>
<td>My Registry ID:</td> <td>Data Delivery ID:</td>
<td><span id="myRegistryIdSpan">[Unknown]</span></td> <td><span id="dataDeliveryIdSpan">[Unknown]</span></td>
</tr>
<tr>
<td>Site ID:</td>
<td><span id="registrySiteIdSpan">[Unknown]</span></td>
</tr> </tr>
<tr> <tr>
<td>Federated:</td> <td>Federated:</td>
<td><span id="federatedSpan">[Unknown]</span></td> <td><span id="federatedSpan">[Unknown]</span></td>
</tr> </tr>
<tr>
<td>Replicating To:</td>
<td><span id="replicatingToSpan">Retrieving Registry List...</span></td>
</tr>
<tr>
<td>Replicating From:</td>
<td><span id="replicatingFromSpan">Retrieving Registry List...</span></td>
</tr>
</table> </table>
<br><br> <br><br>
<table border ="1"> <table border ="1">
<tr> <tr>
<td>Resubmit Subscriptions To:</td> <td>Synchronize With:</td>
<td><select id="resubmitSubsToRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick='resubmitSubs()'>Resubmit</button></td>
</tr>
<tr>
<td>Synchronize with Registry:</td>
<td><select id="syncWithRegistrySelect"></select></td> <td><select id="syncWithRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="sync()">Sync</button></td> <td style='width:90px'><button type="button" style='width:90px' onclick="sync()">Sync</button></td>
</tr> </tr>
<tr> <tr>
<td>Subscribe To Registry:</td> <td>Subscribe To:</td>
<td><select id="subscribeToRegistrySelect"></select></td> <td><select id="subscribeToRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="subscribe()">Subscribe</button></td> <td style='width:90px'><button type="button" style='width:90px' onclick="subscribe()">Subscribe</button></td>
</tr> </tr>
<tr> <tr>
<td>Unsubscribe From Registry:</td> <td>Unsubscribe From:</td>
<td><select id="unsubscribeFromRegistrySelect"></select></td> <td><select id="unsubscribeFromRegistrySelect"></select></td>
<td style='width:90px'><button type="button" style='width:90px' onclick="unsubscribe()">Unsubscribe</button></td> <td style='width:90px'><button type="button" style='width:90px' onclick="unsubscribe()">Unsubscribe</button></td>
</tr> </tr>
</table> </table>
<br> <br>
<b>My Registry is Subscribed To:</b>
<span id="subscribedToRegistriesSpan">Retrieving Registry List...</span>
<br>
<br>
<b>Registries Subscribing to My Registry:</b>
<span id="subscribedToRegistries">Retrieving Registry List...</span>
<br>
<br>
<b>Federation Members:<b> <b>Federation Members:<b>
<span id="federationMembersSpan"></span> <span id="federationMembersSpan"></span>
<br> <br>
<br> <br>
<b>Object Types Currently Replicated:</b> <b>Object Types Replicated:</b>
<span id="replicatedObjectListSpan">Retrieving Object List...</span> <span id="replicatedObjectListSpan">Retrieving Object List...</span>
<br> <br>
<br> <br>
@ -127,38 +121,45 @@ Date Ticket# Engineer Description
function subscribe(){ function subscribe(){
var registryId = getComboValue("subscribeToRegistrySelect") var registryId = getComboValue("subscribeToRegistrySelect")
callRestService("dataDelivery/status/subscribeToRegistry",registryId); callRestService("dataDelivery/federation/subscribeToRegistry",registryId);
location.reload(false) location.reload(false)
} }
function resubmitSubs(){ function resubmitSubs(){
var registryId = getComboValue("resubmitSubsToRegistrySelect") var registryId = getComboValue("resubmitSubsToRegistrySelect")
callRestService("dataDelivery/status/subscribeToRegistry",registryId); callRestService("dataDelivery/federation/subscribeToRegistry",registryId);
} }
function unsubscribe(){ function unsubscribe(){
var registryId = getComboValue("unsubscribeFromRegistrySelect") var registryId = getComboValue("unsubscribeFromRegistrySelect")
callRestService("dataDelivery/status/unsubscribeFromRegistry",registryId); callRestService("dataDelivery/federation/unsubscribeFromRegistry",registryId);
location.reload(false) location.reload(false)
} }
function sync(){ function sync(){
var registryId = getComboValue("syncWithRegistrySelect") var registryId = getComboValue("syncWithRegistrySelect")
callRestService("dataDelivery/status/syncWithRegistry",registryId); callRestService("dataDelivery/federation/synchronizeWithRegistry",registryId);
} }
function populate(){ function populate(){
var isFederated = callRestService("dataDelivery/status/isFederated") var isFederated = callRestService("dataDelivery/federation/isFederated")
var dataDeliveryId=callRestService("dataDelivery/federation/dataDeliveryId");
var siteId=callRestService("dataDelivery/federation/siteId");
var objectTypes = callRestService("dataDelivery/federation/getObjectTypesReplicated").split(",")
var federationMembers = new Array()
document.getElementById("federatedSpan").innerHTML=isFederated document.getElementById("federatedSpan").innerHTML=isFederated
document.getElementById("dataDeliveryIdSpan").innerHTML=dataDeliveryId
document.getElementById("registrySiteIdSpan").innerHTML=siteId
if(isFederated == "true"){ if(isFederated == "true"){
var myRegistryId=callRestService("dataDelivery/status/getMyRegistryInfo").split("\n")[0].split(",")[0] var replicatingToString = callRestService("dataDelivery/federation/getReplicatingTo")
document.getElementById("myRegistryIdSpan").innerHTML=myRegistryId var replicatingTo = replicatingToString.split(",")
var subscriptionCandidates = new Array(); var replicatingFromString = callRestService("dataDelivery/federation/getReplicatingFrom")
var replicatingFrom = replicatingFromString.split(",")
var registries = callRestService("dataDelivery/federation/getFederationMembers").split("\n")
var memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>" var memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
var registries = callRestService("dataDelivery/status/getFederationMembers").split("\n")
var federationMembers = new Array()
var subscribedTo=new Array()
var subscribedFrom=new Array()
for(var i = 0; i < registries.length-1;i++){ for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",") var tokens = registries[i].split(",")
memberHTML+="<tr>" memberHTML+="<tr>"
@ -170,39 +171,7 @@ Date Ticket# Engineer Description
federationMembers[i]=tokens[0] federationMembers[i]=tokens[0]
} }
memberHTML+="</table>" memberHTML+="</table>"
document.getElementById("federationMembersSpan").innerHTML=memberHTML
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
registries = callRestService("dataDelivery/status/getRegistriesSubscribedTo").split("\n")
for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",")
memberHTML+="<tr>"
memberHTML+="<td>"+tokens[0]+"</td>"
memberHTML+="<td>"+tokens[1]+"</td>"
memberHTML+="<td>"+tokens[2]+"</td>"
memberHTML+="<td>"+tokens[3]+"</td>"
memberHTML+="</tr>"
subscribedTo[i] = tokens[0]
}
memberHTML+="</table>"
document.getElementById("subscribedToRegistriesSpan").innerHTML=memberHTML
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
registries = callRestService("dataDelivery/status/getRegistrySubscribing").split("\n")
for(var i = 0; i < registries.length-1;i++){
var tokens = registries[i].split(",")
memberHTML+="<tr>"
memberHTML+="<td>"+tokens[0]+"</td>"
memberHTML+="<td>"+tokens[1]+"</td>"
memberHTML+="<td>"+tokens[2]+"</td>"
memberHTML+="<td>"+tokens[3]+"</td>"
memberHTML+="</tr>"
subscribedFrom[i]=tokens[0]
}
memberHTML+="</table>"
document.getElementById("subscribedToRegistries").innerHTML=memberHTML
var objectTypes = callRestService("dataDelivery/status/getObjectTypesReplicated").split("\n")
var objectTypeHTML = "<table border='1'><tr><th style='width:30px;'></th><th>Object Type</th></tr>" var objectTypeHTML = "<table border='1'><tr><th style='width:30px;'></th><th>Object Type</th></tr>"
for(var i = 0; i < objectTypes.length-1;i++){ for(var i = 0; i < objectTypes.length-1;i++){
objectTypeHTML+="<tr>" objectTypeHTML+="<tr>"
@ -210,27 +179,28 @@ Date Ticket# Engineer Description
objectTypeHTML+="<td>"+objectTypes[i]+"</td>" objectTypeHTML+="<td>"+objectTypes[i]+"</td>"
objectTypeHTML+="</tr>" objectTypeHTML+="</tr>"
} }
objectTypeHTML+="</table>";
for(var i = 0; i < federationMembers.length;i++){ for(var i = 0; i < federationMembers.length;i++){
var member=federationMembers[i] var member=federationMembers[i]
if(subscribedTo.indexOf(member)== -1 && member!=myRegistryId){ if(replicatingFrom.indexOf(member)== -1 && member!=dataDeliveryId){
addOptionToList("subscribeToRegistrySelect",member,member) addOptionToList("subscribeToRegistrySelect",member,member)
} }
if(member!=myRegistryId){ if(member!=dataDeliveryId){
addOptionToList("syncWithRegistrySelect",member,member) addOptionToList("syncWithRegistrySelect",member,member)
} }
if(subscribedTo.indexOf(member) != -1){ if(replicatingFrom.indexOf(member) != -1){
addOptionToList("unsubscribeFromRegistrySelect",member,member) addOptionToList("unsubscribeFromRegistrySelect",member,member)
addOptionToList("resubmitSubsToRegistrySelect",member,member)
} }
} }
objectTypeHTML+="</table>";
document.getElementById("replicatedObjectListSpan").innerHTML=objectTypeHTML document.getElementById("replicatedObjectListSpan").innerHTML=objectTypeHTML
document.getElementById("replicatingToSpan").innerHTML=replicatingToString
document.getElementById("replicatingFromSpan").innerHTML=replicatingFromString
document.getElementById("federationMembersSpan").innerHTML=memberHTML
} }
} }
</script> </script>
</html> </html>