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

  Copyright (C) 2014 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>
    <key>org.exoplatform.clouddrive.CloudDriveService</key>
    <type>org.exoplatform.clouddrive.CloudDriveServiceImpl</type>
  </component>
  <component>
    <key>org.exoplatform.clouddrive.CloudDriveFeatures</key>
    <type>org.exoplatform.clouddrive.features.PermissiveFeatures</type>
  </component>
  <component>
    <key>org.exoplatform.clouddrive.jcr.NodeFinder</key>
    <type>org.exoplatform.clouddrive.ecms.jcr.CMSNodeFinder</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.utils.ExtendedMimeTypeResolver</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.viewer.ViewerStorage</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.ConnectService</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.ProviderService</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.DriveService</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.FeaturesService</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.DriveServiceLocator</type>
  </component>
  <component>
    <type>org.exoplatform.clouddrive.rest.ContentService</type>
  </component>

  <external-component-plugins>
    <target-component>org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog</target-component>
    <component-plugin>
      <name>addActions</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin</type>
      <description>add Cloud File removal action</description>
      <init-params>
        <object-param>
          <name>actions</name>
          <object type="org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin$ActionsConfig">
            <field name="actions">
              <collection type="java.util.ArrayList">
                <value>
                  <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
                    <field name="eventTypes">
                      <string>removeNode</string>
                    </field>
                    <field name="nodeTypes">
                      <string>ecd:cloudFile</string>
                    </field>
                    <field name="isDeep">
                      <boolean>true</boolean>
                    </field>
                    <field name="actionClassName">
                      <string>org.exoplatform.clouddrive.jcr.RemoveCloudFileAction</string>
                    </field>
                  </object>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>addActions</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin</type>
      <description>add Cloud File symlink removal action</description>
      <init-params>
        <object-param>
          <name>actions</name>
          <object type="org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin$ActionsConfig">
            <field name="actions">
              <collection type="java.util.ArrayList">
                <value>
                  <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
                    <field name="eventTypes">
                      <string>removeNode</string>
                    </field>
                    <field name="nodeTypes">
                      <string>ecd:cloudFileLink</string>
                    </field>
                    <field name="isDeep">
                      <boolean>false</boolean>
                    </field>
                    <field name="actionClassName">
                      <string>org.exoplatform.clouddrive.ecms.action.RemoveCloudFileLinkAction</string>
                    </field>
                  </object>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
  <external-component-plugins>
    <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
    <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="ecd" value="http://www.exoplatform.com/jcr/clouddrive/1.0/" />
        </properties-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>add.gadget.services.nodeType</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
      <init-params>
        <values-param>
          <name>autoCreatedInNewRepository</name>
          <description>Cloud Drive node types configuration file</description>
          <value>jar:/conf/portal/jcr/clouddrive-nodetypes.xml</value>
          <value>jar:/conf/portal/jcr/clouddrive-ui-nodetypes.xml</value>
        </values-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <!-- use this plugin in external configuration, e.g. an extension -->
  <external-component-plugins>
    <target-component>org.exoplatform.clouddrive.CloudDriveService</target-component>
    <component-plugin>
      <name>add.portalenv</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.clouddrive.webui.PortalEnvironment</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.clouddrive.utils.ExtendedMimeTypeResolver</target-component>
    <component-plugin>
      <name>add.namespaces</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.clouddrive.utils.ExtendedMimeTypeResolver$MimeTypeMap</type>
      <init-params>
        <values-param>
          <name>mimetypes-properties</name>
          <description>Mimetype property files, path can be any format supported by eXo configuration</description>
          <value>jar:/conf/clouddrive/mimetypes.properties</value>
          <!-- value>war:/conf/portal/custom/mimetypes.properties</value -->
        </values-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <import>war:/conf/clouddrive/dms-ext-configuration.xml</import>
  <import>war:/conf/clouddrive/portal-configuration.xml</import>
</configuration>