org.pentaho.test.platform
Class SolutionRepositoryAdapter

java.lang.Object
  extended by org.pentaho.test.platform.SolutionRepositoryAdapter
All Implemented Interfaces:
ILogger, ISolutionRepository

public class SolutionRepositoryAdapter
extends Object
implements ISolutionRepository


Field Summary
 
Fields inherited from interface org.pentaho.platform.api.repository.ISolutionRepository
ACTION_ADMIN, ACTION_CREATE, ACTION_DELETE, ACTION_EXECUTE, ACTION_SHARE, ACTION_SUBSCRIBE, ACTION_UPDATE, FILE_ADD_FAILED, FILE_ADD_INVALID_PUBLISH_PASSWORD, FILE_ADD_INVALID_USER_CREDENTIALS, FILE_ADD_SUCCESSFUL, FILE_EXISTS, INDEX_FILENAME, REPOSITORY_SERVICE_CACHE_REGION, SEPARATOR
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Constructor Summary
SolutionRepositoryAdapter()
           
 
Method Summary
 void addPermission(ISolutionFile file, IPermissionRecipient recipient, IPermissionMask permission)
          Adds to the ACL associated with aFile.
 int addSolutionFile(String baseUrl, String path, String fileName, byte[] data, boolean overwrite)
          Adds a solution to the solution repository defined by the url that is built by concatenating baseUrl, path, and fileName.
 int addSolutionFile(String baseUrl, String path, String fileName, File f, boolean overwrite)
          Adds a solution to the solution repository defined by the url that is built by concatenating baseUrl, path, and fileName.
 ISolutionFile createFolder(File newFolder)
          This method creates a new folder in the Repository
 void debug(String message)
          Log a message object with the DEBUG Level.
 void debug(String message, Throwable error)
          Log a message with the DEBUG level including the stack trace of the Throwable error passed as parameter.
 void error(String message)
          Log a message object with the ERROR Level.
 void error(String message, Throwable error)
          Log a message with the ERROR level including the stack trace of the Throwable error passed as parameter.
 void fatal(String message)
          Log a message object with the FATAL Level.
 void fatal(String message, Throwable error)
          Log a message with the FATAL level including the stack trace of the Throwable error passed as parameter.
 IActionSequence getActionSequence(String solutionName, String actionPath, String actionName, int loggingLevel, int actionOperation)
          Retrieves the action sequence from the repository.
 String[] getAllActionSequences()
          Defaults action operation to execute
 String[] getAllActionSequences(int actionOperation)
          An array of Strings where each string is the fully qualified path of every *.xaction contained in the repository.
 ClassLoader getClassLoader(String path)
          Returns an appropriate class loader for a specific path
 Map<IPermissionRecipient,IPermissionMask> getEffectivePermissions(ISolutionFile file)
          Returns the ACL for the given file.
 ISolutionFile getFileByPath(String path)
           
 org.dom4j.Document getFullSolutionTree(int actionOperation, ISolutionFilter filter)
           
 org.dom4j.Document getFullSolutionTree(int actionOperation, ISolutionFilter filter, ISolutionFile startFile)
           
 String getLocalizedFileProperty(ISolutionFile resourceFile, String key)
          This method retrieves a locale aware value given a key and a file.
 String getLocalizedFileProperty(ISolutionFile resourceFile, String key, int actionOperation)
          This method retrieves a locale aware value given a key and a file.
 int getLoggingLevel()
          Return the logging level for this Logger.
 List getMessages()
          Return the message list, if any, that all log messages generated by this Solution Repository are being appended to
 org.dom4j.Document getNavigationUIDocument(String solution, String path, int actionOperation)
          Get an XML document that describes the structure of the solution repository.
 Map<IPermissionRecipient,IPermissionMask> getPermissions(ISolutionFile file)
          Returns the ACL for the given file.
 String getRepositoryName()
           
 byte[] getResourceAsBytes(IActionSequenceResource actionResource, boolean getLocalizedResource)
          See getResourceInputBytes(String solutionPath).
 byte[] getResourceAsBytes(IActionSequenceResource actionResource, boolean getLocalizedResource, int actionOperation)
          See getResourceInputBytes(String solutionPath).
 byte[] getResourceAsBytes(String solutionPath, boolean getLocalizedResource)
          See getResourceInputBytes(String solutionPath).
 byte[] getResourceAsBytes(String solutionPath, boolean getLocalizedResource, int actionOperation)
          See getResourceInputBytes(String solutionPath).
 org.dom4j.Document getResourceAsDocument(IActionSequenceResource actionResource)
          See getResourceInputStream(IActionResource actionResource).
 org.dom4j.Document getResourceAsDocument(IActionSequenceResource actionResource, int actionOperation)
          See getResourceInputStream(IActionResource actionResource).
 org.dom4j.Document getResourceAsDocument(String solutionPath)
          See getResourceInputStream(String solutionPath).
 org.dom4j.Document getResourceAsDocument(String solutionPath, int actionOperation)
          See getResourceInputStream(String solutionPath).
 String getResourceAsString(IActionSequenceResource actionResource)
          See getResourceInputStream(IActionResource actionResource).
 String getResourceAsString(IActionSequenceResource actionResource, int actionOperation)
          See getResourceInputStream(IActionResource actionResource).
 String getResourceAsString(String solutionPath)
          See getResourceInputStream(String solutionPath).
 String getResourceAsString(String solutionPath, int actionOperation)
          See getResourceInputStream(String solutionPath).
 org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(IActionSequenceResource actionResource)
          See getResourceInputStream(IActionResource actionResource).
 org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(IActionSequenceResource actionResource, int actionOperation)
          See getResourceInputStream(IActionResource actionResource).
 org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(String solutionPath)
          See getResourceInputStream(String solutionPath).
 org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(String solutionPath, int actionOperation)
          See getResourceInputStream(String solutionPath).
 InputStream getResourceInputStream(IActionSequenceResource actionResource, boolean getLocalizedResource)
          Given a IActionResource this method returns a InputStream that references the content of the actionResource.
 InputStream getResourceInputStream(IActionSequenceResource actionResource, boolean getLocalizedResource, int actionOperation)
          Given a IActionResource this method returns a InputStream that references the content of the actionResource.
 InputStream getResourceInputStream(String solutionPath, boolean getLocalizedResource)
          Returns an InputStream that contains the data of the resource defined by the solutionPath.
 InputStream getResourceInputStream(String solutionPath, boolean getLocalizedResource, int actionOperation)
          Returns an InputStream that contains the data of the resource defined by the solutionPath.
 Reader getResourceReader(IActionSequenceResource actionResource)
          See getResourceInputStream(IActionResource actionResource).
 Reader getResourceReader(IActionSequenceResource actionResource, int actionOperation)
          See getResourceInputStream(IActionResource actionResource).
 Reader getResourceReader(String solutionPath)
          See getResourceInputStream(String solutionPath).
 Reader getResourceReader(String solutionPath, int actionOperation)
          See getResourceInputStream(String solutionPath).
 ISolutionFile getRootFolder(int actionOperation)
           
 ISolutionFile getSolutionFile(IActionSequenceResource actionResource)
          Defaults action operation to execute
 ISolutionFile getSolutionFile(IActionSequenceResource actionResource, int actionOperation)
           
 ISolutionFile getSolutionFile(String path)
           
 ISolutionFile getSolutionFile(String path, int actionOperation)
           
 long getSolutionFileLastModified(String path)
          Returns a long that represents the last time this file was modified Defaults to Action Operation of execute
 long getSolutionFileLastModified(String path, int actionOperation)
          Returns a long that represents the last time this file was modified
 org.dom4j.Document getSolutions(int actionOperation)
          Gets an XML Document representing all the solutions and all the files within all the solutions
 org.dom4j.Document getSolutions(String solutionName, String pathName, int actionOperation, boolean visibleOnly)
          Gets an XML Document representing all the files within a certain path within a solution
 org.dom4j.Document getSolutionStructure(int actionOperation)
          Returns an XML document that represents the parent/child relationship of the current solution repository
 org.dom4j.Document getSolutionTree(int actionOperation)
          Returns an XML document that defines the entire solution tree.
 org.dom4j.Document getSolutionTree(int actionOperation, ISolutionFilter filter)
           
 String getXSLName(org.dom4j.Document doc, String solution, String inputXSLName)
          Interprets the XSL name coming in against the document to see if there are any repository-specific changes based on display type associated with the XSL name
 boolean hasAccess(ISolutionFile file, int actionOperation)
          Checks permission.
 void info(String message)
          Log a message object with the INFO Level.
 void info(String message, Throwable error)
          Log a message with the INFO level including the stack trace of the Throwable error passed as parameter.
 void init(IPentahoSession session)
          Initializes the solution repository with the user session
 void localizeDoc(org.dom4j.Node document, ISolutionFile file)
           
 int publish(String baseUrl, String path, String fileName, byte[] data, boolean overwrite)
          Put a file into the solution repo.
 int publish(String baseUrl, String path, String fileName, File f, boolean overwrite)
          Put a file into the solution repo.
 void reloadSolutionRepository(IPentahoSession session, int loggingLevel)
          Loads or reloads a solution repository after a structure change.
 boolean removeSolutionFile(String solutionPath)
           
 boolean removeSolutionFile(String solution, String path, String fileName)
          Removes the file (fileName) from the path defined by the solution and path.
 void resetRepository()
          This method resets the caches used by the solution repository.
 boolean resourceExists(String solutionPath)
          Returns a true if the specified resource exists.
 boolean resourceExists(String solutionPath, int actionOperation)
          Returns a true if the specified resource exists.
 long resourceSize(String solutionPath)
          Returns the size of the specfied resource.
 long resourceSize(String solutionPath, int actionOperation)
          Returns the size of the specfied resource.
 void setLoggingLevel(int loggingLevel)
          Set the logging level for this Logger.
 void setMessages(List messages)
          Allows the caller to provide a List that will contain all log messages generated by the Solution Repository represented by this interface
 void setPermissions(ISolutionFile file, Map<IPermissionRecipient,IPermissionMask> acl)
          Replaces the ACL on aFile.
 void share(ISolutionFile file, List<IPermissionRecipient> shareRecipients)
          Share file with recipient.
 boolean solutionSynchronizationSupported()
           
 boolean supportsAccessControls()
           
 boolean synchronizeSolutionWithSolutionSource(IPentahoSession session)
          For ISolutionRepository implementations that have a source and a destination (for example, DBBasedSolutionRepository which has a file-system source and a DB destination) this is the entry point that allows synchronization.
 void trace(String message)
          Log a message object with the TRACE Level.
 void trace(String message, Throwable error)
          Log a message with the TRACE level including the stack trace of the Throwable error passed as parameter.
 void warn(String message)
          Log a message object with the WARN Level.
 void warn(String message, Throwable error)
          Log a message with the WARN level including the stack trace of the Throwable error passed as parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolutionRepositoryAdapter

public SolutionRepositoryAdapter()
Method Detail

addPermission

public void addPermission(ISolutionFile file,
                          IPermissionRecipient recipient,
                          IPermissionMask permission)
Description copied from interface: ISolutionRepository
Adds to the ACL associated with aFile.

Specified by:
addPermission in interface ISolutionRepository
Parameters:
file - file whose ACL is to be modified
recipient - recipient of the permission
permission - right to an action on this file by this user

addSolutionFile

public int addSolutionFile(String baseUrl,
                           String path,
                           String fileName,
                           File f,
                           boolean overwrite)
Description copied from interface: ISolutionRepository
Adds a solution to the solution repository defined by the url that is built by concatenating baseUrl, path, and fileName. The fileName that is added has its data populated by the data from File (on disk).

Specified by:
addSolutionFile in interface ISolutionRepository
Returns:
- int indicating status of return

addSolutionFile

public int addSolutionFile(String baseUrl,
                           String path,
                           String fileName,
                           byte[] data,
                           boolean overwrite)
Description copied from interface: ISolutionRepository
Adds a solution to the solution repository defined by the url that is built by concatenating baseUrl, path, and fileName. The fileName that is added has its data populated by the data.

Specified by:
addSolutionFile in interface ISolutionRepository
Returns:
- int indicating status of return

createFolder

public ISolutionFile createFolder(File newFolder)
                           throws IOException
Description copied from interface: ISolutionRepository
This method creates a new folder in the Repository

Specified by:
createFolder in interface ISolutionRepository
Parameters:
newFolder - The File that points to the new folder to create
Returns:
The RepositoryFile object created
Throws:
IOException

getActionSequence

public IActionSequence getActionSequence(String solutionName,
                                         String actionPath,
                                         String actionName,
                                         int loggingLevel,
                                         int actionOperation)
Description copied from interface: ISolutionRepository
Retrieves the action sequence from the repository. Should return null if the requested action seqeuence is not found.

Specified by:
getActionSequence in interface ISolutionRepository
Parameters:
solutionName - The name of the solution - like the root folder
actionPath - The relative path (from the solution) of where the file is stored
actionName - The name of the action sequence
loggingLevel - The level at which to log messages
actionOperation - Whether the action sequence is being retrieved for administration or execution
Returns:

getAllActionSequences

public String[] getAllActionSequences()
Description copied from interface: ISolutionRepository
Defaults action operation to execute

Specified by:
getAllActionSequences in interface ISolutionRepository
Returns:
An array of Strings where each string is the fully qualified path of every *.xaction contained in the repository.

getAllActionSequences

public String[] getAllActionSequences(int actionOperation)
Description copied from interface: ISolutionRepository
An array of Strings where each string is the fully qualified path of every *.xaction contained in the repository.

Specified by:
getAllActionSequences in interface ISolutionRepository
Parameters:
actionOperation - - Type of action operation to be performed
Returns:

getClassLoader

public ClassLoader getClassLoader(String path)
Description copied from interface: ISolutionRepository
Returns an appropriate class loader for a specific path

Specified by:
getClassLoader in interface ISolutionRepository
Returns:
- A ClassLoader

getEffectivePermissions

public Map<IPermissionRecipient,IPermissionMask> getEffectivePermissions(ISolutionFile file)
Description copied from interface: ISolutionRepository
Returns the ACL for the given file. If there are no access control entries for the given file, return the access control entries of an ancestor file.

Specified by:
getEffectivePermissions in interface ISolutionRepository
Parameters:
file - file whose ACL is to be returned
Returns:
ACL

getFileByPath

public ISolutionFile getFileByPath(String path)
Specified by:
getFileByPath in interface ISolutionRepository
Parameters:
path - the solution path to the desired resource
Returns:
the ISolutionFile for the given path

getFullSolutionTree

public org.dom4j.Document getFullSolutionTree(int actionOperation,
                                              ISolutionFilter filter)
Specified by:
getFullSolutionTree in interface ISolutionRepository

getFullSolutionTree

public org.dom4j.Document getFullSolutionTree(int actionOperation,
                                              ISolutionFilter filter,
                                              ISolutionFile startFile)
Specified by:
getFullSolutionTree in interface ISolutionRepository

getLocalizedFileProperty

public String getLocalizedFileProperty(ISolutionFile resourceFile,
                                       String key)
Description copied from interface: ISolutionRepository
This method retrieves a locale aware value given a key and a file. The intention is to allow the repository to be used as an API, so we can ask it for the "title" or "description" or "author" of a given file with localization in effect. Defaults action operation to execute

Specified by:
getLocalizedFileProperty in interface ISolutionRepository
Returns:
the String value found for the given key

getLocalizedFileProperty

public String getLocalizedFileProperty(ISolutionFile resourceFile,
                                       String key,
                                       int actionOperation)
Description copied from interface: ISolutionRepository
This method retrieves a locale aware value given a key and a file. The intention is to allow the repository to be used as an API, so we can ask it for the "title" or "description" or "author" of a given file with localization in effect.

Specified by:
getLocalizedFileProperty in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
the String value found for the given key

getMessages

public List getMessages()
Description copied from interface: ISolutionRepository
Return the message list, if any, that all log messages generated by this Solution Repository are being appended to

Specified by:
getMessages in interface ISolutionRepository
Returns:
List of String messages

getNavigationUIDocument

public org.dom4j.Document getNavigationUIDocument(String solution,
                                                  String path,
                                                  int actionOperation)
Description copied from interface: ISolutionRepository
Get an XML document that describes the structure of the solution repository. Returns the document used to construct the navigation UI. Also used by WAQR and jpivot to construct the repository browswer

Specified by:
getNavigationUIDocument in interface ISolutionRepository
Parameters:
solution - String The name of the solution. If this is empty (null or ""), and path is empty, return the root of the document. Otherwise return a document that starts at the node specified by the solution and path in the solution
path - String The path of the interested folder. See notes for parameter solution.
actionOperation - - Type of action operation to be performed
Returns:
Document XML document that describes the structure of the solution repository.

getPermissions

public Map<IPermissionRecipient,IPermissionMask> getPermissions(ISolutionFile file)
Description copied from interface: ISolutionRepository
Returns the ACL for the given file.

Specified by:
getPermissions in interface ISolutionRepository
Parameters:
file - file whose ACL is to be returned
Returns:
ACL

getRepositoryName

public String getRepositoryName()
Specified by:
getRepositoryName in interface ISolutionRepository

getResourceAsBytes

public byte[] getResourceAsBytes(String solutionPath,
                                 boolean getLocalizedResource)
                          throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputBytes(String solutionPath). Identical method except returns results as a byte array. Exception is thrown if io error. Defaults action operation to execute

Specified by:
getResourceAsBytes in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsBytes

public byte[] getResourceAsBytes(String solutionPath,
                                 boolean getLocalizedResource,
                                 int actionOperation)
                          throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputBytes(String solutionPath). Identical method except returns results as a byte array. Exception is thrown if io error.

Specified by:
getResourceAsBytes in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceAsBytes

public byte[] getResourceAsBytes(IActionSequenceResource actionResource,
                                 boolean getLocalizedResource)
                          throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputBytes(String solutionPath). Identical method except returns results as a byte array. Exception is thrown if io error. Defaults action operation to execute

Specified by:
getResourceAsBytes in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsBytes

public byte[] getResourceAsBytes(IActionSequenceResource actionResource,
                                 boolean getLocalizedResource,
                                 int actionOperation)
                          throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputBytes(String solutionPath). Identical method except returns results as a byte array. Exception is thrown if io error.

Specified by:
getResourceAsBytes in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceAsDocument

public org.dom4j.Document getResourceAsDocument(String solutionPath)
                                         throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a Document. Defaults action operation to execute

Specified by:
getResourceAsDocument in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsDocument

public org.dom4j.Document getResourceAsDocument(String solutionPath,
                                                int actionOperation)
                                         throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a Document.

Specified by:
getResourceAsDocument in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceAsDocument

public org.dom4j.Document getResourceAsDocument(IActionSequenceResource actionResource)
                                         throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a Document. Defaults action operation to execute

Specified by:
getResourceAsDocument in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsDocument

public org.dom4j.Document getResourceAsDocument(IActionSequenceResource actionResource,
                                                int actionOperation)
                                         throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a Document.

Specified by:
getResourceAsDocument in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceAsString

public String getResourceAsString(IActionSequenceResource actionResource)
                           throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a String. Exception is thrown if io error. Defaults action operation to execute

Specified by:
getResourceAsString in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsString

public String getResourceAsString(IActionSequenceResource actionResource,
                                  int actionOperation)
                           throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a String. Exception is thrown if io error.

Specified by:
getResourceAsString in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceAsString

public String getResourceAsString(String solutionPath)
                           throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a String. Exception is thrown if io error. Default action operation to execute

Specified by:
getResourceAsString in interface ISolutionRepository
Returns:
Throws:
IOException

getResourceAsString

public String getResourceAsString(String solutionPath,
                                  int actionOperation)
                           throws IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a String. Exception is thrown if io error.

Specified by:
getResourceAsString in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
IOException

getResourceDataSource

public org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(String solutionPath)
                                                                          throws FileNotFoundException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a DataSource. Defaults action operation to execute

Specified by:
getResourceDataSource in interface ISolutionRepository
Returns:
Throws:
FileNotFoundException

getResourceDataSource

public org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(String solutionPath,
                                                                                 int actionOperation)
                                                                          throws FileNotFoundException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a DataSource.

Specified by:
getResourceDataSource in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
FileNotFoundException

getResourceDataSource

public org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(IActionSequenceResource actionResource)
                                                                          throws FileNotFoundException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a DataSource. Defaults action operation to execute

Specified by:
getResourceDataSource in interface ISolutionRepository
Returns:
Throws:
FileNotFoundException

getResourceDataSource

public org.pentaho.commons.connection.IPentahoStreamSource getResourceDataSource(IActionSequenceResource actionResource,
                                                                                 int actionOperation)
                                                                          throws FileNotFoundException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a DataSource.

Specified by:
getResourceDataSource in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
FileNotFoundException

getResourceInputStream

public InputStream getResourceInputStream(IActionSequenceResource actionResource,
                                          boolean getLocalizedResource)
                                   throws FileNotFoundException
Description copied from interface: ISolutionRepository
Given a IActionResource this method returns a InputStream that references the content of the actionResource. Defaults action operation to execute

Specified by:
getResourceInputStream in interface ISolutionRepository
Parameters:
actionResource - - resource to create a stream for.
getLocalizedResource - - flag to use to check if we should attempt to get a localized version of the resource
Returns:
- InputStream that contains the data of the actionResource
Throws:
FileNotFoundException

getResourceInputStream

public InputStream getResourceInputStream(IActionSequenceResource actionResource,
                                          boolean getLocalizedResource,
                                          int actionOperation)
                                   throws FileNotFoundException
Description copied from interface: ISolutionRepository
Given a IActionResource this method returns a InputStream that references the content of the actionResource.

Specified by:
getResourceInputStream in interface ISolutionRepository
Parameters:
actionResource - - resource to create a stream for.
getLocalizedResource - - flag to use to check if we should attempt to get a localized version of the resource
actionOperation - - Type of action operation to be performed
Returns:
- InputStream that contains the data of the actionResource
Throws:
FileNotFoundException

getResourceInputStream

public InputStream getResourceInputStream(String solutionPath,
                                          boolean getLocalizedResource)
                                   throws FileNotFoundException
Description copied from interface: ISolutionRepository
Returns an InputStream that contains the data of the resource defined by the solutionPath. Defaults action operation to execute

Specified by:
getResourceInputStream in interface ISolutionRepository
Parameters:
solutionPath - - location of a resource.
Returns:
- InputStream that represents the data of the resource.
Throws:
FileNotFoundException

getResourceInputStream

public InputStream getResourceInputStream(String solutionPath,
                                          boolean getLocalizedResource,
                                          int actionOperation)
                                   throws FileNotFoundException
Description copied from interface: ISolutionRepository
Returns an InputStream that contains the data of the resource defined by the solutionPath.

Specified by:
getResourceInputStream in interface ISolutionRepository
Parameters:
solutionPath - - location of a resource.
actionOperation - - Type of action operation to be performed
Returns:
- InputStream that represents the data of the resource.
Throws:
FileNotFoundException

getResourceReader

public Reader getResourceReader(IActionSequenceResource actionResource)
                         throws FileNotFoundException,
                                IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a Reader. Exceptions are thrown if io error or file is not found. Defults action operation to execute

Specified by:
getResourceReader in interface ISolutionRepository
Returns:
Throws:
FileNotFoundException
IOException

getResourceReader

public Reader getResourceReader(IActionSequenceResource actionResource,
                                int actionOperation)
                         throws FileNotFoundException,
                                IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(IActionResource actionResource). Identical method except returns results as a Reader. Exceptions are thrown if io error or file is not found.

Specified by:
getResourceReader in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
FileNotFoundException
IOException

getResourceReader

public Reader getResourceReader(String solutionPath)
                         throws FileNotFoundException,
                                IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a Reader. Exceptions are thrown if io error or file is not found. Defaults action operation to execute

Specified by:
getResourceReader in interface ISolutionRepository
Returns:
Throws:
FileNotFoundException
IOException

getResourceReader

public Reader getResourceReader(String solutionPath,
                                int actionOperation)
                         throws FileNotFoundException,
                                IOException
Description copied from interface: ISolutionRepository
See getResourceInputStream(String solutionPath). Identical method except returns results as a Reader. Exceptions are thrown if io error or file is not found.

Specified by:
getResourceReader in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:
Throws:
FileNotFoundException
IOException

getRootFolder

public ISolutionFile getRootFolder(int actionOperation)
Specified by:
getRootFolder in interface ISolutionRepository
Parameters:
actionOperation - - Type of action operation to be performed
Returns:
the ISolutionFile for the root of the repository

getSolutionFile

public ISolutionFile getSolutionFile(String path)
Specified by:
getSolutionFile in interface ISolutionRepository
Returns:

getSolutionFile

public ISolutionFile getSolutionFile(String path,
                                     int actionOperation)
Specified by:
getSolutionFile in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:

getSolutionFile

public ISolutionFile getSolutionFile(IActionSequenceResource actionResource)
Description copied from interface: ISolutionRepository
Defaults action operation to execute

Specified by:
getSolutionFile in interface ISolutionRepository
Returns:

getSolutionFile

public ISolutionFile getSolutionFile(IActionSequenceResource actionResource,
                                     int actionOperation)
Specified by:
getSolutionFile in interface ISolutionRepository
actionOperation - - Type of action operation to be performed
Returns:

getSolutionFileLastModified

public long getSolutionFileLastModified(String path)
Description copied from interface: ISolutionRepository
Returns a long that represents the last time this file was modified Defaults to Action Operation of execute

Specified by:
getSolutionFileLastModified in interface ISolutionRepository

getSolutionFileLastModified

public long getSolutionFileLastModified(String path,
                                        int actionOperation)
Description copied from interface: ISolutionRepository
Returns a long that represents the last time this file was modified

Specified by:
getSolutionFileLastModified in interface ISolutionRepository
actionOperation - - Type of action operation to be performed

getSolutionStructure

public org.dom4j.Document getSolutionStructure(int actionOperation)
Description copied from interface: ISolutionRepository
Returns an XML document that represents the parent/child relationship of the current solution repository

Specified by:
getSolutionStructure in interface ISolutionRepository
Returns:
an XML document

getSolutionTree

public org.dom4j.Document getSolutionTree(int actionOperation)
Description copied from interface: ISolutionRepository
Returns an XML document that defines the entire solution tree. This general purpose method return all files/folders in the solution in an easily understood XML document.

Specified by:
getSolutionTree in interface ISolutionRepository
Returns:

getSolutionTree

public org.dom4j.Document getSolutionTree(int actionOperation,
                                          ISolutionFilter filter)
Specified by:
getSolutionTree in interface ISolutionRepository
filter - an implementation of a ISolutionFilter that determines which files will be returned
Returns:
Document representing the solution tree

getSolutions

public org.dom4j.Document getSolutions(int actionOperation)
Description copied from interface: ISolutionRepository
Gets an XML Document representing all the solutions and all the files within all the solutions

Specified by:
getSolutions in interface ISolutionRepository
Parameters:
actionOperation - Indicates what the list will be used for - execution or administration
Returns:
Document

getSolutions

public org.dom4j.Document getSolutions(String solutionName,
                                       String pathName,
                                       int actionOperation,
                                       boolean visibleOnly)
Description copied from interface: ISolutionRepository
Gets an XML Document representing all the files within a certain path within a solution

Specified by:
getSolutions in interface ISolutionRepository
Parameters:
solutionName - The name of the solution to get
pathName - The path from which to retrieve
actionOperation - Indicates what the list will be used for - execution or administration
Returns:
Document

getXSLName

public String getXSLName(org.dom4j.Document doc,
                         String solution,
                         String inputXSLName)
Description copied from interface: ISolutionRepository
Interprets the XSL name coming in against the document to see if there are any repository-specific changes based on display type associated with the XSL name

Specified by:
getXSLName in interface ISolutionRepository
Returns:
Actual XSL name to use

hasAccess

public boolean hasAccess(ISolutionFile file,
                         int actionOperation)
Description copied from interface: ISolutionRepository
Checks permission. Although implementations should enforce permissions, some clients may want to see beforehand whether or not an operation will succeed. An example is enabling/disable UI controls based on access.

Specified by:
hasAccess in interface ISolutionRepository
Parameters:
file - domain instance to check
actionOperation - permission requested (A constant from ISolutionRepository.)
Returns:
true if actionOperation is allowed for this aFile

init

public void init(IPentahoSession session)
Description copied from interface: ISolutionRepository
Initializes the solution repository with the user session

Specified by:
init in interface ISolutionRepository
Parameters:
session - The current user session

localizeDoc

public void localizeDoc(org.dom4j.Node document,
                        ISolutionFile file)
Specified by:
localizeDoc in interface ISolutionRepository

publish

public int publish(String baseUrl,
                   String path,
                   String fileName,
                   byte[] data,
                   boolean overwrite)
            throws PentahoAccessControlException
Description copied from interface: ISolutionRepository
Put a file into the solution repo. This method differs from addSolutionFile. Only Pentaho administrators can successfully execute addSolutionFile. addSolutionFile is a low-level operation. There is potentially more logic in the implementation of this method than in the implementation of addSolutionFile.

Specified by:
publish in interface ISolutionRepository
Returns:
Throws:
PentahoAccessControlException

publish

public int publish(String baseUrl,
                   String path,
                   String fileName,
                   File f,
                   boolean overwrite)
            throws PentahoAccessControlException
Description copied from interface: ISolutionRepository
Put a file into the solution repo. This method differs from addSolutionFile. Only Pentaho administrators can successfully execute addSolutionFile. addSolutionFile is a low-level operation. There is potentially more logic in the implementation of this method than in the implementation of addSolutionFile.

Specified by:
publish in interface ISolutionRepository
Returns:
constant from ISolutionRepository
Throws:
PentahoAccessControlException

reloadSolutionRepository

public void reloadSolutionRepository(IPentahoSession session,
                                     int loggingLevel)
Description copied from interface: ISolutionRepository
Loads or reloads a solution repository after a structure change.

Specified by:
reloadSolutionRepository in interface ISolutionRepository
Parameters:
session - - The session associated with this solution repository
loggingLevel - - The requested level of logging

removeSolutionFile

public boolean removeSolutionFile(String solution,
                                  String path,
                                  String fileName)
Description copied from interface: ISolutionRepository
Removes the file (fileName) from the path defined by the solution and path.

Specified by:
removeSolutionFile in interface ISolutionRepository
Returns:
- boolean indicating success

removeSolutionFile

public boolean removeSolutionFile(String solutionPath)
Specified by:
removeSolutionFile in interface ISolutionRepository

resetRepository

public void resetRepository()
Description copied from interface: ISolutionRepository
This method resets the caches used by the solution repository.

Specified by:
resetRepository in interface ISolutionRepository

resourceExists

public boolean resourceExists(String solutionPath)
Description copied from interface: ISolutionRepository
Returns a true if the specified resource exists. Default action operation to execute

Specified by:
resourceExists in interface ISolutionRepository
Parameters:
solutionPath - - path to the resource
Returns:
- boolean true if resource exists

resourceExists

public boolean resourceExists(String solutionPath,
                              int actionOperation)
Description copied from interface: ISolutionRepository
Returns a true if the specified resource exists.

Specified by:
resourceExists in interface ISolutionRepository
Parameters:
solutionPath - - path to the resource
actionOperation - - Type of action operation to be performed
Returns:
- boolean true if resource exists

resourceSize

public long resourceSize(String solutionPath)
Description copied from interface: ISolutionRepository
Returns the size of the specfied resource. If resource doesn't exit a -1 is returned Default action operation of execute

Specified by:
resourceSize in interface ISolutionRepository
Parameters:
solutionPath - - path to the resource
Returns:
- long value of the size

resourceSize

public long resourceSize(String solutionPath,
                         int actionOperation)
Description copied from interface: ISolutionRepository
Returns the size of the specfied resource. If resource doesn't exit a -1 is returned

Specified by:
resourceSize in interface ISolutionRepository
Parameters:
solutionPath - - path to the resource
actionOperation - - Type of action operation to be performed
Returns:
- long value of the size

setMessages

public void setMessages(List messages)
Description copied from interface: ISolutionRepository
Allows the caller to provide a List that will contain all log messages generated by the Solution Repository represented by this interface

Specified by:
setMessages in interface ISolutionRepository
Parameters:
messages - a List that String messages will be appended to

setPermissions

public void setPermissions(ISolutionFile file,
                           Map<IPermissionRecipient,IPermissionMask> acl)
                    throws PentahoAccessControlException
Description copied from interface: ISolutionRepository
Replaces the ACL on aFile.

Specified by:
setPermissions in interface ISolutionRepository
Parameters:
file - file whose ACL is to be modified
acl - new ACL
Throws:
PentahoAccessControlException

share

public void share(ISolutionFile file,
                  List<IPermissionRecipient> shareRecipients)
Description copied from interface: ISolutionRepository
Share file with recipient. This version is appropriate for sharing with a particular role. The semantics of share are encapsulated in the implementation. (The sharer comes from the IPentahoSession.)

Specified by:
share in interface ISolutionRepository
Parameters:
file - file to share
shareRecipients - the users or roles with which to share (aka share-ees)

solutionSynchronizationSupported

public boolean solutionSynchronizationSupported()
Specified by:
solutionSynchronizationSupported in interface ISolutionRepository
Returns:
True if solution synchronization is supported by this implementor

supportsAccessControls

public boolean supportsAccessControls()
Specified by:
supportsAccessControls in interface ISolutionRepository
Returns:
whether or not the concrete versions of this interface support access controls

synchronizeSolutionWithSolutionSource

public boolean synchronizeSolutionWithSolutionSource(IPentahoSession session)
                                              throws UnsupportedOperationException
Description copied from interface: ISolutionRepository
For ISolutionRepository implementations that have a source and a destination (for example, DBBasedSolutionRepository which has a file-system source and a DB destination) this is the entry point that allows synchronization. Implementors should throw an UnsupportedOperationException if there is no synchronization necessary (for example, the FileBasedSolutionRepository).

Specified by:
synchronizeSolutionWithSolutionSource in interface ISolutionRepository
Returns:
boolean true if the synchronization succeeded
Throws:
UnsupportedOperationException

debug

public void debug(String message)
Description copied from interface: ILogger
Log a message object with the DEBUG Level.

Specified by:
debug in interface ILogger
Parameters:
message - the message object to log.

debug

public void debug(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the DEBUG level including the stack trace of the Throwable error passed as parameter.

Specified by:
debug in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

error

public void error(String message)
Description copied from interface: ILogger
Log a message object with the ERROR Level.

Specified by:
error in interface ILogger
Parameters:
message - the message object to log.

error

public void error(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the ERROR level including the stack trace of the Throwable error passed as parameter.

Specified by:
error in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

fatal

public void fatal(String message)
Description copied from interface: ILogger
Log a message object with the FATAL Level.

Specified by:
fatal in interface ILogger
Parameters:
message - the message object to log.

fatal

public void fatal(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the FATAL level including the stack trace of the Throwable error passed as parameter.

Specified by:
fatal in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

getLoggingLevel

public int getLoggingLevel()
Description copied from interface: ILogger
Return the logging level for this Logger.

Specified by:
getLoggingLevel in interface ILogger
Returns:
logging level

info

public void info(String message)
Description copied from interface: ILogger
Log a message object with the INFO Level.

Specified by:
info in interface ILogger
Parameters:
message - the message object to log.

info

public void info(String message,
                 Throwable error)
Description copied from interface: ILogger
Log a message with the INFO level including the stack trace of the Throwable error passed as parameter.

Specified by:
info in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

setLoggingLevel

public void setLoggingLevel(int loggingLevel)
Description copied from interface: ILogger
Set the logging level for this Logger.

Valid logging levels are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.

Specified by:
setLoggingLevel in interface ILogger

trace

public void trace(String message)
Description copied from interface: ILogger
Log a message object with the TRACE Level.

Specified by:
trace in interface ILogger
Parameters:
message - the message object to log.

trace

public void trace(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the TRACE level including the stack trace of the Throwable error passed as parameter.

Specified by:
trace in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

warn

public void warn(String message)
Description copied from interface: ILogger
Log a message object with the WARN Level.

Specified by:
warn in interface ILogger
Parameters:
message - the message object to log.

warn

public void warn(String message,
                 Throwable error)
Description copied from interface: ILogger
Log a message with the WARN level including the stack trace of the Throwable error passed as parameter.

Specified by:
warn in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.