So, Simple steps to use JCR | Jackrabbit with Database..
1. Start a liferay instance with any database you need. For me its, MSSQL 2005 Express Edition.
2. That will create a repository.xml file in data/jackrabbit/ folder.
Below is a default repository.xml file.
Change the content to include filesystem and persistence manager in this way. Use your correct username and password.
3. Now, Add the properties below in portal-ext.properties file. We need to let liferay know that we are going to store images and document in db via JCR.
com.liferay.portlet.documentlibrary.store.JCRStore is what we need to store documents via JCR.
That's it. Restart your liferay instance and you should see the files being stored in database.
Check my post below to see if database size increases when you add few files.
[SQL Server] Get size of database in SQL Server 2005
All done.
Until next time. :)
1. Start a liferay instance with any database you need. For me its, MSSQL 2005 Express Edition.
2. That will create a repository.xml file in data/jackrabbit/ folder.
Below is a default repository.xml file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<Repository> | |
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> | |
<param name="path" value="${rep.home}/repository" /> | |
</FileSystem> | |
<!-- | |
Database File System (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_R_FS_"/> | |
</FileSystem>--> | |
<Security appName="Jackrabbit"> | |
<AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" /> | |
<LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule"> | |
<param name="anonymousId" value="anonymous" /> | |
</LoginModule> | |
</Security> | |
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="liferay" /> | |
<Workspace name="${wsp.name}"> | |
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> | |
<param name="path" value="${wsp.home}" /> | |
</FileSystem> | |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager" /> | |
<!-- | |
Database File System and Persistence (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> | |
<param name="driver" value="com.mysql.jdbc.Driver" /> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql" /> | |
<param name="schemaObjectPrefix" value="J_PM_${wsp.name}_" /> | |
<param name="externalBLOBs" value="false" /> | |
</PersistenceManager> | |
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/> | |
</FileSystem>--> | |
</Workspace> | |
<Versioning rootPath="${rep.home}/version"> | |
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem"> | |
<param name="path" value="${rep.home}/version" /> | |
</FileSystem> | |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager" /> | |
<!-- | |
Database File System and Persistence (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_V_FS_"/> | |
</FileSystem> | |
<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> | |
<param name="driver" value="com.mysql.jdbc.Driver" /> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql" /> | |
<param name="schemaObjectPrefix" value="J_V_PM_" /> | |
<param name="externalBLOBs" value="false" /> | |
</PersistenceManager>--> | |
</Versioning> | |
<!-- | |
Cluster Configuration | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<Cluster id="node_1" syncDelay="5"> | |
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal"> | |
<param name="revision" value="${rep.home}/revision"/> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr"/> | |
<param name="user" value=""/> | |
<param name="password" value=""/> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_C_"/> | |
</Journal> | |
</Cluster>--> | |
</Repository> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<Repository> | |
<!-- | |
Database File System (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem"> | |
<param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/> | |
<param name="url" value="jdbc:jtds:sqlserver://localhost/lportal" /> | |
<param name="user" value="ravi" /> | |
<param name="password" value="test" /> | |
<param name="schema" value="mssql"/> | |
<param name="schemaObjectPrefix" value="J_R_FS_"/> | |
</FileSystem> | |
<Security appName="Jackrabbit"> | |
<AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" /> | |
<LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule"> | |
<param name="anonymousId" value="anonymous" /> | |
</LoginModule> | |
</Security> | |
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="liferay" /> | |
<Workspace name="${wsp.name}"> | |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MSSqlPersistenceManager"> | |
<param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/> | |
<param name="url" value="jdbc:jtds:sqlserver://localhost/lportal" /> | |
<param name="user" value="ravi" /> | |
<param name="password" value="test" /> | |
<param name="schema" value="mssql"/> | |
<param name="schemaObjectPrefix" value="J_PM_${wsp.name}_"/> | |
<param name="externalBLOBs" value="false"/> | |
</PersistenceManager> | |
<FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem"> | |
<param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/> | |
<param name="url" value="jdbc:jtds:sqlserver://localhost/lportal" /> | |
<param name="user" value="ravi" /> | |
<param name="password" value="test" /> | |
<param name="schema" value="mssql"/> | |
<param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/> | |
</FileSystem> | |
<!-- | |
Database File System and Persistence (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> | |
<param name="driver" value="com.mysql.jdbc.Driver" /> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql" /> | |
<param name="schemaObjectPrefix" value="J_PM_${wsp.name}_" /> | |
<param name="externalBLOBs" value="false" /> | |
</PersistenceManager> | |
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/> | |
</FileSystem>--> | |
</Workspace> | |
<Versioning rootPath="${rep.home}/version"> | |
<FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem"> | |
<param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/> | |
<param name="url" value="jdbc:jtds:sqlserver://localhost/lportal" /> | |
<param name="user" value="ravi" /> | |
<param name="password" value="test" /> | |
<param name="schema" value="mssql"/> | |
<param name="schemaObjectPrefix" value="J_V_FS_"/> | |
</FileSystem> | |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MSSqlPersistenceManager"> | |
<param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/> | |
<param name="url" value="jdbc:jtds:sqlserver://localhost/lportal" /> | |
<param name="user" value="ravi" /> | |
<param name="password" value="test" /> | |
<param name="schema" value="mssql"/> | |
<param name="schemaObjectPrefix" value="J_V_PM_"/> | |
<param name="externalBLOBs" value="false"/> | |
</PersistenceManager> | |
<!-- | |
Database File System and Persistence (Cluster Configuration) | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_V_FS_"/> | |
</FileSystem> | |
<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager"> | |
<param name="driver" value="com.mysql.jdbc.Driver" /> | |
<param name="url" value="jdbc:mysql://localhost/jcr" /> | |
<param name="user" value="" /> | |
<param name="password" value="" /> | |
<param name="schema" value="mysql" /> | |
<param name="schemaObjectPrefix" value="J_V_PM_" /> | |
<param name="externalBLOBs" value="false" /> | |
</PersistenceManager>--> | |
</Versioning> | |
<!-- | |
Cluster Configuration | |
This is sample configuration for mysql persistence that can be used for | |
clustering Jackrabbit. For other databases, change the connection, | |
credentials, and schema settings. | |
--> | |
<!--<Cluster id="node_1" syncDelay="5"> | |
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal"> | |
<param name="revision" value="${rep.home}/revision"/> | |
<param name="driver" value="com.mysql.jdbc.Driver"/> | |
<param name="url" value="jdbc:mysql://localhost/jcr"/> | |
<param name="user" value=""/> | |
<param name="password" value=""/> | |
<param name="schema" value="mysql"/> | |
<param name="schemaObjectPrefix" value="J_C_"/> | |
</Journal> | |
</Cluster>--> | |
<!--<RepositoryLockMechanism class="org.apache.jackrabbit.core.util.CooperativeFileLock" /> --> | |
</Repository> |
com.liferay.portlet.documentlibrary.store.JCRStore is what we need to store documents via JCR.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jcr.initialize.on.startup=true | |
# | |
# Set the name of a class that implements | |
# com.liferay.portlet.documentlibrary.store.Store. The | |
# document library server will use this to persist documents. | |
# | |
dl.store.impl=com.liferay.portlet.documentlibrary.store.JCRStore | |
## | |
## Images | |
## | |
# | |
# In versions prior to 6.1, the Image Gallery portlet supported persisting | |
# images via com.liferay.portal.image.DatabaseHook, | |
# com.liferay.portal.image.DLHook, or | |
# com.liferay.portal.image.FileSystemHook. Since 6.1, only DLHook is | |
# supported. | |
# | |
# Set this property to the hook implementation to trigger automatic data | |
# migration during an upgrade. | |
# | |
image.hook.impl=com.liferay.portal.image.DatabaseHook |
Check my post below to see if database size increases when you add few files.
[SQL Server] Get size of database in SQL Server 2005
All done.
Until next time. :)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.