Class RepositoryUtils

java.lang.Object
org.pentaho.platform.repository2.unified.RepositoryUtils

public class RepositoryUtils extends Object
Utility methods that can be applied on any IUnifiedRepository} User: dkincade
  • Constructor Summary

    Constructors
    Constructor
    Description
    RepositoryUtils(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
    Creates a new instance of this utility class with access to the specified repository
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.pentaho.platform.api.repository2.unified.RepositoryFile
    createFile(String filePath, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean createParentDirs, boolean versioned, String versionMessage)
    Creates a new file that is known to not exist
    org.pentaho.platform.api.repository2.unified.RepositoryFile
    getFile(String path, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean createIfNotExist, boolean createParents, String versionMessage)
    Returns the specified file from the current repository.
    org.pentaho.platform.api.repository2.unified.RepositoryFile
    getFolder(String path, boolean createIfNotExist, boolean createParents, String versionMessage)
    Returns the specified folder in the current repository.
    org.pentaho.platform.api.repository2.unified.RepositoryFile
    getFolder(String path, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl, boolean createIfNotExist, boolean createParents, String versionMessage)
     
    org.pentaho.platform.api.repository2.unified.IUnifiedRepository
    Returns the IUnifiedRepository for this instance
    org.pentaho.platform.api.repository2.unified.RepositoryFile
    saveFile(String filePath, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean create, boolean overwrite, boolean createParentDirs, boolean versioned, String versionMessage)
    Save the data to a file at the specified path.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RepositoryUtils

      public RepositoryUtils(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
      Creates a new instance of this utility class with access to the specified repository
  • Method Details

    • getRepository

      public org.pentaho.platform.api.repository2.unified.IUnifiedRepository getRepository()
      Returns the IUnifiedRepository for this instance
    • getFolder

      public org.pentaho.platform.api.repository2.unified.RepositoryFile getFolder(String path, boolean createIfNotExist, boolean createParents, String versionMessage)
      Returns the specified folder in the current repository. If it can not be found, it will optionally be created. The missing parent folders can also be created if needed
      Parameters:
      path - the full path to the requested folder in the repository
      createIfNotExist - true indicates the folder will be created if it doesn't exist
      createParents - true indicates that any missing parent folders will be created if they do not exist
      versionMessage - the message used if any folders are created
      Returns:
      the RepositoryFile of the request folders, or null if it does not exist and the parameters do not allow for it to be created
    • getFolder

      public org.pentaho.platform.api.repository2.unified.RepositoryFile getFolder(String path, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl, boolean createIfNotExist, boolean createParents, String versionMessage)
    • getFile

      public org.pentaho.platform.api.repository2.unified.RepositoryFile getFile(String path, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean createIfNotExist, boolean createParents, String versionMessage)
      Returns the specified file from the current repository. If it can not be found, it will optionally be created. The missing parent folders can also be created if needed.
      Parameters:
      path - the full path to the requested file in the repository
      data - the data to put in the file if it does not exist ... use null at your discretion
      createIfNotExist - true indicates the file will be created if it doesn't exist
      createParents - true indicates that any missing parent folders will be created if they do not exist
      versionMessage - the message used if the file or any folders are created
      Returns:
      the RepositoryFile of the request file, or null if it does not exist and the parameters do not allow for it to be created
    • saveFile

      public org.pentaho.platform.api.repository2.unified.RepositoryFile saveFile(String filePath, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean create, boolean overwrite, boolean createParentDirs, boolean versioned, String versionMessage)
      Save the data to a file at the specified path. It will create the file it is doesn't exist (if create == true), it will overwrite the file it it does exist (if overwrite == true, and it will create any necessary parent directories (if createParentDirs == true
      Parameters:
      filePath -
      data -
      create -
      overwrite -
      createParentDirs -
      Returns:
    • createFile

      protected org.pentaho.platform.api.repository2.unified.RepositoryFile createFile(String filePath, org.pentaho.platform.api.repository2.unified.IRepositoryFileData data, boolean createParentDirs, boolean versioned, String versionMessage)
      Creates a new file that is known to not exist
      Parameters:
      filePath - the full path to the file
      data - the data to be stored in the file
      createParentDirs - indicates of the directory structure should be created if it doesn't exist
      versionMessage - the version message
      Returns:
      the newly create IRepositoryFile or null if it couldn't be created