You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scout-dev@ws.apache.org by ge...@apache.org on 2005/02/11 19:43:22 UTC
svn commit: r153439 - in
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout:
registry/BusinessQueryManagerImpl.java util/ScoutJaxrUddiHelper.java
Author: geirm
Date: Fri Feb 11 10:43:20 2005
New Revision: 153439
URL: http://svn.apache.org/viewcvs?view=rev&rev=153439
Log:
- be defensive
- when the spec says return a concrete class, return a concrete class :)
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/util/ScoutJaxrUddiHelper.java
Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java?view=diff&r1=153438&r2=153439
==============================================================================
--- 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 Fri Feb 11 10:43:20 2005
@@ -47,6 +47,7 @@
import javax.xml.registry.LifeCycleManager;
import javax.xml.registry.RegistryService;
import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.BusinessLifeCycleManager;
import javax.xml.registry.infomodel.ClassificationScheme;
import javax.xml.registry.infomodel.Concept;
import javax.xml.registry.infomodel.Key;
@@ -478,53 +479,64 @@
public RegistryObject getRegistryObject(String id) throws JAXRException
{
- return null;
+ throw new UnsupportedCapabilityException();
}
public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException
{
IRegistry registry = registryService.getRegistry();
- RegistryObject regobj = null;
- if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
- {
- try
- {
+ BusinessLifeCycleManager lcm = registryService.getBusinessLifeCycleManager();
+
+ if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) {
+
+ try {
+
TModelDetail tmodeldetail = registry.getTModelDetail(id);
- regobj = (RegistryObject) ScoutUddiJaxrHelper.getConcept(tmodeldetail, registryService.getBusinessLifeCycleManager());
+ Concept c = ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
- } catch (RegistryException e)
- {
+ /*
+ * now turn into a concrete ClassificationScheme
+ */
+
+ ClassificationScheme scheme = new ClassificationSchemeImpl(lcm);
+
+ scheme.setName(c.getName());
+ scheme.setDescription(c.getDescription());
+ scheme.setKey(c.getKey());
+
+ return scheme;
+ }
+ catch (RegistryException e) {
e.printStackTrace();
throw new JAXRException(e.getLocalizedMessage());
}
}
- if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType))
- {
- //Get the Organization from the uddi registry
+ else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {
+
try
{
BusinessDetail orgdetail = registry.getBusinessDetail(id);
- regobj = (RegistryObject) ScoutUddiJaxrHelper.getOrganization(orgdetail, registryService.getBusinessLifeCycleManager());
- } catch (RegistryException e)
- {
+ return ScoutUddiJaxrHelper.getOrganization(orgdetail, lcm);
+ }
+ catch (RegistryException e) {
e.printStackTrace();
throw new JAXRException(e.getLocalizedMessage());
}
}
- if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType))
- {
+ else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) {
+
try
{
TModelDetail tmodeldetail = registry.getTModelDetail(id);
- regobj = (RegistryObject) ScoutUddiJaxrHelper.getConcept(tmodeldetail, registryService.getBusinessLifeCycleManager());
-
- } catch (RegistryException e)
- {
+ return ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm);
+ }
+ catch (RegistryException e) {
e.printStackTrace();
throw new JAXRException(e.getLocalizedMessage());
}
}
- return regobj;
+
+ return null;
}
public BulkResponse getRegistryObjects() throws JAXRException
@@ -534,7 +546,7 @@
public BulkResponse getRegistryObjects(Collection objectKeys) throws JAXRException
{
- return null;
+ throw new UnsupportedCapabilityException();
}
public BulkResponse getRegistryObjects(Collection objectKeys, String objectType) throws JAXRException
@@ -568,7 +580,7 @@
throw new JAXRException(e.getLocalizedMessage());
}
}
- if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType))
+ else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType))
{
//Get the Organization from the uddi registry
try
@@ -585,7 +597,7 @@
throw new JAXRException(e.getLocalizedMessage());
}
}
- if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType))
+ else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType))
{
try
{
@@ -606,9 +618,9 @@
}
- public BulkResponse getRegistryObjects(String objectTypes) throws JAXRException
+ public BulkResponse getRegistryObjects(String id) throws JAXRException
{
- return null;
+ throw new UnsupportedCapabilityException();
}
private static final Map findQualifierMapping;
Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java
URL: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/util/ScoutJaxrUddiHelper.java?view=diff&r1=153438&r2=153439
==============================================================================
--- 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 Fri Feb 11 10:43:20 2005
@@ -199,10 +199,32 @@
TModel tm = new TModel();
try
{
- tm.setTModelKey(scheme.getKey().getId());
- tm.setAuthorizedName(scheme.getSlot("authorizedName").getName());
- tm.setOperator(scheme.getSlot("operator").getName());
+ /*
+ * a fresh scheme might not have a key
+ */
+ Key k = scheme.getKey();
+
+ if(k != null) {
+ tm.setTModelKey(k.getId());
+
+ }
+
+ /*
+ * There's no reason to believe these are here either
+ */
+
+ Slot s = scheme.getSlot("authorizedName");
+
+ if (s != null) {
+ tm.setAuthorizedName(s.getName());
+ }
+
+ s = scheme.getSlot("operator");
+
+ if (s != null) {
+ tm.setOperator(s.getName());
+ }
InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) scheme).getName();
String name = iname.getValue();
---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org