diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/.classpath b/edexOsgi/com.raytheon.uf.edex.ebxml/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.ebxml/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 29e41127e1..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.ebxml/META-INF/MANIFEST.MF deleted file mode 100644 index 912f96ac71..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/META-INF/MANIFEST.MF +++ /dev/null @@ -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" diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/build.properties b/edexOsgi/com.raytheon.uf.edex.ebxml/build.properties deleted file mode 100644 index 34d2e4d2da..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/com.raytheon.uf.edex.ebxml.ecl b/edexOsgi/com.raytheon.uf.edex.ebxml/com.raytheon.uf.edex.ebxml.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/component-deploy.xml b/edexOsgi/com.raytheon.uf.edex.ebxml/component-deploy.xml deleted file mode 100644 index fc65d5d5c6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/component-deploy.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/QueryException.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/QueryException.java deleted file mode 100644 index 6d1eb098e9..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/QueryException.java +++ /dev/null @@ -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); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/RegistryException.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/RegistryException.java deleted file mode 100644 index 881ffdfbdb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/exception/RegistryException.java +++ /dev/null @@ -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; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/AdhocQueryHandler.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/AdhocQueryHandler.java deleted file mode 100644 index c365b4ab12..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/AdhocQueryHandler.java +++ /dev/null @@ -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 handleQuery(QueryType query, - boolean federated, String federation, long startIndex, - long maxResults, long depth, boolean matchOlderVersions) - throws IOException { - Map> parameters = new HashMap>(); - Collection slots = query.getSlot(); - - for (SlotType slot : slots) { - String param = slot.getName(); - List values = parameters.get(param); - if (values == null) { - values = new ArrayList(); - 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); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/BasicQueryHandler.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/BasicQueryHandler.java deleted file mode 100644 index 39ec338d4e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/BasicQueryHandler.java +++ /dev/null @@ -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 BASIC_QUERY_PARAMETERS = new ArrayList(); - 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 handleQuery(QueryType query, - boolean federated, String federation, long startIndex, - long maxResults, long depth, boolean matchOlderVersions) - throws IOException { - Map> baseParameters = new HashMap>(); - Boolean matchAny = false; - - Collection 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 values = baseParameters.get(param); - if (values == null) { - values = new ArrayList(); - baseParameters.put(param, values); - } - - values.add(((StringValueType) slot.getSlotValue()).getValue()); - } - } - - IRegistry registry = RegistryManager.getRegistryInstance(); - return registry.query(baseParameters, matchAny, startIndex, maxResults, - depth, matchOlderVersions); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/IQueryHandler.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/IQueryHandler.java deleted file mode 100644 index 39c1e7fcc5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/IQueryHandler.java +++ /dev/null @@ -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 handleQuery(QueryType query, boolean federated, - String federation, long startIndex, long maxResults, - long depth, boolean matchOlderVersion) throws IOException; - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/QueryParameters.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/QueryParameters.java deleted file mode 100644 index 1d9a164042..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/QueryParameters.java +++ /dev/null @@ -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 - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 15, 2011            bphillip     Initial creation
- *
- * 
- * - * @author bphillip - * @version 1.0 - */ - -public final class QueryParameters { - - public static final List 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(); - 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"; - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/AndMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/AndMatcher.java deleted file mode 100644 index 68d8c4706a..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/AndMatcher.java +++ /dev/null @@ -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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/CompositeMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/CompositeMatcher.java deleted file mode 100644 index 1c9f8bb182..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/CompositeMatcher.java +++ /dev/null @@ -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 matchers = new ArrayList(); - - public void add(IMatcher matcher) { - matchers.add(matcher); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/IMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/IMatcher.java deleted file mode 100644 index 490f560278..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/IMatcher.java +++ /dev/null @@ -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); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/OrMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/OrMatcher.java deleted file mode 100644 index aa6c41e59d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/query/matcher/OrMatcher.java +++ /dev/null @@ -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; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/IRegistry.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/IRegistry.java deleted file mode 100644 index 90792a5023..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/IRegistry.java +++ /dev/null @@ -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 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 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 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 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 refs, - List 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 query(Map> parameters, - boolean matchAny, long startIndex, long maxResults, - long depth, boolean matchOlderVersions) throws IOException; - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/RegistryManager.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/RegistryManager.java deleted file mode 100644 index 64bb1432a7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/RegistryManager.java +++ /dev/null @@ -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); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/MemoryRegistery.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/MemoryRegistery.java deleted file mode 100644 index ef6e1cc8b8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/MemoryRegistery.java +++ /dev/null @@ -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 SUPPORTED_QUERY_LANGUAGES = new ArrayList(); - - 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 */ - private final Map registry; - - /** Map of IDs to LIDs. Tells which LID an ID is in. */ - private final Map ids; - - /** Private default constructor. */ - public MemoryRegistery() { - registry = new HashMap(); - ids = new HashMap(); - } - - /** {@inheritDoc} */ - @Override - public void init() { - // Do nothing. - } - - /** {@inheritDoc} */ - @Override - public synchronized RegistryExceptionType create( - List objs) { - return putObject(objs); - } - - /** {@inheritDoc} */ - @Override - public synchronized RegistryExceptionType replace( - List objs) { - return putObject(objs); - } - - /** {@inheritDoc} */ - @Override - public synchronized RegistryExceptionType version( - List 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 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 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 refs, - List 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 objList = new ArrayList( - 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 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 query(Map> 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 values = parameters.get(key); - matcher.add(MatcherManager.getMatcher(key, values)); - } - - List matchedObjects = new ArrayList(); - long currentIndex = 0; - for (String lid : registry.keySet()) { - List nodesToCheck = new ArrayList(); - 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 versions; - - public RegistryVersionNode(RegistryObjectType obj) { - this.obj = obj; - this.id = obj.getId(); - this.lid = obj.getLid(); - this.versions = new Vector(); - } - - @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(); - } - - 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)); - } - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ClassificationMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ClassificationMatcher.java deleted file mode 100644 index b63c0e8a14..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ClassificationMatcher.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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 classifications = obj.getClassification(); - for (ClassificationType classification : classifications) { - String node = classification.getClassificationNode(); - if (value.equals(node)) { - return true; - } - } - return false; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DefaultMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DefaultMatcher.java deleted file mode 100644 index 8b7f0f8219..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DefaultMatcher.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @author bphillip - * @version 1.0 - */ - -public class DefaultMatcher implements IMatcher { - - @Override - public boolean matches(RegistryObjectType obj) { - return false; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DescriptionMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DescriptionMatcher.java deleted file mode 100644 index 58e211b389..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/DescriptionMatcher.java +++ /dev/null @@ -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 - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- *
- * 
- * - * @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; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/MatcherManager.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/MatcherManager.java deleted file mode 100644 index a91d1e029f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/MatcherManager.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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> matcherMap = new HashMap>(); - 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 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; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/NameMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/NameMatcher.java deleted file mode 100644 index a57d4289cd..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/NameMatcher.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ObjectTypeMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ObjectTypeMatcher.java deleted file mode 100644 index 18a1dd4698..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/ObjectTypeMatcher.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/OwnerMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/OwnerMatcher.java deleted file mode 100644 index 331c447a98..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/OwnerMatcher.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/StatusMatcher.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/StatusMatcher.java deleted file mode 100644 index 222ff3f65c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/registry/memory/matchers/StatusMatcher.java +++ /dev/null @@ -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 - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2011            bphillip     Initial creation
- *
- * 
- * - * @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; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/CatalogerImpl.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/CatalogerImpl.java deleted file mode 100644 index 61db00829f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/CatalogerImpl.java +++ /dev/null @@ -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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleListener.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleListener.java deleted file mode 100644 index 0460840bfe..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleListener.java +++ /dev/null @@ -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 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 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 refs); -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleManagerImpl.java deleted file mode 100644 index f4ac8b20a4..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/LifecycleManagerImpl.java +++ /dev/null @@ -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}. - * - *
- *
- * 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 listeners = new CopyOnWriteArrayList(); - - /** - * 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. - *

- * .The checkReferences attribute specifies the reference - * checking behavior expected of the server: - *

- * · true - 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} - *

- * · false (default) – 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} - *

- * The {@link Mode} attribute specifies the semantics for how the - * server should handle RegistryObjects being submitted when they - * already exist in the server: - *

- * - * · CreateOrReplace (default) - 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 - *

- * · CreateOrVersion - 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 - *

- * · CreateOnly - 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: - *

- * {@link RegistryExceptionType} - If internal errors occur - * while creating or replacing objects in the registry.
- * {@link UnresolvedReferenceException} - If checkReferences is - * true and a reference does not resolve.
- * {@link ObjectExistsException} - If the mode is CreateOnly and - * an object specified in the regObjects list alread exists
- * {@link InvalidRequestException} - Returned in the following - * cases: - *

- * · The mode is CreateOrReplace and the id is not specified - * or the lid is not specified
- * · The mode is CreateOrVersion and the id is not specified - * or the id does not exist and the lid does or - * the lid is not specified
- * · The mode is CreateOnly and the specified id already exists - * or the lid is not specified or 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 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 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 toCreate = new ArrayList(); - List toReplace = new ArrayList(); - List toVersion = new ArrayList(); - - 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. - *

- * A client initiates the RemoveObjects protocol by sending a - * RemoveObjectsRequest message to the LifecycleManager endpoint. - *

- * 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: - *

- * checkReferences – Specifies the reference checking behavior - * expected of the server: - * - * true - 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}
- * false (default) – 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} - *

- * deleteChildren – This attribute specifies whether or not to - * delete children of the objects being deleted according to the - * following behavior: - * - * false – Specifies the server MUST NOT delete the - * children of objects that are specified to be deleted - *

- * true – Specifies the server MUST delete children of - * objects being deleted if and only if those children are not - * children of any other parent objects - *

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

- * The following canonical ClassificationNodes are defined for - * the DeletionScopeType ClassificationScheme: - *

- * DeleteRepositoryItemOnly - Specifies that the server - * MUST delete the RepositoryItem for the specified - * ExtrinsicObjects but MUST NOT delete the specified - * ExtrinsicObjects - *

- * DeleteAll (default) - Specifies that the request MUST - * delete both the RegistryObject and the RepositoryItem (if any) - * for the specified objects - *

- * 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. - *

- * 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: - *

- * {@link ReferencesExistsException} Returned in the following - * cases: - *

- * · If checkReferences is true and a reference exists to them - *
- *

- * {@link UnresolvedReferenceException} Returned in the - * following cases: - *

- * · 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 objRefs = new ArrayList(); - if (objRefList != null) { - objRefs.addAll(objRefList.getObjectRef()); - } - - List queriedRefs = new ArrayList(); - 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 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. - *

- * A server MUST return InvalidRequestException fault message if the client - * attempts to update the id, lid or objectType attribute of a - * RegistryObject. - *

- * 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. - *

- * 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. - *

- * UpdateAction – Specifies the details of how to update the target objects - *

- * checkReferences – Specifies the reference checking behavior expected of - * the server: - *

- * true - 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 - *

- * false (default) – 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 - *

- * mode – Specifies the semantics for how the server should handle - * RegistryObjects being updated in the server: - *

- * CreateOrReplace (default) - 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 - *

- * CreateOrVersion - 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 - *

- * CreateOnly – 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 objRefs = new ArrayList(); - if (objRefList != null) { - objRefs.addAll(objRefList.getObjectRef()); - } - - List queriedRefs = new ArrayList(); - 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 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 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 refList = new ArrayList(); - 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); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/QueryManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/QueryManagerImpl.java deleted file mode 100644 index 3fd18d82e7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/QueryManagerImpl.java +++ /dev/null @@ -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}. - * - *
- *
- * Note: Quoted comments come from regrep-rs.pdf - * - * @author jsherida - */ -public class QueryManagerImpl implements QueryManager { - - protected Map queryHandlers = Collections - .synchronizedMap(new HashMap()); - - /** 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 matchingObjects = new ArrayList(); - 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 objects = objList.getRegistryObject(); - objects.addAll(matchingObjects); - - response.setRegistryObjectList(objList); - - return response; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/ValidatorImpl.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/ValidatorImpl.java deleted file mode 100644 index 947fc14e39..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/ValidatorImpl.java +++ /dev/null @@ -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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/InsertMarshaller.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/InsertMarshaller.java deleted file mode 100644 index 0acd6476b8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/InsertMarshaller.java +++ /dev/null @@ -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: - - - - - - - - - - - */ - 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 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(); - } - - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/QueryMarshaller.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/QueryMarshaller.java deleted file mode 100644 index 3781386090..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/QueryMarshaller.java +++ /dev/null @@ -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 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(); - } - - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/RemoveMarshaller.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/RemoveMarshaller.java deleted file mode 100644 index cf7ddf1222..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/RemoveMarshaller.java +++ /dev/null @@ -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(); - } - - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/UpdateMarshaller.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/UpdateMarshaller.java deleted file mode 100644 index b3b7194dec..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/test/UpdateMarshaller.java +++ /dev/null @@ -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 - * - *

- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 16, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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(); - } - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlJaxbManager.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlJaxbManager.java deleted file mode 100644 index a026d56eb2..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlJaxbManager.java +++ /dev/null @@ -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 - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 14, 2011            bphillip     Initial creation
- * 
- * 
- * - * @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 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 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> classList = new ArrayList>(); - 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)); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlUtil.java b/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlUtil.java deleted file mode 100644 index 29827e3a71..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/util/EbxmlUtil.java +++ /dev/null @@ -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 UPDATE_MODES = new ArrayList(); - 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 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 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; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/META-INF/jax-ws-catalog.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/jax-ws-catalog.xml similarity index 100% rename from edexOsgi/com.raytheon.uf.edex.ebxml/META-INF/jax-ws-catalog.xml rename to edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/jax-ws-catalog.xml diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml index 8fc4387562..d703377800 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml @@ -15,7 +15,7 @@ + class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerImpl" /> diff --git a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/NotificationListenerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java similarity index 75% rename from edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/NotificationListenerImpl.java rename to edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java index 9ad13ee4cd..b3486f1c2d 100644 --- a/edexOsgi/com.raytheon.uf.edex.ebxml/src/com/raytheon/uf/edex/ebxml/services/NotificationListenerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/ebxml/minDB/ext/SubmitObjectsRequest_DataDelivery_OrganizationRoleScheme.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/ebxml/minDB/ext/SubmitObjectsRequest_DataDelivery_OrganizationRoleScheme.xml new file mode 100644 index 0000000000..dfcb57bc8a --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/ebxml/minDB/ext/SubmitObjectsRequest_DataDelivery_OrganizationRoleScheme.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.registry.feature/feature.xml index cc3daf7d53..8b1e771c4b 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.feature/feature.xml @@ -45,13 +45,6 @@ version="0.0.0" unpack="false"/> - - -