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); } }
public static ApplicationClientDD parse(URL ddResource) throws JBossXBException, IOException { if (ddResource == null) return null; log.debug("found application-client.xml " + ddResource); ApplicationClientDDObjectFactory factory = new ApplicationClientDDObjectFactory(); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); ApplicationClientDD dd = (ApplicationClientDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); return dd; }
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 ); } }
unmarshaller.setSchemaValidation(isUseSchemaValidation()); unmarshaller.setValidation(isUseValidation()); InputStream is = file.openStream(); Object parsed = null; try parsed = unmarshaller.unmarshal(is, resolver); log.debug("Parsed file: "+file+" to: "+parsed);
unmarshaller.setValidation(useValidation); EarMetaData specMetaData = null; JBossAppMetaData appMetaData = null; try specMetaData = (EarMetaData) unmarshaller.unmarshal(in, resolver); try appMetaData = (JBossAppMetaData) unmarshaller.unmarshal(in, resolver);
@Override protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception { if (file == null) throw new IllegalArgumentException("Null file"); Unmarshaller unmarshaller = factory.newUnmarshaller(); unmarshaller.setSchemaValidation(isUseSchemaValidation()); unmarshaller.setValidation(isUseValidation()); Object parsed = null; try { ObjectModelFactory factory = getObjectModelFactory(root); URL url = file.toURL(); parsed = unmarshaller.unmarshal(url.toString(), factory, root); } catch (Throwable t) { DeploymentException.rethrowAsDeploymentException("Error parsing meta data " + file.getPathName(), t); } if (parsed == null) throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!"); return getOutput().cast(parsed); }
public void parse(URL loginConfigURL, ArrayList<String> configNames) throws Exception { LoginConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory(); UsersObjectModelFactory uomf = new UsersObjectModelFactory(); InputStreamReader xmlReader = loadURL(loginConfigURL); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule"); Object root = null; PolicyConfig config = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, root); Set<String> cnames = config.getConfigNames(); configNames.addAll(cnames); xmlConfig.copy(config); // Add the config to SecurityConfiguration for (String cname : cnames) { ApplicationPolicy ap = config.get(cname); SecurityConfiguration.addApplicationPolicy(ap); handleJASPIDelegation(ap); } }
/** * 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); }
public static ApplicationClientDD parse(URL ddResource) throws JBossXBException, IOException { if (ddResource == null) return null; log.debug("found application-client.xml " + ddResource); ApplicationClientDDObjectFactory factory = new ApplicationClientDDObjectFactory(); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); ApplicationClientDD dd = (ApplicationClientDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); return dd; }
KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null) throw new RuntimeException("The xml " + url + " is not well formed!");
public static EjbJarDD parse(URL ddResource) throws JBossXBException, IOException { ObjectModelFactory factory = null; Unmarshaller unmarshaller = null; EjbJarDD dd = null; if (ddResource != null) { log.debug("found ejb-jar.xml " + ddResource); factory = new EjbJarDDObjectFactory(); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); dd = (EjbJarDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); } return dd; }
KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null) throw new RuntimeException("The xml " + url + " is not well formed!");
public static EjbJarDD parse(URL ddResource) throws JBossXBException, IOException { ObjectModelFactory factory = null; Unmarshaller unmarshaller = null; EjbJarDD dd = null; if (ddResource != null) { log.debug("found ejb-jar.xml " + ddResource); factory = new EjbJarDDObjectFactory(); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); dd = (EjbJarDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); } return dd; }
KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null) throw new RuntimeException("The xml " + url + " is not well formed!");
public static ApplicationClientDD parse(URL ddResource, ApplicationClientDD dd) throws JBossXBException, IOException { // TODO: how to properly fix this if (dd == null) dd = new ApplicationClientDD(); if (ddResource == null) return dd; log.debug("found jboss-client.xml " + ddResource); JBossClientDDObjectFactory factory = new JBossClientDDObjectFactory(dd); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); dd = (ApplicationClientDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); return dd; }
KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null) throw new RuntimeException("The xml " + url + " is not well formed!");
public static ApplicationClientDD parse(URL ddResource, ApplicationClientDD dd) throws JBossXBException, IOException { // TODO: how to properly fix this if (dd == null) dd = new ApplicationClientDD(); if (ddResource == null) return dd; log.debug("found jboss-client.xml " + ddResource); JBossClientDDObjectFactory factory = new JBossClientDDObjectFactory(dd); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); dd = (ApplicationClientDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); return dd; }
KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver); if (deployment == null) throw new RuntimeException("The xml " + url + " is not well formed!");
public static EjbJarDD parse(URL ddResource, EjbJarDD dd) throws JBossXBException, IOException { ObjectModelFactory factory = null; Unmarshaller unmarshaller = null; if (ddResource != null) { log.debug("found jboss.xml " + ddResource); if (dd == null) dd = new EjbJarDD(); factory = new JBossDDObjectFactory(dd); UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setEntityResolver(new JBossEntityResolver()); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); dd = (EjbJarDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null); } return dd; }
/** * 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; } }