phoenix
phoenix

Reputation: 47

Modeshape workspace creation

We are working with this platform:

JBoss 6.1.0.GA

Modeshape 3.6.0

I just need to create a new workspace and to put inside images,javascripts, and other files I need for a webapp we are developing.

I tried to connect via webdav to our modeshape repository and create a new test directory inside, but I always receive this exception:

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

I looked on stackoverflow and on the official guide of modeshape, but I still cannot catch how to do this "easy" task.

It seems there's no documentation that explains how to manually create a new workspace in a repository.

I add the configurations from standalone.xml I'm using for cache:

        <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>

and also for the 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>

Upvotes: 1

Views: 667

Answers (2)

phoenix
phoenix

Reputation: 47

I managed to get it work only changing the configuration to this one:

JBoss 6.3.0.GA

Modeshape 3.8.1

Upvotes: 0

Randall Hauch
Randall Hauch

Reputation: 7187

You can create a new workspace programmatically using the standard JCR API (see this StackOverflow question, but you can also define workspaces in the ModeShape configuration file.

Since you're deploying ModeShape to JBoss EAP, you can configure new workspaces in the ModeShape subsystem configuration within the installation's 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 for the workspace named default, and it enables the programmatic creation of workspaces.

<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">

The structure of this XML fragment is dictated by the modeshape_1_0.xsd file in your EAP installation (or the modeshape_2_0.xsd file in Wildfly installations).

For those not deploying ModeShape in JBoss EAP (or Wildfly for ModeShape 4.x), you can do the same thing in ModeShape's JSON configuration file. For example, this defines exactly the same workspaces described above:

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

See ModeShape's JSON schema for more details and options.

Also, be sure that when you log into a Session that you correctly specify the workspace name.

Upvotes: 1

Related Questions