Author: anil
Date: Wed Mar 9 18:43:50 2005
New Revision: 156725
URL: http://svn.apache.org/viewcvs?view=rev&rev=156725
Log:
Latest changes in Scout.
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
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/ConnectionImpl.java
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?view=diff&r1=156724&r2=156725
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Wed Mar 9 18:43:50 2005
@@ -19,31 +19,20 @@
import org.apache.juddi.IRegistry;
import org.apache.juddi.datatype.binding.BindingTemplate;
import org.apache.juddi.datatype.business.BusinessEntity;
-import org.apache.juddi.datatype.response.AuthToken;
-import org.apache.juddi.datatype.response.BindingDetail;
-import org.apache.juddi.datatype.response.BusinessDetail;
-import org.apache.juddi.datatype.response.DispositionReport;
-import org.apache.juddi.datatype.response.ErrInfo;
-import org.apache.juddi.datatype.response.Result;
-import org.apache.juddi.datatype.response.ServiceDetail;
-import org.apache.juddi.datatype.response.TModelDetail;
+import org.apache.juddi.datatype.response.*;
import org.apache.juddi.datatype.service.BusinessService;
import org.apache.juddi.datatype.tmodel.TModel;
+import org.apache.juddi.datatype.assertion.PublisherAssertion;
+import org.apache.juddi.datatype.KeyedReference;
+import org.apache.juddi.datatype.request.AuthInfo;
import org.apache.juddi.error.RegistryException;
import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
import org.apache.ws.scout.util.ScoutJaxrUddiHelper;
+import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
-import javax.xml.registry.DeleteException;
-import javax.xml.registry.InvalidRequestException;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.JAXRResponse;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.SaveException;
-import javax.xml.registry.UnexpectedObjectException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.*;
import javax.xml.registry.infomodel.Association;
import javax.xml.registry.infomodel.ClassificationScheme;
import javax.xml.registry.infomodel.Concept;
@@ -216,8 +205,48 @@
}
- public BulkResponse saveAssociations(Collection associationObjects,
boolean replace) throws JAXRException { //TODO
- return null;
+ public BulkResponse saveAssociations(Collection asso, boolean replace)
throws JAXRException { //TODO
+ BulkResponseImpl bulk = new BulkResponseImpl();
+ Vector svect = new Vector();
+
+ Collection coll = new ArrayList();
+ Collection exceptions = new ArrayList();
+
+
+ Iterator iter = asso.iterator();
+ while (iter.hasNext()) {
+ try {
+ PublisherAssertion pa =
ScoutJaxrUddiHelper.getPubAssertionFromJAXRAssociation((Association)
iter.next());
+ svect.add(pa);
+ }
+ catch (ClassCastException ce) {
+ throw new UnexpectedObjectException();
+ }
+ }
+ // Save PublisherAssertion
+ PublisherAssertions bd = null;
+ try {
+ bd = (PublisherAssertions) executeOperation(svect,
"SAVE_ASSOCIATION");
+ }
+ catch (RegistryException e) {
+ exceptions.add(new SaveException(e.getLocalizedMessage()));
+ bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
+ }
+ if(bd != null)
+ {
+ Vector keyvect = bd.getPublisherAssertionVector();
+ for (int i = 0; keyvect != null && i < keyvect.size(); i++) {
+ PublisherAssertion result = (PublisherAssertion)
keyvect.elementAt(i);
+ KeyedReference kr = result.getKeyedReference();
+ coll.add(kr.getTModelKey()); //TODO:Verify This
+
+ }
+ }
+ bulk.setCollection(coll);
+ bulk.setExceptions(exceptions);
+
+ return bulk;
}
public BulkResponse saveClassificationSchemes(Collection schemes) throws
JAXRException {
@@ -249,6 +278,7 @@
catch (RegistryException e) {
exceptions.add(new SaveException(e.getLocalizedMessage()));
bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
}
entityvect = td.getTModelVector();
@@ -293,6 +323,7 @@
catch (RegistryException e) {
exceptions.add(new SaveException(e.getLocalizedMessage()));
bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
}
entityvect = td.getTModelVector();
@@ -337,6 +368,7 @@
catch (RegistryException e) {
exceptions.add(new SaveException(e.getLocalizedMessage()));
bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
}
entityvect = bd.getBusinessEntityVector();
@@ -377,6 +409,7 @@
catch (RegistryException e) {
exceptions.add(new SaveException(e.getLocalizedMessage()));
bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
}
sbvect = bd.getBindingTemplateVector();
@@ -416,6 +449,7 @@
catch (RegistryException e) {
exceptions.add(new SaveException(e.getLocalizedMessage()));
bulk.setStatus(JAXRResponse.STATUS_FAILURE);
+ return bulk;
}
svect = sd.getBusinessServiceVector();
@@ -430,10 +464,22 @@
}
public void confirmAssociation(Association assoc) throws JAXRException,
InvalidRequestException {
- //TODO
- }
-
- public void unConfirmAssociation(Association assoc) throws JAXRException,
InvalidRequestException { //TODO
+ //Store it in the UDDI registry
+ Collection col = new ArrayList();
+ col.add(assoc);
+ BulkResponse br = this.saveAssociations(col, true);
+ if(br.getExceptions()!= null)
+ throw new JAXRException("Confiming the Association Failed");
+ }
+
+ public void unConfirmAssociation(Association assoc) throws JAXRException,
InvalidRequestException {
+ //TODO
+ //Delete it from the UDDI registry
+ Collection col = new ArrayList();
+ col.add(assoc.getKey());
+ BulkResponse br = this.deleteAssociations(col);
+ if(br.getExceptions()!= null)
+ throw new JAXRException("UnConfiming the Association Failed");
}
//Protected Methods
@@ -449,7 +495,10 @@
ConnectionImpl connection = registry.getConnection();
AuthToken token = getAuthToken(connection, ireg);
-
+ if(op.equalsIgnoreCase("SAVE_ASSOCIATION"))
+ {
+ regobj = ireg.setPublisherAssertions(token.getAuthInfo(),
datavect);
+ } else
if (op.equalsIgnoreCase("SAVE_SERVICE")) {
regobj = ireg.saveService(token.getAuthInfo(), datavect);
}
@@ -463,6 +512,7 @@
regobj = ireg.saveTModel(token.getAuthInfo(), datavect);
}
else if (op.equalsIgnoreCase("DELETE_ORG")) {
+ clearPublisherAssertions(token.getAuthInfo(),datavect,ireg);
regobj = ireg.deleteBusiness(token.getAuthInfo(), datavect);
}
else if (op.equalsIgnoreCase("DELETE_SERVICE")) {
@@ -475,7 +525,14 @@
regobj = ireg.deleteTModel(token.getAuthInfo(), datavect);
}
else if (op.equalsIgnoreCase("DELETE_ASSOCIATION")) {
- regobj = ireg.deletePublisherAssertions(token.getAuthInfo(),
datavect);
+ int len = datavect.size();
+ Vector pavect = new Vector(len);
+ for(int i=0;i<len;i++)
+ {
+ String keystr = (String)datavect.elementAt(i);
+
pavect.add(ScoutJaxrUddiHelper.getPubAssertionFromJAXRAssociationKey(keystr));
+ }
+ regobj = ireg.deletePublisherAssertions(token.getAuthInfo(),
pavect);
}
else if (op.equalsIgnoreCase("DELETE_CLASSIFICATIONSCHEME")) {
regobj = ireg.deleteTModel(token.getAuthInfo(), datavect);
@@ -488,9 +545,61 @@
}
+ private void clearPublisherAssertions( AuthInfo authinfo,Vector
orgkeys,IRegistry ireg) throws JAXRException
+ {
+
+ Vector pasvect = null;
+ try
+ {
+ AssertionStatusReport report =
ireg.getAssertionStatusReport(authinfo,"");
+ Vector v = report.getAssertionStatusItemVector();
+
+ int len = 0;
+ if (v != null)
+ {
+ len = v.size();
+ }
+ for (int i = 0; i < len; i++)
+ {
+ AssertionStatusItem asi = (AssertionStatusItem) v.elementAt(i);
+ String sourceKey = asi.getFromKey();
+ String targetKey = asi.getToKey();
+ PublisherAssertion pa = new PublisherAssertion();
+ pa.setFromKey(sourceKey);
+ pa.setToKey(targetKey);
+ KeyedReference keyr = asi.getKeyedReference();
+ pa.setKeyedReference(keyr);
+ pa.setTModelKey(keyr.getTModelKey());
+ pa.setKeyName(keyr.getKeyName());
+ pa.setKeyValue(keyr.getKeyValue());
+ if(pasvect == null) pasvect = new Vector(len);
+ pasvect.add(pa);
+ }
+ }
+ catch (RegistryException e)
+ {
+ e.printStackTrace();
+ }
+
+ if(pasvect != null && pasvect.size() > 0)
+ try
+ {
+ ireg.deletePublisherAssertions(authinfo,pasvect);
+ }
+ catch (RegistryException e)
+ {
+ e.printStackTrace();
+ //IGNORE
+ }
+ }
+
+
protected BulkResponse deleteOperation(Collection keys, String op)
throws JAXRException {
+ if(keys == null)
+ throw new JAXRException("Keys provided to "+op+" are null");
+
//Now we need to convert the collection into a vector for juddi
BulkResponseImpl bulk = new BulkResponseImpl();
Vector keyvect = new Vector();
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=156724&r2=156725
==============================================================================
---
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 Mar 9 18:43:50 2005
@@ -17,32 +17,27 @@
package org.apache.ws.scout.registry;
import org.apache.juddi.IRegistry;
+import org.apache.juddi.datatype.KeyedReference;
import org.apache.juddi.datatype.Name;
-import org.apache.juddi.datatype.service.BusinessService;
+import org.apache.juddi.datatype.assertion.PublisherAssertion;
+import org.apache.juddi.datatype.binding.BindingTemplate;
import org.apache.juddi.datatype.business.BusinessEntity;
import org.apache.juddi.datatype.request.FindQualifiers;
-import org.apache.juddi.datatype.response.BusinessDetail;
-import org.apache.juddi.datatype.response.BusinessInfo;
-import org.apache.juddi.datatype.response.BusinessList;
-import org.apache.juddi.datatype.response.TModelDetail;
-import org.apache.juddi.datatype.response.TModelInfo;
-import org.apache.juddi.datatype.response.TModelInfos;
-import org.apache.juddi.datatype.response.TModelList;
-import org.apache.juddi.datatype.response.ServiceList;
-import org.apache.juddi.datatype.response.ServiceInfos;
-import org.apache.juddi.datatype.response.ServiceInfo;
-import org.apache.juddi.datatype.response.ServiceDetail;
+import org.apache.juddi.datatype.response.*;
+import org.apache.juddi.datatype.service.BusinessService;
import org.apache.juddi.datatype.tmodel.TModel;
import org.apache.juddi.error.RegistryException;
import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
import org.apache.ws.scout.registry.infomodel.KeyImpl;
-import org.apache.ws.scout.registry.infomodel.ConceptImpl;
-import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceBindingImpl;
+import org.apache.ws.scout.registry.infomodel.AssociationImpl;
import org.apache.ws.scout.util.EnumerationHelper;
import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
import javax.xml.registry.BusinessQueryManager;
import javax.xml.registry.FindQualifier;
import javax.xml.registry.InvalidRequestException;
@@ -50,20 +45,23 @@
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.Association;
import javax.xml.registry.infomodel.ClassificationScheme;
import javax.xml.registry.infomodel.Concept;
import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.RegistryObject;
import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.ServiceBinding;
+import java.net.PasswordAuthentication;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Vector;
-import java.util.List;
/**
* Implements the JAXR BusinessQueryManager Interface
@@ -145,7 +143,49 @@
String targetObjectId,
Collection associationTypes) throws
JAXRException
{
- return null;
+ //TODO: Currently we just return all the Association objects owned by
the caller
+ IRegistry registry = registryService.getRegistry();
+ try
+ {
+ FindQualifiers juddiFindQualifiers =
mapFindQualifiers(findQualifiers);
+
+ ConnectionImpl con =
((RegistryServiceImpl)getRegistryService()).getConnection();
+ AuthToken auth = this.getAuthToken(con,registry);
+ PublisherAssertions result =
+ registry.getPublisherAssertions(auth.getAuthInfo());
+ Vector v = result.getPublisherAssertionVector();
+
+ Collection col = null;
+ int len = 0;
+ if (v != null)
+ {
+ len = v.size();
+ col = new ArrayList(len);
+ }
+ for (int i = 0; i < len; i++)
+ {
+ PublisherAssertion pas = (PublisherAssertion) v.elementAt(i);
+ String sourceKey = pas.getFromKey();
+ String targetKey = pas.getToKey();
+ Collection orgcol = new ArrayList();
+ orgcol.add(new KeyImpl(sourceKey));
+ orgcol.add(new KeyImpl(targetKey));
+ BulkResponse bl = getRegistryObjects(orgcol,
LifeCycleManager.ORGANIZATION);
+ Association asso =
ScoutUddiJaxrHelper.getAssociation(bl.getCollection(),
+
registryService.getBusinessLifeCycleManager());
+ KeyedReference keyr = pas.getKeyedReference();
+ Concept c = new
ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
+ c.setName(new InternationalStringImpl(keyr.getKeyName()));
+ c.setKey( new KeyImpl(keyr.getTModelKey()) );
+ c.setValue(keyr.getKeyValue());
+ asso.setAssociationType(c);
+ col.add(asso);
+ }
+ return new BulkResponseImpl(col);
+ } catch (RegistryException e)
+ {
+ throw new JAXRException(e);
+ }
}
public BulkResponse findCallerAssociations(Collection findQualifiers,
@@ -153,7 +193,72 @@
Boolean confirmedByOtherParty,
Collection associationTypes)
throws JAXRException
{
- return null;
+ //TODO: Currently we just return all the Association objects owned by
the caller
+ IRegistry registry = registryService.getRegistry();
+ try
+ {
+ FindQualifiers juddiFindQualifiers =
mapFindQualifiers(findQualifiers);
+
+ ConnectionImpl con =
((RegistryServiceImpl)getRegistryService()).getConnection();
+ AuthToken auth = this.getAuthToken(con,registry);
+
+ AssertionStatusReport report = null;
+ String confirm = "";
+ boolean caller = confirmedByCaller.booleanValue();
+ boolean other = confirmedByOtherParty.booleanValue();
+
+ if(caller && other )
+ confirm = CompletionStatus.COMPLETE;
+ else
+ if(!caller && other )
+ confirm = CompletionStatus.FROMKEY_INCOMPLETE;
+ else
+ if(caller && !other )
+ confirm = CompletionStatus.TOKEY_INCOMPLETE;
+
+ report =
registry.getAssertionStatusReport(auth.getAuthInfo(),confirm);
+ Vector v = report.getAssertionStatusItemVector();
+ Collection col = new ArrayList();
+ int len = 0;
+ if (v != null)
+ {
+ len = v.size();
+ col = new ArrayList(len);
+ }
+ for (int i = 0; i < len; i++)
+ {
+ AssertionStatusItem asi = (AssertionStatusItem) v.elementAt(i);
+ String sourceKey = asi.getFromKey();
+ String targetKey = asi.getToKey();
+ Collection orgcol = new ArrayList();
+ orgcol.add(new KeyImpl(sourceKey));
+ orgcol.add(new KeyImpl(targetKey));
+ BulkResponse bl = getRegistryObjects(orgcol,
LifeCycleManager.ORGANIZATION);
+ Association asso =
ScoutUddiJaxrHelper.getAssociation(bl.getCollection(),
+
registryService.getBusinessLifeCycleManager());
+ //Set Confirmation
+ ((AssociationImpl)asso).setConfirmedBySourceOwner(caller);
+ ((AssociationImpl)asso).setConfirmedByTargetOwner(other);
+
+ if(confirm != CompletionStatus.COMPLETE)
+ ((AssociationImpl)asso).setConfirmed(false);
+
+ Concept c = new
ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
+ KeyedReference keyr = asi.getKeyedReference();
+ c.setKey(new KeyImpl(keyr.getTModelKey()));
+ c.setName(new InternationalStringImpl(keyr.getKeyName()));
+ c.setValue(keyr.getKeyValue());
+ asso.setKey(new KeyImpl(keyr.getTModelKey())); //TODO:Validate
this
+ asso.setAssociationType(c);
+ col.add(asso);
+ }
+
+
+ return new BulkResponseImpl(col);
+ } catch (RegistryException e)
+ {
+ throw new JAXRException(e);
+ }
}
/**
@@ -181,12 +286,30 @@
scheme.setName(new InternationalStringImpl(namePatterns));
scheme.setKey(new KeyImpl(TModel.D_U_N_S_TMODEL_KEY));
}
+ else if (namePatterns.indexOf("uddi-org:iso-ch:3166:1999") != -1)
+ {
+ scheme = new
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+ scheme.setName(new InternationalStringImpl(namePatterns));
+ scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));
+ }
else if (namePatterns.indexOf("uddi-org:iso-ch:3166-1999") != -1)
{
scheme = new
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
scheme.setName(new InternationalStringImpl(namePatterns));
scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));
}
+ else if (namePatterns.indexOf("iso-ch:3166:1999") != -1)
+ {
+ scheme = new
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+ scheme.setName(new InternationalStringImpl(namePatterns));
+ scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));
+ }
+ else if (namePatterns.indexOf("iso-ch:3166-1999") != -1)
+ {
+ scheme = new
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
+ scheme.setName(new InternationalStringImpl(namePatterns));
+ scheme.setKey(new KeyImpl(TModel.ISO_CH_TMODEL_KEY));
+ }
else if (namePatterns.indexOf("unspsc-org:unspsc") != -1) {
scheme = new
ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl());
@@ -352,7 +475,19 @@
Collection classifications,
Collection externalLinks)
throws JAXRException
{
- return null;
+ //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
@@ -417,7 +552,43 @@
Collection classifications,
Collection specifications) throws
JAXRException
{
- return null;
+ BulkResponseImpl blkRes = new BulkResponseImpl();
+
+ IRegistry iRegistry = registryService.getRegistry();
+ FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
+
+ try
+ {
+
+ BindingDetail l =
iRegistry.findBinding(serviceKey.getId(),null,null,juddiFindQualifiers,registryService.getMaxRows());
+
+ /*
+ * now convert from jUDDI ServiceInfo objects to JAXR Services
+ */
+ if (l != null) {
+
+ Vector bindvect= l.getBindingTemplateVector();
+ Collection col = new ArrayList();
+
+ for (int i=0; bindvect != null && i < bindvect.size(); i++) {
+ BindingTemplate si = (BindingTemplate)
bindvect.elementAt(i);
+ ServiceBinding sb =
ScoutUddiJaxrHelper.getServiceBinding(si,
+ registryService.getBusinessLifeCycleManager());
+ col.add(sb);
+ //Fill the Service object by making a call to registry
+ Service s = (Service)getRegistryObject(serviceKey.getId(),
LifeCycleManager.SERVICE);
+ ((ServiceBindingImpl)sb).setService(s);
+ }
+
+ blkRes.setCollection(col);
+ }
+ }
+ catch (RegistryException e) {
+ e.printStackTrace();
+ throw new JAXRException(e.getLocalizedMessage());
+ }
+
+ return blkRes;
}
@@ -552,6 +723,7 @@
try {
+
ServiceDetail sd = registry.getServiceDetail(id);
if (sd != null) {
@@ -814,5 +986,33 @@
result.add(new Name(pattern));
}
return result;
+ }
+
+ /**
+ * Get the Auth Token from the registry
+ *
+ * @param connection
+ * @param ireg
+ * @return auth token
+ * @throws JAXRException
+ */
+ private AuthToken getAuthToken(ConnectionImpl connection, IRegistry ireg)
+ throws JAXRException {
+ Set creds = connection.getCredentials();
+ Iterator it = creds.iterator();
+ String username = "", pwd = "";
+ while (it.hasNext()) {
+ PasswordAuthentication pass = (PasswordAuthentication) it.next();
+ username = pass.getUserName();
+ pwd = new String(pass.getPassword());
+ }
+ AuthToken token = null;
+ try {
+ token = ireg.getAuthToken(username, pwd);
+ }
+ catch (Exception e) {
+ throw new JAXRException(e);
+ }
+ return token;
}
}
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java?view=diff&r1=156724&r2=156725
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/ConnectionImpl.java
Wed Mar 9 18:43:50 2005
@@ -55,7 +55,7 @@
* Even if the properties passed contains no values,
* juddi takes default values
*/
- registry = new RegistryProxy(prop);
+ registry = new RegistryProxy(prop);
registry.setInquiryURL(queryManagerURL);
registry.setPublishURL(lifeCycleManagerURL);
this.postalScheme = postalScheme;
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java?view=diff&r1=156724&r2=156725
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/RegistryServiceImpl.java
Wed Mar 9 18:43:50 2005
@@ -17,6 +17,7 @@
package org.apache.ws.scout.registry;
import org.apache.juddi.IRegistry;
+import org.apache.juddi.error.RegistryException;
import org.apache.juddi.proxy.RegistryProxy;
import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
import org.apache.ws.scout.registry.infomodel.KeyImpl;
@@ -116,7 +117,24 @@
public String makeRegistrySpecificRequest(String s) throws JAXRException
{
- throw new UnsupportedCapabilityException();
+ String inquiry = "INQUIRY";
+ String publish = "PUBLISH";
+ String type = "";
+
+ //TODO: Need a better way to do this
+ String snippet = s.substring(0,20);
+ if( snippet.indexOf("save") > -1) type = publish;
+ else
+ type = inquiry;
+
+ try
+ {
+ return registry.execute(s,type);
+ }
+ catch (RegistryException e)
+ {
+ throw new JAXRException(e.getLocalizedMessage());
+ }
}
public ConnectionImpl getConnection()
Modified:
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
URL:
http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java?view=diff&r1=156724&r2=156725
==============================================================================
---
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
(original)
+++
webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/infomodel/AssociationImpl.java
Wed Mar 9 18:43:50 2005
@@ -22,6 +22,7 @@
import javax.xml.registry.infomodel.Concept;
import javax.xml.registry.infomodel.InternationalString;
import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Key;
/**
* Implements JAXR Association Interface.
@@ -98,4 +99,57 @@
{
target = ro;
}
+
+ /**
+ * There is an impedance mismatch as specified in the JAXR specification
+ * Section D-11
+ */
+ public Key getKey()
+ {
+ String id = null;
+ Key key = null;
+ try
+ {
+ id = source.getKey().getId();
+ id += ":" + target.getKey().getId();
+ Key k = null;
+ if(type != null ) k = type.getKey();
+ if(k == null || k.getId() == "" ) id +=":NULL";
+ else
+ id+=":"+k.getId();
+ id += ":" + "Concept"; //UDDI: KeyedReference->Key Name
+ String val = "NULL";
+ if(type!= null) id += ":" + type.getValue();
+ else id +=":NULL";
+
+ }
+ catch (JAXRException e)
+ {
+ e.printStackTrace();
+ }
+
+ if(id != null) key = new KeyImpl(id);
+ return key;
+ }
+
+ public void setConfirmed(boolean b)
+ {
+ this.isConfirmed = b;
+ }
+
+ public void setConfirmedBySourceOwner(boolean b)
+ {
+ isConfirmedBySourceOwner = b;
+ }
+
+ public void setConfirmedByTargetOwner(boolean b)
+ {
+ isConfirmedByTargetOwner = b;
+ }
+
+ public void setExtramural(boolean b)
+ {
+ isExtramural = b;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]