/** * Find a directory using the path to the directory with file.separator between the dir-names. * * @param path * The path to the directory * @return The directory if one was found, null if nothing was found. */ @Override public RepositoryDirectory findDirectory( String path ) { String[] newPath = Const.splitPath( path, DIRECTORY_SEPARATOR ); String[] p = null; if ( parent == null ) { // This doesn't include the root: p = new String[newPath.length + 1]; p[0] = DIRECTORY_SEPARATOR; for ( int i = 0; i < newPath.length; i++ ) { p[i + 1] = newPath[i]; } } else { p = newPath; } return findDirectory( p ); }
/** * Find the sub-directory with a certain ID * * @param id_directory * the directory ID to look for. * @return The RepositoryDirectory if the ID was found, null if nothing could be found. */ @Override public RepositoryDirectory findDirectory( ObjectId id_directory ) { // Check for the root directory... // if ( getObjectId() == null && id_directory == null ) { return this; } if ( getObjectId() != null && getObjectId().equals( id_directory ) ) { return this; } for ( int i = 0; i < getNrSubdirectories(); i++ ) { RepositoryDirectory rd = getSubdirectory( i ).findDirectory( id_directory ); if ( rd != null ) { return rd; } } return null; }
protected enum RepositoryServers { DIS, POBS }
private RepositoryDirectoryInterface initRepositoryDirectoryTree( RepositoryFileTree repoTree ) throws KettleException { RepositoryFile rootFolder = repoTree.getFile(); RepositoryDirectory rootDir = new RepositoryDirectory(); rootDir.setObjectId( new StringObjectId( rootFolder.getId().toString() ) ); fillRepositoryDirectoryFromTree( rootDir, repoTree ); // Example: /etc RepositoryDirectory etcDir = rootDir.findDirectory( ClientRepositoryPaths.getEtcFolderPath() ); RepositoryDirectory newRoot = new RepositoryDirectory(); newRoot.setObjectId( rootDir.getObjectId() ); newRoot.setVisible( false ); for ( int i = 0; i < rootDir.getNrSubdirectories(); i++ ) { RepositoryDirectory childDir = rootDir.getSubdirectory( i ); // Don't show /etc boolean isEtcChild = childDir.equals( etcDir ); if ( isEtcChild ) { continue; } newRoot.addSubdirectory( childDir ); } return newRoot; }
if ( rd.findDirectory( id_directory_parent ) != null ) {