public W3CEndpointReference run() throws Exception { Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller(); try { return (W3CEndpointReference)unmarshaller.unmarshal(writer.getDocument()); } finally { JAXBUtils.closeUnmarshaller(unmarshaller); } } });
private void processHandlerElement(Element el, List<Handler> chain) { try { JAXBContext ctx = getContextForPortComponentHandlerType(); PortComponentHandlerType pt = JAXBUtils.unmarshall(ctx, el, PortComponentHandlerType.class).getValue(); chain.addAll(buildHandlerChain(pt, classLoader)); } catch (JAXBException e) { throw new IllegalArgumentException("Could not unmarshal handler chain", e); } }
private synchronized JAXBContext getContext() throws JAXBException { if (context == null || classes == null) { CachedContextAndSchemas ccs = JAXBContextCache.getCachedContextAndSchemas(type); classes = ccs.getClasses(); context = ccs.getContext(); } return context; }
private synchronized JAXBContext getJAXBContext() { if (jaxbContext == null) { try { jaxbContext = JAXBContextCache.getCachedContextAndSchemas(ObjectFactory.class).getContext(); } catch (JAXBException e) { throw new RuntimeException(e); } } return jaxbContext; } private synchronized ServiceImpl getService() {
public static SchemaCompiler createSchemaCompilerWithDefaultAllocator(Set<String> allocatorSet) { try { SchemaCompiler compiler = JAXBUtils.createSchemaCompiler(); Object allocator = ReflectionInvokationHandler .createProxyWrapper(new DefaultClassNameAllocator(allocatorSet), JAXBUtils.getParamClass(compiler, "setClassNameAllocator")); compiler.setClassNameAllocator(allocator); return compiler; } catch (JAXBException e1) { throw new IllegalStateException("Unable to create schema compiler", e1); } }
protected SchemaCompiler createSchemaCompiler() { SchemaCompiler compiler = JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>()); if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) { compiler.getOptions().parseArguments(schemaCompilerOptions); } return compiler; }
String methodName = JAXBUtils.nameToIdentifier(name, JAXBUtils.IdentifierType.GETTER); MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, methodName, "()" + classCode, fieldDescriptor == null ? null : "()" + fieldDescriptor, mv.visitEnd(); methodName = JAXBUtils.nameToIdentifier(name, JAXBUtils.IdentifierType.SETTER); mv = cw.visitMethod(Opcodes.ACC_PUBLIC, methodName, "(" + classCode + ")V", fieldDescriptor == null ? null : "(" + fieldDescriptor + ")V", null);
private synchronized JAXBContext getContext() throws JAXBException { if (context == null || classes == null) { CachedContextAndSchemas ccs = JAXBContextCache.getCachedContextAndSchemas(type); classes = ccs.getClasses(); context = ccs.getContext(); } return context; }
WSDiscoveryProvider() { try { context = JAXBContextCache.getCachedContextAndSchemas(ObjectFactory.class).getContext(); } catch (JAXBException e) { e.printStackTrace(); } }
public static SchemaCompiler createSchemaCompilerWithDefaultAllocator(Set<String> allocatorSet) { try { SchemaCompiler compiler = JAXBUtils.createSchemaCompiler(); Object allocator = ReflectionInvokationHandler .createProxyWrapper(new DefaultClassNameAllocator(allocatorSet), JAXBUtils.getParamClass(compiler, "setClassNameAllocator")); compiler.setClassNameAllocator(allocator); return compiler; } catch (JAXBException e1) { throw new IllegalStateException("Unable to create schema compiler", e1); } }
protected SchemaCompiler createSchemaCompiler() { SchemaCompiler compiler = JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<String>()); if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) { compiler.getOptions().parseArguments(schemaCompilerOptions); } return compiler; }
public EndpointReference run() throws Exception { Unmarshaller unmarshaller = null; try { unmarshaller = getJAXBContext().createUnmarshaller(); return (EndpointReference)unmarshaller.unmarshal(reader); } finally { try { StaxUtils.close(reader); } catch (XMLStreamException e) { // Ignore } JAXBUtils.closeUnmarshaller(unmarshaller); } } });
public Object getPayload(JAXBContext arg0) { try { Source s = getPayload(); if (s instanceof DOMSource) { DOMSource ds = (DOMSource)s; ds.setNode(org.apache.cxf.helpers.DOMUtils.getDomElement(ds.getNode())); Node parent = ds.getNode().getParentNode(); Node next = ds.getNode().getNextSibling(); if (parent instanceof DocumentFragment) { parent.removeChild(ds.getNode()); } try { return JAXBUtils.unmarshall(arg0, ds); } finally { if (parent instanceof DocumentFragment) { parent.insertBefore(ds.getNode(), next); } } } return JAXBUtils.unmarshall(arg0, getPayload()); } catch (JAXBException e) { throw new WebServiceException(e); } }
private synchronized JAXBContext getContext() throws JAXBException { if (context == null || classes == null) { CachedContextAndSchemas ccs = JAXBContextCache.getCachedContextAndSchemas(data.getClass()); classes = ccs.getClasses(); context = ccs.getContext(); } return context; }
WSDiscoveryProvider() { try { context = JAXBContextCache.getCachedContextAndSchemas(ObjectFactory.class).getContext(); } catch (JAXBException e) { e.printStackTrace(); } }
protected SchemaCompiler createSchemaCompiler() { SchemaCompiler compiler = JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>()); if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) { compiler.getOptions().parseArguments(schemaCompilerOptions); } return compiler; }
/** * Convert from EndpointReference to CXF internal 2005/08 EndpointReferenceType * * @param external the javax.xml.ws.EndpointReference * @return CXF internal 2005/08 EndpointReferenceType */ public static EndpointReferenceType convertToInternal(EndpointReference external) { if (external instanceof W3CEndpointReference) { Unmarshaller um = null; try { DocumentFragment frag = DOMUtils.getEmptyDocument().createDocumentFragment(); DOMResult result = new DOMResult(frag); external.writeTo(result); W3CDOMStreamReader reader = new W3CDOMStreamReader(frag); // CXF internal 2005/08 EndpointReferenceType should be // compatible with W3CEndpointReference //jaxContext = ContextUtils.getJAXBContext(); JAXBContext context = JAXBContext .newInstance(new Class[] {org.apache.cxf.ws.addressing.ObjectFactory.class}); um = context.createUnmarshaller(); return um.unmarshal(reader, EndpointReferenceType.class).getValue(); } catch (JAXBException e) { throw new IllegalArgumentException("Could not unmarshal EndpointReference", e); } finally { JAXBUtils.closeUnmarshaller(um); } } return null; }
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
private synchronized JAXBContext getContext() throws JAXBException { if (context == null || classes == null) { CachedContextAndSchemas ccs = JAXBContextCache.getCachedContextAndSchemas(data.getClass()); classes = ccs.getClasses(); context = ccs.getContext(); } return context; }
protected SchemaCompiler createSchemaCompiler() { SchemaCompiler compiler = JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<String>()); if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) { compiler.getOptions().parseArguments(schemaCompilerOptions); } return compiler; }