@Override public boolean traverseDescendents( FileSelectInfo fileSelectInfo ) throws Exception { FileObject fileObject = fileSelectInfo.getFile(); String folder = fileObject.getName().getBaseName(); FileObject kettleIgnore = fileObject.getChild( ".kettle-ignore" ); return includeLibJars || ( kettleIgnore == null && !"lib".equals( folder ) ); }
@Override public FileObject getChild(final String name) throws FileSystemException { return decoratedFileObject.getChild(name); }
@Override public FileObject getChild(final String name) throws FileSystemException { return decoratedFileObject.getChild(name); }
@Override public FileObject getChild(final String name) throws FileSystemException { return decoratedFileObject.getChild(name); }
@Override public FileObject getChild(final String name) throws FileSystemException { return decoratedFileObject.getChild(name); }
public FileObject getChild(String name) throws FileSystemException { return parent.getChild(name); }
private FileObject createFileObject(String string) { try { FileObject child = base.getChild(string); return child; } catch (FileSystemException e) { throw new RuntimeException(e); } } @Override
private FileObject createFileObject(String string) { try { FileObject child = base.getChild(string); return child; } catch (FileSystemException e) { throw new RuntimeException(e); } } @Override
public FileObject getChildrenDirectory() { FileObject baseDir = directory; if(!parameters.isEmpty()) { try { baseDir = baseDir.getChild(DETAIL); } catch (FileSystemException e) { throw new RuntimeException(e); } } return baseDir; }
public static FileObject getChild(FileObject objectFile, String name, String errorMessage) { try { return objectFile.getChild(name); } catch (IOException e) { throw new ApplicationTechnicalException(errorMessage, e); } }
@Override public FileObject getChild(String name) { try { return FileObject.toDaFileObject(this.fileObject.getChild(name)); } catch (FileSystemException e) { throw new VFSFileSystemException(e); } }
@Override public FileObject getChild(String name) { try { return FileObject.toDaFileObject(this.fileObject.getChild(name)); } catch (FileSystemException e) { throw new VFSFileSystemException(e); } }
/** * Returns the identified file object. If not existing, returns null. * * @param identifier data identifier * @return identified file object * @throws DataStoreException if any file system exception occurs */ protected FileObject getExistingFileObject(DataIdentifier identifier) throws DataStoreException { String relPath = resolveFileObjectRelPath(identifier); String [] segments = relPath.split("/"); FileObject tempFileObject = getBaseFolderObject(); try { for (int i = 0; i < segments.length; i++) { tempFileObject = tempFileObject.getChild(segments[i]); if (tempFileObject == null) { return null; } } return tempFileObject; } catch (FileSystemException e) { throw new DataStoreException("File object not resolved: " + identifier, e); } }
public static void configurePageAction(PageAction pageAction, PageInstance pageInstance) { if(pageInstance.getConfiguration() != null) { logger.debug("Page instance {} is already configured"); return; } FileObject configurationFile; try { configurationFile = pageInstance.getDirectory().getChild("configuration.xml"); } catch (FileSystemException e) { throw new RuntimeException(e); } Class<?> configurationClass = PageActionLogic.getConfigurationClass(pageAction.getClass()); try { Object configuration = getConfiguration(configurationFile, configurationClass); pageInstance.setConfiguration(configuration); } catch (Throwable t) { logger.error("Couldn't load configuration from " + configurationFile.getName().getPath(), t); } pageAction.setPageInstance(pageInstance); }
/** * Get the content of a test flux */ public String getTestFluxContent(String id) throws ContentNotFetchedException { try { return readFile(VFS.getManager().getBaseFile().getChild("testFlux").resolveFile(id)); } catch (Exception e) { throw new ContentNotFetchedException("Exception raised", e); } }
protected void loadConfiguration(ServletContext servletContext, FileObject applicationRoot) throws FileSystemException, ConfigurationException { FileObject configurationFile = applicationRoot.getChild("portofino.properties"); WritableCompositeConfiguration compositeConfiguration = new WritableCompositeConfiguration(); if(configurationFile != null) { Configurations configurations = new Configurations(); PropertiesConfiguration configuration = configurations.properties(configurationFile.getURL()); FileObject localConfigurationFile = applicationRoot.getChild("portofino-local.properties"); if (localConfigurationFile != null && localConfigurationFile.exists() && localConfigurationFile.getType() == FileType.FILE) { logger.info("Local configuration found: {}", localConfigurationFile); PropertiesConfiguration localConfiguration = configurations.properties(localConfigurationFile.getURL()); compositeConfiguration.addConfiguration(localConfiguration); } compositeConfiguration.addConfiguration(configuration); this.configuration = compositeConfiguration; } else { this.configuration = new PropertiesConfiguration(); logger.warn("portofino.properties file not found in " + applicationRoot); } servletContext.setAttribute("portofino.configuration", this.configuration); }
protected void initApplicationRoot(ServletContext servletContext, String actionsDirectoryName) { try { FileObject actionsDirectory = applicationRoot.getChild(actionsDirectoryName); if(actionsDirectory == null || actionsDirectory.getType() != FileType.FOLDER) { initializationFailed(new Exception("Not a directory: " + actionsDirectoryName)); } CodeBase codeBase = createAndStoreCodeBase(servletContext); ResourceResolvers resourceResolver = new ResourceResolvers(); configureResourceResolvers(resourceResolver, codeBase); DocumentedApiRoot.setRootFactory(() -> getRoot(actionsDirectory, resourceResolver)); } catch (Exception e) { initializationFailed(e); } }
/** * Creates a child folder by the {@code name} under the {@code baseFolder} and retrieves the created folder. * @param baseFolder base folder object * @param name child folder name * @return a child folder by the {@code name} under the {@code baseFolder} and retrieves the created folder * @throws DataStoreException if any file system exception occurs */ static FileObject createChildFolder(FileObject baseFolder, String name) throws DataStoreException { FileObject childFolder = null; try { childFolder = baseFolder.resolveFile(name); if (!childFolder.exists()) { childFolder.createFolder(); childFolder = baseFolder.getChild(childFolder.getName().getBaseName()); } } catch (FileSystemException e) { throw new DataStoreException( "Could not create a child folder, '" + name + "' under " + baseFolder.getName().getFriendlyURI(), e); } return childFolder; }
/** * Creates a child file by the {@code name} under the {@code baseFolder} and retrieves the created file. * @param baseFolder base folder object * @param name child file name * @return a child file by the {@code name} under the {@code baseFolder} and retrieves the created file * @throws DataStoreException if any file system exception occurs */ static FileObject createChildFile(FileObject baseFolder, String name) throws DataStoreException { FileObject childFile = null; try { childFile = baseFolder.resolveFile(name); if (!childFile.exists()) { childFile.createFile(); childFile = baseFolder.getChild(childFile.getName().getBaseName()); } } catch (FileSystemException e) { throw new DataStoreException( "Could not create a child file, '" + name + "' under " + baseFolder.getName().getFriendlyURI(), e); } return childFile; }