List of usage examples for javax.xml.namespace QName toString
public String toString()
From source file:org.kuali.rice.ksb.messaging.dao.impl.MessageQueueDAOOjbImpl.java
@SuppressWarnings("unchecked") public List<PersistedMessageBO> findByServiceName(QName serviceName, String methodName) { if (LOG.isDebugEnabled()) { LOG.debug("Finding messages for service name " + serviceName); }// ww w . jav a 2s .c o m Criteria crit = new Criteria(); crit.addEqualTo("serviceName", serviceName.toString()); crit.addEqualTo("methodName", methodName); return (List<PersistedMessageBO>) getPersistenceBrokerTemplate() .getCollectionByQuery(new QueryByCriteria(PersistedMessageBO.class, crit)); }
From source file:org.kuali.student.common.test.resourceloader.SimpleSpringResourceLoader.java
public Object getService(QName qname) { if (qname == null || StringUtils.isEmpty(qname.toString())) { throw new IllegalArgumentException("The service name must be non-null."); }/*from w ww. ja va2s. com*/ String qualifiedServiceName = qname.toString(); if (CoreApiServiceLocator.KUALI_CONFIGURATION_SERVICE.equals(qualifiedServiceName)) { return configurationService; } else if (KRADServiceLocatorWeb.KUALI_MODULE_SERVICE.equals(qualifiedServiceName)) { return kualiModuleService; } else if (KRADServiceLocatorWeb.DATA_DICTIONARY_SERVICE.equals(qualifiedServiceName)) { return dataDictionaryService; } else if (KRADServiceLocator.KD_PROVIDER_REGISTRY.equals(qualifiedServiceName)) { return providerRegistry; } else if (KRADServiceLocatorWeb.UIF_DEFAULTING_SERVICE.equals(qualifiedServiceName)) { return uifDefaultingService; } else if (KRADServiceLocatorWeb.EXPRESSION_EVALUATOR_FACTORY.equals(qualifiedServiceName)) { return expressionEvaluatorFactory; } else if ("{http://rice.kuali.org/kim/v2_0}identityService".equals(qualifiedServiceName)) { return identityService; } else if ("{http://rice.kuali.org/kim/v2_0}roleService".equals(qualifiedServiceName)) { return roleService; } else { String localBeanName = qname.getLocalPart(); return applicationContext.getBean(localBeanName); } }
From source file:org.kuali.student.r2.common.datadictionary.util.TestBaseValidCharsDictionary.java
public Object getService(QName qname) { if (qname == null || StringUtils.isEmpty(qname.toString())) { throw new IllegalArgumentException("The service name must be non-null."); }/*from ww w. ja v a 2 s. c o m*/ String localServiceName = qname.toString(); if (CoreApiServiceLocator.KUALI_CONFIGURATION_SERVICE.equals(localServiceName)) { return configurationService; } else if (KRADServiceLocatorWeb.KUALI_MODULE_SERVICE.equals(localServiceName)) { return kualiModuleService; } else if (KRADServiceLocatorWeb.MESSAGE_SERVICE.equals(localServiceName)) { return messageService; } else { return null; } }
From source file:org.lockss.plugin.clockss.XPathXmlMetadataParser.java
private ArticleMetadata extractDataFromNode(Object startNode, XPathInfo[] xPathList) throws XPathExpressionException { ArticleMetadata returnAM = makeNewArticleMetadata(); NumberFormat format = NumberFormat.getInstance(); for (int i = 0; i < xPathList.length; i++) { log.debug3("evaluate xpath: " + xPathList[i].xKey.toString()); QName definedType = xPathList[i].xVal.getType(); Object itemResult = xPathList[i].xExpr.evaluate(startNode, XPathConstants.NODESET); NodeList resultNodeList = (NodeList) itemResult; log.debug3(resultNodeList.getLength() + " results for this xKey"); for (int p = 0; p < resultNodeList.getLength(); p++) { Node resultNode = resultNodeList.item(p); if (resultNode == null) { continue; }/*w ww . j ava2 s. c o m*/ String value = null; if (definedType == XPathConstants.NODE) { // filter node value = xPathList[i].xVal.getValue(resultNode); } else if (definedType == XPathConstants.STRING) { // filter node text content String text = resultNode.getTextContent(); if (!StringUtil.isNullString(text)) { value = xPathList[i].xVal.getValue(text); } } else if (definedType == XPathConstants.BOOLEAN) { // filter boolean value of node text content String text = resultNode.getTextContent(); if (!StringUtil.isNullString(text)) { value = xPathList[i].xVal.getValue(Boolean.parseBoolean(text)); } } else if (definedType == XPathConstants.NUMBER) { // filter number value of node text content try { String text = resultNode.getTextContent(); if (!StringUtil.isNullString(text)) { value = xPathList[i].xVal.getValue(format.parse(text)); } } catch (ParseException ex) { // ignore invalid number log.debug3("ignore invalid number", ex); } } else { log.debug("Unknown nodeValue type: " + definedType.toString()); } if (!StringUtil.isNullString(value)) { log.debug3(" returning (" + xPathList[i].xKey + ", " + value); returnAM.putRaw(xPathList[i].xKey, value); } } } return returnAM; }
From source file:org.maodian.flyingcat.xmpp.codec.AbstractCodec.java
protected Decoder findDecoder(QName key, Stanzas stanzas) { Decoder decoder = applicationContext.getDecoder(key); //TODO: here we should distinguish service_unavailable and feature_not_implemented if (decoder == null) { throw new XmppException("Cant find Decoder for:" + key.toString(), new StanzaError(stanzas, StanzaErrorCondition.SERVICE_UNAVAILABLE, Type.CANCEL)); }/*ww w .j a v a 2 s . c o m*/ return decoder; }
From source file:org.modeldriven.fuml.xmi.stream.StreamContext.java
private void loadNamespaces(XMLEvent root) { List<Namespace> list = new ArrayList<Namespace>(); Iterator<Namespace> namespaceIter = root.asStartElement().getNamespaces(); while (namespaceIter.hasNext()) { Namespace namespace = namespaceIter.next(); list.add(namespace);//from w w w .ja va 2s . com QName name = namespace.getName(); if (log.isDebugEnabled()) log.debug("root namespace: " + name.toString()); String uri = namespace.getValue(); if (!XmiConstants.NAMESPACE_PREFIX.equals(name.getPrefix())) continue; //not a namespace namespaceLocalNameMap.put(name.getLocalPart(), namespace); namespaceURIMap.put(namespace.getNamespaceURI(), namespace); NamespaceDomain domain = FumlConfiguration.getInstance().findNamespaceDomain(uri); if (domain == null) { log.debug("could not find domain for namespace '" + uri + "' - mapping only by local name"); continue; } Namespace existing = this.namespaceDomainMap.get(domain); if (existing != null) throw new XmiException("multiple " + domain.value() + " namespaces (" + existing.getNamespaceURI() + ", " + namespace.getNamespaceURI() + ")"); this.namespaceDomainMap.put(domain, namespace); } // while() if (getXmiNamespace() == null) { throw new XmiException(createNamespaceMessge(NamespaceDomain.XMI)); } if (getUmlNamespace() == null) { throw new XmiException(createNamespaceMessge(NamespaceDomain.UML)); } namespaces = new Namespace[list.size()]; list.toArray(namespaces); }
From source file:org.nuxeo.apidoc.introspection.XMLWriter.java
public String resolve(QName name) { String prefix = null;//from w w w. j a va2 s . c o m String uri = name.getNamespaceURI(); if (element != null) { prefix = element.getXmlNs(uri); if (prefix == null) { prefix = getXmlNs(uri); } } else { prefix = getXmlNs(uri); } if (prefix == null) { return name.toString(); } if (prefix.length() == 0) { return name.getLocalPart(); } return prefix + ":" + name.getLocalPart(); }
From source file:org.overlord.sramp.shell.ShellCommandFactory.java
/** * Gets the available commands, ordered by command {@link QName}. *//* www. ja v a 2 s.c o m*/ private Map<QName, Class<? extends ShellCommand>> getCommands() { TreeMap<QName, Class<? extends ShellCommand>> treeMap = new TreeMap<QName, Class<? extends ShellCommand>>( new Comparator<QName>() { @Override public int compare(QName name1, QName name2) { return name1.toString().compareTo(name2.toString()); } }); treeMap.putAll(this.registry); return treeMap; }
From source file:org.ow2.petals.binding.soap.SoapComponentContext.java
/** * <p>/*w ww .j a va 2 s . co m*/ * Get a service client associated to an axis service set with the good * operation. It is taken from a pool object. * </p> * <p> * <b>This service client must be returned to the pool after usage using * API: * <code>{@link #returnServiceClient(String, QName, URI, ServiceClient)}</code> * .</b> * </p> * * @param address * the address of the service, mainly used as key to retrieve the * associated SU. * @param operation * the target operation QName. Non null * @param mep * the message exchange pattern used. Non null * @param cdkExtensions * SU extensions used by the service client pool when the * creation of a service client is needed * @param provides * the provides block of the endpoint which is creating the * external WS call * @param ramprtUserName * @return a ServiceClient. Not null. Must be returned to the pool after * usage using API: * <code>{@link #returnServiceClient(String, QName, URI, ServiceClient)}</code> * @throws HandlingException */ public ServiceClient borrowServiceClient(final String address, final QName operation, final String soapAction, final URI mep, final ConfigurationExtensions cdkExtensions, final Provides provides, String rampartUserName) throws MessagingException { try { String resolvedOp; if (operation != null) { resolvedOp = operation.toString(); } else if (soapAction != null) { resolvedOp = soapAction; } else { throw new MessagingException( "Unable to resolve the operation. Set it in the Jbi exchange or SoapAction."); } final ServiceClientKey key = new ServiceClientKey(address, resolvedOp, mep); ObjectPool pool = this.serviceClientPools.get(key); if (pool == null) { // TODO: The pool max size should be limited by the JBI worker // number pool = new GenericObjectPool( // object factory new ServiceClientPoolObjectFactory(address, operation, mep, cdkExtensions, this, provides, this.logger, soapAction, rampartUserName), // max number of borrowed object sized to the number of // JBI message processors this.componentConfiguration.getProcessorPoolSize().getValue(), // getting an object blocks until a new or idle object // is available GenericObjectPool.WHEN_EXHAUSTED_BLOCK, // if getting an object is blocked for at most this // delay, a NoSuchElementException will be thrown. In // case of a synchronous call the delay is sized to the // value of the SU's parameter "synchronous-timeout", // otherwise it sized to 5 minutes. MEPConstants.IN_OUT_PATTERN.equals(mep) || MEPConstants.IN_OPTIONAL_OUT_PATTERN.equals(mep) ? SUPropertiesHelper.retrieveTimeout(cdkExtensions) : 300000l, // max number of idle object in the pool. Sized to the // number of JBI acceptors. this.componentConfiguration.getAcceptorPoolSize().getValue(), // min number of idle object in the pool. Sized to 0 // (ie when no activity no object in pool) GenericObjectPool.DEFAULT_MIN_IDLE, // no validation test of the borrowed object false, // no validation test of the returned object false, // how long the eviction thread should sleep before // "runs" of examining idle objects. Sized to 5min. 300000l, // the number of objects examined in each run of the // idle object evictor. Size to the default value (ie. // 3) GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN, // the minimum amount of time that an object may sit // idle in the pool before it is eligible for eviction // due to idle time. Sized to 30min GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, // no validation test of the idle object false, // the minimum amount of time an object may sit idle in // the pool before it is eligible for eviction by the // idle object evictor (if any), with the extra // condition that at least "minIdle" amount of object // remain in the pool. GenericObjectPool.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS, // the pool returns idle objects in last-in-first-out // order true); this.serviceClientPools.put(key, pool); } return (ServiceClient) pool.borrowObject(); } catch (final Exception e) { throw new MessagingException("Can't create get an Axis service client from the pool", e); } }
From source file:org.ow2.petals.binding.soap.SoapComponentContext.java
/** * Release the service client to the pool * /*from w w w . j a v a 2 s.c o m*/ * @param address * @param operation * @param mep * @param serviceClient * @throws MessagingException */ public void returnServiceClient(final String address, final QName operation, final URI mep, final ServiceClient serviceClient, final String soapAction) throws MessagingException { try { String resolvedOp = null; if (operation != null) { resolvedOp = operation.toString(); } else if (soapAction != null) { resolvedOp = soapAction; } else { throw new MessagingException( "Unable to resolve the operation. Set it in the Jbi exchange or SoapAction."); } ObjectPool pool = this.serviceClientPools.get(new ServiceClientKey(address, resolvedOp, mep)); if (pool != null) { pool.returnObject(serviceClient); } } catch (final Exception e) { throw new MessagingException("Can't return the Axis service client to the pool", e); } }