@Override public Enumeration<URL> loadAllResourcesAsURL(String uri) { ObjectHelper.notEmpty(uri, "uri"); Vector<URL> answer = new Vector<>(); try { String resolvedName = resolveUriPath(uri); Enumeration<URL> e = bundleContext.getBundle().getResources(resolvedName); while (e != null && e.hasMoreElements()) { answer.add(e.nextElement()); } String path = FileUtil.onlyPath(uri); String name = FileUtil.stripPath(uri); if (path != null && name != null) { for (Bundle bundle : bundleContext.getBundles()) { LOG.trace("Finding all entries in path: {} with pattern: {}", path, name); e = bundle.findEntries(path, name, false); while (e != null && e.hasMoreElements()) { answer.add(e.nextElement()); } } } } catch (IOException e) { throw new RuntimeException("Cannot load resource: " + uri, e); } return answer.elements(); }
String directory = FileUtil.onlyPath(name); if (directory == null) {
String directory = FileUtil.onlyPath(name); String onlyName = FileUtil.stripPath(name); try {
String dir = FileUtil.onlyPath(to); if (dir != null) {
String path = FileUtil.onlyPath(name); if (path != null) { changeCurrentDirectory(path);
public boolean deleteFile(String name) throws GenericFileOperationFailedException { log.debug("Deleting file: {}", name); boolean result; String target = name; String currentDir = null; try { if (endpoint.getConfiguration().isStepwise()) { // remember current directory currentDir = getCurrentDirectory(); target = FileUtil.stripPath(name); try { changeCurrentDirectory(FileUtil.onlyPath(name)); } catch (GenericFileOperationFailedException e) { // we could not change directory, try to change back before changeCurrentDirectory(currentDir); throw e; } } // delete the file log.trace("Client deleteFile: {}", target); result = client.deleteFile(target); // change back to previous directory if (currentDir != null) { changeCurrentDirectory(currentDir); } } catch (IOException e) { throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e); } return result; }
String path = FileUtil.onlyPath(name); if (path != null) { changeCurrentDirectory(path);
String path = FileUtil.onlyPath(name); if (path != null) { changeCurrentDirectory(path);
public synchronized boolean storeFile(String name, Exchange exchange, long size) throws GenericFileOperationFailedException { // must normalize name first name = endpoint.getConfiguration().normalizePath(name); LOG.trace("storeFile({})", name); boolean answer = false; String currentDir = null; String path = FileUtil.onlyPath(name); String targetName = name; try { if (path != null && endpoint.getConfiguration().isStepwise()) { // must remember current dir so we stay in that directory after // the write currentDir = getCurrentDirectory(); // change to path of name changeCurrentDirectory(path); // the target name should be without path, as we have changed // directory targetName = FileUtil.stripPath(name); } // store the file answer = doStoreFile(name, targetName, exchange); } finally { // change back to current directory if we changed directory if (currentDir != null) { changeCurrentDirectory(currentDir); } } return answer; }
String dir = FileUtil.onlyPath(to); if (dir != null) {
String path = FileUtil.onlyPath(name); if (path != null) { changeCurrentDirectory(path);
String path = FileUtil.onlyPath(name); String targetName = name;