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:
Dustin Johnson 2013-06-24 09:51:56 -05:00
parent b007d4a302
commit 69c09e530f
75 changed files with 877 additions and 1369 deletions

View file

@ -8,11 +8,15 @@
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler"> class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <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>
<constructor-arg> <constructor-arg>
<bean <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> </constructor-arg>
</bean> </bean>
@ -20,37 +24,57 @@
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler"> class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <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>
<constructor-arg> <constructor-arg>
<bean <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> </constructor-arg>
</bean> </bean>
<bean name="GroupDefinitionHandler" <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" <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" <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" <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" <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" <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" <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" <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 --> <!-- The actual registering of the handlers -->

View file

@ -46,10 +46,6 @@
</bean> </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 <!-- 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... CAVE just gets a ClassNotFoundException on boot...
someday the reason should be figured out and these beans removed --> someday the reason should be figured out and these beans removed -->

View file

@ -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.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.Parameter; import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.registry.IMultipleResultFormatter; 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.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * Jun 21, 2012 736 djohnson Initial creation
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Aug 15, 2012 0743 djohnson Type-safe result formatters. * Aug 15, 2012 0743 djohnson Type-safe result formatters.
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -41,11 +42,11 @@ public class DataLevelTypeDescriptionQuery extends
private transient Set<String> alreadyFound; private transient Set<String> alreadyFound;
@Override @Override
public Collection<String> decodeObject(RegistryObjectType registryObjectType) public Collection<String> decodeObject(
RegistryObjectType registryObjectType, IRegistryEncoder encoder)
throws SerializationException { throws SerializationException {
Parameter object = (Parameter) RegistryUtil Parameter object = (Parameter) encoder.decodeObject(registryObjectType);
.decodeObject(registryObjectType);
if (alreadyFound == null) { if (alreadyFound == null) {
alreadyFound = new HashSet<String>(); alreadyFound = new HashSet<String>();

View file

@ -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.DataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter; import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.registry.IMultipleResultFormatter; 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.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * Jun 21, 2012 736 djohnson Initial creation
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -55,10 +56,10 @@ public class DataLevelTypeQuery extends
@Override @Override
public Collection<DataLevelType> decodeObject( public Collection<DataLevelType> decodeObject(
RegistryObjectType registryObjectType) RegistryObjectType registryObjectType, IRegistryEncoder encoder)
throws SerializationException { throws SerializationException {
Object object = RegistryUtil.decodeObject(registryObjectType); Object object = encoder.decodeObject(registryObjectType);
if (object instanceof DataSet) { if (object instanceof DataSet) {

View file

@ -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.datadelivery.registry.DataSetMetaData;
import com.raytheon.uf.common.registry.IResultFormatter; 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.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.time.util.ImmutableDate; import com.raytheon.uf.common.time.util.ImmutableDate;
@ -46,6 +47,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2012 0743 djohnson Initial creation * Aug 15, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -64,7 +66,8 @@ public class DataSetMetaDataDatesQuery extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public ImmutableDate decodeObject(RegistryObjectType registryObjectType) public ImmutableDate decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoder)
throws SerializationException { throws SerializationException {
Set<SlotType> returnedSlots = registryObjectType.getSlot(); Set<SlotType> returnedSlots = registryObjectType.getSlot();

View file

@ -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.datadelivery.registry.DataSetName;
import com.raytheon.uf.common.registry.IResultFormatter; import com.raytheon.uf.common.registry.IResultFormatter;
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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. * Jun 21, 2012 736 djohnson Add thrift serialization annotations.
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Aug 15, 2012 0743 djohnson Type-safe result formatters. * Aug 15, 2012 0743 djohnson Type-safe result formatters.
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -58,7 +60,8 @@ public class DataSetNameQuery extends
} }
@Override @Override
public String decodeObject(RegistryObjectType registryObjectType) { public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoder) {
String object = null; String object = null;

View file

@ -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.datadelivery.registry.Parameter;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.registry.IResultFormatter; 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.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; 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. * Oct 17, 2012 0726 djohnson Made filter check method public.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects. * 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. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -61,10 +62,11 @@ public class DataSetWithFiltersQuery extends DataSetQuery implements
private ReferencedEnvelope envelope; private ReferencedEnvelope envelope;
@Override @Override
public DataSet decodeObject(RegistryObjectType registryObjectType) public DataSet decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoder)
throws SerializationException { throws SerializationException {
DataSet retVal = null; DataSet retVal = null;
DataSet object = (DataSet) RegistryUtil DataSet object = (DataSet) encoder
.decodeObject(registryObjectType); .decodeObject(registryObjectType);
if (satisfiesFilterCriteria(object, levels, envelope)) { if (satisfiesFilterCriteria(object, levels, envelope)) {

View file

@ -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.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.registry.IResultFormatter; import com.raytheon.uf.common.registry.IResultFormatter;
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/** /**
@ -23,6 +24,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 02, 2013 1441 djohnson Initial creation * Jan 02, 2013 1441 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -34,7 +36,8 @@ public class GroupNameQuery extends GroupDefinitionFilterableQuery<String>
implements IResultFormatter<String> { implements IResultFormatter<String> {
@Override @Override
public String decodeObject(RegistryObjectType registryObjectType) { public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoder) {
Set<SlotType> returnedSlots = registryObjectType.getSlot(); Set<SlotType> returnedSlots = registryObjectType.getSlot();

View file

@ -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 oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import com.raytheon.uf.common.registry.IResultFormatter; import com.raytheon.uf.common.registry.IResultFormatter;
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * Jun 21, 2012 736 djohnson Initial creation
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries. * Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Aug 15, 2012 0743 djohnson Type-safe result formatters. * Aug 15, 2012 0743 djohnson Type-safe result formatters.
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -35,7 +37,8 @@ public class ParameterNameQuery extends ParameterFilterableQuery<String>
implements IResultFormatter<String> { implements IResultFormatter<String> {
@Override @Override
public String decodeObject(RegistryObjectType registryObjectType) { public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoder) {
String object = null; String object = null;

View file

@ -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.datadelivery.registry.Subscription;
import com.raytheon.uf.common.registry.IResultFormatter; 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.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -43,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 24, 2012 0743 djohnson Initial creation * Aug 24, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* *
* </pre> * </pre>
* *
@ -74,7 +76,8 @@ public class SubscriptionDataSetNameQuery extends
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public String decodeObject(RegistryObjectType registryObjectType) public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoderStrategy)
throws SerializationException { throws SerializationException {
Set<SlotType> returnedSlots = registryObjectType.getSlot(); Set<SlotType> returnedSlots = registryObjectType.getSlot();

View file

@ -26,7 +26,6 @@ import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData; 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.DataSetMetaDataDatesQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataFilterableQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -41,8 +40,9 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 03, 2012 1241 djohnson Initial creation * Oct 03, 2012 1241 djohnson Initial creation
* Oct 17, 2012 0726 djohnson Move in {@link #getByDataSet}. * Oct 17, 2012 0726 djohnson Move in {@link #getByDataSet}.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -65,8 +65,8 @@ public abstract class BaseDataSetMetaDataHandler<T extends DataSetMetaData, QUER
query.setDataSetName(dataSetName); query.setDataSetName(dataSetName);
query.setProviderName(providerName); query.setProviderName(providerName);
RegistryQueryResponse<ImmutableDate> response = RegistryManager RegistryQueryResponse<ImmutableDate> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getDatesForDataSet"); checkResponse(response, "getDatesForDataSet");
@ -83,8 +83,7 @@ public abstract class BaseDataSetMetaDataHandler<T extends DataSetMetaData, QUER
query.setDataSetName(dataSetName); query.setDataSetName(dataSetName);
query.setProviderName(providerName); query.setProviderName(providerName);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByDataSet"); checkResponse(response, "getByDataSet");

View file

@ -26,7 +26,6 @@ import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription; import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.RegistryResponse; import com.raytheon.uf.common.registry.RegistryResponse;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
@ -46,6 +45,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 04, 2013 1841 djohnson Extracted from PendingSubscriptionHandler and genericized. * Apr 04, 2013 1841 djohnson Extracted from PendingSubscriptionHandler and genericized.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -94,8 +94,8 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
query.setReturnObjects(false); query.setReturnObjects(false);
// Delete associations // Delete associations
RegistryResponse<Object> removalResponse = RegistryManager RegistryResponse<Object> removalResponse = registryHandler
.removeRegistyObjects(query); .removeObjects(query);
checkResponse(removalResponse, "deleteAssociationToSubscription"); checkResponse(removalResponse, "deleteAssociationToSubscription");
} }
@ -122,8 +122,8 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
query.setTargetObjectId(id); query.setTargetObjectId(id);
query.setReturnObjects(true); query.setReturnObjects(true);
RegistryQueryResponse<Object> response = RegistryManager RegistryQueryResponse<Object> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getBySubscriptionId"); checkResponse(response, "getBySubscriptionId");

View file

@ -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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionDataSetNameQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionDataSetNameQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; 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()}. * Oct 10, 2012 0726 djohnson Add {@link #getActive()}.
* Feb 20, 2013 1543 djohnson Add ability to filter on routes. * Feb 20, 2013 1543 djohnson Add ability to filter on routes.
* May 28, 2013 1650 djohnson Add getByNames. * May 28, 2013 1650 djohnson Add getByNames.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -68,8 +68,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
SubscriptionFilterableQuery<T> query = getQuery(); SubscriptionFilterableQuery<T> query = getQuery();
query.setName(name); query.setName(name);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByName"); checkResponse(response, "getByName");
@ -85,8 +84,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
SubscriptionFilterableQuery<T> query = getQuery(); SubscriptionFilterableQuery<T> query = getQuery();
query.setNames(names); query.setNames(names);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByNames"); checkResponse(response, "getByNames");
@ -101,8 +99,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
SubscriptionFilterableQuery<T> query = getQuery(); SubscriptionFilterableQuery<T> query = getQuery();
query.setOwner(owner); query.setOwner(owner);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByOwner"); checkResponse(response, "getByOwner");
@ -117,8 +114,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
SubscriptionFilterableQuery<T> query = getQuery(); SubscriptionFilterableQuery<T> query = getQuery();
query.setGroupName(group); query.setGroupName(group);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByGroupName"); checkResponse(response, "getByGroupName");
@ -131,8 +127,8 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
@Override @Override
public Set<String> getSubscribedToDataSetNames() public Set<String> getSubscribedToDataSetNames()
throws RegistryHandlerException { throws RegistryHandlerException {
RegistryQueryResponse<String> response = RegistryManager RegistryQueryResponse<String> response = registryHandler
.getRegistyObjects(new SubscriptionDataSetNameQuery()); .getObjects(new SubscriptionDataSetNameQuery());
checkResponse(response, "getSubscribedToDataSetNames"); checkResponse(response, "getSubscribedToDataSetNames");
@ -154,8 +150,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
query.setOfficeId(officeId); query.setOfficeId(officeId);
} }
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getByFilters"); checkResponse(response, "getByFilters");
@ -170,8 +165,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
SubscriptionFilterableQuery<T> query = getQuery(); SubscriptionFilterableQuery<T> query = getQuery();
query.setActive(true); query.setActive(true);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getActive"); checkResponse(response, "getActive");
@ -197,8 +191,7 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
query.setActive(true); query.setActive(true);
query.setRoutes(Arrays.asList(routes)); query.setRoutes(Arrays.asList(routes));
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getActiveForRoutes"); checkResponse(response, "getActiveForRoutes");

View file

@ -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.Parameter;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetWithFiltersQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.ebxml.UnresolvedReferenceException; 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. * 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. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jun 04, 2013 223 mpduff Added datatype to the filter. * Jun 04, 2013 223 mpduff Added datatype to the filter.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -211,8 +211,8 @@ public class DataSetHandler extends
query.setDataSetName(name); query.setDataSetName(name);
query.setProviderName(providerName); query.setProviderName(providerName);
RegistryQueryResponse<DataSet> response = RegistryManager RegistryQueryResponse<DataSet> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getByNameAndProvider"); checkResponse(response, "getByNameAndProvider");
@ -252,8 +252,8 @@ public class DataSetHandler extends
query.setEnvelope(envelope); query.setEnvelope(envelope);
} }
RegistryQueryResponse<DataSet> response = RegistryManager RegistryQueryResponse<DataSet> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getByFilters"); checkResponse(response, "getByFilters");

View file

@ -26,7 +26,6 @@ import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.DataSetName; 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.DataSetNameObjectQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetNameQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -40,7 +39,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* *
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -50,8 +50,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
public class DataSetNameHandler extends public class DataSetNameHandler extends
BaseRegistryObjectHandler<DataSetName, DataSetNameObjectQuery> BaseRegistryObjectHandler<DataSetName, DataSetNameObjectQuery>
implements implements IDataSetNameHandler {
IDataSetNameHandler {
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -78,9 +77,9 @@ public class DataSetNameHandler extends
DataSetNameQuery query = new DataSetNameQuery(); DataSetNameQuery query = new DataSetNameQuery();
query.setDataSetTypes(dataTypes); query.setDataSetTypes(dataTypes);
RegistryQueryResponse<String> response = RegistryManager RegistryQueryResponse<String> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getByDataTypes"); checkResponse(response, "getByDataTypes");
return new HashSet<String>(response.getResults()); return new HashSet<String>(response.getResults());

View file

@ -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.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.GriddedDataSetMetaDataQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.time.util.ImmutableDate; import com.raytheon.uf.common.time.util.ImmutableDate;
@ -40,6 +39,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 03, 2012 1241 djohnson Initial creation * Oct 03, 2012 1241 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -80,8 +80,8 @@ public class GriddedDataSetMetaDataHandler
query.setCycle(cycle); query.setCycle(cycle);
query.setDate(new ImmutableDate(date)); query.setDate(new ImmutableDate(date));
RegistryQueryResponse<GriddedDataSetMetaData> response = RegistryManager RegistryQueryResponse<GriddedDataSetMetaData> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getByDataSetDateAndCycle"); checkResponse(response, "getByDataSetDateAndCycle");

View file

@ -24,7 +24,6 @@ import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition; 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.GroupNameQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.GroupQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.RegistryResponse; import com.raytheon.uf.common.registry.RegistryResponse;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; 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 * Oct 3, 2012 1241 djohnson Initial creation
* Jan 02, 2013 1441 djohnson Add deleteByName() and getGroupNames(). * Jan 02, 2013 1441 djohnson Add deleteByName() and getGroupNames().
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -61,8 +61,8 @@ public class GroupDefinitionHandler extends
GroupQuery gQuery = getQuery(); GroupQuery gQuery = getQuery();
gQuery.setGroupName(groupName); gQuery.setGroupName(groupName);
RegistryQueryResponse<GroupDefinition> response = RegistryManager RegistryQueryResponse<GroupDefinition> response = registryHandler
.getRegistyObjects(gQuery); .getObjects(gQuery);
checkResponse(response, "getByName"); checkResponse(response, "getByName");
@ -77,8 +77,8 @@ public class GroupDefinitionHandler extends
GroupQuery gQuery = getQuery(); GroupQuery gQuery = getQuery();
gQuery.setGroupName(groupName); gQuery.setGroupName(groupName);
RegistryResponse<GroupDefinition> response = RegistryManager RegistryResponse<GroupDefinition> response = registryHandler
.removeRegistyObjects(gQuery); .removeObjects(gQuery);
checkResponse(response, "getByName"); checkResponse(response, "getByName");
} }
@ -90,8 +90,8 @@ public class GroupDefinitionHandler extends
public List<String> getGroupNames() throws RegistryHandlerException { public List<String> getGroupNames() throws RegistryHandlerException {
GroupNameQuery groupNameQuery = new GroupNameQuery(); GroupNameQuery groupNameQuery = new GroupNameQuery();
RegistryQueryResponse<String> response = RegistryManager RegistryQueryResponse<String> response = registryHandler
.getRegistyObjects(groupNameQuery); .getObjects(groupNameQuery);
checkResponse(response, "getGroupNames"); checkResponse(response, "getGroupNames");

View file

@ -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.DataLevelTypeDescriptionQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.ParameterNameQuery; import com.raytheon.uf.common.datadelivery.registry.ebxml.ParameterNameQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.ParameterQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.ebxml.UnresolvedReferenceException; import com.raytheon.uf.common.registry.ebxml.UnresolvedReferenceException;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
@ -47,7 +46,8 @@ import com.raytheon.uf.common.status.UFStatus;
* *
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -146,8 +146,8 @@ public class ParameterHandler extends
DataLevelTypeDescriptionQuery query = new DataLevelTypeDescriptionQuery(); DataLevelTypeDescriptionQuery query = new DataLevelTypeDescriptionQuery();
query.setDataTypes(dataTypes); query.setDataTypes(dataTypes);
RegistryQueryResponse<String> response = RegistryManager RegistryQueryResponse<String> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getDataLevelTypeDescriptions"); checkResponse(response, "getDataLevelTypeDescriptions");
return response.getResults(); return response.getResults();
@ -222,8 +222,8 @@ public class ParameterHandler extends
ParameterNameQuery query = new ParameterNameQuery(); ParameterNameQuery query = new ParameterNameQuery();
query.setDataTypes(dataTypes); query.setDataTypes(dataTypes);
RegistryQueryResponse<String> response = RegistryManager RegistryQueryResponse<String> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getNamesByDataTypes"); checkResponse(response, "getNamesByDataTypes");

View file

@ -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.Provider;
import com.raytheon.uf.common.datadelivery.registry.ebxml.ProviderQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.BaseRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -35,7 +34,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* *
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -56,8 +56,8 @@ public class ProviderHandler extends
ProviderQuery gQuery = getQuery(); ProviderQuery gQuery = getQuery();
gQuery.setProviderName(providerName); gQuery.setProviderName(providerName);
RegistryQueryResponse<Provider> response = RegistryManager RegistryQueryResponse<Provider> response = registryHandler
.getRegistyObjects(gQuery); .getObjects(gQuery);
checkResponse(response, "getByName"); checkResponse(response, "getByName");

View file

@ -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.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.ebxml.AssociationQuery; import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
@ -45,6 +44,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 05, 2013 1841 djohnson Extracted and genericized from siteSubscriptionHandler. * Apr 05, 2013 1841 djohnson Extracted and genericized from siteSubscriptionHandler.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* *
* </pre> * </pre>
* *
@ -77,8 +77,8 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
query.setSourceObjectId(id); query.setSourceObjectId(id);
query.setReturnObjects(true); query.setReturnObjects(true);
RegistryQueryResponse<Object> response = RegistryManager RegistryQueryResponse<Object> response = registryHandler
.getRegistyObjects(query); .getObjects(query);
checkResponse(response, "getByPendingSubscriptionId"); checkResponse(response, "getByPendingSubscriptionId");
@ -130,8 +130,7 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
query.setProviderName(providerName); query.setProviderName(providerName);
query.setActive(true); query.setActive(true);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getActiveByDataSetAndProvider"); checkResponse(response, "getActiveByDataSetAndProvider");

View file

@ -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

View file

@ -23,6 +23,7 @@ import java.util.Collection;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; 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; import com.raytheon.uf.common.serialization.SerializationException;
/** /**
@ -36,6 +37,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2012 0743 djohnson Initial creation * Aug 15, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Accepts the registry encoder as a method parameter.
* *
* </pre> * </pre>
* *
@ -45,6 +47,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
public interface IMultipleResultFormatter<T> extends RegistryQuery<T> { public interface IMultipleResultFormatter<T> extends RegistryQuery<T> {
Collection<T> decodeObject(RegistryObjectType registryObjectType) Collection<T> decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoderStrategy)
throws SerializationException; throws SerializationException;
} }

View file

@ -2,6 +2,7 @@ package com.raytheon.uf.common.registry;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; 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; import com.raytheon.uf.common.serialization.SerializationException;
/** /**
@ -17,6 +18,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* Mar 27, 2012 jspinks Initial creation * Mar 27, 2012 jspinks Initial creation
* Jun 21, 2012 736 djohnson Add throws SerializationException. * Jun 21, 2012 736 djohnson Add throws SerializationException.
* Aug 15, 2012 0743 djohnson Type-safe result formatters. * Aug 15, 2012 0743 djohnson Type-safe result formatters.
* Jun 24, 2013 2106 djohnson Accepts the registry encoder as a method parameter.
* *
* </pre> * </pre>
* *
@ -24,7 +26,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* @version 1.0 * @version 1.0
*/ */
public interface IResultFormatter<T> extends RegistryQuery<T> { public interface IResultFormatter<T> extends RegistryQuery<T> {
T decodeObject(RegistryObjectType registryObjectType) T decodeObject(RegistryObjectType registryObjectType,
throws SerializationException; IRegistryEncoder encoder) throws SerializationException;
} }

View file

@ -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);
}
}

View file

@ -6,10 +6,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; 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 * 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 * in the registry using the RegistryManager Class. Member fields of a Class

View file

@ -6,7 +6,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; 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.constants.AssociationTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryObjectResolver; import com.raytheon.uf.common.registry.ebxml.RegistryObjectResolver;

View file

@ -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 oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnresolvedReferenceExceptionType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.google.common.annotations.VisibleForTesting; 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.annotations.RegistryObject;
import com.raytheon.uf.common.registry.constants.AssociationTypes; import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage; 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.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -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 * 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 * 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. * Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
* Jun 24, 2013 2106 djohnson Requires a transaction to already be active.
* *
* </pre> * </pre>
* *
* @author djohnson * @author djohnson
*/ */
@Service @Service
@Transactional @Transactional(propagation = Propagation.MANDATORY)
public class FactoryRegistryHandler implements RegistryHandler { public class FactoryRegistryHandler implements RegistryHandler {
@VisibleForTesting @VisibleForTesting
@ -97,24 +99,14 @@ public class FactoryRegistryHandler implements RegistryHandler {
static IUFStatusHandler statusHandler = UFStatus static IUFStatusHandler statusHandler = UFStatus
.getHandler(FactoryRegistryHandler.class); .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 final int batchSize = 10;
private LifecycleManagerFactory lifecycleManagerFactory; private LifecycleManagerFactory lifecycleManagerFactory;
private QueryManagerFactory queryManagerFactory; private QueryManagerFactory queryManagerFactory;
private IRegistryEncoder encoderStrategy;
/** /**
* Private constructor to disallow instance creation. * Private constructor to disallow instance creation.
*/ */
@ -181,6 +173,14 @@ public class FactoryRegistryHandler implements RegistryHandler {
this.queryManagerFactory = queryManagerFactory; this.queryManagerFactory = queryManagerFactory;
} }
/**
* @param encoderStrategy
* the encoderStrategy to set
*/
public void setEncoderStrategy(IRegistryEncoder encoderStrategy) {
this.encoderStrategy = encoderStrategy;
}
private List<RegistryObjectType> getAssociations(QueryManager qm, private List<RegistryObjectType> getAssociations(QueryManager qm,
String sourceObjectId, String targetObjectId, String associationType) String sourceObjectId, String targetObjectId, String associationType)
throws MsgRegistryException { throws MsgRegistryException {
@ -324,8 +324,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
+ objs.size() + " items returned"); + objs.size() + " items returned");
} }
List<T> registryObjects = FactoryRegistryHandler.filterResults( List<T> registryObjects = filterResults(registryQuery, objs);
registryQuery, objs);
timer.stop(); timer.stop();
long totalElapsedTime = timer.getElapsedTime(); long totalElapsedTime = timer.getElapsedTime();
@ -358,16 +357,15 @@ public class FactoryRegistryHandler implements RegistryHandler {
* @return the results * @return the results
*/ */
@VisibleForTesting @VisibleForTesting
static <T> List<T> filterResults(RegistryQuery<T> registryQuery, <T> List<T> filterResults(RegistryQuery<T> registryQuery,
List<RegistryObjectType> objs) { List<RegistryObjectType> objs) {
final List<T> registryObjects = new ArrayList<T>(objs.size()); final List<T> registryObjects = new ArrayList<T>(objs.size());
if (registryQuery instanceof IResultFormatter) { if (registryQuery instanceof IResultFormatter) {
FactoryRegistryHandler.filterResults( filterResults((IResultFormatter<T>) registryQuery, objs,
(IResultFormatter<T>) registryQuery, objs, registryObjects); registryObjects);
} else if (registryQuery instanceof IMultipleResultFormatter) { } else if (registryQuery instanceof IMultipleResultFormatter) {
FactoryRegistryHandler.filterResults( filterResults((IMultipleResultFormatter<T>) registryQuery, objs,
(IMultipleResultFormatter<T>) registryQuery, objs,
registryObjects); registryObjects);
} }
// This handles Association queries that do NOT return @RegistryObject // This handles Association queries that do NOT return @RegistryObject
@ -381,7 +379,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
} else { } else {
for (RegistryObjectType obj : objs) { for (RegistryObjectType obj : objs) {
try { try {
Object o = RegistryUtil.decodeObject(obj); Object o = encoderStrategy.decodeObject(obj);
if (o != null) { if (o != null) {
registryObjects.add(registryQuery.getResultType().cast( registryObjects.add(registryQuery.getResultType().cast(
o)); o));
@ -408,11 +406,12 @@ public class FactoryRegistryHandler implements RegistryHandler {
* @param results * @param results
* the collection to add results to * 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) { List<RegistryObjectType> objs, Collection<T> results) {
for (RegistryObjectType obj : objs) { for (RegistryObjectType obj : objs) {
try { try {
T decodedObject = registryQuery.decodeObject(obj); T decodedObject = registryQuery.decodeObject(obj,
encoderStrategy);
if (decodedObject != null) { if (decodedObject != null) {
results.add(decodedObject); results.add(decodedObject);
} }
@ -435,12 +434,12 @@ public class FactoryRegistryHandler implements RegistryHandler {
* @param results * @param results
* the collection to add results to * the collection to add results to
*/ */
private static <T> void filterResults( private <T> void filterResults(IMultipleResultFormatter<T> registryQuery,
IMultipleResultFormatter<T> registryQuery,
List<RegistryObjectType> objs, Collection<T> results) { List<RegistryObjectType> objs, Collection<T> results) {
for (RegistryObjectType obj : objs) { for (RegistryObjectType obj : objs) {
try { try {
Collection<T> decodedObject = registryQuery.decodeObject(obj); Collection<T> decodedObject = registryQuery.decodeObject(obj,
encoderStrategy);
if (decodedObject != null) { if (decodedObject != null) {
results.addAll(decodedObject); results.addAll(decodedObject);
} }
@ -711,8 +710,8 @@ public class FactoryRegistryHandler implements RegistryHandler {
// to be stored for this Object in a list so that appropriate // to be stored for this Object in a list so that appropriate
// associations can be created between the RegistryObjects created (the // associations can be created between the RegistryObjects created (the
// associations themselves are RegistryObjects). // associations themselves are RegistryObjects).
RegistryObjectType registryObject = RegistryUtil RegistryObjectType registryObject = RegistryUtil.newRegistryObject(
.newRegistryObject(object); object, encoderStrategy);
// Need to find all associations for the Objects referenced by the 'new' // Need to find all associations for the Objects referenced by the 'new'
// RegistryObject so that the appropriate 'parent' associations can also // RegistryObject so that the appropriate 'parent' associations can also

View file

@ -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.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; 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.comm.CommunicationException;
import com.raytheon.uf.common.registry.OperationStatus; import com.raytheon.uf.common.registry.OperationStatus;
import com.raytheon.uf.common.registry.RegistryException; 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. * 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 * 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 03, 2013 2038 djohnson Allow setting the same encoder strategy.
* Jun 24, 2013 2106 djohnson Remove encoder strategy from instance variables.
* *
* </pre> * </pre>
* *
@ -133,12 +133,6 @@ public final class RegistryUtil {
SLOT_CONVERSION = Collections.unmodifiableMap(map); SLOT_CONVERSION = Collections.unmodifiableMap(map);
} }
/**
* Defines the encoding strategy to use.
*/
@VisibleForTesting
static IRegistryEncoder ENCODER_STRATEGY;
/** /**
* Creates a slot of the given type. * Creates a slot of the given type.
* *
@ -162,61 +156,6 @@ public final class RegistryUtil {
return converter.getSlots(slotName, slotValue).get(0); 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. * Generate a unique id for a registry object.
* *
@ -366,7 +305,8 @@ public final class RegistryUtil {
* @throws ReflectionException * @throws ReflectionException
* on error reflectively accessing the object * on error reflectively accessing the object
*/ */
public static RegistryObjectType newRegistryObject(Object object) public static RegistryObjectType newRegistryObject(Object object,
IRegistryEncoder encoderStrategy)
throws SerializationException, ReflectionException { throws SerializationException, ReflectionException {
RegistryObjectType registryObject = new RegistryObjectType(); RegistryObjectType registryObject = new RegistryObjectType();
@ -412,7 +352,7 @@ public final class RegistryUtil {
if (ro.storeContent()) { if (ro.storeContent()) {
// Store the Base64 encoded Object in a slot called // Store the Base64 encoded Object in a slot called
// "content" // "content"
slots.add(RegistryUtil.encodeObject(object)); slots.add(encoderStrategy.encodeObject(object));
} }
// Set the ObjectType so it can be distinguished from other // Set the ObjectType so it can be distinguished from other
// Objects // Objects
@ -490,7 +430,8 @@ public final class RegistryUtil {
} }
public static Map<String, RegistryObjectType> getAssociatedObjects( 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>(); Map<String, RegistryObjectType> ids = new HashMap<String, RegistryObjectType>();
@ -516,7 +457,8 @@ public final class RegistryUtil {
List<Object> objects = mapper.getRegistryObjects(v); List<Object> objects = mapper.getRegistryObjects(v);
for (Object obj : objects) { for (Object obj : objects) {
RegistryObjectType o = newRegistryObject(obj); RegistryObjectType o = newRegistryObject(obj,
encoderStrategy);
ids.put(o.getId(), o); ids.put(o.getId(), o);
} }
} }

View file

@ -27,7 +27,7 @@ import java.util.List;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.OperationStatus; 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.RegistryQueryResponse;
import com.raytheon.uf.common.registry.RegistryResponse; import com.raytheon.uf.common.registry.RegistryResponse;
import com.raytheon.uf.common.registry.annotations.RegistryObject; 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. * Sep 21, 2012 1187 djohnson Add bulk delete operations.
* Oct 05, 2012 1195 djohnson Remove executeQuery method, add getById. * Oct 05, 2012 1195 djohnson Remove executeQuery method, add getById.
* 3/18/2013 1802 bphillip Implemented transaction boundaries * 3/18/2013 1802 bphillip Implemented transaction boundaries
* Jun 24, 2013 2106 djohnson Composes the registryHandler.
* </pre> * </pre>
* *
* @author djohnson * @author djohnson
@ -63,6 +64,8 @@ import com.raytheon.uf.common.util.CollectionUtil;
public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQuery<T>> public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQuery<T>>
implements IRegistryObjectHandler<T> { implements IRegistryObjectHandler<T> {
protected RegistryHandler registryHandler;
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -71,8 +74,7 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
IdQuery<T> query = new IdQuery<T>(getRegistryObjectClass()); IdQuery<T> query = new IdQuery<T>(getRegistryObjectClass());
query.setID(id); query.setID(id);
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getById"); checkResponse(response, "getById");
@ -85,8 +87,7 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
@Override @Override
public List<T> getAll() throws RegistryHandlerException { public List<T> getAll() throws RegistryHandlerException {
QUERY query = getQuery(); QUERY query = getQuery();
RegistryQueryResponse<T> response = RegistryManager RegistryQueryResponse<T> response = registryHandler.getObjects(query);
.getRegistyObjects(query);
checkResponse(response, "getAll"); checkResponse(response, "getAll");
@ -98,7 +99,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
*/ */
@Override @Override
public void store(T obj) throws RegistryHandlerException { public void store(T obj) throws RegistryHandlerException {
RegistryResponse<T> response = RegistryManager.storeRegistryObject(obj); RegistryResponse<T> response = registryHandler
.storeObject(obj);
checkResponse(response, obj, "store"); checkResponse(response, obj, "store");
} }
@ -108,8 +110,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
*/ */
@Override @Override
public void update(T obj) throws RegistryHandlerException { public void update(T obj) throws RegistryHandlerException {
RegistryResponse<T> response = RegistryManager RegistryResponse<?> response = registryHandler
.storeOrReplaceRegistryObject(obj); .storeOrReplaceObject(obj);
checkResponse(response, obj, "update"); checkResponse(response, obj, "update");
} }
@ -180,8 +182,8 @@ public abstract class BaseRegistryObjectHandler<T, QUERY extends AdhocRegistryQu
IdQuery<T> registryQuery = new IdQuery<T>(getRegistryObjectClass()); IdQuery<T> registryQuery = new IdQuery<T>(getRegistryObjectClass());
registryQuery.setIDs(registryIds); registryQuery.setIDs(registryIds);
RegistryResponse<T> response = RegistryManager.removeRegistyObjects( RegistryResponse<T> response = registryHandler.removeObjects(username,
username, registryQuery); registryQuery);
checkResponse(response, "deleteByIds"); 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 * Return the {@link RegistryObject} annotated class object this handler
* works with. * works with.

View file

@ -32,6 +32,8 @@ import java.util.regex.Pattern;
import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.jdbc.Work; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; 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. * 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. * 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> * </pre>
* *
* @author djohnson * @author djohnson
@ -116,6 +119,7 @@ public abstract class DbInit {
* @throws Exception * @throws Exception
* on error initializing the database * on error initializing the database
*/ */
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void initDb() throws Exception { public void initDb() throws Exception {
/* /*
* Create a new configuration object which holds all the classes that * Create a new configuration object which holds all the classes that

View file

@ -21,7 +21,7 @@
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>
<to <to
uri="log:SbnSimulator?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true" /> uri="log:SbnSimulator" />
</doCatch> </doCatch>
</doTry> </doTry>
</route> </route>

View file

@ -13,10 +13,6 @@
<!-- No retrievals for in-memory --> <!-- No retrievals for in-memory -->
</bean> </bean>
<bean id="registryManagerInstanceInitializer" class="java.lang.String">
<!-- required for depends-on -->
</bean>
<bean id="registerDataDeliveryHandlers" class="java.lang.String"> <bean id="registerDataDeliveryHandlers" class="java.lang.String">
<!-- required for depends-on --> <!-- required for depends-on -->
</bean> </bean>

View file

@ -21,8 +21,7 @@
factory-method="getBandwidthDbInit" /> factory-method="getBandwidthDbInit" />
<bean id="bandwidthManagerInitializer" factory-bean="bandwidthContextFactory" <bean id="bandwidthManagerInitializer" factory-bean="bandwidthContextFactory"
factory-method="getBandwidthInitializer" depends-on="registryManagerInstanceInitializer"> factory-method="getBandwidthInitializer"/>
</bean>
<bean id="bandwidthMapConfigFile" factory-bean="bandwidthContextFactory" <bean id="bandwidthMapConfigFile" factory-bean="bandwidthContextFactory"
factory-method="getBandwidthMapConfigFile" /> factory-method="getBandwidthMapConfigFile" />

View file

@ -199,20 +199,7 @@ public abstract class BandwidthManager extends
if (DataDeliveryRegistryObjectTypes.DATASETMETADATA.equals(objectType)) { if (DataDeliveryRegistryObjectTypes.DATASETMETADATA.equals(objectType)) {
DataSetMetaData dsmd = null; DataSetMetaData dsmd = getDataSetMetaData(id);
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);
if (dsmd != null) { if (dsmd != null) {
// Repost the Object to the BandwidthEventBus to free // Repost the Object to the BandwidthEventBus to free
@ -233,7 +220,7 @@ public abstract class BandwidthManager extends
BandwidthEventBus.publish(dsmd); BandwidthEventBus.publish(dsmd);
} else { } else {
statusHandler.error("No DataSetMetaData found for id [" + id statusHandler.error("No DataSetMetaData found for id [" + id
+ "] after " + attempts + " attempts"); + "]");
} }
} else if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION } else if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION

View file

@ -20,8 +20,9 @@
<bean id="crawlerCommunicationStrategy" class="com.raytheon.uf.edex.datadelivery.harvester.crawler.FileCommunicationStrategy" /> <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="crawlerCommunicationStrategy" />
<constructor-arg ref="ProviderHandler" />
</bean> </bean>
<camelContext id="MetaData-context" <camelContext id="MetaData-context"

View file

@ -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.Collection;
import com.raytheon.uf.common.datadelivery.registry.Provider; import com.raytheon.uf.common.datadelivery.registry.Provider;
import com.raytheon.uf.common.datadelivery.registry.Utils; 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.datadelivery.registry.handlers.IProviderHandler;
import com.raytheon.uf.common.event.EventBus; import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
@ -54,15 +53,16 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 20, 2011 218 dhladky Initial creation * Feb 20, 2011 0218 dhladky Initial creation
* Jul 17, 2012 749 djohnson Break out the use of files to communicate as a strategy. * Jul 17, 2012 0749 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. * Jul 24, 2012 0955 djohnson Use the Abstract Factory Pattern to simplify service specific access.
* Aug 30, 2012 1123 djohnson Rename CrawlerEvent to HarvesterEvent. * Aug 30, 2012 1123 djohnson Rename CrawlerEvent to HarvesterEvent.
* Sept 12,2012 1038 dhladky Reconfigured config. * Sept 12,2012 1038 dhladky Reconfigured config.
* Oct 03, 2012 1241 djohnson Use registry handler. * Oct 03, 2012 1241 djohnson Use registry handler.
* Nov 09, 2012 1263 dhladky Changed to Site Level * Nov 09, 2012 1263 dhladky Changed to Site Level
* Feb 05, 2013 1580 mpduff EventBus refactor. * Feb 05, 2013 1580 mpduff EventBus refactor.
* 3/18/2013 1802 bphillip Modified to insert provider object after database is initialized * 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> * </pre>
* *
@ -140,8 +140,13 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
private Map<String, HarvesterConfig> hconfigs = null; private Map<String, HarvesterConfig> hconfigs = null;
public CrawlMetaDataHandler(CommunicationStrategy communicationStrategy) { private final IProviderHandler providerHandler;
public CrawlMetaDataHandler(CommunicationStrategy communicationStrategy,
IProviderHandler providerHandler) {
this.communicationStrategy = communicationStrategy; this.communicationStrategy = communicationStrategy;
this.providerHandler = providerHandler;
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC, LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
@ -151,15 +156,13 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
} }
@Override
public void executeAfterRegistryInit() { public void executeAfterRegistryInit() {
statusHandler statusHandler
.info("<<<<<<<<<<<<<<<<<<<<< INITIALIZING CRAWL META DATA HANDLER >>>>>>>>>>>>>>>>>>>>>>"); .info("<<<<<<<<<<<<<<<<<<<<< INITIALIZING CRAWL META DATA HANDLER >>>>>>>>>>>>>>>>>>>>>>");
hconfigs = readCrawlConfigs(); hconfigs = readCrawlConfigs();
final IProviderHandler handler = DataDeliveryHandlers
.getProviderHandler();
if (hconfigs != null) { if (hconfigs != null) {
for (Entry<String, HarvesterConfig> entry : hconfigs.entrySet()) { for (Entry<String, HarvesterConfig> entry : hconfigs.entrySet()) {
try { try {
@ -168,7 +171,7 @@ public class CrawlMetaDataHandler implements RegistryInitializedListener {
statusHandler.info("Inserting/Updating Provider: " statusHandler.info("Inserting/Updating Provider: "
+ provider.getName() + ": " + provider.getName() + ": "
+ provider.getServiceType()); + provider.getServiceType());
handler.update(provider); providerHandler.update(provider);
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Error inserting/updating Provider! ", statusHandler.error("Error inserting/updating Provider! ",

View file

@ -1,6 +1,5 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
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 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"> 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"> class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <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>
<constructor-arg> <constructor-arg>
<bean <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> </constructor-arg>
</bean> </bean>
@ -22,36 +25,62 @@
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler"> class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler">
<constructor-arg> <constructor-arg>
<bean <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>
<constructor-arg> <constructor-arg>
<bean <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> </constructor-arg>
</bean> </bean>
<bean name="GroupDefinitionHandler" <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" <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" <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" <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" <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" <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" <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" <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> </beans>

View file

@ -7,8 +7,4 @@
<bean id="registryHandler" <bean id="registryHandler"
class="com.raytheon.uf.common.registry.ebxml.ThriftRegistryHandler" /> class="com.raytheon.uf.common.registry.ebxml.ThriftRegistryHandler" />
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
<constructor-arg ref="registryHandler" />
</bean>
</beans> </beans>

View file

@ -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 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. * 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 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> * </pre>
* *
@ -223,24 +224,8 @@ public class SubscriptionIntegrityVerifier {
final IDataSetHandler dataSetHandler = DataDeliveryHandlers final IDataSetHandler dataSetHandler = DataDeliveryHandlers
.getDataSetHandler(); .getDataSetHandler();
DataSet dataSet = null; DataSet dataSet = dataSetHandler.getById(event.getId());
int attempts = 0; dataSetUpdated(dataSet);
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) {
dataSetUpdated(dataSet);
}
} catch (RegistryHandlerException e) { } catch (RegistryHandlerException e) {
statusHandler statusHandler
.handle(Priority.ERROR, .handle(Priority.ERROR,

View file

@ -19,7 +19,7 @@
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>
<to <to
uri="log:dataDeliveryRetrieval?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true" /> uri="log:dataDeliveryRetrieval" />
</doCatch> </doCatch>
</doTry> </doTry>
</route> </route>

View file

@ -1,91 +1,96 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 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"> http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Done to force instantiation of the GribTables --> <!-- Done to force instantiation of the GribTables -->
<bean id="gribTableLookup" class="com.raytheon.edex.util.grib.GribTableLookup" <bean id="gribTableLookup" class="com.raytheon.edex.util.grib.GribTableLookup"
factory-method="getInstance" depends-on="gribRegistered" /> factory-method="getInstance" depends-on="gribRegistered" />
<bean id="gribDecoder" class="com.raytheon.edex.plugin.grib.GribDecoder" /> <bean id="gribDecoder" class="com.raytheon.edex.plugin.grib.GribDecoder" />
<bean id="gribPostProcessor" <bean id="gribPostProcessor"
class="com.raytheon.edex.plugin.grib.decoderpostprocessors.GribPostProcessor" class="com.raytheon.edex.plugin.grib.decoderpostprocessors.GribPostProcessor"
factory-method="getInstance" /> factory-method="getInstance" />
<bean id="ingest-grib" class="org.apache.camel.component.jms.JmsComponent"> <bean id="ingest-grib" class="org.apache.camel.component.jms.JmsComponent">
<constructor-arg ref="jmsIngestGribConfig" /> <constructor-arg ref="jmsIngestGribConfig" />
<property name="taskExecutor" ref="gribThreadPool" /> <property name="taskExecutor" ref="gribThreadPool" />
</bean> </bean>
<bean id="jmsIngestGribConfig" class="org.apache.camel.component.jms.JmsConfiguration" <bean id="jmsIngestGribConfig" class="org.apache.camel.component.jms.JmsConfiguration"
factory-bean="jmsConfig" factory-method="copy"> factory-bean="jmsConfig" factory-method="copy">
</bean> </bean>
<bean id="gribThreadPool" <bean id="gribThreadPool"
class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor"> class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
<property name="corePoolSize" value="4" /> <property name="corePoolSize" value="4" />
<property name="maxPoolSize" value="4" /> <property name="maxPoolSize" value="4" />
</bean> </bean>
<bean id="largeFileChecker" class="com.raytheon.edex.plugin.grib.GribLargeFileChecker" /> <bean id="largeFileChecker" class="com.raytheon.edex.plugin.grib.GribLargeFileChecker" />
<bean id="largeFileLockRelease" class="com.raytheon.edex.plugin.grib.GribLockRelease" /> <bean id="largeFileLockRelease" class="com.raytheon.edex.plugin.grib.GribLockRelease" />
<bean id="gribCamelRegistered" factory-bean="contextManager" <bean id="gribCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered"> factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="grib-camel"/> <constructor-arg ref="grib-camel" />
</bean> </bean>
<bean id="gribLayerCollector" class="com.raytheon.uf.edex.plugin.grib.ogc.GribLayerCollector" depends-on="registryManagerInstanceInitializer, registerDataDeliveryHandlers, registerRequestRegistryRouter">
<constructor-arg ref="gribLayerTransformer" />
</bean>
<camelContext id="grib-camel" xmlns="http://camel.apache.org/schema/spring" <bean id="gribLayerCollector"
errorHandlerRef="errorHandler" class="com.raytheon.uf.edex.plugin.grib.ogc.GribLayerCollector"
autoStartup="false"> depends-on="registerDataDeliveryHandlers, registerRequestRegistryRouter">
<endpoint id="gribFileEndpoint" uri="file:${edex.home}/data/sbn/grib?noop=true&amp;idempotent=false" /> <constructor-arg ref="gribLayerTransformer" />
<route id="gribFileConsumerRoute"> </bean>
<from ref="gribFileEndpoint" />
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>grib</constant>
</setHeader>
<to uri="ingest-grib:queue:Ingest.Grib" />
</route>
<!-- Begin Grib Routes --> <camelContext id="grib-camel"
<route id="gribIngestRoute"> xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"
<from uri="ingest-grib:queue:Ingest.Grib?concurrentConsumers=4&amp;destinationResolver=#qpidDurableResolver" /> autoStartup="false">
<setHeader headerName="pluginName"> <endpoint id="gribFileEndpoint"
<constant>grib</constant> uri="file:${edex.home}/data/sbn/grib?noop=true&amp;idempotent=false" />
</setHeader> <route id="gribFileConsumerRoute">
<doTry> <from ref="gribFileEndpoint" />
<pipeline> <bean ref="fileToString" />
<bean ref="stringToFile" /> <setHeader headerName="pluginName">
<bean ref="largeFileChecker" /> <constant>grib</constant>
<bean ref="gribDecoder" method="decode" /> </setHeader>
<bean ref="gribPostProcessor" method="process" /> <to uri="ingest-grib:queue:Ingest.Grib" />
<bean ref="persist" method="persist" /> </route>
<bean ref="index" method="index" />
<bean ref="processUtil" method="log" />
<multicast parallelProcessing="false">
<bean ref="gribLayerCollector" method="add"/>
<to uri="directvm:gribIngestAlert"/>
</multicast>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:grib?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
<doFinally>
<bean ref="largeFileLockRelease" />
</doFinally>
</doTry>
</route>
<route id="gribIngestAlert"> <!-- Begin Grib Routes -->
<from uri="directvm:gribIngestAlert" /> <route id="gribIngestRoute">
<bean ref="toDataURI" method="toDataURI" /> <from
<to uri="vm:stageNotification" /> uri="ingest-grib:queue:Ingest.Grib?concurrentConsumers=4&amp;destinationResolver=#qpidDurableResolver" />
</route> <setHeader headerName="pluginName">
<constant>grib</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="largeFileChecker" />
<bean ref="gribDecoder" method="decode" />
<bean ref="gribPostProcessor" method="process" />
<bean ref="persist" method="persist" />
<bean ref="index" method="index" />
<bean ref="processUtil" method="log" />
<multicast parallelProcessing="false">
<bean ref="gribLayerCollector" method="add" />
<to uri="directvm:gribIngestAlert" />
</multicast>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to
uri="log:grib" />
</doCatch>
<doFinally>
<bean ref="largeFileLockRelease" />
</doFinally>
</doTry>
</route>
</camelContext> <route id="gribIngestAlert">
<from uri="directvm:gribIngestAlert" />
<bean ref="toDataURI" method="toDataURI" />
<to uri="vm:stageNotification" />
</route>
</camelContext>
</beans> </beans>

View file

@ -1,126 +1,133 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 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"> 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"> <bean id="registerDataDeliveryHandlers" class="java.lang.String">
<!-- required for depends-on --> <!-- required for depends-on -->
</bean> </bean>
<bean id="madisDecoder" class="com.raytheon.uf.edex.plugin.madis.MadisDecoder"> <bean id="madisDecoder" class="com.raytheon.uf.edex.plugin.madis.MadisDecoder">
<constructor-arg ref="madisPluginName" /> <constructor-arg ref="madisPluginName" />
</bean> </bean>
<bean id="jmsIngestMadisConfig" class="org.apache.camel.component.jms.JmsConfiguration" <bean id="jmsIngestMadisConfig" class="org.apache.camel.component.jms.JmsConfiguration"
factory-bean="jmsConfig" factory-method="copy"> factory-bean="jmsConfig" factory-method="copy">
</bean> </bean>
<bean id="madisThreadPool" <bean id="madisThreadPool"
class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor"> class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
<property name="corePoolSize" value="2" /> <property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="2" /> <property name="maxPoolSize" value="2" />
</bean> </bean>
<bean id="jms-madis" class="org.apache.camel.component.jms.JmsComponent"> <bean id="jms-madis" class="org.apache.camel.component.jms.JmsComponent">
<constructor-arg ref="jmsIngestMadisConfig" /> <constructor-arg ref="jmsIngestMadisConfig" />
<property name="taskExecutor" ref="madisThreadPool" /> <property name="taskExecutor" ref="madisThreadPool" />
</bean> </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"
<bean id="madisDistRegistry" factory-bean="distributionSrv" depends-on="registerMadisPlugin" />
factory-method="register">
<constructor-arg value="madis" /> <bean id="madisDistRegistry" factory-bean="distributionSrv"
<constructor-arg value="jms-dist:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" /> factory-method="register">
</bean> <constructor-arg value="madis" />
<constructor-arg
value="jms-dist:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
</bean>
<bean id="madisCamelRegistered" factory-bean="contextManager" <bean id="madisCamelRegistered" factory-bean="contextManager"
factory-method="register" factory-method="register" depends-on="persistCamelRegistered">
depends-on="persistCamelRegistered"> <constructor-arg ref="madis-camel" />
<constructor-arg ref="madis-camel"/> </bean>
</bean>
<bean id="madisLayerCollector" class="com.raytheon.uf.edex.plugin.madis.ogc.MadisLayerCollector" depends-on="registryManagerInstanceInitializer, 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" />
<!-- time in hours for orphan purging -->
<constructor-arg value="1" />
</bean>
<camelContext id="madis-camel"
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&amp;idempotent=false" />
<route id="madisFileConsumerRoute">
<from ref="madisFileEndpoint" />
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>madis</constant>
</setHeader>
<to uri="jms-generic:queue:Ingest.madis" />
</route>
<!-- Separates MADIS files into manageable chunks -->
<route id="madisSeperatorRoute">
<from uri="jms-generic:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
<setHeader headerName="pluginName">
<constant>madis</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="madisSeparator" method="separate" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:madis?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
<!-- Begin MADIS production route --> <bean id="madisLayerCollector"
<route id="madisIngestRoute"> class="com.raytheon.uf.edex.plugin.madis.ogc.MadisLayerCollector"
<from uri="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" /> depends-on="registerDataDeliveryHandlers, registerRequestRegistryRouter, registerMadisPlugin">
<setHeader headerName="pluginName"> <constructor-arg ref="madisLayerTransformer" />
<constant>madis</constant> </bean>
</setHeader>
<doTry> <bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator"
<pipeline> depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
<bean ref="madisDecoder" method="decode" /> <constructor-arg
<bean ref="madisLayerCollector" method="geoFilter"/> value="jms-madis:queue:Ingest.madisSeparator?destinationResolver=#qpidDurableResolver" />
<bean ref="madisPointData" method="toPointData" /> <!-- time in hours for orphan purging -->
<bean ref="madisLayerCollector" method="add"/> <constructor-arg value="1" />
<!-- we don't need to alert on DPA, just save --> </bean>
<to uri="direct-vm:persistIndex" />
</pipeline> <camelContext id="madis-camel"
<doCatch> xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"
<exception>java.lang.Throwable</exception> autoStartup="false">
<to uri="log:madis?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch> <!-- This first file drop route is used mainly for testing -->
</doTry> <endpoint id="madisFileEndpoint"
</route> uri="file:${edex.home}/data/sbn/madis?noop=true&amp;idempotent=false" />
<route id="madisFileConsumerRoute">
<route id="madisLayerRoute"> <from ref="madisFileEndpoint" />
<!-- send metadata to registry every minute --> <bean ref="fileToString" />
<from uri="quartz://madis/layers?cron=0+*+*+*+*+?" /> <setHeader headerName="pluginName">
<bean ref="madisLayerCollector" method="buildLayerUpdate" /> <constant>madis</constant>
</route> </setHeader>
<to uri="jms-generic:queue:Ingest.madis" />
<route id="madisOrphanPurgeRoute"> </route>
<!-- purge madis orphan files based on hour in separator constructor arg -->
<from uri="quartz://madis/orphan?cron=0+0+*+*+*+?" /> <!-- Separates MADIS files into manageable chunks -->
<bean ref="madisSeparator" method="fileCleaner" /> <route id="madisSeperatorRoute">
</route> <from
uri="jms-generic:queue:Ingest.madis?destinationResolver=#qpidDurableResolver" />
</camelContext> <setHeader headerName="pluginName">
<constant>madis</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="madisSeparator" method="separate" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to
uri="log:madis" />
</doCatch>
</doTry>
</route>
<!-- Begin MADIS production route -->
<route id="madisIngestRoute">
<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="madisPointData" method="toPointData" />
<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" />
</doCatch>
</doTry>
</route>
<route id="madisLayerRoute">
<!-- send metadata to registry every minute -->
<from uri="quartz://madis/layers?cron=0+*+*+*+*+?" />
<bean ref="madisLayerCollector" method="buildLayerUpdate" />
</route>
<route id="madisOrphanPurgeRoute">
<!-- 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>
</camelContext>
</beans> </beans>

View file

@ -23,7 +23,7 @@
<constructor-arg ref="obs-camel"/> <constructor-arg ref="obs-camel"/>
</bean> </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" /> <constructor-arg ref="metarLayerTransformer" />
</bean> </bean>
@ -61,7 +61,7 @@
</pipeline> </pipeline>
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>
<to uri="log:metar?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/> <to uri="log:metar"/>
</doCatch> </doCatch>
</doTry> </doTry>
</route> </route>

View file

@ -1,21 +1,36 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="edexRegistryManager" <bean id="edexRegistryManagerFactory"
class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager"> class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManagerFactory">
<property name="xacmlPep" ref="XACMLPolicyEnforcementPoint" /> <property name="queryManager" ref="queryServiceImpl" />
<property name="queryManager" ref="queryServiceImpl" /> <property name="lifecycleManager" ref="lcmServiceImpl" />
</bean> </bean>
<bean id="registryHandler" <bean id="registryHandler"
class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler"> class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
<property name="lcmFactory" ref="edexRegistryManager" /> <property name="lcmFactory" ref="edexRegistryManagerFactory" />
<property name="queryFactory" ref="edexRegistryManager" /> <property name="queryFactory" ref="edexRegistryManagerFactory" />
</bean> <property name="encoderStrategy" ref="registryEncoder" />
</bean>
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager"> <bean id="edexRegistryManager"
<constructor-arg ref="registryHandler" /> class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager">
</bean> <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> </beans>

View file

@ -1,132 +1,130 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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" <bean id="queryTypeManager"
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryTypeManager" /> class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryTypeManager" />
<bean <bean factory-bean="queryTypeManager" factory-method="addQueryTypes">
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <constructor-arg>
<property name="staticMethod" <util:list>
value="com.raytheon.uf.edex.registry.ebxml.services.query.QueryTypeManager.addQueryTypes" /> <ref bean="basicQuery" />
<property name="arguments"> <ref bean="adhocQuery" />
<list> <ref bean="classificationSchemeSelector" />
<ref bean="basicQuery" /> <ref bean="exportObject" />
<ref bean="adhocQuery" /> <ref bean="extrinsicObjectQuery" />
<ref bean="classificationSchemeSelector" /> <ref bean="findAllMyObjects" />
<ref bean="exportObject" /> <ref bean="findAssociatedObjects" />
<ref bean="extrinsicObjectQuery" /> <ref bean="findAssociations" />
<ref bean="findAllMyObjects" /> <ref bean="garbageCollector" />
<ref bean="findAssociatedObjects" /> <ref bean="getAuditTrailById" />
<ref bean="findAssociations" /> <ref bean="getAuditTrailByLid" />
<ref bean="garbageCollector" /> <ref bean="getAuditTrailByTimeInterval" />
<ref bean="getAuditTrailById" /> <ref bean="getNotification" />
<ref bean="getAuditTrailByLid" /> <ref bean="getChildrenByParentId" />
<ref bean="getAuditTrailByTimeInterval" /> <ref bean="getClassificationSchemesById" />
<ref bean="getNotification"/> <ref bean="getObjectById" />
<ref bean="getChildrenByParentId" /> <ref bean="getObjectsByLid" />
<ref bean="getClassificationSchemesById" /> <ref bean="getRegistryPackagesByMemberId" />
<ref bean="getObjectById" /> <ref bean="keywordSearch" />
<ref bean="getObjectsByLid" /> <ref bean="registryPackageSelector" />
<ref bean="getRegistryPackagesByMemberId" /> </util:list>
<ref bean="keywordSearch" /> </constructor-arg>
<ref bean="registryPackageSelector" /> </bean>
</list>
</property>
</bean>
<bean id="basicQuery" <bean id="basicQuery"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.BasicQuery"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.BasicQuery">
<property name="classificationDao" ref="classificationTypeDao" /> <property name="classificationDao" ref="classificationTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="adhocQuery" <bean id="adhocQuery"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.AdhocQuery"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.AdhocQuery">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="classificationSchemeSelector" <bean id="classificationSchemeSelector"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ClassificationSchemeSelector"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ClassificationSchemeSelector">
<property name="classificationSchemeTypeDao" ref="classificationSchemeTypeDao" /> <property name="classificationSchemeTypeDao" ref="classificationSchemeTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="exportObject" <bean id="exportObject"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ExportObject"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ExportObject">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="extrinsicObjectQuery" <bean id="extrinsicObjectQuery"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ExtrinsicObjectQuery"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.ExtrinsicObjectQuery">
<property name="basicQuery" ref="basicQuery" /> <property name="basicQuery" ref="basicQuery" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="findAllMyObjects" <bean id="findAllMyObjects"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAllMyObjects"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAllMyObjects">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="findAssociatedObjects" <bean id="findAssociatedObjects"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAssociatedObjects"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAssociatedObjects">
<property name="findAssociations" ref="findAssociations" /> <property name="findAssociations" ref="findAssociations" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="findAssociations" <bean id="findAssociations"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAssociations"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.FindAssociations">
<property name="classificationNodeDao" ref="classificationNodeDao" /> <property name="classificationNodeDao" ref="classificationNodeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="garbageCollector" <bean id="garbageCollector"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GarbageCollector"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GarbageCollector">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getAuditTrailById" <bean id="getAuditTrailById"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailById"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailById">
<property name="auditableEventDao" ref="AuditableEventTypeDao" /> <property name="auditableEventDao" ref="AuditableEventTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getAuditTrailByLid" <bean id="getAuditTrailByLid"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailByLid"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailByLid">
<property name="auditableEventDao" ref="AuditableEventTypeDao" /> <property name="auditableEventDao" ref="AuditableEventTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getAuditTrailByTimeInterval" <bean id="getAuditTrailByTimeInterval"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailByTimeInterval"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetAuditTrailByTimeInterval">
<property name="auditableEventDao" ref="AuditableEventTypeDao" /> <property name="auditableEventDao" ref="AuditableEventTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getNotification" <bean id="getNotification"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetNotification"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetNotification">
<property name="subscriptionManager" ref="RegistrySubscriptionManager" /> <property name="subscriptionManager" ref="RegistrySubscriptionManager" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
<property name="subscriptionDao" ref="subscriptionTypeDao"/> <property name="subscriptionDao" ref="subscriptionTypeDao" />
</bean> </bean>
<bean id="getChildrenByParentId" <bean id="getChildrenByParentId"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetChildrenByParentId"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetChildrenByParentId">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getClassificationSchemesById" <bean id="getClassificationSchemesById"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetClassificationSchemesById"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetClassificationSchemesById">
<property name="classificationSchemeTypeDao" ref="classificationSchemeTypeDao" /> <property name="classificationSchemeTypeDao" ref="classificationSchemeTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getObjectById" <bean id="getObjectById"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetObjectById"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetObjectById">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getObjectsByLid" <bean id="getObjectsByLid"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetObjectsByLid"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetObjectsByLid">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="getRegistryPackagesByMemberId" <bean id="getRegistryPackagesByMemberId"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetRegistryPackagesByMemberId"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.GetRegistryPackagesByMemberId">
<property name="registryPackageDao" ref="registryPackageTypeDao" /> <property name="registryPackageDao" ref="registryPackageTypeDao" />
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="keywordSearch" <bean id="keywordSearch"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.KeywordSearch"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.KeywordSearch">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
<bean id="registryPackageSelector" <bean id="registryPackageSelector"
class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.RegistryPackageSelector"> class="com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical.RegistryPackageSelector">
<property name="registryObjectDao" ref="registryObjectDao" /> <property name="registryObjectDao" ref="registryObjectDao" />
</bean> </bean>
</beans> </beans>

View file

@ -1,26 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<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>

View file

@ -6,7 +6,6 @@
<property name="lcm" ref="lcmServiceImpl" /> <property name="lcm" ref="lcmServiceImpl" />
<property name="dao" ref="registryObjectDao" /> <property name="dao" ref="registryObjectDao" />
<property name="sessionFactory" ref="metadataSessionFactory" /> <property name="sessionFactory" ref="metadataSessionFactory" />
<property name="txTemplate" ref="metadataTxTemplate"/>
</bean> </bean>
<bean id="ebxmlDbValidationStrategy" <bean id="ebxmlDbValidationStrategy"

View file

@ -45,12 +45,13 @@ import org.apache.commons.beanutils.PropertyUtils;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.jdbc.Work; 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.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; 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.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.raytheon.uf.common.localization.LocalizationFile; 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. * Apr 30, 2013 1960 djohnson Extend the generalized DbInit.
* 5/21/2013 2022 bphillip Using TransactionTemplate for database initialization * 5/21/2013 2022 bphillip Using TransactionTemplate for database initialization
* May 29, 2013 1650 djohnson Reference LifecycleManager as interface type. * 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> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
@Transactional
public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
ApplicationListener<ContextRefreshedEvent> { ApplicationListener<ContextRefreshedEvent>, ApplicationContextAware {
@VisibleForTesting @VisibleForTesting
static volatile boolean INITIALIZED = false; static volatile boolean INITIALIZED = false;
@ -108,8 +110,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
/** Hibernate session factory */ /** Hibernate session factory */
private SessionFactory sessionFactory; private SessionFactory sessionFactory;
/** Transaction template */ private ApplicationContext applicationContext;
private TransactionTemplate txTemplate;
/** /**
* Creates a new instance of DbInit. This constructor should only be called * Creates a new instance of DbInit. This constructor should only be called
@ -319,47 +320,42 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
} }
@Override @Override
@Transactional
public void onApplicationEvent(ContextRefreshedEvent event) { public void onApplicationEvent(ContextRefreshedEvent event) {
if (!INITIALIZED) { if (!INITIALIZED) {
txTemplate.execute(new TransactionCallbackWithoutResult() { // Must reference this bean through the proxy to get proper
@Override // transactional semantics, which requires going through the
protected void doInTransactionWithoutResult( // application context
TransactionStatus status) { final DbInit myself = applicationContext.getBean(DbInit.class);
try { try {
initDb(); myself.initDb();
} catch (Exception e) { } catch (Exception e) {
statusHandler.fatal( statusHandler.fatal("Error initializing EBXML database!", e);
"Error initializing EBXML database!", e); }
}
} myself.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()) {
listener.executeAfterRegistryInit();
}
} catch (Throwable t) {
throw new RuntimeException(
"Error initializing EBXML database!", t);
}
}
});
INITIALIZED = true; INITIALIZED = true;
} }
} }
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void postInitDb() {
statusHandler.info("Executing post initialization actions");
try {
Map<String, RegistryInitializedListener> beans = EDEXUtil
.getSpringContext().getBeansOfType(
RegistryInitializedListener.class);
for (RegistryInitializedListener listener : beans.values()) {
listener.executeAfterRegistryInit();
}
} catch (Throwable t) {
throw new RuntimeException(
"Error initializing EBXML database!", t);
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -384,7 +380,12 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
this.sessionFactory = sessionFactory; this.sessionFactory = sessionFactory;
} }
public void setTxTemplate(TransactionTemplate txTemplate) { /**
this.txTemplate = txTemplate; * {@inheritDoc}
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
} }
} }

View file

@ -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.ValidateObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse; import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.event.EventBus; 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 * 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 18, 2013 1693 djohnson Changes to conform to Ebxml 4.0 SubmitObjects protocol.
* Apr 24, 2013 1910 djohnson Use validation framework to check references. * Apr 24, 2013 1910 djohnson Use validation framework to check references.
* Jun 24, 2013 2106 djohnson Requires a transaction to already be open.
* *
* *
* </pre> * </pre>
@ -109,7 +111,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional @Transactional(propagation = Propagation.MANDATORY)
public class LifecycleManagerImpl implements LifecycleManager { public class LifecycleManagerImpl implements LifecycleManager {
/** The logger */ /** The logger */

View file

@ -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.RegistryResponseStatus;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; 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 * Jan 18, 2012 184 bphillip Initial creation
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection * 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
* Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum. * Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum.
* Jun 24, 2013 2106 djohnson Transaction must already be open.
* *
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional @Transactional(propagation = Propagation.MANDATORY)
public class QueryManagerImpl implements QueryManager { public class QueryManagerImpl implements QueryManager {
/** The logger */ /** The logger */
@ -138,7 +140,7 @@ public class QueryManagerImpl implements QueryManager {
* Executor service used to submit queries to federation members in parallel * Executor service used to submit queries to federation members in parallel
* during the processing of a federated query * during the processing of a federated query
*/ */
private ExecutorService queryExecutor; private final ExecutorService queryExecutor;
/** /**
* ObjectRef - This option specifies that the QueryResponse MUST contain a * 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> { private class RemoteRegistryQuery implements Callable<QueryResponse> {
/** The registry to query */ /** The registry to query */
private RegistryType registryToQuery; private final RegistryType registryToQuery;
/** The request to submit to the remote registry */ /** The request to submit to the remote registry */
private QueryRequest queryRequest; private final QueryRequest queryRequest;
/** /**
* Creates a new RemoteRegistryQuery. * Creates a new RemoteRegistryQuery.

View file

@ -34,6 +34,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.IRegistryQuery;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 18, 2012 184 bphillip Initial creation * Jan 18, 2012 184 bphillip Initial creation
* Jun 24, 2013 2106 djohnson Remove static use.
* *
* </pre> * </pre>
* *
@ -43,7 +44,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.IRegistryQuery;
public class QueryTypeManager { public class QueryTypeManager {
/** The query map */ /** 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 * Private constructor
@ -63,9 +64,10 @@ public class QueryTypeManager {
return queryTypeMap.get(queryDefinition); return queryTypeMap.get(queryDefinition);
} }
public static void addQueryTypes(IRegistryQuery... queries) { public Object addQueryTypes(IRegistryQuery... queries) {
for (IRegistryQuery query : queries) { for (IRegistryQuery query : queries) {
queryTypeMap.put(query.getQueryDefinition(), query); queryTypeMap.put(query.getQueryDefinition(), query);
} }
return null;
} }
} }

View file

@ -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.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.ErrorSeverity; 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 * 2/21/2012 #184 bphillip Initial creation
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection * 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
* 4/9/2013 1802 bphillip Refactor of registry query handling * 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> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional
public abstract class AbstractEbxmlQuery implements IRegistryQuery { public abstract class AbstractEbxmlQuery implements IRegistryQuery {
protected static final transient IUFStatusHandler statusHandler = UFStatus protected static final transient IUFStatusHandler statusHandler = UFStatus
@ -82,6 +83,8 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
protected RegistryObjectDao registryObjectDao; protected RegistryObjectDao registryObjectDao;
@Override
@Transactional(propagation = Propagation.MANDATORY)
public void executeQuery(QueryRequest queryRequest, public void executeQuery(QueryRequest queryRequest,
QueryResponse queryResponse, String client) QueryResponse queryResponse, String client)
throws EbxmlRegistryException { throws EbxmlRegistryException {
@ -228,4 +231,4 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
this.returnType = returnType; this.returnType = returnType;
} }
} }

View file

@ -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.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType; 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.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
@ -50,11 +47,11 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.CanonicalEbxmlQu
* Filter etc. * Filter etc.
* <p> * <p>
* <b>Parameter Summary:</b> <br> * <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 * language specified by the
* <p> * <p>
* · <b><i>queryLanguage</i></b> -- Value is the id of a ClassificationNode * <b><i>queryLanguage</i></b> -- Value is the id of a ClassificationNode within
* within the canonical QueryLanguageScheme ClassificationScheme. * the canonical QueryLanguageScheme ClassificationScheme.
* *
* queryLanguage parameter * queryLanguage parameter
* <p> * <p>
@ -67,15 +64,14 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.types.CanonicalEbxmlQu
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 18, 2012 bphillip Initial creation * Jan 18, 2012 bphillip Initial creation
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection * 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 * 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> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Service
@Transactional
public class AdhocQuery extends CanonicalEbxmlQuery { public class AdhocQuery extends CanonicalEbxmlQuery {
/** The list of valid parameters for this query */ /** The list of valid parameters for this query */

View file

@ -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.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao; import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -53,14 +51,14 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 18, 2012 bphillip Initial creation * Jan 18, 2012 bphillip Initial creation
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection * 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 * 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> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@Transactional
public class GetNotification extends CanonicalEbxmlQuery { public class GetNotification extends CanonicalEbxmlQuery {
/** The list of valid parameters for this query */ /** The list of valid parameters for this query */

View file

@ -2,26 +2,23 @@ package com.raytheon.uf.edex.registry.ebxml.util;
import java.util.List; 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.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.raytheon.uf.common.auth.exception.AuthorizationException; import com.raytheon.uf.common.auth.exception.AuthorizationException;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.registry.IRegistryRequest; 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.RegistryQuery;
import com.raytheon.uf.common.registry.RegistryResponse; 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.serialization.comm.response.ServerErrorResponse;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler; import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
import com.raytheon.uf.edex.auth.resp.AuthorizationResponse; import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyEnforcementPoint; 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 14, 2012 1169 djohnson Add use of create only mode.
* Sep 27, 2012 1187 djohnson Simplify the session management for a registry interaction. * 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 * 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> * </pre>
* *
@ -50,8 +48,7 @@ import com.raytheon.uf.edex.registry.acp.xacml.XACMLPolicyEnforcementPoint;
* @version 1.0 * @version 1.0
*/ */
public class EDEXRegistryManager extends public class EDEXRegistryManager extends
AbstractPrivilegedRequestHandler<IRegistryRequest<?>> implements AbstractPrivilegedRequestHandler<IRegistryRequest<?>> {
LifecycleManagerFactory, QueryManagerFactory {
@VisibleForTesting @VisibleForTesting
static IUFStatusHandler statusHandler = UFStatus static IUFStatusHandler statusHandler = UFStatus
@ -60,38 +57,9 @@ public class EDEXRegistryManager extends
@VisibleForTesting @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!"; 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 XACMLPolicyEnforcementPoint xacmlPep;
private QueryManager queryManager; private RegistryHandler registryHandler;
/**
* 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;
}
/** /**
* Handle the IRegistryRequests made to this Class from Thrift clients. * Handle the IRegistryRequests made to this Class from Thrift clients.
@ -112,6 +80,7 @@ public class EDEXRegistryManager extends
* @see ServerErrorResponse * @see ServerErrorResponse
*/ */
@Override @Override
@Transactional
public Object handleRequest(IRegistryRequest<?> request) throws Exception { public Object handleRequest(IRegistryRequest<?> request) throws Exception {
RegistryResponse<?> response = null; RegistryResponse<?> response = null;
RegistryQuery<?> query = request.getQuery(); RegistryQuery<?> query = request.getQuery();
@ -120,31 +89,30 @@ public class EDEXRegistryManager extends
switch (request.getAction()) { switch (request.getAction()) {
case QUERY: case QUERY:
response = RegistryManager.getRegistyObjects(query); response = registryHandler.getObjects(query);
break; break;
case REMOVE: case REMOVE:
if (query == null) { if (query == null) {
response = RegistryManager.removeRegistyObjects(username, response = registryHandler.removeObjects(username,
objects); objects);
} else if (username == null) { } else if (username == null) {
response = RegistryManager.removeRegistyObjects(query); response = registryHandler.removeObjects(query);
} else { } else {
response = RegistryManager response = registryHandler.removeObjects(username, query);
.removeRegistyObjects(username, query);
} }
break; break;
case STORE_OR_REPLACE: case STORE_OR_REPLACE:
if (objects.size() > 1) { if (objects.size() > 1) {
statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT); statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT);
} }
response = RegistryManager.storeOrReplaceRegistryObject(objects response = registryHandler.storeOrReplaceObject(objects
.get(0)); .get(0));
break; break;
case STORE: case STORE:
if (objects.size() > 1) { if (objects.size() > 1) {
statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT); statusHandler.error(CAN_ONLY_STORE_SINGLE_OBJECT);
} }
response = RegistryManager.storeRegistryObject(objects.get(0)); response = registryHandler.storeObject(objects.get(0));
break; break;
} }
@ -152,6 +120,7 @@ public class EDEXRegistryManager extends
} }
@Override @Override
@Transactional
public AuthorizationResponse authorized(IUser user, public AuthorizationResponse authorized(IUser user,
IRegistryRequest<?> request) throws AuthorizationException { IRegistryRequest<?> request) throws AuthorizationException {
return xacmlPep.handleRegistryRequest(user, request); return xacmlPep.handleRegistryRequest(user, request);
@ -161,8 +130,7 @@ public class EDEXRegistryManager extends
this.xacmlPep = xacmlPep; this.xacmlPep = xacmlPep;
} }
public void setQueryManager(QueryManager queryManager) { public void setRegistryHandler(RegistryHandler registryHandler) {
this.queryManager = queryManager; this.registryHandler = registryHandler;
} }
} }

View file

@ -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;
}
}

View file

@ -30,9 +30,10 @@
<target name="classpath-setup-developer" depends="env-setup" unless="jenkins.build"> <target name="classpath-setup-developer" depends="env-setup" unless="jenkins.build">
<path id="test.compile.classpath"> <path id="test.compile.classpath">
<dirset dir="${AWIPS2_BASELINE}" includes="**/bin" /> <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.junit" includes="**/*.jar" />
<fileset dir="${AWIPS2_BASELINE}/cots/org.springframework" 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" /> <fileset dir="${PROJECTS.DIR}/cots" includes="**/*.jar" />
<dirset dir="${PROJECTS.DIR}" includes="**/bin" /> <dirset dir="${PROJECTS.DIR}" includes="**/bin" />
<fileset dir="${basedir}/lib" includes="**/*.jar" /> <fileset dir="${basedir}/lib" includes="**/*.jar" />
@ -59,6 +60,7 @@
<fileset dir="${UNZIP.DIR}" includes="**/*.jar" excludes="**/ant-*.jar" /> <fileset dir="${UNZIP.DIR}" includes="**/*.jar" excludes="**/ant-*.jar" />
<fileset dir="${PROJECTS.DIR}/org.junit" includes="**/*.jar" /> <fileset dir="${PROJECTS.DIR}/org.junit" includes="**/*.jar" />
<fileset dir="${PROJECTS.DIR}/org.springframework" includes="**/*.jar" /> <fileset dir="${PROJECTS.DIR}/org.springframework" includes="**/*.jar" />
<fileset dir="${PROJECTS.DIR}/org.slf4j" includes="**/*.jar" />
<fileset dir="${basedir}/lib" includes="**/*.jar" /> <fileset dir="${basedir}/lib" includes="**/*.jar" />
</path> </path>

View file

@ -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);
}
}
}
}

View file

@ -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());
}
}

View file

@ -89,7 +89,6 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
SpringFiles.DATADELIVERY_HANDLERS_IMPL_XML, SpringFiles.EBXML_XML, SpringFiles.DATADELIVERY_HANDLERS_IMPL_XML, SpringFiles.EBXML_XML,
SpringFiles.EBXML_IMPL_XML, SpringFiles.EBXML_QUERYTYPES_XML, SpringFiles.EBXML_IMPL_XML, SpringFiles.EBXML_QUERYTYPES_XML,
SpringFiles.EBXML_REGISTRY_DAO_XML, SpringFiles.EBXML_REGISTRY_DAO_XML,
SpringFiles.EBXML_REGISTRY_ENCODER_XML,
SpringFiles.EBXML_WEBSERVICES_XML, SpringFiles.EBXML_XACML_XML, SpringFiles.EBXML_WEBSERVICES_XML, SpringFiles.EBXML_XACML_XML,
SpringFiles.EBXML_VALIDATOR_PLUGINS_XML, SpringFiles.EBXML_VALIDATOR_PLUGINS_XML,
SpringFiles.EBXML_SUBSCRIPTION_XML, SpringFiles.EVENTBUS_COMMON_XML, SpringFiles.EBXML_SUBSCRIPTION_XML, SpringFiles.EVENTBUS_COMMON_XML,

View file

@ -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.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -53,6 +54,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; 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.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes; import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.registry.constants.Namespaces; 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.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.util.SpringFiles; 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.MockNotificationListenerFactory;
import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotificationManager; import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotificationManager;
@ -72,7 +75,8 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotific
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 16, 2013 1672 djohnson Initial creation * Apr 16, 2013 1672 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Set explicitly non-transactional event bus handler.
* *
* </pre> * </pre>
* *
@ -94,6 +98,12 @@ public class RegistryNotificationManagerTest extends AbstractRegistryTest {
@Autowired @Autowired
private PluginSubscribedListener pluginSubscribedListener; private PluginSubscribedListener pluginSubscribedListener;
@BeforeClass
public static void classSetUp() {
EventBusTest
.useExplicitEventBusHandler(new NonTransactionalSynchronousEventBusHandler());
}
@Test @Test
public void webServiceDestinationIsNotifiedOnSubscribedObjectInsert() public void webServiceDestinationIsNotifiedOnSubscribedObjectInsert()
throws MsgRegistryException { throws MsgRegistryException {

View file

@ -19,10 +19,6 @@
<constructor-arg ref="bandwidthManager" /> <constructor-arg ref="bandwidthManager" />
</bean> </bean>
<bean id="registryManagerInstanceInitializer" class="java.lang.String">
<!-- required for depends-on -->
</bean>
<bean id="registerDataDeliveryHandlers" class="java.lang.String"> <bean id="registerDataDeliveryHandlers" class="java.lang.String">
<!-- required for depends-on --> <!-- required for depends-on -->
</bean> </bean>

View file

@ -15,7 +15,6 @@
<property name="lcm" ref="lcmServiceImpl" /> <property name="lcm" ref="lcmServiceImpl" />
<property name="dao" ref="registryObjectDao" /> <property name="dao" ref="registryObjectDao" />
<property name="sessionFactory" ref="metadataSessionFactory" /> <property name="sessionFactory" ref="metadataSessionFactory" />
<property name="txTemplate" ref="metadataTxTemplate"/>
</bean> </bean>
<bean id="ebxmlDbValidationStrategy" <bean id="ebxmlDbValidationStrategy"

View file

@ -30,6 +30,8 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData; 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.registry.ebxml.slots.DateSlotConverter;
import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
@ -45,6 +47,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2012 0743 djohnson Initial creation * Aug 15, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson IResultFormatter implementations now require an encoder passed to them.
* *
* </pre> * </pre>
* *
@ -65,7 +68,8 @@ public class DataSetMetaDataDatesQueryTest {
registryObject.setSlot(new HashSet<SlotType>(slots)); registryObject.setSlot(new HashSet<SlotType>(slots));
DataSetMetaDataDatesQuery query = new DataSetMetaDataDatesQuery(); DataSetMetaDataDatesQuery query = new DataSetMetaDataDatesQuery();
ImmutableDate result = query.decodeObject(registryObject); ImmutableDate result = query.decodeObject(registryObject,
RegistryEncoders.ofType(Type.JAXB));
assertEquals( assertEquals(
"The result from the query should have matched the initial date!", "The result from the query should have matched the initial date!",

View file

@ -36,12 +36,11 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition; import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest; 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; 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.GroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; 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.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionServiceHandler; 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 * Jan 18, 2013 1441 djohnson Initial creation
* Feb 26, 2013 1643 djohnson Change exception type thrown. * Feb 26, 2013 1643 djohnson Change exception type thrown.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* Jun 24, 2013 2106 djohnson RegistryManager is gone.
* *
* </pre> * </pre>
* *
@ -89,7 +89,6 @@ public class GroupDefinitionServiceTest {
@Before @Before
public void setUp() throws RegistryHandlerException { public void setUp() throws RegistryHandlerException {
RegistryObjectHandlersUtil.initMemory(); RegistryObjectHandlersUtil.initMemory();
RegistryManagerTest.setMockInstance();
subscriptionHandler = DataDeliveryHandlers.getSubscriptionHandler(); subscriptionHandler = DataDeliveryHandlers.getSubscriptionHandler();
groupHandler = DataDeliveryHandlers.getGroupDefinitionHandler(); groupHandler = DataDeliveryHandlers.getGroupDefinitionHandler();

View file

@ -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);
}
}

View file

@ -45,6 +45,7 @@ import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.registry.OperationStatus; import com.raytheon.uf.common.registry.OperationStatus;
import com.raytheon.uf.common.registry.RegistryResponse; import com.raytheon.uf.common.registry.RegistryResponse;
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage; 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;
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type; import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type;
import com.raytheon.uf.common.serialization.SerializationException; 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 * Jul 12, 2012 740 djohnson Initial creation
* Aug 15, 2012 0743 djohnson Type-safe result formatters. * Aug 15, 2012 0743 djohnson Type-safe result formatters.
* Sep 07, 2012 1102 djohnson Setup the registry encoder. * Sep 07, 2012 1102 djohnson Setup the registry encoder.
* Jun 24, 2013 2106 djohnson FactoryRegistryHandler now takes the encoder.
* </pre> * </pre>
* *
* @author djohnson * @author djohnson
@ -78,10 +80,14 @@ public class FactoryRegistryHandlerTest {
private static final CommunicationException COMMUNICATION_EXCEPTION = new CommunicationException( private static final CommunicationException COMMUNICATION_EXCEPTION = new CommunicationException(
RegistryErrorMessage.DATABASE_ERROR_MESSAGE); RegistryErrorMessage.DATABASE_ERROR_MESSAGE);
private static final IRegistryEncoder encoderStrategy = RegistryEncoders
.ofType(Type.DYNAMIC_SERIALIZE);
private static final FactoryRegistryHandler registryHandler = new FactoryRegistryHandler();
@BeforeClass @BeforeClass
public static void classSetup() { public static void classSetUp() {
RegistryUtilTest.setEncoderStrategy(RegistryEncoders registryHandler.setEncoderStrategy(encoderStrategy);
.ofType(Type.DYNAMIC_SERIALIZE));
} }
@After @After
@ -97,8 +103,8 @@ public class FactoryRegistryHandlerTest {
throw WEB_SERVICE_EXCEPTION; throw WEB_SERVICE_EXCEPTION;
} }
}; };
RegistryResponse<Object> response = new FactoryRegistryHandler() RegistryResponse<Object> response = registryHandler.processRequest(
.processRequest(callable, new RegistryResponse<Object>()); callable, new RegistryResponse<Object>());
assertEquals(OperationStatus.FAILED, response.getStatus()); assertEquals(OperationStatus.FAILED, response.getStatus());
} }
@ -110,8 +116,8 @@ public class FactoryRegistryHandlerTest {
throw WEB_SERVICE_EXCEPTION; throw WEB_SERVICE_EXCEPTION;
} }
}; };
RegistryResponse<Object> response = new FactoryRegistryHandler() RegistryResponse<Object> response = registryHandler.processRequest(
.processRequest(callable, new RegistryResponse<Object>()); callable, new RegistryResponse<Object>());
assertEquals(RegistryErrorMessage.UNABLE_TO_CONNECT_TO_REGISTRY, assertEquals(RegistryErrorMessage.UNABLE_TO_CONNECT_TO_REGISTRY,
response.getErrors().iterator().next().getMessage()); response.getErrors().iterator().next().getMessage());
} }
@ -124,8 +130,8 @@ public class FactoryRegistryHandlerTest {
throw COMMUNICATION_EXCEPTION; throw COMMUNICATION_EXCEPTION;
} }
}; };
RegistryResponse<Object> response = new FactoryRegistryHandler() RegistryResponse<Object> response = registryHandler.processRequest(
.processRequest(callable, new RegistryResponse<Object>()); callable, new RegistryResponse<Object>());
assertEquals(OperationStatus.FAILED, response.getStatus()); assertEquals(OperationStatus.FAILED, response.getStatus());
} }
@ -137,8 +143,8 @@ public class FactoryRegistryHandlerTest {
throw COMMUNICATION_EXCEPTION; throw COMMUNICATION_EXCEPTION;
} }
}; };
RegistryResponse<Object> response = new FactoryRegistryHandler() RegistryResponse<Object> response = registryHandler.processRequest(
.processRequest(callable, new RegistryResponse<Object>()); callable, new RegistryResponse<Object>());
assertEquals(RegistryErrorMessage.FAILED_TO_CONNECT_TO_DATABASE, assertEquals(RegistryErrorMessage.FAILED_TO_CONNECT_TO_DATABASE,
response.getErrors().iterator().next().getMessage()); response.getErrors().iterator().next().getMessage());
} }
@ -153,12 +159,12 @@ public class FactoryRegistryHandlerTest {
// Setup the encoded objects as if they were coming from the registry // Setup the encoded objects as if they were coming from the registry
for (int i = 0; i < registryObjectTypes.size(); i++) { for (int i = 0; i < registryObjectTypes.size(); i++) {
Set<SlotType> slotType = CollectionUtil.asSet(RegistryUtil Set<SlotType> slotType = CollectionUtil.asSet(encoderStrategy
.encodeObject(results[i])); .encodeObject(results[i]));
registryObjectTypes.get(i).setSlot(slotType); registryObjectTypes.get(i).setSlot(slotType);
} }
List<String> filteredResults = FactoryRegistryHandler.filterResults( List<String> filteredResults = registryHandler.filterResults(
new StringQueryNonFormatter(), registryObjectTypes); new StringQueryNonFormatter(), registryObjectTypes);
assertEquals("Incorrect number of results were returned!", assertEquals("Incorrect number of results were returned!",
results.length, filteredResults.size()); results.length, filteredResults.size());
@ -178,8 +184,8 @@ public class FactoryRegistryHandlerTest {
StringResultsQuery query = new StringResultsQuery(results); StringResultsQuery query = new StringResultsQuery(results);
List<String> filteredResults = FactoryRegistryHandler.filterResults( List<String> filteredResults = registryHandler.filterResults(query,
query, registryObjectTypes); registryObjectTypes);
assertEquals("Incorrect number of results were returned!", assertEquals("Incorrect number of results were returned!",
results.length, filteredResults.size()); results.length, filteredResults.size());
@ -202,8 +208,8 @@ public class FactoryRegistryHandlerTest {
StringArrayResultsQuery query = new StringArrayResultsQuery(results); StringArrayResultsQuery query = new StringArrayResultsQuery(results);
List<String> filteredResults = FactoryRegistryHandler.filterResults( List<String> filteredResults = registryHandler.filterResults(query,
query, registryObjectTypes); registryObjectTypes);
assertEquals("Incorrect number of results were returned!", 6, assertEquals("Incorrect number of results were returned!", 6,
filteredResults.size()); filteredResults.size());
@ -230,8 +236,8 @@ public class FactoryRegistryHandlerTest {
StringArrayResultsQuery query = new StringArrayResultsQuery(results); StringArrayResultsQuery query = new StringArrayResultsQuery(results);
List<String> filteredResults = FactoryRegistryHandler.filterResults( List<String> filteredResults = registryHandler.filterResults(query,
query, registryObjectTypes); registryObjectTypes);
assertEquals("Incorrect number of results were returned!", 6, assertEquals("Incorrect number of results were returned!", 6,
filteredResults.size()); filteredResults.size());

View file

@ -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.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.DataType; import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.registry.MockRegistryObject; 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;
import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type; import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type;
import com.raytheon.uf.common.serialization.SerializationException; 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 * Aug 22, 2012 0743 djohnson Initial creation
* Sep 07, 2012 1102 djohnson Setup the registry encoder. * Sep 07, 2012 1102 djohnson Setup the registry encoder.
* Jun 24, 2013 2106 djohnson RegistryUtil no longer holds the encoder instance.
* *
* </pre> * </pre>
* *
@ -55,22 +54,6 @@ import com.raytheon.uf.common.util.ReflectionException;
public class RegistryUtilTest { 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 @Test
public void newRegistryObjectCanConvertEnumValues() public void newRegistryObjectCanConvertEnumValues()
throws ReflectionException, SerializationException { throws ReflectionException, SerializationException {
@ -78,7 +61,8 @@ public class RegistryUtilTest {
registryObject.setDataType(DataType.GRID); registryObject.setDataType(DataType.GRID);
RegistryObjectType type = RegistryUtil RegistryObjectType type = RegistryUtil
.newRegistryObject(registryObject); .newRegistryObject(registryObject,
RegistryEncoders.ofType(Type.DYNAMIC_SERIALIZE));
SlotType slotToCheck = null; SlotType slotToCheck = null;
for (SlotType slot : type.getSlot()) { for (SlotType slot : type.getSlot()) {

View file

@ -23,10 +23,11 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; 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}. * 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2012 0743 djohnson Initial creation * Aug 15, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson IResultFormatter instances take the encoder as a method argument.
* *
* </pre> * </pre>
* *
@ -72,7 +74,9 @@ public class StringArrayResultsQuery extends AdhocRegistryQuery<String>
} }
@Override @Override
public Collection<String> decodeObject(RegistryObjectType registryObjectType) { public Collection<String> decodeObject(
RegistryObjectType registryObjectType,
IRegistryEncoder encoderStrategy) {
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<String>();
String[] valuesToReturn = resultsToReturn[index++]; String[] valuesToReturn = resultsToReturn[index++];

View file

@ -19,25 +19,27 @@
**/ **/
package com.raytheon.uf.common.registry.ebxml; 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 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> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2012 djohnson Initial creation * Aug 15, 2012 djohnson Initial creation
* * Jun 24, 2013 2106 djohnson IResultFormatter instances take the encoder as a method argument.
*
* </pre> * </pre>
* *
* @author djohnson * @author djohnson
* @version 1.0 * @version 1.0
*/ */
public class StringResultsQuery extends AdhocRegistryQuery<String> implements public class StringResultsQuery extends AdhocRegistryQuery<String> implements
@ -67,7 +69,8 @@ public class StringResultsQuery extends AdhocRegistryQuery<String> implements
} }
@Override @Override
public String decodeObject(RegistryObjectType registryObjectType) { public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoderStrategy) {
return resultsToReturn[index++]; return resultsToReturn[index++];
} }
} }

View file

@ -34,6 +34,7 @@ import org.junit.Ignore;
* Apr 23, 2013 1910 djohnson Add constants for ebxml spring files. * Apr 23, 2013 1910 djohnson Add constants for ebxml spring files.
* May 02, 2013 1910 djohnson Add validator plugins spring file. * May 02, 2013 1910 djohnson Add validator plugins spring file.
* May 28, 2013 1650 djohnson Add event bus spring files. * May 28, 2013 1650 djohnson Add event bus spring files.
* Jun 24, 2013 2106 djohnson Remove spring file.
* *
* </pre> * </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_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_REPLICATION_DATADELIVERY_WFO_XML = "/spring/registry-replication-datadelivery-wfo.xml";
public static final String EBXML_SUBSCRIPTION_XML = "/spring/ebxml-subscription.xml"; public static final String EBXML_SUBSCRIPTION_XML = "/spring/ebxml-subscription.xml";

View file

@ -67,7 +67,8 @@ import dods.dap.parser.ParseException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 09, 2013 1466 dhladky Unit test for NCOM * Jan 09, 2013 1466 dhladky Unit test for NCOM
* Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary. * Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary.
* Jun 24, 2013 2106 djohnson Use in-memory registry object handlers.
* *
* </pre> * </pre>
* *
@ -112,7 +113,7 @@ public class OpenDAPMetaDataParserNCOMTest {
TestUtil.readResource(OpenDAPMetaDataParserNCOMTest.class, DAS_FILE)); TestUtil.readResource(OpenDAPMetaDataParserNCOMTest.class, DAS_FILE));
DAS.parse(bis); DAS.parse(bis);
RegistryObjectHandlersUtil.init(); RegistryObjectHandlersUtil.initMemory();
} }
private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() { private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() {

View file

@ -76,6 +76,7 @@ import dods.dap.parser.ParseException;
* Oct 23, 2012 1286 djohnson Install test localization before each test. * Oct 23, 2012 1286 djohnson Install test localization before each test.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects. * Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary. * Feb 06, 2013 1543 djohnson Remove test setup methods no longer necessary.
* Jun 24, 2013 2106 djohnson Use in-memory registry object handlers.
* *
* </pre> * </pre>
* *
@ -120,7 +121,7 @@ public class OpenDAPMetaDataParserRAPTest {
TestUtil.readResource(OpenDAPMetaDataParserRAPTest.class, DAS_FILE)); TestUtil.readResource(OpenDAPMetaDataParserRAPTest.class, DAS_FILE));
DAS.parse(bis); DAS.parse(bis);
RegistryObjectHandlersUtil.init(); RegistryObjectHandlersUtil.initMemory();
} }
private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() { private final OpenDAPMetaDataParser parser = new OpenDAPMetaDataParser() {

View file

@ -28,10 +28,9 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData; import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture; 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; 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}. * Test {@link OpenDAPRetrievalGenerator}.
@ -44,7 +43,7 @@ import com.raytheon.uf.common.registry.RegistryManagerTest;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 23, 2012 955 djohnson Initial creation * Jul 23, 2012 955 djohnson Initial creation
* Aug 10, 2012 1022 djohnson Remove generics from {@link GriddedDataSetMetaData}. * 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. * Sep 24, 2012 1209 djohnson Test for NO_CYCLE metadatas and subscriptions.
* Oct 17, 2012 0726 djohnson Remove unused code. * Oct 17, 2012 0726 djohnson Remove unused code.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.

View file

@ -30,7 +30,7 @@ import org.junit.Test;
import com.raytheon.uf.common.registry.IRegistryRequest; import com.raytheon.uf.common.registry.IRegistryRequest;
import com.raytheon.uf.common.registry.IRegistryRequest.Action; 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; 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. * Sep 17, 2012 1169 djohnson Tests for more than one item provided to store/storeOrReplace.
* Oct 17, 2012 0726 djohnson Use {@link RegistryManagerTest#setMockInstance()}. * Oct 17, 2012 0726 djohnson Use {@link RegistryManagerTest#setMockInstance()}.
* Jun 24, 2013 2106 djohnson No more RegistryManager.
* *
* </pre> * </pre>
* *
@ -55,9 +56,11 @@ public class EDEXRegistryManagerTest {
private final IUFStatusHandler statusHandler = mock(IUFStatusHandler.class); private final IUFStatusHandler statusHandler = mock(IUFStatusHandler.class);
private final static EDEXRegistryManager edexRegistryManager = new EDEXRegistryManager();
@BeforeClass @BeforeClass
public static void classSetUp() { public static void classSetUp() {
RegistryManagerTest.setMockInstance(); edexRegistryManager.setRegistryHandler(mock(RegistryHandler.class));
} }
@Test @Test
@ -68,8 +71,7 @@ public class EDEXRegistryManagerTest {
request.setAction(Action.STORE); request.setAction(Action.STORE);
request.setObjects(Arrays.asList("one", "two")); request.setObjects(Arrays.asList("one", "two"));
new EDEXRegistryManager() edexRegistryManager.handleRequest(request);
.handleRequest(request);
verify(statusHandler).error( verify(statusHandler).error(
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT); EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
@ -84,8 +86,7 @@ public class EDEXRegistryManagerTest {
request.setAction(Action.STORE_OR_REPLACE); request.setAction(Action.STORE_OR_REPLACE);
request.setObjects(Arrays.asList("one", "two")); request.setObjects(Arrays.asList("one", "two"));
new EDEXRegistryManager() edexRegistryManager.handleRequest(request);
.handleRequest(request);
verify(statusHandler).error( verify(statusHandler).error(
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT); EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
@ -99,8 +100,7 @@ public class EDEXRegistryManagerTest {
request.setAction(Action.STORE); request.setAction(Action.STORE);
request.setObjects(Arrays.asList("one")); request.setObjects(Arrays.asList("one"));
new EDEXRegistryManager() edexRegistryManager.handleRequest(request);
.handleRequest(request);
verify(statusHandler, never()).error( verify(statusHandler, never()).error(
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT); EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
@ -114,8 +114,7 @@ public class EDEXRegistryManagerTest {
request.setAction(Action.STORE_OR_REPLACE); request.setAction(Action.STORE_OR_REPLACE);
request.setObjects(Arrays.asList("one")); request.setObjects(Arrays.asList("one"));
new EDEXRegistryManager() edexRegistryManager.handleRequest(request);
.handleRequest(request);
verify(statusHandler, never()).error( verify(statusHandler, never()).error(
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT); EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);
@ -129,8 +128,7 @@ public class EDEXRegistryManagerTest {
request.setAction(Action.REMOVE); request.setAction(Action.REMOVE);
request.setObjects(Arrays.asList("one", "two")); request.setObjects(Arrays.asList("one", "two"));
new EDEXRegistryManager() edexRegistryManager.handleRequest(request);
.handleRequest(request);
verify(statusHandler, never()).error( verify(statusHandler, never()).error(
EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT); EDEXRegistryManager.CAN_ONLY_STORE_SINGLE_OBJECT);