List of usage examples for javax.xml.registry.infomodel ClassificationScheme setKey
void setKey(Key key) throws JAXRException;
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
/** * TODO - need to support the qualifiers * * @param findQualifiers//from w ww .ja va 2 s .co 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 RegistryObject getRegistryObject(String id, String objectType) throws JAXRException { IRegistry registry = (IRegistry) registryService.getRegistry(); BusinessLifeCycleManager lcm = registryService.getBusinessLifeCycleManager(); if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) { try {/*w w w.j a v a 2 s .c om*/ TModelDetail tmodeldetail = registry.getTModelDetail(id); Concept c = ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm); /* * 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) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) { try { BusinessDetail orgdetail = registry.getBusinessDetail(id); return ScoutUddiJaxrHelper.getOrganization(orgdetail, lcm); } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) { try { TModelDetail tmodeldetail = registry.getTModelDetail(id); return ScoutUddiJaxrHelper.getConcept(tmodeldetail, lcm); } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) { try { ServiceDetail sd = registry.getServiceDetail(id); if (sd != null && sd.getBusinessService() != null) { for (BusinessService businessService : sd.getBusinessService()) { Service service = getServiceFromBusinessService(businessService, lcm); return service; } } } catch (RegistryException e) { throw new RuntimeException(e); } } return null; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.java
/** * TODO - need to support the qualifiers * * @param findQualifiers/*w w w.j a v a 2 s. co 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 IRegistryV3 registry = (IRegistryV3) 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 (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } } } return scheme; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.java
public RegistryObject getRegistryObject(String id, String objectType) throws JAXRException { IRegistryV3 registry = (IRegistryV3) registryService.getRegistry(); BusinessLifeCycleManager lcm = registryService.getBusinessLifeCycleManager(); if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) { try {//from w ww . ja va 2 s .c o m TModelDetail tmodeldetail = registry.getTModelDetail(id); Concept c = ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm); /* * 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 (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) { try { BusinessDetail orgdetail = registry.getBusinessDetail(id); return ScoutUddiV3JaxrHelper.getOrganization(orgdetail, lcm); } catch (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) { try { TModelDetail tmodeldetail = registry.getTModelDetail(id); return ScoutUddiV3JaxrHelper.getConcept(tmodeldetail, lcm); } catch (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) { try { ServiceDetail sd = registry.getServiceDetail(id); if (sd != null && sd.getBusinessService() != null) { for (BusinessService businessService : sd.getBusinessService()) { Service service = getServiceFromBusinessService(businessService, lcm); return service; } } } catch (RegistryV3Exception e) { throw new RuntimeException(e); } } return null; }
From source file:org.apache.ws.scout.util.EnumerationHelper.java
/** * /* w ww . j av a 2 s . com*/ * @param firstToken * @param secondToken * @return Concept * @throws JAXRException */ private static Concept createConcept(String firstToken, String secondToken) throws JAXRException, IllegalArgumentException { if (!TYPES_LIST.contains(firstToken)) throw new IllegalArgumentException("Expected the path to " + "start with one of " + TYPES); //get the predefined classificationscheme ClassificationScheme cs = new ClassificationSchemeImpl(null); cs.setName(new InternationalStringImpl(firstToken)); cs.setKey(new KeyImpl(firstToken)); ArrayList<String> conceptStrings = typesMap.get(firstToken); if (!conceptStrings.contains(secondToken)) throw new IllegalArgumentException( "Expected the path to " + "end with one of " + conceptStrings.toArray()); Concept concept = new ConceptImpl(null); concept.setName(new InternationalStringImpl(secondToken.toLowerCase())); concept.setValue(secondToken); concept.setKey(new KeyImpl(UDDI_ORG_TYPES)); ((ConceptImpl) concept).setScheme(((ClassificationSchemeImpl) cs)); return concept; }