List of usage examples for javax.xml.registry BulkResponse getExceptions
Collection getExceptions() throws JAXRException;
From source file:it.cnr.icar.eric.client.ui.thin.SearchPanelBean.java
@SuppressWarnings("unchecked") private BulkResponse executeQuery(Query query, @SuppressWarnings("rawtypes") Map queryParams, IterativeQueryParams iqParams) throws JAXRException { BulkResponse bulkResponse = null; try {/*from w w w . jav a 2s. co m*/ DeclarativeQueryManagerImpl dqm = RegistryBrowser.getDQM(); // Use search depth parameter for all queries. Support can be // added incrementally on server side for depth-related requests. queryParams.put(CanonicalConstants.CANONICAL_SEARCH_DEPTH_PARAMETER, getSearchDepth()); if (isCompressContent) { ExportBean.getInstance().setZipFileName(null); Collection<String> filterQueryIds = new ArrayList<String>(); filterQueryIds.add(BindingUtility.FREEBXML_REGISTRY_FILTER_QUERY_COMPRESSCONTENT); queryParams.put("$queryFilterIds", filterQueryIds); } bulkResponse = dqm.executeQuery(query, queryParams, iqParams); Collection<?> exceptions = bulkResponse.getExceptions(); //TO DO: forward exceptions to an error JSP if (exceptions != null) { Iterator<?> iter = exceptions.iterator(); Exception exception = null; StringBuffer sb = new StringBuffer(WebUIResourceBundle.getInstance().getString("errorExecQuery")); while (iter.hasNext()) { exception = (Exception) iter.next(); } log.error("\n" + exception.getMessage()); throw new JAXRException(sb.toString()); } else { if (isCompressContent) { handleCompressedContent(bulkResponse); } } } catch (Throwable t) { log.error(WebUIResourceBundle.getInstance().getString("message.ErrorDuringRequestProcessing"), t); throw new JAXRException( WebUIResourceBundle.getInstance().getString("errorRequestProcessing") + t.getMessage()); } return bulkResponse; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
private void initializeObjectTypesMap() { try {//from w w w . j ava 2 s . c o m DeclarativeQueryManager dqm = getRegistryService().getDeclarativeQueryManager(); // String queryStr = "SELECT children.* FROM ClassificationNode children, ClassificationNode parent where (parent.path LIKE '/" // + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_ObjectType // + "/RegistryObject%') AND (parent.path NOT LIKE '/" // + BindingUtility.CANONICAL_CLASSIFICATION_SCHEME_LID_ObjectType // + "/RegistryObject/ExtrinsicObject/%') AND parent.id = children.parent"; // Query query = dqm.createQuery(Query.QUERY_TYPE_SQL, queryStr); Query query = SQLQueryProvider.initializeObjectTypesMap(dqm); BulkResponse resp = dqm.executeQuery(query); if ((resp != null) && (!(resp.getStatus() == JAXRResponse.STATUS_SUCCESS))) { Collection<?> exceptions = resp.getExceptions(); if (exceptions != null) { Iterator<?> iter = exceptions.iterator(); while (iter.hasNext()) { Exception e = (Exception) iter.next(); e.printStackTrace(); } } return; } objectTypesMap = new HashMap<String, Concept>(); Collection<?> concepts = resp.getCollection(); Iterator<?> iter = concepts.iterator(); while (iter.hasNext()) { Concept concept = (Concept) iter.next(); String value = concept.getValue(); if (value.equals("ClassificationNode")) { value = "Concept"; } objectTypesMap.put(value, concept); } } catch (JAXRException e) { e.printStackTrace(); } }
From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java
private void handleExceptions(BulkResponse br) throws JAXRException { String errorMessages = ""; try {//w ww . j a v a 2 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
/** * 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//ww w . jav a 2s . c o m * <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 w w w .j av a 2 s . 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 .j a v a 2 s .com*/ //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"); }