@Override public synchronized DocumentBuilderFactory getDocumentBuilderFactory() { this.documentBuilderFactory = newDocumentBuilderFactory(); this.documentBuilderFactory.setNamespaceAware(true); this.documentBuilderFactory.setValidating(true); // ignore white space can only be set if parser is validating this.documentBuilderFactory.setIgnoringElementContentWhitespace(true); // select xml schema as the schema language (a.o.t. DTD) this.documentBuilderFactory.setAttribute( "http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); // set schema sources final URL url = BonitaEnvironmentParser.class.getClassLoader().getResource("bonita-environment.xsd"); if (url == null) { String message = ExceptionManager.getInstance().getFullMessage("benv_XEP_1"); throw new BonitaRuntimeException(message); } this.documentBuilderFactory.setAttribute( "http://java.sun.com/xml/jaxp/properties/schemaSource", url.toExternalForm()); return this.documentBuilderFactory; }
/** * Creates a new EnvironmentFactory from the list of entries. */ public EnvironmentFactory createEnvironmentFactory() { final String envConfig = createEnvironmentXml(); if (EnvGenerator.LOG.isLoggable(Level.CONFIG)) { EnvGenerator.LOG.config("The following environment has been generated by: " + this.getClass().getName() + Misc.LINE_SEPARATOR + envConfig); } return BonitaEnvironmentParser.parseEnvironmentFactoryFromXmlString(envConfig); }
public static EnvironmentFactory parseEnvironmentFactoryFromXmlString( final String xmlString) { final Parse parse = getInstance().createParse(); parse.setString(xmlString); final EnvironmentFactory factory = (EnvironmentFactory) parse.execute().getDocumentObject(); Misc.showProblems(parse.getProblems(), "environment"); return factory; }
public static synchronized PvmEnvironmentFactoryParser getInstance() { if (instance == null) { instance = new BonitaEnvironmentParser(); // Get bindings final Bindings bindings = instance.getEnvironmentXmlParser().getBindings(); // Use the same bindings in block and application contexts instance.getEnvironmentFactoryXmlParser().setBindings(bindings); // Add bonita bindings final BindingParser bindingParser = new BindingParser(); final URL url = ReflectUtil.getResource(null, BONITA_WIRE_BINDINGS_RESOURCES); if (url != null) { LOG.info("parsing bindings from resource url: " + url); Parse parse = bindingParser.createParse() .setUrl(url) .pushObject(bindings) .execute(); Misc.showProblems(parse.getProblems(), "bonita wire bindings"); } } return instance; }
LOG.config("The environment resource " + url + " contains: " + Misc.LINE_SEPARATOR + environment); final EnvironmentFactory factory = BonitaEnvironmentParser.parseEnvironmentFactoryFromXmlString(environment); setEnvironmentFactory(domain, factory); Runtime.getRuntime().addShutdownHook(new BonitaShutdownHook());