Example usage for javax.xml.registry JAXRException JAXRException

List of usage examples for javax.xml.registry JAXRException JAXRException

Introduction

In this page you can find the example usage for javax.xml.registry JAXRException JAXRException.

Prototype

public JAXRException(Throwable cause) 

Source Link

Document

Constructs a JAXRException object initialized with the given Throwable object.

Usage

From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java

public BulkResponse findServiceBindings(Key serviceKey, Collection findQualifiers, Collection classifications,
        Collection specifications) throws JAXRException {
    BulkResponseImpl blkRes = new BulkResponseImpl();

    IRegistry iRegistry = (IRegistry) registryService.getRegistry();
    FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);

    try {/*www  .  j  av  a  2  s.  c  o  m*/

        BindingDetail bindingDetail = iRegistry.findBinding(serviceKey.getId(),
                ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
                ScoutJaxrUddiHelper.getTModelBagFromSpecifications(specifications), juddiFindQualifiers,
                registryService.getMaxRows());

        /*
         * now convert  from jUDDI ServiceInfo objects to JAXR Services
         */
        if (bindingDetail != null) {

            List<BindingTemplate> bindingTemplateList = bindingDetail.getBindingTemplate();
            BindingTemplate[] bindarr = new BindingTemplate[bindingTemplateList.size()];
            bindingTemplateList.toArray(bindarr);

            LinkedHashSet<ServiceBinding> col = new LinkedHashSet<ServiceBinding>();

            for (int i = 0; bindarr != null && i < bindarr.length; i++) {
                BindingTemplate si = bindarr[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) {
        throw new JAXRException(e.getLocalizedMessage());
    }

    return blkRes;
}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java

/**
 * Finds all Service objects that match all of the criteria specified by
 * the parameters of this call.  This is a logical AND operation between
 * all non-null parameters/*from  w w  w .j  a v a2s  .  c o  m*/
 *
 * TODO - support findQualifiers, classifications and specifications
 *
 * @param orgKey
 * @param findQualifiers
 * @param namePatterns
 * @param classifications
 * @param specificationa
 * @return BulkResponse
 * @throws JAXRException
 */
public BulkResponse findServices(Key orgKey, Collection findQualifiers, Collection namePatterns,
        Collection classifications, Collection specificationa) throws JAXRException {
    BulkResponseImpl blkRes = new BulkResponseImpl();

    IRegistry iRegistry = (IRegistry) registryService.getRegistry();
    FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
    Name[] juddiNames = mapNamePatterns(namePatterns);

    try {
        /*
         * hit the registry.  The key is not required for UDDI2
         */

        String id = null;

        if (orgKey != null) {
            id = orgKey.getId();
        }

        ServiceList serviceList = iRegistry.findService(id, juddiNames,
                ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications), null,
                juddiFindQualifiers, registryService.getMaxRows());

        /*
         * now convert  from jUDDI ServiceInfo objects to JAXR Services
         */
        if (serviceList != null) {

            ServiceInfos serviceInfos = serviceList.getServiceInfos();
            LinkedHashSet<Service> col = new LinkedHashSet<Service>();

            if (serviceInfos != null && serviceInfos.getServiceInfo() != null) {
                for (ServiceInfo si : serviceInfos.getServiceInfo()) {
                    Service srv = (Service) getRegistryObject(si.getServiceKey(), LifeCycleManager.SERVICE);
                    col.add(srv);
                }

            }
            blkRes.setCollection(col);
        }
    } catch (RegistryException e) {
        throw new JAXRException(e.getLocalizedMessage());
    }

    return blkRes;
}

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  ww.  j a  v  a2  s  .com*/

            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.BusinessQueryManagerImpl.java

public BulkResponse getRegistryObjects(Collection objectKeys, String objectType) throws JAXRException {
    IRegistry registry = (IRegistry) registryService.getRegistry();
    //Convert into a vector of strings
    String[] keys = new String[objectKeys.size()];
    int currLoc = 0;
    for (Key key : (Collection<Key>) objectKeys) {
        keys[currLoc] = key.getId();//www.j  ava 2s  .  c o m
        currLoc++;
    }
    LinkedHashSet<RegistryObject> col = new LinkedHashSet<RegistryObject>();
    LifeCycleManager lcm = registryService.getLifeCycleManagerImpl();

    if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) {
        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(keys);
            List<TModel> tmodelList = tmodeldetail.getTModel();

            for (TModel tModel : tmodelList) {
                col.add(ScoutUddiJaxrHelper.getConcept(tModel, lcm));
            }

        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {
        ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection();
        AuthToken auth = this.getAuthToken(con, registry);

        try {
            RegisteredInfo ri = null;
            try {
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            } catch (RegistryException rve) {
                String username = getUsernameFromCredentials(con.getCredentials());
                if (AuthTokenSingleton.getToken(username) != null) {
                    AuthTokenSingleton.deleteAuthToken(username);
                }
                auth = getAuthToken(con, registry);
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            }

            if (ri != null) {
                for (String key : keys) {
                    BusinessDetail detail = registry.getBusinessDetail(key);
                    col.add(((BusinessLifeCycleManagerImpl) registryService.getLifeCycleManagerImpl())
                            .createOrganization(detail));
                }

            }
        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) {
        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(keys);
            List<TModel> tmodelList = tmodeldetail.getTModel();

            for (TModel tmodel : tmodelList) {
                col.add(ScoutUddiJaxrHelper.getConcept(tmodel, lcm));
            }

        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) {

        try {
            ServiceDetail serviceDetail = registry.getServiceDetail(keys);

            if (serviceDetail != null) {
                List<BusinessService> bizServiceList = serviceDetail.getBusinessService();

                for (BusinessService businessService : bizServiceList) {

                    Service service = getServiceFromBusinessService(businessService, lcm);

                    col.add(service);
                }
            }
        } catch (RegistryException e) {
            throw new JAXRException(e);
        }
    } else {
        throw new JAXRException("Unsupported type " + objectType + " for getRegistryObjects() in Apache Scout");
    }

    return new BulkResponseImpl(col);

}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java

public BulkResponse getRegistryObjects(String id) throws JAXRException {
    if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(id)) {
        IRegistry registry = (IRegistry) registryService.getRegistry();
        ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection();
        AuthToken auth = this.getAuthToken(con, registry);
        LinkedHashSet<Organization> orgs = null;
        try {/*from w  ww  .j  av a2 s  .  c  o m*/
            RegisteredInfo ri = null;
            try {
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            } catch (RegistryException rve) {
                String username = getUsernameFromCredentials(con.getCredentials());
                if (AuthTokenSingleton.getToken(username) != null) {
                    AuthTokenSingleton.deleteAuthToken(username);
                }
                auth = getAuthToken(con, registry);
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            }

            if (ri != null && ri.getBusinessInfos() != null) {
                List<BusinessInfo> bizInfoList = ri.getBusinessInfos().getBusinessInfo();
                orgs = new LinkedHashSet<Organization>();
                for (BusinessInfo businessInfo : bizInfoList) {
                    BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey());
                    orgs.add(((BusinessLifeCycleManagerImpl) registryService.getLifeCycleManagerImpl())
                            .createOrganization(detail));
                }
            }

        } catch (RegistryException re) {
            throw new JAXRException(re);
        }
        return new BulkResponseImpl(orgs);
    } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(id)) {
        List<String> a = new ArrayList<String>();
        a.add("%");

        BulkResponse br = this.findServices(null, null, a, null, null);

        return br;
    } else {
        throw new JAXRException("Unsupported type for getRegistryObjects() :" + id);
    }

}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java

/**
  * Get the Auth Token from the registry
  */*from w  ww .  jav a 2  s .  co  m*/
  * @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());
    }

    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.BusinessQueryManagerV3Impl.java

/**
 * Finds organizations in the registry that match the specified parameters
 *
 * @param findQualifiers/*ww  w  . j a v a  2  s  .co  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 {
    IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
    try {
        FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
        Name[] nameArray = mapNamePatterns(namePatterns);
        BusinessList result = registry.findBusiness(nameArray, null,
                ScoutJaxrUddiV3Helper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers),
                ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications),
                ScoutJaxrUddiV3Helper.getTModelBagFromSpecifications(specifications), 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());
                BusinessLifeCycleManagerV3Impl blcm = (BusinessLifeCycleManagerV3Impl) registryService
                        .getLifeCycleManagerImpl();
                orgs.add(blcm.createOrganization(detail));
            }
            bizInfoArr = new BusinessInfo[bizInfoList.size()];
            bizInfoList.toArray(bizInfoArr);
        }
        return new BulkResponseImpl(orgs);
    } catch (RegistryV3Exception e) {
        throw new JAXRException(e);
    }
}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.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
    IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
    try {//from   ww  w  . j a v  a  2s .  c  o m
        ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection();
        AuthToken auth = this.getAuthToken(con, registry);
        PublisherAssertions result = null;
        try {
            result = registry.getPublisherAssertions(auth.getAuthInfo());
        } catch (RegistryV3Exception rve) {
            String username = getUsernameFromCredentials(con.getCredentials());
            if (AuthTokenV3Singleton.getToken(username) != null) {
                AuthTokenV3Singleton.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();
            Collection<Key> orgcol = new ArrayList<Key>();
            orgcol.add(new KeyImpl(sourceKey));
            orgcol.add(new KeyImpl(targetKey));
            BulkResponse bl = getRegistryObjects(orgcol, LifeCycleManager.ORGANIZATION);
            Association asso = ScoutUddiV3JaxrHelper.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 (RegistryV3Exception e) {
        throw new JAXRException(e);
    }
}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.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
    IRegistryV3 registry = (IRegistryV3) registryService.getRegistry();
    try {//from w  w  w. j av a 2  s .  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;

        try {
            report = registry.getAssertionStatusReport(auth.getAuthInfo(), confirm);
        } catch (RegistryV3Exception rve) {
            String username = getUsernameFromCredentials(con.getCredentials());
            if (AuthTokenV3Singleton.getToken(username) != null) {
                AuthTokenV3Singleton.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 = ScoutUddiV3JaxrHelper.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 (RegistryV3Exception e) {
        throw new JAXRException(e);
    }
}

From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.java

/**
 *  TODO - need to support the qualifiers
 *
 * @param findQualifiers/*from ww  w .j  a  va2  s .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
            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;
}