Author: kstam
Date: Wed May 2 21:24:39 2007
New Revision: 534703
URL: http://svn.apache.org/viewvc?view=rev&rev=534703
Log:
SCOUT-30 Applying patch which enables the handling of classifications
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
URL:
http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java?view=diff&rev=534703&r1=534702&r2=534703
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
Wed May 2 21:24:39 2007
@@ -24,6 +24,7 @@
import org.apache.ws.scout.registry.infomodel.AssociationImpl;
import org.apache.ws.scout.util.EnumerationHelper;
import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
+import org.apache.ws.scout.util.ScoutJaxrUddiHelper;
import org.apache.ws.scout.uddi.AssertionStatusItem;
import org.apache.ws.scout.uddi.AssertionStatusReport;
@@ -121,7 +122,10 @@
FindQualifiers juddiFindQualifiers =
mapFindQualifiers(findQualifiers);
Name[] nameArray = mapNamePatterns(namePatterns);
BusinessList result = registry.findBusiness(nameArray,
- null, null, null, null,
+ null,
+
ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers),
+
ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
+ null,
juddiFindQualifiers,
registryService.getMaxRows());
BusinessInfo[] a = result.getBusinessInfos() != null ?
result.getBusinessInfos().getBusinessInfoArray() : null;
@@ -475,25 +479,24 @@
scheme.addChildConcept(c);
}
- public BulkResponse findClassificationSchemes(Collection findQualifiers,
- Collection namePatterns,
- Collection classifications,
- Collection externalLinks)
throws JAXRException
- {
- //TODO: Handle this better
- Collection col = new ArrayList();
- Iterator iter = namePatterns.iterator();
- String name = "";
- while(iter.hasNext())
- {
- name = (String)iter.next();
- break;
- }
-
- col.add(this.findClassificationSchemeByName(findQualifiers,name));
- return new BulkResponseImpl(col);
-
- }
+ public BulkResponse findClassificationSchemes(Collection findQualifiers,
+
Collection namePatterns,
+
Collection classifications,
+
Collection externalLinks) throws JAXRException
+ {
+ //TODO: Handle this better
+ Collection col = new ArrayList();
+ Iterator iter = namePatterns.iterator();
+ String name = "";
+ while(iter.hasNext())
+ {
+ name = (String)iter.next();
+ break;
+ }
+
+
col.add(this.findClassificationSchemeByName(findQualifiers,name));
+ return new BulkResponseImpl(col);
+ }
public Concept findConceptByPath(String path) throws JAXRException
{
@@ -523,7 +526,10 @@
String namestr = (String) iter.next();
try
{
- TModelList list = registry.findTModel(namestr, null, null,
juddiFindQualifiers, 10);
+ TModelList list = registry.findTModel(namestr,
+
ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
+
ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers),
+ juddiFindQualifiers, 10);
TModelInfos infos = null;
TModelInfo[] tmarr = null;
if (list != null) infos = list.getTModelInfos();
@@ -565,7 +571,10 @@
try
{
- BindingDetail l =
iRegistry.findBinding(serviceKey.getId(),null,null,juddiFindQualifiers,registryService.getMaxRows());
+ BindingDetail l = iRegistry.findBinding(serviceKey.getId(),
+
ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
+ null,
+ juddiFindQualifiers,registryService.getMaxRows());
/*
* now convert from jUDDI ServiceInfo objects to JAXR Services
@@ -635,8 +644,11 @@
id = orgKey.getId();
}
- ServiceList l = iRegistry.findService(id, juddiNames,
- null, null, juddiFindQualifiers,
registryService.getMaxRows());
+ ServiceList l = iRegistry.findService(id,
+ juddiNames,
+
ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
+ null,
+ juddiFindQualifiers, registryService.getMaxRows());
/*
* now convert from jUDDI ServiceInfo objects to JAXR Services
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
URL:
http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java?view=diff&rev=534703&r1=534702&r2=534703
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/RegistryObjectImpl.java
Wed May 2 21:24:39 2007
@@ -109,10 +109,12 @@
public void addClassifications(Collection collection)
{
- for (Iterator i = collection.iterator(); i.hasNext();)
- {
- Classification classification = (Classification) i.next();
- classifications.add(classification);
+ if (collection!=null) {
+ for (Iterator i = collection.iterator(); i.hasNext();)
+ {
+ Classification classification = (Classification) i.next();
+ classifications.add(classification);
+ }
}
}
@@ -202,11 +204,13 @@
public void addExternalIdentifiers(Collection collection)
{
- for (Iterator i = collection.iterator(); i.hasNext();)
- {
- ExternalIdentifier externalId = (ExternalIdentifier) i.next();
- externalIds.add(externalId);
- ((ExternalIdentifierImpl) externalId).setRegistryObject(this);
+ if (collection!=null) {
+ for (Iterator i = collection.iterator(); i.hasNext();)
+ {
+ ExternalIdentifier externalId = (ExternalIdentifier) i.next();
+ externalIds.add(externalId);
+ ((ExternalIdentifierImpl) externalId).setRegistryObject(this);
+ }
}
}
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
URL:
http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java?view=diff&rev=534703&r1=534702&r2=534703
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
Wed May 2 21:24:39 2007
@@ -40,6 +40,7 @@
import org.apache.ws.scout.uddi.URLType;
import org.apache.ws.scout.uddi.TModelInstanceDetails;
import org.apache.ws.scout.uddi.TModelInstanceInfo;
+import org.apache.xmlbeans.XmlObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -311,7 +312,7 @@
bs.setServiceKey(serve.getKey().getId());
}
- addCategories(serve.getClassifications(),
bs.addNewCategoryBag());
+
bs.setCategoryBag(getCategoryBagFromClassifications(serve.getClassifications()));
// TODO: need to do ServiceBindings->BindingTemplates
@@ -370,8 +371,8 @@
emptyDesc.setStringValue(scheme.getDescription().getValue());
}
- addIdentifiers(scheme.getExternalIdentifiers(),
tm.addNewIdentifierBag());
- addCategories(scheme.getClassifications(),
tm.addNewCategoryBag());
+
tm.setIdentifierBag(getIdentifierBagFromExternalIdentifiers(scheme.getExternalIdentifiers()));
+
tm.setCategoryBag(getCategoryBagFromClassifications(scheme.getClassifications()));
// ToDO: overviewDoc
} catch (Exception ud) {
@@ -414,8 +415,8 @@
emptyDesc.setStringValue(scheme.getDescription().getValue());
}
- addIdentifiers(scheme.getExternalIdentifiers(),
tm.addNewIdentifierBag());
- addCategories(scheme.getClassifications(),
tm.addNewCategoryBag());
+
tm.setIdentifierBag(getIdentifierBagFromExternalIdentifiers(scheme.getExternalIdentifiers()));
+
tm.setCategoryBag(getCategoryBagFromClassifications(scheme.getClassifications()));
// ToDO: overviewDoc
@@ -550,8 +551,8 @@
}
}
- addIdentifiers(org.getExternalIdentifiers(),
biz.addNewIdentifierBag());
- addCategories(org.getClassifications(),
biz.addNewCategoryBag());
+
biz.setIdentifierBag(getIdentifierBagFromExternalIdentifiers(org.getExternalIdentifiers()));
+
biz.setCategoryBag(getCategoryBagFromClassifications(org.getClassifications()));
} catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
@@ -676,7 +677,7 @@
return uri;
}
- /**
+ /**
* According to JAXR Javadoc, there are two types of classification,
internal and external and they use the Classification, Concept,
* and ClassificationScheme objects. It seems the only difference between
internal and external (as related to UDDI) is that the
* name/value pair of the categorization is held in the Concept for
internal classifications and the Classification for external (bypassing
@@ -690,12 +691,13 @@
* @param destinationObj
* @throws JAXRException
*/
- private static void addCategories(Collection classifications, CategoryBag
cbag) throws JAXRException {
+ public static CategoryBag getCategoryBagFromClassifications(Collection
classifications) throws JAXRException {
try {
- if (classifications == null || cbag == null)
- return;
+ if (classifications == null)
+ return null;
// Classifications
+ CategoryBag cbag =
(CategoryBag)(XmlObject.Factory.newInstance()).changeType(CategoryBag.type);
Iterator classiter = classifications.iterator();
while (classiter.hasNext()) {
Classification classification =
(Classification) classiter.next();
@@ -733,24 +735,26 @@
}
}
}
+ return cbag;
} catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
}
- /**
+ /**
* Adds the objects identifiers from JAXR's external identifier collection
*
* @param identifiers
* @param ibag
* @throws JAXRException
*/
- private static void addIdentifiers(Collection identifiers, IdentifierBag
ibag) throws JAXRException {
+ public static IdentifierBag
getIdentifierBagFromExternalIdentifiers(Collection identifiers) throws
JAXRException {
try {
- if (identifiers == null || ibag == null)
- return;
+ if (identifiers == null)
+ return null;
// Identifiers
+ IdentifierBag ibag =
(IdentifierBag)(XmlObject.Factory.newInstance()).changeType(IdentifierBag.type);
Iterator iditer = identifiers.iterator();
while (iditer.hasNext()) {
ExternalIdentifier extid = (ExternalIdentifier)
iditer.next();
@@ -775,10 +779,10 @@
}
}
}
+ return ibag;
} catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
}
-
}
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
URL:
http://svn.apache.org/viewvc/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java?view=diff&rev=534703&r1=534702&r2=534703
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
Wed May 2 21:24:39 2007
@@ -43,6 +43,7 @@
import javax.xml.registry.LifeCycleManager;
import javax.xml.registry.infomodel.*;
import java.util.Collection;
+import java.util.ArrayList;
/**
* Helper class that does UDDI->Jaxr Mapping
@@ -131,9 +132,8 @@
}
}
-
- addExternalIdentifiers(entity.getIdentifierBag(), org, lcm);
- addClassifications(entity.getCategoryBag(), org, lcm);
+
org.addExternalIdentifiers(getExternalIdentifiers(entity.getIdentifierBag(),
lcm));
+ org.addClassifications(getClassifications(entity.getCategoryBag(), lcm));
return org;
}
@@ -210,8 +210,8 @@
}
}
- addExternalIdentifiers(entity.getIdentifierBag(), org, lcm);
- addClassifications(entity.getCategoryBag(), org, lcm);
+
org.addExternalIdentifiers(getExternalIdentifiers(entity.getIdentifierBag(),
lcm));
+ org.addClassifications(getClassifications(entity.getCategoryBag(), lcm));
return org;
}
@@ -256,7 +256,7 @@
serve.addServiceBinding(getServiceBinding(bindingTemplate, lcm));
}
- addClassifications(bs.getCategoryBag(), serve, lcm);
+ serve.addClassifications(getClassifications(bs.getCategoryBag(), lcm));
return serve;
}
@@ -323,16 +323,15 @@
TModel tmodel = tc != null && tc.length > 0 ? tc[0] : null;
if (tmodel != null) {
- concept.setKey(lcm.createKey(tmodel.getTModelKey()));
+ concept.setKey(lcm.createKey(tmodel.getTModelKey()));
concept.setName(lcm.createInternationalString(tmodel.getName().getStringValue()));
- Description desc = getDescription(tmodel);
+ Description desc = getDescription(tmodel);
if( desc != null )
concept.setDescription(lcm.createInternationalString(desc.getStringValue()));
- addExternalIdentifiers(tmodel.getIdentifierBag(), concept, lcm);
- addClassifications(tmodel.getCategoryBag(), concept, lcm);
+
concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(),
lcm));
+
concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lcm));
}
-
return concept;
}
@@ -346,8 +345,8 @@
Description desc = getDescription(tmodel);
concept.setDescription(lcm.createInternationalString(desc.getStringValue()));
- addExternalIdentifiers(tmodel.getIdentifierBag(), concept, lcm);
- addClassifications(tmodel.getCategoryBag(), concept, lcm);
+
concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(),
lcm));
+ concept.addClassifications(getClassifications(tmodel.getCategoryBag(),
lcm));
return concept;
}
@@ -377,26 +376,29 @@
* @param lcm
* @throws JAXRException
*/
- private static void addClassifications(CategoryBag cbag, RegistryObject
destinationObj, LifeCycleManager lcm) throws JAXRException {
- if (cbag != null) {
- KeyedReference[] keyrarr = cbag.getKeyedReferenceArray();
- for (int i = 0; keyrarr != null && i < keyrarr.length; i++)
- {
- KeyedReference keyr = (KeyedReference)keyrarr[i];
- Classification classification = new ClassificationImpl(lcm);
- classification.setValue(keyr.getKeyValue());
- classification.setName(new
InternationalStringImpl(keyr.getKeyName()));
-
- String tmodelKey = keyr.getTModelKey();
- if (tmodelKey != null) {
- ClassificationScheme scheme = new
ClassificationSchemeImpl(lcm);
- scheme.setKey(new KeyImpl(tmodelKey));
- classification.setClassificationScheme(scheme);
- }
- destinationObj.addClassification(classification);
- }
- }
- }
+ public static Collection getClassifications(CategoryBag cbag,
LifeCycleManager lcm) throws JAXRException {
+ Collection<Classification> classifications = null;
+ if (cbag != null) {
+ classifications = new ArrayList<Classification>();
+ KeyedReference[] keyrarr =
cbag.getKeyedReferenceArray();
+ for (int i = 0; keyrarr != null && i < keyrarr.length;
i++)
+ {
+ KeyedReference keyr =
(KeyedReference)keyrarr[i];
+ Classification classification = new
ClassificationImpl(lcm);
+ classification.setValue(keyr.getKeyValue());
+ classification.setName(new
InternationalStringImpl(keyr.getKeyName()));
+
+ String tmodelKey = keyr.getTModelKey();
+ if (tmodelKey != null) {
+ ClassificationScheme scheme = new
ClassificationSchemeImpl(lcm);
+ scheme.setKey(new KeyImpl(tmodelKey));
+
classification.setClassificationScheme(scheme);
+ }
+ classifications.add(classification);
+ }
+ }
+ return classifications;
+ }
/**
* External Identifiers
@@ -406,8 +408,10 @@
* @param lcm
* @throws JAXRException
*/
- private static void addExternalIdentifiers(IdentifierBag ibag,
RegistryObject destinationObj, LifeCycleManager lcm) throws JAXRException {
+ public static Collection getExternalIdentifiers(IdentifierBag ibag,
LifeCycleManager lcm) throws JAXRException {
+ Collection<ExternalIdentifier> extidentifiers = null;
if (ibag != null) {
+ extidentifiers = new ArrayList<ExternalIdentifier>();
KeyedReference[] keyrarr = ibag.getKeyedReferenceArray();
for (int i = 0; keyrarr != null && i < keyrarr.length; i++)
{
@@ -422,9 +426,10 @@
scheme.setKey(new KeyImpl(tmodelKey));
extId.setIdentificationScheme(scheme);
}
- destinationObj.addExternalIdentifier(extId);
+ extidentifiers.add(extId);
}
}
+ return extidentifiers;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]