List of usage examples for javax.xml.registry LifeCycleManager ORGANIZATION
String ORGANIZATION
To view the source code for javax.xml.registry LifeCycleManager ORGANIZATION.
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 w ww .j av a 2s. 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 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 IRegistry registry = (IRegistry) registryService.getRegistry(); try {//from w w w.jav a2s . co m ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection(); AuthToken auth = this.getAuthToken(con, registry); PublisherAssertions result = null; try { result = registry.getPublisherAssertions(auth.getAuthInfo()); } catch (RegistryException rve) { String username = getUsernameFromCredentials(con.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.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(); if ((sourceObjectId == null || sourceObjectId.equals(sourceKey)) && (targetObjectId == null || targetObjectId.equals(targetKey))) { Collection<Key> orgcol = new ArrayList<Key>(); orgcol.add(new KeyImpl(sourceKey)); orgcol.add(new KeyImpl(targetKey)); BulkResponse bl = getRegistryObjects(orgcol, LifeCycleManager.ORGANIZATION); Association asso = ScoutUddiJaxrHelper.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 (RegistryException e) { throw new JAXRException(e); } }
From source file:org.apache.ws.scout.registry.BusinessQueryManagerImpl.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 IRegistry registry = (IRegistry) 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); 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; report = null; try { report = registry.getAssertionStatusReport(auth.getAuthInfo(), confirm); } catch (RegistryException rve) { String username = getUsernameFromCredentials(con.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.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 = ScoutUddiJaxrHelper.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 (RegistryException e) { throw new JAXRException(e); } }
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 www . jav a 2s .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
/** * 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//from w w w. j a v a 2 s . com * * @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();// ww w.j a va 2 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 {/* w ww .jav a 2 s . 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 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 va 2 s .c om 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 {/* w ww .j a v 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
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.ja v a 2 s . c om 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; }