Java 类org.apache.camel.model.Constants 实例源码

项目:syncope    文件:SyncopeCamelContext.java   
private void loadContext(final Collection<String> routes) {
    try {
        DOMImplementationRegistry reg = DOMImplementationRegistry.newInstance();
        DOMImplementationLS domImpl = (DOMImplementationLS) reg.getDOMImplementation("LS");
        LSParser parser = domImpl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);

        JAXBContext jaxbContext = JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES);
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        List<RouteDefinition> routeDefs = new ArrayList<>();
        for (String route : routes) {
            try (InputStream input = IOUtils.toInputStream(route, StandardCharsets.UTF_8)) {
                LSInput lsinput = domImpl.createLSInput();
                lsinput.setByteStream(input);

                Node routeElement = parser.parse(lsinput).getDocumentElement();
                routeDefs.add(unmarshaller.unmarshal(routeElement, RouteDefinition.class).getValue());
            }
        }
        camelContext.addRouteDefinitions(routeDefs);
    } catch (Exception e) {
        LOG.error("While loading Camel context {}", e);
        throw new CamelException(e);
    }
}
项目:fabric8-forge    文件:RouteXml.java   
public JAXBContext jaxbContext() throws JAXBException {
    if (_jaxbContext == null) {
        String packageName = Constants.JAXB_CONTEXT_PACKAGES + ":org.apache.camel.spring";
        _jaxbContext = JAXBContext.newInstance(packageName, classLoader);
    }
    return _jaxbContext;
}
项目:Camel    文件:DefaultModelJAXBContextFactory.java   
protected String getPackages() {
    return Constants.JAXB_CONTEXT_PACKAGES;
}