<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<section id="Core.JCROrganizationServiceConfiguration">
  <title>JCR organization service Configuration</title>

  <para>You may decide to make eXo users to be mapped on top of JCR. eXo
  provides an implementation of its OrganizationService on top of JCR.</para>

  <section id="Core.JCROrganizationServiceConfiguration.Quickstart">
    <title>Quickstart</title>

    <para>This is an implementation of the exo.core.component.organization.api
    API. The information will be stored in the root node exo:organization of
    the workspace. The workspace name has to be configured in the
    configuration file (see below)</para>

    <itemizedlist>
      <listitem>
        <para>Open <emphasis
        role="bold">exo-tomcat/webapps/portal/WEB-INF/conf/configuration.xml</emphasis>
        and replace:</para>
      </listitem>
    </itemizedlist>

    <programlisting language="xml">&lt;import&gt;war:/conf/organization/idm-configuration.xml&lt;/import&gt;</programlisting>

    <para>With</para>

    <programlisting language="xml">&lt;import&gt;war:/conf/organization/exo/jcr-configuration.xml&lt;/import&gt;</programlisting>

    <itemizedlist>
      <listitem>
        <para>Create <emphasis role="bold">jcr-configuration.xml</emphasis>
        file in <emphasis
        role="bold">exo-tomcat/webapps/portal/WEB-INF/conf/organization/exo
        directory</emphasis> and fill it with this content: <programlisting
        language="xml">
&lt;configuration
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_3.xsd http://www.exoplaform.org/xml/ns/kernel_1_3.xsd"
   xmlns="http://www.exoplaform.org/xml/ns/kernel_1_3.xsd"&gt;
       
  &lt;component&gt;
    &lt;key&gt;org.exoplatform.services.organization.OrganizationService&lt;/key&gt;
    &lt;type&gt;org.exoplatform.services.jcr.ext.organization.JCROrganizationServiceImpl&lt;/type&gt;
    &lt;init-params&gt;
      &lt;value-param&gt;
        &lt;name&gt;storage-workspace&lt;/name&gt;
        &lt;description&gt;Workspace in default repository where organization storage will be created&lt;/description&gt;
        &lt;value&gt;collaboration&lt;/value&gt;
      &lt;/value-param&gt;
    &lt;/init-params&gt;
   &lt;/component&gt;
      
  &lt;external-component-plugins&gt;
    &lt;target-component&gt;org.exoplatform.services.jcr.RepositoryService&lt;/target-component&gt;
    &lt;component-plugin&gt;
      &lt;name&gt;add.namespaces&lt;/name&gt;
      &lt;set-method&gt;addPlugin&lt;/set-method&gt;
      &lt;type&gt;org.exoplatform.services.jcr.impl.AddNamespacesPlugin&lt;/type&gt;
      &lt;init-params&gt;
        &lt;properties-param&gt;
          &lt;name&gt;namespaces&lt;/name&gt;
          &lt;property name="jos" value="http://www.exoplatform.com/jcr-services/organization-service/1.0/"/&gt;
        &lt;/properties-param&gt;
       &lt;/init-params&gt;
    &lt;/component-plugin&gt;
     &lt;component-plugin&gt;
      &lt;name&gt;add.nodeType&lt;/name&gt;
      &lt;set-method&gt;addPlugin&lt;/set-method&gt;
      &lt;type&gt;org.exoplatform.services.jcr.impl.AddNodeTypePlugin&lt;/type&gt;
      &lt;init-params&gt;
        &lt;values-param&gt;
          &lt;name&gt;autoCreatedInNewRepository&lt;/name&gt;
          &lt;description&gt;Node types configuration file&lt;/description&gt;
          &lt;value&gt;jar:/conf/organization-nodetypes.xml&lt;/value&gt;
        &lt;/values-param&gt;
      &lt;/init-params&gt;
    &lt;/component-plugin&gt;
  &lt;/external-component-plugins&gt;
&lt;/configuration&gt;
</programlisting> where storage-workspace is the name of the workspace in the
        default repository where the organization storage will be created. If
        storage-workspace is absent in configuration then default workspace
        will be selected in current repository.</para>
      </listitem>
    </itemizedlist>

    <itemizedlist>
      <listitem>
        <para>Delete <emphasis role="bold">exo-tomcat/temp/</emphasis>* to
        have a clean database and then start tomcat.</para>
      </listitem>
    </itemizedlist>

    <para>eXo starts and autocreates its organization model in
    /exo:organization node</para>

    <para>That's it! Now eXo uses your JCR node as its organization model
    storage. Users, groups and memberships are now stored and retrieved from
    there.</para>
  </section>

  <section id="Core.JCROrganizationServiceConfiguration.Configuration">
    <title>Configuration</title>

    <para>Sice eXo JCR 1.11 you can add two new params:</para>

    <programlisting language="xml">
&lt;value-param&gt;
  &lt;name&gt;repository&lt;/name&gt;
  &lt;description&gt;The name of repository where organization storage will be created&lt;/description&gt;
  &lt;value&gt;db1&lt;/value&gt;
&lt;/value-param&gt;
&lt;value-param&gt;
  &lt;name&gt;storage-path&lt;/name&gt;
  &lt;description&gt;The relative path where organization storage will be created&lt;/description&gt;
  &lt;value&gt;/exo:organization&lt;/value&gt;
&lt;/value-param&gt;
      </programlisting>

    <para>where repository is the name of the repository where the
    organization storage will be created storage-path - the relative path to
    the stored data</para>

    <para>Register JCR Organization service namespace and nodetypes via
    RepositoryService's plugins:</para>

    <programlisting language="xml">
&lt;component&gt;
&lt;key&gt;org.exoplatform.services.jcr.RepositoryService&lt;/key&gt;
&lt;type&gt;org.exoplatform.services.jcr.impl.RepositoryServiceImpl&lt;/type&gt;
&lt;component-plugins&gt;
  &lt;component-plugin&gt;
    &lt;name&gt;add.namespaces&lt;/name&gt;
    &lt;set-method&gt;addPlugin&lt;/set-method&gt;
    &lt;type&gt;org.exoplatform.services.jcr.impl.AddNamespacesPlugin&lt;/type&gt;
    &lt;init-params&gt;
      &lt;properties-param&gt;
        &lt;name&gt;namespaces&lt;/name&gt;
        &lt;property name="jos" value="http://www.exoplatform.com/jcr-services/organization-service/1.0/"/&gt;
      &lt;/properties-param&gt;
    &lt;/init-params&gt;
  &lt;/component-plugin&gt;
  &lt;component-plugin&gt;
    &lt;name&gt;add.nodeType&lt;/name&gt;
    &lt;set-method&gt;addPlugin&lt;/set-method&gt;
    &lt;type&gt;org.exoplatform.services.jcr.impl.AddNodeTypePlugin&lt;/type&gt;
    &lt;init-params&gt;
      &lt;values-param&gt;
        &lt;name&gt;autoCreatedInNewRepository&lt;/name&gt;
        &lt;description&gt;Node types configuration file&lt;/description&gt;
        &lt;value&gt;jar:/conf/organization-nodetypes.xml&lt;/value&gt;
      &lt;/values-param&gt;
    &lt;/init-params&gt;
  &lt;/component-plugin&gt;
&lt;/component-plugins&gt;
&lt;/component&gt;
        </programlisting>
  </section>

  <section id="Core.JCROrganizationServiceConfiguration.Migration">
    <title>Migration</title>

    <para>Inner representation of JCR organization service has been modified
    in JCR 1.15. eXo provides a migration tool to migrate from the old JCR
    organization service strutcure to the new one. The migration process is
    launched automatically once you will upgrade to JCR 1.15.</para>

    <note>
      <para>Please avoid aborting a migration process.</para>
    </note>
  </section>

  <section>
    <title>Disable/Enable an user</title>

    <para>To be able to disable or enable an user account which is supported
    since JCR 1.16, you have no need to change your old configuration as it is
    exactly the same configuration. Old data will still be valid, it will
    consider all the existing users as enabled and since enabling/disabling an
    user is based on a mixin type, no structure change is required.</para>
  </section>
</section>
