/** * * @param classLoader * The ClassLoader that will be used to load all Java classes as well * as all file system resources. * * @param createSoapClient * True if you want the SOAP client to be initialized. This requires * that you have a valid JAX-RPC SOAP implementation (not just the * interfaces) on the classpath. * */ public AbstractEnvironment(ClassLoader classLoader, boolean createSoapClient) { initialize(classLoader, createSoapClient); }
public String createRelativePath(String originalPath, String relativePath) { URI original = URI.create(originalPath); // // If the relative path is an absolute path // then it only makes sense to return it since returning a absolute // path relative to another path does not make sense // if(isAbsolute(relativePath)) { return relativePath; } return original.resolve(relativePath).toString(); }
public InputStream getDataResourceStream(String path) { InputStream stream = getClassLoader().getResourceAsStream(path); if (stream == null) { Object[] filler = { path }; throw new RuntimeException(_MESSAGES.get("NoDataResource", filler)); } return stream; }
/** * * Saves the ClassLoader and loads the SOAP client, if desired. * */ private void initialize(ClassLoader classLoader, boolean createSoapClient) { if (classLoader == null) throw new NullPointerException(_MESSAGES.get("NullClassLoader")); _classLoader = classLoader; if (createSoapClient) _soapClient = createSoapClient(); }
/** * * @return An EPR whose URI is the value returned by getDefaultURI(). * */ protected EndpointReference getDefaultEPR() { String defaultURI = getDefaultURI(); if (defaultURI == null) throw new IllegalStateException(_MESSAGES.get("NoDefaultURI")); return new EndpointReference(URI.create(defaultURI)); }
public Document getDocument(String path) { InputStream stream = getDataResourceStream(path); try { return XmlUtils.createDocument(stream); } catch (Exception error) { Object[] filler = { path, error.getMessage() }; throw new RuntimeException(_MESSAGES.get("CreateDocFailed", filler)); } }
public URL getDataResource(String path) { URL url = getClassLoader().getResource(path); if (url == null) { Object[] filler = { path }; throw new RuntimeException(_MESSAGES.get("NoDataResource", filler)); } return url; }
/** * * Initializes the AbstractEnvironment with its own ClassLoader. * * @param createSoapClient * True if you want the SOAP client to be initialized. This requires * that you have a valid JAX-RPC SOAP implementation (not just the * interfaces) on the classpath. * */ public AbstractEnvironment(boolean createSoapClient) { initialize(getClass().getClassLoader(), createSoapClient); }