List of usage examples for javax.xml.namespace QName valueOf
public static QName valueOf(String qNameAsString)
From source file:org.apache.cxf.ws.security.sts.provider.operation.IssueDelegateTest.java
@Test public void testIssueDelegateWithInvalidCert2() throws CertificateException { IssueDelegate id = new IssueDelegate(); assertNotNull(id);/*from ww w . ja va 2s . c o m*/ CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); X509Certificate x509Certificate = (X509Certificate) certificateFactory .generateCertificate(new ByteArrayInputStream(Base64.decodeBase64(CERT_DATA.getBytes()))); JAXBElement<X509Certificate> jX509Certificate = new JAXBElement<X509Certificate>( QName.valueOf("X509Certificate"), X509Certificate.class, x509Certificate); // JAXBElement<byte[]> jX509Certificate = new // JAXBElement<byte[]>(QName.valueOf("X509Certificate"), byte[].class, // CERT_DATA.getBytes()); X509DataType x509DataType = new X509DataType(); x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(jX509Certificate); JAXBElement<X509DataType> jX509DataType = new JAXBElement<X509DataType>(QName.valueOf("X509Data"), X509DataType.class, x509DataType); KeyInfoType keyInfoType = new KeyInfoType(); keyInfoType.getContent().add(jX509DataType); JAXBElement<KeyInfoType> jKeyInfoType = new JAXBElement<KeyInfoType>(QName.valueOf("KeyInfo"), KeyInfoType.class, keyInfoType); UseKeyType useKeyType = new UseKeyType(); useKeyType.setAny(jKeyInfoType); JAXBElement<UseKeyType> jUseKeyType = new JAXBElement<UseKeyType>(QName.valueOf("UseKey"), UseKeyType.class, useKeyType); EasyMock.expect(requestMock.getAny()).andStubReturn(Arrays.asList((Object) jUseKeyType)); EasyMock.replay(requestMock); EasyMock.expect(passwordCallbackMock.resetUsername()).andReturn(null); EasyMock.expect(passwordCallbackMock.resetPassword()).andReturn("joespassword"); EasyMock.replay(passwordCallbackMock); TokenProvider tp1 = new Saml1TokenProvider(); TokenProvider tp2 = new Saml2TokenProvider(); id.setTokenProviders(Arrays.asList(tp1, tp2)); id.setPasswordCallback(passwordCallbackMock); try { id.issue(requestMock); fail("CertificateException should be thrown"); } catch (Exception e) { } verify(requestMock); }
From source file:org.apache.hise.dao.Task.java
public QName getTaskDefinitionName() { return QName.valueOf(getTaskDefinitionKey()); }
From source file:org.apache.hise.runtime.TaskEvaluator.java
public XQueryEvaluator buildQueryEvaluator() { XQueryEvaluator evaluator = new XQueryEvaluator(); evaluator.setContextObject(this); evaluator.declareNamespace("htd", "http://www.example.org/WS-HT"); evaluator.declareJavaClass("http://www.example.org/WS-HT", HtdFunctions.class); evaluator.bindVariable(QName.valueOf("taskId"), task.getTaskDto().getId()); evaluator.bindVariable(QName.valueOf("currentEventDateTime"), task.getCurrentEventDateTime()); return evaluator; }
From source file:org.apache.hise.runtime.TaskEvaluator.java
public Set<TaskOrgEntity> evaluateGenericHumanRole(TGenericHumanRole role, GenericHumanRole assignmentRole) { Set<TaskOrgEntity> result = new HashSet<TaskOrgEntity>(); TFrom f = role.getFrom();/*w ww.jav a 2 s .c om*/ if (f.getLogicalPeopleGroup() != null) { throw new NotImplementedException(); } else { Element e = DOMUtils.findElement(QName.valueOf("{http://www.example.org/WS-HT}literal"), f.getContent()); if (e != null) { for (String user : (List<String>) buildQueryEvaluator().evaluateExpression( "declare namespace htd='http://www.example.org/WS-HT'; for $i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", e)) { TaskOrgEntity x = new TaskOrgEntity(); x.setGenericHumanRole(assignmentRole); x.setName(user); x.setType(OrgEntityType.USER); x.setTask(task.getTaskDto()); result.add(x); } for (String group : (List<String>) buildQueryEvaluator().evaluateExpression( "declare namespace htd='http://www.example.org/WS-HT'; for $i in htd:literal/htd:organizationalEntity/htd:groups/htd:group return string($i)", e)) { TaskOrgEntity x = new TaskOrgEntity(); x.setGenericHumanRole(assignmentRole); x.setName(group); x.setType(OrgEntityType.GROUP); x.setTask(task.getTaskDto()); result.add(x); } } } return result; }
From source file:org.apache.hise.runtime.TaskEvaluator.java
public Node evaluateOutcome(boolean outcome) { XQueryEvaluator evaluator = buildQueryEvaluator(); evaluator.bindVariable(QName.valueOf("outcome"), outcome); return (Node) evaluator.evaluateExpression(task.getTaskDefinition().getOutcomeExpression(), null).get(0); }
From source file:org.apache.hise.runtime.TaskEvaluator.java
public XQueryEvaluator buildPresentationEvaluator() { XQueryEvaluator evaluator = buildQueryEvaluator(); for (TPresentationParameter p : task.getTaskDefinition().getPresentationParameters()) { XQueryEvaluator evaluator2 = buildQueryEvaluator(); List eavaluationResult = evaluator2.evaluateExpression(XmlUtils.getStringContent(p.getContent()), null); Object v = null;//from www. j av a2s.c om if (!eavaluationResult.isEmpty()) { v = eavaluationResult.get(0); } else { v = "ERROR"; __log.warn("Could not evaluate presentationParameter: " + p.getName()); } __log.debug("evaluated presentationParameter: " + p.getName() + " = " + v); evaluator.bindVariable(QName.valueOf(p.getName()), v); } return evaluator; }
From source file:org.apache.myfaces.trinidadbuild.plugin.faces.parse.converters.QNameConverter.java
public Object convert(Class type, Object value) { if (value == null) throw new ConversionException("Missing value"); if (value instanceof QName) return value; try {/*www .j a v a 2 s .c om*/ return QName.valueOf(value.toString()); } catch (Exception e) { throw new ConversionException(e); } }
From source file:org.apache.ode.bpel.compiler.BpelCompiler.java
public OScope.Variable resolveVariable(String varName) { for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) { OScope.Variable var = i.next().getLocalVariable(varName); if (var != null) return var; }/* ww w .j av a 2 s . c om*/ // A "real" variable couldn't be found, checking if we're dealing with a // process custom property if (_customProcessProperties != null && _customProcessProperties.get(QName.valueOf(varName)) != null) { } throw new CompilationException(__cmsgs.errUndeclaredVariable(varName)); }
From source file:org.apache.ode.bpel.compiler.BpelCompiler.java
private OProcess.OPropertyAlias compile(PropertyAlias src) { OProcess.OProperty property = resolveProperty(src.getPropertyName()); OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess); alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for " + src.getMessageType()); if (src.getMessageType() == null) { throw new CompilationException( __cmsgs.errAliasUndeclaredMessage(src.getPropertyName(), src.getQuery().getPath())); }//from www . j a va 2s. c o m OMessageVarType messageType = resolveMessageType(src.getMessageType()); OVarType rootNodeType = messageType; alias.varType = messageType; // bpel 2.0 excludes declaration of part; // bpel 1.1 requires it if (src.getPart() != null) { alias.part = messageType.parts.get(src.getPart()); if (alias.part == null) throw new CompilationException( __cmsgs.errUnknownPartInAlias(src.getPart(), messageType.messageType.toString())); rootNodeType = alias.part.type; } else if (src.getHeader() != null) { alias.header = src.getHeader(); rootNodeType = new OElementVarType(_oprocess, QName.valueOf("{http://www.w3.org/2001/XMLSchema}any")); } if (src.getQuery() != null) alias.location = compileExpr(src.getQuery(), rootNodeType, null, new Object[1]); property.aliases.add(alias); alias.debugInfo = createDebugInfo(_processDef, src.getMessageType() + " --> " + src.getPropertyName()); return alias; }
From source file:org.apache.ode.bpel.elang.xpath20.runtime.XsdTypesTest.java
public void testDateTime() throws Exception { XPathFactoryImpl xpf = new XPathFactoryImpl(); JaxpVariableResolver jvr = new JaxpVariableResolver(null, null, xpf.getConfiguration()); Object o = jvr.getSimpleContent( DOMUtils.stringToDOM(/* w w w .jav a2 s.co m*/ "<temporary-simple-type-wrapper>2010-01-25T15:38:54.82Z</temporary-simple-type-wrapper>"), QName.valueOf("{http://www.w3.org/2001/XMLSchema}dateTime")); __log.debug(o); assertTrue(o.toString().contains("2010-01-25T15:38:54.82Z")); }