org.pentaho.platform.repository.content
Class ContentLocation

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.PentahoBase
      extended by org.pentaho.platform.repository.content.ContentLocation
All Implemented Interfaces:
Serializable, ILogger, IContentLocation, ISearchable

public class ContentLocation
extends PentahoBase
implements IContentLocation, ISearchable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pentaho.platform.engine.core.system.PentahoBase
EMPTYLOGID, LOGID_MASK1, LOGID_MASK2, LOGID_SEPARATOR
 
Fields inherited from interface org.pentaho.platform.api.repository.ISearchable
SEARCH_TYPE_PHRASE, SEARCH_TYPE_WORDS_AND, SEARCH_TYPE_WORDS_OR
 
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
 
Method Summary
 IContentItem getContentItemById(String itemId)
          Gets a content item by its Id - this is the most efficient way to get a content item from a location
 IContentItem getContentItemByName(String itemName)
          Gets a child content item by name.
 IContentItem getContentItemByPath(String path)
          Returns the contentitem with the specified path
 Iterator getContentItemIterator()
          Iterates over registered content items.
 String getDescription()
           
 String getDirPath()
           
 String getId()
           
 Log getLogger()
           
 List getMessages()
           
 String getName()
           
 String getPhraseSearchQueryName()
           
 int getRevision()
           
 String[] getSearchableColumns()
           
 String getSearchableTable()
           
 String getSolutionId()
           
 File getTmpFile(String fileSuffix)
          Gets a temporary file in the location.
 File getTmpFile(String fileSuffix, boolean deleteOnExit)
          Gets a temporary file in the location.
 File makeSubdirectory(String subDirName)
          Creates a subdirectory in the content location.
 IContentItem newContentItem(String itemName, String title, String extension, String mType, String url, int writeMode)
          Create a new ContentItem parented to this content location.
 IContentItem newContentItem(String cntId, String itemName, String title, String extension, String mType, String url, int writeMode)
          Create a new ContentItem parented to this content location.
 void setDescription(String description)
           
 void setDirPath(String dirPath)
           
 void setId(String id)
           
 void setName(String name)
           
 void setRevision(int revision)
           
 void setSolutionId(String solutionId)
           
 String toString()
           
 
Methods inherited from class org.pentaho.platform.engine.core.system.PentahoBase
debug, debug, error, error, fatal, fatal, genLogIdFromInfo, genLogIdFromInfo, genLogIdFromSession, getLoggingLevel, getLogId, getObjectName, info, info, setLoggingLevel, setLogId, trace, trace, warn, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newContentItem

public IContentItem newContentItem(String itemName,
                                   String title,
                                   String extension,
                                   String mType,
                                   String url,
                                   int writeMode)
                            throws ContentException
Description copied from interface: IContentLocation
Create a new ContentItem parented to this content location.

Specified by:
newContentItem in interface IContentLocation
Parameters:
itemName - The name of the content item
title - The title of the content item
extension - The extension (i.e. .txt or .pdf) of the content item.
mType - The mime type of the content item
url - Optional URL to get to the content.
writeMode - The write mode of the content item. Please see IContentItem for valid write modes
Returns:
A new IContentItem instance, parented to the ContentLocation
Throws:
ContentException

newContentItem

public IContentItem newContentItem(String cntId,
                                   String itemName,
                                   String title,
                                   String extension,
                                   String mType,
                                   String url,
                                   int writeMode)
                            throws ContentException
Description copied from interface: IContentLocation
Create a new ContentItem parented to this content location. This version is used when the content Id is already generated.

Specified by:
newContentItem in interface IContentLocation
Parameters:
cntId - The Identifier for the new content item
itemName - The name of the content item
title - The title of the content item
extension - The extension (i.e. .txt or .pdf) of the content item.
mType - The mime type of the content item
url - Optional URL to get to the content.
writeMode - The write mode of the content item. Please see IContentItem for valid write modes
Returns:
A new IContentItem instance, parented to the ContentLocation
Throws:
ContentException

getContentItemByPath

public IContentItem getContentItemByPath(String path)
Description copied from interface: IContentLocation
Returns the contentitem with the specified path

Specified by:
getContentItemByPath in interface IContentLocation
Parameters:
path - The path to look for
Returns:
The content item

getMessages

public List getMessages()

getRevision

public int getRevision()
Specified by:
getRevision in interface IContentLocation
Returns:
Returns the revision.

setRevision

public void setRevision(int revision)
Parameters:
revision - The revision to set.

getContentItemIterator

public Iterator getContentItemIterator()
Iterates over registered content items.

Specified by:
getContentItemIterator in interface IContentLocation
Returns:
Iterator of the child content

getContentItemById

public IContentItem getContentItemById(String itemId)
Description copied from interface: IContentLocation
Gets a content item by its Id - this is the most efficient way to get a content item from a location

Specified by:
getContentItemById in interface IContentLocation
Parameters:
itemId - The id to retrieve
Returns:
The content item

getContentItemByName

public IContentItem getContentItemByName(String itemName)
Description copied from interface: IContentLocation
Gets a child content item by name. Returns the ContentItem with the specified name, and a parent of the content location

Specified by:
getContentItemByName in interface IContentLocation
Parameters:
itemName - The name to find
Returns:
ContentItem

getTmpFile

public File getTmpFile(String fileSuffix)
                throws ContentException
Gets a temporary file in the location.

Specified by:
getTmpFile in interface IContentLocation
Parameters:
fileSuffix - What the file suffix should be. If null, then .tmp will be used.
Returns:
File that is unique within the directory inside this location.
Throws:
ContentException

getTmpFile

public File getTmpFile(String fileSuffix,
                       boolean deleteOnExit)
                throws ContentException
Gets a temporary file in the location.

Specified by:
getTmpFile in interface IContentLocation
Parameters:
fileSuffix - What the file suffix should be. If null, then .tmp will be used.
deleteOnExit - If true, will call the files' deleteOnExit method which will attempt to delete the file on VM termination.
Returns:
File that is unique within the directory inside this location.
Throws:
ContentException

makeSubdirectory

public File makeSubdirectory(String subDirName)
                      throws ContentException
Creates a subdirectory in the content location.

Specified by:
makeSubdirectory in interface IContentLocation
Parameters:
subDirName - The directory name to create
Returns:
File created
Throws:
ContentException

getDirPath

public String getDirPath()
Specified by:
getDirPath in interface IContentLocation
Returns:
Returns the dirPath.

setDirPath

public void setDirPath(String dirPath)
Parameters:
dirPath - The dirPath to set.

getId

public String getId()
Specified by:
getId in interface IContentLocation
Returns:
Returns the id.

setId

public void setId(String id)
Parameters:
id - The id to set.

getName

public String getName()
Specified by:
getName in interface IContentLocation
Returns:
Returns the name.

setName

public void setName(String name)
Parameters:
name - The name to set.

getSolutionId

public String getSolutionId()
Specified by:
getSolutionId in interface IContentLocation
Returns:
Returns the solutionId.

setSolutionId

public void setSolutionId(String solutionId)
Parameters:
solutionId - The solutionId to set.

getDescription

public String getDescription()
Specified by:
getDescription in interface IContentLocation
Returns:
Returns the description.

setDescription

public void setDescription(String description)
Parameters:
description - The description to set.

getLogger

public Log getLogger()
Specified by:
getLogger in class PentahoBase

getSearchableColumns

public String[] getSearchableColumns()
Specified by:
getSearchableColumns in interface ISearchable
Returns:
Returns an array of the char/varchar columns that can be searched.

getSearchableTable

public String getSearchableTable()
Specified by:
getSearchableTable in interface ISearchable
Returns:
Returns the name of the hibernated object which will be used in the search.

getPhraseSearchQueryName

public String getPhraseSearchQueryName()
Specified by:
getPhraseSearchQueryName in interface ISearchable
Returns:
Returns the fully-package-qualified name of a named query in the Hibernate Schema that supports a full-text search of all searchable columns. The parameter name for the search term in the query must be :searchTerm or the query will fail.

toString

public String toString()
Overrides:
toString in class Object