List of usage examples for javax.xml.registry JAXRResponse STATUS_FAILURE
int STATUS_FAILURE
To view the source code for javax.xml.registry JAXRResponse STATUS_FAILURE.
Click Source Link
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
public BulkResponse saveOrganizations(Collection organizations) throws JAXRException { //Now we need to convert the collection into a vector for juddi BulkResponseImpl bulk = new BulkResponseImpl(); BusinessEntity[] entityarr = new BusinessEntity[organizations.size()]; LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); Iterator iter = organizations.iterator(); int currLoc = 0; while (iter.hasNext()) { try {/* w w w . j a v a2 s.co m*/ BusinessEntity en = ScoutJaxrUddiV3Helper.getBusinessEntityFromJAXROrg((Organization) iter.next()); entityarr[currLoc] = en; currLoc++; } catch (ClassCastException ce) { throw new UnexpectedObjectException(); } } log.debug("Method:save_business: ENlength=" + entityarr.length); // Save business BusinessDetail bd = null; try { bd = (BusinessDetail) executeOperation(entityarr, "SAVE_ORG"); } catch (RegistryV3Exception e) { exceptions.add(new SaveException(e.getLocalizedMessage())); bulk.setStatus(JAXRResponse.STATUS_FAILURE); return bulk; } List<BusinessEntity> bizEntityList = bd.getBusinessEntity(); entityarr = new BusinessEntity[bizEntityList.size()]; bizEntityList.toArray(entityarr); log.debug("After Saving Business. Obtained vector size:" + entityarr != null ? entityarr.length : 0); for (int i = 0; entityarr != null && i < entityarr.length; i++) { BusinessEntity entity = (BusinessEntity) entityarr[i]; coll.add(new KeyImpl(entity.getBusinessKey())); } bulk.setCollection(coll); bulk.setExceptions(exceptions); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
public BulkResponse saveServiceBindings(Collection bindings) throws JAXRException { BulkResponseImpl bulk = new BulkResponseImpl(); BindingTemplate[] sbarr = new BindingTemplate[bindings.size()]; LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); Iterator iter = bindings.iterator(); int currLoc = 0; while (iter.hasNext()) { try {// w w w .j av a2s.com BindingTemplate bs = ScoutJaxrUddiV3Helper .getBindingTemplateFromJAXRSB((ServiceBinding) iter.next()); sbarr[currLoc] = bs; currLoc++; } catch (ClassCastException ce) { throw new UnexpectedObjectException(); } } // Save ServiceBinding BindingDetail bd = null; try { bd = (BindingDetail) executeOperation(sbarr, "SAVE_SERVICE_BINDING"); } catch (RegistryV3Exception e) { exceptions.add(new SaveException(e.getLocalizedMessage())); bulk.setStatus(JAXRResponse.STATUS_FAILURE); return bulk; } List<BindingTemplate> bindingTemplateList = bd.getBindingTemplate(); sbarr = new BindingTemplate[bindingTemplateList.size()]; bindingTemplateList.toArray(sbarr); for (int i = 0; sbarr != null && i < sbarr.length; i++) { BindingTemplate bt = (BindingTemplate) sbarr[i]; coll.add(new KeyImpl(bt.getBindingKey())); } if (coll.size() > 0) { bulk.setCollection(coll); } bulk.setExceptions(exceptions); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
public BulkResponse saveServices(Collection services) throws JAXRException { BulkResponseImpl bulk = new BulkResponseImpl(); BusinessService[] sarr = new BusinessService[services.size()]; LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); Iterator iter = services.iterator(); int currLoc = 0; while (iter.hasNext()) { try {/*from w w w . j a va2 s .c om*/ BusinessService bs = ScoutJaxrUddiV3Helper.getBusinessServiceFromJAXRService((Service) iter.next()); sarr[currLoc] = bs; currLoc++; } catch (ClassCastException ce) { throw new UnexpectedObjectException(); } } // Save Service ServiceDetail sd = null; try { sd = (ServiceDetail) executeOperation(sarr, "SAVE_SERVICE"); } catch (RegistryV3Exception e) { exceptions.add(new SaveException(e.getLocalizedMessage())); bulk.setStatus(JAXRResponse.STATUS_FAILURE); return bulk; } List<BusinessService> bizServiceList = sd.getBusinessService(); sarr = new BusinessService[bizServiceList.size()]; bizServiceList.toArray(sarr); for (int i = 0; sarr != null && i < sarr.length; i++) { BusinessService entity = (BusinessService) sarr[i]; coll.add(new KeyImpl(entity.getServiceKey())); } bulk.setCollection(coll); bulk.setExceptions(exceptions); return bulk; }
From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java
protected BulkResponse deleteOperation(Collection<Key> keys, String op) throws JAXRException { if (keys == null) throw new JAXRException("Keys provided to " + op + " are null"); //Now we need to convert the collection into a vector for juddi BulkResponseImpl bulk = new BulkResponseImpl(); String[] keyarr = new String[keys.size()]; Result[] keyResultArr;// ww w. ja v a 2s.c o m LinkedHashSet<Key> coll = new LinkedHashSet<Key>(); Collection<Exception> exceptions = new ArrayList<Exception>(); try { Iterator iter = keys.iterator(); int currLoc = 0; while (iter.hasNext()) { Key key = (Key) iter.next(); keyarr[currLoc] = key.getId(); currLoc++; } // Delete operation DispositionReport bd = (DispositionReport) executeOperation(keyarr, op); List<Result> resultList = bd.getResult(); keyResultArr = new Result[resultList.size()]; resultList.toArray(keyResultArr); log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length : 0); for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) { Result result = (Result) keyResultArr[i]; int errno = result.getErrno(); if (errno == 0) { coll.addAll(keys); } else { ErrInfo errinfo = result.getErrInfo(); DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue()); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } } } catch (RegistryV3Exception regExcept) { /* * jUDDI (and prollie others) throw an exception on any fault in * the transaction w/ the registry, so we don't get any partial * success */ DeleteException de = new DeleteException(regExcept.getFaultCode() + ":" + regExcept.getFaultString(), regExcept); bulk.setStatus(JAXRResponse.STATUS_FAILURE); exceptions.add(de); } catch (JAXRException tran) { exceptions.add(new JAXRException("Apache JAXR Impl:", tran)); bulk.setStatus(JAXRResponse.STATUS_FAILURE); } bulk.setCollection(coll); bulk.setExceptions(exceptions); return bulk; }