public void setResourceFinder(ResourceFinder finder) { if (finder == null) { _resourceFinder = new DefaultResourceFinder(); } else { _resourceFinder = finder; } }
/** * Constructor: resolve relative URIs against specified directory. * @param relativeDir base path for relative URLs. * @param absoluteDir base path for absolute URLs. */ public DefaultResourceFinder(File relativeDir, File absoluteDir) { checkDir("relativeDir", relativeDir); checkDir("absoluteDir", absoluteDir); _relativeDir = relativeDir; _absoluteDir = absoluteDir; }
public InputStream openResource(URI uri) throws MalformedURLException, IOException { uri = relativize(uri); InputStream r = openFileResource(uri); if (r != null) { return r; } if (__log.isDebugEnabled()) { __log.debug("trying classpath resource for " + uri); } r = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri.getPath()); if (r != null) { return r; } else { if (__log.isDebugEnabled()) { __log.debug("classpath resource not found " + uri); } return null; } }
public URI resolve(URI parent, URI child) { parent = relativize(parent); child = relativize(child); URI result = parent.resolve(child); URI result2 = _absoluteDir.toURI().resolve(result); if (__log.isDebugEnabled()) { __log.debug("resolving URI: parent " + parent + " child " + child + " result " + result + " resultAbsolute:" + result2); } return result2; }
public DocumentRegistry getDocRegistry() { if (_docRegistry == null) { _docRegistry = new DocumentRegistry(); WSDLFactory4BPEL wsdlFactory = (WSDLFactory4BPEL) WSDLFactoryBPEL20.newInstance(); WSDLReader r = wsdlFactory.newWSDLReader(); DefaultResourceFinder rf = new DefaultResourceFinder(_duDirectory, _duDirectory); URI basedir = _duDirectory.toURI(); List<File> wsdls = FileUtils.directoryEntriesInPath(_duDirectory, DeploymentUnitDir._wsdlFilter); for (File file : wsdls) { URI uri = basedir.relativize(file.toURI()); try { _docRegistry.addDefinition((Definition4BPEL) r.readWSDL(new WSDLLocatorImpl(rf, uri))); } catch (WSDLException e) { throw new ContextException("Couldn't read WSDL document at " + uri, e); } } } return _docRegistry; }
} else { File suDir = _suDir != null ? _suDir : _bpelFile.getParentFile(); wf = new DefaultResourceFinder(_bpelFile.getAbsoluteFile().getParentFile(), suDir.getAbsoluteFile());
r.setExtensionRegistry(extReg); DefaultResourceFinder rf = new DefaultResourceFinder(_duDirectory, _duDirectory); URI basedir = _duDirectory.toURI(); List<File> wsdls = FileUtils.directoryEntriesInPath(_duDirectory, DeploymentUnitDir._wsdlFilter);