List of usage examples for javax.xml.namespace QName toString
public String toString()
From source file:org.switchyard.rhq.plugin.ComponentReferenceDiscoveryComponent.java
/** * Discover existing resources.// w w w. ja v a 2s . com * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ComponentServiceResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ComponentServiceResourceComponent parent = context.getParentResourceComponent(); final Map<String, ComponentReference> references = parent.getReferences(); if (references != null) { for (ComponentReference reference : references.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = reference.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Component Reference " + reference); } } return discoveredResources; }
From source file:org.switchyard.rhq.plugin.ComponentServiceDiscoveryComponent.java
/** * Discover existing resources./*from w w w.j a v a 2 s . co m*/ * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ApplicationResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ApplicationResourceComponent parent = context.getParentResourceComponent(); final Map<String, ComponentService> componentServices = parent.getComponentServices(); for (ComponentService componentService : componentServices.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = componentService.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Component Service " + componentService); } return discoveredResources; }
From source file:org.switchyard.rhq.plugin.ReferenceBindingDiscoveryComponent.java
/** * Discover existing resources./* w w w .j av a 2 s. c om*/ * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ReferenceResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ReferenceResourceComponent parent = context.getParentResourceComponent(); final Map<String, Gateway> gateways = parent.getGateways(); if (gateways != null) { for (Gateway gateway : gateways.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = gateway.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Reference Binding " + gateway); } } return discoveredResources; }
From source file:org.switchyard.rhq.plugin.ReferenceDiscoveryComponent.java
/** * Discover existing resources./*w w w. j a va2 s. co m*/ * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ApplicationResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ApplicationResourceComponent parent = context.getParentResourceComponent(); final Map<String, Reference> references = parent.getReferences(); for (Reference reference : references.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = reference.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Reference " + reference); } return discoveredResources; }
From source file:org.switchyard.rhq.plugin.ServiceBindingDiscoveryComponent.java
/** * Discover existing resources.//from www .java 2 s. c o m * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ServiceResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ServiceResourceComponent parent = context.getParentResourceComponent(); final Map<String, Gateway> gateways = parent.getGateways(); if (gateways != null) { for (Gateway gateway : gateways.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = gateway.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Service Binding " + gateway); } } return discoveredResources; }
From source file:org.switchyard.rhq.plugin.ServiceDiscoveryComponent.java
/** * Discover existing resources.// www . ja v a2 s.c om * * @param context * The context for the current discovery component. * @return The discovered resources. */ @Override public Set<DiscoveredResourceDetails> discoverResources( final ResourceDiscoveryContext<ApplicationResourceComponent> context) { final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(); final ApplicationResourceComponent parent = context.getParentResourceComponent(); final Map<String, Service> services = parent.getServices(); for (Service service : services.values()) { final Configuration pluginConfig = context.getDefaultPluginConfiguration(); final QName name = service.getName(); final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), name.toString(), name.getLocalPart(), name.getNamespaceURI(), null, pluginConfig, null); discoveredResources.add(resource); LOG.debug("Discovered SwitchYard Service " + service); } return discoveredResources; }
From source file:org.unc.hive.services.rs.ConceptsResource.java
/** * Utility method to transform a map of String keys and QName values * into XML./*from w w w . j a va 2 s .c om*/ * * @param treeMap the map of String keys and QName values * @return xmlString the XML string */ public static String conceptTreeMapToXML(TreeMap<String, QName> treeMap) { String xmlString = ""; StringBuffer xmlStringBuffer = new StringBuffer(XML_DECLARATION); xmlStringBuffer.append("<concepts>\n"); for (String s : treeMap.keySet()) { QName qName = treeMap.get(s); if (qName != null) { xmlStringBuffer.append("<concept>\n"); xmlStringBuffer.append(" <prefLabel>" + s + "</prefLabel>\n"); xmlStringBuffer.append(" <QName>\n"); xmlStringBuffer.append(" <namespaceURI>" + qName.getNamespaceURI() + "</namespaceURI>\n"); xmlStringBuffer.append(" <prefix>" + qName.getPrefix() + "</prefix>\n"); xmlStringBuffer.append(" <localPart>" + qName.getLocalPart() + "</localPart>\n"); xmlStringBuffer.append(" <string>" + qName.toString() + "</string>\n"); xmlStringBuffer.append(" </QName>\n"); xmlStringBuffer.append("</concept>\n"); } } xmlStringBuffer.append("</concepts>"); xmlString = xmlStringBuffer.toString(); return xmlString; }
From source file:org.unc.hive.services.rs.ConceptsResource.java
/** * Utility method to transform a QName to XML. * //from w w w.j a va 2 s . com * @param qName the QName object to be transformed * @return xmlString the XML string */ public static String qNameToXML(QName qName) { String xmlString = ""; StringBuffer xmlStringBuffer = new StringBuffer(XML_DECLARATION); if (qName != null) { xmlStringBuffer.append(" <QName>\n"); xmlStringBuffer.append(" <namespaceURI>" + qName.getNamespaceURI() + "</namespaceURI>\n"); xmlStringBuffer.append(" <prefix>" + qName.getPrefix() + "</prefix>\n"); xmlStringBuffer.append(" <localPart>" + qName.getLocalPart() + "</localPart>\n"); xmlStringBuffer.append(" <string>" + qName.toString() + "</string>\n"); xmlStringBuffer.append(" </QName>"); xmlString = xmlStringBuffer.toString(); } return xmlString; }
From source file:org.wso2.bps.integration.common.clients.humantasks.HumanTaskPackageManagementClient.java
public TaskInfoType getTaskInfo(QName taskId) throws Exception { try {//from ww w. j a v a 2s .com return humanTaskPackageManagementStub.getTaskInfo(taskId); } catch (Exception e) { String errorMsg = "Unable to get task info task ID" + taskId.toString(); log.error(errorMsg, e); throw new Exception(errorMsg, e); } }
From source file:org.wso2.bps.samples.migration.MigrationExecutor.java
/** * Store extracted packages with version. * Change QName for current tasks appending with version * * @param archiveFile//from w w w .j a va 2 s .c om * @param tenantId * @throws Exception */ private static void migrateHumanTasks(File archiveFile, int tenantId) throws Exception { Connection conn = initializeDBConnection(); conn.setAutoCommit(false); String md5sum = HumanTaskStoreUtils.getMD5Checksum(archiveFile); String packageName = FilenameUtils.removeExtension(archiveFile.getName()); Long version = getNextVersion(); String deployPath = "repository" + File.separator + HumanTaskConstants.HUMANTASK_REPO_DIRECTORY + File.separator + tenantId + File.separator + packageName + "-" + version; //Create Human Task Deployment Unit HumanTaskDeploymentUnit humanTaskDU = createHumanTaskDeploymentUnit(archiveFile, tenantId, md5sum, version); try { long deploymentID = getNextDeploymentID(); Date date = new Date(); //Entry to HT_DEPLOYMENT_UNIT table conn.createStatement().execute(query.getINSERT_DEPLOYMENT_UNIT(deploymentID, md5sum, date, deployPath, packageName + "-" + version, packageName, tenantId, version)); TTask[] tasks = humanTaskDU.getTasks(); //Update QName of existing tasks. if (tasks != null) { for (TTask task : tasks) { QName taskQName = new QName(humanTaskDU.getNamespace(), task.getName()); conn.createStatement() .execute(query.getUPDATE_TASKS(taskQName.toString(), tenantId, packageName, version)); } } //Set Next Version setVersion(); conn.commit(); System.out.println(FilenameUtils.removeExtension(archiveFile.getName()) + "\t|\t" + version); } catch (Exception ex) { ex.printStackTrace(); conn.rollback(); throw new Exception(ex); } finally { if (conn != null) { conn.close(); } } }