Issue #1692 Implemented/Verified Registry LifecycleManager

- Verified submitObjects protocol
            - Added unimplemented features of removeObjects protocol
            - Implemented updateObjects protocol
            - Refactored registry error reporting
            - Fixed JUnit tests
            - Corrected @XmlRootElement tag on registry objects
            - Added capability to modify registry objects using XPath

Change-Id: Id8eea47c3c4a1e39fe88cb17530e9e6cdacd7ce2

Former-commit-id: 2403f75262 [formerly 2403f75262 [formerly 94810246b449c64457c48684df72baf6e9e8b03d]]
Former-commit-id: 1390bd8a65
Former-commit-id: d9dffafa6f
This commit is contained in:
Benjamin Phillippe 2013-08-12 10:45:24 -05:00
parent 5dd5e0bf30
commit f2889110a7
119 changed files with 2334 additions and 838 deletions

View file

@ -30,4 +30,5 @@ Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
org.springframework;bundle-version="2.5.6",
org.apache.commons.lang;bundle-version="2.3.0",
org.apache.commons.cxf;bundle-version="1.0.0"
Import-Package: com.vividsolutions.jts.geom
Import-Package: com.sun.xml.bind.marshaller,
com.vividsolutions.jts.geom

View file

@ -0,0 +1,96 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
/**
*
* Jaxb Manager tailor for use specifically with registry objects. This jaxb
* manager uses a namespace mapper to correctly map registry object namespaces
* according to the spec
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 8/8/2013 1692 bphillip Initial implementation
* </pre>
*
* @author bphillip
* @version 1
*/
public class RegistryJaxbManager extends JAXBManager {
/** The namespace mapper property name on the marshaller */
private static final String NAMESPACE_PREFIX_MAPPER_PROPERTY = "com.sun.xml.bind.namespacePrefixMapper";
protected NamespacePrefixMapper namespaceMapper;
/**
* Creates a new RegistryJaxbManager. Hidden from public use
*
* @throws JAXBException
*/
protected RegistryJaxbManager() throws JAXBException {
super();
}
/**
* Creates a new RegistryJaxbManager with the given namespace mapper
*
* @param namespaceMapper
* The namespace mapper
* @param formattedOutput
* If the xml produced is formatted
* @throws JAXBException
* If errors occur creating the jaxb context
*/
public RegistryJaxbManager(RegistryNamespaceMapper namespaceMapper)
throws JAXBException {
super(
oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory.class,
oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory.class,
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory.class,
oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory.class,
com.raytheon.uf.common.registry.services.rest.response.RestCollectionResponse.class);
this.namespaceMapper = namespaceMapper;
}
@Override
protected Marshaller getMarshaller() throws JAXBException {
Marshaller m = marshallers.poll();
if (m == null) {
m = getJaxbContext().createMarshaller();
if (namespaceMapper != null) {
m.setProperty(NAMESPACE_PREFIX_MAPPER_PROPERTY, namespaceMapper);
}
}
return m;
}
}

View file

@ -0,0 +1,125 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
/**
*
* Namespace mapper to be used with the RegistryJaxbManager to correctly map
* registry namespaces
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 8/8/2013 1692 bphillip Initial implementation
* </pre>
*
* @author bphillip
* @version 1
*/
public class RegistryNamespaceMapper extends NamespacePrefixMapper implements
NamespaceContext {
/** Map which maps namespaceURIs to prefixes */
public static final Map<String, String> NAMESPACE_PREFIX_MAP = new HashMap<String, String>(
7);
/** Map which maps prefixes to namespaceURIs */
public static final Map<String, String> PREFIX_NAMESPACE_MAP = new HashMap<String, String>(
7);
static {
NAMESPACE_PREFIX_MAP.put("urn:oasis:names:tc:ebxml-regrep:xsd:rim:4.0",
"rim");
PREFIX_NAMESPACE_MAP.put("rim",
"urn:oasis:names:tc:ebxml-regrep:xsd:rim:4.0");
NAMESPACE_PREFIX_MAP.put("urn:oasis:names:tc:ebxml-regrep:xsd:lcm:4.0",
"lcm");
PREFIX_NAMESPACE_MAP.put("lcm",
"urn:oasis:names:tc:ebxml-regrep:xsd:lcm:4.0");
NAMESPACE_PREFIX_MAP.put("urn:oasis:names:tc:ebxml-regrep:xsd:spi:4.0",
"spi");
PREFIX_NAMESPACE_MAP.put("spi",
"urn:oasis:names:tc:ebxml-regrep:xsd:spi:4.0");
NAMESPACE_PREFIX_MAP.put(
"urn:oasis:names:tc:ebxml-regrep:xsd:query:4.0", "query");
PREFIX_NAMESPACE_MAP.put("query",
"urn:oasis:names:tc:ebxml-regrep:xsd:query:4.0");
NAMESPACE_PREFIX_MAP.put("urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0",
"rs");
PREFIX_NAMESPACE_MAP.put("rs",
"urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0");
NAMESPACE_PREFIX_MAP.put("http://www.w3.org/2005/08/addressing",
"addressing");
PREFIX_NAMESPACE_MAP.put("addressing",
"http://www.w3.org/2005/08/addressing");
NAMESPACE_PREFIX_MAP.put("http://www.w3.org/1999/xlink", "xlink");
PREFIX_NAMESPACE_MAP.put("xlink", "http://www.w3.org/1999/xlink");
}
/**
* Creates a new RegistryNamespaceMapper
*/
public RegistryNamespaceMapper() {
}
@Override
public String getPreferredPrefix(String namespaceURI, String suggestion,
boolean requirePrefix) {
String prefix = NAMESPACE_PREFIX_MAP.get(namespaceURI);
return prefix == null ? suggestion : prefix;
}
@Override
public String getNamespaceURI(String prefix) {
String namespaceURI = PREFIX_NAMESPACE_MAP.get(prefix);
return namespaceURI == null ? XMLConstants.NULL_NS_URI : namespaceURI;
}
@Override
public String getPrefix(String namespaceURI) {
throw new UnsupportedOperationException();
}
@Override
public Iterator getPrefixes(String namespaceURI) {
throw new UnsupportedOperationException();
}
}

View file

@ -35,12 +35,13 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.io.Resources;
import com.raytheon.uf.common.registry.RegistryJaxbManager;
import com.raytheon.uf.common.registry.RegistryNamespaceMapper;
import com.raytheon.uf.common.registry.constants.RegistryAvailability;
import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService;
import com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService;
import com.raytheon.uf.common.registry.services.rest.IRegistryObjectsRestService;
import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -110,6 +111,16 @@ public class RegistryRESTServices {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RegistryRESTServices.class);
private static RegistryJaxbManager jaxbManager;
static {
try {
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
} catch (JAXBException e) {
statusHandler.error("Error creating Registry jaxb manager!", e);
}
}
/**
* Gets the registry object rest service implementation
*
@ -146,13 +157,11 @@ public class RegistryRESTServices {
throws JAXBException, RegistryServiceException {
String objStr = getRegistryObjectService(baseURL).getRegistryObject(
objectId);
try {
return SerializationUtil.unmarshalFromXml(expectedType, objStr);
} catch (ClassCastException e) {
JAXBElement<RegistryObjectType> obj = (JAXBElement<RegistryObjectType>) SerializationUtil
.getJaxbManager().unmarshalFromXml(objStr);
return (T) obj.getValue();
Object retVal = jaxbManager.unmarshalFromXml(objStr);
if (retVal instanceof JAXBElement<?>) {
return (T) ((JAXBElement<?>) retVal).getValue();
}
return (T) jaxbManager.unmarshalFromXml(objStr);
}
/**
@ -259,8 +268,7 @@ public class RegistryRESTServices {
"Error accessing REST service at URL: [" + url + "]", e);
}
try {
return SerializationUtil.getJaxbManager()
.unmarshalFromXml(response);
return jaxbManager.unmarshalFromXml(response);
} catch (JAXBException e) {
throw new RegistryServiceException(
"Error unmarshalling xml response from REST Service at URL: ["

View file

@ -77,4 +77,12 @@ public class MsgRegistryException extends Exception {
return faultInfo;
}
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("REGISTRY EXCEPTION:\n");
builder.append("\t Message: ").append(this.getMessage()).append("\n");
builder.append(faultInfo.toString());
return builder.toString();
}
}

View file

@ -67,12 +67,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "UpdateAction")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UpdateActionType", propOrder = { "valueHolder", "selector" })
@DynamicSerialize
public class UpdateActionType {
public enum UPDATE_MODE {
Insert, Update, Delete
}
@XmlElement(name = "ValueHolder")
@DynamicSerializeElement
protected ValueType valueHolder;
@ -138,6 +142,10 @@ public class UpdateActionType {
return mode;
}
public UPDATE_MODE getUpdateMode() {
return UPDATE_MODE.valueOf(mode);
}
/**
* Sets the value of the mode property.
*
@ -149,4 +157,8 @@ public class UpdateActionType {
this.mode = value;
}
public void setUpdateMode(UPDATE_MODE mode) {
this.mode = mode.toString();
}
}

View file

@ -50,7 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "QueryException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QueryExceptionType")
@DynamicSerialize

View file

@ -61,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ResponseOption")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseOptionType")
@DynamicSerialize

View file

@ -71,7 +71,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Action")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ActionType", propOrder = { "affectedObjects",
"affectedObjectRefs" })

View file

@ -66,7 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@Entity
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@XmlRootElement
@XmlRootElement(name = "AnyValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AnyValueType", propOrder = { "anyValue" })
@DynamicSerialize

View file

@ -64,7 +64,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Association")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AssociationType")
@DynamicSerialize

View file

@ -72,7 +72,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "AuditableEvent")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuditableEventType", propOrder = { "action" })
@DynamicSerialize

View file

@ -61,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "BooleanValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BooleanValueType", propOrder = { "booleanValue" })
@DynamicSerialize

View file

@ -64,7 +64,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ClassificationNodeType")
@XmlRootElement
@XmlRootElement(name = "ClassificationNode")
@DynamicSerialize
@Entity
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)

View file

@ -60,7 +60,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ClassificationScheme")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ClassificationSchemeType")
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Classification")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ClassificationType")
@DynamicSerialize

View file

@ -70,7 +70,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "CollectionValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CollectionValueType", propOrder = { "collectionValue" })
@DynamicSerialize

View file

@ -56,7 +56,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Comment")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CommentType")
@DynamicSerialize

View file

@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "DateTimeValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DateTimeValueType", propOrder = { "dateTimeValue" })
@DynamicSerialize

View file

@ -72,7 +72,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "DeliveryInfo")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DeliveryInfoType")
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "DurationValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DurationValueType", propOrder = { "durationValue" })
@DynamicSerialize

View file

@ -64,7 +64,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "DynamicObjectRef")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DynamicObjectRefType", propOrder = { "query" })
@DynamicSerialize

View file

@ -64,7 +64,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "EmailAddress")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EmailAddressType")
@DynamicSerialize

View file

@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Entry")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EntryType", propOrder = { "entryKey", "entryValue" })
@DynamicSerialize

View file

@ -79,7 +79,7 @@ import com.raytheon.uf.common.status.UFStatus;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ExtensibleObject")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExtensibleObjectType", propOrder = { "slot" })
@XmlSeeAlso({ PostalAddressType.class, TelephoneNumberType.class,
@ -170,7 +170,7 @@ public abstract class ExtensibleObjectType {
public SlotType getSlotByName(String slotName) {
for (SlotType slot : getSlot()) {
if (slot.getName().equals(slotName)) {
if (slot.getName() != null && slot.getName().equals(slotName)) {
return slot;
}
}

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ExternalIdentifier")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExternalIdentifierType")
@DynamicSerialize

View file

@ -65,7 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ExternalIdentifier")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExternalLinkType", propOrder = { "externalRef" })
@DynamicSerialize

View file

@ -77,7 +77,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ExtrinsicObject")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExtrinsicObjectType", propOrder = { "contentVersionInfo",
"repositoryItemRef", "repositoryItem" })

View file

@ -58,12 +58,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Federation")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FederationType")
@DynamicSerialize
@Entity
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(schema = "ebxml", name = "Federation")
public class FederationType extends RegistryObjectType {

View file

@ -61,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "FloatValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FloatValueType", propOrder = { "floatValue" })
@DynamicSerialize

View file

@ -58,7 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "IdentifiableList")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IdentifiableListType", propOrder = { "identifiable" })
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Identifiable")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IdentifiableType")
@XmlSeeAlso({ RegistryObjectType.class })

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "IntegerValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IntegerValueType", propOrder = { "integerValue" })
@DynamicSerialize

View file

@ -75,7 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "InternationalString")
@XmlAccessorType(XmlAccessType.FIELD)
@DynamicSerialize
@XmlType(name = "InternationalStringType", propOrder = { "localizedString" })

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "InternationalStringValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InternationalStringValueType", propOrder = { "internationalStringValue" })
@DynamicSerialize

View file

@ -66,7 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "LocalizedString")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LocalizedStringType")
@DynamicSerialize

View file

@ -72,7 +72,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Map")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MapType", propOrder = { "entry" })
@DynamicSerialize

View file

@ -61,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@Entity
@Entity(name = "MapValue")
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)

View file

@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Notification")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NotificationType", propOrder = { "event" })
@DynamicSerialize

View file

@ -70,7 +70,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ObjectRefList")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ObjectRefListType", propOrder = { "objectRef" })
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ObjectRef")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ObjectRefType")
@XmlSeeAlso({ DynamicObjectRefType.class })

View file

@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Organization")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OrganizationType", propOrder = { "organization" })
@DynamicSerialize

View file

@ -78,7 +78,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Parameter")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ParameterType", propOrder = { "name", "description" })
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Party")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PartyType", propOrder = { "postalAddress", "telephoneNumber",
"emailAddress" })

View file

@ -61,12 +61,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "PersonName")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PersonNameType")
@DynamicSerialize
@Entity
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(schema = "ebxml", name = "PersonName")
public class PersonNameType extends ExtensibleObjectType implements
Serializable {

View file

@ -60,12 +60,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Person")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PersonType", propOrder = { "personName" })
@DynamicSerialize
@Entity
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(schema = "ebxml", name = "Person")
public class PersonType extends PartyType {

View file

@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "PostalAddress")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PostalAddressType")
@DynamicSerialize

View file

@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "QueryDefinition")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QueryDefinitionType", propOrder = { "parameter",
"queryExpression" })

View file

@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "QueryExpression")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QueryExpressionType")
@XmlSeeAlso({ StringQueryExpressionType.class, XMLQueryExpressionType.class })
@ -90,6 +90,15 @@ public class QueryExpressionType extends ExtensibleObjectType {
@RegistryObjectReference
protected String queryLanguage;
public QueryExpressionType() {
}
public QueryExpressionType(String queryLanguage) {
super();
this.queryLanguage = queryLanguage;
}
/**
* Gets the value of the queryLanguage property.
*

View file

@ -65,7 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Query")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QueryType")
@DynamicSerialize

View file

@ -71,7 +71,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "RegistryObjectList")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryObjectListType", propOrder = { "registryObject" })
@DynamicSerialize

View file

@ -63,12 +63,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "RegistryPackage")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryPackageType", propOrder = { "registryObjectList" })
@DynamicSerialize
@Entity
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(schema = "ebxml", name = "RegistryPackage")
public class RegistryPackageType extends RegistryObjectType {

View file

@ -74,7 +74,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Registry")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryType")
@DynamicSerialize

View file

@ -61,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Role")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RoleType")
@DynamicSerialize

View file

@ -59,7 +59,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ServiceBinding")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceBindingType")
@DynamicSerialize

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ServiceEndpoint")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceEndpointType")
@DynamicSerialize

View file

@ -58,7 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ServiceInterface")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceInterfaceType")
@DynamicSerialize

View file

@ -69,7 +69,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Service")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceType", propOrder = { "serviceEndpoint" })
@DynamicSerialize

View file

@ -68,7 +68,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "SimpleLink")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SimpleLinkType")
@DynamicSerialize

View file

@ -78,15 +78,11 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Slot")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SlotType", propOrder = { "slotValue" })
@DynamicSerialize
@Entity
// @AssociationOverride(name = "slot", joinTable = @JoinTable(name =
// "slot_join_slot", joinColumns = @JoinColumn(name = "parent_slot_key",
// referencedColumnName = "key"), inverseJoinColumns = @JoinColumn(name =
// "child_slot_key", referencedColumnName = "key")))
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all")
@Table(schema = "ebxml", name = "Slot")
public class SlotType extends ExtensibleObjectType implements

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "SlotValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SlotValueType", propOrder = { "slotValue" })
@DynamicSerialize

View file

@ -64,7 +64,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@Entity
@Table(schema = "ebxml", name = "StringQueryExpression")
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@XmlRootElement
@XmlRootElement(name = "StringQueryExpression")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StringQueryExpressionType", propOrder = { "value" })
@DynamicSerialize
@ -74,6 +74,15 @@ public class StringQueryExpressionType extends QueryExpressionType {
@DynamicSerializeElement
protected String value;
public StringQueryExpressionType() {
super();
}
public StringQueryExpressionType(String queryLanguage, String value) {
super(queryLanguage);
this.value = value;
}
/**
* Gets the value of the value property.
*

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "StringValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StringValueType", propOrder = { "stringValue" })
@DynamicSerialize

View file

@ -75,7 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Subscription")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SubscriptionType", propOrder = { "deliveryInfo", "selector" })
@DynamicSerialize

View file

@ -65,7 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "TaxonomyElement")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TaxonomyElementType", propOrder = { "classificationNode" })
@XmlSeeAlso({ ClassificationSchemeType.class, ClassificationNodeType.class })

View file

@ -65,7 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "TelephoneNumber")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TelephoneNumberType")
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "Value")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ValueType")
@XmlSeeAlso({ StringValueType.class, DateTimeValueType.class,

View file

@ -27,6 +27,7 @@ import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -56,6 +57,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*/
@Embeddable
@XmlRootElement(name = "VersionInfo")
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class VersionInfoType implements Serializable,

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "VocabularyTerm")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VocabularyTermType")
@DynamicSerialize

View file

@ -63,7 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "VocabularyTermValue")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VocabularyTermValueType", propOrder = { "vocabularyTermValue" })
@DynamicSerialize

View file

@ -59,12 +59,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "WorkflowAction")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WorkflowActionType")
@DynamicSerialize
@Entity
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(schema = "ebxml", name = "WorkflowAction")
public class WorkflowActionType extends RegistryObjectType {

View file

@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@Entity
@Table(schema = "ebxml", name = "XMLQueryExpression")
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@XmlRootElement
@XmlRootElement(name = "XMLQueryExpression")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "XMLQueryExpressionType", propOrder = { "any" })
@DynamicSerialize
@ -79,6 +79,15 @@ public class XMLQueryExpressionType extends QueryExpressionType {
@Type(type = "com.raytheon.uf.common.registry.schemas.ebxml.util.SerializedType")
protected Object any;
public XMLQueryExpressionType() {
super();
}
public XMLQueryExpressionType(String queryLanguage, Object any) {
super(queryLanguage);
this.any = any;
}
/**
* Gets the value of the any property.
*

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "AuthenticationException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuthenticationExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "AuthorizationException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuthorizationExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "InvalidRequestException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InvalidRequestExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ObjectExistsException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ObjectExistsExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ObjectNotFoundException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ObjectNotFoundExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "QuotaExceededException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QuotaExceededExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ReferencesExistException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ReferencesExistExceptionType")
@DynamicSerialize

View file

@ -62,7 +62,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "RegistryException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryExceptionType")
@XmlSeeAlso({ ObjectNotFoundExceptionType.class,
@ -184,17 +184,16 @@ public class RegistryExceptionType extends ExtensibleObjectType {
@Override
public String toString() {
StringBuilder strBuilder = new StringBuilder();
strBuilder.append("\n").append(this.getClass().getName()).append("\n");
if (code == null) {
strBuilder.append(" CODE: [").append("NONE SPECIFIED")
strBuilder.append("\t CODE: ").append("NONE SPECIFIED")
.append("]\n");
} else {
strBuilder.append(" CODE: [").append(code).append("]\n");
strBuilder.append("\t CODE: ").append(code).append("\n");
}
strBuilder.append("SEVERITY: [").append(severity).append("]\n");
strBuilder.append(" MESSAGE: [").append(message).append("]\n");
strBuilder.append(" DETAIL: [").append(detail).append("]\n");
strBuilder.append("\tSEVERITY: ").append(severity).append("\n");
strBuilder.append("\t MESSAGE: ").append(message).append("\n");
strBuilder.append("\t DETAIL: ").append(detail).append("\n");
return strBuilder.toString();
}

View file

@ -66,7 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "RegistryRequest")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryRequestType")
@XmlSeeAlso({ CatalogObjectsRequest.class, ValidateObjectsRequest.class,

View file

@ -75,7 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "RegistryResponse")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RegistryResponseType", propOrder = { "exception",
"registryObjectList", "objectRefList" })

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "TimeoutException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TimeoutExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "UnresolvedReferenceException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnresolvedReferenceExceptionType")
@DynamicSerialize

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "UnsupportedCapabilityException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnsupportedCapabilityExceptionType")
@DynamicSerialize

View file

@ -50,7 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "CatalogingException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CatalogingExceptionType")
@DynamicSerialize

View file

@ -50,7 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "FilteringException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FilteringExceptionType")
@DynamicSerialize

View file

@ -50,7 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
*
*/
@XmlRootElement
@XmlRootElement(name = "ValidationException")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ValidationExceptionType")
@DynamicSerialize

View file

@ -108,7 +108,7 @@ public class JAXBManager {
private final Queue<Unmarshaller> unmarshallers = new ConcurrentLinkedQueue<Unmarshaller>();
private final Queue<Marshaller> marshallers = new ConcurrentLinkedQueue<Marshaller>();
protected final Queue<Marshaller> marshallers = new ConcurrentLinkedQueue<Marshaller>();
public JAXBManager(Class<?>... clazz) throws JAXBException {
jaxbContext = JAXBContext.newInstance(clazz);
@ -138,7 +138,7 @@ public class JAXBManager {
return m;
}
private Marshaller getMarshaller() throws JAXBException {
protected Marshaller getMarshaller() throws JAXBException {
Marshaller m = marshallers.poll();
if (m == null) {
m = getJaxbContext().createMarshaller();

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.exception.NoReplicationServersAvailableException;
import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
/**
@ -112,6 +113,9 @@ public class NcfRegistryFederationManager extends RegistryFederationManager
replicationManager.submitRemoteSubscriptions(registry);
try {
replicationManager.checkDownTime();
} catch (NoReplicationServersAvailableException e) {
statusHandler
.warn("No replication servers have been specified!");
} catch (Exception e) {
throw new EbxmlRegistryException("Error checking down time!", e);
}

View file

@ -47,7 +47,6 @@ import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
@ -163,14 +162,6 @@ public abstract class RegistryFederationManager {
federationProperties = (FederationProperties) jaxbManager
.jaxbUnmarshalFromXmlFile(federationPropertiesFile);
}
if (this.replicationManager.getServers() == null
|| CollectionUtil.isNullOrEmpty(replicationManager
.getServers().getRegistryReplicationServers())) {
statusHandler
.warn("No servers configured for replication. Federation functionality is disabled");
this.federationEnabled = false;
this.replicationManager.setSubscriptionProcessingEnabled(false);
}
}
}

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
@ -117,7 +118,16 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
super(federationEnabled, lcm, federationPropertiesFileName,
replicationManager);
this.ncfAddress = ncfAddress;
scheduler = Executors.newSingleThreadScheduledExecutor();
if (this.replicationManager.getServers() == null
|| CollectionUtil.isNullOrEmpty(replicationManager.getServers()
.getRegistryReplicationServers())) {
statusHandler
.warn("No servers configured for replication. Federation functionality is disabled");
this.federationEnabled = false;
this.replicationManager.setSubscriptionProcessingEnabled(false);
} else {
scheduler = Executors.newSingleThreadScheduledExecutor();
}
}
@Override

View file

@ -79,6 +79,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistryMonitor;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.exception.NoReplicationServersAvailableException;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
/**
@ -240,7 +241,7 @@ public class RegistryReplicationManager {
// No available registry was found!
if (registryToSyncFrom == null) {
throw new EbxmlRegistryException(
throw new NoReplicationServersAvailableException(
"No available registries found! Registry data will not be synchronized with the federation!");
} else {
synchronizeRegistryWithFederation(registryToSyncFrom
@ -256,6 +257,11 @@ public class RegistryReplicationManager {
}
}
} catch (Exception e) {
// If no servers are found, don't retry, just throw the
// exception
if (e instanceof NoReplicationServersAvailableException) {
throw e;
}
if (syncAttempt < maxSyncRetries) {
statusHandler.error(
"Federation registry data synchronization attempt #"

View file

@ -33,7 +33,9 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
uk.ltd.getahead;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0",
javax.mail;bundle-version="1.0.0",
org.apache.commons.validator;bundle-version="1.2.0"
org.apache.commons.validator;bundle-version="1.2.0",
com.sun.xml.bind;bundle-version="1.0.0",
org.apache.commons.io;bundle-version="2.4.0"
Export-Package: com.raytheon.uf.edex.registry.ebxml.acp,
com.raytheon.uf.edex.registry.ebxml.dao,
com.raytheon.uf.edex.registry.ebxml.exception,
@ -50,4 +52,5 @@ Export-Package: com.raytheon.uf.edex.registry.ebxml.acp,
com.raytheon.uf.edex.registry.ebxml.services.validator,
com.raytheon.uf.edex.registry.ebxml.services.validator.types,
com.raytheon.uf.edex.registry.ebxml.util,
com.raytheon.uf.edex.registry.ebxml.util.xpath,
com.raytheon.uf.edex.registry.ebxml.web

View file

@ -45,5 +45,16 @@
<property name="dynamicRefDao" ref="dynamicObjectRefDao"/>
<property name="queryManager" ref="queryServiceImpl"/>
</bean>
<bean id="registryXpathProcessor" class="com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor">
<constructor-arg ref="registryJaxbManager"/>
<constructor-arg ref="registryNamespaceMapper"/>
</bean>
<bean id="registryJaxbManager" class="com.raytheon.uf.common.registry.RegistryJaxbManager">
<constructor-arg ref="registryNamespaceMapper"/>
</bean>
<bean id="registryNamespaceMapper" class="com.raytheon.uf.common.registry.RegistryNamespaceMapper"/>
</beans>

View file

@ -31,6 +31,7 @@
<property name="auditableEventService" ref="AuditableEventService" />
<property name="cataloger" ref="catalogerServiceImpl" />
<property name="referenceResolver" ref="objectReferenceResolver"/>
<property name="xpathProcessor" ref="registryXpathProcessor"/>
</bean>
<!-- VALIDATOR -->

View file

@ -24,6 +24,7 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
/**
@ -163,6 +164,13 @@ public class RegistryObjectDao extends
this.template.delete(obj);
}
public void deleteObjectWithoutDeletingChildren(RegistryObjectType obj)
throws DataAccessLayerException {
this.executeHQLStatement(
"DELETE FROM RegistryObjectType obj where obj.id=:id", "id",
obj.getId());
}
/**
* Retrieves all registry objects from the registry
*

View file

@ -19,11 +19,9 @@
**/
package com.raytheon.uf.edex.registry.ebxml.dao;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import org.hibernate.SessionFactory;
@ -32,7 +30,6 @@ import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Property;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
/**
@ -216,55 +213,6 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
return this.executeHQLQuery(str.toString());
}
/**
* Deletes objects based on the reference (id field)
*
* @param objRefs
* The objectRefs pointing to objects to be deleted
* @throws EbxmlRegistryException
* If the delete fails
*/
@SuppressWarnings("unchecked")
public void deleteByRefs(final List<ObjectRefType> objRefs)
throws EbxmlRegistryException {
// TODO: FIX THIS METHOD TO ELIMINATE CASTING OR MOVE IT ELSEWHERE
try {
List<String> objIds = new ArrayList<String>();
for (ObjectRefType ref : objRefs) {
objIds.add(ref.getId());
}
List<ENTITY> objs = getById(objIds);
for (RegistryObjectType regObj : objs) {
if (regObj.getClassification() != null) {
for (RegistryObjectType classification : regObj
.getClassification()) {
delete((ENTITY) classification);
}
}
}
for (RegistryObjectType regObj : objs) {
if (regObj.getExternalIdentifier() != null) {
for (RegistryObjectType extId : regObj
.getExternalIdentifier()) {
delete((ENTITY) extId);
}
}
}
for (RegistryObjectType regObj : objs) {
if (regObj.getExternalLink() != null) {
for (RegistryObjectType extLink : regObj.getExternalLink()) {
delete((ENTITY) extLink);
}
}
}
for (ENTITY obj : objs) {
delete(obj);
}
} catch (Throwable e) {
throw new EbxmlRegistryException("Error deleting objects", e);
}
}
/**
* Convenience method used by queries which return a single result. The
* method takes a list and returns null if the list is empty

View file

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

View file

@ -20,10 +20,7 @@
package com.raytheon.uf.edex.registry.ebxml.services.lifecycle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.xml.ws.WebServiceContext;
@ -33,33 +30,31 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryExceptio
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateActionType;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationSchemeType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtrinsicObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryExpressionType;
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.StringQueryExpressionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.InvalidRequestExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectExistsExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.registry.constants.DeletionScope;
import com.raytheon.uf.common.registry.constants.ErrorSeverity;
import com.raytheon.uf.common.registry.constants.QueryLanguages;
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes;
@ -70,8 +65,10 @@ import com.raytheon.uf.common.registry.event.RegistryStatisticsEvent;
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.AuditableEventService;
import com.raytheon.uf.edex.registry.ebxml.services.cataloger.CatalogerImpl;
@ -79,6 +76,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl;
import com.raytheon.uf.edex.registry.ebxml.services.validator.ValidatorImpl;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
import com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor;
/**
* The LifecycleManager interface allows a client to perform various lifecycle
@ -115,6 +113,12 @@ public class LifecycleManagerImpl implements LifecycleManager {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(LifecycleManagerImpl.class);
public static final String REMOVE_OBJECTS_ERROR_MSG = "Error removing objects";
public static final String SUBMIT_OBJECTS_ERROR_MSG = "Error submitting objects";
public static final String UPDATE_OBJECTS_ERROR_MSG = "Error updating objects";
@Resource
private WebServiceContext wsContext;
@ -124,6 +128,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
private QueryManagerImpl queryManager;
/** The validator */
@SuppressWarnings("unused")
private ValidatorImpl validator;
/** The cataloger */
@ -135,6 +140,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
private AuditableEventService auditableEventService;
private RegistryXPathProcessor xpathProcessor;
/**
* The Remove Objects protocol allows a client to remove or delete one or
* more RegistryObject instances from the server.
@ -148,7 +155,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
@Override
public RegistryResponseType removeObjects(RemoveObjectsRequest request)
throws MsgRegistryException {
long startTime = System.currentTimeMillis();
long startTime = TimeUtil.currentTimeMillis();
statusHandler
.info("LifecycleManager received removeObjectsRequest from ["
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
@ -158,121 +165,133 @@ public class LifecycleManagerImpl implements LifecycleManager {
response.setStatus(RegistryResponseStatus.SUCCESS);
boolean checkReferences = request.isCheckReferences();
if (checkReferences) {
response.getException()
.add(EbxmlExceptionUtil
.createRegistryException(
UnsupportedCapabilityExceptionType.class,
"",
"Checking references currently not supported",
"This EBXML registry currently does not support checking references when removing objects",
ErrorSeverity.WARNING, statusHandler));
response.setStatus(RegistryResponseStatus.PARTIAL_SUCCESS);
}
boolean deleteChildren = request.isDeleteChildren();
if (deleteChildren) {
response.getException()
.add(EbxmlExceptionUtil
.createRegistryException(
UnsupportedCapabilityExceptionType.class,
"",
"Deleting children currently not supported",
"This EBXML registry currently does not support deleting children when removing objects",
ErrorSeverity.WARNING, statusHandler));
response.setStatus(RegistryResponseStatus.PARTIAL_SUCCESS);
}
String deletionScope = request.getDeletionScope();
if (!deletionScope.equals(DeletionScope.DELETE_ALL)) {
response.getException()
.add(EbxmlExceptionUtil
.createRegistryException(
UnsupportedCapabilityExceptionType.class,
"",
"Deletion scope currently not supported",
"This EBXML registry currently does not support specification of the deletion scope",
ErrorSeverity.WARNING, statusHandler));
response.setStatus(RegistryResponseStatus.PARTIAL_SUCCESS);
/*
* Validate the deletion scope according to the spec: The value of the
* deletionScope attribute MUST be a reference to a ClassificationNode
* within the canonical DeletionScopeType ClassificationScheme as
* described in ebRIM. A server MUST support the deletionScope types as
* defined by the canonical DeletionScopeType ClassificationScheme. The
* canonical DeletionScopeType ClassificationScheme may be extended by
* adding additional ClassificationNodes to it.
*/
RegistryObjectType deleteScopeObj = registryObjectDao
.getById(deletionScope);
if (deleteScopeObj == null) {
throw EbxmlExceptionUtil.createQueryExceptionType(
REMOVE_OBJECTS_ERROR_MSG, "DeletionScope [" + deletionScope
+ "] does not exist in registry!");
}
List<ObjectRefType> objRefs = new ArrayList<ObjectRefType>();
List<RegistryObjectType> objRefTypes = new ArrayList<RegistryObjectType>();
List<RegistryObjectType> objectsToRemove = new ArrayList<RegistryObjectType>();
if (request.getObjectRefList() != null) {
objRefs.addAll(request.getObjectRefList().getObjectRef());
List<String> ids = new ArrayList<String>(objRefs.size());
// First Query for the Objects that are to be deleted byReference
// so that the proper notification message can be sent.
for (ObjectRefType o : objRefs) {
ids.add(o.getId());
}
try {
objRefTypes.addAll(registryObjectDao.getById(ids));
} catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil
.createMsgRegistryException(
"Error deleting objects from the registry",
RegistryObjectTypeDao.class,
"",
"Error deleting objects from the registry",
"There was an unexpected error encountered while querying objects to delete using object refs",
ErrorSeverity.ERROR, e, statusHandler);
if (request.getObjectRefList() != null
&& !CollectionUtil.isNullOrEmpty(request.getObjectRefList()
.getObjectRef())) {
for (ObjectRefType objectRef : request.getObjectRefList()
.getObjectRef()) {
RegistryObjectType objReferenced = registryObjectDao
.getById(objectRef.getId());
if (objReferenced == null) {
statusHandler.info("Object with id [" + objectRef.getId()
+ "] does not exist in the registry.");
} else {
objectsToRemove.add(objReferenced);
}
}
}
// TODO: Handle querying for objects to delete
QueryType query = request.getQuery();
if (query != null) {
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
.createResponseOptionType();
responseOption.setReturnType(QueryReturnTypes.OBJECT_REF);
ResponseOptionType responseOption = new ResponseOptionType(
QueryReturnTypes.REGISTRY_OBJECT, true);
QueryResponse queryResponse = queryManager.executeQuery(
responseOption, query);
if (queryResponse.getStatus()
.equals(RegistryResponseStatus.SUCCESS)
|| queryResponse.getStatus().equals(
RegistryResponseStatus.PARTIAL_SUCCESS)) {
.equals(RegistryResponseStatus.SUCCESS)) {
statusHandler.info("Remove objects query successful");
} else {
throw EbxmlExceptionUtil.createQueryExceptionType(
REMOVE_OBJECTS_ERROR_MSG,
"Remove objects query failed!");
}
if (CollectionUtil
.isNullOrEmpty(queryResponse.getRegistryObjects())) {
statusHandler
.info("No results returned from remove objects query");
} else {
statusHandler.info("Remove objects query returned "
+ queryResponse.getRegistryObjects() + " objects");
objectsToRemove.addAll(queryResponse.getRegistryObjects());
}
}
if (queryResponse.getObjectRefList() != null) {
objRefs.addAll(queryResponse.getObjectRefList().getObjectRef());
if (checkReferences) {
statusHandler
.info("Client has selected to check object references before removing objects.");
String message = referenceResolver
.allReferencesDoNotResolve(objectsToRemove);
if (!message.isEmpty()) {
throw EbxmlExceptionUtil.createReferencesExistExceptionType(
REMOVE_OBJECTS_ERROR_MSG, message);
}
}
try {
Map<String, List<ObjectRefType>> actionMap = new HashMap<String, List<ObjectRefType>>();
actionMap.put(ActionTypes.delete, objRefs);
auditableEventService.createAuditableEventFromRefs(request, null,
null, null, objRefs);
registryObjectDao.deleteByRefs(objRefs);
if (deletionScope.equals(DeletionScope.DELETE_ALL)) {
for (RegistryObjectType objToRemove : objectsToRemove) {
removeRepositoryItem(objToRemove);
if (deleteChildren) {
registryObjectDao.deleteWithoutMerge(objToRemove);
} else {
try {
registryObjectDao
.deleteObjectWithoutDeletingChildren(objToRemove);
} catch (DataAccessLayerException e) {
throw EbxmlExceptionUtil.createQueryExceptionType(
REMOVE_OBJECTS_ERROR_MSG,
"Error deleting object ["
+ objToRemove.getId() + "]"
+ e.getLocalizedMessage());
}
}
}
} else if (deletionScope
.equals(DeletionScope.DELETE_REPOSITORY_ITEM_ONLY)) {
for (RegistryObjectType objToRemove : objectsToRemove) {
removeRepositoryItem(objToRemove);
}
} else {
throw EbxmlExceptionUtil
.createUnsupportedCapabilityExceptionType(
REMOVE_OBJECTS_ERROR_MSG,
"Unsupported DeletionScope [" + deletionScope
+ "]");
}
auditableEventService.createAuditableEventFromObjects(request,
null, null, null, objectsToRemove);
} catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil
.createMsgRegistryException(
"Error deleting objects from the registry",
QueryExceptionType.class,
"",
"Error deleting objects from the registry",
"There was an unexpected error encountered while deleting objects using object refs",
ErrorSeverity.ERROR, e, statusHandler);
throw EbxmlExceptionUtil.createMsgRegistryException(
REMOVE_OBJECTS_ERROR_MSG, e);
}
long totalTime = System.currentTimeMillis() - startTime;
long avTimePerRecord = 0;
if (!objRefTypes.isEmpty()) {
avTimePerRecord = totalTime / objRefTypes.size();
if (!objectsToRemove.isEmpty()) {
avTimePerRecord = totalTime / objectsToRemove.size();
}
statusHandler
.info("LifeCycleManager removeObjects operation completed in "
+ totalTime + " ms");
for (RegistryObjectType obj : objRefTypes) {
for (RegistryObjectType obj : objectsToRemove) {
String objectType = obj.getObjectType();
// Don't send notifications for Association types
if (!objectType.equals(RegistryObjectTypes.ASSOCIATION)) {
if (objectType != null
&& !objectType.equals(RegistryObjectTypes.ASSOCIATION)) {
RemoveRegistryEvent event = new RemoveRegistryEvent(
request.getUsername(), obj.getId());
event.setAction(Action.DELETE);
@ -280,7 +299,6 @@ public class LifecycleManagerImpl implements LifecycleManager {
event.setObjectType(objectType);
EventBus.publish(event);
}
EventBus.publish(new RegistryStatisticsEvent(obj.getObjectType(),
obj.getStatus(), obj.getOwner(), avTimePerRecord));
}
@ -288,6 +306,25 @@ public class LifecycleManagerImpl implements LifecycleManager {
return response;
}
/**
* This method removes the repository item for the specified registry
* object.
* <p>
* This method will have to be expanded to handle remove objects that are
* linked to. Right now, the assumption is that the repository item is
* contained in the repositoryItem field of the object
*
* @param obj
*/
private void removeRepositoryItem(RegistryObjectType obj) {
if (obj instanceof ExtrinsicObjectType) {
ExtrinsicObjectType extrinsicObject = (ExtrinsicObjectType) obj;
extrinsicObject.setRepositoryItem(null);
registryObjectDao.update(obj);
}
}
/**
* The SubmitObjects protocol allows a client to submit RegistryObjects to
* the server. It also allows a client to completely replace existing
@ -306,10 +343,9 @@ public class LifecycleManagerImpl implements LifecycleManager {
statusHandler
.info("LifecycleManager received submitObjectsRequest from ["
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
long startTime = System.currentTimeMillis();
long startTime = TimeUtil.currentTimeMillis();
RegistryResponseType response = EbxmlObjectUtil.rsObjectFactory
.createRegistryResponseType();
RegistryResponseType response = new RegistryResponseType();
response.setStatus(RegistryResponseStatus.SUCCESS);
boolean checkReferences = request.isCheckReferences();
@ -327,23 +363,108 @@ public class LifecycleManagerImpl implements LifecycleManager {
if (checkReferences) {
statusHandler
.info("Client has selected to check object references before submitting objects.");
referenceResolver.checkReferences(objs);
String unresolvedReferencesMessage = referenceResolver
.allReferencesResolve(objs);
if (!unresolvedReferencesMessage.isEmpty()) {
throw EbxmlExceptionUtil
.createUnresolvedReferenceExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
unresolvedReferencesMessage);
}
}
if (submitMode.equals(Mode.CREATE_OR_REPLACE)
|| submitMode.equals(Mode.CREATE_OR_VERSION)
|| submitMode.equals(Mode.CREATE_ONLY)) {
processSubmit(request, response);
List<RegistryObjectType> objsCreated = new ArrayList<RegistryObjectType>();
List<RegistryObjectType> objsUpdated = new ArrayList<RegistryObjectType>();
for (RegistryObjectType obj : request.getRegistryObjectList()
.getRegistryObject()) {
String objectId = obj.getId();
final String objectLid = obj.getLid();
statusHandler.debug("Processing object [" + objectId + "]");
if (objectLid == null) {
throw EbxmlExceptionUtil.createInvalidRequestExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"LID MUST be specified by client");
}
if (obj instanceof TaxonomyElementType) {
generatePaths((TaxonomyElementType) obj, "");
}
RegistryObjectType existingObject = null;
switch (submitMode) {
case CREATE_OR_REPLACE:
if (objectId == null) {
throw EbxmlExceptionUtil.createInvalidRequestExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"ID MUST be specified by client");
}
existingObject = registryObjectDao.getById(objectId);
if (existingObject == null) {
objsCreated.add(obj);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
} else {
/*
* A server MUST NOT perform update operations via
* SubmitObjects and UpdateObjects operations on a local
* replica of a remote object. (Except in the case of
* updating objects from notifications)
*/
checkReplica(request, obj, existingObject);
objsUpdated.add(obj);
registryObjectDao.merge(obj, existingObject);
statusHandler.info("Object [" + objectId
+ "] replaced in the registry.");
}
break;
case CREATE_OR_VERSION:
for (RegistryObjectType objectGenerated : versionObject(obj,
objsCreated)) {
registryObjectDao.create(objectGenerated);
objsCreated.add(objectGenerated);
}
break;
case CREATE_ONLY:
if (registryObjectDao.lidExists(objectLid)) {
throw EbxmlExceptionUtil.createObjectExistsExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"Object already exists with lid: " + objectId
+ ". Cannot submit using CREATE_ONLY mode");
}
if (objectId == null) {
objectId = RegistryUtil.generateRegistryObjectId();
obj.setId(objectId);
} else if (registryObjectDao.idExists(objectId)) {
throw EbxmlExceptionUtil.createObjectExistsExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"Object already exists with id: " + objectId
+ ". Cannot submit using CREATE_ONLY mode");
}
objsCreated.add(obj);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
break;
}
}
if (response.getException().isEmpty()) {
statusHandler.info("Submit objects successful");
statusHandler.info("Creating auditable events....");
try {
auditableEventService.createAuditableEventFromObjects(request,
objsCreated, objsUpdated, null, null);
} catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException(
SUBMIT_OBJECTS_ERROR_MSG, e);
}
} else {
throw EbxmlExceptionUtil
.createMsgRegistryException(
"Error submitting",
UnsupportedCapabilityExceptionType.class,
"",
"Invalid submit mode: " + submitMode,
"Valid insert modes are: "
+ Arrays.toString(Mode.values()),
ErrorSeverity.ERROR, statusHandler);
statusHandler
.warn("Submit objects failed. Returning errors to client.");
}
response.setRequestId(request.getId());
@ -370,181 +491,79 @@ public class LifecycleManagerImpl implements LifecycleManager {
return response;
}
/**
*
* Submits objects to the registry
*
* @param request
* The submit objects request
* @param response
* The response object to update with any errors or warnings
* @throws MsgRegistryException
* If the submission process encounters errors
*/
private void processSubmit(SubmitObjectsRequest request,
RegistryResponseType response) throws MsgRegistryException {
private List<RegistryObjectType> versionObject(RegistryObjectType obj,
List<RegistryObjectType> objsCreated) throws MsgRegistryException {
List<RegistryObjectType> objectsGenerated = new ArrayList<RegistryObjectType>(
2);
String objectId = obj.getId();
String objectLid = obj.getLid();
RegistryObjectType existingObject = null;
List<RegistryObjectType> objsCreated = new ArrayList<RegistryObjectType>();
List<RegistryObjectType> objsUpdated = new ArrayList<RegistryObjectType>();
for (RegistryObjectType obj : request.getRegistryObjectList()
.getRegistryObject()) {
String objectId = obj.getId();
final String objectLid = obj.getLid();
statusHandler.debug("Processing object [" + objectId + "]");
if (objectLid == null) {
throw EbxmlExceptionUtil
.createInvalidRequestException("LID MUST be specified by client");
}
if (obj instanceof TaxonomyElementType) {
generatePaths((TaxonomyElementType) obj, "");
}
RegistryObjectType existingObject = null;
switch (request.getMode()) {
case CREATE_OR_REPLACE:
if (objectId == null) {
throw EbxmlExceptionUtil
.createInvalidRequestException("ID MUST be specified by client");
}
existingObject = registryObjectDao.getById(objectId);
if (existingObject == null) {
objsCreated.add(obj);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
} else {
/*
* A server MUST NOT perform update operations via
* SubmitObjects and UpdateObjects operations on a local
* replica of a remote object. (Except in the case of
* updating objects from notifications)
*/
checkReplica(request, obj, existingObject);
objsUpdated.add(obj);
registryObjectDao.merge(obj, existingObject);
statusHandler.info("Object [" + objectId
+ "] replaced in the registry.");
}
break;
case CREATE_OR_VERSION:
if (objectId == null) {
throw EbxmlExceptionUtil
.createInvalidRequestException("ID MUST be specified by client");
}
boolean idExists = registryObjectDao.idExists(objectId);
boolean lidExists = registryObjectDao.lidExists(objectLid);
/*
* If id does not exist and lid does not exist, server MUST
* create new object using the id (create)
*/
if (!idExists && !lidExists) {
objsCreated.add(obj);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
}
/*
* If id does not exist and lid exists server MUST throw
* InvalidRequestException
*/
else if (!idExists && lidExists) {
throw EbxmlExceptionUtil
.createInvalidRequestException("Specified object ID does not exist yet lid exists, unable to version");
}
/*
* If id exists, server MUST create a new version of existing
* object matching the id
*/
else if (idExists) {
existingObject = registryObjectDao.getById(objectId);
String nextVersion = registryObjectDao
.getNextVersion(existingObject);
obj.setVersionInfo(new VersionInfoType(nextVersion));
obj.setStatus(existingObject.getStatus());
obj.setId(existingObject.getId()
+ "_"
+ nextVersion.substring(nextVersion
.lastIndexOf(".") + 1));
AssociationType versionAssociation = EbxmlObjectUtil.rimObjectFactory
.createAssociationType();
String idUUID = EbxmlObjectUtil.getUUID();
versionAssociation.setId(idUUID);
versionAssociation.setLid(idUUID);
versionAssociation.setName(RegistryUtil
.getInternationalString("Version Association"));
versionAssociation.setDescription(RegistryUtil
.getInternationalString(objectId + " Supersedes "
+ existingObject.getId()));
versionAssociation.setOwner(existingObject.getOwner());
versionAssociation
.setObjectType(RegistryObjectTypes.ASSOCIATION);
versionAssociation.setSourceObject(objectId);
versionAssociation.setTargetObject(existingObject.getId());
versionAssociation.setStatus(StatusTypes.APPROVED);
versionAssociation.setType(AssociationTypes.SUPERSEDES);
versionAssociation.setVersionInfo(new VersionInfoType());
objsCreated.add(obj);
objsCreated.add(versionAssociation);
registryObjectDao.create(versionAssociation);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] versioned in the registry.");
}
break;
case CREATE_ONLY:
if (registryObjectDao.lidExists(objectLid)) {
throw EbxmlExceptionUtil
.createObjectExistsException("Object already exists with lid: "
+ objectId
+ ". Cannot submit using CREATE_ONLY mode");
}
if (objectId == null) {
objectId = RegistryUtil.generateRegistryObjectId();
} else {
if (registryObjectDao.idExists(objectId)) {
throw EbxmlExceptionUtil
.createObjectExistsException("Object already exists with id: "
+ objectId
+ ". Cannot submit using CREATE_ONLY mode");
} else {
objsCreated.add(obj);
registryObjectDao.create(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
}
}
break;
}
// TODO: Implement proper cataloging of objects according to EbXML
// spec
if (objectId == null) {
throw EbxmlExceptionUtil.createInvalidRequestExceptionType(
SUBMIT_OBJECTS_ERROR_MSG, "ID MUST be specified by client");
}
boolean idExists = registryObjectDao.idExists(objectId);
boolean lidExists = registryObjectDao.lidExists(objectLid);
if (response.getException().isEmpty()) {
statusHandler.info("Submit objects successful");
statusHandler.info("Creating auditable events....");
try {
auditableEventService.createAuditableEventFromObjects(request,
objsCreated, objsUpdated, null, null);
} catch (EbxmlRegistryException e) {
response.getException()
.add(EbxmlExceptionUtil
.createRegistryException(
RegistryExceptionType.class,
"",
"Error sending request to create auditable event",
"Error sending request to create auditable event",
ErrorSeverity.ERROR, e, statusHandler));
}
} else {
statusHandler
.warn("Submit objects failed. Returning errors to client.");
/*
* If id does not exist and lid does not exist, server MUST create new
* object using the id (create)
*/
if (!idExists && !lidExists) {
objsCreated.add(obj);
objectsGenerated.add(obj);
statusHandler.info("Object [" + objectId
+ "] created in the registry.");
}
/*
* If id does not exist and lid exists server MUST throw
* InvalidRequestException
*/
else if (!idExists && lidExists) {
throw EbxmlExceptionUtil
.createInvalidRequestExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"Specified object ID does not exist yet lid exists, unable to version");
}
/*
* If id exists, server MUST create a new version of existing object
* matching the id
*/
else if (idExists) {
existingObject = registryObjectDao.getById(objectId);
String nextVersion = registryObjectDao
.getNextVersion(existingObject);
obj.setVersionInfo(new VersionInfoType(nextVersion));
obj.setStatus(existingObject.getStatus());
obj.setId(existingObject.getId() + "_"
+ nextVersion.substring(nextVersion.lastIndexOf(".") + 1));
AssociationType versionAssociation = EbxmlObjectUtil.rimObjectFactory
.createAssociationType();
String idUUID = EbxmlObjectUtil.getUUID();
versionAssociation.setId(idUUID);
versionAssociation.setLid(idUUID);
versionAssociation.setName(RegistryUtil
.getInternationalString("Version Association"));
versionAssociation.setDescription(RegistryUtil
.getInternationalString(objectId + " Supersedes "
+ existingObject.getId()));
versionAssociation.setOwner(existingObject.getOwner());
versionAssociation.setObjectType(RegistryObjectTypes.ASSOCIATION);
versionAssociation.setSourceObject(objectId);
versionAssociation.setTargetObject(existingObject.getId());
versionAssociation.setStatus(StatusTypes.APPROVED);
versionAssociation.setType(AssociationTypes.SUPERSEDES);
versionAssociation.setVersionInfo(new VersionInfoType());
objsCreated.add(obj);
objsCreated.add(versionAssociation);
objectsGenerated.add(versionAssociation);
objectsGenerated.add(obj);
statusHandler.info("Object [" + objectId
+ "] versioned in the registry.");
}
return objectsGenerated;
}
/**
@ -574,31 +593,22 @@ public class LifecycleManagerImpl implements LifecycleManager {
return;
}
if (fromNotification) {
if (object1Home != null && object2Home == null) {
throw EbxmlExceptionUtil.createMsgRegistryException(
"Cannot overwrite local object with replica",
ObjectExistsExceptionType.class, "",
"Cannot overwrite local object with replica", "",
ErrorSeverity.ERROR, statusHandler);
throw EbxmlExceptionUtil.createObjectExistsExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"Cannot overwrite local object with replica");
} else if (object1Home != null && object2Home != null) {
if (!object1Home.equals(object2Home)) {
throw EbxmlExceptionUtil
.createMsgRegistryException(
"Cannot overwrite a remote replica from a different server",
ObjectExistsExceptionType.class,
"",
"Cannot overwrite a remote replica from a different server",
"", ErrorSeverity.ERROR, statusHandler);
.createObjectExistsExceptionType(
SUBMIT_OBJECTS_ERROR_MSG,
"Cannot overwrite a remote replica from a different server");
}
}
} else {
if (object2Home != null) {
throw EbxmlExceptionUtil.createMsgRegistryException(
"Cannot update replicas",
InvalidRequestExceptionType.class, "",
"Cannot update replicas", "", ErrorSeverity.ERROR,
statusHandler);
throw EbxmlExceptionUtil.createInvalidRequestExceptionType(
SUBMIT_OBJECTS_ERROR_MSG, "Cannot update replicas");
}
}
}
@ -630,13 +640,180 @@ public class LifecycleManagerImpl implements LifecycleManager {
@Override
public RegistryResponseType updateObjects(UpdateObjectsRequest request)
throws MsgRegistryException {
long startTime = TimeUtil.currentTimeMillis();
statusHandler.info("LifecycleManager received updateObjects from ["
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
throw EbxmlExceptionUtil.createMsgRegistryException(
"updateObjects not yet implemented",
UnsupportedCapabilityExceptionType.class, "",
"Unsupported Service", "Unsupported Service",
ErrorSeverity.ERROR, statusHandler);
RegistryResponseType response = new RegistryResponseType();
response.setStatus(RegistryResponseStatus.SUCCESS);
List<UpdateActionType> updateActions = request.getUpdateAction();
boolean checkReferences = request.isCheckReferences();
Mode mode = request.getMode();
List<RegistryObjectType> objectsToUpdate = new ArrayList<RegistryObjectType>();
if (request.getObjectRefList() != null
&& !CollectionUtil.isNullOrEmpty(request.getObjectRefList()
.getObjectRef())) {
for (ObjectRefType objectRef : request.getObjectRefList()
.getObjectRef()) {
RegistryObjectType objReferenced = registryObjectDao
.getById(objectRef.getId());
if (objReferenced == null) {
throw EbxmlExceptionUtil.createObjectNotFoundExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"Unable to update object [" + objectRef.getId()
+ "]. Not present in registry");
} else {
objectsToUpdate.add(objReferenced);
}
}
}
QueryType query = request.getQuery();
if (query != null) {
ResponseOptionType responseOption = new ResponseOptionType(
QueryReturnTypes.REGISTRY_OBJECT, true);
QueryResponse queryResponse = queryManager.executeQuery(
responseOption, query);
if (queryResponse.getStatus()
.equals(RegistryResponseStatus.SUCCESS)) {
statusHandler.info("Update objects query successful");
} else {
throw EbxmlExceptionUtil.createQueryExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"Update objects query failed!");
}
if (CollectionUtil
.isNullOrEmpty(queryResponse.getRegistryObjects())) {
statusHandler
.info("No results returned from update objects query");
} else {
statusHandler.info("Update objects query returned "
+ queryResponse.getRegistryObjects() + " objects");
objectsToUpdate.addAll(queryResponse.getRegistryObjects());
}
}
if (checkReferences) {
statusHandler
.info("Client has selected to check object references before submitting objects.");
String unresolvedReferencesMessage = referenceResolver
.allReferencesResolve(objectsToUpdate);
if (!unresolvedReferencesMessage.isEmpty()) {
throw EbxmlExceptionUtil
.createUnresolvedReferenceExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
unresolvedReferencesMessage);
}
}
// Refresh the list with the versionedObjects instead of the originals
// if CREATE_OR_VERSION mode is selected
if (mode.equals(Mode.CREATE_OR_VERSION)) {
List<RegistryObjectType> tempList = new ArrayList<RegistryObjectType>(
objectsToUpdate.size());
for (RegistryObjectType objectToUpdate : objectsToUpdate) {
List<RegistryObjectType> generatedObjects = versionObject(
objectToUpdate, new ArrayList<RegistryObjectType>());
for (RegistryObjectType generatedObject : generatedObjects) {
if (generatedObject instanceof AssociationType) {
// save the association
registryObjectDao.create(generatedObject);
} else {
tempList.add(generatedObject);
}
}
}
objectsToUpdate.clear();
objectsToUpdate.addAll(tempList);
}
for (RegistryObjectType objToUpdate : objectsToUpdate) {
statusHandler.info("Updating object: " + objToUpdate.getId()
+ "...");
RegistryObjectType updatedObject = applyUpdates(objToUpdate,
updateActions);
registryObjectDao.merge(updatedObject, objToUpdate);
}
try {
auditableEventService.createAuditableEventFromObjects(request,
null, objectsToUpdate, null, null);
} catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException(
UPDATE_OBJECTS_ERROR_MSG, e);
}
long totalTime = System.currentTimeMillis() - startTime;
statusHandler
.info("LifeCycleManager updateObjects operation completed in "
+ totalTime + " ms");
return response;
}
private RegistryObjectType applyUpdates(RegistryObjectType objectToUpdate,
List<UpdateActionType> updateActions) throws MsgRegistryException {
for (UpdateActionType updateAction : updateActions) {
QueryExpressionType selector = updateAction.getSelector();
String xpathExpression = null;
if (!selector.getQueryLanguage().equals(QueryLanguages.XPATH)) {
throw EbxmlExceptionUtil
.createUnsupportedCapabilityExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"This registry does not currently support "
+ selector.getQueryLanguage());
}
if (selector instanceof StringQueryExpressionType) {
xpathExpression = ((StringQueryExpressionType) selector)
.getValue();
} else {
throw EbxmlExceptionUtil
.createUnsupportedCapabilityExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"This registry currently only supports XPath embedded in StringQueryExpressionType objects");
}
try {
switch (updateAction.getUpdateMode()) {
case Insert:
if (updateAction.getValueHolder() == null) {
throw EbxmlExceptionUtil
.createRegistryExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"Update action mode of Insert must specify a value!");
}
objectToUpdate = (RegistryObjectType) xpathProcessor
.insert(objectToUpdate, xpathExpression,
updateAction.getValueHolder().getValue());
break;
case Update:
if (updateAction.getValueHolder() == null) {
throw EbxmlExceptionUtil
.createRegistryExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"Update action mode of Update must specify a value!");
}
objectToUpdate = (RegistryObjectType) xpathProcessor
.update(objectToUpdate, xpathExpression,
updateAction.getValueHolder().getValue());
break;
case Delete:
if (updateAction.getValueHolder() != null) {
throw EbxmlExceptionUtil
.createRegistryExceptionType(
UPDATE_OBJECTS_ERROR_MSG,
"Update action mode of Delete must NOT specify a value!");
}
objectToUpdate = (RegistryObjectType) xpathProcessor
.delete(objectToUpdate, xpathExpression);
break;
}
} catch (EbxmlRegistryException e) {
throw EbxmlExceptionUtil.createMsgRegistryException(
UPDATE_OBJECTS_ERROR_MSG, e);
}
}
return objectToUpdate;
}
public QueryManagerImpl getQueryManager() {
@ -668,4 +845,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
this.referenceResolver = referenceResolver;
}
public void setXpathProcessor(RegistryXPathProcessor xpathProcessor) {
this.xpathProcessor = xpathProcessor;
}
}

Some files were not shown because too many files have changed in this diff Show more