List of usage examples for javax.xml.registry InvalidRequestException InvalidRequestException
public InvalidRequestException(Throwable cause)
JAXRException
object initialized with the given Throwable
object. From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Creates instances of information model interfaces (factory method). To * create an Organization, use this method as follows: * //ww w . j a v a 2 s .c om * <pre> * Organization org = (Organization) lifeCycleMgr.createObject(LifeCycleManager.ORGANIZATION); * </pre> * <p> * <DL> * <DT><B>Capability Level: 0 </B> * </DL> * * @param interfaceName * the unqualified name of an interface in the * javax.xml.registry.infomodel package * * @return an Object that can then be cast to an instance of the interface * * @throws JAXRException * if the JAXR provider encounters an internal error * * @throws InvalidRequestException * if the interface is not an interface in the * javax.xml.registry.infomodel package * * @throws UnsupportedCapabilityException * if the client attempts to create an instance of an infomodel * interface that is not supported by the capability level of * the JAXR provider */ public Object createObject(String className) throws JAXRException, InvalidRequestException, UnsupportedCapabilityException { Object obj = null; try { // Try to find extended constructor by nickname Constructor<?> cons = imFactory.getConstructor1Arg(className); if (cons != null) { // use extended constructor Object[] args = { this }; obj = cons.newInstance(args); // set extended type String typeId = imFactory.getTypeName(className); BusinessQueryManagerImpl bqm = (BusinessQueryManagerImpl) regService.getBusinessQueryManager(); Concept typeConcept = (Concept) bqm.getRegistryObject(typeId, LifeCycleManager.CONCEPT); if (obj instanceof Association) { ((Association) obj).setAssociationType(typeConcept); } else if (obj instanceof ExtrinsicObject) { ((ExtrinsicObjectImpl) obj).setObjectType(typeConcept); } } else { // proceed the default way: infomodel class className = "it.cnr.icar.eric.client.xml.registry.infomodel." + BindingUtility.mapEbXMLNameToJAXRName(className) + "Impl"; Class<?> cls = this.getClass().getClassLoader().loadClass(className); Class<?> lcmCls = this.getClass().getClassLoader() .loadClass("it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl"); @SuppressWarnings("rawtypes") Class[] parmTypes = { lcmCls }; cons = cls.getDeclaredConstructor(parmTypes); Object[] args = { this }; obj = cons.newInstance(args); } } catch (ClassNotFoundException e) { throw new InvalidRequestException(JAXRResourceBundle.getInstance() .getString("message.error.invalid.classname", new Object[] { className })); } catch (NoSuchMethodException e) { throw new JAXRException(e); } catch (InvocationTargetException e) { throw new JAXRException(e.getCause()); } catch (IllegalAccessException e) { throw new JAXRException(e); } catch (InstantiationException e) { throw new JAXRException(e); } catch (ExceptionInInitializerError e) { throw new JAXRException(e); } catch (SecurityException e) { throw new JAXRException(e); } return obj; }
From source file:it.cnr.icar.eric.server.common.ServerRequestContext.java
/** * Checks each object including composed objects. *//*from w w w .j a v a 2 s . co m*/ @SuppressWarnings("unchecked") public void checkObjects() throws RegistryException { try { //Process ObjectRefs and create local replicas of any remote ObjectRefs createReplicasOfRemoteObjectRefs(); //Get all submitted objects including composed objects that are part of the submission //so that they can be used to resolve references getSubmittedObjectsMap().putAll(getTopLevelRegistryObjectTypeMap()); Collection<IdentifiableType> composedObjects = bu .getComposedRegistryObjects(getTopLevelRegistryObjectTypeMap().values(), -1); getSubmittedObjectsMap().putAll(bu.getRegistryObjectTypeMap(composedObjects)); pm.updateIdToLidMap(this, getSubmittedObjectsMap().keySet(), "RegistryObject"); getNewSubmittedObjectIds(); //Check id of each object (top level or composed) Iterator<Object> iter = getSubmittedObjectsMap().values().iterator(); while (iter.hasNext()) { RegistryObjectType ro = (RegistryObjectType) iter.next(); //AuditableEvents are not allowed to be submitted by clients if (ro instanceof AuditableEventType) { throw new InvalidRequestException( ServerResourceBundle.getInstance().getString("message.auditableEventsNotAllowed")); } checkId(ro); } //Get RegistryObjects referenced by submittedObjects. this.getReferenceInfos(); //Append the references to the IdToLidMap iter = this.referencedInfos.iterator(); Set<String> referencedIds = new HashSet<String>(); while (iter.hasNext()) { ReferenceInfo refInfo = (ReferenceInfo) iter.next(); referencedIds.add(refInfo.targetObject); } pm.updateIdToLidMap(this, referencedIds, "RegistryObject"); //Iterate over idMap and replace keys in various structures that use id as key //that are based on temporary ids with their permanent id. Iterator<String> iter2 = getIdMap().keySet().iterator(); while (iter2.hasNext()) { String idOld = iter2.next(); String idNew = getIdMap().get(idOld); //replace in all RequestContext data structures Object obj = getTopLevelRegistryObjectTypeMap().remove(idOld); if (obj != null) { getTopLevelRegistryObjectTypeMap().put(idNew, (RegistryObjectType) obj); } obj = getSubmittedObjectsMap().remove(idOld); if (obj != null) { getSubmittedObjectsMap().put(idNew, obj); } if (getNewSubmittedObjectIds().remove(idOld)) { getNewSubmittedObjectIds().add(idNew); } RepositoryItem ri = (RepositoryItem) getRepositoryItemsMap().remove(idOld); if (ri != null) { ri.setId(idNew); getRepositoryItemsMap().put(idNew, ri); } } //Now replace any old versions of RegistryObjects with new versions Iterator<RegistryObjectType> iter3 = getNewROVersionMap().keySet().iterator(); while (iter3.hasNext()) { RegistryObjectType ebRegistryObjectTypeOld = iter3.next(); RegistryObjectType ebRegistryObjectTypeNew = getNewROVersionMap().get(ebRegistryObjectTypeOld); // replace in all data structures getSubmittedObjectsMap().remove(ebRegistryObjectTypeOld.getId()); getSubmittedObjectsMap().put(ebRegistryObjectTypeNew.getId(), ebRegistryObjectTypeNew); getTopLevelRegistryObjectTypeMap().remove(ebRegistryObjectTypeOld.getId()); getTopLevelRegistryObjectTypeMap().put(ebRegistryObjectTypeNew.getId(), ebRegistryObjectTypeNew); } //Now replace any old versions of RepositoryItems with new versions Iterator<RepositoryItem> iter4 = getNewRIVersionMap().keySet().iterator(); while (iter4.hasNext()) { RepositoryItem riOld = iter4.next(); RepositoryItem riNew = getNewRIVersionMap().get(riOld); //replace in all RequestContext data structures getRepositoryItemsMap().remove(riOld.getId()); getRepositoryItemsMap().put(riNew.getId(), riNew); } //resolve references from each object resolveObjectReferences(); } catch (JAXRException e) { throw new RegistryException(e); } }
From source file:it.cnr.icar.eric.server.lcm.LifeCycleManagerImpl.java
/** * Calculates the effective user to be used as the identity of the * requestor. Implements ability to re-assign user to a different user than * the caller if:/* w ww . j av a2 s.c om*/ * * a) The actual caller is a RegistryAdministrator role, and b) The request * specifies the CANONICAL_SLOT_LCM_OWNER. * */ @SuppressWarnings("static-access") void calculateEffectiveUser(ServerRequestContext context) throws RegistryException { try { UserType caller = (context).getUser(); // See if CANONICAL_SLOT_LCM_OWNER defined on request HashMap<String, Object> slotsMap = bu.getSlotsFromRequest((context).getCurrentRegistryRequest()); String effectiveUserId = (String) slotsMap.get(bu.CANONICAL_SLOT_LCM_OWNER); if (effectiveUserId != null) { if (ac.hasRegistryAdministratorRole(caller)) { UserType effectiveUser = (UserType) pm.getRegistryObject((context), effectiveUserId, "User"); if (effectiveUser == null) { throw new RegistryException(ServerResourceBundle.getInstance() .getString("message.specifiedUserNotOwner", new Object[] { effectiveUserId })); } (context).setUser(effectiveUser); } else { throw new InvalidRequestException(ServerResourceBundle.getInstance() .getString("message.requestSlotInvalid", new Object[] { bu.CANONICAL_SLOT_LCM_OWNER })); } } } catch (javax.xml.bind.JAXBException e) { throw new RegistryException(e); } catch (InvalidRequestException e) { throw new RegistryException(e); } }
From source file:it.cnr.icar.eric.client.xml.registry.BusinessQueryManagerImpl.java
/** * Find a ClassificationScheme by name based on the specified name pattern. * * * <p><DL><DT><B>Capability Level: 0 </B></DL> * * @param namePattern Is a String that is a partial or full * name pattern with wildcard searching as specified by the SQL-92 LIKE * specification./*from w w w .ja v a 2s. com*/ * * @return The ClassificationScheme matching the namePattern. If none match * return null. If multiple match then throw an InvalidRequestException. * */ public ClassificationScheme findClassificationSchemeByName( @SuppressWarnings("rawtypes") Collection findQualifiers, String namePattern) throws JAXRException { Collection<String> namePatterns = new ArrayList<String>(); namePatterns.add(namePattern); Query query = createQueryByName(findQualifiers, "ClassificationScheme", namePatterns); BulkResponse br = dqm.executeQuery(query); query = addOrderBy(query, findQualifiers); Iterator<?> i = br.getCollection().iterator(); ClassificationScheme cs = null; if (i.hasNext()) { cs = (ClassificationScheme) i.next(); } // needs to check if more then 1 return and raise InvalidRequestException if (i.hasNext()) { throw new InvalidRequestException(JAXRResourceBundle.getInstance() .getString("message.error.call.not.match.ClassificationScheme")); } return cs; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Create an ExternalIdentifier instance using the specified parameters. * /*from ww w . j a va2 s . c o m*/ * * <p> * <DL> * <DT><B>Capability Level: 0 </B> * </DL> * */ public ExternalIdentifier createExternalIdentifier(ClassificationScheme scheme, InternationalString name, String value) throws JAXRException { ExternalIdentifierImpl extId = new ExternalIdentifierImpl(this); if (scheme == null) { throw new InvalidRequestException( JAXRResourceBundle.getInstance().getString("message.error.IdentificationScheme.null")); } extId.setIdentificationScheme(scheme); extId.setName(name); extId.setValue(value); return extId; }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Utility method that checks if obj is an instance of targetType. * /*from w w w.j ava 2s . co m*/ * @param obj * Object to check * @param targetType * Class type for which to check * * @return true if obj is an instance of targetType * * @throws InvalidRequestException * if obj is not an instance of targetType. */ @SuppressWarnings("rawtypes") public static boolean isInstanceOf(Object obj, Class targetType) throws InvalidRequestException { if (targetType.isInstance(obj)) { return true; } else { Object[] notInstanceOfArgs = { targetType.getName(), obj.getClass().getName() }; MessageFormat form = new MessageFormat(resourceBundle.getString("error.notInstanceOf")); throw new InvalidRequestException(form.format(notInstanceOfArgs)); } }
From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java
private void handlePseudoComposedObjects() throws InvalidRequestException, JAXRException, Exception { if (pseudoComposedRobsToDelete != null) { Iterator<RegistryObjectBean> itr = pseudoComposedRobsToDelete.iterator(); while (itr.hasNext()) { RegistryObjectBean rob = itr.next(); List<Key> deleteRO = new ArrayList<Key>(); deleteRO.add((rob.getRegistryObject().getKey())); if (!RegistryBrowser.getBQM().getRegistryObjects(deleteRO).getCollection().isEmpty()) { String status = doDeleteObject(rob); if (status.equalsIgnoreCase("failure")) { pseudoComposedRobsToDelete.clear(); throw new InvalidRequestException(WebUIResourceBundle.getInstance() .getString("message.CouldNotDeleteComposedObject")); }/*from w w w . j a v a2 s. c o m*/ } } pseudoComposedRobsToDelete.clear(); } }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.java
/** * TODO - need to support the qualifiers * * @param findQualifiers// www . j a v 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.BusinessQueryManagerV3Impl.java
/** * TODO - need to support the qualifiers * * @param findQualifiers//from ww w. java 2 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; }
From source file:org.freebxml.omar.common.BindingUtility.java
public static String getActionFromRequest(RegistryRequestType registryRequest) throws JAXRException { String action = null;/*w ww. ja va2s. co m*/ if (registryRequest instanceof AdhocQueryRequest) { action = ACTION_READ; } else if (registryRequest instanceof SubmitObjectsRequest) { action = ACTION_CREATE; } else if (registryRequest instanceof ApproveObjectsRequest) { action = ACTION_APPROVE; } else if (registryRequest instanceof DeprecateObjectsRequest) { action = ACTION_DEPRECATE; } else if (registryRequest instanceof UndeprecateObjectsRequest) { action = ACTION_UNDEPRECATE; } else if (registryRequest instanceof UpdateObjectsRequest) { action = ACTION_UPDATE; } else if (registryRequest instanceof RemoveObjectsRequest) { action = ACTION_DELETE; } else if (registryRequest instanceof RelocateObjectsRequest) { action = ACTION_RELOCATE; } else if (registryRequest instanceof SetStatusOnObjectsRequest) { action = ACTION_SET_STATUS; } else if (registryRequest instanceof RegistryRequestType) { //??Get slotName and return the extension protocol name here action = ACTION_EXTENSION_REQUEST; } else { throw new InvalidRequestException(CommonResourceBundle.getInstance() .getString("message.unexpectedObjectType", new Object[] { registryRequest.getClass().getName(), "org.oasis.ebxml.registry.bindings.rs.RegistryRequestType" })); } return action; }