Issue #1738: Removed unused project com.raytheon.uf.edex.ebxml

Change-Id: I87783b45692c84cf851fb5695dae7efa79308655

Former-commit-id: fd5302a619 [formerly e0033900cf] [formerly fd5302a619 [formerly e0033900cf] [formerly e01ae283f7 [formerly 323bdc5919de9f04849e325dfdeb868ccdb39603]]]
Former-commit-id: e01ae283f7
Former-commit-id: 1314c47acf [formerly 3940bf0a6d]
Former-commit-id: 32a205e880
This commit is contained in:
Benjamin Phillippe 2013-02-28 14:59:39 -06:00
parent bc668bc828
commit b4fb275c29
44 changed files with 57 additions and 3503 deletions

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,8 +0,0 @@
#Tue Jan 24 11:57:43 CST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,11 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ebxml
Bundle-SymbolicName: com.raytheon.uf.edex.ebxml
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
org.apache.commons.beanutils;bundle-version="1.8.3",
org.apache.commons.cxf;bundle-version="1.0.0"

View file

@ -1,4 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -1,8 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.edex.ebxml">
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,16 +0,0 @@
package com.raytheon.uf.edex.ebxml.exception;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
public class QueryException extends RegistryException {
private static final long serialVersionUID = -3278994859030039974L;
public QueryException(RegistryExceptionType registryException) {
super(registryException);
}
public QueryException(String message, RegistryException e) {
super(message,e);
}
}

View file

@ -1,24 +0,0 @@
package com.raytheon.uf.edex.ebxml.exception;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
public class RegistryException extends Exception {
private static final long serialVersionUID = -7413493987092217686L;
private RegistryExceptionType registryException;
public RegistryException(RegistryExceptionType registryException) {
super(EbxmlUtil.translateException(registryException));
}
public RegistryException(String message, RegistryException e) {
super(message, e);
}
public RegistryExceptionType getRegistryException() {
return registryException;
}
}

View file

@ -1,100 +0,0 @@
/*
* The following software products were developed by Raytheon:
*
* ADE (AWIPS Development Environment) software
* CAVE (Common AWIPS Visualization Environment) software
* EDEX (Environmental Data Exchange) software
* uFrame (Universal Framework) software
*
* Copyright (c) 2010 Raytheon Co.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/epl-v10.php
*
*
* Contractor Name: Raytheon Company
* Contractor Address:
* 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2011 jsherida Initial creation
*
*/
package com.raytheon.uf.edex.ebxml.query;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import com.raytheon.uf.edex.ebxml.registry.IRegistry;
import com.raytheon.uf.edex.ebxml.registry.RegistryManager;
/**
* Handles query logic for "AdhocQuery" queries.
*
* @author jsherida
* @version 1.0
*/
public class AdhocQueryHandler implements IQueryHandler {
public static final String QUERY_DEFINITION = "urn:oasis:names:tc:ebxml-regrep:query:AdhocQuery";
/** {@inheritDoc} */
@Override
public String getQueryDefinition() {
return QUERY_DEFINITION;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.ebxml.query.IQueryHandler#handleQuery(oasis.names
* .tc.ebxml_regrep.xsd.rim._4.QueryType, boolean, java.lang.String, long,
* long, long, boolean)
*/
@Override
public List<RegistryObjectType> handleQuery(QueryType query,
boolean federated, String federation, long startIndex,
long maxResults, long depth, boolean matchOlderVersions)
throws IOException {
Map<String, List<Object>> parameters = new HashMap<String, List<Object>>();
Collection<SlotType> slots = query.getSlot();
for (SlotType slot : slots) {
String param = slot.getName();
List<Object> values = parameters.get(param);
if (values == null) {
values = new ArrayList<Object>();
parameters.put(param, values);
}
// if (IRegistry.QUERY_EXPR_PARAM.equals(param)
// || IRegistry.QUERY_LANG_PARAM.equals(param)) {
// String classValue = ((StringValueType)
// slot.getSlotValue()).getValue();
// values.add(classValue);
// }
}
IRegistry registry = RegistryManager.getRegistryInstance();
return registry.query(parameters, false, startIndex, maxResults, depth,
matchOlderVersions);
}
}

View file

@ -1,77 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.query;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import com.raytheon.uf.edex.ebxml.registry.IRegistry;
import com.raytheon.uf.edex.ebxml.registry.RegistryManager;
/**
* Handles query logic for "BasicQuery" queries.
*
* @author jsherida
*/
public class BasicQueryHandler implements IQueryHandler {
public static final String QUERY_DEFINITION = "urn:oasis:names:tc:ebxml-regrep:query:BasicQuery";
private static final List<String> BASIC_QUERY_PARAMETERS = new ArrayList<String>();
static {
BASIC_QUERY_PARAMETERS.add("name");
BASIC_QUERY_PARAMETERS.add("description");
BASIC_QUERY_PARAMETERS.add("type");
BASIC_QUERY_PARAMETERS.add("status");
BASIC_QUERY_PARAMETERS.add("classifications");
BASIC_QUERY_PARAMETERS.add("matchOnAnyParameter");
}
/** {@inheritDoc} */
@Override
public String getQueryDefinition() {
return QUERY_DEFINITION;
}
@Override
public List<RegistryObjectType> handleQuery(QueryType query,
boolean federated, String federation, long startIndex,
long maxResults, long depth, boolean matchOlderVersions)
throws IOException {
Map<String, List<Object>> baseParameters = new HashMap<String, List<Object>>();
Boolean matchAny = false;
Collection<SlotType> slots = query.getSlot();
for (SlotType slot : slots) {
String param = slot.getName();
if (BASIC_QUERY_PARAMETERS.contains(param)) {
if (param.equals("matchOnAnyParameter")) {
matchAny = true;
continue;
}
List<Object> values = baseParameters.get(param);
if (values == null) {
values = new ArrayList<Object>();
baseParameters.put(param, values);
}
values.add(((StringValueType) slot.getSlotValue()).getValue());
}
}
IRegistry registry = RegistryManager.getRegistryInstance();
return registry.query(baseParameters, matchAny, startIndex, maxResults,
depth, matchOlderVersions);
}
}

View file

@ -1,37 +0,0 @@
package com.raytheon.uf.edex.ebxml.query;
import java.io.IOException;
import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
/**
* Interface for objects that handle specific queries.
*
* @author jsherida
*/
public interface IQueryHandler {
/**
* Returns the definition string for the query that this handler handles.
*
* @return the definition string.
*/
public String getQueryDefinition();
/**
* Handle the given query.
*
* @param query
* The query.
* @return A list of {@link RegistryObjectType}s that correspond to the
* query, if applicable.
* @throws IOException
* if there was a problem contacting the registry.
*/
public List<RegistryObjectType> handleQuery(QueryType query, boolean federated,
String federation, long startIndex, long maxResults,
long depth, boolean matchOlderVersion) throws IOException;
}

View file

@ -1,99 +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.query;
import java.util.ArrayList;
import java.util.List;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 15, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public final class QueryParameters {
public static final List<String> QUERY_PARAM_NAMES;
/** "name" query parameter key. */
public static final String NAME_QUERY_PARAM = "name";
/** "description" query parameter key. */
public static final String DESC_QUERY_PARAM = "description";
/** "objectType" query parameter key. */
public static final String OBJ_TYPE_QUERY_PARAM = "objectType";
/** "status" query parameter key. */
public static final String STATUS_QUERY_PARAM = "status";
/** "versionName" query parameter key. */
public static final String VERSION_NAME_QUERY_PARAM = "versionName";
/** "userVersionName" query parameter key. */
public static final String USER_VERSION_NAME_QUERY_PARAM = "userVersionName";
/** "classificationNode" query parameter key. */
public static final String CLASS_NODE_QUERY_PARAM = "classificationNode";
/** "classifiedObject" query parameter key. */
public static final String CLASS_OBJECT_QUERY_PARAM = "classifiedObject";
/** "classificationScheme" query parameter key. */
public static final String CLASS_SCHEME_QUERY_PARAM = "classificationScheme";
/** "nodeRepresentation" query parameter key. */
public static final String CLASS_NODE_REP_QUERY_PARAM = "nodeRepresentation";
/** "lid" query parameter key. */
public static final String LID_QUERY_PARAM = "lid";
/** "owner" query parameter key. */
public static final String OWNER_QUERY_PARAM = "owner";
static{
QUERY_PARAM_NAMES = new ArrayList<String>();
QUERY_PARAM_NAMES.add(NAME_QUERY_PARAM);
QUERY_PARAM_NAMES.add(DESC_QUERY_PARAM);
QUERY_PARAM_NAMES.add(VERSION_NAME_QUERY_PARAM);
QUERY_PARAM_NAMES.add(USER_VERSION_NAME_QUERY_PARAM);
QUERY_PARAM_NAMES.add(CLASS_NODE_QUERY_PARAM);
QUERY_PARAM_NAMES.add(CLASS_OBJECT_QUERY_PARAM);
QUERY_PARAM_NAMES.add(CLASS_SCHEME_QUERY_PARAM);
QUERY_PARAM_NAMES.add(CLASS_NODE_REP_QUERY_PARAM);
QUERY_PARAM_NAMES.add(LID_QUERY_PARAM);
QUERY_PARAM_NAMES.add(OBJ_TYPE_QUERY_PARAM);
QUERY_PARAM_NAMES.add(OWNER_QUERY_PARAM);
QUERY_PARAM_NAMES.add(STATUS_QUERY_PARAM);
}
/** "matchOnAnyParameter" query parameter key. */
public static final String MATCH_ANY_QUERY_PARAM = "matchOnAnyParameter";
/** "queryExpression" query parameter key. */
public static final String QUERY_EXPR_PARAM = "queryExpression";
/** "queryLanguage" query parameter key. */
public static final String QUERY_LANG_PARAM = "queryLanguage";
}

View file

@ -1,16 +0,0 @@
package com.raytheon.uf.edex.ebxml.query.matcher;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
public class AndMatcher extends CompositeMatcher {
@Override
public boolean matches(RegistryObjectType obj) {
boolean isMatch = (matchers.size() > 0);
for (IMatcher matcher : matchers) {
isMatch = isMatch && matcher.matches(obj);
}
return isMatch;
}
}

View file

@ -1,13 +0,0 @@
package com.raytheon.uf.edex.ebxml.query.matcher;
import java.util.ArrayList;
import java.util.List;
public abstract class CompositeMatcher implements IMatcher {
protected final List<IMatcher> matchers = new ArrayList<IMatcher>();
public void add(IMatcher matcher) {
matchers.add(matcher);
}
}

View file

@ -1,19 +0,0 @@
package com.raytheon.uf.edex.ebxml.query.matcher;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
/**
* Interface for containing the logic to match a query parameter's
* value to a RegistryObject.
* @author jsherida
*/
public interface IMatcher {
/**
* Does the specified value match the given RegistryObject?
* @param obj The RegistryObject to check the value against.
* @return true if the RegistryObject matches has the value.
*/
public boolean matches(RegistryObjectType obj);
}

View file

@ -1,15 +0,0 @@
package com.raytheon.uf.edex.ebxml.query.matcher;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
public class OrMatcher extends CompositeMatcher {
@Override
public boolean matches(RegistryObjectType obj) {
boolean isMatch = false;
for (IMatcher matcher : matchers) {
isMatch = isMatch || matcher.matches(obj);
}
return isMatch;
}
}

View file

@ -1,120 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.registry;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateActionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
/**
* Registry interface with functions for manipulating and querying a registry.
*
* @author jsherida
*/
public interface IRegistry {
/**
* Initialize the registry object.
*/
public void init();
/**
* Store the given {@link RegistryObjectType}s in the registry.
*
* @param objs
* The list of registry objects to store.
* @return A {@link RegistryExceptionType} if there was a problem.
*/
public RegistryExceptionType create(List<RegistryObjectType> objs);
/**
* Update the given {@link RegistryObjectType}s in the registry.
*
* @param objs
* The list of registry objects to update.
* @return A {@link RegistryExceptionType} if there was a problem.
*/
public RegistryExceptionType replace(List<RegistryObjectType> objs);
/**
* Store new versions of the given {@link RegistryObjectType}s in the
* registry.
*
* @param objs
* The list of registry objects to store.
* @return A {@link RegistryExceptionType} if there was a problem.
*/
public RegistryExceptionType version(List<RegistryObjectType> objs);
/**
* Remove the given {@link ObjectRefType}s from the registry.
*
* @param refs
* The list of registry objects to remove.
* @return A {@link RegistryExceptionType} if there was a problem.
*/
public RegistryExceptionType remove(List<ObjectRefType> refs);
/**
* Updates the give {@link ObjectRefType}s from the registry
*
* @param refs
* The list of registry objects to update according to the update
* actions
* @param updateActions
* The actions to perform on the registry objects provided
* @param mode
* The {@link Mode} to use for updating data
* @return A {@link RegistryExceptionType} if there was a problem
*/
public RegistryExceptionType update(List<ObjectRefType> refs,
List<UpdateActionType> updateActions, Mode mode);
/**
* Check the registry to see if it contains the given ID.
*
* @param id
* The ID
* @return True if the ID is in the registry.
* @throws IOException
* if there was a problem.
*/
public boolean containsId(String id) throws IOException;
/**
* Check the registry to see if it contains the given LID.
*
* @param id
* The LID
* @return True if the LID is in the registry.
* @throws IOException
* if there was a problem.
*/
public boolean containsLid(String lid) throws IOException;
/**
* Query the registry for Registry Objects matching the given parameters.
*
* @param parameters
* A map of parameter name to a list containing one or more
* values for that parameter. If there is more than one value, it
* is assumed they will be matched with a logical AND.
* @param matchAny
* If true, match each parameter to the object with logical OR.
* If false, use logical AND.
* @return A non-null list of RegistryObjects matching the parameters.
* @throws IOException
* if there is a problem retrieving information from registry
*/
public List<RegistryObjectType> query(Map<String, List<Object>> parameters,
boolean matchAny, long startIndex, long maxResults,
long depth, boolean matchOlderVersions) throws IOException;
}

View file

@ -1,33 +0,0 @@
package com.raytheon.uf.edex.ebxml.registry;
import com.raytheon.uf.edex.ebxml.registry.memory.MemoryRegistery;
public class RegistryManager {
/** The singleton {@link IRegistry} instance. */
protected static IRegistry registry = null;
/**
* If not already initialized, this retrieves an {@link IRegistry} instance
* based on a configuration file. The object must have a default constructor
* and will be initialized with {@link IRegistry#init()}.
*
* @return The {@link IRegistry} instance.
*/
public static synchronized IRegistry getRegistryInstance() {
if (registry == null){
registry = new MemoryRegistery();
}
return registry;
}
/**
* Throw an {@link IllegalStateException} using the given error.
*
* @param e
* an {@link Exception}.
*/
private static void error(Exception e) {
throw new IllegalStateException("Could not initialize registry", e);
}
}

View file

@ -1,400 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.registry.memory;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateActionType;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringQueryExpressionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.InvalidRequestExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectNotFoundExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.ebxml.query.matcher.AndMatcher;
import com.raytheon.uf.edex.ebxml.query.matcher.CompositeMatcher;
import com.raytheon.uf.edex.ebxml.query.matcher.OrMatcher;
import com.raytheon.uf.edex.ebxml.registry.IRegistry;
import com.raytheon.uf.edex.ebxml.registry.memory.matchers.MatcherManager;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
/**
* Basic implementation of an {@link IRegistry}. Stores data in a map structure
* and has no persistence.
*
* @author jsherida
*/
public class MemoryRegistery implements IRegistry {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(MemoryRegistery.class);
private static final List<String> SUPPORTED_QUERY_LANGUAGES = new ArrayList<String>();
static {
SUPPORTED_QUERY_LANGUAGES.add("XPath");
}
private oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory queryFactory = new oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory();
private oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
/** Map<LID, RegistryObject version tree> */
private final Map<String, RegistryVersionNode> registry;
/** Map of IDs to LIDs. Tells which LID an ID is in. */
private final Map<String, String> ids;
/** Private default constructor. */
public MemoryRegistery() {
registry = new HashMap<String, RegistryVersionNode>();
ids = new HashMap<String, String>();
}
/** {@inheritDoc} */
@Override
public void init() {
// Do nothing.
}
/** {@inheritDoc} */
@Override
public synchronized RegistryExceptionType create(
List<RegistryObjectType> objs) {
return putObject(objs);
}
/** {@inheritDoc} */
@Override
public synchronized RegistryExceptionType replace(
List<RegistryObjectType> objs) {
return putObject(objs);
}
/** {@inheritDoc} */
@Override
public synchronized RegistryExceptionType version(
List<RegistryObjectType> objs) {
for (RegistryObjectType obj : objs) {
String lid = obj.getLid();
String id = obj.getId();
RegistryVersionNode node = registry.get(lid);
if (node == null) {
registry.put(lid, new RegistryVersionNode(obj));
} else {
node.addVersion(obj);
}
ids.put(id, lid);
}
return null;
}
/** {@inheritDoc} */
@Override
public synchronized RegistryExceptionType remove(List<ObjectRefType> refs) {
for (ObjectRefType ref : refs) {
String id = ref.getId();
String lid = ids.get(id);
// TODO Remove specific version?
registry.remove(lid);
ids.remove(id);
}
return null;
}
/**
* Puts the RegistryObject into the registry.
*
* @param objs
* the RegistryObject
*/
private RegistryExceptionType putObject(List<RegistryObjectType> objs) {
for (RegistryObjectType obj : objs) {
String lid = obj.getLid();
String id = obj.getId();
RegistryVersionNode node = registry.get(lid);
if (node == null) {
registry.put(lid, new RegistryVersionNode(obj));
} else {
RegistryVersionNode version = node.getObject(id);
version.setObject(obj);
}
ids.put(id, lid);
}
return null;
}
/** {@inheritDoc} */
@Override
public synchronized boolean containsId(String id) throws IOException {
return ids.keySet().contains(id);
}
/** {@inheritDoc} */
@Override
public synchronized boolean containsLid(String lid) throws IOException {
return registry.containsKey(lid);
}
@Override
public RegistryExceptionType update(List<ObjectRefType> refs,
List<UpdateActionType> updateActions, Mode mode) {
if (mode.equals(Mode.CREATE_ONLY)) {
InvalidRequestExceptionType e2 = rsFactory
.createInvalidRequestExceptionType();
e2.setMessage("The " + Mode.CREATE_ONLY
+ " mode is invalid for use with updating objects");
return e2;
} else if (mode.equals(!mode.equals(Mode.CREATE_OR_REPLACE)
&& !mode.equals(Mode.CREATE_OR_VERSION))) {
InvalidRequestExceptionType e3 = rsFactory
.createInvalidRequestExceptionType();
e3.setMessage("Invalid mode specified: " + mode);
e3.setDetail("Valid modes are: " + Arrays.toString(Mode.values()));
return e3;
}
// Ensure that all of the objects are in the registry.
for (ObjectRefType ref : refs) {
try {
if (!this.containsId(ref.getId())) {
ObjectNotFoundExceptionType e = rsFactory
.createObjectNotFoundExceptionType();
e.setMessage("Object (id=" + ref.getId() + ") not found");
return e;
}
} catch (IOException ioe) {
StringWriter writer = new StringWriter();
ioe.printStackTrace(new PrintWriter(writer));
RegistryExceptionType e = rsFactory
.createRegistryExceptionType();
e.setMessage("Error contacting registry.");
e.setDetail(writer.toString());
e.setCode(ioe.getClass().toString());
return e;
}
}
for (ObjectRefType ref : refs) {
if (mode.equals(Mode.CREATE_OR_VERSION)) {
// Increment the version on this object before updating
List<RegistryObjectType> objList = new ArrayList<RegistryObjectType>(
1);
objList.add(this.registry.get(ref.getId()).getObject());
this.version(objList);
}
RegistryVersionNode node = this.registry.get(ref.getId())
.getLatest();
RegistryExceptionType e = applyUpdate(node, updateActions);
if (e != null) {
return e;
}
}
return null;
}
private RegistryExceptionType applyUpdate(RegistryVersionNode node,
List<UpdateActionType> updateActions) {
/*
* Validate the update actions before applying them
*/
for (UpdateActionType updateAction : updateActions) {
String updateMode = updateAction.getMode();
StringQueryExpressionType selector = null;
if (updateAction.getSelector() instanceof StringQueryExpressionType) {
selector = (StringQueryExpressionType) updateAction
.getSelector();
} else {
// TODO: Implement XML QueryType
QueryExceptionType e = queryFactory.createQueryExceptionType();
e.setMessage("Unsupported query type specified: "
+ updateAction.getSelector().getClass().getName());
e.setDetail("StringQueryType is currently the only supported query type");
return e;
}
String queryLanguage = selector.getQueryLanguage();
String query = selector.getValue();
if (!SUPPORTED_QUERY_LANGUAGES.contains(queryLanguage)) {
QueryExceptionType e = queryFactory.createQueryExceptionType();
e.setMessage("Unsupported query language specified: "
+ queryLanguage);
e.setDetail("Supported language for this registry are: "
+ SUPPORTED_QUERY_LANGUAGES);
return e;
}
String updateField = query.replaceAll("\\.", "")
.replaceAll("/", "");
// Updating the lid, id, or objectType fields is
// explicitly not allowed
if (updateField.equalsIgnoreCase("lid")
|| updateField.equalsIgnoreCase("id")
|| updateField.equalsIgnoreCase("objectType")) {
InvalidRequestExceptionType e = rsFactory
.createInvalidRequestExceptionType();
e.setMessage("The update objects protocol prohibits updating the id, lid, or objectType fields");
return e;
}
if (!EbxmlUtil.isUpdateModeValid(updateMode)) {
InvalidRequestExceptionType e = rsFactory
.createInvalidRequestExceptionType();
e.setMessage("Invalide update mode specified: " + updateMode);
e.setDetail("Valid update modes are: " + EbxmlUtil.UPDATE_MODES);
return e;
}
}
/*
* This section applies the updates to the specified object after the
* validation is complete
*/
for (UpdateActionType updateAction : updateActions) {
StringQueryExpressionType selector = (StringQueryExpressionType) updateAction
.getSelector();
String updateMode = updateAction.getMode();
String query = selector.getValue();
}
return null;
}
/** {@inheritDoc} */
@Override
public List<RegistryObjectType> query(Map<String, List<Object>> parameters,
boolean matchAny, long startIndex, long maxResults, long depth,
boolean matchOlderVersions) throws IOException {
CompositeMatcher matcher;
if (matchAny) {
matcher = new OrMatcher();
} else {
matcher = new AndMatcher();
}
for (String key : parameters.keySet()) {
List<Object> values = parameters.get(key);
matcher.add(MatcherManager.getMatcher(key, values));
}
List<RegistryObjectType> matchedObjects = new ArrayList<RegistryObjectType>();
long currentIndex = 0;
for (String lid : registry.keySet()) {
List<RegistryVersionNode> nodesToCheck = new ArrayList<RegistryVersionNode>();
if (matchOlderVersions) {
nodesToCheck.add(registry.get(lid));
nodesToCheck.addAll(registry.get(lid).versions);
} else {
nodesToCheck.add(registry.get(lid).getLatest());
}
for (RegistryVersionNode node : nodesToCheck) {
if (matcher.matches(node.getObject())) {
if (currentIndex >= startIndex
&& (matchedObjects.size() < maxResults || maxResults == -1)) {
matchedObjects.add(node.getObject());
}
currentIndex++;
}
}
}
return matchedObjects;
}
/**
* Represents a version node for a {@link RegistryObjectType}.
*
* @author jsherida
*/
private static class RegistryVersionNode implements Cloneable {
private String lid;
private String id;
private RegistryObjectType obj;
private Vector<RegistryVersionNode> versions;
public RegistryVersionNode(RegistryObjectType obj) {
this.obj = obj;
this.id = obj.getId();
this.lid = obj.getLid();
this.versions = new Vector<RegistryVersionNode>();
}
@SuppressWarnings("unused")
public String getId() {
return id;
}
@SuppressWarnings("unused")
public String getLid() {
return lid;
}
public void setObject(RegistryObjectType obj) {
this.obj = obj;
this.id = obj.getId();
this.lid = obj.getLid();
this.versions = new Vector<RegistryVersionNode>();
}
public RegistryObjectType getObject() {
return obj;
}
public RegistryVersionNode getLatest() {
if (versions.size() == 0) {
return this;
} else {
return versions.lastElement().getLatest();
}
}
public RegistryVersionNode getObject(String id) {
if (this.id.equals(id)) {
return this;
} else {
for (RegistryVersionNode node : versions) {
MemoryRegistery.RegistryVersionNode version = node
.getObject(id);
if (version != null) {
return version;
}
}
return null;
}
}
public void addVersion(RegistryObjectType obj) {
RegistryVersionNode node = getObject(obj.getLid());
int idx = obj.getId().lastIndexOf(':');
if (idx == -1) {
obj.setId(obj.getId() + ":" + System.currentTimeMillis());
} else {
obj.setId(obj.getId().substring(0, idx) + ":"
+ System.currentTimeMillis());
}
node.addChildVersion(obj);
}
public void addChildVersion(RegistryObjectType obj) {
versions.add(new RegistryVersionNode(obj));
}
}
}

View file

@ -1,70 +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.memory.matchers;
import java.util.Set;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class ClassificationMatcher implements IMatcher {
private final String value;
/**
* @param value
* non-null string value.
*/
public ClassificationMatcher(String value) {
this.value = value;
}
/** {@inheritDoc} */
@Override
public boolean matches(RegistryObjectType obj) {
Set<ClassificationType> classifications = obj.getClassification();
for (ClassificationType classification : classifications) {
String node = classification.getClassificationNode();
if (value.equals(node)) {
return true;
}
}
return false;
}
}

View file

@ -1,50 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class DefaultMatcher implements IMatcher {
@Override
public boolean matches(RegistryObjectType obj) {
return false;
}
}

View file

@ -1,73 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class DescriptionMatcher implements IMatcher {
private final String value;
private final String lang;
/**
* @param value
* non-null string value.
*/
public DescriptionMatcher(String value) {
this(value, "en-US");
}
public DescriptionMatcher(String value, String lang) {
this.value = value;
this.lang = lang;
}
/** {@inheritDoc} */
@Override
public boolean matches(RegistryObjectType obj) {
String description = EbxmlUtil.getLocalizedString(
obj.getDescription(), lang);
if (description != null && description.contains(value)) {
return true;
}
return false;
}
}

View file

@ -1,103 +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.memory.matchers;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.ConstructorUtils;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.ebxml.query.matcher.AndMatcher;
import com.raytheon.uf.edex.ebxml.query.matcher.CompositeMatcher;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class MatcherManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(MatcherManager.class);
private static final IMatcher DEFAULT = new DefaultMatcher();
private static Map<String, Class<?>> matcherMap = new HashMap<String, Class<?>>();
static {
matcherMap.put("name", NameMatcher.class);
matcherMap.put("description", DescriptionMatcher.class);
matcherMap.put("objectType", ObjectTypeMatcher.class);
matcherMap.put("status", StatusMatcher.class);
matcherMap.put("classifications", ClassificationMatcher.class);
}
public static IMatcher getMatcher(String fieldName, List<Object> values) {
String[] vals = new String[values.size()];
for (int i = 0; i < values.size(); i++) {
vals[i] = (String) values.get(i);
}
return getMatcher(fieldName, vals);
}
public static IMatcher getMatcher(String fieldName, String[] values) {
Class<?> matcherClass = matcherMap.get(fieldName);
if (matcherClass == null) {
return DEFAULT;
}
CompositeMatcher andMatcher = null;
andMatcher = null;
for (String value : values) {
IMatcher subMatcher = null;
try {
subMatcher = (IMatcher) ConstructorUtils.invokeConstructor(
matcherClass, value);
} catch (Exception e) {
statusHandler.error("Error instantiating matcher class", e);
}
if (values.length == 1) {
return subMatcher;
} else {
if (andMatcher == null) {
andMatcher = new AndMatcher();
}
andMatcher.add(subMatcher);
}
}
return DEFAULT;
}
}

View file

@ -1,73 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class NameMatcher implements IMatcher {
private final String value;
private final String lang;
/**
* @param value
* non-null string value.
*/
public NameMatcher(String value) {
this(value, "en-US");
}
public NameMatcher(String value, String lang) {
this.value = value;
this.lang = lang;
}
/** {@inheritDoc} */
@Override
public boolean matches(RegistryObjectType obj) {
String name = EbxmlUtil.getLocalizedString(obj.getName(), lang);
if (name != null && name.equals(value)) {
return true;
}
return false;
}
}

View file

@ -1,60 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class ObjectTypeMatcher implements IMatcher {
private final String value;
public ObjectTypeMatcher(String value) {
this.value = value;
}
@Override
public boolean matches(RegistryObjectType obj) {
String objType = obj.getObjectType();
if (objType != null && objType.equals(value)) {
return true;
}
return false;
}
}

View file

@ -1,68 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class OwnerMatcher implements IMatcher {
private final String value;
/**
* @param value
* non-null string value.
*/
public OwnerMatcher(String value) {
this.value = value;
}
/** {@inheritDoc} */
@Override
public boolean matches(RegistryObjectType obj) {
String owner = obj.getOwner();
// TODO "Note that a parameter value of
// #@'@#rs:currentUserId()#@'@# may be
// used to specify the id of the user associated with the current
// request"
if (owner != null && owner.equals(value)) {
return true;
}
return false;
}
}

View file

@ -1,59 +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.memory.matchers;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import com.raytheon.uf.edex.ebxml.query.matcher.IMatcher;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 19, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class StatusMatcher implements IMatcher {
private final String value;
public StatusMatcher(String value) {
this.value = value;
}
@Override
public boolean matches(RegistryObjectType obj) {
String status = obj.getStatus();
if (status != null && status.contains(value)) {
return true;
}
return false;
}
}

View file

@ -1,32 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.services;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Cataloger;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsResponse;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory;
/**
* @author jsherida
*
*/
public class CatalogerImpl implements Cataloger {
/** {@inheritDoc} */
@Override
public CatalogObjectsResponse catalogObjects(
CatalogObjectsRequest partCatalogObjectsRequest)
throws MsgRegistryException {
// TODO Auto-generated method stub
ObjectFactory factory = new ObjectFactory();
CatalogObjectsResponse response = factory.createCatalogObjectsResponse();
response.setRequestId(partCatalogObjectsRequest.getId());
response.setStatus("Request Not Implemented");
return response;
}
}

View file

@ -1,63 +0,0 @@
/*
* The following software products were developed by Raytheon:
*
* ADE (AWIPS Development Environment) software
* CAVE (Common AWIPS Visualization Environment) software
* EDEX (Environmental Data Exchange) software
* uFrame (Universal Framework) software
*
* Copyright (c) 2010 Raytheon Co.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/epl-v10.php
*
*
* Contractor Name: Raytheon Company
* Contractor Address:
* 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 19, 2011 jsherida Initial creation
*
*/
package com.raytheon.uf.edex.ebxml.services;
import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
/**
* Interface for listening to lifecycle events.
*
* @author jsherida
* @version 1.0
*/
public interface LifecycleListener {
/**
* Notify the listener that one or more objects have been sumbitted.
* @param objs The list of objects that were submitted.
*/
public void objectsSubmitted(List<RegistryObjectType> objs);
/**
* Notify the listener that one or more objects have been updated.
* @param refs The list of references to objects that were updated
*/
public void objectsUpdated(List<ObjectRefType> refs);
/**
* Notify the listener that one or more objects have been removed.
* @param refs The list of references to objects that were removed.
*/
public void objectsRemoved(List<ObjectRefType> refs);
}

View file

@ -1,738 +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.services;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
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.QueryRequest;
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.ObjectRefListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
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.RegistryResponseType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnresolvedReferenceExceptionType;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.ebxml.registry.IRegistry;
import com.raytheon.uf.edex.ebxml.registry.RegistryManager;
/**
* Implementation of the {@link LifecycleManager}.
*
* <br>
* <br>
* Note: Quoted comments come from regrep-rs.pdf
*
* @author jsherida
*/
public class LifecycleManagerImpl implements LifecycleManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LifecycleManagerImpl.class);
/** The registry instance */
protected final IRegistry registry;
/** The query manager used for executing queries */
protected QueryManager queryManager;
/** The list of lifecycle event listeners */
protected List<LifecycleListener> listeners = new CopyOnWriteArrayList<LifecycleListener>();
/**
* Constructs a new LifecycleManagerImpl
*/
public LifecycleManagerImpl() {
this.registry = RegistryManager.getRegistryInstance();
}
/**
* The SubmitObjects protocol allows a client to submit RegistryObjects to
* the server. It also allows a client to completely replace existing
* RegistryObjects in the server.
*
* A client initiates the SubmitObjects protocol by sending a
* SubmitObjectsRequest message to the LifecycleManager endpoint.
*
* The LifecycleManager sends a RegistryResponse back to the client as
* response
*
* @param partSubmitObjectsRequest
* The partSubmitObjectsRequest is a container class containing
* details of the objects to be inserted or replaced in the
* registry. The protocol for handling such requests is describe
* herein. The registryObjectList element specifies a set of
* RegistryObject instances that are being submitted to the
* server. The RegistryObjects in the list may be new objects
* being submitted to the server or they may be current objects
* already existing in the server.
* <p>
* .The checkReferences attribute specifies the reference
* checking behavior expected of the server:
* <p>
* · <i>true</i> - Specifies that a server MUST check submitted
* objects and make sure that all references via reference
* attributes and slots to other RegistryObjects are resolvable.
* If a reference does not resolve then the server MUST return
* {@link UnresolvedReferenceException}
* <p>
* · <i>false (default)</i> Specifies that a server MUST NOT
* check submitted objects to make sure that all references via
* reference attributes and slots to other RegistryObjects are
* resolvable. If a reference does not resolve then the server
* MUST NOT return {@link UnresolvedReferenceException}
* <p>
* The {@link Mode} attribute specifies the semantics for how the
* server should handle RegistryObjects being submitted when they
* already exist in the server:
* <p>
*
* · <i>CreateOrReplace (default)</i> - If an object does not
* exist, server MUST create it as a new object. If an object
* already exists, server MUST replace the existing object with
* the submitted object
* <p>
* · <i>CreateOrVersion</i> - If an object does not exist, server
* MUST create it as a new object. If an object already exists,
* server MUST not alter the existing object and instead it MUST
* create a new version of the existing object using the state of
* the submitted object
* <p>
* · <i>CreateOnly</i> - If an object does not exist, server MUST
* create it as a new object. If an object already exists, the
* server MUST return an {@link ObjectExistsException} fault
* message
*
* @return {@link RegistryResponseType} - The response contains the status
* of the request. This is returned only upon success
* @throws MsgRegistryException
* The MsgRegistryException is returned if the request failed
* and wraps the following exceptions for the following reasons:
* <p>
* {@link RegistryExceptionType} - If internal errors occur
* while creating or replacing objects in the registry.<br>
* {@link UnresolvedReferenceException} - If checkReferences is
* true and a reference does not resolve.<br>
* {@link ObjectExistsException} - If the mode is CreateOnly and
* an object specified in the regObjects list alread exists <br>
* {@link InvalidRequestException} - Returned in the following
* cases:
* <p>
* · The mode is CreateOrReplace and the id is not specified
* <i>or</i> the lid is not specified<br>
* · The mode is CreateOrVersion and the id is not specified
* <i>or</i> the id does not exist and the lid does <i>or</i>
* the lid is not specified <br>
* · The mode is CreateOnly and the specified id already exists
* <i>or</i> the lid is not specified <i>or</i> the specified
* lid already exists
*/
public RegistryResponseType submitObjects(
SubmitObjectsRequest partSubmitObjectsRequest)
throws MsgRegistryException {
RegistryObjectListType regObjList = partSubmitObjectsRequest
.getRegistryObjectList();
Mode mode = partSubmitObjectsRequest.getMode();
boolean checkReferences = partSubmitObjectsRequest.isCheckReferences();
if (checkReferences) {
statusHandler
.info("Checking object references is currently unimplemented!");
// TODO Implement. See section 4.1.1.2
}
List<RegistryObjectType> regObjects = regObjList.getRegistryObject();
RegistryExceptionType e = internalSubmitObjects(regObjects, mode);
if (e != null) {
throw new MsgRegistryException("Request failed: " + e.getMessage(),
e);
}
statusHandler.info("Notifying listeners..");
for (LifecycleListener listener : listeners) {
listener.objectsSubmitted(regObjects);
}
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
RegistryResponseType response = rsFactory.createRegistryResponseType();
response.setRequestId(partSubmitObjectsRequest.getId());
response.setStatus("Success");
statusHandler
.info("submitObjects complete. Returning success response.");
return response;
}
/**
* @See {@link LifecycleManagerImpl#submitObjects} for details
*/
private RegistryExceptionType internalSubmitObjects(
List<RegistryObjectType> regObjects, Mode mode) {
statusHandler.info("Attempting to submit " + regObjects.size()
+ " objects.");
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
List<RegistryObjectType> toCreate = new ArrayList<RegistryObjectType>();
List<RegistryObjectType> toReplace = new ArrayList<RegistryObjectType>();
List<RegistryObjectType> toVersion = new ArrayList<RegistryObjectType>();
for (RegistryObjectType obj : regObjects) {
String id = obj.getId();
if (id == null && mode != Mode.CREATE_ONLY) {
InvalidRequestExceptionType e = rsFactory
.createInvalidRequestExceptionType();
e.setMessage("ID value is not specified");
return e;
}
String lid = obj.getLid();
if (lid == null) {
InvalidRequestExceptionType e = rsFactory
.createInvalidRequestExceptionType();
e.setMessage("LID value is not specified");
return e;
}
switch (mode) {
case CREATE_OR_REPLACE:
try {
if (registry.containsId(id)) {
toReplace.add(obj);
} else {
toCreate.add(obj);
}
} catch (IOException ioe) {
StringWriter writer = new StringWriter();
ioe.printStackTrace(new PrintWriter(writer));
RegistryExceptionType e = rsFactory
.createRegistryExceptionType();
e.setMessage("Error contacting registry.");
e.setDetail(writer.toString());
e.setCode(ioe.getClass().toString());
return e;
}
break;
case CREATE_OR_VERSION:
try {
if (!registry.containsId(id)) {
if (!registry.containsLid(lid)) {
toCreate.add(obj);
} else {
InvalidRequestExceptionType e = rsFactory
.createInvalidRequestExceptionType();
e.setMessage("Object LID exists in registry: "
+ lid);
return e;
}
} else {
toVersion.add(obj);
}
} catch (IOException ioe) {
RegistryExceptionType e = rsFactory
.createRegistryExceptionType();
e.setMessage("Error contacting registry.");
e.setDetail(ioe.toString());
e.setCode(ioe.getClass().toString());
return e;
}
break;
case CREATE_ONLY:
try {
if (registry.containsLid(lid)) {
ObjectExistsExceptionType e = rsFactory
.createObjectExistsExceptionType();
e.setMessage("Object LID exitsts in registry: " + lid);
return e;
}
if (id == null) {
// "If unspecified Server MUST generate UUID URN"
// TODO Generate UUID.
}
if (registry.containsId(id)) {
ObjectExistsExceptionType e = rsFactory
.createObjectExistsExceptionType();
e.setMessage("Object ID exitsts in registry: " + id);
return e;
} else {
toCreate.add(obj);
}
} catch (IOException ioe) {
RegistryExceptionType e = rsFactory
.createRegistryExceptionType();
e.setMessage("Error contacting registry.");
e.setDetail(ioe.toString());
e.setCode(ioe.getClass().toString());
return e;
}
break;
}
}
RegistryExceptionType e = null;
if (toCreate.size() > 0) {
for (RegistryObjectType obj : toCreate) {
statusHandler.info("Creating entry (" + "id: " + obj.getId()
+ " lid: " + obj.getLid());
}
e = registry.create(toCreate);
if (e != null)
return e;
}
if (toReplace.size() > 0) {
for (RegistryObjectType obj : toReplace) {
statusHandler.info("Replacing entry (" + "id: " + obj.getId()
+ " lid: " + obj.getLid());
}
e = registry.replace(toReplace);
if (e != null)
return e;
}
if (toVersion.size() > 0) {
for (RegistryObjectType obj : toVersion) {
statusHandler.info("Versioning entry (" + "id: " + obj.getId()
+ " lid: " + obj.getLid());
}
e = registry.version(toVersion);
if (e != null)
return e;
}
statusHandler.info("Entries successfully submitted to registry");
return null;
}
/**
* The Remove Objects protocol allows a client to remove or delete one or
* more RegistryObject instances from the server.
* <p>
* A client initiates the RemoveObjects protocol by sending a
* RemoveObjectsRequest message to the LifecycleManager endpoint.
* <p>
* The LifecycleManager sends a RegistryResponse back to the client as
* response.
*
* @param partRemoveObjectsRequest
* The partRemoveObjectsRequest is a container class containing
* details of the objects to be deleted from the registry. The
* protocol for handling such requests is describe herein. This
* object contains the following information:
* <p>
* checkReferences Specifies the reference checking behavior
* expected of the server:
*
* <i>true</i> - Specifies that a server MUST check objects being
* removed and make sure that there are no references to them
* from other objects via reference attributes and slots. If a
* reference exists then the server MUST return
* {@link ReferencesExistsException} <br>
* <i>false (default)</i> Specifies that a server MUST NOT
* check objects being removed to make sure that there are no
* references to them from other objects via reference attributes
* and slots. If a reference exists then the server MUST NOT
* return {@link ReferencesExistsException}
* <p>
* deleteChildren This attribute specifies whether or not to
* delete children of the objects being deleted according to the
* following behavior:
*
* <i>false</i> Specifies the server MUST NOT delete the
* children of objects that are specified to be deleted
* <p>
* <i>true</i> Specifies the server MUST delete children of
* objects being deleted if and only if those children are not
* children of any other parent objects
* <p>
* deletionScope - This attribute specifies the scope of impact
* of the RemoveObjectsRequest. 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
* <p>
* The following canonical ClassificationNodes are defined for
* the DeletionScopeType ClassificationScheme:
* <p>
* <i>DeleteRepositoryItemOnly</i> - Specifies that the server
* MUST delete the RepositoryItem for the specified
* ExtrinsicObjects but MUST NOT delete the specified
* ExtrinsicObjects
* <p>
* <i>DeleteAll (default)</i> - Specifies that the request MUST
* delete both the RegistryObject and the RepositoryItem (if any)
* for the specified objects
* <p>
* Query - Specifies a query to be invoked. A server MUST remove
* all objects that match the specified query in addition to any
* other objects identified by the ObjectRefList element.
* <p>
* ObjectRefList - Specifies a collection of references to
* existing RegistryObject instances in the server. A server MUST
* remove all objects that are referenced by this element in
* addition to any other objects identified by the Query element.
* @returns {@link RegistryResponseType} - The response contains the status
* of the request. This is returned only upon success
* @throws MsgRegistryException
* The MsgRegistryException is returned if the request failed
* and wraps the following exceptions for the following reasons:
* <p>
* {@link ReferencesExistsException} Returned in the following
* cases:
* <p>
* · If checkReferences is true and a reference exists to them
* <br>
* <p>
* {@link UnresolvedReferenceException} Returned in the
* following cases:
* <p>
* · If the requestor referenced an object within the request
* that was not resolved during the processing of the request.
*/
@Override
public RegistryResponseType removeObjects(
RemoveObjectsRequest partRemoveObjectsRequest)
throws MsgRegistryException {
boolean checkReferences = partRemoveObjectsRequest.isCheckReferences();
if (checkReferences) {
statusHandler
.info("Checking object references is currently unimplemented!");
// TODO Implement. See section 4.3.1.2
}
boolean deleteChildren = partRemoveObjectsRequest.isDeleteChildren();
if (deleteChildren) {
statusHandler
.warn("The deleteChildren option is currently unimplemented");
// TODO: Implement deleteChildren behavior
}
String deletionScope = partRemoveObjectsRequest.getDeletionScope();
if (deletionScope != null) {
statusHandler
.warn("The deletionScope option is currently unimplemented");
// TODO: Implement deletionScope behavior
}
// TODO Exceptions. See section 4.3.1.4
ObjectRefListType objRefList = partRemoveObjectsRequest
.getObjectRefList();
List<ObjectRefType> objRefs = new ArrayList<ObjectRefType>();
if (objRefList != null) {
objRefs.addAll(objRefList.getObjectRef());
}
List<ObjectRefType> queriedRefs = new ArrayList<ObjectRefType>();
try {
QueryType query = partRemoveObjectsRequest.getQuery();
if (query != null) {
queriedRefs = performQuery(query);
}
} catch (IllegalStateException e) {
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
RegistryExceptionType re = rsFactory.createRegistryExceptionType();
re.setMessage(e.getMessage());
re.setDetail(writer.toString());
re.setCode(e.getClass().toString());
throw new MsgRegistryException("Request not implemented", re, e);
}
statusHandler.info("Object references specified: " + objRefs.size());
statusHandler.info("Object references returned from query: "
+ queriedRefs.size());
objRefs.addAll(queriedRefs);
statusHandler.info("Attempting to remove " + objRefs.size()
+ " objects.");
RegistryExceptionType e = internalRemoveObjects(objRefs);
if (e != null) {
throw new MsgRegistryException("Request failed: " + e.getMessage(),
e);
}
// TODO Implement Audit Trails. See section 4.1.2
statusHandler.info("Notifying listeners..");
for (LifecycleListener listener : listeners) {
listener.objectsRemoved(objRefs);
}
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
RegistryResponseType response = rsFactory.createRegistryResponseType();
response.setRequestId(partRemoveObjectsRequest.getId());
response.setStatus("Success");
statusHandler
.info("removeObjects complete. Returning success response.");
return response;
}
/**
* @See {@link LifecycleManagerImpl#removeObjects} for details
*/
private RegistryExceptionType internalRemoveObjects(
List<ObjectRefType> objectRefs) {
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
try {
for (ObjectRefType ref : objectRefs) {
if (!registry.containsId(ref.getId())) {
UnresolvedReferenceExceptionType e = rsFactory
.createUnresolvedReferenceExceptionType();
e.setMessage("ID not found in registry: " + ref.getId());
return e;
}
}
} catch (IOException ioe) {
StringWriter writer = new StringWriter();
ioe.printStackTrace(new PrintWriter(writer));
RegistryExceptionType e = rsFactory.createRegistryExceptionType();
e.setMessage("Error contacting registry.");
e.setDetail(writer.toString());
e.setCode(ioe.getClass().toString());
return e;
}
return registry.remove(objectRefs);
}
/**
* The UpdateObjectsRequest protocol allows a client to make partial updates
* to one or more RegistryObjects that already exist in the server. This
* protocol enables partial update of RegistryObjects rather than a complete
* replacement. A client SHOULD use the SubmitObjects protocol for complete
* replacement of RegistryObjects.
* <p>
* A server MUST return InvalidRequestException fault message if the client
* attempts to update the id, lid or objectType attribute of a
* RegistryObject.
* <p>
* Query - Specifies a query to be invoked. A server MUST use all objects
* that match the specified query in addition to any other objects
* identified by the ObjectRefList element as targets of the update action.
* <p>
* ObjectRefList - Specifies a collection of references to existing
* RegistryObject instances in the server. A server MUST use all objects
* that are referenced by this element in addition to any other objects
* identified by the Query element as targets of the update action.
* <p>
* UpdateAction Specifies the details of how to update the target objects
* <p>
* checkReferences Specifies the reference checking behavior expected of
* the server:
* <p>
* <i>true</i> - Specifies that a server MUST check updated objects and make
* sure that all references via reference attributes and slots to other
* RegistryObjects are resolvable. If a reference does not resolve then the
* server MUST return UnresolvedReferenceException
* <p>
* <i>false (default)</i> Specifies that a server MUST NOT check updated
* objects to make sure that all references via reference attributes and
* slots to other RegistryObjects are resolvable. If a reference does not
* resolve then the server MUST NOT return UnresolvedReferenceException
* <p>
* mode Specifies the semantics for how the server should handle
* RegistryObjects being updated in the server:
* <p>
* <i>CreateOrReplace (default)</i> - If an object does not exist, server
* MUST return ObjectNotFoundException. If an object already exists, server
* MUST update the existing object without creating a new version
* <p>
* <i>CreateOrVersion</i> - If an object does not exist, server MUST return
* ObjectNotFoundException. If an object already exists, server MUST create
* a new version of the existing object before applying the requested update
* action
* <p>
* <i>CreateOnly</i> This mode does not apply to UpdateObjectsRequest. If
* specified, server MUST return an InvalidRequestException
*
* @param partUpdateObjectsRequest
* @returns {@link RegistryResponseType}
* @throws MsgRegistryException
*/
public RegistryResponseType updateObjects(
UpdateObjectsRequest partUpdateObjectsRequest)
throws MsgRegistryException {
boolean checkReferences = partUpdateObjectsRequest.isCheckReferences();
if (checkReferences) {
statusHandler
.info("Checking object references is currently unimplemented!");
// TODO Implement. See section 4.3.1.2
}
Mode mode = partUpdateObjectsRequest.getMode();
ObjectRefListType objRefList = partUpdateObjectsRequest
.getObjectRefList();
List<ObjectRefType> objRefs = new ArrayList<ObjectRefType>();
if (objRefList != null) {
objRefs.addAll(objRefList.getObjectRef());
}
List<ObjectRefType> queriedRefs = new ArrayList<ObjectRefType>();
try {
QueryType query = partUpdateObjectsRequest.getQuery();
if (query != null) {
queriedRefs = performQuery(query);
objRefs.addAll(queriedRefs);
}
} catch (IllegalStateException e) {
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
RegistryExceptionType re = rsFactory.createRegistryExceptionType();
re.setMessage(e.getMessage());
re.setDetail(writer.toString());
re.setCode(e.getClass().toString());
throw new MsgRegistryException("Error executing query for update",
re, e);
}
List<UpdateActionType> updateActions = partUpdateObjectsRequest
.getUpdateAction();
RegistryExceptionType e = registry.update(objRefs, updateActions, mode);
if (e != null) {
throw new MsgRegistryException("Request failed: " + e.getMessage(),
e);
}
// TODO Implement Audit Trails. See section 4.1.2
statusHandler.info("Notifying listeners..");
for (LifecycleListener listener : listeners) {
listener.objectsUpdated(objRefs);
}
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
RegistryResponseType response = rsFactory.createRegistryResponseType();
response.setRequestId(partUpdateObjectsRequest.getId());
response.setStatus("Success");
statusHandler
.info("updateObjects complete. Returning success response.");
return response;
}
/**
* Perform the given query to retrieve a list of references.
*
* @param query
* @return
* @throws MsgRegistryException
* if the query exceptioned.
* @throws IllegalStateException
* if the QueryManager is not defined.
*/
protected List<ObjectRefType> performQuery(QueryType query)
throws MsgRegistryException, IllegalStateException {
oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory queryFactory = new oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory();
if (queryManager == null) {
throw new IllegalStateException("QueryManager must not be null");
}
QueryRequest request = queryFactory.createQueryRequest();
request.setQuery(query);
request.setId(Long.toString(System.currentTimeMillis())); // TODO better
// ID.
ResponseOptionType responseOption = queryFactory
.createResponseOptionType();
responseOption.setReturnType("ObjectRef");
request.setResponseOption(responseOption);
List<ObjectRefType> refList = new ArrayList<ObjectRefType>();
QueryResponse response = queryManager.executeQuery(request);
if (response != null) {
// TODO Replace the following with the commented out code below when
// QueryManager works right.
RegistryObjectListType objList = response.getRegistryObjectList();
if (objList != null) {
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory = new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
for (RegistryObjectType obj : objList.getRegistryObject()) {
ObjectRefType ref = rimFactory.createObjectRefType();
ref.setId(obj.getLid());
refList.add(ref);
}
}
/*
* TODO This should be the actual way to do it, but QueryManager
* doesn't support references yet. ObjectRefListType objRefList =
* response.getObjectRefList(); if (objRefList != null) {
* refList.addAll(objRefList.getObjectRef()); }
*/
}
return refList;
}
/**
* @return the queryManager
*/
public QueryManager getQueryManager() {
return queryManager;
}
/**
* @param queryManager
* the queryManager to set
*/
public void setQueryManager(QueryManager queryManager) {
this.queryManager = queryManager;
}
/**
* @param listener
* the {@link LifecycleListener} to add.
*/
public void addListener(LifecycleListener listener) {
listeners.add(listener);
}
/**
* @param listener
* the {@link LifecycleListener} to remove.
*/
public void removeListener(LifecycleListener listener) {
listeners.remove(listener);
}
}

View file

@ -1,120 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.services;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
import com.raytheon.uf.edex.ebxml.query.AdhocQueryHandler;
import com.raytheon.uf.edex.ebxml.query.BasicQueryHandler;
import com.raytheon.uf.edex.ebxml.query.IQueryHandler;
/**
* Implementation of the {@link QueryManager}.
*
* <br>
* <br>
* Note: Quoted comments come from regrep-rs.pdf
*
* @author jsherida
*/
public class QueryManagerImpl implements QueryManager {
protected Map<String, IQueryHandler> queryHandlers = Collections
.synchronizedMap(new HashMap<String, IQueryHandler>());
/** Default Constructor. */
public QueryManagerImpl() {
queryHandlers.put(BasicQueryHandler.QUERY_DEFINITION,
new BasicQueryHandler());
queryHandlers.put(AdhocQueryHandler.QUERY_DEFINITION,
new AdhocQueryHandler());
}
/** {@inheritDoc} */
@Override
public QueryResponse executeQuery(QueryRequest partQueryRequest)
throws MsgRegistryException {
ResponseOptionType responseOption = partQueryRequest
.getResponseOption();
long depth = partQueryRequest.getDepth().longValue();
boolean federated = partQueryRequest.isFederated();
String federation = partQueryRequest.getFederation();
String lang = partQueryRequest.getLang();
boolean matchOlderVersions = partQueryRequest.isMatchOlderVersions();
long maxResults = partQueryRequest.getMaxResults().longValue();
long startIndex = partQueryRequest.getStartIndex().longValue();
QueryType query = partQueryRequest.getQuery();
IQueryHandler handler = queryHandlers.get(query.getQueryDefinition());
List<RegistryObjectType> matchingObjects = new ArrayList<RegistryObjectType>();
if (handler == null) {
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
UnsupportedCapabilityExceptionType e = rsFactory
.createUnsupportedCapabilityExceptionType();
e.setMessage("Query type not supported: "
+ query.getQueryDefinition());
e.setDetail(query.getQueryDefinition());
throw new MsgRegistryException("Query not supported", e);
} else {
try {
matchingObjects.addAll(handler.handleQuery(query, federated,
federation, startIndex, maxResults, depth,
matchOlderVersions));
} catch (IOException ioe) {
oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory rsFactory = new oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory();
StringWriter writer = new StringWriter();
ioe.printStackTrace(new PrintWriter(writer));
RegistryExceptionType e = rsFactory
.createRegistryExceptionType();
e.setMessage(ioe.getMessage());
e.setDetail(writer.toString());
e.setCode(ioe.getClass().toString());
throw new MsgRegistryException("Query failed", e, ioe);
}
}
oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory queryFactory = new oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory = new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
QueryResponse response = queryFactory.createQueryResponse();
response.setRequestId(partQueryRequest.getId());
response.setStatus("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success");
response.setTotalResultCount(new BigInteger(Integer
.toString(matchingObjects.size())));
RegistryObjectListType objList = rimFactory
.createRegistryObjectListType();
List<RegistryObjectType> objects = objList.getRegistryObject();
objects.addAll(matchingObjects);
response.setRegistryObjectList(objList);
return response;
}
}

View file

@ -1,32 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.services;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Validator;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
/**
* @author jsherida
*
*/
public class ValidatorImpl implements Validator {
/** {@inheritDoc} */
@Override
public ValidateObjectsResponse validateObjects(
ValidateObjectsRequest partValidateObjectsRequest)
throws MsgRegistryException {
// TODO Auto-generated method stub
ObjectFactory factory = new ObjectFactory();
ValidateObjectsResponse response = factory.createValidateObjectsResponse();
response.setRequestId(partValidateObjectsRequest.getId());
response.setStatus("Request Not Implemented");
return response;
}
}

View file

@ -1,188 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.test;
import java.util.List;
import javax.xml.bind.JAXBException;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import com.raytheon.uf.edex.ebxml.util.EbxmlJaxbManager;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.CollectionValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DateTimeValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DurationValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
/**
* @author jsherida
*/
public class InsertMarshaller {
/**
* @param args none
*/
public static void main(String[] args) {
oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory lcmFactory =
new oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory =
new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
// Construct an example message
/* Based on solr schema:
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="location" type="location" indexed="true" stored="true"/>
<field name="ul_location" type="location" indexed="true" stored="true"/>
<field name="lr_location" type="location" indexed="true" stored="true"/>
<field name="name" type="text" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>
<!-- catchall field, containing all other searchable text fields (implemented
via copyField further on in this schema -->
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
</fields>
*/
SubmitObjectsRequest request = lcmFactory.createSubmitObjectsRequest();
request.setId("123");
request.setComment("Test SubmitObjects");
request.setMode(Mode.CREATE_OR_REPLACE);
// Metar registry object
RegistryObjectType metarRegObj = rimFactory.createRegistryObjectType();
metarRegObj.setId("serviceUID0001");
metarRegObj.setLid("serviceUID0001");
metarRegObj.setName(EbxmlUtil.getIntlString("National Weather Service Metar"));
metarRegObj.setDescription(EbxmlUtil.getIntlString(
"Metar point data from the National Weather Service (NWS)."));
metarRegObj.setObjectType("MetarService");
ClassificationType pointClass = rimFactory.createClassificationType();
pointClass.setClassificationNode("point");
ClassificationType metarClass = rimFactory.createClassificationType();
metarClass.setClassificationNode("metar");
ClassificationType wfsClass = rimFactory.createClassificationType();
wfsClass.setClassificationNode("wfs");
metarRegObj.getClassification().add(pointClass);
metarRegObj.getClassification().add(metarClass);
metarRegObj.getClassification().add(wfsClass);
SlotType locationSlot = rimFactory.createSlotType();
locationSlot.setName("location");
StringValueType locationValue = rimFactory.createStringValueType();
locationValue.setValue("35.2452,-122.3845");
locationSlot.setSlotValue(locationValue);
SlotType metarLinkSlot = rimFactory.createSlotType();
metarLinkSlot.setName("link");
StringValueType metarLinkValue = rimFactory.createStringValueType();
metarLinkValue.setValue("http://metarland.org:8080/wfs");
metarLinkSlot.setSlotValue(metarLinkValue);
metarRegObj.getSlot().add(locationSlot);
metarRegObj.getSlot().add(metarLinkSlot);
// Satellite registry object
RegistryObjectType satelliteRegObj = rimFactory.createRegistryObjectType();
satelliteRegObj.setId("serviceUID0002");
satelliteRegObj.setLid("serviceUID0002");
satelliteRegObj.setName(EbxmlUtil.getIntlString("NASA GOES Imagery"));
satelliteRegObj.setDescription(EbxmlUtil.getIntlString(
"Satellite raster data from NASA. Includes water vapor, infrared, and visible images."));
satelliteRegObj.setObjectType("SatelliteService");
ClassificationType rasterClass = rimFactory.createClassificationType();
rasterClass.setClassificationNode("raster");
ClassificationType satelliteClass = rimFactory.createClassificationType();
satelliteClass.setClassificationNode("satellite");
ClassificationType wcsClass = rimFactory.createClassificationType();
wcsClass.setClassificationNode("wfs");
satelliteRegObj.getClassification().add(rasterClass);
satelliteRegObj.getClassification().add(satelliteClass);
satelliteRegObj.getClassification().add(wcsClass);
SlotType ulLocationSlot = rimFactory.createSlotType();
ulLocationSlot.setName("location"); //"ulLocation");
StringValueType ulValue = rimFactory.createStringValueType();
ulValue.setValue("45.00,-122.00");
ulLocationSlot.setSlotValue(ulValue);
// SlotType lrLocationSlot = rimFactory.createSlotType();
// lrLocationSlot.setName("lrLocation");
// StringValueType lrValue = rimFactory.createStringValueType();
// lrValue.setValue("20.00,-100.00");
// lrLocationSlot.setSlotValue(lrValue);
SlotType satLinkSlot = rimFactory.createSlotType();
satLinkSlot.setName("link");
StringValueType satLinkValue = rimFactory.createStringValueType();
satLinkValue.setValue("http://satellicious.com:8080/wcs");
satLinkSlot.setSlotValue(satLinkValue);
// Testing output:
SlotType timePeriodSlot = rimFactory.createSlotType();
timePeriodSlot.setName("timePeriod");
DurationValueType timePeriodValue = rimFactory.createDurationValueType();
try {
timePeriodValue.setValue(DatatypeFactory.newInstance().newDuration(30000));
} catch (DatatypeConfigurationException e1) {
e1.printStackTrace();
}
timePeriodSlot.setSlotValue(timePeriodValue);
// Testing output:
SlotType dateSlot = rimFactory.createSlotType();
dateSlot.setName("timePeriod");
DateTimeValueType dateValue = rimFactory.createDateTimeValueType();
try {
dateValue.setValue(DatatypeFactory.newInstance().newXMLGregorianCalendar());
} catch (DatatypeConfigurationException e1) {
e1.printStackTrace();
}
dateSlot.setSlotValue(dateValue);
// Testing output:
SlotType collSlot = rimFactory.createSlotType();
collSlot.setName("timePeriod");
CollectionValueType collValue = rimFactory.createCollectionValueType();
collValue.setCollectionType("StringValueType");
collValue.getElement().add(satLinkValue);
collSlot.setSlotValue(collValue);
satelliteRegObj.getSlot().add(ulLocationSlot);
// satelliteRegObj.getSlot().add(lrLocationSlot);
satelliteRegObj.getSlot().add(satLinkSlot);
satelliteRegObj.getSlot().add(timePeriodSlot);
satelliteRegObj.getSlot().add(dateSlot);
satelliteRegObj.getSlot().add(collSlot);
// Fill list
RegistryObjectListType regObjList = rimFactory.createRegistryObjectListType();
List<RegistryObjectType> objects = regObjList.getRegistryObject();
objects.add(metarRegObj);
objects.add(satelliteRegObj);
request.setRegistryObjectList(regObjList);
EbxmlJaxbManager manager = EbxmlJaxbManager.getInstance();
try {
// Marshal it
String requestStr = manager.marshal(request);
// Print it
System.out.println(requestStr);
} catch (JAXBException e) {
// Or, print error
e.printStackTrace();
}
}
}

View file

@ -1,94 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.test;
import java.math.BigInteger;
import java.util.Collection;
import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import com.raytheon.uf.edex.ebxml.util.EbxmlJaxbManager;
/**
* @author jsherida
*/
public class QueryMarshaller {
/**
* @param args
* none
*/
public static void main(String[] args) {
oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory queryFactory = new oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory = new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
// Construct an example query
QueryRequest request = queryFactory.createQueryRequest();
request.setId("123");
request.setComment("Test Request");
request.setStartIndex(new BigInteger("0"));
request.setMaxResults(new BigInteger("-1"));
ResponseOptionType responseOption = queryFactory
.createResponseOptionType();
responseOption.setReturnComposedObjects(Boolean.TRUE);
responseOption.setReturnType("RegistryObject");
request.setResponseOption(responseOption);
QueryType queryType = rimFactory.createQueryType();
queryType
.setQueryDefinition("urn:oasis:names:tc:ebxml-regrep:query:BasicQuery");
SlotType descSlot = rimFactory.createSlotType();
descSlot.setName("description");
StringValueType descValue = rimFactory.createStringValueType();
descValue.setValue("satellite");
descSlot.setSlotValue(descValue);
SlotType nameSlot = rimFactory.createSlotType();
nameSlot.setName("name");
StringValueType nameValue = rimFactory.createStringValueType();
nameValue.setValue("GOES");
nameSlot.setSlotValue(nameValue);
SlotType expressionSlot = rimFactory.createSlotType();
expressionSlot.setName("queryExpression");
StringValueType expressionValue = rimFactory.createStringValueType();
expressionValue.setValue("*:*");
expressionSlot.setSlotValue(expressionValue);
SlotType languageSlot = rimFactory.createSlotType();
languageSlot.setName("queryLanguage");
StringValueType languageValue = rimFactory.createStringValueType();
languageValue.setValue("solr");
languageSlot.setSlotValue(languageValue);
Collection<SlotType> slots = queryType.getSlot();
slots.add(descSlot);
slots.add(nameSlot);
slots.add(expressionSlot);
slots.add(languageSlot);
request.setQuery(queryType);
EbxmlJaxbManager manager = EbxmlJaxbManager.getInstance();
try {
// Marshal it
String requestStr = manager.marshal(request);
// Print it
System.out.println(requestStr);
} catch (JAXBException e) {
// Or, print error
e.printStackTrace();
}
}
}

View file

@ -1,76 +0,0 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.test;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.edex.ebxml.util.EbxmlJaxbManager;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
/**
* @author jsherida
*
*/
public class RemoveMarshaller {
/**
* @param args none
*/
public static void main(String[] args) {
oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory lcmFactory =
new oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory =
new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
// Construct an example message
RemoveObjectsRequest request = lcmFactory.createRemoveObjectsRequest();
request.setId("123");
request.setComment("Test RemoveObjects");
request.setDeleteChildren(true);
request.setDeletionScope("DeleteRepositoryItemOnly");
// List ID #2
ObjectRefType ref = rimFactory.createObjectRefType();
ref.setId("serviceUID0002");
ObjectRefListType refList = rimFactory.createObjectRefListType();
refList.getObjectRef().add(ref);
request.setObjectRefList(refList);
// Query for "metar" (ID #1)
QueryType query = rimFactory.createQueryType();
query.setQueryDefinition("urn:oasis:names:tc:ebxml-regrep:query:BasicQuery");
SlotType descSlot = rimFactory.createSlotType();
descSlot.setName("description");
StringValueType descValue = rimFactory.createStringValueType();
descValue.setValue("metar");
descSlot.setSlotValue(descValue);
query.getSlot().add(descSlot);
request.setQuery(query);
EbxmlJaxbManager manager = EbxmlJaxbManager.getInstance();
try {
// Marshal it
String requestStr = manager.marshal(request);
// Print it
System.out.println(requestStr);
} catch (JAXBException e) {
// Or, print error
e.printStackTrace();
}
}
}

View file

@ -1,116 +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.test;
import java.util.List;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.edex.ebxml.util.EbxmlJaxbManager;
import com.raytheon.uf.edex.ebxml.util.EbxmlUtil;
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
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.rim.v4.AnyValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.InternationalStringType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.InternationalStringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.LocalizedStringType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryExpressionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringQueryExpressionType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class UpdateMarshaller {
/**
* @param args
* none
*/
public static void main(String[] args) {
oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory lcmFactory = new oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory = new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory queryFactory = new oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory();
UpdateObjectsRequest request = lcmFactory.createUpdateObjectsRequest();
request.setId("0");
request.setComment("Test SubmitObjects");
request.setMode(Mode.CREATE_OR_REPLACE);
ObjectRefListType objRefList = new ObjectRefListType();
ObjectRefType ref = new ObjectRefType();
ref.setId("0");
objRefList.getObjectRef().add(ref);
request.setObjectRefList(objRefList);
UpdateActionType updateAction = new UpdateActionType();
updateAction.setMode("UPDATE");
InternationalStringValueType val = new InternationalStringValueType();
InternationalStringType t = new InternationalStringType();
LocalizedStringType lst = new LocalizedStringType();
lst.setLang("en-US");
lst.setValue("New Description");
t.getLocalizedString().add(lst);
val.setValue(t);
updateAction.setValueHolder(val);
StringQueryExpressionType queryType = rimFactory
.createStringQueryExpressionType();
queryType.setQueryLanguage("XPath");
queryType.setValue("./rim:Name");
updateAction.setSelector(queryType);
request.getUpdateAction().add(updateAction);
EbxmlJaxbManager manager = EbxmlJaxbManager.getInstance();
try {
// Marshal it
String requestStr = manager.marshal(request);
// Print it
System.out.println(requestStr);
} catch (JAXBException e) {
// Or, print error
e.printStackTrace();
}
}
}

View file

@ -1,242 +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.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import org.apache.cxf.helpers.IOUtils;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 14, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class EbxmlJaxbManager {
public static final String JAXB_NAMESPACE_MAPPER = "com.sun.xml.bind.namespacePrefixMapper";
private static JAXBContext defaultCtx = null;
private JAXBContext context = null;
// private NamespacePrefixMapper mapper;
/**
* Private constructor
*
* @param prefixmap
* A map of URI to namespace prefix to use when marshalling or
* umarshalling.
*/
private EbxmlJaxbManager(final Map<String, String> prefixmap) {
this.context = getDefaultContext();
// this.mapper = new NamespacePrefixMapper() {
// @Override
// public String getPreferredPrefix(String namespaceUri,
// String suggestion, boolean requirePrefix) {
// return prefixmap.get(namespaceUri);
// }
// };
}
/** Private default constructor. */
private EbxmlJaxbManager() {
this.context = getDefaultContext();
}
/**
* @return A new instance of {@link EbxmlJaxbManager} that does not use a
* prefix map.
*/
public static EbxmlJaxbManager getInstance() {
return new EbxmlJaxbManager();
}
/**
* @param prefixmap
* A map of URI to namespace prefix to use when marshalling or
* umarshalling.
* @return A new instance of {@link EbxmlJaxbManager} that uses a prefix
* map.
*/
public static EbxmlJaxbManager getInstance(
final Map<String, String> prefixmap) {
return new EbxmlJaxbManager(prefixmap);
}
/**
* @return The default context.
*/
private JAXBContext getDefaultContext() {
if (defaultCtx == null) {
defaultCtx = createContext();
}
return defaultCtx;
}
/** Create the context based on ObjectFactories that will be needed. */
private JAXBContext createContext() {
ArrayList<Class<?>> classList = new ArrayList<Class<?>>();
classList
.add(oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory.class);
classList
.add(oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory.class);
classList
.add(oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class);
classList
.add(oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory.class);
classList
.add(oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory.class);
JAXBContext rval = null;
try {
rval = JAXBContext.newInstance(classList
.toArray(new Class[classList.size()]));
} catch (JAXBException e) {
e.printStackTrace();
}
return rval;
}
/**
* Create Java objects from the given XML string.
*
* @param xml
* The xml to unmarshal.
* @return The Java objects created from the XML.
* @throws JAXBException
* if a problem occurred.
*/
public Object unmarshal(String xml) throws JAXBException {
Object rval = null;
Unmarshaller u = context.createUnmarshaller();
rval = u.unmarshal(new StringReader(xml));
if (rval instanceof JAXBElement<?>) {
rval = ((JAXBElement<?>) rval).getValue();
}
return rval;
}
/**
* Create an xml string from the given object.
*
* @param obj
* The object to marshal.
* @return The XML string created from the Java.
* @throws JAXBException
* if a problem occured.
*/
public String marshal(Object obj) throws JAXBException {
return marshal(obj, true);
}
/**
* Create an xml string from the given object.
*
* @param obj
* The object to marshal.
* @param formatted
* whether or not the output should be formatted.
* @return The XML string created from the Java.
* @throws JAXBException
* if a problem occured.
*/
public String marshal(Object obj, boolean formatted) throws JAXBException {
return marshal(obj, null, formatted);
}
/**
* Create an xml string from the given object.
*
* @param obj
* The object to marshal.
* @param schemaLocation
* The location of a schema to use. May be null.
* @param formatted
* whether or not the output should be formatted.
* @return The XML string created from the Java.
* @throws JAXBException
* if a problem occured.
*/
public String marshal(Object obj, String schemaLocation, boolean formatted)
throws JAXBException {
String rval = null;
Marshaller m = context.createMarshaller();
StringWriter writer = new StringWriter();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, formatted);
// if (mapper != null) {
// m.setProperty(JAXB_NAMESPACE_MAPPER, mapper);
// }
if (schemaLocation != null && !schemaLocation.isEmpty()) {
m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
}
m.marshal(obj, writer);
rval = writer.toString();
return rval;
}
/**
* @return The current context.
*/
public JAXBContext getContext() {
return context;
}
/**
* Create Java objects from the given {@link InputStream} containing XML.
*
* @param stream
* The stream to umarshal from.
* @return The Java objects created from the XMl stream.
* @throws IOException
* if there was a problem with the stream.
* @throws JAXBException
* if a problem occured.
*/
public Object unmarshal(InputStream stream) throws JAXBException,
IOException {
return unmarshal(IOUtils.toString(stream));
}
}

View file

@ -1,221 +0,0 @@
package com.raytheon.uf.edex.ebxml.util;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.datatype.XMLGregorianCalendar;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AnyValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.BooleanValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.CollectionValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DateTimeValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DurationValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FloatValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.IntegerValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.InternationalStringType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.InternationalStringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.LocalizedStringType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.MapValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VocabularyTermValueType;
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
/**
* Utility class containing functions commonly used with ebXML.
*
* @author jsherida
*/
public class EbxmlUtil {
public static List<String> UPDATE_MODES = new ArrayList<String>();
static {
UPDATE_MODES.add("Insert");
UPDATE_MODES.add("Update");
UPDATE_MODES.add("Delete");
}
/**
* Create an {@link InternationalStringType} from the given string.
* Currently this method assumes the "en-US" language.
*
* @param string
* The string to convert.
* @return An internationalized string object.
*/
public static InternationalStringType getIntlString(String string) {
oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory rimFactory = new oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory();
InternationalStringType intlString = rimFactory
.createInternationalStringType();
LocalizedStringType localString = rimFactory
.createLocalizedStringType();
localString.setLang("en-US");
localString.setValue(string);
List<LocalizedStringType> localizedList = intlString
.getLocalizedString();
localizedList.add(localString);
return intlString;
}
/**
* Get the {@link String} of the given language from an
* {@link InternationalStringType}.
*
* @param intlString
* The international string.
* @param lang
* The language to retrieve the {@link String} for.
* @return The {@link String} of the given language, or null if a string for
* the language could not be found.
*/
public static String getLocalizedString(InternationalStringType intlString,
String lang) {
List<LocalizedStringType> localStrings = intlString
.getLocalizedString();
String localizedString = null;
for (LocalizedStringType localStrType : localStrings) {
if (lang.equals(localStrType.getLang())) {
localizedString = localStrType.getValue();
}
}
return localizedString;
}
/**
* Convenience method for converting a known string {@link ValueType} into a
* {@link String}.
*
* @param value
* The ValueType
* @return The String value contained.
*/
public static String getStringValue(ValueType value) {
if (value == null) {
return null;
}
return ((StringValueType) value).getValue();
}
/**
* Convenience method for converting a known date {@link ValueType} into a
* {@link Date}.
*
* @param value
* The ValueType
* @return The Date value contained.
*/
public static Date getDateValue(ValueType value) {
if (value == null) {
return null;
}
XMLGregorianCalendar cal = ((DateTimeValueType) value).getValue();
return cal.toGregorianCalendar().getTime();
}
/**
* Convenience method for converting a known float {@link ValueType} into a
* {@link Float}.
*
* @param value
* The ValueType
* @return The Float value contained.
*/
public static Float getFloatValue(ValueType value) {
if (value == null) {
return null;
}
return ((FloatValueType) value).getValue();
}
/**
* Convenience method for converting a known long {@link ValueType} into a
* {@link Long}.
*
* @param value
* The ValueType
* @return The Long value contained.
*/
public static Long getLongValue(ValueType value) {
if (value == null) {
return null;
}
BigInteger bigint = ((IntegerValueType) value).getValue();
return Long.valueOf(bigint.longValue());
}
/**
* Convenience method for converting a known boolean {@link ValueType} into
* a {@link Boolean}.
*
* @param value
* The ValueType
* @return The Boolean value contained.
*/
public static Boolean getBooleanValue(ValueType value) {
if (value == null) {
return null;
}
return ((BooleanValueType) value).isValue();
}
public static String translateException(
RegistryExceptionType registryException) {
StringBuilder msg = new StringBuilder();
msg.append("Registry Exception");
msg.append("\nCode: ").append(registryException.getCode());
msg.append("\nDetail: ").append(registryException.getDetail());
msg.append("\nMessage: ").append(registryException.getMessage());
msg.append("\nSeverity: ").append(registryException.getSeverity());
return msg.toString();
}
public static Object getValue(ValueType value) {
Object retVal = null;
if (value instanceof AnyValueType) {
return ((AnyValueType) value).getAny();
} else if (value instanceof AnyValueType) {
return ((AnyValueType) value).getAny();
} else if (value instanceof BooleanValueType) {
return ((BooleanValueType) value).isValue();
} else if (value instanceof CollectionValueType) {
return ((CollectionValueType) value).getElement();
} else if (value instanceof DateTimeValueType) {
return ((DateTimeValueType) value).getValue();
} else if (value instanceof DurationValueType) {
return ((DurationValueType) value).getValue();
} else if (value instanceof FloatValueType) {
return ((FloatValueType) value).getValue();
} else if (value instanceof IntegerValueType) {
return ((IntegerValueType) value).getValue();
} else if (value instanceof InternationalStringValueType) {
return ((InternationalStringValueType) value).getValue();
} else if (value instanceof MapValueType) {
return ((MapValueType) value).getMap();
} else if (value instanceof SlotValueType) {
return ((SlotValueType) value).getSlot();
} else if (value instanceof StringValueType) {
return ((StringValueType) value).getValue();
} else if (value instanceof VocabularyTermValueType) {
return ((VocabularyTermValueType) value).getValue();
}
return retVal;
}
public static boolean isUpdateModeValid(String updateMode) {
for (String mode : UPDATE_MODES) {
if (mode.equalsIgnoreCase(updateMode)) {
return true;
}
}
return false;
}
}

View file

@ -15,7 +15,7 @@
<!-- NOTIFICATION LISTENER -->
<!-- Define concrete implementation of the service -->
<bean id="notificationServiceImpl"
class="com.raytheon.uf.edex.ebxml.services.NotificationListenerImpl" />
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerImpl" />
<!-- LIFE CYCLE MANAGER -->

View file

@ -1,18 +1,10 @@
/**
*
*/
package com.raytheon.uf.edex.ebxml.services;
package com.raytheon.uf.edex.registry.ebxml.services.notification;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
/**
* @author jsherida
*
*/
public class NotificationListenerImpl implements NotificationListener {
/** {@inheritDoc} */
@Override
public void onNotification(NotificationType notification) {
// TODO Auto-generated method stub

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SubmitObjectsRequest mode="CreateOrReplace" checkReferences="false" comment="Submission of registered user profile" id="User Profiles and Roles" xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:4.0" xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rim:4.0" xmlns:ns4="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://www.w3.org/1999/xlink" xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0" xmlns:ns6="urn:oasis:names:tc:ebxml-regrep:xsd:query:4.0" xmlns:ns7="urn:oasis:names:tc:ebxml-regrep:xsd:spi:4.0">
<RegistryObjectList>
<RegistryObject xsi:type="RoleType" type="urn:oasis:names:tc:ebxml-regrep:SubjectRole:RegistryAdministrator" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Role" lid="RegistryAdministrator" id="RegistryAdministrator" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="RegAdminRole" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="Role used for Registry Administrators" xml:lang="en-US"/>
</Description>
</RegistryObject>
<RegistryObject xsi:type="RoleType" type="urn:oasis:names:tc:ebxml-regrep:SubjectRole:RegistryLocalAdministrator" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Role" lid="RegistryLocalAdministrator" id="RegistryLocalAdministrator" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="RegistryLocalAdministrator" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="Role used for localAdministrators" xml:lang="en-US"/>
</Description>
</RegistryObject>
<RegistryObject xsi:type="RoleType" type="urn:oasis:names:tc:ebxml-regrep:SubjectRole:RegistryUser" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Role" lid="RegistryUser" id="RegistryUser" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="RegistryUser" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="Role used for Registry Users" xml:lang="en-US"/>
</Description>
</RegistryObject>
<RegistryObject xsi:type="RoleType" type="urn:oasis:names:tc:ebxml-regrep:SubjectRole:RegistryGuest" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Role" lid="RegistryGuest" id="RegistryGuest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="RegistryGuest" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="Role used for guests to the registry" xml:lang="en-US"/>
</Description>
</RegistryObject>
<RegistryObject xsi:type="PersonType" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Person" lid="EDEX_Internal_User" id="EDEX_Internal_User" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="EDEX_Internal_User" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="EDEX_Internal_User" xml:lang="en-US"/>
</Description>
<PersonName lastName="User" middleName="Internal" firstName="EDEX"/>
</RegistryObject>
<RegistryObject xsi:type="AssociationType" targetObject="RegistryAdministrator" sourceObject="EDEX_Internal_User" type="urn:oasis:names:tc:ebxml-regrep:AssociationType:HasRole" owner="EDEX_Internal_User" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association" lid="EDEX Internal Admin Association" id="EDEX Internal Admin Association" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<LocalizedString value="EDEX Internal Admin" xml:lang="en-US"/>
</Name>
<Description>
<LocalizedString value="Association linking EDEX Internal user to admin role" xml:lang="en-US"/>
</Description>
</RegistryObject>
</RegistryObjectList>
</ns2:SubmitObjectsRequest>

View file

@ -45,13 +45,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.ebxml"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.registry.ebxml"
download-size="0"

View file

@ -48,7 +48,6 @@
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.raytheon.uf.edex.core"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.raytheon.uf.edex.database"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.mchange"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.raytheon.uf.edex.ebxml"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.apache.commons.management"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.facebook.thrift"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.raytheon.uf.common.datastorage"/>