List of usage examples for javax.xml.registry JAXRException printStackTrace
public void printStackTrace()
From source file:de.kp.ames.web.core.rss.RssConverter.java
/** * A public method to convert a certain registry object * as a new syndication entry//from w ww . ja va 2 s. c o m * * @param ro * @param jaxrHandle * @param domain * @return */ public static SyndEntry convertRegistryObject(RegistryObjectImpl ro, JaxrHandle jaxrHandle, String domain) { SyndEntry entry = null; JaxrDQM dqm = new JaxrDQM(jaxrHandle); try { entry = new SyndEntryImpl(); /* * The identifier of the respective registry * object is set to the uri */ entry.setUri(ro.getId()); /* * Entry title */ String eventType = dqm.getLastEventType(ro); if (eventType == null) eventType = "created"; String title = ro.getDisplayName() + " (" + eventType + ")"; entry.setTitle(title); /* * Description using default locale */ SyndContent desc = new SyndContentImpl(); desc.setType(GlobalConstants.MT_HTML); String description = dqm.getDescription(ro); description = (description == "") ? ((InternationalStringImpl) ro.getDescription()).getClosestValue() : description; desc.setValue(description); entry.setDescription(desc); /* * Author name */ String author = dqm.getAuthor(ro); entry.setAuthor(author); /* * Published date */ Date date = dqm.getLastModified(ro); entry.setUpdatedDate(date); /* * categories = domain, object type */ List<SyndCategory> categories = new ArrayList<SyndCategory>(); SyndCategory category = null; // domain category = new SyndCategoryImpl(); category.setName(domain); categories.add(category); // object type category = new SyndCategoryImpl(); category.setName(ro.getObjectType().getKey().getId()); categories.add(category); entry.setCategories(categories); /* * Link parameter * * the link parameter is actually set to the home address * of the respective registry; in a federated environment, * these parameters determine a certain registry object uniquely */ String home = dqm.getHome(ro); entry.setLink(home); } catch (JAXRException e) { e.printStackTrace(); } finally { } return entry; }
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.IdentifiableImpl.java
/** * Compares two registries objects. Consider adding Comparable to * RegistryObject in JAXR 2.0??/*from w w w. j a va2 s . c o m*/ * * @return 0 (equal) is the id of the objects matches this objects id. * Otherwise return -1 (this object is less than arg o). */ public int compareTo(Object o) { int result = -1; if (o instanceof IdentifiableImpl) { try { // Need class match otherwise RegistryObjectRef and // IdentifiableImpl // with same id will match when they should not. if (o.getClass() == this.getClass()) { String myId = getId(); String otherId = ((IdentifiableImpl) o).getKey().getId(); result = myId.compareTo(otherId); } } catch (JAXRException e) { e.printStackTrace(); } } return result; }
From source file:it.cnr.icar.eric.client.ui.swing.JAXRClient.java
/** * DOCUMENT ME!/* w w w.java 2 s .com*/ * * @return DOCUMENT ME! */ CapabilityProfile getCapabilityProfile() { CapabilityProfile profile = null; try { profile = connection.getRegistryService().getCapabilityProfile(); } catch (JAXRException e) { e.printStackTrace(); RegistryBrowser.displayError(e); } return profile; }
From source file:JAXRSaveClassificationScheme.java
/** * Creates a classification scheme and saves it to the * registry./*from w w w. j a v a2s .c om*/ * * @param username the username for the registry * @param password the password for the registry */ public void executePublish(String username, String password) { RegistryService rs = null; BusinessLifeCycleManager blcm = null; BusinessQueryManager bqm = null; try { rs = connection.getRegistryService(); blcm = rs.getBusinessLifeCycleManager(); bqm = rs.getBusinessQueryManager(); System.out.println("Got registry service, query " + "manager, and life cycle manager"); // Get authorization from the registry PasswordAuthentication passwdAuth = new PasswordAuthentication(username, password.toCharArray()); HashSet<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>(); creds.add(passwdAuth); connection.setCredentials(creds); System.out.println("Established security credentials"); ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples"); // Create classification scheme InternationalString sn = blcm.createInternationalString(bundle.getString("postal.scheme.name")); InternationalString sd = blcm.createInternationalString(bundle.getString("postal.scheme.description")); ClassificationScheme postalScheme = blcm.createClassificationScheme(sn, sd); /* * Find the uddi-org:types classification scheme defined * by the UDDI specification, using well-known key id. */ String uuid_types = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4"; ClassificationScheme uddiOrgTypes = (ClassificationScheme) bqm.getRegistryObject(uuid_types, LifeCycleManager.CLASSIFICATION_SCHEME); if (uddiOrgTypes != null) { InternationalString cn = blcm .createInternationalString(bundle.getString("postal.classification.name")); Classification classification = blcm.createClassification(uddiOrgTypes, cn, bundle.getString("postal.classification.value")); postalScheme.addClassification(classification); /* * Set link to location of postal scheme (fictitious) * so others can look it up. If the URI were valid, we * could use the createExternalLink method. */ ExternalLink externalLink = (ExternalLink) blcm.createObject(LifeCycleManager.EXTERNAL_LINK); externalLink.setValidateURI(false); externalLink.setExternalURI(bundle.getString("postal.scheme.link")); InternationalString is = blcm.createInternationalString(bundle.getString("postal.scheme.linkdesc")); externalLink.setDescription(is); postalScheme.addExternalLink(externalLink); // Add scheme and save it to registry // Retrieve key if successful Collection<ClassificationScheme> schemes = new ArrayList<ClassificationScheme>(); schemes.add(postalScheme); BulkResponse br = blcm.saveClassificationSchemes(schemes); if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) { System.out.println("Saved PostalAddress " + "ClassificationScheme"); Collection schemeKeys = br.getCollection(); for (Object k : schemeKeys) { Key key = (Key) k; System.out.println("The postalScheme key is " + key.getId()); System.out.println( "Use this key as the scheme uuid " + "in the postalconcepts.xml file\n and as the " + "argument to JAXRPublishPostal and " + "JAXRQueryPostal"); } } else { Collection exceptions = br.getExceptions(); for (Object e : exceptions) { Exception exception = (Exception) e; System.err.println("Exception on save: " + exception.toString()); } } } else { System.out.println("uddi-org:types not found. Unable to " + "save PostalAddress scheme."); } } catch (JAXRException jaxe) { jaxe.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.InternationalStringImpl.java
public Object clone() { InternationalStringImpl _clone = null; try {/*from w ww .j a v a2 s. c om*/ _clone = new InternationalStringImpl(lcm); Iterator<LocalizedString> iter = this.getLocalizedStrings().iterator(); while (iter.hasNext()) { LocalizedStringImpl ls = (LocalizedStringImpl) iter.next(); LocalizedString lsClone = (LocalizedString) ls.clone(); _clone.addLocalizedString(lsClone); } } catch (JAXRException e) { //Cannot happen. e.printStackTrace(); } return _clone; }
From source file:it.cnr.icar.eric.server.cache.ClassificationSchemeCache.java
/** * Clear all affectedObjects in AuditableEvent from cache. When called, * internalCache may be out of date with respect to dB (where transaction * has been committed) and objectCache (where affected classification nodes * have already been processed).<br> * This code keeps the cache primed if it was primed earlier. The side * effect of this choice is every other context (separate transaction) * immediately knows about the just-committed changes. That is, this cache * imitates TRANSACTION_READ_COMMITTED transaction isolation unless the * caching event setting is "never".//from ww w. j a v a 2 s.c o m */ public void onEvent(ServerRequestContext context, AuditableEventType ae) { final String eventType = ae.getEventType(); final boolean justRemove = primeCacheEvent.equalsIgnoreCase("never"); final boolean wasChanged = eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Created) || eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Updated) || eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Versioned); final boolean wasRemoved = eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Deleted); Set<String> schemesToRemove = new HashSet<String>(); HashMap<String, RegistryObjectType> schemesToUpdate = new HashMap<String, RegistryObjectType>(); primeCacheOnFirstUse(context); if (wasChanged || wasRemoved) { try { List<ObjectRefType> affectedObjects = ae.getAffectedObjects().getObjectRef(); Iterator<ObjectRefType> iter = affectedObjects.iterator(); while (iter.hasNext()) { ObjectRefType ref = iter.next(); String objectId = ref.getId(); RegistryObjectType ro = context.getAffectedObjectsMap().get(objectId); if (null == ro) { // In case missing (removed?) object was a scheme schemesToRemove.add(objectId); } else { if (ro instanceof ClassificationSchemeType) { if (wasRemoved || justRemove) { schemesToRemove.add(objectId); } else { schemesToUpdate.put(objectId, ro); } } else if (ro instanceof ClassificationNodeType) { String schemeId = bu.getSchemeIdForRegistryObject(ro); // Handle case where a node in a scheme has been // added, deleted or updated. if (justRemove) { schemesToRemove.add(schemeId); } else if (!(schemesToRemove.contains(schemeId) || schemesToUpdate.containsKey(schemeId))) { ClassificationSchemeType scheme = (ClassificationSchemeType) getRegistryObjectInternal( context, schemeId, "ClassScheme"); if (null != scheme) { schemesToUpdate.put(schemeId, scheme); // ??? Why is this necessary for all // ??? schemes loaded? loadChildren(context, scheme, getDepthForScheme(schemeId)); } } } } } } catch (JAXRException e) { log.error(e); // Just update all schemes to be safe in case of any errors reset(context); // Make following block a no-op. schemesToRemove.clear(); schemesToUpdate.clear(); } } synchronized (internalCache) { int oldSize; // xxx pa 110816 added try / catch for CacheException (ehcache 1.0 effect?) try { oldSize = internalCache.getSize(); Iterator<String> iter = schemesToRemove.iterator(); while (iter.hasNext()) { String objectId = iter.next(); internalCache.remove(objectId); } if (justRemove) { // Cache may become primed regardless of primeCacheEvent // setting, pay attention if we have undone that. if (oldSize != internalCache.getSize()) { cacheIsPrimed = false; } } else if (schemesToUpdate.size() > 0) { addClassificationSchemesToCache(schemesToUpdate.values()); } } catch (CacheException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
public void insert(Point point) { RegistryBrowser.setWaitCursor();/*w w w . jav a 2 s.c o m*/ try { if (RegistryBrowser.getInstance().getClient().getConnection() == null) { RegistryBrowser.displayError("Connect to a registry by specifying Registry Location first."); return; } RegistryObject ro = createRegistryObject(); // Construct Vertex with no Label JBGraphCell vertex = new JBGraphCell(ro, true); registryObjectToCellMap.put(ro, vertex); // Add one Floating Port vertex.add(new DefaultPort()); // Snap the Point to the Grid point = snap(new Point(point)); // Default Size for the new Vertex Dimension size = new Dimension(25, 25); // Create a Map that holds the attributes for the Vertex Map<?, ?> map = GraphConstants.createMap(); // Add a Bounds Attribute to the Map GraphConstants.setBounds(map, new Rectangle(point, size)); // Add a Border Color Attribute to the Map GraphConstants.setBorderColor(map, Color.black); // Add a White Background GraphConstants.setBackground(map, Color.white); // Make Vertex Opaque GraphConstants.setOpaque(map, true); // Construct a Map from cells to Maps (for insert) Hashtable<DefaultGraphCell, Map<?, ?>> attributes = new Hashtable<DefaultGraphCell, Map<?, ?>>(); // Associate the Vertex with its Attributes attributes.put(vertex, map); // Insert the Vertex and its Attributes getModel().insert(new Object[] { vertex }, null, null, attributes); } catch (JAXRException e) { e.printStackTrace(); RegistryBrowser.displayError(e); } RegistryBrowser.setDefaultCursor(); }