1

我们正在使用这个平台:

JBoss 6.1.0.GA

模式形状 3.6.0

我只需要创建一个新的工作区并放入我们正在开发的 web 应用程序所需的图像、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

我查看了 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>
4

2 回答 2

1

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

由于您将 ModeShape 部署到 JBoss EAP,您可以在安装的Standalone-modeshape.xml文件中的 ModeShape 子系统配置中配置新的工作空间。这是一个示例(实际上在该配置文件中),用于定义 3 个名为default、的工作区other,并在启动时为名为 的工作区extra定义一些初始内容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 用于 ModeShape 4.x)中部署 ModeShape 的人,您可以在 ModeShape 的 JSON 配置文件中做同样的事情。例如,这定义了与上述完全相同的工作空间:

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

有关更多详细信息和选项,请参阅 ModeShape 的JSON 模式

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

于 2015-02-04T15:05:12.040 回答
0

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

JBoss 6.3.0.GA

模式形状 3.8.1

于 2015-02-04T16:56:40.153 回答