Issue #2106 Fix transactional semantics
- No longer continuously suspend/resume transactions caused by invoking static methods - Mark registry top-level query/store classes as requiring existing transactions - Invoke registry initialized listeners in their own transaction - Data changes denoted by registry events are now visible when the transaction commits Change-Id: Ic78cbf00afc93aa5fcf1357000ea6c8b5e32cea9 Former-commit-id: 8d1a47446927a3c6646fa0748d7096afb376b952
This commit is contained in:
parent
b007d4a302
commit
69c09e530f
75 changed files with 877 additions and 1369 deletions
|
@ -8,11 +8,15 @@
|
|||
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
@ -20,37 +24,57 @@
|
|||
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="GroupDefinitionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="ProviderHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ProviderHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ProviderHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="DataSetNameHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetNameHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetNameHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="ParameterHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="ParameterLevelHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterLevelHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterLevelHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="DataSetMetaDataHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetMetaDataHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetMetaDataHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="GriddedDataSetMetaDataHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GriddedDataSetMetaDataHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GriddedDataSetMetaDataHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="DataSetHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<!-- The actual registering of the handlers -->
|
||||
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
</bean>
|
||||
-->
|
||||
|
||||
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
|
||||
<constructor-arg ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<!-- These util:constant beans should not be required, they overwrite the ones in *-common.xml files for CAVE since
|
||||
CAVE just gets a ClassNotFoundException on boot...
|
||||
someday the reason should be figured out and these beans removed -->
|
||||
|
|
|
@ -12,7 +12,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
|||
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Jun 21, 2012 736 djohnson Initial creation
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* Aug 15, 2012 0743 djohnson Type-safe result formatters.
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -41,11 +42,11 @@ public class DataLevelTypeDescriptionQuery extends
|
|||
private transient Set<String> alreadyFound;
|
||||
|
||||
@Override
|
||||
public Collection<String> decodeObject(RegistryObjectType registryObjectType)
|
||||
public Collection<String> decodeObject(
|
||||
RegistryObjectType registryObjectType, IRegistryEncoder encoder)
|
||||
throws SerializationException {
|
||||
|
||||
Parameter object = (Parameter) RegistryUtil
|
||||
.decodeObject(registryObjectType);
|
||||
Parameter object = (Parameter) encoder.decodeObject(registryObjectType);
|
||||
|
||||
if (alreadyFound == null) {
|
||||
alreadyFound = new HashSet<String>();
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
|
|||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 21, 2012 736 djohnson Initial creation
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,10 +56,10 @@ public class DataLevelTypeQuery extends
|
|||
|
||||
@Override
|
||||
public Collection<DataLevelType> decodeObject(
|
||||
RegistryObjectType registryObjectType)
|
||||
RegistryObjectType registryObjectType, IRegistryEncoder encoder)
|
||||
throws SerializationException {
|
||||
|
||||
Object object = RegistryUtil.decodeObject(registryObjectType);
|
||||
Object object = encoder.decodeObject(registryObjectType);
|
||||
|
||||
if (object instanceof DataSet) {
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
|
@ -46,6 +47,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,7 +66,8 @@ public class DataSetMetaDataDatesQuery extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ImmutableDate decodeObject(RegistryObjectType registryObjectType)
|
||||
public ImmutableDate decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder)
|
||||
throws SerializationException {
|
||||
Set<SlotType> returnedSlots = registryObjectType.getSlot();
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetName;
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
|
@ -29,6 +30,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Jun 21, 2012 736 djohnson Add thrift serialization annotations.
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* Aug 15, 2012 0743 djohnson Type-safe result formatters.
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +60,8 @@ public class DataSetNameQuery extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public String decodeObject(RegistryObjectType registryObjectType) {
|
||||
public String decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder) {
|
||||
|
||||
String object = null;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -41,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Oct 17, 2012 0726 djohnson Made filter check method public.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,10 +62,11 @@ public class DataSetWithFiltersQuery extends DataSetQuery implements
|
|||
private ReferencedEnvelope envelope;
|
||||
|
||||
@Override
|
||||
public DataSet decodeObject(RegistryObjectType registryObjectType)
|
||||
public DataSet decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder)
|
||||
throws SerializationException {
|
||||
DataSet retVal = null;
|
||||
DataSet object = (DataSet) RegistryUtil
|
||||
DataSet object = (DataSet) encoder
|
||||
.decodeObject(registryObjectType);
|
||||
|
||||
if (satisfiesFilterCriteria(object, levels, envelope)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +24,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 02, 2013 1441 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -34,7 +36,8 @@ public class GroupNameQuery extends GroupDefinitionFilterableQuery<String>
|
|||
implements IResultFormatter<String> {
|
||||
|
||||
@Override
|
||||
public String decodeObject(RegistryObjectType registryObjectType) {
|
||||
public String decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder) {
|
||||
|
||||
Set<SlotType> returnedSlots = registryObjectType.getSlot();
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
||||
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +25,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Jun 21, 2012 736 djohnson Initial creation
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* Aug 15, 2012 0743 djohnson Type-safe result formatters.
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -35,7 +37,8 @@ public class ParameterNameQuery extends ParameterFilterableQuery<String>
|
|||
implements IResultFormatter<String> {
|
||||
|
||||
@Override
|
||||
public String decodeObject(RegistryObjectType registryObjectType) {
|
||||
public String decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder) {
|
||||
|
||||
String object = null;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
|
@ -43,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 24, 2012 0743 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -74,7 +76,8 @@ public class SubscriptionDataSetNameQuery extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String decodeObject(RegistryObjectType registryObjectType)
|
||||
public String decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoderStrategy)
|
||||
throws SerializationException {
|
||||
Set<SlotType> returnedSlots = registryObjectType.getSlot();
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Set;
|
|||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataDatesQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -43,6 +42,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 03, 2012 1241 djohnson Initial creation
|
||||
* Oct 17, 2012 0726 djohnson Move in {@link #getByDataSet}.
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,8 +65,8 @@ public abstract class BaseDataSetMetaDataHandler<T extends DataSetMetaData, QUER
|
|||
query.setDataSetName(dataSetName);
|
||||
query.setProviderName(providerName);
|
||||
|
||||
RegistryQueryResponse<ImmutableDate> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<ImmutableDate> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getDatesForDataSet");
|
||||
|
||||
|
@ -83,8 +83,7 @@ public abstract class BaseDataSetMetaDataHandler<T extends DataSetMetaData, QUER
|
|||
query.setDataSetName(dataSetName);
|
||||
query.setProviderName(providerName);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByDataSet");
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
|
@ -46,6 +45,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2013 1841 djohnson Extracted from PendingSubscriptionHandler and genericized.
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,8 +94,8 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
|
|||
query.setReturnObjects(false);
|
||||
|
||||
// Delete associations
|
||||
RegistryResponse<Object> removalResponse = RegistryManager
|
||||
.removeRegistyObjects(query);
|
||||
RegistryResponse<Object> removalResponse = registryHandler
|
||||
.removeObjects(query);
|
||||
|
||||
checkResponse(removalResponse, "deleteAssociationToSubscription");
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
|
|||
query.setTargetObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<Object> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getBySubscriptionId");
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.raytheon.uf.common.datadelivery.registry.Network;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionDataSetNameQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -48,6 +47,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* Oct 10, 2012 0726 djohnson Add {@link #getActive()}.
|
||||
* Feb 20, 2013 1543 djohnson Add ability to filter on routes.
|
||||
* May 28, 2013 1650 djohnson Add getByNames.
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -68,8 +68,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setName(name);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByName");
|
||||
|
||||
|
@ -85,8 +84,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setNames(names);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByNames");
|
||||
|
||||
|
@ -101,8 +99,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setOwner(owner);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByOwner");
|
||||
|
||||
|
@ -117,8 +114,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setGroupName(group);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByGroupName");
|
||||
|
||||
|
@ -131,8 +127,8 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
@Override
|
||||
public Set<String> getSubscribedToDataSetNames()
|
||||
throws RegistryHandlerException {
|
||||
RegistryQueryResponse<String> response = RegistryManager
|
||||
.getRegistyObjects(new SubscriptionDataSetNameQuery());
|
||||
RegistryQueryResponse<String> response = registryHandler
|
||||
.getObjects(new SubscriptionDataSetNameQuery());
|
||||
|
||||
checkResponse(response, "getSubscribedToDataSetNames");
|
||||
|
||||
|
@ -154,8 +150,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
query.setOfficeId(officeId);
|
||||
}
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByFilters");
|
||||
|
||||
|
@ -170,8 +165,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setActive(true);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getActive");
|
||||
|
||||
|
@ -197,8 +191,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
|
|||
query.setActive(true);
|
||||
query.setRoutes(Arrays.asList(routes));
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getActiveForRoutes");
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetWithFiltersQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.ebxml.UnresolvedReferenceException;
|
||||
|
@ -56,6 +55,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||
* Jun 04, 2013 223 mpduff Added datatype to the filter.
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -211,8 +211,8 @@ public class DataSetHandler extends
|
|||
query.setDataSetName(name);
|
||||
query.setProviderName(providerName);
|
||||
|
||||
RegistryQueryResponse<DataSet> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<DataSet> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByNameAndProvider");
|
||||
|
||||
|
@ -252,8 +252,8 @@ public class DataSetHandler extends
|
|||
query.setEnvelope(envelope);
|
||||
}
|
||||
|
||||
RegistryQueryResponse<DataSet> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<DataSet> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByFilters");
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Set;
|
|||
import com.raytheon.uf.common.datadelivery.registry.DataSetName;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetNameObjectQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetNameQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -40,7 +39,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,8 +50,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
|
||||
public class DataSetNameHandler extends
|
||||
BaseRegistryObjectHandler<DataSetName, DataSetNameObjectQuery>
|
||||
implements
|
||||
IDataSetNameHandler {
|
||||
implements IDataSetNameHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -78,8 +77,8 @@ public class DataSetNameHandler extends
|
|||
DataSetNameQuery query = new DataSetNameQuery();
|
||||
query.setDataSetTypes(dataTypes);
|
||||
|
||||
RegistryQueryResponse<String> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<String> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByDataTypes");
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
|||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.GriddedDataSetMetaDataQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
|
@ -40,6 +39,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 03, 2012 1241 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,8 +80,8 @@ public class GriddedDataSetMetaDataHandler
|
|||
query.setCycle(cycle);
|
||||
query.setDate(new ImmutableDate(date));
|
||||
|
||||
RegistryQueryResponse<GriddedDataSetMetaData> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<GriddedDataSetMetaData> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByDataSetDateAndCycle");
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.GroupNameQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.GroupQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
|
@ -41,6 +40,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
* Jan 02, 2013 1441 djohnson Add deleteByName() and getGroupNames().
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,8 +61,8 @@ public class GroupDefinitionHandler extends
|
|||
GroupQuery gQuery = getQuery();
|
||||
gQuery.setGroupName(groupName);
|
||||
|
||||
RegistryQueryResponse<GroupDefinition> response = RegistryManager
|
||||
.getRegistyObjects(gQuery);
|
||||
RegistryQueryResponse<GroupDefinition> response = registryHandler
|
||||
.getObjects(gQuery);
|
||||
|
||||
checkResponse(response, "getByName");
|
||||
|
||||
|
@ -77,8 +77,8 @@ public class GroupDefinitionHandler extends
|
|||
GroupQuery gQuery = getQuery();
|
||||
gQuery.setGroupName(groupName);
|
||||
|
||||
RegistryResponse<GroupDefinition> response = RegistryManager
|
||||
.removeRegistyObjects(gQuery);
|
||||
RegistryResponse<GroupDefinition> response = registryHandler
|
||||
.removeObjects(gQuery);
|
||||
|
||||
checkResponse(response, "getByName");
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ public class GroupDefinitionHandler extends
|
|||
public List<String> getGroupNames() throws RegistryHandlerException {
|
||||
GroupNameQuery groupNameQuery = new GroupNameQuery();
|
||||
|
||||
RegistryQueryResponse<String> response = RegistryManager
|
||||
.getRegistyObjects(groupNameQuery);
|
||||
RegistryQueryResponse<String> response = registryHandler
|
||||
.getObjects(groupNameQuery);
|
||||
|
||||
checkResponse(response, "getGroupNames");
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.raytheon.uf.common.datadelivery.registry.ParameterLevel;
|
|||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataLevelTypeDescriptionQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.ParameterNameQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.ParameterQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.UnresolvedReferenceException;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
|
@ -47,7 +46,8 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -146,8 +146,8 @@ public class ParameterHandler extends
|
|||
DataLevelTypeDescriptionQuery query = new DataLevelTypeDescriptionQuery();
|
||||
query.setDataTypes(dataTypes);
|
||||
|
||||
RegistryQueryResponse<String> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<String> response = registryHandler
|
||||
.getObjects(query);
|
||||
checkResponse(response, "getDataLevelTypeDescriptions");
|
||||
|
||||
return response.getResults();
|
||||
|
@ -222,8 +222,8 @@ public class ParameterHandler extends
|
|||
ParameterNameQuery query = new ParameterNameQuery();
|
||||
query.setDataTypes(dataTypes);
|
||||
|
||||
RegistryQueryResponse<String> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<String> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getNamesByDataTypes");
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.ProviderQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
@ -35,7 +34,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
* Oct 03, 2012 1241 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,8 +56,8 @@ public class ProviderHandler extends
|
|||
ProviderQuery gQuery = getQuery();
|
||||
gQuery.setProviderName(providerName);
|
||||
|
||||
RegistryQueryResponse<Provider> response = RegistryManager
|
||||
.getRegistyObjects(gQuery);
|
||||
RegistryQueryResponse<Provider> response = registryHandler
|
||||
.getObjects(gQuery);
|
||||
|
||||
checkResponse(response, "getByName");
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
|||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
|
@ -45,6 +44,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 05, 2013 1841 djohnson Extracted and genericized from siteSubscriptionHandler.
|
||||
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,8 +77,8 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
|
|||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
RegistryQueryResponse<Object> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<Object> response = registryHandler
|
||||
.getObjects(query);
|
||||
|
||||
checkResponse(response, "getByPendingSubscriptionId");
|
||||
|
||||
|
@ -130,8 +130,7 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
|
|||
query.setProviderName(providerName);
|
||||
query.setActive(true);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getActiveByDataSetAndProvider");
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# Valid values: JAXB, DYNAMIC_SERIALIZE
|
||||
# Note: If you change the encoding strategy you MUST
|
||||
# delete the ebxml database and recreate it
|
||||
com.raytheon.uf.common.registry.ebxml.encoding.type=JAXB
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
|
||||
/**
|
||||
|
@ -36,6 +37,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Accepts the registry encoder as a method parameter.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -45,6 +47,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
|
||||
public interface IMultipleResultFormatter<T> extends RegistryQuery<T> {
|
||||
|
||||
Collection<T> decodeObject(RegistryObjectType registryObjectType)
|
||||
Collection<T> decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoderStrategy)
|
||||
throws SerializationException;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.raytheon.uf.common.registry;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
|
||||
/**
|
||||
|
@ -17,6 +18,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
* Mar 27, 2012 jspinks Initial creation
|
||||
* Jun 21, 2012 736 djohnson Add throws SerializationException.
|
||||
* Aug 15, 2012 0743 djohnson Type-safe result formatters.
|
||||
* Jun 24, 2013 2106 djohnson Accepts the registry encoder as a method parameter.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -25,6 +27,6 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
*/
|
||||
public interface IResultFormatter<T> extends RegistryQuery<T> {
|
||||
|
||||
T decodeObject(RegistryObjectType registryObjectType)
|
||||
throws SerializationException;
|
||||
T decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoder) throws SerializationException;
|
||||
}
|
||||
|
|
|
@ -1,202 +0,0 @@
|
|||
package com.raytheon.uf.common.registry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.AdhocRegistryQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.IdQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
* Convenience Class for storing and retrieving Objects from the ebXML registry.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 27, 2012 356 jspinks Initial creation
|
||||
* Apr 24, 2012 455 jspinks Modified for storing associations between
|
||||
* RegistryObjects.
|
||||
* Jun 21, 2012 736 djohnson Change to utility class, inject instance with Spring.
|
||||
* Aug 02, 2012 955 djohnson Type-safe registry query/responses.
|
||||
* Aug 20, 2012 0743 djohnson Allow instance to be changed from {@link RegistryManagerTest}.
|
||||
* Sep 14, 2012 1169 djohnson Add use of create only mode.
|
||||
* Nov 15, 2012 1322 djohnson Use package-level constructor to control who can set the handler instance.
|
||||
* Feb 26, 2013 1643 djohnson Remove registry manager debug toggle.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jspinks
|
||||
* @version 1.0
|
||||
*/
|
||||
public final class RegistryManager {
|
||||
|
||||
private static RegistryHandler instance;
|
||||
|
||||
/**
|
||||
* Package-level constructor for utility class, it allows Spring to set the
|
||||
* instance multiple times.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
RegistryManager(RegistryHandler instance) {
|
||||
RegistryManager.instance = instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for getting specific implementation of RegistryHandler.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static RegistryHandler getInstance() {
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException(
|
||||
"Spring should have populated the singleton instance!");
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve registry objects that satisfy the RegistryQuery.
|
||||
*
|
||||
* @param registryQuery
|
||||
* A RegistryQuery to search the registry for objects.
|
||||
*
|
||||
* @return A RegistryQueryResponse containing the status of the request, any
|
||||
* registry objects that satisfied the RegistryQuery and any
|
||||
* Exceptions generated from processing the RegistryQuery.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* when unable to connect to the registry
|
||||
* @see AdhocRegistryQuery
|
||||
* @see IdQuery
|
||||
*/
|
||||
public static <T> RegistryQueryResponse<T> getRegistyObjects(
|
||||
RegistryQuery<T> registryQuery) {
|
||||
return getInstance().getObjects(registryQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove objects from the registry.
|
||||
*
|
||||
* @param registryObjects
|
||||
* A List of Objects that are annotated with @RegistryObject.
|
||||
* These Objects will be searched for in the registry and
|
||||
* removed.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to remove the Objects from
|
||||
* the registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> removeRegistyObjects(
|
||||
List<T> registryObjects) {
|
||||
return removeRegistyObjects(null, registryObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove objects from the registry that satisfy a RegistryQuery.
|
||||
*
|
||||
* @param registryQuery
|
||||
* A RegistryQuery to search the registry for objects. These
|
||||
* Objects will be removed from the registry.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to remove the Objects from
|
||||
* the registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> removeRegistyObjects(
|
||||
RegistryQuery<T> registryQuery) {
|
||||
return getInstance().removeObjects(registryQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove objects from the registry that satisfy a RegistryQuery.
|
||||
*
|
||||
* @param username
|
||||
* the username requesting the removal
|
||||
* @param registryQuery
|
||||
* A RegistryQuery to search the registry for objects. These
|
||||
* Objects will be removed from the registry.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to remove the Objects from
|
||||
* the registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> removeRegistyObjects(String username,
|
||||
RegistryQuery<T> registryQuery) {
|
||||
return getInstance().removeObjects(username, registryQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove objects from the registry.
|
||||
*
|
||||
* @param username
|
||||
* The name of the user making the request.
|
||||
*
|
||||
* @param registryObjects
|
||||
* A List of Objects that are annotated with @RegistryObject.
|
||||
* These Objects will be searched for in the registry and
|
||||
* removed.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to remove the Objects from
|
||||
* the registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> removeRegistyObjects(String username,
|
||||
List<T> registryObjects) {
|
||||
return getInstance().removeObjects(username,
|
||||
registryObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store an Object to the registry.
|
||||
*
|
||||
* @param object
|
||||
* An Object whose Class is annotated with @RegistryObject. This
|
||||
* Object will be stored in the registry.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to store the Object into the
|
||||
* registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> storeRegistryObject(T object) {
|
||||
return getInstance().storeObject(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store an Object to the registry, this method will replace any object
|
||||
* already existing with the same ID.
|
||||
*
|
||||
* @param object
|
||||
* An Object whose Class is annotated with @RegistryObject. This
|
||||
* Object will be stored in the registry.
|
||||
*
|
||||
* @return A RegistryResponse containing the status of the request, and any
|
||||
* Exceptions generated from attempting to store the Object into the
|
||||
* registry.
|
||||
*
|
||||
* @see RegistryObject
|
||||
*
|
||||
*/
|
||||
public static <T> RegistryResponse<T> storeOrReplaceRegistryObject(T object) {
|
||||
return getInstance().storeOrReplaceObject(object);
|
||||
}
|
||||
}
|
|
@ -6,10 +6,6 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An annotation that indicates that an instance of this Class can be stored
|
||||
* in the registry using the RegistryManager Class. Member fields of a Class
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryObjectResolver;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnresolvedReferenceExceptionType;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -49,7 +50,7 @@ import com.raytheon.uf.common.registry.RegistryResponse;
|
|||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -78,13 +79,14 @@ import com.raytheon.uf.common.util.ReflectionException;
|
|||
* 3/27/2013 1802 bphillip Changed visibility of processRequest and fixed catch block to catch the correct Exception type
|
||||
* 4/9/2013 1802 bphillip Modified to use constants in constants package instead of RegistryUtil
|
||||
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
|
||||
* Jun 24, 2013 2106 djohnson Requires a transaction to already be active.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
public class FactoryRegistryHandler implements RegistryHandler {
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -97,24 +99,14 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
static IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FactoryRegistryHandler.class);
|
||||
|
||||
private static void print(Object object) {
|
||||
|
||||
JAXBManager jaxb;
|
||||
try {
|
||||
jaxb = new JAXBManager(object.getClass());
|
||||
System.out.println(jaxb.marshalToXml(object));
|
||||
}
|
||||
|
||||
catch (Throwable t) {
|
||||
}
|
||||
}
|
||||
|
||||
private final int batchSize = 10;
|
||||
|
||||
private LifecycleManagerFactory lifecycleManagerFactory;
|
||||
|
||||
private QueryManagerFactory queryManagerFactory;
|
||||
|
||||
private IRegistryEncoder encoderStrategy;
|
||||
|
||||
/**
|
||||
* Private constructor to disallow instance creation.
|
||||
*/
|
||||
|
@ -181,6 +173,14 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
this.queryManagerFactory = queryManagerFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param encoderStrategy
|
||||
* the encoderStrategy to set
|
||||
*/
|
||||
public void setEncoderStrategy(IRegistryEncoder encoderStrategy) {
|
||||
this.encoderStrategy = encoderStrategy;
|
||||
}
|
||||
|
||||
private List<RegistryObjectType> getAssociations(QueryManager qm,
|
||||
String sourceObjectId, String targetObjectId, String associationType)
|
||||
throws MsgRegistryException {
|
||||
|
@ -324,8 +324,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
+ objs.size() + " items returned");
|
||||
}
|
||||
|
||||
List<T> registryObjects = FactoryRegistryHandler.filterResults(
|
||||
registryQuery, objs);
|
||||
List<T> registryObjects = filterResults(registryQuery, objs);
|
||||
|
||||
timer.stop();
|
||||
long totalElapsedTime = timer.getElapsedTime();
|
||||
|
@ -358,16 +357,15 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
* @return the results
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static <T> List<T> filterResults(RegistryQuery<T> registryQuery,
|
||||
<T> List<T> filterResults(RegistryQuery<T> registryQuery,
|
||||
List<RegistryObjectType> objs) {
|
||||
final List<T> registryObjects = new ArrayList<T>(objs.size());
|
||||
|
||||
if (registryQuery instanceof IResultFormatter) {
|
||||
FactoryRegistryHandler.filterResults(
|
||||
(IResultFormatter<T>) registryQuery, objs, registryObjects);
|
||||
filterResults((IResultFormatter<T>) registryQuery, objs,
|
||||
registryObjects);
|
||||
} else if (registryQuery instanceof IMultipleResultFormatter) {
|
||||
FactoryRegistryHandler.filterResults(
|
||||
(IMultipleResultFormatter<T>) registryQuery, objs,
|
||||
filterResults((IMultipleResultFormatter<T>) registryQuery, objs,
|
||||
registryObjects);
|
||||
}
|
||||
// This handles Association queries that do NOT return @RegistryObject
|
||||
|
@ -381,7 +379,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
} else {
|
||||
for (RegistryObjectType obj : objs) {
|
||||
try {
|
||||
Object o = RegistryUtil.decodeObject(obj);
|
||||
Object o = encoderStrategy.decodeObject(obj);
|
||||
if (o != null) {
|
||||
registryObjects.add(registryQuery.getResultType().cast(
|
||||
o));
|
||||
|
@ -408,11 +406,12 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
* @param results
|
||||
* the collection to add results to
|
||||
*/
|
||||
private static <T> void filterResults(IResultFormatter<T> registryQuery,
|
||||
private <T> void filterResults(IResultFormatter<T> registryQuery,
|
||||
List<RegistryObjectType> objs, Collection<T> results) {
|
||||
for (RegistryObjectType obj : objs) {
|
||||
try {
|
||||
T decodedObject = registryQuery.decodeObject(obj);
|
||||
T decodedObject = registryQuery.decodeObject(obj,
|
||||
encoderStrategy);
|
||||
if (decodedObject != null) {
|
||||
results.add(decodedObject);
|
||||
}
|
||||
|
@ -435,12 +434,12 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
* @param results
|
||||
* the collection to add results to
|
||||
*/
|
||||
private static <T> void filterResults(
|
||||
IMultipleResultFormatter<T> registryQuery,
|
||||
private <T> void filterResults(IMultipleResultFormatter<T> registryQuery,
|
||||
List<RegistryObjectType> objs, Collection<T> results) {
|
||||
for (RegistryObjectType obj : objs) {
|
||||
try {
|
||||
Collection<T> decodedObject = registryQuery.decodeObject(obj);
|
||||
Collection<T> decodedObject = registryQuery.decodeObject(obj,
|
||||
encoderStrategy);
|
||||
if (decodedObject != null) {
|
||||
results.addAll(decodedObject);
|
||||
}
|
||||
|
@ -711,8 +710,8 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
// to be stored for this Object in a list so that appropriate
|
||||
// associations can be created between the RegistryObjects created (the
|
||||
// associations themselves are RegistryObjects).
|
||||
RegistryObjectType registryObject = RegistryUtil
|
||||
.newRegistryObject(object);
|
||||
RegistryObjectType registryObject = RegistryUtil.newRegistryObject(
|
||||
object, encoderStrategy);
|
||||
|
||||
// Need to find all associations for the Objects referenced by the 'new'
|
||||
// RegistryObject so that the appropriate 'parent' associations can also
|
||||
|
|
|
@ -24,7 +24,6 @@ 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.StringValueType;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.registry.OperationStatus;
|
||||
import com.raytheon.uf.common.registry.RegistryException;
|
||||
|
@ -76,6 +75,7 @@ import com.raytheon.uf.common.util.ReflectionUtil;
|
|||
* Oct 05, 2012 1195 djohnson Don't persist slots for null values.
|
||||
* 4/9/2013 1802 bphillip Pulled constants out into existing constants package that was moved into common
|
||||
* Jun 03, 2013 2038 djohnson Allow setting the same encoder strategy.
|
||||
* Jun 24, 2013 2106 djohnson Remove encoder strategy from instance variables.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -133,12 +133,6 @@ public final class RegistryUtil {
|
|||
SLOT_CONVERSION = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the encoding strategy to use.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static IRegistryEncoder ENCODER_STRATEGY;
|
||||
|
||||
/**
|
||||
* Creates a slot of the given type.
|
||||
*
|
||||
|
@ -162,61 +156,6 @@ public final class RegistryUtil {
|
|||
return converter.getSlots(slotName, slotValue).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the encoder strategy to use. This method should only be called once
|
||||
* via Spring initialization.
|
||||
*
|
||||
* @param encoder
|
||||
* the encoder strategy
|
||||
* @throws IllegalStateException
|
||||
* if an attempt is made to change the encoding strategy once it
|
||||
* has been set
|
||||
*/
|
||||
public static void setEncoderStrategy(IRegistryEncoder encoder) {
|
||||
if (ENCODER_STRATEGY != null && !ENCODER_STRATEGY.equals(encoder)) {
|
||||
throw new IllegalStateException(
|
||||
"The encoder strategy is already set, you cannot change it on a running system!");
|
||||
}
|
||||
ENCODER_STRATEGY = encoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for decoding the stored Object in the registry.
|
||||
*
|
||||
* @param registryObjectType
|
||||
* The response from the registry that contains all of the slot
|
||||
* values associated with the registry object. The Thrift
|
||||
* serialized, base64 encoded Object is stored in a slot called
|
||||
* "content". Find it, decode it, unmarshal it back into and
|
||||
* Object and return it.
|
||||
*
|
||||
* @return The Object stored in the registry response.
|
||||
*
|
||||
* @throws SerializationException
|
||||
* If the stored Object cannot be unmarshalled.
|
||||
*/
|
||||
public static Object decodeObject(RegistryObjectType registryObjectType)
|
||||
throws SerializationException {
|
||||
return ENCODER_STRATEGY.decodeObject(registryObjectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for encoding an Object into a slot for storage in the
|
||||
* registry.
|
||||
*
|
||||
* @param objectToEncode
|
||||
* Encodes an object for storage in the registry
|
||||
*
|
||||
* @return The Object stored in the registry response.
|
||||
*
|
||||
* @throws SerializationException
|
||||
* If the stored Object cannot be unmarshalled.
|
||||
*/
|
||||
public static SlotType encodeObject(Object objectToEncode)
|
||||
throws SerializationException {
|
||||
return ENCODER_STRATEGY.encodeObject(objectToEncode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique id for a registry object.
|
||||
*
|
||||
|
@ -366,7 +305,8 @@ public final class RegistryUtil {
|
|||
* @throws ReflectionException
|
||||
* on error reflectively accessing the object
|
||||
*/
|
||||
public static RegistryObjectType newRegistryObject(Object object)
|
||||
public static RegistryObjectType newRegistryObject(Object object,
|
||||
IRegistryEncoder encoderStrategy)
|
||||
throws SerializationException, ReflectionException {
|
||||
|
||||
RegistryObjectType registryObject = new RegistryObjectType();
|
||||
|
@ -412,7 +352,7 @@ public final class RegistryUtil {
|
|||
if (ro.storeContent()) {
|
||||
// Store the Base64 encoded Object in a slot called
|
||||
// "content"
|
||||
slots.add(RegistryUtil.encodeObject(object));
|
||||
slots.add(encoderStrategy.encodeObject(object));
|
||||
}
|
||||
// Set the ObjectType so it can be distinguished from other
|
||||
// Objects
|
||||
|
@ -490,7 +430,8 @@ public final class RegistryUtil {
|
|||
}
|
||||
|
||||
public static Map<String, RegistryObjectType> getAssociatedObjects(
|
||||
Object object) throws ReflectionException, SerializationException {
|
||||
Object object, IRegistryEncoder encoderStrategy)
|
||||
throws ReflectionException, SerializationException {
|
||||
|
||||
Map<String, RegistryObjectType> ids = new HashMap<String, RegistryObjectType>();
|
||||
|
||||
|
@ -516,7 +457,8 @@ public final class RegistryUtil {
|
|||
List<Object> objects = mapper.getRegistryObjects(v);
|
||||
|
||||
for (Object obj : objects) {
|
||||
RegistryObjectType o = newRegistryObject(obj);
|
||||
RegistryObjectType o = newRegistryObject(obj,
|
||||
encoderStrategy);
|
||||
ids.put(o.getId(), o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.OperationStatus;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryHandler;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
|
@ -54,6 +54,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Sep 21, 2012 1187 djohnson Add bulk delete operations.
|
||||
* Oct 05, 2012 1195 djohnson Remove executeQuery method, add getById.
|
||||
* 3/18/2013 1802 bphillip Implemented transaction boundaries
|
||||
* Jun 24, 2013 2106 djohnson Composes the registryHandler.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -63,6 +64,8 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQuery<T>>
|
||||
implements IRegistryObjectHandler<T> {
|
||||
|
||||
protected RegistryHandler registryHandler;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -71,8 +74,7 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
IdQuery<T> query = new IdQuery<T>(getRegistryObjectClass());
|
||||
query.setID(id);
|
||||
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getById");
|
||||
|
||||
|
@ -85,8 +87,7 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
@Override
|
||||
public List<T> getAll() throws RegistryHandlerException {
|
||||
QUERY query = getQuery();
|
||||
RegistryQueryResponse<T> response = RegistryManager
|
||||
.getRegistyObjects(query);
|
||||
RegistryQueryResponse<T> response = registryHandler.getObjects(query);
|
||||
|
||||
checkResponse(response, "getAll");
|
||||
|
||||
|
@ -98,7 +99,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
*/
|
||||
@Override
|
||||
public void store(T obj) throws RegistryHandlerException {
|
||||
RegistryResponse<T> response = RegistryManager.storeRegistryObject(obj);
|
||||
RegistryResponse<T> response = registryHandler
|
||||
.storeObject(obj);
|
||||
|
||||
checkResponse(response, obj, "store");
|
||||
}
|
||||
|
@ -108,8 +110,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
*/
|
||||
@Override
|
||||
public void update(T obj) throws RegistryHandlerException {
|
||||
RegistryResponse<T> response = RegistryManager
|
||||
.storeOrReplaceRegistryObject(obj);
|
||||
RegistryResponse<?> response = registryHandler
|
||||
.storeOrReplaceObject(obj);
|
||||
|
||||
checkResponse(response, obj, "update");
|
||||
}
|
||||
|
@ -180,8 +182,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
IdQuery<T> registryQuery = new IdQuery<T>(getRegistryObjectClass());
|
||||
registryQuery.setIDs(registryIds);
|
||||
|
||||
RegistryResponse<T> response = RegistryManager.removeRegistyObjects(
|
||||
username, registryQuery);
|
||||
RegistryResponse<T> response = registryHandler.removeObjects(username,
|
||||
registryQuery);
|
||||
|
||||
checkResponse(response, "deleteByIds");
|
||||
|
||||
|
@ -240,6 +242,14 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param registryHandler
|
||||
* the registryHandler to set
|
||||
*/
|
||||
public void setRegistryHandler(RegistryHandler registryHandler) {
|
||||
this.registryHandler = registryHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link RegistryObject} annotated class object this handler
|
||||
* works with.
|
||||
|
|
|
@ -32,6 +32,8 @@ import java.util.regex.Pattern;
|
|||
import org.hibernate.cfg.AnnotationConfiguration;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -49,6 +51,7 @@ import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 30, 2013 1960 djohnson Extracted and generalized from the registry DbInit.
|
||||
* May 29, 2013 1650 djohnson Allow initDb() to be overridden, though should rarely be done.
|
||||
* Jun 24, 2013 2106 djohnson initDb() always starts a fresh, shiny, new transaction.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -116,6 +119,7 @@ public abstract class DbInit {
|
|||
* @throws Exception
|
||||
* on error initializing the database
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void initDb() throws Exception {
|
||||
/*
|
||||
* Create a new configuration object which holds all the classes that
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:SbnSimulator?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true" />
|
||||
uri="log:SbnSimulator" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
<!-- No retrievals for in-memory -->
|
||||
</bean>
|
||||
|
||||
<bean id="registryManagerInstanceInitializer" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
||||
<bean id="registerDataDeliveryHandlers" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
factory-method="getBandwidthDbInit" />
|
||||
|
||||
<bean id="bandwidthManagerInitializer" factory-bean="bandwidthContextFactory"
|
||||
factory-method="getBandwidthInitializer" depends-on="registryManagerInstanceInitializer">
|
||||
</bean>
|
||||
factory-method="getBandwidthInitializer"/>
|
||||
|
||||
<bean id="bandwidthMapConfigFile" factory-bean="bandwidthContextFactory"
|
||||
factory-method="getBandwidthMapConfigFile" />
|
||||
|
|
|
@ -199,20 +199,7 @@ public abstract class BandwidthManager extends
|
|||
|
||||
if (DataDeliveryRegistryObjectTypes.DATASETMETADATA.equals(objectType)) {
|
||||
|
||||
DataSetMetaData dsmd = null;
|
||||
int attempts = 0;
|
||||
do {
|
||||
attempts++;
|
||||
dsmd = getDataSetMetaData(id);
|
||||
if (dsmd == null) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
} while (dsmd == null && attempts < 20);
|
||||
DataSetMetaData dsmd = getDataSetMetaData(id);
|
||||
|
||||
if (dsmd != null) {
|
||||
// Repost the Object to the BandwidthEventBus to free
|
||||
|
@ -233,7 +220,7 @@ public abstract class BandwidthManager extends
|
|||
BandwidthEventBus.publish(dsmd);
|
||||
} else {
|
||||
statusHandler.error("No DataSetMetaData found for id [" + id
|
||||
+ "] after " + attempts + " attempts");
|
||||
+ "]");
|
||||
}
|
||||
|
||||
} else if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
|
||||
<bean id="crawlerCommunicationStrategy" class="com.raytheon.uf.edex.datadelivery.harvester.crawler.FileCommunicationStrategy" />
|
||||
|
||||
<bean id="MetaDataProcessor" class="com.raytheon.uf.edex.datadelivery.harvester.CrawlMetaDataHandler" depends-on="registryInit,registerDataDeliveryHandlers,registryManagerInstanceInitializer">
|
||||
<bean id="MetaDataProcessor" class="com.raytheon.uf.edex.datadelivery.harvester.CrawlMetaDataHandler" depends-on="registryInit">
|
||||
<constructor-arg ref="crawlerCommunicationStrategy" />
|
||||
<constructor-arg ref="ProviderHandler" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="MetaData-context"
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.raytheon.uf.common.datadelivery.harvester.HarvesterConfig;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Collection;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Utils;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler;
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
|
@ -54,15 +53,16 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 20, 2011 218 dhladky Initial creation
|
||||
* Jul 17, 2012 749 djohnson Break out the use of files to communicate as a strategy.
|
||||
* Jul 24, 2012 955 djohnson Use the Abstract Factory Pattern to simplify service specific access.
|
||||
* Feb 20, 2011 0218 dhladky Initial creation
|
||||
* Jul 17, 2012 0749 djohnson Break out the use of files to communicate as a strategy.
|
||||
* Jul 24, 2012 0955 djohnson Use the Abstract Factory Pattern to simplify service specific access.
|
||||
* Aug 30, 2012 1123 djohnson Rename CrawlerEvent to HarvesterEvent.
|
||||
* Sept 12,2012 1038 dhladky Reconfigured config.
|
||||
* Oct 03, 2012 1241 djohnson Use registry handler.
|
||||
* Nov 09, 2012 1263 dhladky Changed to Site Level
|
||||
* Feb 05, 2013 1580 mpduff EventBus refactor.
|
||||
* 3/18/2013 1802 bphillip Modified to insert provider object after database is initialized
|
||||
* Jun 24, 2013 2106 djohnson Accepts ProviderHandler as a constructor argument.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -140,8 +140,13 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
|
|||
|
||||
private Map<String, HarvesterConfig> hconfigs = null;
|
||||
|
||||
public CrawlMetaDataHandler(CommunicationStrategy communicationStrategy) {
|
||||
private final IProviderHandler providerHandler;
|
||||
|
||||
public CrawlMetaDataHandler(CommunicationStrategy communicationStrategy,
|
||||
IProviderHandler providerHandler) {
|
||||
this.communicationStrategy = communicationStrategy;
|
||||
this.providerHandler = providerHandler;
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
|
@ -151,15 +156,13 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeAfterRegistryInit() {
|
||||
|
||||
statusHandler
|
||||
.info("<<<<<<<<<<<<<<<<<<<<< INITIALIZING CRAWL META DATA HANDLER >>>>>>>>>>>>>>>>>>>>>>");
|
||||
hconfigs = readCrawlConfigs();
|
||||
|
||||
final IProviderHandler handler = DataDeliveryHandlers
|
||||
.getProviderHandler();
|
||||
|
||||
if (hconfigs != null) {
|
||||
for (Entry<String, HarvesterConfig> entry : hconfigs.entrySet()) {
|
||||
try {
|
||||
|
@ -168,7 +171,7 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
|
|||
statusHandler.info("Inserting/Updating Provider: "
|
||||
+ provider.getName() + ": "
|
||||
+ provider.getServiceType());
|
||||
handler.update(provider);
|
||||
providerHandler.update(provider);
|
||||
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error inserting/updating Provider! ",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
|
@ -10,11 +9,15 @@
|
|||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.SharedSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
@ -22,36 +25,62 @@
|
|||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSiteSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSharedSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="GroupDefinitionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GroupDefinitionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="ProviderHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ProviderHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ProviderHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="DataSetNameHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetNameHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetNameHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="ParameterHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="ParameterLevelHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterLevelHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.ParameterLevelHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="DataSetMetaDataHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetMetaDataHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetMetaDataHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="GriddedDataSetMetaDataHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GriddedDataSetMetaDataHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.GriddedDataSetMetaDataHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="DataSetHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetHandler" />
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
|
||||
</beans>
|
|
@ -7,8 +7,4 @@
|
|||
<bean id="registryHandler"
|
||||
class="com.raytheon.uf.common.registry.ebxml.ThriftRegistryHandler" />
|
||||
|
||||
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
|
||||
<constructor-arg ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -53,6 +53,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* May 08, 2013 2000 djohnson Shortcut out if no subscriptions are returned for the dataset.
|
||||
* May 20, 2013 2000 djohnson Shortcut out if no subscription handler is available.
|
||||
* Jun 20, 2013 1802 djohnson Check several times for the dataset for now.
|
||||
* Jun 25, 2013 2106 djohnson Remove checking several times for the dataset now that transactions propagate correctly.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -223,24 +224,8 @@ public class SubscriptionIntegrityVerifier {
|
|||
final IDataSetHandler dataSetHandler = DataDeliveryHandlers
|
||||
.getDataSetHandler();
|
||||
|
||||
DataSet dataSet = null;
|
||||
int attempts = 0;
|
||||
do {
|
||||
attempts++;
|
||||
dataSet = dataSetHandler.getById(event.getId());
|
||||
if (dataSet == null) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
} while (dataSet == null && attempts < 20);
|
||||
|
||||
if (dataSet != null) {
|
||||
DataSet dataSet = dataSetHandler.getById(event.getId());
|
||||
dataSetUpdated(dataSet);
|
||||
}
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler
|
||||
.handle(Priority.ERROR,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:dataDeliveryRetrieval?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true" />
|
||||
uri="log:dataDeliveryRetrieval" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
|
|
@ -31,17 +31,20 @@
|
|||
|
||||
<bean id="gribCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="grib-camel"/>
|
||||
<constructor-arg ref="grib-camel" />
|
||||
</bean>
|
||||
|
||||
<bean id="gribLayerCollector" class="com.raytheon.uf.edex.plugin.grib.ogc.GribLayerCollector" depends-on="registryManagerInstanceInitializer, registerDataDeliveryHandlers, registerRequestRegistryRouter">
|
||||
<bean id="gribLayerCollector"
|
||||
class="com.raytheon.uf.edex.plugin.grib.ogc.GribLayerCollector"
|
||||
depends-on="registerDataDeliveryHandlers, registerRequestRegistryRouter">
|
||||
<constructor-arg ref="gribLayerTransformer" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="grib-camel" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
<camelContext id="grib-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
<endpoint id="gribFileEndpoint" uri="file:${edex.home}/data/sbn/grib?noop=true&idempotent=false" />
|
||||
<endpoint id="gribFileEndpoint"
|
||||
uri="file:${edex.home}/data/sbn/grib?noop=true&idempotent=false" />
|
||||
<route id="gribFileConsumerRoute">
|
||||
<from ref="gribFileEndpoint" />
|
||||
<bean ref="fileToString" />
|
||||
|
@ -53,7 +56,8 @@
|
|||
|
||||
<!-- Begin Grib Routes -->
|
||||
<route id="gribIngestRoute">
|
||||
<from uri="ingest-grib:queue:Ingest.Grib?concurrentConsumers=4&destinationResolver=#qpidDurableResolver" />
|
||||
<from
|
||||
uri="ingest-grib:queue:Ingest.Grib?concurrentConsumers=4&destinationResolver=#qpidDurableResolver" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>grib</constant>
|
||||
</setHeader>
|
||||
|
@ -67,13 +71,14 @@
|
|||
<bean ref="index" method="index" />
|
||||
<bean ref="processUtil" method="log" />
|
||||
<multicast parallelProcessing="false">
|
||||
<bean ref="gribLayerCollector" method="add"/>
|
||||
<to uri="directvm:gribIngestAlert"/>
|
||||
<bean ref="gribLayerCollector" method="add" />
|
||||
<to uri="directvm:gribIngestAlert" />
|
||||
</multicast>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:grib?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
<to
|
||||
uri="log:grib" />
|
||||
</doCatch>
|
||||
<doFinally>
|
||||
<bean ref="largeFileLockRelease" />
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="registryManagerInstanceInitializer" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
||||
<bean id="registerDataDeliveryHandlers" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
@ -30,37 +26,43 @@
|
|||
<property name="taskExecutor" ref="madisThreadPool" />
|
||||
</bean>
|
||||
|
||||
<bean id="madisPointData" class="com.raytheon.uf.edex.plugin.madis.MadisPointDataTransform" depends-on="registerMadisPlugin"/>
|
||||
<bean id="madisPointData"
|
||||
class="com.raytheon.uf.edex.plugin.madis.MadisPointDataTransform"
|
||||
depends-on="registerMadisPlugin" />
|
||||
|
||||
<bean id="madisDistRegistry" factory-bean="distributionSrv"
|
||||
factory-method="register">
|
||||
<constructor-arg value="madis" />
|
||||
<constructor-arg value="jms-dist:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
|
||||
<constructor-arg
|
||||
value="jms-dist:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
|
||||
</bean>
|
||||
|
||||
<bean id="madisCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register"
|
||||
depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="madis-camel"/>
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="madis-camel" />
|
||||
</bean>
|
||||
|
||||
<bean id="madisLayerCollector" class="com.raytheon.uf.edex.plugin.madis.ogc.MadisLayerCollector" depends-on="registryManagerInstanceInitializer, registerDataDeliveryHandlers, registerRequestRegistryRouter, registerMadisPlugin" >
|
||||
<bean id="madisLayerCollector"
|
||||
class="com.raytheon.uf.edex.plugin.madis.ogc.MadisLayerCollector"
|
||||
depends-on="registerDataDeliveryHandlers, registerRequestRegistryRouter, registerMadisPlugin">
|
||||
<constructor-arg ref="madisLayerTransformer" />
|
||||
</bean>
|
||||
|
||||
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator" depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
|
||||
<constructor-arg value="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" />
|
||||
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator"
|
||||
depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
|
||||
<constructor-arg
|
||||
value="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" />
|
||||
<!-- time in hours for orphan purging -->
|
||||
<constructor-arg value="1" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="madis-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<!-- This first file drop route is used mainly for testing -->
|
||||
<endpoint id="madisFileEndpoint" uri="file:${edex.home}/data/sbn/madis?noop=true&idempotent=false" />
|
||||
<endpoint id="madisFileEndpoint"
|
||||
uri="file:${edex.home}/data/sbn/madis?noop=true&idempotent=false" />
|
||||
<route id="madisFileConsumerRoute">
|
||||
<from ref="madisFileEndpoint" />
|
||||
<bean ref="fileToString" />
|
||||
|
@ -72,7 +74,8 @@
|
|||
|
||||
<!-- Separates MADIS files into manageable chunks -->
|
||||
<route id="madisSeperatorRoute">
|
||||
<from uri="jms-generic:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
|
||||
<from
|
||||
uri="jms-generic:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>madis</constant>
|
||||
</setHeader>
|
||||
|
@ -83,29 +86,32 @@
|
|||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:madis?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
<to
|
||||
uri="log:madis" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- Begin MADIS production route -->
|
||||
<route id="madisIngestRoute">
|
||||
<from uri="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" />
|
||||
<from
|
||||
uri="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>madis</constant>
|
||||
</setHeader>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="madisDecoder" method="decode" />
|
||||
<bean ref="madisLayerCollector" method="geoFilter"/>
|
||||
<bean ref="madisLayerCollector" method="geoFilter" />
|
||||
<bean ref="madisPointData" method="toPointData" />
|
||||
<bean ref="madisLayerCollector" method="add"/>
|
||||
<bean ref="madisLayerCollector" method="add" />
|
||||
<!-- we don't need to alert on DPA, just save -->
|
||||
<to uri="direct-vm:persistIndex" />
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:madis?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
<to
|
||||
uri="log:madis" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
@ -117,7 +123,8 @@
|
|||
</route>
|
||||
|
||||
<route id="madisOrphanPurgeRoute">
|
||||
<!-- purge madis orphan files based on hour in separator constructor arg -->
|
||||
<!-- purge madis orphan files based on hour in separator constructor
|
||||
arg -->
|
||||
<from uri="quartz://madis/orphan?cron=0+0+*+*+*+?" />
|
||||
<bean ref="madisSeparator" method="fileCleaner" />
|
||||
</route>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<constructor-arg ref="obs-camel"/>
|
||||
</bean>
|
||||
|
||||
<bean id="metarLayerCollector" class="com.raytheon.uf.edex.plugin.obs.ogc.metar.MetarLayerCollector" depends-on="registryManagerInstanceInitializer, registerDataDeliveryHandlers, registerRequestRegistryRouter, registerObsPlugin" >
|
||||
<bean id="metarLayerCollector" class="com.raytheon.uf.edex.plugin.obs.ogc.metar.MetarLayerCollector" depends-on="registerDataDeliveryHandlers, registerRequestRegistryRouter, registerObsPlugin" >
|
||||
<constructor-arg ref="metarLayerTransformer" />
|
||||
</bean>
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:metar?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
<to uri="log:metar"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
|
|
@ -2,20 +2,35 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="edexRegistryManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager">
|
||||
<property name="xacmlPep" ref="XACMLPolicyEnforcementPoint" />
|
||||
<bean id="edexRegistryManagerFactory"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManagerFactory">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
<property name="lifecycleManager" ref="lcmServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryHandler"
|
||||
class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
|
||||
<property name="lcmFactory" ref="edexRegistryManager" />
|
||||
<property name="queryFactory" ref="edexRegistryManager" />
|
||||
<property name="lcmFactory" ref="edexRegistryManagerFactory" />
|
||||
<property name="queryFactory" ref="edexRegistryManagerFactory" />
|
||||
<property name="encoderStrategy" ref="registryEncoder" />
|
||||
</bean>
|
||||
|
||||
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
|
||||
<constructor-arg ref="registryHandler" />
|
||||
<bean id="edexRegistryManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager">
|
||||
<property name="xacmlPep" ref="XACMLPolicyEnforcementPoint" />
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryEncoderType"
|
||||
class="com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders$Type"
|
||||
factory-method="valueOf">
|
||||
<constructor-arg value="JAXB" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryEncoder"
|
||||
class="com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders"
|
||||
factory-method="ofType">
|
||||
<constructor-arg ref="registryEncoderType" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
<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">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util
|
||||
http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
<bean id="queryTypeManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryTypeManager" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||
<property name="staticMethod"
|
||||
value="com.raytheon.uf.edex.registry.ebxml.services.query.QueryTypeManager.addQueryTypes" />
|
||||
<property name="arguments">
|
||||
<list>
|
||||
<bean factory-bean="queryTypeManager" factory-method="addQueryTypes">
|
||||
<constructor-arg>
|
||||
<util:list>
|
||||
<ref bean="basicQuery" />
|
||||
<ref bean="adhocQuery" />
|
||||
<ref bean="classificationSchemeSelector" />
|
||||
|
@ -23,7 +21,7 @@
|
|||
<ref bean="getAuditTrailById" />
|
||||
<ref bean="getAuditTrailByLid" />
|
||||
<ref bean="getAuditTrailByTimeInterval" />
|
||||
<ref bean="getNotification"/>
|
||||
<ref bean="getNotification" />
|
||||
<ref bean="getChildrenByParentId" />
|
||||
<ref bean="getClassificationSchemesById" />
|
||||
<ref bean="getObjectById" />
|
||||
|
@ -31,8 +29,8 @@
|
|||
<ref bean="getRegistryPackagesByMemberId" />
|
||||
<ref bean="keywordSearch" />
|
||||
<ref bean="registryPackageSelector" />
|
||||
</list>
|
||||
</property>
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="basicQuery"
|
||||
|
@ -95,7 +93,7 @@
|
|||
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetNotification">
|
||||
<property name="subscriptionManager" ref="RegistrySubscriptionManager" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="subscriptionDao" ref="subscriptionTypeDao"/>
|
||||
<property name="subscriptionDao" ref="subscriptionTypeDao" />
|
||||
</bean>
|
||||
<bean id="getChildrenByParentId"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetChildrenByParentId">
|
||||
|
|
|
@ -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">
|
||||
|
||||
<bean id="registryEncoderType"
|
||||
class="com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders$Type"
|
||||
factory-method="valueOf">
|
||||
<constructor-arg value="${com.raytheon.uf.common.registry.ebxml.encoding.type}" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryEncoder" class="com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders"
|
||||
factory-method="ofType">
|
||||
<constructor-arg ref="registryEncoderType" />
|
||||
</bean>
|
||||
|
||||
<bean name="registryUtilInitializer"
|
||||
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||
<property name="staticMethod"
|
||||
value="com.raytheon.uf.common.registry.ebxml.RegistryUtil.setEncoderStrategy" />
|
||||
<property name="arguments">
|
||||
<list>
|
||||
<ref bean="registryEncoder" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
|
@ -6,7 +6,6 @@
|
|||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="dao" ref="registryObjectDao" />
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="txTemplate" ref="metadataTxTemplate"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ebxmlDbValidationStrategy"
|
||||
|
|
|
@ -45,12 +45,13 @@ import org.apache.commons.beanutils.PropertyUtils;
|
|||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.AnnotationConfiguration;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
|
@ -83,14 +84,15 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
|
|||
* Apr 30, 2013 1960 djohnson Extend the generalized DbInit.
|
||||
* 5/21/2013 2022 bphillip Using TransactionTemplate for database initialization
|
||||
* May 29, 2013 1650 djohnson Reference LifecycleManager as interface type.
|
||||
* Jun 24, 2013 2106 djohnson Invoke registry initialized listeners in their own transaction so
|
||||
* they can't fail the ebxml schema creation/population.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Transactional
|
||||
public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
||||
ApplicationListener<ContextRefreshedEvent> {
|
||||
ApplicationListener<ContextRefreshedEvent>, ApplicationContextAware {
|
||||
|
||||
@VisibleForTesting
|
||||
static volatile boolean INITIALIZED = false;
|
||||
|
@ -108,8 +110,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
/** Hibernate session factory */
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
/** Transaction template */
|
||||
private TransactionTemplate txTemplate;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* Creates a new instance of DbInit. This constructor should only be called
|
||||
|
@ -319,45 +320,40 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
if (!INITIALIZED) {
|
||||
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||
@Override
|
||||
protected void doInTransactionWithoutResult(
|
||||
TransactionStatus status) {
|
||||
// Must reference this bean through the proxy to get proper
|
||||
// transactional semantics, which requires going through the
|
||||
// application context
|
||||
final DbInit myself = applicationContext.getBean(DbInit.class);
|
||||
try {
|
||||
initDb();
|
||||
myself.initDb();
|
||||
} catch (Exception e) {
|
||||
statusHandler.fatal(
|
||||
"Error initializing EBXML database!", e);
|
||||
statusHandler.fatal("Error initializing EBXML database!", e);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
myself.postInitDb();
|
||||
|
||||
INITIALIZED = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void postInitDb() {
|
||||
statusHandler.info("Executing post initialization actions");
|
||||
|
||||
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||
@Override
|
||||
protected void doInTransactionWithoutResult(
|
||||
TransactionStatus status) {
|
||||
try {
|
||||
Map<String, RegistryInitializedListener> beans = EDEXUtil
|
||||
.getSpringContext().getBeansOfType(
|
||||
RegistryInitializedListener.class);
|
||||
for (RegistryInitializedListener listener : beans
|
||||
.values()) {
|
||||
for (RegistryInitializedListener listener : beans.values()) {
|
||||
listener.executeAfterRegistryInit();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(
|
||||
"Error initializing EBXML database!", t);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
INITIALIZED = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -384,7 +380,12 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
|
|||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
public void setTxTemplate(TransactionTemplate txTemplate) {
|
||||
this.txTemplate = txTemplate;
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext)
|
||||
throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
|
@ -102,6 +103,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 4/9/2013 1802 bphillip Changed how auditable events are handled
|
||||
* Apr 18, 2013 1693 djohnson Changes to conform to Ebxml 4.0 SubmitObjects protocol.
|
||||
* Apr 24, 2013 1910 djohnson Use validation framework to check references.
|
||||
* Jun 24, 2013 2106 djohnson Requires a transaction to already be open.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -109,7 +111,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
@Transactional
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
public class LifecycleManagerImpl implements LifecycleManager {
|
||||
|
||||
/** The logger */
|
||||
|
|
|
@ -51,6 +51,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
|
@ -100,13 +101,14 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Jan 18, 2012 184 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
|
||||
* Jun 24, 2013 2106 djohnson Transaction must already be open.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
@Transactional
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
public class QueryManagerImpl implements QueryManager {
|
||||
|
||||
/** The logger */
|
||||
|
@ -138,7 +140,7 @@ public class QueryManagerImpl implements QueryManager {
|
|||
* Executor service used to submit queries to federation members in parallel
|
||||
* during the processing of a federated query
|
||||
*/
|
||||
private ExecutorService queryExecutor;
|
||||
private final ExecutorService queryExecutor;
|
||||
|
||||
/**
|
||||
* ObjectRef - This option specifies that the QueryResponse MUST contain a
|
||||
|
@ -502,10 +504,10 @@ public class QueryManagerImpl implements QueryManager {
|
|||
private class RemoteRegistryQuery implements Callable<QueryResponse> {
|
||||
|
||||
/** The registry to query */
|
||||
private RegistryType registryToQuery;
|
||||
private final RegistryType registryToQuery;
|
||||
|
||||
/** The request to submit to the remote registry */
|
||||
private QueryRequest queryRequest;
|
||||
private final QueryRequest queryRequest;
|
||||
|
||||
/**
|
||||
* Creates a new RemoteRegistryQuery.
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.IRegistryQuery;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 18, 2012 184 bphillip Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Remove static use.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -43,7 +44,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.IRegistryQuery;
|
|||
public class QueryTypeManager {
|
||||
|
||||
/** The query map */
|
||||
private static Map<String, IRegistryQuery> queryTypeMap = new HashMap<String, IRegistryQuery>();
|
||||
private final Map<String, IRegistryQuery> queryTypeMap = new HashMap<String, IRegistryQuery>();
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
|
@ -63,9 +64,10 @@ public class QueryTypeManager {
|
|||
return queryTypeMap.get(queryDefinition);
|
||||
}
|
||||
|
||||
public static void addQueryTypes(IRegistryQuery... queries) {
|
||||
public Object addQueryTypes(IRegistryQuery... queries) {
|
||||
for (IRegistryQuery query : queries) {
|
||||
queryTypeMap.put(query.getQueryDefinition(), query);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ErrorSeverity;
|
||||
|
@ -56,13 +57,13 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 2/21/2012 #184 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
|
||||
* 4/9/2013 1802 bphillip Refactor of registry query handling
|
||||
* Jun 24, 2013 2106 djohnson Requires a transaction to be open, will not create one.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
@Transactional
|
||||
public abstract class AbstractEbxmlQuery implements IRegistryQuery {
|
||||
|
||||
protected static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -82,6 +83,8 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
|
|||
|
||||
protected RegistryObjectDao registryObjectDao;
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
public void executeQuery(QueryRequest queryRequest,
|
||||
QueryResponse queryResponse, String client)
|
||||
throws EbxmlRegistryException {
|
||||
|
|
|
@ -29,9 +29,6 @@ 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.SlotType;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
||||
|
@ -50,11 +47,11 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.CanonicalEbxmlQu
|
|||
* Filter etc.
|
||||
* <p>
|
||||
* <b>Parameter Summary:</b> <br>
|
||||
* · <b><i>queryExpression</i></b> -- Value is a query expression string in the
|
||||
* <b><i>queryExpression</i></b> -- Value is a query expression string in the
|
||||
* language specified by the
|
||||
* <p>
|
||||
* · <b><i>queryLanguage</i></b> -- Value is the id of a ClassificationNode
|
||||
* within the canonical QueryLanguageScheme ClassificationScheme.
|
||||
* <b><i>queryLanguage</i></b> -- Value is the id of a ClassificationNode within
|
||||
* the canonical QueryLanguageScheme ClassificationScheme.
|
||||
*
|
||||
* queryLanguage parameter
|
||||
* <p>
|
||||
|
@ -68,14 +65,13 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.CanonicalEbxmlQu
|
|||
* Jan 18, 2012 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
|
||||
* 4/9/2013 1802 bphillip Changed abstract method signature, modified return processing, and changed static variables
|
||||
* Jun 24, 2013 2106 djohnson Requires a transaction to be open, will not create one.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdhocQuery extends CanonicalEbxmlQuery {
|
||||
|
||||
/** The list of valid parameters for this query */
|
||||
|
|
|
@ -30,8 +30,6 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
@ -54,13 +52,13 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Jan 18, 2012 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
|
||||
* 4/9/2013 1802 bphillip Changed abstract method signature, modified return processing, and changed static variables
|
||||
* Jun 24, 2013 2106 djohnson Requires a transaction to be open, will not create one.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
@Transactional
|
||||
public class GetNotification extends CanonicalEbxmlQuery {
|
||||
|
||||
/** The list of valid parameters for this query */
|
||||
|
|
|
@ -2,26 +2,23 @@ package com.raytheon.uf.edex.registry.ebxml.util;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.auth.exception.AuthorizationException;
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.registry.IRegistryRequest;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryHandler;
|
||||
import com.raytheon.uf.common.registry.RegistryQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.LifecycleManagerFactory;
|
||||
import com.raytheon.uf.common.registry.ebxml.QueryManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
|
||||
import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyEnforcementPoint;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +40,7 @@ import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyEnforcementPoint;
|
|||
* Sep 14, 2012 1169 djohnson Add use of create only mode.
|
||||
* Sep 27, 2012 1187 djohnson Simplify the session management for a registry interaction.
|
||||
* 3/18/2013 bphillip Modified to use proper transaction management and spring injection of objects
|
||||
* Jun 24, 2013 2106 djohnson Separate factory functionality into its own class, use registryHandler, start transaction if not already open.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,8 +48,7 @@ import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyEnforcementPoint;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class EDEXRegistryManager extends
|
||||
AbstractPrivilegedRequestHandler<IRegistryRequest<?>> implements
|
||||
LifecycleManagerFactory, QueryManagerFactory {
|
||||
AbstractPrivilegedRequestHandler<IRegistryRequest<?>> {
|
||||
|
||||
@VisibleForTesting
|
||||
static IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -60,38 +57,9 @@ public class EDEXRegistryManager extends
|
|||
@VisibleForTesting
|
||||
static final String CAN_ONLY_STORE_SINGLE_OBJECT = "Only one object can be stored at a time, ignoring all but the first item in the list!";
|
||||
|
||||
private static final String LIFECYCLEMANAGER_BEAN = "lcmServiceImpl";
|
||||
|
||||
private XACMLPolicyEnforcementPoint xacmlPep;
|
||||
|
||||
private QueryManager queryManager;
|
||||
|
||||
/**
|
||||
* Get an implementation of LifeCycleManager that uses the internal
|
||||
* components defined by the registry itself.
|
||||
*
|
||||
* @return A local implementation of LifeCycleManager.
|
||||
*
|
||||
* @see LifecycleManagerFactory
|
||||
*/
|
||||
@Override
|
||||
public LifecycleManager getLifeCycleManager() {
|
||||
return (LifecycleManager) EDEXUtil
|
||||
.getESBComponent(LIFECYCLEMANAGER_BEAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an implementation of QueryManager that uses the internal components
|
||||
* defined by the registry itself.
|
||||
*
|
||||
* @return An implementation of QueryManager.
|
||||
*
|
||||
* @see QueryManagerFactory
|
||||
*/
|
||||
@Override
|
||||
public QueryManager getQueryManager() {
|
||||
return queryManager;
|
||||
}
|
||||
private RegistryHandler registryHandler;
|
||||
|
||||
/**
|
||||
* Handle the IRegistryRequests made to this Class from Thrift clients.
|
||||
|
@ -112,6 +80,7 @@ public class EDEXRegistryManager extends
|
|||
* @see ServerErrorResponse
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Object handleRequest(IRegistryRequest<?> request) throws Exception {
|
||||
RegistryResponse<?> response = null;
|
||||
RegistryQuery<?> query = request.getQuery();
|
||||
|
@ -120,31 +89,30 @@ public class EDEXRegistryManager extends
|
|||
|
||||
switch (request.getAction()) {
|
||||
case QUERY:
|
||||
response = RegistryManager.getRegistyObjects(query);
|
||||
response = registryHandler.getObjects(query);
|
||||
break;
|
||||
case REMOVE:
|
||||
if (query == null) {
|
||||
response = RegistryManager.removeRegistyObjects(username,
|
||||
response = registryHandler.removeObjects(username,
|
||||
objects);
|
||||
} else if (username == null) {
|
||||
response = RegistryManager.removeRegistyObjects(query);
|
||||
response = registryHandler.removeObjects(query);
|
||||
} else {
|
||||
response = RegistryManager
|
||||
.removeRegistyObjects(username, query);
|
||||
response = registryHandler.removeObjects(username, query);
|
||||
}
|
||||
break;
|
||||
case STORE_OR_REPLACE:
|
||||
if (objects.size() > 1) {
|
||||
statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
}
|
||||
response = RegistryManager.storeOrReplaceRegistryObject(objects
|
||||
response = registryHandler.storeOrReplaceObject(objects
|
||||
.get(0));
|
||||
break;
|
||||
case STORE:
|
||||
if (objects.size() > 1) {
|
||||
statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
}
|
||||
response = RegistryManager.storeRegistryObject(objects.get(0));
|
||||
response = registryHandler.storeObject(objects.get(0));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -152,6 +120,7 @@ public class EDEXRegistryManager extends
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AuthorizationResponse authorized(IUser user,
|
||||
IRegistryRequest<?> request) throws AuthorizationException {
|
||||
return xacmlPep.handleRegistryRequest(user, request);
|
||||
|
@ -161,8 +130,7 @@ public class EDEXRegistryManager extends
|
|||
this.xacmlPep = xacmlPep;
|
||||
}
|
||||
|
||||
public void setQueryManager(QueryManager queryManager) {
|
||||
this.queryManager = queryManager;
|
||||
public void setRegistryHandler(RegistryHandler registryHandler) {
|
||||
this.registryHandler = registryHandler;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.util;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
|
||||
import com.raytheon.uf.common.registry.ebxml.LifecycleManagerFactory;
|
||||
import com.raytheon.uf.common.registry.ebxml.QueryManagerFactory;
|
||||
|
||||
/**
|
||||
* Contains the implementations of {@link LifecycleManager} and
|
||||
* {@link QueryManager}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 21, 2013 2106 djohnson Extracted from EdexRegistryManager.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EDEXRegistryManagerFactory implements LifecycleManagerFactory,
|
||||
QueryManagerFactory {
|
||||
|
||||
private LifecycleManager lifecycleManager;
|
||||
|
||||
private QueryManager queryManager;
|
||||
|
||||
/**
|
||||
* Get an implementation of QueryManager that uses the internal components
|
||||
* defined by the registry itself.
|
||||
*
|
||||
* @return An implementation of QueryManager.
|
||||
*
|
||||
* @see QueryManagerFactory
|
||||
*/
|
||||
@Override
|
||||
public QueryManager getQueryManager() {
|
||||
return queryManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an implementation of LifeCycleManager that uses the internal
|
||||
* components defined by the registry itself.
|
||||
*
|
||||
* @return A local implementation of LifeCycleManager.
|
||||
*
|
||||
* @see LifecycleManagerFactory
|
||||
*/
|
||||
@Override
|
||||
public LifecycleManager getLifeCycleManager() {
|
||||
return lifecycleManager;
|
||||
}
|
||||
|
||||
public void setLifecycleManager(LifecycleManager lifecycleManager) {
|
||||
this.lifecycleManager = lifecycleManager;
|
||||
}
|
||||
|
||||
public void setQueryManager(QueryManager queryManager) {
|
||||
this.queryManager = queryManager;
|
||||
}
|
||||
|
||||
}
|
|
@ -30,9 +30,10 @@
|
|||
<target name="classpath-setup-developer" depends="env-setup" unless="jenkins.build">
|
||||
<path id="test.compile.classpath">
|
||||
<dirset dir="${AWIPS2_BASELINE}" includes="**/bin" />
|
||||
<fileset dir="${AWIPS2_BASELINE}/cots" includes="**/*.jar" excludes="**/ant-*.jar" />
|
||||
<fileset dir="${AWIPS2_BASELINE}/cots/org.junit" includes="**/*.jar" />
|
||||
<fileset dir="${AWIPS2_BASELINE}/cots/org.springframework" includes="**/*.jar" />
|
||||
<fileset dir="${AWIPS2_BASELINE}/cots/org.slf4j" includes="**/*.jar" />
|
||||
<fileset dir="${AWIPS2_BASELINE}/cots" includes="**/*.jar" excludes="**/ant-*.jar" />
|
||||
<fileset dir="${PROJECTS.DIR}/cots" includes="**/*.jar" />
|
||||
<dirset dir="${PROJECTS.DIR}" includes="**/bin" />
|
||||
<fileset dir="${basedir}/lib" includes="**/*.jar" />
|
||||
|
@ -59,6 +60,7 @@
|
|||
<fileset dir="${UNZIP.DIR}" includes="**/*.jar" excludes="**/ant-*.jar" />
|
||||
<fileset dir="${PROJECTS.DIR}/org.junit" includes="**/*.jar" />
|
||||
<fileset dir="${PROJECTS.DIR}/org.springframework" includes="**/*.jar" />
|
||||
<fileset dir="${PROJECTS.DIR}/org.slf4j" includes="**/*.jar" />
|
||||
<fileset dir="${basedir}/lib" includes="**/*.jar" />
|
||||
</path>
|
||||
|
||||
|
|
|
@ -1,112 +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.service.services;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
|
||||
import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
||||
import com.raytheon.uf.common.util.DeployTestProperties;
|
||||
import com.raytheon.uf.edex.ebxml.registry.RegistryManagerDeployTest;
|
||||
|
||||
/**
|
||||
* Test SubscriptionDeleteHandler.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 27, 2012 1187 djohnson Initial creation
|
||||
* Oct 17, 2012 0726 djohnson Use {@link RegistryManagerDeployTest#setDeployInstance()}.
|
||||
* Nov 15, 2012 1286 djohnson Use RequestRouter.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscriptionDeleteHandlerDeployTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void staticSetUp() {
|
||||
RegistryObjectHandlersUtil.init();
|
||||
RegistryManagerDeployTest.setDeployInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletingSubscriptionDeletesPendingAlso() throws Exception {
|
||||
|
||||
Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
PendingSubscription pending = subscription.pending(subscription
|
||||
.getOwner());
|
||||
|
||||
ISubscriptionHandler subHandler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
IPendingSubscriptionHandler pendingHandler = DataDeliveryHandlers
|
||||
.getPendingSubscriptionHandler();
|
||||
try {
|
||||
subHandler.store(subscription);
|
||||
pendingHandler.store(pending);
|
||||
|
||||
assertNotNull(
|
||||
"The pending subscription should have been retrievable!",
|
||||
pendingHandler.getBySubscription(subscription));
|
||||
|
||||
SubscriptionDeleteRequest request = new SubscriptionDeleteRequest(
|
||||
Arrays.asList(RegistryUtil
|
||||
.getRegistryObjectKey(subscription)),
|
||||
ISubscriptionHandler.class, DeployTestProperties
|
||||
.getInstance()
|
||||
.getUserId());
|
||||
|
||||
RequestRouter.route(request,
|
||||
DataDeliveryConstants.DATA_DELIVERY_SERVER);
|
||||
|
||||
assertNull(
|
||||
"The pending subscription should have been deleted when deleting the subscription!",
|
||||
pendingHandler.getBySubscription(subscription));
|
||||
} finally {
|
||||
try {
|
||||
subHandler.delete(subscription);
|
||||
} finally {
|
||||
pendingHandler.delete(pending);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,128 +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.ebxml.registry;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.auth.RequestConstants;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderFixture;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
||||
import com.raytheon.uf.common.registry.OperationStatus;
|
||||
import com.raytheon.uf.common.registry.RegistryConstants;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryManagerTest;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.ebxml.ThriftRegistryHandler;
|
||||
import com.raytheon.uf.common.serialization.comm.RequestRouterTest;
|
||||
import com.raytheon.uf.common.util.DeployTestProperties;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
import com.raytheon.uf.edex.auth.RemoteServerRequestRouter;
|
||||
|
||||
/**
|
||||
* Deploy test for {@link RegistryManager}. Deploy tests must execute against a
|
||||
* running EDEX instance.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 13, 2012 1169 djohnson Initial creation
|
||||
* Oct 17, 2012 0726 djohnson Add {@link #setDeployInstance()}.
|
||||
* Nov 15, 2012 1286 djohnson Use RequestRouter.
|
||||
* Dec 06, 2012 1397 djohnson Also set the request router.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class RegistryManagerDeployTest {
|
||||
|
||||
private static final Provider provider = ProviderFixture.INSTANCE.get();
|
||||
|
||||
/**
|
||||
* Sets the deploy test thrift registry handler instance.
|
||||
*/
|
||||
public static void setDeployInstance() {
|
||||
// this allows the configuration wiring to be checked for validity
|
||||
// first, otherwise any exceptions would be hidden in registry response
|
||||
// objects
|
||||
DeployTestProperties.getInstance();
|
||||
final ThriftRegistryHandler handler = new ThriftRegistryHandler();
|
||||
RegistryManagerTest.setInstance(handler);
|
||||
try {
|
||||
RequestRouterTest.clearRegistry();
|
||||
final RemoteServerRequestRouter requestRouter = new RemoteServerRequestRouter(
|
||||
DeployTestProperties.getInstance().getRequestServer());
|
||||
final RemoteServerRequestRouter dataDeliveryRouter = new RemoteServerRequestRouter(DeployTestProperties
|
||||
.getInstance().getDataDeliveryServer());
|
||||
RequestRouterTest.register(
|
||||
DataDeliveryConstants.DATA_DELIVERY_SERVER, dataDeliveryRouter);
|
||||
RequestRouterTest.register(
|
||||
RegistryConstants.EBXML_REGISTRY_SERVICE, dataDeliveryRouter);
|
||||
RequestRouterTest.register(RequestConstants.REQUEST_SERVER,
|
||||
requestRouter);
|
||||
} catch (RegistryException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void staticSetUp() {
|
||||
setDeployInstance();
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanUp() {
|
||||
RegistryManager.removeRegistyObjects(Arrays.asList(provider));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnableToStoreAlreadyStoredRegistryObject() {
|
||||
RegistryResponse<Provider> response = RegistryManager
|
||||
.storeRegistryObject(provider);
|
||||
assertEquals("First store should have succeeded!",
|
||||
OperationStatus.SUCCESS, response.getStatus());
|
||||
response = RegistryManager.storeRegistryObject(provider);
|
||||
assertEquals("Second store should have failed!",
|
||||
OperationStatus.FAILED, response.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbleToStoreAlreadyStoredRegistryObjectWithStoreOrReplace() {
|
||||
RegistryResponse<Provider> response = RegistryManager
|
||||
.storeRegistryObject(provider);
|
||||
assertEquals("First store should have succeeded!",
|
||||
OperationStatus.SUCCESS, response.getStatus());
|
||||
response = RegistryManager.storeOrReplaceRegistryObject(provider);
|
||||
assertEquals("Second store should have succeeded!",
|
||||
OperationStatus.SUCCESS, response.getStatus());
|
||||
}
|
||||
}
|
|
@ -89,7 +89,6 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
SpringFiles.DATADELIVERY_HANDLERS_IMPL_XML, SpringFiles.EBXML_XML,
|
||||
SpringFiles.EBXML_IMPL_XML, SpringFiles.EBXML_QUERYTYPES_XML,
|
||||
SpringFiles.EBXML_REGISTRY_DAO_XML,
|
||||
SpringFiles.EBXML_REGISTRY_ENCODER_XML,
|
||||
SpringFiles.EBXML_WEBSERVICES_XML, SpringFiles.EBXML_XACML_XML,
|
||||
SpringFiles.EBXML_VALIDATOR_PLUGINS_XML,
|
||||
SpringFiles.EBXML_SUBSCRIPTION_XML, SpringFiles.EVENTBUS_COMMON_XML,
|
||||
|
|
|
@ -45,6 +45,7 @@ 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.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -53,6 +54,7 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.raytheon.uf.common.event.EventBusTest;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
|
||||
import com.raytheon.uf.common.registry.constants.Namespaces;
|
||||
|
@ -60,6 +62,7 @@ import com.raytheon.uf.common.registry.constants.NotificationOptionTypes;
|
|||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.util.SpringFiles;
|
||||
import com.raytheon.uf.edex.event.NonTransactionalSynchronousEventBusHandler;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.notification.MockNotificationListenerFactory;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotificationManager;
|
||||
|
||||
|
@ -73,6 +76,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotific
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 16, 2013 1672 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson Set explicitly non-transactional event bus handler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,6 +98,12 @@ public class RegistryNotificationManagerTest extends AbstractRegistryTest {
|
|||
@Autowired
|
||||
private PluginSubscribedListener pluginSubscribedListener;
|
||||
|
||||
@BeforeClass
|
||||
public static void classSetUp() {
|
||||
EventBusTest
|
||||
.useExplicitEventBusHandler(new NonTransactionalSynchronousEventBusHandler());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webServiceDestinationIsNotifiedOnSubscribedObjectInsert()
|
||||
throws MsgRegistryException {
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
<constructor-arg ref="bandwidthManager" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryManagerInstanceInitializer" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
||||
<bean id="registerDataDeliveryHandlers" class="java.lang.String">
|
||||
<!-- required for depends-on -->
|
||||
</bean>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="dao" ref="registryObjectDao" />
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="txTemplate" ref="metadataTxTemplate"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ebxmlDbValidationStrategy"
|
||||
|
|
|
@ -30,6 +30,8 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
|||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type;
|
||||
import com.raytheon.uf.common.registry.ebxml.slots.DateSlotConverter;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
|
@ -45,6 +47,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson IResultFormatter implementations now require an encoder passed to them.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,7 +68,8 @@ public class DataSetMetaDataDatesQueryTest {
|
|||
registryObject.setSlot(new HashSet<SlotType>(slots));
|
||||
|
||||
DataSetMetaDataDatesQuery query = new DataSetMetaDataDatesQuery();
|
||||
ImmutableDate result = query.decodeObject(registryObject);
|
||||
ImmutableDate result = query.decodeObject(registryObject,
|
||||
RegistryEncoders.ofType(Type.JAXB));
|
||||
|
||||
assertEquals(
|
||||
"The result from the query should have matched the initial date!",
|
||||
|
|
|
@ -36,12 +36,11 @@ import org.junit.Test;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService;
|
||||
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
|
||||
import com.raytheon.uf.common.registry.RegistryManagerTest;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
|
||||
import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionServiceHandler;
|
||||
|
@ -58,6 +57,7 @@ import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionService
|
|||
* Jan 18, 2013 1441 djohnson Initial creation
|
||||
* Feb 26, 2013 1643 djohnson Change exception type thrown.
|
||||
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Jun 24, 2013 2106 djohnson RegistryManager is gone.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -89,7 +89,6 @@ public class GroupDefinitionServiceTest {
|
|||
@Before
|
||||
public void setUp() throws RegistryHandlerException {
|
||||
RegistryObjectHandlersUtil.initMemory();
|
||||
RegistryManagerTest.setMockInstance();
|
||||
|
||||
subscriptionHandler = DataDeliveryHandlers.getSubscriptionHandler();
|
||||
groupHandler = DataDeliveryHandlers.getGroupDefinitionHandler();
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.registry;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyList;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
* Allows setting a specific {@link RegistryHandler} instance for test purposes.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 16, 2012 0743 djohnson Initial creation
|
||||
* Oct 17, 2012 0726 djohnson Remove MockRegistryHandler.
|
||||
* Nov 15, 2012 1286 djohnson Set handler instance via package-level constructor.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@Ignore
|
||||
public class RegistryManagerTest {
|
||||
|
||||
/**
|
||||
* Sets the {@link RegistryManager#instance} to be a mock instance.
|
||||
*
|
||||
* @return the mock {@link RegistryHandler}.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static RegistryHandler setMockInstance() {
|
||||
RegistryHandler mock = mock(RegistryHandler.class);
|
||||
RegistryManagerTest.setInstance(mock);
|
||||
RegistryQueryResponse response = mock(RegistryQueryResponse.class);
|
||||
when(response.getStatus()).thenReturn(OperationStatus.SUCCESS);
|
||||
// Handles the responses for deletes, stores, and updates...
|
||||
// TODO: Handle retrieving objects?
|
||||
when(mock.removeObjects(any(RegistryQuery.class))).thenReturn(response);
|
||||
when(mock.removeObjects(anyString(), anyList())).thenReturn(response);
|
||||
when(mock.removeObjects(anyString(), any(RegistryQuery.class)))
|
||||
.thenReturn(response);
|
||||
when(mock.storeObject(any())).thenReturn(response);
|
||||
when(mock.storeOrReplaceObject(any())).thenReturn(response);
|
||||
when(mock.removeObjects(anyString(), any(RegistryQuery.class)))
|
||||
.thenReturn(response);
|
||||
|
||||
return mock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting of the RegistyHandler instance on RegistryManager. Only
|
||||
* allowed from tests. This is useful if you want to use a mocking library
|
||||
* version of the handler, rather than an actual object.
|
||||
*
|
||||
* @param handler
|
||||
* the handler to use
|
||||
*/
|
||||
public static void setInstance(RegistryHandler handler) {
|
||||
new RegistryManager(handler);
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.common.comm.CommunicationException;
|
|||
import com.raytheon.uf.common.registry.OperationStatus;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
|
@ -64,6 +65,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* Jul 12, 2012 740 djohnson Initial creation
|
||||
* Aug 15, 2012 0743 djohnson Type-safe result formatters.
|
||||
* Sep 07, 2012 1102 djohnson Setup the registry encoder.
|
||||
* Jun 24, 2013 2106 djohnson FactoryRegistryHandler now takes the encoder.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -78,10 +80,14 @@ public class FactoryRegistryHandlerTest {
|
|||
private static final CommunicationException COMMUNICATION_EXCEPTION = new CommunicationException(
|
||||
RegistryErrorMessage.DATABASE_ERROR_MESSAGE);
|
||||
|
||||
private static final IRegistryEncoder encoderStrategy = RegistryEncoders
|
||||
.ofType(Type.DYNAMIC_SERIALIZE);
|
||||
|
||||
private static final FactoryRegistryHandler registryHandler = new FactoryRegistryHandler();
|
||||
|
||||
@BeforeClass
|
||||
public static void classSetup() {
|
||||
RegistryUtilTest.setEncoderStrategy(RegistryEncoders
|
||||
.ofType(Type.DYNAMIC_SERIALIZE));
|
||||
public static void classSetUp() {
|
||||
registryHandler.setEncoderStrategy(encoderStrategy);
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -97,8 +103,8 @@ public class FactoryRegistryHandlerTest {
|
|||
throw WEB_SERVICE_EXCEPTION;
|
||||
}
|
||||
};
|
||||
RegistryResponse<Object> response = new FactoryRegistryHandler()
|
||||
.processRequest(callable, new RegistryResponse<Object>());
|
||||
RegistryResponse<Object> response = registryHandler.processRequest(
|
||||
callable, new RegistryResponse<Object>());
|
||||
assertEquals(OperationStatus.FAILED, response.getStatus());
|
||||
}
|
||||
|
||||
|
@ -110,8 +116,8 @@ public class FactoryRegistryHandlerTest {
|
|||
throw WEB_SERVICE_EXCEPTION;
|
||||
}
|
||||
};
|
||||
RegistryResponse<Object> response = new FactoryRegistryHandler()
|
||||
.processRequest(callable, new RegistryResponse<Object>());
|
||||
RegistryResponse<Object> response = registryHandler.processRequest(
|
||||
callable, new RegistryResponse<Object>());
|
||||
assertEquals(RegistryErrorMessage.UNABLE_TO_CONNECT_TO_REGISTRY,
|
||||
response.getErrors().iterator().next().getMessage());
|
||||
}
|
||||
|
@ -124,8 +130,8 @@ public class FactoryRegistryHandlerTest {
|
|||
throw COMMUNICATION_EXCEPTION;
|
||||
}
|
||||
};
|
||||
RegistryResponse<Object> response = new FactoryRegistryHandler()
|
||||
.processRequest(callable, new RegistryResponse<Object>());
|
||||
RegistryResponse<Object> response = registryHandler.processRequest(
|
||||
callable, new RegistryResponse<Object>());
|
||||
assertEquals(OperationStatus.FAILED, response.getStatus());
|
||||
}
|
||||
|
||||
|
@ -137,8 +143,8 @@ public class FactoryRegistryHandlerTest {
|
|||
throw COMMUNICATION_EXCEPTION;
|
||||
}
|
||||
};
|
||||
RegistryResponse<Object> response = new FactoryRegistryHandler()
|
||||
.processRequest(callable, new RegistryResponse<Object>());
|
||||
RegistryResponse<Object> response = registryHandler.processRequest(
|
||||
callable, new RegistryResponse<Object>());
|
||||
assertEquals(RegistryErrorMessage.FAILED_TO_CONNECT_TO_DATABASE,
|
||||
response.getErrors().iterator().next().getMessage());
|
||||
}
|
||||
|
@ -153,12 +159,12 @@ public class FactoryRegistryHandlerTest {
|
|||
|
||||
// Setup the encoded objects as if they were coming from the registry
|
||||
for (int i = 0; i < registryObjectTypes.size(); i++) {
|
||||
Set<SlotType> slotType = CollectionUtil.asSet(RegistryUtil
|
||||
Set<SlotType> slotType = CollectionUtil.asSet(encoderStrategy
|
||||
.encodeObject(results[i]));
|
||||
registryObjectTypes.get(i).setSlot(slotType);
|
||||
}
|
||||
|
||||
List<String> filteredResults = FactoryRegistryHandler.filterResults(
|
||||
List<String> filteredResults = registryHandler.filterResults(
|
||||
new StringQueryNonFormatter(), registryObjectTypes);
|
||||
assertEquals("Incorrect number of results were returned!",
|
||||
results.length, filteredResults.size());
|
||||
|
@ -178,8 +184,8 @@ public class FactoryRegistryHandlerTest {
|
|||
|
||||
StringResultsQuery query = new StringResultsQuery(results);
|
||||
|
||||
List<String> filteredResults = FactoryRegistryHandler.filterResults(
|
||||
query, registryObjectTypes);
|
||||
List<String> filteredResults = registryHandler.filterResults(query,
|
||||
registryObjectTypes);
|
||||
assertEquals("Incorrect number of results were returned!",
|
||||
results.length, filteredResults.size());
|
||||
|
||||
|
@ -202,8 +208,8 @@ public class FactoryRegistryHandlerTest {
|
|||
|
||||
StringArrayResultsQuery query = new StringArrayResultsQuery(results);
|
||||
|
||||
List<String> filteredResults = FactoryRegistryHandler.filterResults(
|
||||
query, registryObjectTypes);
|
||||
List<String> filteredResults = registryHandler.filterResults(query,
|
||||
registryObjectTypes);
|
||||
assertEquals("Incorrect number of results were returned!", 6,
|
||||
filteredResults.size());
|
||||
|
||||
|
@ -230,8 +236,8 @@ public class FactoryRegistryHandlerTest {
|
|||
|
||||
StringArrayResultsQuery query = new StringArrayResultsQuery(results);
|
||||
|
||||
List<String> filteredResults = FactoryRegistryHandler.filterResults(
|
||||
query, registryObjectTypes);
|
||||
List<String> filteredResults = registryHandler.filterResults(query,
|
||||
registryObjectTypes);
|
||||
assertEquals("Incorrect number of results were returned!", 6,
|
||||
filteredResults.size());
|
||||
|
||||
|
|
|
@ -24,12 +24,10 @@ import static org.junit.Assert.assertNotNull;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.registry.MockRegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
|
@ -46,6 +44,7 @@ import com.raytheon.uf.common.util.ReflectionException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 22, 2012 0743 djohnson Initial creation
|
||||
* Sep 07, 2012 1102 djohnson Setup the registry encoder.
|
||||
* Jun 24, 2013 2106 djohnson RegistryUtil no longer holds the encoder instance.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,22 +54,6 @@ import com.raytheon.uf.common.util.ReflectionException;
|
|||
|
||||
public class RegistryUtilTest {
|
||||
|
||||
/**
|
||||
* Allows tests to set a specific registry encoding type to use.
|
||||
*
|
||||
* @param type
|
||||
* the type
|
||||
*/
|
||||
public static void setEncoderStrategy(IRegistryEncoder encoder) {
|
||||
RegistryUtil.ENCODER_STRATEGY = encoder;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void classSetup() {
|
||||
RegistryUtilTest.setEncoderStrategy(RegistryEncoders
|
||||
.ofType(Type.DYNAMIC_SERIALIZE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newRegistryObjectCanConvertEnumValues()
|
||||
throws ReflectionException, SerializationException {
|
||||
|
@ -78,7 +61,8 @@ public class RegistryUtilTest {
|
|||
registryObject.setDataType(DataType.GRID);
|
||||
|
||||
RegistryObjectType type = RegistryUtil
|
||||
.newRegistryObject(registryObject);
|
||||
.newRegistryObject(registryObject,
|
||||
RegistryEncoders.ofType(Type.DYNAMIC_SERIALIZE));
|
||||
|
||||
SlotType slotToCheck = null;
|
||||
for (SlotType slot : type.getSlot()) {
|
||||
|
|
|
@ -23,10 +23,11 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
|
||||
/**
|
||||
* Returns an arbitrary number of string results per {@link RegistryObjectType}.
|
||||
*
|
||||
|
@ -37,6 +38,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson IResultFormatter instances take the encoder as a method argument.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,7 +74,9 @@ public class StringArrayResultsQuery extends AdhocRegistryQuery<String>
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> decodeObject(RegistryObjectType registryObjectType) {
|
||||
public Collection<String> decodeObject(
|
||||
RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoderStrategy) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
|
||||
String[] valuesToReturn = resultsToReturn[index++];
|
||||
|
|
|
@ -19,12 +19,13 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.registry.ebxml;
|
||||
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import com.raytheon.uf.common.registry.IResultFormatter;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* {@link IResultFormatter} that returns a {@link String}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -33,6 +34,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 djohnson Initial creation
|
||||
* Jun 24, 2013 2106 djohnson IResultFormatter instances take the encoder as a method argument.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -67,7 +69,8 @@ public class StringResultsQuery extends AdhocRegistryQuery<String> implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public String decodeObject(RegistryObjectType registryObjectType) {
|
||||
public String decodeObject(RegistryObjectType registryObjectType,
|
||||
IRegistryEncoder encoderStrategy) {
|
||||
return resultsToReturn[index++];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.junit.Ignore;
|
|||
* Apr 23, 2013 1910 djohnson Add constants for ebxml spring files.
|
||||
* May 02, 2013 1910 djohnson Add validator plugins spring file.
|
||||
* May 28, 2013 1650 djohnson Add event bus spring files.
|
||||
* Jun 24, 2013 2106 djohnson Remove spring file.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -79,8 +80,6 @@ public class SpringFiles {
|
|||
|
||||
public static final String EBXML_REGISTRY_DAO_XML = "/spring/ebxml-registry-dao.xml";
|
||||
|
||||
public static final String EBXML_REGISTRY_ENCODER_XML = "/spring/ebxml-registry-encoder.xml";
|
||||
|
||||
public static final String EBXML_REPLICATION_DATADELIVERY_WFO_XML = "/spring/registry-replication-datadelivery-wfo.xml";
|
||||
|
||||
public static final String EBXML_SUBSCRIPTION_XML = "/spring/ebxml-subscription.xml";
|
||||
|
|
|
@ -68,6 +68,7 @@ import dods.dap.parser.ParseException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 09, 2013 1466 dhladky Unit test for NCOM
|
||||
* Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary.
|
||||
* Jun 24, 2013 2106 djohnson Use in-memory registry object handlers.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -112,7 +113,7 @@ public class OpenDAPMetaDataParserNCOMTest {
|
|||
TestUtil.readResource(OpenDAPMetaDataParserNCOMTest.class, DAS_FILE));
|
||||
DAS.parse(bis);
|
||||
|
||||
RegistryObjectHandlersUtil.init();
|
||||
RegistryObjectHandlersUtil.initMemory();
|
||||
}
|
||||
|
||||
private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() {
|
||||
|
|
|
@ -76,6 +76,7 @@ import dods.dap.parser.ParseException;
|
|||
* Oct 23, 2012 1286 djohnson Install test localization before each test.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary.
|
||||
* Jun 24, 2013 2106 djohnson Use in-memory registry object handlers.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -120,7 +121,7 @@ public class OpenDAPMetaDataParserRAPTest {
|
|||
TestUtil.readResource(OpenDAPMetaDataParserRAPTest.class, DAS_FILE));
|
||||
DAS.parse(bis);
|
||||
|
||||
RegistryObjectHandlersUtil.init();
|
||||
RegistryObjectHandlersUtil.initMemory();
|
||||
}
|
||||
|
||||
private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() {
|
||||
|
|
|
@ -28,10 +28,9 @@ import org.junit.Test;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.registry.RegistryManagerTest;
|
||||
|
||||
/**
|
||||
* Test {@link OpenDAPRetrievalGenerator}.
|
||||
|
@ -44,7 +43,7 @@ import com.raytheon.uf.common.registry.RegistryManagerTest;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2012 955 djohnson Initial creation
|
||||
* Aug 10, 2012 1022 djohnson Remove generics from {@link GriddedDataSetMetaData}.
|
||||
* Aug 20, 2012 0743 djohnson Use {@link RegistryManagerTest} to set the handler.
|
||||
* Aug 20, 2012 0743 djohnson Use RegistryManagerTest to set the handler.
|
||||
* Sep 24, 2012 1209 djohnson Test for NO_CYCLE metadatas and subscriptions.
|
||||
* Oct 17, 2012 0726 djohnson Remove unused code.
|
||||
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.junit.Test;
|
|||
|
||||
import com.raytheon.uf.common.registry.IRegistryRequest;
|
||||
import com.raytheon.uf.common.registry.IRegistryRequest.Action;
|
||||
import com.raytheon.uf.common.registry.RegistryManagerTest;
|
||||
import com.raytheon.uf.common.registry.RegistryHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 17, 2012 1169 djohnson Tests for more than one item provided to store/storeOrReplace.
|
||||
* Oct 17, 2012 0726 djohnson Use {@link RegistryManagerTest#setMockInstance()}.
|
||||
* Jun 24, 2013 2106 djohnson No more RegistryManager.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,9 +56,11 @@ public class EDEXRegistryManagerTest {
|
|||
|
||||
private final IUFStatusHandler statusHandler = mock(IUFStatusHandler.class);
|
||||
|
||||
private final static EDEXRegistryManager edexRegistryManager = new EDEXRegistryManager();
|
||||
|
||||
@BeforeClass
|
||||
public static void classSetUp() {
|
||||
RegistryManagerTest.setMockInstance();
|
||||
edexRegistryManager.setRegistryHandler(mock(RegistryHandler.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -68,8 +71,7 @@ public class EDEXRegistryManagerTest {
|
|||
request.setAction(Action.STORE);
|
||||
request.setObjects(Arrays.asList("one", "two"));
|
||||
|
||||
new EDEXRegistryManager()
|
||||
.handleRequest(request);
|
||||
edexRegistryManager.handleRequest(request);
|
||||
|
||||
verify(statusHandler).error(
|
||||
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
|
@ -84,8 +86,7 @@ public class EDEXRegistryManagerTest {
|
|||
request.setAction(Action.STORE_OR_REPLACE);
|
||||
request.setObjects(Arrays.asList("one", "two"));
|
||||
|
||||
new EDEXRegistryManager()
|
||||
.handleRequest(request);
|
||||
edexRegistryManager.handleRequest(request);
|
||||
|
||||
verify(statusHandler).error(
|
||||
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
|
@ -99,8 +100,7 @@ public class EDEXRegistryManagerTest {
|
|||
request.setAction(Action.STORE);
|
||||
request.setObjects(Arrays.asList("one"));
|
||||
|
||||
new EDEXRegistryManager()
|
||||
.handleRequest(request);
|
||||
edexRegistryManager.handleRequest(request);
|
||||
|
||||
verify(statusHandler, never()).error(
|
||||
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
|
@ -114,8 +114,7 @@ public class EDEXRegistryManagerTest {
|
|||
request.setAction(Action.STORE_OR_REPLACE);
|
||||
request.setObjects(Arrays.asList("one"));
|
||||
|
||||
new EDEXRegistryManager()
|
||||
.handleRequest(request);
|
||||
edexRegistryManager.handleRequest(request);
|
||||
|
||||
verify(statusHandler, never()).error(
|
||||
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
|
@ -129,8 +128,7 @@ public class EDEXRegistryManagerTest {
|
|||
request.setAction(Action.REMOVE);
|
||||
request.setObjects(Arrays.asList("one", "two"));
|
||||
|
||||
new EDEXRegistryManager()
|
||||
.handleRequest(request);
|
||||
edexRegistryManager.handleRequest(request);
|
||||
|
||||
verify(statusHandler, never()).error(
|
||||
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
|
||||
|
|
Loading…
Add table
Reference in a new issue