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.common.BindingUtility.java
/** * Get List of Id of first-level RegistryObject or ObjectRef in a request. For * those kinds of request having RegistryObject and ObjectRef (e.g. SubmitObjectsRequest), * only the id of RegistryObject elements are returned. *///from w ww . j a v a 2 s . c o m public List<String> getIdsFromRequest(Object registryRequest) throws JAXRException { List<String> ids = new ArrayList<String>(); if (registryRequest instanceof AdhocQueryRequest) { } else if (registryRequest instanceof ApproveObjectsRequest) { ObjectRefListType refList = ((ApproveObjectsRequest) registryRequest).getObjectRefList(); ids.addAll(getIdsFromObjectRefList(refList)); } else if (registryRequest instanceof SetStatusOnObjectsRequest) { ObjectRefListType refList = ((SetStatusOnObjectsRequest) registryRequest).getObjectRefList(); ids.addAll(getIdsFromObjectRefList(refList)); } else if (registryRequest instanceof DeprecateObjectsRequest) { ObjectRefListType refList = ((DeprecateObjectsRequest) registryRequest).getObjectRefList(); ids.addAll(getIdsFromObjectRefList(refList)); } else if (registryRequest instanceof UndeprecateObjectsRequest) { ObjectRefListType refList = ((UndeprecateObjectsRequest) registryRequest).getObjectRefList(); ids.addAll(getIdsFromObjectRefList(refList)); } else if (registryRequest instanceof RemoveObjectsRequest) { ObjectRefListType refList = ((RemoveObjectsRequest) registryRequest).getObjectRefList(); ids.addAll(getIdsFromObjectRefList(refList)); } else if (registryRequest instanceof SubmitObjectsRequest) { RegistryObjectListType objList = ((SubmitObjectsRequest) registryRequest).getRegistryObjectList(); List<IdentifiableType> objs = getRegistryObjectTypeFilteredList(objList); ids.addAll(getIdsFromRegistryObjectTypes(objs)); } else if (registryRequest instanceof UpdateObjectsRequest) { RegistryObjectListType objList = ((UpdateObjectsRequest) registryRequest).getRegistryObjectList(); List<IdentifiableType> objs = getRegistryObjectTypeFilteredList(objList); ids.addAll(getIdsFromRegistryObjectTypes(objs)); } else if (registryRequest instanceof RelocateObjectsRequest) { // Do nothing. } else { throw new JAXRException(resourceBundle.getString("message.invalidRequest", new String[] { registryRequest.getClass().getName() })); } return ids; }
From source file:it.cnr.icar.eric.server.query.QueryManagerImpl.java
/** * Creates and caches all QueryPlugins//from w w w .j a va 2s .com */ private void getQueryPlugins() { RegistryProperties props = RegistryProperties.getInstance(); Iterator<String> propsIter = props.getPropertyNamesStartingWith(QUERY_PLUGIN_PROPERTY_PREFIX); while (propsIter.hasNext()) { String prop = propsIter.next(); String queryId = prop.substring(QUERY_PLUGIN_PROPERTY_PREFIX.length() + 1); String pluginClassName = props.getProperty(prop); try { Object plugin = createPluginInstance(pluginClassName); if (!(plugin instanceof QueryPlugin)) { throw new JAXRException( CommonResourceBundle.getInstance().getString("message.unexpectedObjectType", new String[] { plugin.getClass().toString(), QueryPlugin.class.toString() })); } queryPluginsMap.put(queryId, plugin); } catch (Exception e) { log.error(e); } } }
From source file:it.cnr.icar.eric.server.query.QueryManagerImpl.java
/** * Creates and caches all QueryFilterPlugins *///from w ww . ja va 2 s .c o m private void getQueryFilterPlugins() { RegistryProperties props = RegistryProperties.getInstance(); Iterator<String> propsIter = props.getPropertyNamesStartingWith(QUERY_FILTER_PLUGIN_PROPERTY_PREFIX); while (propsIter.hasNext()) { String prop = propsIter.next(); String queryId = prop.substring(QUERY_FILTER_PLUGIN_PROPERTY_PREFIX.length() + 1); String pluginClassName = props.getProperty(prop); try { Object plugin = createPluginInstance(pluginClassName); if (!(plugin instanceof QueryPlugin)) { throw new JAXRException( CommonResourceBundle.getInstance().getString("message.unexpectedObjectType", new String[] { plugin.getClass().toString(), QueryPlugin.class.toString() })); } queryPluginsMap.put(queryId, plugin); } catch (Exception e) { log.error(e); } } }
From source file:it.cnr.icar.eric.common.BindingUtility.java
public SOAPElement getSOAPElementFromBindingObject(Object obj) throws JAXRException { SOAPElement soapElem = null;//w w w. ja va 2 s .c om try { SOAPElement parent = SOAPFactory.newInstance().createElement("dummy"); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.marshal(obj, new DOMResult(parent)); soapElem = (SOAPElement) parent.getChildElements().next(); } catch (Exception e) { throw new JAXRException(e); } return soapElem; }
From source file:it.cnr.icar.eric.common.BindingUtility.java
public Object getBindingObjectFromSOAPElement(SOAPElement soapElem) throws JAXRException { Object obj = null;// w w w . j a va 2s. c o m try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); obj = unmarshaller.unmarshal(soapElem); } catch (Exception e) { throw new JAXRException(e); } return obj; }
From source file:it.cnr.icar.eric.common.BindingUtility.java
public void checkRegistryResponse(RegistryResponseType resp) throws JAXRException { if (!(resp.getStatus().equals(CANONICAL_RESPONSE_STATUS_TYPE_ID_Success))) { StringWriter sw = new StringWriter(); try {// w ww .j a v a 2 s . com Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(resp, sw); throw new JAXRException(sw.toString()); } catch (Exception e) { throw new JAXRException(e); } } }
From source file:it.cnr.icar.eric.client.xml.registry.jaas.LoginModuleManager.java
private void deleteCfgFile(String cfgFile) throws JAXRException { try {/* w ww . j ava 2s. com*/ File file = new File(cfgFile); boolean isDeleted = file.delete(); if (!isDeleted) { System.out.println("warning: could not delete tmp file"); } } catch (Throwable t) { throw new JAXRException(t); } }
From source file:it.cnr.icar.eric.client.xml.registry.jaas.LoginModuleManager.java
private void writeCfgFile(File configFile, String cfgFileContents, boolean append) throws JAXRException { BufferedWriter writer = null; try {/* www . ja v a2 s. c o m*/ writer = new BufferedWriter(new FileWriter(configFile, append)); writer.write(cfgFileContents, 0, cfgFileContents.length()); writer.flush(); } catch (IOException ex) { throw new JAXRException(ex); } finally { if (writer != null) { try { writer.close(); } catch (IOException ex) { // ignore writer = null; } } } }
From source file:it.cnr.icar.eric.client.xml.registry.jaas.LoginModuleManager.java
private String getUserCfgFileContents(String userHomeFileName) throws JAXRException { String fileContents = null;//from w w w . j a v a2 s . c o m BufferedReader in = null; try { File configFile = new File(userHomeFileName); if (configFile.exists()) { StringBuffer sb2 = new StringBuffer(); String line = null; in = new BufferedReader(new FileReader(configFile)); while ((line = in.readLine()) != null) { sb2.append(line).append(LINE_SEPARATOR); } fileContents = sb2.toString(); } log.debug("user config file contents: " + fileContents); return fileContents; } catch (IOException ex) { throw new JAXRException(ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { // ignore in = null; } } }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java
private void createMenuItemsForTaxonomyElements(JMenuItem parentMenuItem, Collection<?> taxonomyElements) throws JAXRException { Iterator<?> iter = taxonomyElements.iterator(); while (iter.hasNext()) { Object taxonomyElementObj = iter.next(); Collection<?> children = null; if (taxonomyElementObj instanceof ClassificationScheme) { children = ((ClassificationScheme) taxonomyElementObj).getChildrenConcepts(); } else if (taxonomyElementObj instanceof Concept) { children = ((Concept) taxonomyElementObj).getChildrenConcepts(); } else {/*from w ww. j av a 2 s. c o m*/ throw new JAXRException(CommonResourceBundle.getInstance() .getString("message.unexpectedObjectType", new String[] { taxonomyElementObj.getClass().toString(), "javax.xml.registry.infomodel.ClassificationScheme, javax.xml.registry.infomodel.ClassificationScheme" })); } String childName = ((RegistryObjectImpl) taxonomyElementObj).getDisplayName(); JMenuItem childMenuItem = null; //Need to handle intermediate nodes different from terminal nodes //Intermediate nodes: have a JMenu and JMenuItem children where first child represents themself //Leaf nodes: have a JMenuItem that represents themself if (children.size() > 0) { //Intermediate node childMenuItem = new JMenu(childName); //Add a first child that represents the intermediate node itself JMenuItem firstGrandChildMenuItem = new TaxonomyElementMenuItem( ((RegistryObjectImpl) taxonomyElementObj)); Action action = new SetStatusAction(((RegistryObjectImpl) taxonomyElementObj)); firstGrandChildMenuItem.setAction(action); childMenuItem.add(firstGrandChildMenuItem); //Now add a separator JSeparator separator = new JSeparator(); childMenuItem.add(separator); createMenuItemsForTaxonomyElements(childMenuItem, children); } else { //Leaf node childMenuItem = new TaxonomyElementMenuItem(((RegistryObjectImpl) taxonomyElementObj)); Action action = new SetStatusAction(((RegistryObjectImpl) taxonomyElementObj)); childMenuItem.setAction(action); } parentMenuItem.add(childMenuItem); } }