/** * Unmarshal the handler-chains xml file. * * @param in the input stream of the file * @return ServiceReferenceHandlerChainsMetaData * @throws JBossXBException */ protected ServiceReferenceHandlerChainsMetaData unmarshall(InputStream in) throws JBossXBException { if(in == null) throw new IllegalArgumentException("InputStream may not be null."); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); return (ServiceReferenceHandlerChainsMetaData) unmarshaller.unmarshal(in, resolver); }
private void parseJSFUnitWebMetaData() { // Parse JSFUnit web.xml Unmarshaller unmarshaller = factory.newUnmarshaller(); URL webXml = this.getClass().getClassLoader().getResource("META-INF/web.xml"); if (webXml == null) throw new IllegalStateException("Unable to find jsfunit web.xml"); SchemaBinding schema = JBossXBBuilder.build(Web25MetaData.class); try { this.jsfunitWebMD = (Web25MetaData) unmarshaller.unmarshal(webXml.toString(), schema); } catch (JBossXBException e) { this.disabled = true; log.error("Unable to parse jsfunit web.xml", e); } }
Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null)
/** * Parse bootstrap metadata from the given url * * @param url the url * @return the bootstrap metadata */ public static BootstrapMetaData parse(URL url) { if (url == null) throw new IllegalArgumentException("Null url"); UnmarshallerFactory factory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = factory.newUnmarshaller(); try { BootstrapMetaData result = (BootstrapMetaData) unmarshaller.unmarshal(url.toString(), new BootstrapSchemaBinding()); if (result == null) throw new IllegalStateException("The bootsrap xml " + url + " is not well formed"); return result; } catch (Exception e) { throw new RuntimeException("Error unmarshalling " + url, e); } } }
Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null)
/** * Parse bootstrap metadata from the given url * * @param url the url * @return the bootstrap metadata */ public static BootstrapMetaData parse(URL url) { if (url == null) throw new IllegalArgumentException("Null url"); UnmarshallerFactory factory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = factory.newUnmarshaller(); try { BootstrapMetaData result = (BootstrapMetaData) unmarshaller.unmarshal(url.toString(), new BootstrapSchemaBinding()); if (result == null) throw new IllegalStateException("The bootsrap xml " + url + " is not well formed"); return result; } catch (Exception e) { throw new RuntimeException("Error unmarshalling " + url, e); } } }
Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null)
/** * <p> * Creates and return an {@code ACLConfiguration} object using the specified input stream to read the ACL * configuration file. * </p> * * @param aclConfigFileStream an {@code InputStream} that reads the contents of the ACL configuration file. * @return the constructed {@code ACLConfiguration} object that contains the configured ACLs. */ public static ACLConfiguration getConfiguration(InputStream aclConfigFileStream) { ClassLoader tcl = Thread.currentThread().getContextClassLoader(); SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaName), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); try { ACLConfiguration configuration = (ACLConfiguration) unmarshaller.unmarshal(aclConfigFileStream, schema); return configuration; } catch (JBossXBException e) { log.debug("Error parsing ACL configuration file", e); throw new RuntimeException(e); } } }
Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null)
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null)
public Object getValue(ServiceValueContext valueContext) throws Exception { // Get the attribute element content in a parsable form StringBuffer buffer = ServiceConfigurator.getElementContent(getElement()); Thread current = Thread.currentThread(); ClassLoader oldTcl = current.getContextClassLoader(); ClassLoader cl = valueContext.getClassloader(); if (cl != null) current.setContextClassLoader(cl); try { // Parse the attribute element content SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); StringReader reader = new StringReader(buffer.toString()); return unmarshaller.unmarshal(reader, resolver); } finally { if (cl != null) current.setContextClassLoader(oldTcl); } } }
/** * Deploy a stream. We may be deploying XML fragments. * * @param deploymentName the deployment name * @param stream the stream * @return the kernel deployment * @throws Throwable for any error */ public KernelDeployment deploy(String deploymentName, final InputStream stream) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Parsing " + deploymentName); Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(stream, resolver); if (deployment == null) throw new RuntimeException("The deployment " + deploymentName + " is not well formed!"); deployment.setName(deploymentName); deploy(deployment); return deployment; } }
public Object getValue(ServiceValueContext valueContext) throws Exception { // Get the attribute element content in a parsable form StringBuffer buffer = ServiceConfigurator.getElementContent(getElement()); Thread current = Thread.currentThread(); ClassLoader oldTcl = current.getContextClassLoader(); ClassLoader cl = valueContext.getClassloader(); if (cl != null) current.setContextClassLoader(cl); try { // Parse the attribute element content SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); StringReader reader = new StringReader(buffer.toString()); Object bean = unmarshaller.unmarshal(reader, resolver); return bean; } finally { if (cl != null) current.setContextClassLoader(oldTcl); } } }
/** * Deploy a stream. We may be deploying XML fragments. * * @param deploymentName the deployment name * @param stream the stream * @return the kernel deployment * @throws Throwable for any error */ public KernelDeployment deploy(String deploymentName, final InputStream stream) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Parsing " + deploymentName); Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(stream, resolver); if (deployment == null) throw new RuntimeException("The deployment " + deploymentName + " is not well formed!"); deployment.setName(deploymentName); deploy(deployment); return deployment; }
/** Unmrashall the webservices.xml if there is one */ protected WebservicesMetaData getWebservicesMetaData(DeploymentInfo unit, String wsFile) { WebservicesMetaData wsMetaData = (WebservicesMetaData)unit.context.get(WebservicesMetaData.class); UnifiedVirtualFile vfWebservices = getWebservicesFile(unit, wsFile); if (wsMetaData == null && vfWebservices != null) { try { URL wsURL = vfWebservices.toURL(); Element root = DOMUtils.parse(wsURL.openStream()); String namespaceURI = root.getNamespaceURI(); if (namespaceURI.equals("http://java.sun.com/xml/ns/j2ee")) { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); ObjectModelFactory factory = new WebservicesFactory(wsURL); wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null); unit.context.put(WebservicesMetaData.class, wsMetaData); } } catch (Exception ex) { throw new WSFDeploymentException(ex); } } return wsMetaData; }
/** * Deploy a stream. We may be deploying XML fragments. * * @param deploymentName the deployment name * @param stream the stream * @return the kernel deployment * @throws Throwable for any error */ public KernelDeployment deploy(String deploymentName, final InputStream stream) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Parsing " + deploymentName); Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(stream, resolver); if (deployment == null) throw new RuntimeException("The deployment " + deploymentName + " is not well formed!"); deployment.setName(deploymentName); deploy(deployment); return deployment; }
public static final XsdAnnotation unmarshal(String annotation) { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.mapFactoryToNamespace(JaxbObjectModelFactory.INSTANCE, Constants.NS_JAXB); unmarshaller.mapFactoryToNamespace(JbxbObjectModelFactory.INSTANCE, Constants.NS_JBXB); try { return (XsdAnnotation)unmarshaller.unmarshal(new StringReader(annotation), XsdObjectModelFactory.INSTANCE, (Object)null ); } catch(JBossXBException e) { throw new JBossXBRuntimeException("Failed to parse annotation string: " + annotation + ": " + e.getMessage(), e ); } }
/** * Deploy a stream. We may be deploying XML fragments. * * @param deploymentName the deployment name * @param stream the stream * @return the kernel deployment * @throws Throwable for any error */ public KernelDeployment deploy(String deploymentName, final InputStream stream) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Parsing " + deploymentName); Unmarshaller unmarshaller = factory.newUnmarshaller(); KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(stream, resolver); if (deployment == null) throw new RuntimeException("The deployment " + deploymentName + " is not well formed!"); deployment.setName(deploymentName); deploy(deployment); return deployment; }
/** Unmrashall the webservices.xml if there is one */ protected WebservicesMetaData getWebservicesMetaData(DeploymentInfo unit, String wsFile) { WebservicesMetaData wsMetaData = (WebservicesMetaData)unit.context.get(WebservicesMetaData.class); UnifiedVirtualFile vfWebservices = getWebservicesFile(unit, wsFile); if (wsMetaData == null && vfWebservices != null) { try { URL wsURL = vfWebservices.toURL(); Element root = DOMUtils.parse(wsURL.openStream()); String namespaceURI = root.getNamespaceURI(); if (namespaceURI.equals("http://java.sun.com/xml/ns/j2ee")) { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); ObjectModelFactory factory = new WebservicesFactory(wsURL); wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null); unit.context.put(WebservicesMetaData.class, wsMetaData); } } catch (Exception ex) { throw new WSFDeploymentException(ex); } } return wsMetaData; }