站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.2 API 英文版文档

HibernateStore - JBOSS Portal 2.2 API 英文版文档


org.jboss.portal.cms.hibernate
Class HibernateStore

java.lang.Object
  extended byorg.jboss.portal.cms.hibernate.HibernateStore
All Implemented Interfaces:
org.apache.jackrabbit.core.fs.FileSystem

public class HibernateStore
extends java.lang.Object
implements org.apache.jackrabbit.core.fs.FileSystem

This is a FileSystem store using Hibernate, built on the DBFilesystem class packaged with Apache Jackrabbit that persists file system entries in a database table.

The required schema is created by hibernate using the portal datasource.

Configuration of this store should look like this:

 <FileSystem class="org.jboss.portal.cms.hibernate.HibernateStore">
 <param name="datasource" value="java:/PortalDS"/>
 <param name="isolation" value="2"/>
 <param name="batch_size" value="0"/>
 <param name="auto" value="update"/>
 <param name="provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
 <param name="schemaObjectPrefix" value="VersionEntry|CMSEntry|RepositoryEntry"/>
 </FileSystem>
 


Field Summary
protected  java.lang.String auto
           
protected  java.lang.String autocommit
           
protected  java.lang.String batch_size
           
protected  java.sql.Connection con
           
protected  java.sql.PreparedStatement copyFilesStmt
           
protected  java.sql.PreparedStatement copyFileStmt
           
protected  java.lang.String datasource
           
protected  java.lang.String deleteFileStmt
           
protected  java.lang.String deleteFolderStmt
           
protected static int INITIAL_BUFFER_SIZE
           
protected  boolean initialized
           
protected  java.lang.String insertFileStmt
           
protected  java.lang.String isolation
           
protected  java.lang.String provider_class
           
protected static java.lang.String SCHEMA_OBJECT_PREFIX_VARIABLE
           
protected  java.lang.String schemaObjectPrefix
           
protected  java.lang.String selectChildCountStmt
           
protected  java.lang.String selectDataStmt
           
protected  java.lang.String selectExistStmt
           
protected  java.sql.PreparedStatement selectFileAndFolderNamesStmt
           
protected  java.lang.String selectFileExistStmt
           
protected  java.sql.PreparedStatement selectFileNamesStmt
           
protected  java.lang.String selectFolderExistStmt
           
protected  java.sql.PreparedStatement selectFolderNamesStmt
           
protected  java.lang.String selectLastModifiedStmt
           
protected  java.lang.String selectLengthStmt
           
protected  java.sql.PreparedStatement updateLastModifiedStmt
           
 
Fields inherited from interface org.apache.jackrabbit.core.fs.FileSystem
SEPARATOR, SEPARATOR_CHAR
 
Constructor Summary
HibernateStore()
          Default constructor
 
Method Summary
protected  void checkSchema()
          Checks if the required schema objects exist and creates them if they don't exist yet.
 void close()
           
 void copy(java.lang.String srcPath, java.lang.String destPath)
           
protected  void copyDeepFolder(java.lang.String srcPath, java.lang.String destPath)
          Recursively copies the given folder to the given destination.
protected  void copyFile(java.lang.String srcPath, java.lang.String destPath)
          Copies the given file entry to the given destination path.
protected  void createDeepFolder(java.lang.String folderPath)
          Creates the specified files system folder entry, recursively creating any non-existing intermediate folder entries.
 void createFolder(java.lang.String folderPath)
           
 void deleteFile(java.lang.String filePath)
           
 void deleteFolder(java.lang.String folderPath)
           
 boolean exists(java.lang.String path)
           
 java.lang.String getAuto()
           
 java.lang.String getAutocommit()
           
 java.lang.String getBatch_size()
           
 java.lang.String getDatasource()
           
 java.io.InputStream getInputStream(java.lang.String filePath)
           
 java.lang.String getIsolation()
           
protected  org.hibernate.Session getNewConnection()
           
 java.io.OutputStream getOutputStream(java.lang.String filePath)
           
 java.lang.String getProvider_class()
           
 org.apache.jackrabbit.core.fs.RandomAccessOutputStream getRandomAccessOutputStream(java.lang.String filePath)
           
 java.lang.String getSchemaObjectPrefix()
           
 boolean hasChildren(java.lang.String path)
           
 void init()
           
 boolean isFile(java.lang.String path)
           
 boolean isFolder(java.lang.String path)
           
 long lastModified(java.lang.String path)
           
 long length(java.lang.String filePath)
           
 java.lang.String[] list(java.lang.String folderPath)
           
 java.lang.String[] listFiles(java.lang.String folderPath)
           
 java.lang.String[] listFolders(java.lang.String folderPath)
           
 void move(java.lang.String srcPath, java.lang.String destPath)
           
 void setAuto(java.lang.String auto)
           
 void setAutocommit(java.lang.String autocommit)
           
 void setBatch_size(java.lang.String batch_size)
           
 void setDatasource(java.lang.String datasource)
           
 void setIsolation(java.lang.String isolation)
           
 void setProvider_class(java.lang.String provider_class)
           
 void setSchemaObjectPrefix(java.lang.String schemaObjectPrefix)
           
 void touch(java.lang.String filePath)
           
protected  void verifyRootExists()
          Verifies that the root file system entry exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_OBJECT_PREFIX_VARIABLE

protected static final java.lang.String SCHEMA_OBJECT_PREFIX_VARIABLE
See Also:
Constant Field Values

initialized

protected boolean initialized

datasource

protected java.lang.String datasource

batch_size

protected java.lang.String batch_size

isolation

protected java.lang.String isolation

auto

protected java.lang.String auto

autocommit

protected java.lang.String autocommit

provider_class

protected java.lang.String provider_class

schemaObjectPrefix

protected java.lang.String schemaObjectPrefix

INITIAL_BUFFER_SIZE

protected static final int INITIAL_BUFFER_SIZE
See Also:
Constant Field Values

con

protected java.sql.Connection con

selectExistStmt

protected java.lang.String selectExistStmt

selectFolderExistStmt

protected java.lang.String selectFolderExistStmt

selectFileExistStmt

protected java.lang.String selectFileExistStmt

selectChildCountStmt

protected java.lang.String selectChildCountStmt

selectDataStmt

protected java.lang.String selectDataStmt

selectLastModifiedStmt

protected java.lang.String selectLastModifiedStmt

selectLengthStmt

protected java.lang.String selectLengthStmt

deleteFileStmt

protected java.lang.String deleteFileStmt

deleteFolderStmt

protected java.lang.String deleteFolderStmt

insertFileStmt

protected java.lang.String insertFileStmt

selectFileNamesStmt

protected java.sql.PreparedStatement selectFileNamesStmt

selectFolderNamesStmt

protected java.sql.PreparedStatement selectFolderNamesStmt

selectFileAndFolderNamesStmt

protected java.sql.PreparedStatement selectFileAndFolderNamesStmt

updateLastModifiedStmt

protected java.sql.PreparedStatement updateLastModifiedStmt

copyFileStmt

protected java.sql.PreparedStatement copyFileStmt

copyFilesStmt

protected java.sql.PreparedStatement copyFilesStmt
Constructor Detail

HibernateStore

public HibernateStore()
Default constructor

Method Detail

getDatasource

public java.lang.String getDatasource()

setDatasource

public void setDatasource(java.lang.String datasource)

getBatch_size

public java.lang.String getBatch_size()

setBatch_size

public void setBatch_size(java.lang.String batch_size)

getIsolation

public java.lang.String getIsolation()

setIsolation

public void setIsolation(java.lang.String isolation)

getAuto

public java.lang.String getAuto()

setAuto

public void setAuto(java.lang.String auto)

getAutocommit

public java.lang.String getAutocommit()

setAutocommit

public void setAutocommit(java.lang.String autocommit)

getProvider_class

public java.lang.String getProvider_class()

setProvider_class

public void setProvider_class(java.lang.String provider_class)

getSchemaObjectPrefix

public java.lang.String getSchemaObjectPrefix()

setSchemaObjectPrefix

public void setSchemaObjectPrefix(java.lang.String schemaObjectPrefix)

init

public void init()
          throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
init in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

close

public void close()
           throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
close in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

createFolder

public void createFolder(java.lang.String folderPath)
                  throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
createFolder in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

deleteFile

public void deleteFile(java.lang.String filePath)
                throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
deleteFile in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

deleteFolder

public void deleteFolder(java.lang.String folderPath)
                  throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
deleteFolder in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

exists

public boolean exists(java.lang.String path)
               throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
exists in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

isFile

public boolean isFile(java.lang.String path)
               throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
isFile in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

isFolder

public boolean isFolder(java.lang.String path)
                 throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
isFolder in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

lastModified

public long lastModified(java.lang.String path)
                  throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
lastModified in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

length

public long length(java.lang.String filePath)
            throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
length in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

hasChildren

public boolean hasChildren(java.lang.String path)
                    throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
hasChildren in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

list

public java.lang.String[] list(java.lang.String folderPath)
                        throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
list in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

listFiles

public java.lang.String[] listFiles(java.lang.String folderPath)
                             throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
listFiles in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

listFolders

public java.lang.String[] listFolders(java.lang.String folderPath)
                               throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
listFolders in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

touch

public void touch(java.lang.String filePath)
           throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
touch in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

getInputStream

public java.io.InputStream getInputStream(java.lang.String filePath)
                                   throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
getInputStream in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

getOutputStream

public java.io.OutputStream getOutputStream(java.lang.String filePath)
                                     throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
getOutputStream in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

getRandomAccessOutputStream

public org.apache.jackrabbit.core.fs.RandomAccessOutputStream getRandomAccessOutputStream(java.lang.String filePath)
                                                                                   throws org.apache.jackrabbit.core.fs.FileSystemException,
                                                                                          java.lang.UnsupportedOperationException
Specified by:
getRandomAccessOutputStream in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException
java.lang.UnsupportedOperationException

copy

public void copy(java.lang.String srcPath,
                 java.lang.String destPath)
          throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
copy in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

move

public void move(java.lang.String srcPath,
                 java.lang.String destPath)
          throws org.apache.jackrabbit.core.fs.FileSystemException
Specified by:
move in interface org.apache.jackrabbit.core.fs.FileSystem
Throws:
org.apache.jackrabbit.core.fs.FileSystemException

checkSchema

protected void checkSchema()
                    throws java.lang.Exception
Checks if the required schema objects exist and creates them if they don't exist yet.

Throws:
java.lang.Exception - if an error occurs

verifyRootExists

protected void verifyRootExists()
                         throws java.lang.Exception
Verifies that the root file system entry exists. If it doesn't exist yet it will be automatically created.

Throws:
java.lang.Exception - if an error occurs

createDeepFolder

protected void createDeepFolder(java.lang.String folderPath)
                         throws org.apache.jackrabbit.core.fs.FileSystemException
Creates the specified files system folder entry, recursively creating any non-existing intermediate folder entries.

Parameters:
folderPath - folder entry to create
Throws:
org.apache.jackrabbit.core.fs.FileSystemException - if an error occurs

copyDeepFolder

protected void copyDeepFolder(java.lang.String srcPath,
                              java.lang.String destPath)
                       throws org.apache.jackrabbit.core.fs.FileSystemException
Recursively copies the given folder to the given destination.

Parameters:
srcPath - folder to be copied
destPath - destination path to which the folder is to be copied
Throws:
org.apache.jackrabbit.core.fs.FileSystemException - if an error occurs

copyFile

protected void copyFile(java.lang.String srcPath,
                        java.lang.String destPath)
                 throws org.apache.jackrabbit.core.fs.FileSystemException
Copies the given file entry to the given destination path. The parent folder of the destination path will be created if it doesn't exist already. If the destination path refers to an existing file, the file will be overwritten.

Parameters:
srcPath - file to be copied
destPath - destination path to which the file is to be copied
Throws:
org.apache.jackrabbit.core.fs.FileSystemException - if an error occurs

getNewConnection

protected org.hibernate.Session getNewConnection()
                                          throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException