JBoss Community Archive (Read Only)

ModeShape 5

ModeShape's CMIS Service

ModeShape offers a CMIS service which allows any client to interact with the repository via the CMIS API. ModeShape's CMIS functionality is built on top of Apache Chemistry and therefore supports several different protocols, including SOAP and AtomPub.

Configuration

Depending on whether you want to use the CMIS Service in the JBoss Application Server or another web server, there are 2 different options:

Embedded

To embed the CMIS service in your own application, you need to use the modeshape-web-cmis-war artifact which comes pre-packaged with all the default dependencies (including ModeShape). The easiest way to use & customize this is to first add the artifact as a dependency in your project:

<dependency>
  <groupId>org.modeshape</groupId>
  <artifactId>modeshape-web-cmis-war</artifactId>
  <type>war</type>
  <scope>runtime</scope>
</dependency>

after which you need to overwrite (overlay) your own web.xml, repository configuration and optional additional dependencies. The former is the most important as it contains a reference towards your own custom repository configuration:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <display-name>ModeShape JCR CMIS Interface Custom Configuration</display-name>

    <!--
      The welcome files are the default from the OpenCMIS server
    -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <!--
      ModeShape OpenCMIS extension which provides the CMIS functionality
    -->
    <listener>
        <listener-class>org.modeshape.cmis.CmisContextListener</listener-class>
    </listener>

    <!--
       Required to be able to parse SOAP endpoints
    -->
    <listener>
        <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>

    <!--
        This parameter defines the location of the configuration file, or can specify
        the JNDI location of the Repository or Repositories implementation.
        (If the object in JNDI is a ModeShape Repositories instance, then this web application
        will support multiple repositories.)

        If a file is specified, ModeShape will first check for a file at this path in the filesystem.
        If not file exists at this path, ModeShape will attempt to load this as a resource
        from the classpath.

        The JNDI location can be specified in the form jndi:<jndi_name>
    -->
    <context-param>
        <param-name>org.modeshape.jcr.URL</param-name>
        <param-value>file:/my-repository-config.json</param-value>
    </context-param>

    <!--
        CMIS 1.0 compliant SOAP endpoint
    -->
    <servlet>
        <servlet-name>cmisws10</servlet-name>
        <servlet-class>org.apache.chemistry.opencmis.server.impl.webservices.CmisWebServicesServlet</servlet-class>
        <init-param>
            <param-name>cmisVersion</param-name>
            <param-value>1.0</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cmisws10</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>


    <!--
        CMIS 1.1 compliant SOAP endpoint
    -->
    <servlet>
        <servlet-name>cmisws11</servlet-name>
        <servlet-class>org.apache.chemistry.opencmis.server.impl.webservices.CmisWebServicesServlet</servlet-class>
        <init-param>
            <param-name>cmisVersion</param-name>
            <param-value>1.1</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cmisws11</servlet-name>
        <url-pattern>/services11/*</url-pattern>
    </servlet-mapping>

    <!--
       CMIS 1.0 compliant AtomPUB endpoint
    -->
    <servlet>
        <servlet-name>cmisatom10</servlet-name>
        <servlet-class>org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet</servlet-class>
        <init-param>
            <param-name>callContextHandler</param-name>
            <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
        </init-param>
        <init-param>
            <param-name>cmisVersion</param-name>
            <param-value>1.0</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cmisatom10</servlet-name>
        <url-pattern>/atom/*</url-pattern>
    </servlet-mapping>

    <!--
       CMIS 1.1 compliant AtomPUB endpoint
    -->
    <servlet>
        <servlet-name>cmisatom11</servlet-name>
        <servlet-class>org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet</servlet-class>
        <init-param>
            <param-name>callContextHandler</param-name>
            <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
        </init-param>
        <init-param>
            <param-name>cmisVersion</param-name>
            <param-value>1.1</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cmisatom11</servlet-name>
        <url-pattern>/atom11/*</url-pattern>
    </servlet-mapping>

    <!--
      OpenCMIS browser for AtomPUB endpoints. See http://chemistry.apache.org/java/opencmis-browser.html.
    -->
    <servlet>
        <servlet-name>cmisbrowser</servlet-name>
        <servlet-class>org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet</servlet-class>
        <init-param>
            <param-name>callContextHandler</param-name>
            <param-value>org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cmisbrowser</servlet-name>
        <url-pattern>/browser/*</url-pattern>
    </servlet-mapping>

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
</web-app>

Maven automatically overlays dependencies of type war, so all you need to do is make sure your project structure contains the correct paths: src/main/resource and src/main/webapp/WEB-INF/web.xml.

See also our examples for such a configuration.

JBoss Wildfly

Once installed into Wildfly, the ModeShape Wildfly kit provides the CMIS service out-of-the-box, via a web application named modeshape-cmis.war. This application is configured by default via the standalone-modeshape.xml server configuration file and allows access to all ModeShape repository configured & deployed via Wildfly.

        <subsystem xmlns="urn:jboss:domain:modeshape:2.0">
            <!--The list of web applications that is packaged inside the kit and should be deployed when the subsystem starts up-->
            <webapp name="modeshape-cmis.war"/>
        </subsystem>

By default, both web applications use Basic HTTP Authentication and require a role named connect to be present in the authenticated user's set of roles.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:12:53 UTC, last content change 2014-11-10 12:32:32 UTC.