FileSystemRepositoryFileDao implements IRepositoryFileDao { static String idToPath( String relPath ) { relPath = RepositoryPathEncoder.decodeRepositoryPath( relPath ); return relPath.replaceFirst( "^/?([A-z])/[/\\\\](.*)", "$1:/$2" ); } FileSystemRepositoryFileDao();  FileSystemRepositoryFileDao( final String baseDir );  FileSystemRepositoryFileDao( File baseDir ); boolean canUnlockFile( Serializable fileId ); File getRootDir(); RepositoryFile createFile( Serializable parentFolderId, RepositoryFile file, IRepositoryFileData data,
      RepositoryFileAcl acl, String versionMessage ); RepositoryFile createFolder( Serializable parentFolderId, RepositoryFile file, RepositoryFileAcl acl,
      String versionMessage ); void deleteFile( Serializable fileId, String versionMessage ); void deleteFileAtVersion( Serializable fileId, Serializable versionId ); @Override List<RepositoryFile> getChildren( RepositoryRequest repositoryRequest ); @Deprecated List<RepositoryFile> getChildren( Serializable folderId ); @Deprecated List<RepositoryFile> getChildren( Serializable folderId, String filter ); @Deprecated List<RepositoryFile> getChildren( Serializable folderId, String filter, Boolean showHiddenFiles ); @SuppressWarnings( "unchecked" ) T getData( Serializable fileId, Serializable versionId, Class<T> dataClass ); List<RepositoryFile> getDeletedFiles( Serializable folderId, String filter ); List<RepositoryFile> getDeletedFiles(); RepositoryFile internalGetFile( File f ); RepositoryFile getFile( String relPath ); RepositoryFile getFile( Serializable fileId, Serializable versionId ); RepositoryFile getFileByAbsolutePath( String absPath ); RepositoryFile getFileById( Serializable fileId ); RepositoryFile getFile( String relPath, boolean loadLocaleMaps ); RepositoryFile getFileById( Serializable fileId, boolean loadLocaleMaps ); @Override RepositoryFile getFile( String relPath, IPentahoLocale locale ); @Override RepositoryFile getFileById( Serializable fileId, IPentahoLocale locale ); @Override RepositoryFile getFile( String relPath, boolean loadLocaleMaps, IPentahoLocale locale ); @Override RepositoryFile getFileById( Serializable fileId, boolean loadLocaleMaps, IPentahoLocale locale ); @Override RepositoryFileTree getTree( RepositoryRequest repositoryRequest ); @Deprecated RepositoryFileTree getTree( String relPath, int depth, String filter, boolean showHidden ); List<VersionSummary> getVersionSummaries( Serializable fileId ); VersionSummary getVersionSummary( Serializable fileId, Serializable versionId ); void lockFile( Serializable fileId, String message ); void moveFile( Serializable fileId, String destRelPath, String versionMessage ); void permanentlyDeleteFile( Serializable fileId, String versionMessage ); void restoreFileAtVersion( Serializable fileId, Serializable versionId, String versionMessage ); void undeleteFile( Serializable fileId, String versionMessage ); void unlockFile( Serializable fileId ); RepositoryFile updateFile( RepositoryFile file, IRepositoryFileData data, String versionMessage ); List<RepositoryFile> getReferrers( Serializable fileId ); void setRootDir( File rootDir ); void setFileMetadata( final Serializable fileId, Map<String, Serializable> metadataMap ); Map<String, Serializable> getFileMetadata( final Serializable fileId ); void copyFile( Serializable fileId, String destAbsPath, String versionMessage ); List<RepositoryFile> getDeletedFiles( String origParentFolderPath, String filter ); @Override List<Character> getReservedChars(); @Override List<Locale> getAvailableLocalesForFileById( Serializable fileId ); @Override List<Locale> getAvailableLocalesForFileByPath( String relPath ); @Override List<Locale> getAvailableLocalesForFile( RepositoryFile repositoryFile ); @Override Properties getLocalePropertiesForFileById( Serializable fileId, String locale ); @Override Properties getLocalePropertiesForFileByPath( String relPath, String locale ); @Override Properties getLocalePropertiesForFile( RepositoryFile repositoryFile, String locale ); @Override void setLocalePropertiesForFileById( Serializable fileId, String locale, Properties properties ); @Override void setLocalePropertiesForFileByPath( String relPath, String locale, Properties properties ); @Override void setLocalePropertiesForFile( RepositoryFile repositoryFile, String locale, Properties properties ); @Override void deleteLocalePropertiesForFile( RepositoryFile repositoryFile, String locale ); @Override RepositoryFile updateFolder( RepositoryFile file, String versionMessage );  }
@Test public void testIdToPath() throws Exception { assertEquals( "C:/Program Files/pentaho/design-tools/data-integration/Unsaved Report.xanalyzer", FileSystemRepositoryFileDao .idToPath( "C\t:Program Files:pentaho:design-tools:data-integration/Unsaved Report.xanalyzer" ) ); assertEquals( "C:/Program Files/pentaho/design-tools/data-integration/Unsaved Report.xanalyzer", FileSystemRepositoryFileDao .idToPath( "C::Program Files:pentaho:design-tools:data-integration/Unsaved Report.xanalyzer" ) ); assertEquals( "C:/Program Files\\pentaho\\design-tools\\data-integration\\Unsaved Report.xanalyzer", FileSystemRepositoryFileDao .idToPath( "C:/Program Files\\pentaho\\design-tools\\data-integration\\Unsaved Report.xanalyzer" ) ); assertEquals( "C:/Program Files\\pentaho\\design-tools\\data-integration\\Unsaved Report.xanalyzer", FileSystemRepositoryFileDao .idToPath( "C:\\Program Files\\pentaho\\design-tools\\data-integration\\Unsaved Report.xanalyzer" ) ); assertEquals( "/home/pentaho/design-tools/data-integration/Unsaved Report.xanalyzer", FileSystemRepositoryFileDao .idToPath( ":home:pentaho:design-tools:data-integration/Unsaved Report.xanalyzer" ) ); }