public static void main(String[] args) { MessagingConfiguration config = new MessagingConfiguration(); ApacheXPathServerConfigurationParser parser = new ApacheXPathServerConfigurationParser(); parser.parse(args[0], new LocalFileResolver(), config); System.out.println("Config " + config.toString()); } }
pushConfigurationFile(f.getParent()); return fin; setErrorMessage(e, path); throw e; setErrorMessage(e, path); e.setRootCause(ex); throw e; setErrorMessage(e, path); e.setRootCause(se); throw e;
private void destinationInclude(Node destInclude, ServiceSettings serviceSettings) { // Validation requiredAttributesOrElements(destInclude, DESTINATION_INCLUDE_CHILDREN); String src = getAttributeOrChildElement(destInclude, SRC_ATTR); if (src.length() > 0) { Document doc = loadDocument(src, fileResolver.getIncludedFile(src)); if (fileResolver instanceof LocalFileResolver) { LocalFileResolver local = (LocalFileResolver)fileResolver; ((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src)); } doc.getDocumentElement().normalize(); Node dest = selectSingleNode(doc, "/" + DESTINATION_ELEMENT); if (dest != null) { destination(dest, serviceSettings); fileResolver.popIncludedFile(); } else { //The destination include root element must be '{DESTINATION_ELEMENT}'. ConfigurationException ex = new ConfigurationException(); ex.setMessage(INVALID_DESTINATION_INCLUDE_ROOT, new Object[]{DESTINATION_ELEMENT}); throw ex; } } }
pushConfigurationFile(f.getParent()); return fin;
private void serviceInclude(Node serviceInclude) { // Validation requiredAttributesOrElements(serviceInclude, SERVICE_INCLUDE_CHILDREN); String src = getAttributeOrChildElement(serviceInclude, SRC_ATTR); if (src.length() > 0) { Document doc = loadDocument(src, fileResolver.getIncludedFile(src)); if (fileResolver instanceof LocalFileResolver) { LocalFileResolver local = (LocalFileResolver)fileResolver; ((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src)); } doc.getDocumentElement().normalize(); Node service = selectSingleNode(doc, "/" + SERVICE_ELEMENT); if (service != null) { service(service); fileResolver.popIncludedFile(); } else { // The services include root element must be '{SERVICE_ELEMENT}'. ConfigurationException ex = new ConfigurationException(); ex.setMessage(INVALID_SERVICE_INCLUDE_ROOT, new Object[]{SERVICE_ELEMENT}); throw ex; } } }
pushConfigurationFile(f.getParent()); return fin;
public static void main(String[] args) { MessagingConfiguration config = new MessagingConfiguration(); XPathServerConfigurationParser parser = new XPathServerConfigurationParser(); parser.parse(args[0], new LocalFileResolver(), config); System.out.println(config.toString()); } }
((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src));
pushConfigurationFile(f.getParent()); return fin; setErrorMessage(e, path); throw e; setErrorMessage(e, path); e.setRootCause(ex); throw e; setErrorMessage(e, path); e.setRootCause(se); throw e;
pushConfigurationFile(f.getParent()); return fin;
configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER); configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER);
((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src));
pushConfigurationFile(f.getParent()); return fin; setErrorMessage(e, path); throw e; setErrorMessage(e, path); e.setRootCause(ex); throw e; setErrorMessage(e, path); e.setRootCause(se); throw e;
} else { configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER); configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER);
((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src));
} else { configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER); configurationResolver = new LocalFileResolver(LocalFileResolver.SERVER);
((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src));
public static ClientConfiguration getClientConfiguration(String path, String parserClass) { ClientConfiguration config = new ClientConfiguration(); ConfigurationParser parser = getConfigurationParser(parserClass); if (parser == null) { // "Unable to create a parser to load messaging configuration." LocalizedException lme = new LocalizedException(); lme.setMessage(10138); throw lme; } LocalFileResolver local = new LocalFileResolver(); parser.parse(path, local, config); config.addConfigPath(path, new File(path).lastModified()); return config; }
((ClientConfiguration)config).addConfigPath(local.getIncludedPath(src), local.getIncludedLastModified(src));
public static ClientConfiguration getClientConfiguration(String path, String parserClass) { ClientConfiguration config = new ClientConfiguration(); ConfigurationParser parser = getConfigurationParser(parserClass); if (parser == null) { // "Unable to create a parser to load messaging configuration." LocalizedException lme = new LocalizedException(); lme.setMessage(10138); throw lme; } LocalFileResolver local = new LocalFileResolver(); parser.parse(path, local, config); config.addConfigPath(path, new File(path).lastModified()); return config; }