Modeshape 工作区创建

Modeshape workspace creation

我们正在使用这个平台:

JBoss6.1.0.GA

Modeshape 3.6.0

我只需要创建一个新的工作区并放入图像、javascript 和我们正在开发的网络应用程序所需的其他文件。

我尝试通过 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

我查看了 Whosebug 和 modeshape 的官方指南,但我仍然不知道如何执行此 "easy" 任务。

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

我添加来自 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/"/>
                <sequencer name="xml-sequencer" classname="xml" module="org.modeshape.sequencer.xml" path-expression="/files(//)*.xml[*]/jcr:content[@jcr:data] => /derived/xml/"/>
                <sequencer name="image-sequencer" classname="image" module="org.modeshape.sequencer.image" path-expression="/files(//*.(png|jpg|gif)[*])/jcr:content[@jcr:data] => /derived/image/"/>
            </sequencers>
            <text-extractors>
                <text-extractor name="tika-extractor" classname="tika" module="org.modeshape.extractor.tika"/>
            </text-extractors>
        </repository>
    </subsystem>

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

由于您将 ModeShape 部署到 JBoss EAP,您可以在安装的 standalone-modeshape.xml file. Here's an example (that actually is in that configuration file) to define 3 workspaces named default, other, and extra upon startup, defines some initial content 中的 ModeShape 子系统配置中为名为 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 片段的结构由 Wildfly 安装中的 modeshape_1_0.xsd file in your EAP installation (or the 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 时正确指定工作区名称。

我设法让它工作,只是将配置更改为这个:

JBoss6.3.0.GA

Modeshape 3.8.1