<?xml version="1.0" encoding="ISO-8859-1"?>
<!--

    Copyright (C) 2010 eXo Platform SAS.

    This is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation; either version 2.1 of
    the License, or (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this software; if not, write to the Free
    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA, or see the FSF site: http://www.fsf.org.

-->
<configuration
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
   xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">

  <component>
    <type>org.exoplatform.services.security.IdentityRegistry </type>
  </component>

  <component>
    <type>org.exoplatform.services.security.ConversationRegistry</type>
  </component>

   <!-- cloud-multitenant-rest-services -->
  <component>
    <key>org.exoplatform.cloudmanagement.CloudApplication</key>
    <type>org.exoplatform.cloudmanagement.CloudApplication</type>
  </component>

  <!-- Service with password features. Registers in CloudApplication -->
  <component>
    <key>org.exoplatform.cloudmanagement.rest.PasswordService</key>
    <type>org.exoplatform.cloudmanagement.rest.PasswordService</type>
    <init-params>
      <value-param>
        <name>mail-sender</name>
        <value><![CDATA[Platform Cloud <exo-plf-cloud-test1@gmail.com>]]></value>
      </value-param>
      <value-param>
        <name>recover-mail-subject</name>
        <value>Platform Cloud password reminder</value>
      </value-param>
      <value-param>
        <name>recover-mail-template-name</name>
        <value>template-mail-password-restoring</value>
      </value-param>
      <value-param>
        <name>change-mail-subject</name>
        <value>Cloud-IDE password changing</value>
      </value-param>
      <value-param>
        <name>change-mail-template-name</name>
        <value>template-mail-password-changing</value>
      </value-param>
    </init-params>
  </component>

  <!--cloud-agent -->
  <component>
    <key>org.exoplatform.platform.cloud.services.rest.CloudAgentApplication</key>
    <type>org.exoplatform.platform.cloud.services.rest.CloudAgentApplication</type>
  </component>


  <!-- TenantCreationSupervisor -->
  <component>
    <key>org.exoplatform.cloudmanagement.multitenancy.TenantCreationSupervisor</key>
    <type>org.exoplatform.cloudmanagement.multitenancy.ExoContainerTenantCreationSupervisor</type>
  </component>

  <!-- RestRepositoryService -->
  <component>
    <key>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</key>
    <type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
  </component>

  <!-- RestRegistryService -->
  <component>
    <type>org.exoplatform.cloudmanagement.rest.TenancyRESTRegistryService</type>
  </component>

  <component>
    <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
    <init-params>
      <properties-param>
        <name>locations</name>
      </properties-param>
    </init-params>
  </component>

  <!-- Plugins for TenantCreationService START -->
  <component>
    <key>org.exoplatform.cloudmanagement.multitenancy.CreateNewRepositoryPlugin</key>
    <type>org.exoplatform.platform.cloud.services.multitenancy.CreateNewRepositoryPlugin</type>
    <description>Create database</description>
    <init-params>
      <value-param>
        <name>priority</name>
        <value>10</value>
      </value-param>
      <value-param>
        <name>configuration-path</name>
        <value>file:///${catalina.home}/${exo.conf.dir.name}/cloud/platform-tenant-configuration-template.xml</value>
      </value-param>
    </init-params>
  </component>

  <component>
    <type>org.exoplatform.cloudmanagement.multitenancy.TenantRegistryPlugin</type>
    <description>Create database</description>
    <init-params>
      <value-param>
        <name>priority</name>
        <value>40</value>
      </value-param>
      <value-param>
        <name>registry-repository</name>
        <!-- Name of repository where information about tenant's will be stored. Should be static. -->
        <value>${tenant.repository.name}</value>
      </value-param>
    </init-params>
  </component>

  <!-- component>
      <type>org.exoplatform.cloudmanagement.multitenancy.ChangeRootPasswordPlugin</type>
      <description>Change root password</description>
      <init-params>
         <value-param>
            <name>priority</name>
            <value>50</value>
         </value-param>
      </init-params>
  </component -->

  <!-- Plugins for TenantCreationService END -->

  <!-- TemplateResolver configuration -->
  <component>
    <key>org.exoplatform.cloudmanagement.multitenancy.TemplateResolver</key>
    <type>org.exoplatform.cloudmanagement.multitenancy.TemplateResolver</type>
    <init-params>
      <value-param>
        <name>temaplate-mail-invitation</name>
        <value>file:///${catalina.home}/${exo.conf.dir.name}/cloud/template-invitation-mail.html</value>
      </value-param>
      <value-param>
         <name>template-mail-password-restoring</name>
         <value>file:///${catalina.home}/${exo.conf.dir.name}/cloud/template-mail-password-restoring.html</value>
      </value-param>
      <value-param>
         <name>template-mail-password-changing</name>
         <value>file:///${catalina.home}/${exo.conf.dir.name}/cloud/template-mail-password-changing.html</value>
      </value-param>
    </init-params>
  </component>
  
  <!-- Backup service -->
  <component>
    <key>org.exoplatform.services.jcr.ext.backup.BackupManager</key>
    <type>org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl
      </type>
    <init-params>
      <value-param>
        <name>force-xml-configuration</name>
        <value>${exo.backup.force-xml-configuration:false}</value>
      </value-param>
      <properties-param>
        <name>backup-properties</name>
        <property name="default-incremental-job-period" value="${exo.backup.default-incremental-job-period:3600}" />
        <property name="full-backup-type" value="${exo.backup.full-backup-type:org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob}" />
        <property name="incremental-backup-type" value="org.exoplatform.services.jcr.ext.backup.impl.fs.IncrementalBackupJob" />
        <property name="backup-dir" value="${exo.backup.dir}/backup${container.name.suffix}" />
      </properties-param>
    </init-params>
  </component>

  <!-- REST service for BackupManager -->
  <component>
    <type>org.exoplatform.services.jcr.ext.backup.server.HTTPBackupAgent</type>
  </component>

  <!-- JCR Organiation service -->
  <component>
    <key>org.exoplatform.services.organization.OrganizationService</key>
    <type>org.exoplatform.services.jcr.ext.organization.JCROrganizationServiceImpl</type>
    <init-params>
      <value-param>
        <name>storage-workspace</name>
        <description>Workspace in default repository where organization storage will be created</description>
        <value>portal-system</value>
      </value-param>
    </init-params>
  </component>

  <!-- TenantRegistryPlugin support -->
  <component>
    <type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
  </component>

  <!-- REST stuff START -->
  <component>
    <key>org.exoplatform.services.rest.impl.RequestHandlerImpl</key>
    <type>org.exoplatform.services.rest.impl.RequestHandlerImpl</type>
  </component>

  <component>
    <key>org.exoplatform.services.rest.impl.RequestDispatcher</key>
    <type>org.exoplatform.services.rest.impl.RequestDispatcher</type>
  </component>

  <component>
    <type>org.exoplatform.services.rest.impl.StartableApplication</type>
  </component>

  <component>
    <type>org.exoplatform.services.rest.impl.ProvidersRegistry</type>
  </component>

  <component>
    <type>org.exoplatform.services.rest.impl.ApplicationRegistry</type>
  </component>

  <component>
    <key>org.exoplatform.services.rest.impl.ResourceBinder</key>
    <type>org.exoplatform.services.rest.impl.ResourceBinder</type>
  </component>

  <component>
    <type>org.exoplatform.services.rest.impl.provider.JAXBContextResolver</type>
  </component>

  <component>
    <key>org.exoplatform.services.jcr.RepositoryService</key>
    <type>org.exoplatform.cloudmanagement.multitenancy.TenantRepositoryService</type>
    <component-plugins>
      <component-plugin>
        <name>add.namespaces</name>
        <set-method>addPlugin</set-method>
        <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
        <init-params>
          <properties-param>
            <name>namespaces</name>
            <property name="dc" value="http://purl.org/dc/elements/1.1/" />
            <property name="jos" value="http://www.exoplatform.com/jcr-services/organization-service/1.0/" />
            <property name="exoide" value="http://exoplatform.org/ide/1.1.x/" />
          </properties-param>
        </init-params>
      </component-plugin>
      <component-plugin>
        <name>add.nodeType</name>
        <set-method>addPlugin</set-method>
        <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
        <init-params>
          <values-param>
            <name>autoCreatedInNewRepository</name>
            <description>Node types configuration file</description>
            <value>jar:/conf/organization-nodetypes.xml</value>
          </values-param>
        </init-params>
      </component-plugin>
    </component-plugins>
  </component>

  <component>
    <key>org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationService</key>
    <type>org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl</type>
  </component>

  <!-- JCR Dependencies END -->

  <component>
    <key>org.exoplatform.services.naming.InitialContextInitializer</key>
    <type>org.exoplatform.services.naming.InitialContextInitializer</type>
    <init-params>
      <value-param>
        <name>bindings-store-path</name>
        <value>${tenant.data.dir}/bind-references.xml</value>
      </value-param>
      <value-param>
        <name>overload-context-factory</name>
        <value>true</value>
      </value-param>
    </init-params>
  </component>

  <external-component-plugins>
    <!-- The full qualified name of the ExtensibleFilter -->
    <target-component>org.exoplatform.web.filter.ExtensibleFilter</target-component>
    <component-plugin>
      <!-- The name of the plugin -->
      <name>Sample Filter Definition Plugin</name>
      <!-- The name of the method to call on the ExtensibleFilter in order to register the FilterDefinitions -->
      <set-method>addFilterDefinitions</set-method>
      <!-- The full qualified name of the FilterDefinitionPlugin -->
      <type>org.exoplatform.web.filter.FilterDefinitionPlugin</type>
      <init-params>
        <object-param>
          <name>Sample Filter Definition</name>
          <object type="org.exoplatform.web.filter.FilterDefinition">
            <!-- The filter instance -->
            <field name="filter"><object type="org.exoplatform.platform.cloud.services.filter.SetTenantRepositoryFilter"/></field>
            <!-- The mapping to use -->
            <!-- WARNING: the mapping is expressed with regular expressions -->
            <field name="patterns">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>/.*</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <!-- The name of the plugin -->
      <name>Sample Filter Definition Plugin</name>
      <!-- The name of the method to call on the ExtensibleFilter in order to register the FilterDefinitions -->
      <set-method>addFilterDefinitions</set-method>
      <!-- The full qualified name of the FilterDefinitionPlugin -->
      <type>org.exoplatform.web.filter.FilterDefinitionPlugin</type>
      <init-params>
        <object-param>
          <name>Sample Filter Definition</name>
          <object type="org.exoplatform.web.filter.FilterDefinition">
            <!-- The filter instance -->
            <field name="filter"><object type="org.exoplatform.platform.cloud.services.filter.LogbackLoggingFilter"/></field>
            <!-- The mapping to use -->
            <!-- WARNING: the mapping is expressed with regular expressions -->
            <field name="patterns">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>/.*</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

</configuration>
