Package org.apache.jackrabbit.core.fs.db
Class OracleFileSystem
- java.lang.Object
-
- org.apache.jackrabbit.core.fs.db.DatabaseFileSystem
-
- org.apache.jackrabbit.core.fs.db.DbFileSystem
-
- org.apache.jackrabbit.core.fs.db.OracleFileSystem
-
- All Implemented Interfaces:
FileSystem
,DatabaseAware
- Direct Known Subclasses:
Oracle9FileSystem
public class OracleFileSystem extends DbFileSystem
OracleFileSystem
is a JDBC-basedFileSystem
implementation for Jackrabbit that persists file system entries in an Oracle database.It is configured through the following properties:
driver
: the FQN name of the JDBC driver class (default:"oracle.jdbc.OracleDriver"
)schema
: type of schema to be used (default:"oracle"
)url
: the database url (e.g."jdbc:oracle:thin:@[host]:[port]:[sid]"
)user
: the database userpassword
: the user's passwordschemaObjectPrefix
: prefix to be prepended to schema objectstablespace
: the tablespace to use for tables (also used for indexes ifindexTablespace
is omitted)indexTablespace
: the tablespace to use for indexes
DbFileSystem
.The following is a fragment from a sample configuration:
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/> <param name="user" value="scott"/> <param name="password" value="tiger"/> <param name="schemaObjectPrefix" value="rep_"/> <param name="tablespace" value="user"/> <param name="indexTablespace" value="user"/> </FileSystem>
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_TABLESPACE_CLAUSE
The default tablespace clause used whentablespace
orindexTablespace
are not specified.protected static String
INDEX_TABLESPACE_VARIABLE
Name of the replacement variable in the DDL forindexTablespace
.protected String
indexTablespace
The Oracle tablespace to use for indexesprotected String
tablespace
The Oracle tablespace to use for tablesprotected static String
TABLESPACE_VARIABLE
Name of the replacement variable in the DDL fortablespace
.-
Fields inherited from class org.apache.jackrabbit.core.fs.db.DbFileSystem
dataSourceName, driver, password, url, user
-
Fields inherited from class org.apache.jackrabbit.core.fs.db.DatabaseFileSystem
conHelper, copyFileSQL, copyFilesSQL, deleteFileSQL, deleteFolderSQL, INITIAL_BUFFER_SIZE, initialized, insertFileSQL, insertFolderSQL, schema, schemaObjectPrefix, selectChildCountSQL, selectDataSQL, selectExistSQL, selectFileAndFolderNamesSQL, selectFileExistSQL, selectFileNamesSQL, selectFolderExistSQL, selectFolderNamesSQL, selectLastModifiedSQL, selectLengthSQL, updateDataSQL, updateLastModifiedSQL
-
Fields inherited from interface org.apache.jackrabbit.core.fs.FileSystem
SEPARATOR, SEPARATOR_CHAR
-
-
Constructor Summary
Constructors Constructor Description OracleFileSystem()
Creates a newOracleFileSystem
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildSQLStatements()
Builds the SQL statementsprotected CheckSchemaOperation
createCheckSchemaOperation()
This method is called fromDatabaseFileSystem.init()
after theDatabaseFileSystem.createConnectionHelper(DataSource)
method, and returns a defaultCheckSchemaOperation
.protected ConnectionHelper
createConnectionHelper(DataSource dataSrc)
This method is called from theDatabaseFileSystem.init()
method of this class and returns aConnectionHelper
instance which is assigned to theconHelper
field.String
getIndexTablespace()
Returns the configured Oracle tablespace for indexes.String
getTablespace()
Returns the configured Oracle tablespace for tables.void
setIndexTablespace(String tablespaceName)
Sets the Oracle tablespace for indexes.void
setTablespace(String tablespaceName)
Sets the Oracle tablespace for tables.-
Methods inherited from class org.apache.jackrabbit.core.fs.db.DbFileSystem
equals, getDataSource, getDataSourceName, getDriver, getPassword, getUrl, getUser, hashCode, setConnectionFactory, setDataSourceName, setDriver, setPassword, setUrl, setUser
-
Methods inherited from class org.apache.jackrabbit.core.fs.db.DatabaseFileSystem
close, createDeepFolder, createFolder, deleteFile, deleteFolder, exists, getInputStream, getOutputStream, getSchema, getSchemaObjectPrefix, hasChildren, init, isFile, isFolder, isSchemaCheckEnabled, lastModified, length, list, listFiles, listFolders, setSchema, setSchemaCheckEnabled, setSchemaObjectPrefix, verifyRootExists
-
-
-
-
Field Detail
-
DEFAULT_TABLESPACE_CLAUSE
protected static final String DEFAULT_TABLESPACE_CLAUSE
The default tablespace clause used whentablespace
orindexTablespace
are not specified.- See Also:
- Constant Field Values
-
TABLESPACE_VARIABLE
protected static final String TABLESPACE_VARIABLE
Name of the replacement variable in the DDL fortablespace
.- See Also:
- Constant Field Values
-
INDEX_TABLESPACE_VARIABLE
protected static final String INDEX_TABLESPACE_VARIABLE
Name of the replacement variable in the DDL forindexTablespace
.- See Also:
- Constant Field Values
-
tablespace
protected String tablespace
The Oracle tablespace to use for tables
-
indexTablespace
protected String indexTablespace
The Oracle tablespace to use for indexes
-
-
Method Detail
-
getTablespace
public String getTablespace()
Returns the configured Oracle tablespace for tables.- Returns:
- the configured Oracle tablespace for tables.
-
setTablespace
public void setTablespace(String tablespaceName)
Sets the Oracle tablespace for tables.- Parameters:
tablespaceName
- the Oracle tablespace for tables.
-
getIndexTablespace
public String getIndexTablespace()
Returns the configured Oracle tablespace for indexes.- Returns:
- the configured Oracle tablespace for indexes.
-
setIndexTablespace
public void setIndexTablespace(String tablespaceName)
Sets the Oracle tablespace for indexes.- Parameters:
tablespaceName
- the Oracle tablespace for indexes.
-
createConnectionHelper
protected ConnectionHelper createConnectionHelper(DataSource dataSrc) throws Exception
This method is called from theDatabaseFileSystem.init()
method of this class and returns aConnectionHelper
instance which is assigned to theconHelper
field. Subclasses may override it to return a specialized connection helper.- Overrides:
createConnectionHelper
in classDatabaseFileSystem
- Parameters:
dataSrc
- theDataSource
of this persistence manager- Returns:
- a
ConnectionHelper
- Throws:
Exception
- on error
-
createCheckSchemaOperation
protected CheckSchemaOperation createCheckSchemaOperation()
This method is called fromDatabaseFileSystem.init()
after theDatabaseFileSystem.createConnectionHelper(DataSource)
method, and returns a defaultCheckSchemaOperation
. Subclasses can overrride this implementation to get a customized implementation.- Overrides:
createCheckSchemaOperation
in classDatabaseFileSystem
- Returns:
- a new
CheckSchemaOperation
instance
-
buildSQLStatements
protected void buildSQLStatements()
Builds the SQL statementsSince Oracle treats emtpy strings and BLOBs as null values the SQL statements had to be adapated accordingly. The following changes were necessary:
- The distinction between file and folder entries is based on FSENTRY_LENGTH being null/not null rather than FSENTRY_DATA being null/not null because FSENTRY_DATA of a 0-length (i.e. empty) file is null in Oracle.
- Folder entries: Since the root folder has an empty name (which would be null in Oracle), an empty name is automatically converted and treated as " ".
- Overrides:
buildSQLStatements
in classDatabaseFileSystem
-
-