List of usage examples for javax.xml.registry JAXRException JAXRException
public JAXRException(Throwable cause)
JAXRException
object initialized with the given Throwable
object. From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Deletes one or more previously submitted objects from the registry, * according to the specified deletion scope. Add to JAXR 2.0 as * deleteObjects(Collection keys, String deletionScope)?? * //from ww w.j av a2s .c o m * @param keys * a Collection of keys for the objects to be deleted * @param deletionScope * the canonical deletion scope code * * @return BulkResponse with success status or list of exceptions. * * @throws JAXRException * if the JAXR provider encounters an internal error * @param keys */ public BulkResponse deleteObjects(Collection<?> keys, AdhocQueryImpl query, HashMap<String, String> slotsMap, String deletionScope) throws JAXRException { BulkResponseImpl response = null; List<ObjectRefType> orl = createObjectRefList(keys); boolean isCallersUserBeingDeleted = isCallersUserBeingDeleted(keys); try { org.oasis.ebxml.registry.bindings.lcm.RemoveObjectsRequest req = lcmFac.createRemoveObjectsRequest(); if (slotsMap != null) { bu.addSlotsToRequest(req, slotsMap); } ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:deleteObjects", req); req.setDeletionScope(deletionScope); ObjectRefListType ebObjectRefListType = rimFac.createObjectRefListType(); ebObjectRefListType.getObjectRef().addAll(orl); req.setObjectRefList(ebObjectRefListType); if (query != null) { AdhocQueryType ebAdhocQueryType = (AdhocQueryType) (query).toBindingObject(); req.setAdhocQuery(ebAdhocQueryType); } JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.removeObjects(context); response = new BulkResponseImpl(this, ebResp, null); // If there are no exceptions and isCallersUserToBeDeleted is // 'true', // then clear the credentials on the Connection object. Failure to // do // so will result in the Connection continuing to use the deleted // credentials. if (response.getExceptions() == null && isCallersUserBeingDeleted) { regService.getConnection().logoff(); } // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Approve one or more previously submitted objects from the registry. * //TODO: Add to JAXR 2.0 API/*from ww w . j a v a 2 s . c o m*/ * * <p> * <DL> * <DT><B>Capability Level: 1 </B> * </DL> * * @return BulkResponse containing the Collection of keys for those objects * that were approved successfully and any RegistryException that * was encountered in case of partial commit. */ public BulkResponse approveObjects(Collection<?> keys, AdhocQueryImpl query, HashMap<String, String> slotsMap) throws JAXRException { BulkResponseImpl response = null; List<ObjectRefType> orl = createObjectRefList(keys); try { org.oasis.ebxml.registry.bindings.lcm.ApproveObjectsRequest req = lcmFac.createApproveObjectsRequest(); if (slotsMap != null) { bu.addSlotsToRequest(req, slotsMap); } ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:approveObjects", req); ObjectRefListType ebObjectRefListType = rimFac.createObjectRefListType(); ebObjectRefListType.getObjectRef().addAll(orl); req.setObjectRefList(ebObjectRefListType); if (query != null) { AdhocQueryType ebAdhocQueryType = (AdhocQueryType) (query).toBindingObject(); req.setAdhocQuery(ebAdhocQueryType); } JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.approveObjects(context); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
public RegistryResponseHolder extensionRequest(RegistryRequestType req, HashMap<String, Object> idToRepositoryItemsMap) throws JAXRException { RegistryResponseHolder respHolder = null; try {//from w w w.ja v a 2s .c om ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:extensionRequest", req); context.setRepositoryItemsMap(idToRepositoryItemsMap); JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); respHolder = serverLCM.extensionRequest(context); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return respHolder; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Changes the owner of one or more objects. * // w w w .j a v a2 s . c om * @param keys * a Collection of keys for the objects to be * @param newOwner * a Collection of keys for the objects to be deprecated * * @return a BulkResponse containing the Collection of keys for those * objects that had their owner changed successfully and any * JAXRException that was encountered in case of partial commit * * @throws JAXRException * if the JAXR provider encounters an internal error */ public BulkResponse changeObjectsOwner(Collection<?> keys, AdhocQueryImpl query1, String newOwner) throws JAXRException { BulkResponseImpl response = null; @SuppressWarnings("unused") List<ObjectRefType> orl = createObjectRefList(keys); try { DeclarativeQueryManager dqm = getRegistryService().getDeclarativeQueryManager(); org.oasis.ebxml.registry.bindings.lcm.RelocateObjectsRequest req = lcmFac .createRelocateObjectsRequest(); ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:changeObjectsOwner", req); // Create and set query String queryStr = "SELECT ro.* from RegistryObject ro WHERE "; Iterator<?> iter = keys.iterator(); while (iter.hasNext()) { String roID = ((Key) iter.next()).getId(); queryStr += "ro.id = '" + roID + "'"; if (iter.hasNext()) { queryStr += " OR "; } } AdhocQueryType ebAdhocQueryType = bu.createAdhocQueryType(queryStr); req.setAdhocQuery(ebAdhocQueryType); // Set owner at source ObjectRefType sourceOwnerRef = rimFac.createObjectRefType(); sourceOwnerRef.setId(it.cnr.icar.eric.common.Utility.getInstance().createId()); // Just // a // dummy // id // for // now // will // do. req.setOwnerAtSource(sourceOwnerRef); // Set owner at destination ObjectRefType newOwnerObj = rimFac.createObjectRefType(); newOwnerObj.setId(newOwner); req.setOwnerAtDestination(newOwnerObj); // Get registry String registryQueryStr = "SELECT r.* from Registry r "; Query query = dqm.createQuery(Query.QUERY_TYPE_SQL, registryQueryStr); // make JAXR request javax.xml.registry.BulkResponse registryResponse = dqm.executeQuery(query); JAXRUtility.checkBulkResponse(registryResponse); // TODOD: Following is dangerous assumption as there may be replica // Registry instances // representing other registries. SHould iterate over all and find // the first one // where home attribute is undefined. RegistryObject registry = (RegistryObject) JAXRUtility.getFirstObject(registryResponse.getCollection()); ObjectRefType registryRef = rimFac.createObjectRefType(); registryRef.setId(registry.getKey().getId()); req.setSourceRegistry(registryRef); req.setDestinationRegistry(registryRef); JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); // Submit the request RegistryResponseType ebResp = serverLCM.relocateObjects(context); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java
private void handleExceptions(BulkResponse br) throws JAXRException { String errorMessages = ""; try {// w ww . jav a2 s .c o m Iterator<?> itr = br.getExceptions().iterator(); StringBuffer sb = new StringBuffer(); while (itr.hasNext()) { Throwable t = (Throwable) itr.next(); sb.append(t.getMessage()).append(' '); } errorMessages = sb.toString(); } catch (Throwable t) { errorMessages = WebUIResourceBundle.getInstance().getString("noErrorMessage"); } throw new JAXRException(errorMessages); }
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 a v a2s . c om * @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.BusinessLifeCycleManagerImpl.java
/** * Saves one or more Objects to the registry. An object may be a * RegistryObject subclass instance. If an object is not in the registry, * it is created in the registry. If it already exists in the registry * and has been modified, then its state is updated (replaced) in the * registry//from w w w. ja v a 2 s. com * <p/> * TODO:Check if juddi can provide a facility to store a collection of heterogenous * objects * <p/> * TODO - does this belong here? it's really an overload of * LifecycleManager.saveObjects, but all the help we need * like saveOrganization() is up here... * * @param col * @return a BulkResponse containing the Collection of keys for those objects * that were saved successfully and any SaveException that was encountered * in case of partial commit * @throws JAXRException */ public BulkResponse saveObjects(Collection col) throws JAXRException { Iterator iter = col.iterator(); LinkedHashSet<Object> suc = new LinkedHashSet<Object>(); Collection<Exception> exc = new ArrayList<Exception>(); while (iter.hasNext()) { RegistryObject reg = (RegistryObject) iter.next(); BulkResponse br = null; Collection<RegistryObject> c = new ArrayList<RegistryObject>(); c.add(reg); if (reg instanceof javax.xml.registry.infomodel.Association) { br = saveAssociations(c, true); } else if (reg instanceof javax.xml.registry.infomodel.ClassificationScheme) { br = saveClassificationSchemes(c); } else if (reg instanceof javax.xml.registry.infomodel.Concept) { br = saveConcepts(c); } else if (reg instanceof javax.xml.registry.infomodel.Organization) { br = saveOrganizations(c); } else if (reg instanceof javax.xml.registry.infomodel.Service) { br = saveServices(c); } else if (reg instanceof javax.xml.registry.infomodel.ServiceBinding) { br = saveServiceBindings(c); } else { throw new JAXRException("Delete Operation for " + reg.getClass() + " not implemented by Scout"); } if (br.getCollection() != null) { suc.addAll(br.getCollection()); } if (br.getExceptions() != null) { exc.addAll(br.getExceptions()); } } BulkResponseImpl bulk = new BulkResponseImpl(); /* * TODO - what is the right status? */ bulk.setStatus(JAXRResponse.STATUS_SUCCESS); bulk.setCollection(suc); bulk.setExceptions(exc); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
public void confirmAssociation(Association assoc) throws JAXRException, InvalidRequestException { //Store it in the UDDI registry HashSet<Association> col = new HashSet<Association>(); col.add(assoc);/*from ww w. j a va 2s . c om*/ BulkResponse br = this.saveAssociations(col, true); if (br.getExceptions() != null) throw new JAXRException("Confiming the Association Failed"); }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
public void unConfirmAssociation(Association assoc) throws JAXRException, InvalidRequestException { //TODO//from w ww.ja v a 2 s .c om //Delete it from the UDDI registry Collection<Key> col = new ArrayList<Key>(); col.add(assoc.getKey()); BulkResponse br = this.deleteAssociations(col); if (br.getExceptions() != null) throw new JAXRException("UnConfiming the Association Failed"); }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java
protected Object executeOperation(Object dataarray, String op) throws RegistryException, JAXRException { if (registry == null) { throw new IllegalStateException("No registry"); }// www.j ava2s. c o m IRegistry ireg = (IRegistry) registry.getRegistry(); ConnectionImpl connection = registry.getConnection(); AuthToken token = getAuthToken(connection, ireg); if (token == null) { throw new IllegalStateException("No auth token returned"); } Object regobj; if (op.equalsIgnoreCase("SAVE_ASSOCIATION")) { try { regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_SERVICE")) { try { regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_SERVICE_BINDING")) { try { regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_ORG")) { try { regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray); } } else if (op.equalsIgnoreCase("SAVE_TMODEL")) { try { regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_ORG")) { try { clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_SERVICE")) { try { regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_SERVICEBINDING")) { try { regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); //clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_CONCEPT")) { try { regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } } else if (op.equalsIgnoreCase("DELETE_ASSOCIATION")) { int len = ((String[]) dataarray).length; PublisherAssertion[] paarr = new PublisherAssertion[len]; for (int i = 0; i < len; i++) { String keystr = ((String[]) dataarray)[i]; paarr[i] = ScoutJaxrUddiHelper.getPubAssertionFromJAXRAssociationKey(keystr); } try { regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr); } } else if (op.equalsIgnoreCase("DELETE_CLASSIFICATIONSCHEME")) { try { regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } catch (RegistryException rve) { String username = getUsernameFromCredentials(connection.getCredentials()); if (AuthTokenSingleton.getToken(username) != null) { AuthTokenSingleton.deleteAuthToken(username); } token = getAuthToken(connection, ireg); clearPublisherAssertions(token.getAuthInfo(), ireg); regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray); } } else { throw new JAXRException("Unsupported operation:" + op); } return regobj; }