Modeshape工作区创建

时间:2015-02-04 08:58:31

标签: jboss jcr modeshape

我们正在使用这个平台:

JBoss 6.1.0.GA

Modeshape 3.6.0

我只需创建一个新的工作区,并将内部图像,javascripts和其他文件放入我们正在开发的webapp中。

我尝试通过webdav连接到我们的modeshape存储库并在里面创建一个新的测试目录,但我总是收到这个例外:

2015-02-03 16:47 WARN  [org.modeshape.web.jcr.webdav.ModeShapeWebdavStore] (http-/0.0.0.0:8021-1) Cannot obtain a session for the repository 'repository': The workspace test was not found

我查看了stackoverflow和modeshape的官方指南,但我仍然无法理解如何做这个“简单”的任务。

似乎没有文档说明如何在存储库中手动创建新工作区。

我从standalone.xml添加配置,我用于缓存:

        <subsystem xmlns="urn:jboss:domain:infinispan:1.4">
        <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4">
            <local-cache name="entity">
                <transaction mode="NON_XA"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="local-query">
                <transaction mode="NONE"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="timestamps">
                <transaction mode="NONE"/>
                <eviction strategy="NONE"/>
            </local-cache>
        </cache-container>
        <cache-container name="modeshape" default-cache="repository" module="org.modeshape">
            <local-cache name="repository">
                <transaction mode="NON_XA"/>
                <string-keyed-jdbc-store datasource="java:/jdbc/blablablaDatasource" shared="true" passivation="false" purge="false">
                    <property name="databaseType">
                        oracle
                    </property>
                    <property name="createTableOnStart">
                        true
                    </property>
                    <string-keyed-table prefix="CONTENT_REPO_STRING">
                        <id-column name="id_column" type="VARCHAR2(255)"/>
                        <data-column name="data_column" type="BLOB"/>
                        <timestamp-column name="timestamp_column" type="NUMBER(20)"/>
                    </string-keyed-table>
                </string-keyed-jdbc-store>
            </local-cache>
        </cache-container>
        <cache-container name="binary_cache_container" default-cache="binary_fs">
            <local-cache name="binary_fs">
                <transaction mode="NON_XA"/>
                <string-keyed-jdbc-store datasource="java:/jdbc/blablablaDatasource" shared="true" preload="false" passivation="false" purge="false">
                    <write-behind flush-lock-timeout="1" modification-queue-size="1024" shutdown-timeout="25000" thread-pool-size="1"/>
                    <property name="databaseType">
                        oracle
                    </property>
                    <string-keyed-table prefix="CONTENT_REPO">
                        <id-column name="id_column" type="VARCHAR(255)"/>
                        <data-column name="data_column" type="BLOB"/>
                        <timestamp-column name="timestamp_column" type="NUMBER(20)"/>
                    </string-keyed-table>
                </string-keyed-jdbc-store>
            </local-cache>
            <local-cache name="binary_fs_meta">
                <transaction mode="NON_XA"/>
                <string-keyed-jdbc-store datasource="java:/jdbc/blablablaDatasource" shared="true" preload="false" passivation="false" purge="false">
                    <write-behind flush-lock-timeout="1" modification-queue-size="1024" shutdown-timeout="25000" thread-pool-size="1"/>
                    <property name="databaseType">
                        oracle
                    </property>
                    <string-keyed-table prefix="CONTENT_REPO">
                        <id-column name="id_column" type="VARCHAR(255)"/>
                        <data-column name="data_column" type="BLOB"/>
                        <timestamp-column name="timestamp_column" type="NUMBER(20)"/>
                    </string-keyed-table>
                </string-keyed-jdbc-store>
            </local-cache>
        </cache-container>
    </subsystem>

以及modeshape conf:

<subsystem xmlns="urn:jboss:domain:modeshape:1.0">
        <repository name="repository" security-domain="modeshape-internal-security">
            <workspaces default-workspace="default" allow-workspace-creation="true">
                <workspace name="ops">
                    <initial-content>
                        initial-content-default.xml
                    </initial-content>
                </workspace>
        <workspace name="other"/>
        <workspace name="extra">
            <initial-content>
                        initial-content-default.xml
                    </initial-content>
                </workspace>    
        <workspace name="default"/>
            </workspaces>
            <indexing rebuild-upon-startup="ALWAYS"/>
            <cache-binary-storage data-cache-name="binary_fs" metadata-cache-name="binary_fs_meta" cache-container="binary_cache_container"/>
            <sequencers>
                <sequencer name="fixed-width-text-sequencer" classname="org.modeshape.sequencer.text.FixedWidthTextSequencer" module="org.modeshape.sequencer.text" commentMarker="#" path-expression="/files(//*.txt[*])/jcr:content[@jcr:data] => /derived/text/fixedWidth/$1"/>
                <sequencer name="xml-sequencer" classname="xml" module="org.modeshape.sequencer.xml" path-expression="/files(//)*.xml[*]/jcr:content[@jcr:data] => /derived/xml/$1"/>
                <sequencer name="image-sequencer" classname="image" module="org.modeshape.sequencer.image" path-expression="/files(//*.(png|jpg|gif)[*])/jcr:content[@jcr:data] => /derived/image/$1"/>
            </sequencers>
            <text-extractors>
                <text-extractor name="tika-extractor" classname="tika" module="org.modeshape.extractor.tika"/>
            </text-extractors>
        </repository>
    </subsystem>

2 个答案:

答案 0 :(得分:0)

您可以使用标准JCR API以编程方式创建新工作区(请参阅this StackOverflow question,但您也可以在ModeShape配置文件中定义工作区。

由于您正在将ModeShape部署到JBoss EAP,因此您可以在安装的standalone-modeshape.xml文件中的ModeShape子系统配置中配置新工作区。这是一个示例(实际上在该配置文件中),用于在启动时定义名为defaultotherextra的3个工作空间,定义了一些initial content名为default的工作空间,它支持以编程方式创建工作空间。

<repository name="artifacts">
  <!-- ... -->
  <!-- Define 3 workspaces to exist upon startup -->
  <workspaces default-workspace="default" allow-workspace-creation="false">
    <workspace name="default">
      <initial-content>initial-content-default.xml</initial-content>
    </workspace>
    <workspace name="other"/>
    <workspace name="extra"/>
  </workspaces>
  <!-- ... -->
<repository name="artifacts">

此XML片段的结构由EAP安装中的modeshape_1_0.xsd文件(或Wildfly安装中的modeshape_2_0.xsd文件)决定。

对于那些没有在JBoss EAP(或Wildfly for ModeShape 4.x)中部署ModeShape的人,你可以在ModeShape的JSON配置文件中做同样的事情。例如,这定义了与上述完全相同的工作空间:

"workspaces" : {
    "predefined" : ["other", "extra"],
    "default" : "default",
    "allowCreation" : true,
    "initialContent" : {
        "default" : "initial-content-default.xml"
    }
},

有关详细信息和选项,请参阅ModeShape的JSON schema

另外,请确保在登录Session时正确指定工作区名称。

答案 1 :(得分:0)

我设法让它只将配置更改为此配置:

JBoss 6.3.0.GA

Modeshape 3.8.1