List of usage examples for javax.xml.registry LifeCycleManager SERVICE
String SERVICE
To view the source code for javax.xml.registry LifeCycleManager SERVICE.
Click Source Link
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 ww w. j ava 2s . c o 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 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 {/* w w w .j av a2s . c om*/ 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 .ja va 2s .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 {/*from w w w. j a v a 2s . c o 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
/** * Gets the RegistryObjects owned by the caller. The objects * are returned as their concrete type (e.g. Organization, User etc.) * * TODO - need to figure out what the set are. This is just to get some * basic functionality/*w w w . j a v a 2 s . c o m*/ * * @return BulkResponse * @throws JAXRException */ public BulkResponse getRegistryObjects() throws JAXRException { String types[] = { LifeCycleManager.ORGANIZATION, LifeCycleManager.SERVICE }; LinkedHashSet<Object> c = new LinkedHashSet<Object>(); for (int i = 0; i < types.length; i++) { try { BulkResponse bk = getRegistryObjects(types[i]); if (bk.getCollection() != null) { c.addAll(bk.getCollection()); } } catch (JAXRException e) { log.debug("ignore - just a problem with that type? " + e.getMessage(), e); } } return new BulkResponseImpl(c); }
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 ww .j av a2 s . 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 {// ww w. ja va 2s .c om 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.BusinessQueryManagerV3Impl.java
public BulkResponse findServiceBindings(Key serviceKey, Collection findQualifiers, Collection classifications, Collection specifications) throws JAXRException { BulkResponseImpl blkRes = new BulkResponseImpl(); IRegistryV3 iRegistry = (IRegistryV3) registryService.getRegistry(); FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers); try {//from w w w . j a v a 2 s .c o m BindingDetail bindingDetail = iRegistry.findBinding(serviceKey.getId(), ScoutJaxrUddiV3Helper.getCategoryBagFromClassifications(classifications), ScoutJaxrUddiV3Helper.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 = ScoutUddiV3JaxrHelper.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 (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } return blkRes; }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.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 ww w . j a v a 2s.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(); IRegistryV3 iRegistry = (IRegistryV3) 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, ScoutJaxrUddiV3Helper.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 (RegistryV3Exception e) { throw new JAXRException(e.getLocalizedMessage()); } return blkRes; }
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 . j av 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; }