List of usage examples for javax.xml.registry LifeCycleManager CONCEPT
String CONCEPT
To view the source code for javax.xml.registry LifeCycleManager CONCEPT.
Click Source Link
From source file:JAXRPublishHelloOrg.java
/** * Creates an organization, its classification, and its * services, and saves it to the registry. *//w ww . jav a 2 s.co m * @param username the username for the registry * @param password the password for the registry */ public void executePublish(String uuidString, String username, String password) { RegistryService rs = null; BusinessLifeCycleManager blcm = null; BusinessQueryManager bqm = null; try { // Get registry service and managers rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); blcm = rs.getBusinessLifeCycleManager(); System.out.println("Got registry service, query " + "manager, and life cycle manager"); // Get authorization from the registry PasswordAuthentication passwdAuth = new PasswordAuthentication(username, password.toCharArray()); HashSet<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>(); creds.add(passwdAuth); connection.setCredentials(creds); System.out.println("Established security credentials"); ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples"); // Create organization name and description InternationalString s = blcm.createInternationalString(bundle.getString("wsdlorg.name")); Organization org = blcm.createOrganization(s); s = blcm.createInternationalString(bundle.getString("wsdlorg.description")); org.setDescription(s); // Create primary contact, set name User primaryContact = blcm.createUser(); PersonName pName = blcm.createPersonName(bundle.getString("wsdlorg.person.name")); primaryContact.setPersonName(pName); s = blcm.createInternationalString(bundle.getString("wsdlorg.person.description")); primaryContact.setDescription(s); // Set primary contact phone number TelephoneNumber tNum = blcm.createTelephoneNumber(); tNum.setNumber(bundle.getString("wsdlorg.phone")); Collection<TelephoneNumber> phoneNums = new ArrayList<TelephoneNumber>(); phoneNums.add(tNum); primaryContact.setTelephoneNumbers(phoneNums); // Set primary contact email address EmailAddress emailAddress = blcm.createEmailAddress(bundle.getString("wsdlorg.email.address")); Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>(); emailAddresses.add(emailAddress); primaryContact.setEmailAddresses(emailAddresses); // Set primary contact for organization org.setPrimaryContact(primaryContact); // Create services and service Collection<Service> services = new ArrayList<Service>(); s = blcm.createInternationalString(bundle.getString("wsdlorg.svc.name")); Service service = blcm.createService(s); s = blcm.createInternationalString(bundle.getString("wsdlorg.svc.description")); service.setDescription(s); // Create service bindings Collection<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>(); ServiceBinding binding = blcm.createServiceBinding(); s = blcm.createInternationalString(bundle.getString("wsdlorg.svcbnd.description")); binding.setDescription(s); binding.setAccessURI(bundle.getString("wsdlorg.svcbnd.uri")); /* * Find the uddi-org:types classification scheme defined * by the UDDI specification, using well-known key id. */ String uuid_types = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4"; ClassificationScheme uddiOrgTypes = (ClassificationScheme) bqm.getRegistryObject(uuid_types, LifeCycleManager.CLASSIFICATION_SCHEME); /* * Create a classification, specifying the scheme * and the taxonomy name and value defined for WSDL * documents by the UDDI specification. */ Classification wsdlSpecClassification = blcm.createClassification(uddiOrgTypes, blcm.createInternationalString("wsdlSpec"), "wsdlSpec"); // Define classifications Collection<Classification> classifications = new ArrayList<Classification>(); classifications.add(wsdlSpecClassification); // Find the concept by its UUID Concept specConcept = (Concept) bqm.getRegistryObject(uuidString, LifeCycleManager.CONCEPT); // If we found the concept, we can save the organization if (specConcept != null) { String name = getName(specConcept); Collection links = specConcept.getExternalLinks(); System.out.println("\nSpecification Concept:\n\tName: " + name + "\n\tKey: " + getKey(specConcept)); if (links.size() > 0) { ExternalLink link = (ExternalLink) links.iterator().next(); System.out.println("\tURL of WSDL document: '" + link.getExternalURI() + "'"); } // Now set the specification link for the service binding SpecificationLink specLink = blcm.createSpecificationLink(); specLink.setSpecificationObject(specConcept); binding.addSpecificationLink(specLink); serviceBindings.add(binding); // Add service bindings to service service.addServiceBindings(serviceBindings); // Add service to services, then add services to organization services.add(service); org.addServices(services); // Add organization and submit to registry // Retrieve key if successful Collection<Organization> orgs = new ArrayList<Organization>(); orgs.add(org); BulkResponse response = blcm.saveOrganizations(orgs); Collection exceptions = response.getExceptions(); if (exceptions == null) { System.out.println("Organization saved"); Collection keys = response.getCollection(); for (Object k : keys) { Key orgKey = (Key) k; String id = orgKey.getId(); System.out.println("Organization key is " + id); } } else { for (Object e : exceptions) { Exception exception = (Exception) e; System.err.println("Exception on save: " + exception.toString()); } } } else { System.out.println("Specified concept not found, " + "organization not saved"); } } catch (Exception e) { e.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }
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: * /*w w w. j a v a2s . co m*/ * <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:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
/** * Deletes one or more previously submitted objects from the registry * using the object keys and a specified objectType attribute. * * @param keys/*from w ww .j av a 2 s. co m*/ * @param objectType * @return BulkResponse object * @throws JAXRException */ public BulkResponse deleteObjects(Collection keys, String objectType) throws JAXRException { BulkResponse bulk = null; if (objectType == LifeCycleManager.ASSOCIATION) { bulk = this.deleteAssociations(keys); } else if (objectType == LifeCycleManager.CLASSIFICATION_SCHEME) { bulk = this.deleteClassificationSchemes(keys); } else if (objectType == LifeCycleManager.CONCEPT) { bulk = this.deleteConcepts(keys); } else if (objectType == LifeCycleManager.ORGANIZATION) { bulk = this.deleteOrganizations(keys); } else if (objectType == LifeCycleManager.SERVICE) { bulk = this.deleteServices(keys); } else if (objectType == LifeCycleManager.SERVICE_BINDING) { bulk = this.deleteServiceBindings(keys); } else { throw new JAXRException("Delete Operation for " + objectType + " not implemented by Scout"); } return bulk; }
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 {/*www. ja v a 2 s .co m*/ 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();//from w w w. j a va 2s . co 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.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 w w .j a v a 2 s . co 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.registry.BusinessQueryManagerV3Impl.java
public BulkResponse getRegistryObjects(Collection objectKeys, String objectType) throws JAXRException { IRegistryV3 registry = (IRegistryV3) registryService.getRegistry(); //Convert into a vector of strings String[] keys = new String[objectKeys.size()]; int currLoc = 0; for (Key key : (Collection<Key>) objectKeys) { String keyString = key.getId(); keys[currLoc++] = keyString;/*from w ww . jav a 2 s . co m*/ } 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(ScoutUddiV3JaxrHelper.getConcept(tModel, lcm)); } } catch (RegistryV3Exception 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 (RegistryV3Exception rve) { String username = getUsernameFromCredentials(con.getCredentials()); if (AuthTokenV3Singleton.getToken(username) != null) { AuthTokenV3Singleton.deleteAuthToken(username); } auth = getAuthToken(con, registry); ri = registry.getRegisteredInfo(auth.getAuthInfo()); } if (ri != null) { BusinessInfos infos = ri.getBusinessInfos(); if (infos != null) { for (String key : keys) { BusinessDetail detail = registry.getBusinessDetail(key); col.add(((BusinessLifeCycleManagerV3Impl) registryService.getLifeCycleManagerImpl()) .createOrganization(detail)); } } } } catch (RegistryV3Exception 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(ScoutUddiV3JaxrHelper.getConcept(tmodel, lcm)); } } catch (RegistryV3Exception 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 (RegistryV3Exception e) { throw new JAXRException(e); } } else { throw new JAXRException("Unsupported type " + objectType + " for getRegistryObjects() in Apache Scout"); } return new BulkResponseImpl(col); }