Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

       某些时候,你可能需要将URule相关规则文件存储到数据库表当中(我们推荐的存储方式),这时你可以新建一个内容如下所示的xml文件,然后通过urule.repository.xml属性指定好该文件位置即可,下面是几种常见的用数据库来作为repository的xml配置文件(因条件所限,除db2配置未测试外,其它皆经过测试),实际使用时我们只需要修改其中的数据库连接即可。

MySQL连接配置文件

Code Block
title将文件存储到数据库中jackrabbit配置示例
themeEclipse
linenumberstrue
languagehtml/xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN" "http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
<Repository>
  <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="repo_"/>
  </FileSystem>
  <Security appName="Jackrabbit">
    <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"></AccessManager>
    <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
      <param name="anonymousId" value="anonymous" />
      <param name="adminId" value="admin" />
    </LoginModule>
  </Security>
  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="repo_ds_"/>
  </DataStore>
  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
  <Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="repo_${wsp.name}_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/><!-- warning, this is not the schema name, it's the db type -->
      <param name="schemaObjectPrefix" value="repo_pm_${wsp.name}_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Workspace>
  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="repo_fsver_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
      <param name="url" value="jdbc:mysql://localhost:3306/urule?useUnicode=true&amp;characterEncoding=UTF-8"/>
      <param name="user" value="root"/>
      <param name="password" value="12345"/>
      <param name="schema" value="mysql"/><!-- warning, this is not the schema name, it's the db type -->
      <param name="schemaObjectPrefix" value="repo_ver_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Versioning>
</Repository>

 

Oracle连接配置文件

Code Block
titleOracle连接配置文件
themeEclipse
linenumberstrue
languagehtml/xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN" "http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
<Repository>
  <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_"/>
  </FileSystem>
  <Security appName="Jackrabbit">
    <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"></AccessManager>
    <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
      <param name="anonymousId" value="anonymous" />
      <param name="adminId" value="admin" />
    </LoginModule>
  </Security>
  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_ds_"/>
  </DataStore>
  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
  <Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_${wsp.name}_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_pm_${wsp.name}_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Workspace>
  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_fsver_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
      <param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
      <param name="url" value="jdbc:oracle:thin:@192.168.18.140:1521:ORCL"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="oracle"/>
      <param name="schemaObjectPrefix" value="repo_ver_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Versioning>
</Repository>
Info
title使用Oracle连接配置时的注意事项

如果当前Oracle的版本Oracle9,那么上述配置中的"org.apache.jackrabbit.core.fs.db.OracleFileSystem"类要改成“org.apache.jackrabbit.core.fs.db.Oracle9FileSystem”;“org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager”类同样也需要改“org.apache.jackrabbit.core.persistence.pool.Oracle9PersistenceManager”。

 

SQLServer连接配置文件

Code Block
titleSQLServer连接配置文件
themeEclipse
linenumberstrue
languagehtml/xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN" "http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
<Repository>
  <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_"/>
  </FileSystem>
  <Security appName="Jackrabbit">
    <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"></AccessManager>
    <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
      <param name="anonymousId" value="anonymous" />
      <param name="adminId" value="admin" />
    </LoginModule>
  </Security>
  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_ds_"/>
  </DataStore>
  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
  <Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_${wsp.name}_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_pm_${wsp.name}_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Workspace>
  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_fsver_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://192.168.18.108:1433;DatabaseName=urule"/>
      <param name="user" value="sa"/>
      <param name="password" value="helpdesk"/>
      <param name="schema" value="mssql"/>
      <param name="schemaObjectPrefix" value="repo_ver_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Versioning>
</Repository>

 

DB2连接配置文件

Code Block
titleDB2连接配置文件
themeEclipse
linenumberstrue
languagehtml/xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN" "http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
<Repository>
  <FileSystem class="org.apache.jackrabbit.core.fs.db.DB2FileSystem">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_"/>
  </FileSystem>
  <Security appName="Jackrabbit">
    <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"></AccessManager>
    <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
      <param name="anonymousId" value="anonymous" />
      <param name="adminId" value="admin" />
    </LoginModule>
  </Security>
  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_ds_"/>
  </DataStore>
  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
  <Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.DB2FileSystem">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_${wsp.name}_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_pm_${wsp.name}_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Workspace>
  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_fsver_"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager">
      <param name="driver" value="com.ibm.db2.jcc.DB2Driver"/>
      <param name="url" value="jdbc:db2:rule"/>
      <param name="user" value="bstek"/>
      <param name="password" value="bstek"/>
      <param name="schema" value="db2"/>
      <param name="schemaObjectPrefix" value="repo_ver_"/>
      <param name="externalBLOBs" value="false" />
    </PersistenceManager>
  </Versioning>
</Repository>

...