List of usage examples for javax.xml.registry JAXRException JAXRException
public JAXRException(Throwable cause)
JAXRException
object initialized with the given Throwable
object. From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
protected BulkResponse deleteOperation(Collection<Key> 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(); String[] keyarr = new String[keys.size()]; Result[] keyResultArr;/* w ww . j a v a 2 s. co m*/ LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); try { Iterator iter = keys.iterator(); int currLoc = 0; while (iter.hasNext()) { Key key = (Key) iter.next(); keyarr[currLoc] = key.getId(); currLoc++; } // Save business DispositionReport bd = (DispositionReport) executeOperation(keyarr, op); List<Result> resultList = bd.getResult(); keyResultArr = new Result[resultList.size()]; resultList.toArray(keyResultArr); log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length : 0); for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) { Result result = (Result) keyResultArr[i]; int errno = result.getErrno(); if (errno == 0) { coll.addAll(keys); } else { ErrInfo errinfo = result.getErrInfo(); DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue()); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } } } catch (RegistryException regExcept) { /* * jUDDI (and prollie others) throw an exception on any fault in * the transaction w/ the registry, so we don't get any partial * success */ DeleteException de = new DeleteException(regExcept.getFaultCode() + ":" + regExcept.getFaultString(), regExcept); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } catch (JAXRException tran) { exceptions.add(new JAXRException("Apache JAXR Impl:", tran)); bulk.setStatus(JAXRResponse.STATUS_FAILURE); } bulk.setCollection(coll); bulk.setExceptions(exceptions); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
/** * Get the Auth Token from the registry//from w w w . ja va 2 s . c om * * @param connection * @param ireg * @return auth token * @throws JAXRException */ private AuthToken getAuthToken(ConnectionImpl connection, IRegistry ireg) throws JAXRException { Set creds = connection.getCredentials(); String username = "", pwd = ""; if (creds != null) { Iterator it = creds.iterator(); while (it.hasNext()) { PasswordAuthentication pass = (PasswordAuthentication) it.next(); username = pass.getUserName(); pwd = new String(pass.getPassword()); } } if (AuthTokenSingleton.getToken(username) != null) { return (AuthToken) AuthTokenSingleton.getToken(username); } AuthToken token = null; try { token = ireg.getAuthToken(username, pwd); } catch (Exception e) { throw new JAXRException(e); } AuthTokenSingleton.addAuthToken(username, token); return token; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
protected Object executeOperation(Object dataarray, String op) throws RegistryV3Exception, JAXRException { if (registry == null) { throw new IllegalStateException("No registry"); }// w w w .j av a 2 s.co m IRegistryV3 ireg = (IRegistryV3) registry.getRegistry(); ConnectionImpl connection = registry.getConnection(); AuthToken token = getAuthToken(connection, ireg); if (token == null) { throw new IllegalStateException("No auth token returned"); } Object regobj; if (op.equalsIgnoreCase("SAVE_ASSOCIATION")) { try { regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_SERVICE")) { try { regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_SERVICE_BINDING")) { try { regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_ORG")) { try { regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_TMODEL")) { try { regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_ORG")) { try { clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_SERVICE")) { try { regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_SERVICEBINDING")) { try { regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_CONCEPT")) { try { regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_ASSOCIATION")) { int len = ((String[]) dataarray).length; PublisherAssertion[] paarr = new PublisherAssertion[len]; for (int i = 0; i < len; i++) { String keystr = ((String[]) dataarray)[i]; paarr[i] = ScoutJaxrUddiV3Helper.getPubAssertionFromJAXRAssociationKey(keystr); } try { regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr); } } else if (op.equalsIgnoreCase("DELETE_CLASSIFICATIONSCHEME")) { try { regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryV3Exception rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } } else { throw new JAXRException("Unsupported operation:" + op); } return regobj; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
protected BulkResponse deleteOperation(Collection<Key> 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(); String[] keyarr = new String[keys.size()]; Result[] keyResultArr;/*from www . j a va2 s . c o m*/ LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); try { Iterator iter = keys.iterator(); int currLoc = 0; while (iter.hasNext()) { Key key = (Key) iter.next(); keyarr[currLoc] = key.getId(); currLoc++; } // Delete operation DispositionReport bd = (DispositionReport) executeOperation(keyarr, op); List<Result> resultList = bd.getResult(); keyResultArr = new Result[resultList.size()]; resultList.toArray(keyResultArr); log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length : 0); for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) { Result result = (Result) keyResultArr[i]; int errno = result.getErrno(); if (errno == 0) { coll.addAll(keys); } else { ErrInfo errinfo = result.getErrInfo(); DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue()); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } } } catch (RegistryV3Exception regExcept) { /* * jUDDI (and prollie others) throw an exception on any fault in * the transaction w/ the registry, so we don't get any partial * success */ DeleteException de = new DeleteException(regExcept.getFaultCode() + ":" + regExcept.getFaultString(), regExcept); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } catch (JAXRException tran) { exceptions.add(new JAXRException("Apache JAXR Impl:", tran)); bulk.setStatus(JAXRResponse.STATUS_FAILURE); } bulk.setCollection(coll); bulk.setExceptions(exceptions); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
/** * Get the Auth Token from the registry/* w ww. ja va 2 s. c o m*/ * * @param connection * @param ireg * @return auth token * @throws JAXRException */ private AuthToken getAuthToken(ConnectionImpl connection, IRegistryV3 ireg) throws JAXRException { Set creds = connection.getCredentials(); String username = "", pwd = ""; if (creds != null) { Iterator it = creds.iterator(); while (it.hasNext()) { PasswordAuthentication pass = (PasswordAuthentication) it.next(); username = pass.getUserName(); pwd = new String(pass.getPassword()); } } if (AuthTokenV3Singleton.getToken(username) != null) { return (AuthToken) AuthTokenV3Singleton.getToken(username); } AuthToken token = null; try { token = ireg.getAuthToken(username, pwd); } catch (Exception e) { throw new JAXRException(e); } AuthTokenV3Singleton.addAuthToken(username, token); return token; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
/** * Finds organizations in the registry that match the specified parameters * * @param findQualifiers//from w ww .j a v a2 s .c o m * @param namePatterns * @param classifications * @param specifications * @param externalIdentifiers * @param externalLinks * @return BulkResponse * @throws JAXRException */ public BulkResponse findOrganizations(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection specifications, Collection externalIdentifiers, Collection externalLinks) throws JAXRException { IRegistry registry = (IRegistry) registryService.getRegistry(); try { FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers); Name[] nameArray = mapNamePatterns(namePatterns); BusinessList result = registry.findBusiness(nameArray, null, ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers), ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications), null, juddiFindQualifiers, registryService.getMaxRows()); BusinessInfo[] bizInfoArr = null; BusinessInfos bizInfos = result.getBusinessInfos(); LinkedHashSet<Organization> orgs = new LinkedHashSet<Organization>(); if (bizInfos != null) { List<BusinessInfo> bizInfoList = bizInfos.getBusinessInfo(); for (BusinessInfo businessInfo : bizInfoList) { //Now get the details on the individual biz BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey()); orgs.add(((BusinessLifeCycleManagerImpl) registryService.getLifeCycleManagerImpl()) .createOrganization(detail)); } bizInfoArr = new BusinessInfo[bizInfoList.size()]; bizInfoList.toArray(bizInfoArr); } return new BulkResponseImpl(orgs); } catch (RegistryException e) { throw new JAXRException(e); } }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
public BulkResponse findAssociations(Collection findQualifiers, String sourceObjectId, String targetObjectId, Collection associationTypes) throws JAXRException { //TODO: Currently we just return all the Association objects owned by the caller IRegistry registry = (IRegistry) registryService.getRegistry(); try {/*from w w w . j ava 2s. c om*/ ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection(); AuthToken auth = this.getAuthToken(con, registry); PublisherAssertions result = null; try { result = registry.getPublisherAssertions(auth.getAuthInfo()); } catch (RegistryException rve) { String username = getUsernameFromCredentials(con.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } auth = getAuthToken(con, registry); result = registry.getPublisherAssertions(auth.getAuthInfo()); } List<PublisherAssertion> publisherAssertionList = result.getPublisherAssertion(); LinkedHashSet<Association> col = new LinkedHashSet<Association>(); for (PublisherAssertion pas : publisherAssertionList) { String sourceKey = pas.getFromKey(); String targetKey = pas.getToKey(); if ((sourceObjectId == null || sourceObjectId.equals(sourceKey)) && (targetObjectId == null || targetObjectId.equals(targetKey))) { Collection<Key> orgcol = new ArrayList<Key>(); 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); } }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
public BulkResponse findCallerAssociations(Collection findQualifiers, Boolean confirmedByCaller, Boolean confirmedByOtherParty, Collection associationTypes) throws JAXRException { //TODO: Currently we just return all the Association objects owned by the caller IRegistry registry = (IRegistry) registryService.getRegistry(); try {/* w w w. j av a 2s . c o m*/ 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 = Constants.COMPLETION_STATUS_COMPLETE; else if (!caller && other) confirm = Constants.COMPLETION_STATUS_FROMKEY_INCOMPLETE; else if (caller && !other) confirm = Constants.COMPLETION_STATUS_TOKEY_INCOMPLETE; report = null; try { report = registry.getAssertionStatusReport(auth.getAuthInfo(), confirm); } catch (RegistryException rve) { String username = getUsernameFromCredentials(con.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } auth = getAuthToken(con, registry); report = registry.getAssertionStatusReport(auth.getAuthInfo(), confirm); } List<AssertionStatusItem> assertionStatusItemList = report.getAssertionStatusItem(); LinkedHashSet<Association> col = new LinkedHashSet<Association>(); for (AssertionStatusItem asi : assertionStatusItemList) { String sourceKey = asi.getFromKey(); String targetKey = asi.getToKey(); Collection<Key> orgcol = new ArrayList<Key>(); 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 != Constants.COMPLETION_STATUS_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); } }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
/** * TODO - need to support the qualifiers * * @param findQualifiers// w ww .jav a 2s. c o m * @param namePatterns * @return ClassificationScheme * @throws JAXRException */ public ClassificationScheme findClassificationSchemeByName(Collection findQualifiers, String namePatterns) throws JAXRException { ClassificationScheme scheme = null; if (namePatterns.indexOf("uddi-org:types") != -1) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_TYPES_TMODEL_KEY)); } else if (namePatterns.indexOf("dnb-com:D-U-N-S") != -1) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.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(Constants.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(Constants.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(Constants.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(Constants.TMODEL_ISO_CH_TMODEL_KEY)); } else if (namePatterns.indexOf("unspsc-org:unspsc") != -1) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); } else if (namePatterns.indexOf("ntis-gov:naics") != -1) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_NAICS_TMODEL_KEY)); } else { //TODO:Before going to the registry, check if it a predefined Enumeration /* * predefined Enumerations */ if ("AssociationType".equals(namePatterns)) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); addChildConcept((ClassificationSchemeImpl) scheme, "RelatedTo"); addChildConcept((ClassificationSchemeImpl) scheme, "HasChild"); addChildConcept((ClassificationSchemeImpl) scheme, "HasMember"); addChildConcept((ClassificationSchemeImpl) scheme, "HasParent"); addChildConcept((ClassificationSchemeImpl) scheme, "ExternallyLinks"); addChildConcept((ClassificationSchemeImpl) scheme, "Contains"); addChildConcept((ClassificationSchemeImpl) scheme, "EquivalentTo"); addChildConcept((ClassificationSchemeImpl) scheme, "Extends"); addChildConcept((ClassificationSchemeImpl) scheme, "Implements"); addChildConcept((ClassificationSchemeImpl) scheme, "InstanceOf"); addChildConcept((ClassificationSchemeImpl) scheme, "Supersedes"); addChildConcept((ClassificationSchemeImpl) scheme, "Uses"); addChildConcept((ClassificationSchemeImpl) scheme, "Replaces"); addChildConcept((ClassificationSchemeImpl) scheme, "ResponsibleFor"); addChildConcept((ClassificationSchemeImpl) scheme, "SubmitterOf"); } else if ("ObjectType".equals(namePatterns)) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); addChildConcept((ClassificationSchemeImpl) scheme, "CPP"); addChildConcept((ClassificationSchemeImpl) scheme, "CPA"); addChildConcept((ClassificationSchemeImpl) scheme, "Process"); addChildConcept((ClassificationSchemeImpl) scheme, "WSDL"); addChildConcept((ClassificationSchemeImpl) scheme, "Association"); addChildConcept((ClassificationSchemeImpl) scheme, "AuditableEvent"); addChildConcept((ClassificationSchemeImpl) scheme, "Classification"); addChildConcept((ClassificationSchemeImpl) scheme, "Concept"); addChildConcept((ClassificationSchemeImpl) scheme, "ExternalIdentifier"); addChildConcept((ClassificationSchemeImpl) scheme, "ExternalLink"); addChildConcept((ClassificationSchemeImpl) scheme, "ExtrinsicObject"); addChildConcept((ClassificationSchemeImpl) scheme, "Organization"); addChildConcept((ClassificationSchemeImpl) scheme, "Package"); addChildConcept((ClassificationSchemeImpl) scheme, "Service"); addChildConcept((ClassificationSchemeImpl) scheme, "ServiceBinding"); addChildConcept((ClassificationSchemeImpl) scheme, "User"); } else if ("PhoneType".equals(namePatterns)) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); addChildConcept((ClassificationSchemeImpl) scheme, "OfficePhone"); addChildConcept((ClassificationSchemeImpl) scheme, "HomePhone"); addChildConcept((ClassificationSchemeImpl) scheme, "MobilePhone"); addChildConcept((ClassificationSchemeImpl) scheme, "Beeper"); addChildConcept((ClassificationSchemeImpl) scheme, "FAX"); } else if ("URLType".equals(namePatterns)) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); addChildConcept((ClassificationSchemeImpl) scheme, "HTTP"); addChildConcept((ClassificationSchemeImpl) scheme, "HTTPS"); addChildConcept((ClassificationSchemeImpl) scheme, "SMTP"); addChildConcept((ClassificationSchemeImpl) scheme, "PHONE"); addChildConcept((ClassificationSchemeImpl) scheme, "FAX"); addChildConcept((ClassificationSchemeImpl) scheme, "OTHER"); } else if ("PostalAddressAttributes".equals(namePatterns)) { scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(namePatterns)); scheme.setKey(new KeyImpl(Constants.TMODEL_UNSPSC_TMODEL_KEY)); addChildConcept((ClassificationSchemeImpl) scheme, "StreetNumber"); addChildConcept((ClassificationSchemeImpl) scheme, "Street"); addChildConcept((ClassificationSchemeImpl) scheme, "City"); addChildConcept((ClassificationSchemeImpl) scheme, "State"); addChildConcept((ClassificationSchemeImpl) scheme, "PostalCode"); addChildConcept((ClassificationSchemeImpl) scheme, "Country"); } else { //Lets ask the uddi registry if it has the TModels IRegistry registry = (IRegistry) registryService.getRegistry(); FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers); try { //We are looking for one exact match, so getting upto 3 records is fine TModelList list = registry.findTModel(namePatterns, null, null, juddiFindQualifiers, 3); if (list != null) { TModelInfos infos = list.getTModelInfos(); if (infos != null) { List<TModelInfo> tmodelInfoList = infos.getTModelInfo(); if (tmodelInfoList.size() > 1) { throw new InvalidRequestException( "Multiple matches found:" + tmodelInfoList.size()); } if (tmodelInfoList.size() == 1) { TModelInfo info = tmodelInfoList.get(0); scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); scheme.setName(new InternationalStringImpl(info.getName().getValue())); scheme.setKey(new KeyImpl(info.getTModelKey())); } } } } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } } return scheme; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
public BulkResponse findConcepts(Collection findQualifiers, Collection namePatterns, Collection classifications, Collection externalIdentifiers, Collection externalLinks) throws JAXRException { LinkedHashSet<Concept> col = new LinkedHashSet<Concept>(); //Lets ask the uddi registry if it has the TModels IRegistry registry = (IRegistry) registryService.getRegistry(); FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers); Iterator iter = null;/* w w w. ja v a 2s . co m*/ if (namePatterns != null) iter = namePatterns.iterator(); while (iter.hasNext()) { String namestr = (String) iter.next(); try { TModelList list = registry.findTModel(namestr, ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications), ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers), juddiFindQualifiers, 10); if (list != null && list.getTModelInfos() != null) { List<TModelInfo> tmodelInfoList = list.getTModelInfos().getTModelInfo(); if (tmodelInfoList != null) { for (TModelInfo info : tmodelInfoList) { col.add(ScoutUddiJaxrHelper.getConcept(info, this.registryService.getBusinessLifeCycleManager())); } } } } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } return new BulkResponseImpl(col); }