exo-jcr SVN: r2922 - in jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules: kernel and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-08-17 10:20:04 -0400 (Tue, 17 Aug 2010)
New Revision: 2922
Removed:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/jmx-bean-server.xml
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel.xml
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/services-wiring.xml
Log:
EXOJCR-892: jmx-bean-server.xml removed
Deleted: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/jmx-bean-server.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/jmx-bean-server.xml 2010-08-17 09:55:11 UTC (rev 2921)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/jmx-bean-server.xml 2010-08-17 14:20:04 UTC (rev 2922)
@@ -1,183 +0,0 @@
-<?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">
-<chapter id="Kernel.JMXMBeanServer">
- <?dbhtml filename="ch-jmxbean-server.html"?>
- <title>JMX MBean Server</title>
-
- <section>
- <title>JMX MBean Server</title>
-
- <para>Each component loaded in the container will be automatically wrapped
- by a MBean that will be registered in an associated MBean server. There
- exist one MBean server per eXo container and you can get the instance from
- the ExoContainer class using the method</para>
-
- <programlisting>public MBeanServer getMBeanServer()</programlisting>
-
- <para>By default the created MBean will be given a conventional name that
- you can override from the configuration.xml file using the jmx-name XML
- tag:</para>
-
- <programlisting><component>
- <key>org.exoplatform.services.database.HibernateService</key>
- <jmx-name>exo-service:type=HibernateService</jmx-name>
- <type>org.exoplatform.services.database.impl.HibernateServiceImpl</type>
- [...]
-</component></programlisting>
-
- <para><emphasis role="bold">Before kernel 2.0.7</emphasis>, you can access
- to your MBeanServers by adding the patch jar attached to this page to your
- classpath. By default this new component will bind your MBean servers to a
- RMI registry on localhost at 9999. You will be able to access your MBeans
- from any JMX Console which supports remote access like the JConsole by
- using the following URLs :</para>
-
- <table>
- <title>Container Type and Access URLs</title>
-
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Container Type</entry>
-
- <entry>Access URL</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>RootContainer or StandaloneContainer</entry>
-
- <entry>service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root</entry>
- </row>
-
- <row>
- <entry>PortalContainer (in Portal mode)</entry>
-
- <entry>service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root/PORTAL_NAME</entry>
- </row>
-
- <row>
- <entry>RepositoryContainer</entry>
-
- <entry>service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root/PORTAL_NAME/REPOSITORY_NAME
- in Portal mode or
- service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root/REPOSITORY_NAME
- in Standalone mode</entry>
- </row>
-
- <row>
- <entry>WorkspaceContainer</entry>
-
- <entry>service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root/PORTAL_NAME/REPOSITORY_NAME/WORKSPACE_NAME
- in Portal mode or
- service:jmx:rmi:///jndi/rmi://localhost:9999/eXo/root/REPOSITORY_NAME/WORKSPACE_NAME
- in Standalone mode</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para>You can of course change these properties by overloading them. Here
- are all the parameters</para>
-
- <programlisting><init-params>
- <value-param>
- <name>protocol</name>
- <description>protocol is a short string that represent the protocol such as "rmi", "iiop", "jmxmp" or "soap"</description>
- <value>rmi:///jndi/rmi</value>
- </value-param>
- <value-param>
- <name>host</name>
- <description>optional hostname</description>
- <value>localhost</value>
- </value-param>
- <value-param>
- <name>port</name>
- <description>optional port</description>
- <value>9999</value>
- </value-param>
- <value-param>
- <name>path-prefix</name>
- <description>optional path prefix</description>
- <value>eXo/</value>
- </value-param>
- <value-param>
- <name>name-separator</name>
- <description>the separator used between the container names</description>
- <value>/</value>
- </value-param>
- <properties-param>
- <name>environment</name>
- <description>a set of attributes to control the new connector server's behaviour</description>
- <property name="jmx.remote.jndi.rebind" value="true"/>
- </properties-param>
-</init-params></programlisting>
-
- <note>
- <para>Please, make sure that an RMI registry has been properly started
- (locally on 9999) before launching eXo. If you use the RMI registry
- provided in JDK 1.5, you can just launch rmiregistry 9999.</para>
- </note>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/jconsole2.png" />
- </imageobject>
- </mediaobject>
-
- <para><emphasis role="bold">Since kernel 2.0.7</emphasis>, it is possible
- to register all eXo MBeans in a single local MBeanServer in order to be
- able to manage them through the JConsole or any another JMX
- Console.</para>
-
- <itemizedlist>
- <listitem>
- <para>The JVM system property <emphasis
- role="bold">org.exoplatform.container.jmx.useExistingServer</emphasis>
- can set to specify that we would like to use a local MBean server. By
- default, the default behavior will be preserved.</para>
- </listitem>
- </itemizedlist>
-
- <programlisting>java -Dorg.exoplatform.container.jmx.useExistingServer ...</programlisting>
-
- <itemizedlist>
- <listitem>
- <para>The JVM system property <emphasis
- role="bold">org.exoplatform.container.jmx.findExistingServer</emphasis>
- can set to specify that we would like to find a specific local MBean
- server. The value of this parameter is the MBean server agent id. By
- default, the platform MBean Server will be used.</para>
- </listitem>
- </itemizedlist>
-
- <programlisting>java -Dorg.exoplatform.container.jmx.findExistingServer=${agent_id} ...</programlisting>
-
- <para>If you have no agent id to set just set the JVM system property
- without any value as below:</para>
-
- <programlisting>java -Dorg.exoplatform.container.jmx.findExistingServer ...</programlisting>
-
- <itemizedlist>
- <listitem>
- <para>The JVM system property <emphasis
- role="bold">org.exoplatform.container.jmx.findExistingServerFromDefaultDomain</emphasis>
- can set to specify our local MBean server research. The value of this
- parameter is the MBean server default domain name. By default, only
- the agent id is used to find the local MBean server so if several
- MBean servers have the same agent id, the first one will be
- used.</para>
- </listitem>
- </itemizedlist>
-
- <programlisting>java -Dorg.exoplatform.container.jmx.findExistingServerFromDefaultDomain=${default_domain} ...</programlisting>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/jconsole.png" />
- </imageobject>
- </mediaobject>
- </section>
-</chapter>
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/services-wiring.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/services-wiring.xml 2010-08-17 09:55:11 UTC (rev 2921)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel/services-wiring.xml 2010-08-17 14:20:04 UTC (rev 2922)
@@ -1,201 +1,194 @@
-<?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">
-<chapter id="Kernel.ServicesWiring">
- <?dbhtml filename="ch-services-wiring.html"?>
-
- <title id="KernelServicesWiring.Title">Services Wiring</title>
-
- <section>
- <title>Overview</title>
-
- <para>The container package is responsible of building a hierarchy of
- containers. Each service will then be registered in one container or the
- other according to the XML configuration file it is defined in. It is
- important to understand that there can be several PortalContainer
- instances that all are children of the RootContainer.</para>
-
- <para>The behavior of the hierarchy is similar to a class loader one,
- hence when you will lookup a service that depends on another one, the
- container will look for it in the current container and if it does not
- find it then it will look in the parent container. That way you can load
- all the reusable business logic components in the same container (here the
- RootContainer) and differentiate the service implementation from one
- portal instance to the other by just loading different service
- implementations in two sibling PortalContainers.</para>
-
- <para>Therefore, if you look at the Portal Container as a service
- repository for all the business logic in a portal instance then you
- understand why having several PortalContainers allows you to manage
- several portals (each one deployed as a single war) in the same server by
- just changing XML configuration files.</para>
-
- <para>The default configuration XML files are packaged in the service jar.
- There are three configuration.xml files, one for each container type. In
- that XML file, we define the list of services and their init parameters
- that will be loaded in the corresponding container.</para>
- </section>
-
- <section>
- <title>Portal Instance</title>
-
- <para>As there can be several portal container instances per JVM it is
- important to be able to configure the loaded services per instance.
- Therefore all the default configuration files located in the service impl
- jar can be overridden from the portal war. For more information refer to
- <link linkend="Kernel.ServiceConfigurationforBeginners">Service
- Configuration for Beginners</link>.</para>
- </section>
-
- <section>
- <title>Introduction to the XML schema of the configuration.xml
- file</title>
-
- <para>After deploying you find the configuration.xml file in
- webapps/portal/WEB-INF/conf Use component registration tags. Let's look at
- the key tag that defines the interface and the type tag that defines the
- implementation. Note that the key tag is not mandatory, but its use
- improves performance.</para>
-
- <programlisting><!-- Portlet container hooks -->
- <component>
- <key>org.exoplatform.services.portletcontainer.persistence.PortletPreferencesPersister</key>
- <type>org.exoplatform.services.portal.impl.PortletPreferencesPersisterImpl</type>
- </component></programlisting>
-
- <para>Register plugins that can act as listeners or external plugin to
- bundle some plugin classes in other jar modules. The usual example is the
- hibernate service to which we can add hbm mapping files even if those are
- deployed in an other maven artifact.</para>
-
- <programlisting><external-component-plugins>
- <target-component>org.exoplatform.services.database.HibernateService</target-component>
- <component-plugin>
- <name>add.hibernate.mapping</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
- <init-params>
- <values-param>
- <name>hibernate.mapping</name>
- <value>org/exoplatform/services/portal/impl/PortalConfigData.hbm.xml</value>
- <value>org/exoplatform/services/portal/impl/PageData.hbm.xml</value>
- <value>org/exoplatform/services/portal/impl/NodeNavigationData.hbm.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
-</external-component-plugins></programlisting>
-
- <para>In that sample we target the HibernateService and we will call its
- addPlugin() method with an argument of the type AddHibernateMappingPlugin.
- That object will first have been filled with the init parameters.</para>
-
- <para>Therefore, it is possible to define services that will be able to
- receive plugins without implementing any framework interface.</para>
-
- <para>Another example of use is the case of listeners as in the following
- code where a listener is added to the OrganisationService and will be
- called each time a new user is created:</para>
-
- <programlisting><external-component-plugins>
- <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
- <component-plugin>
- <name>portal.new.user.event.listener</name>
- <set-method>addListenerPlugin</set-method>
- <type>org.exoplatform.services.portal.impl.PortalUserEventListenerImpl</type>
- <description>this listener create the portal configuration for the new user</description>
- <init-params>
- <object-param>
- <name>configuration</name>
- <description>description</description>
- <object type="org.exoplatform.services.portal.impl.NewPortalConfig">
- <field name="predefinedUser">
- <collection type="java.util.HashSet">
- <value><string>admin</string></value>
- <value><string>exo</string></value>
- <value><string>company</string></value>
- <value><string>community</string></value>
- <value><string>portal</string></value>
- <value><string>exotest</string></value>
- </collection>
- </field>
- <field name="templateUser"><string>template</string></field>
- <field name="templateLocation"><string>war:/conf/users</string></field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
-...</programlisting>
-
- <para>In the previous XML configuration we reference the organization
- service and we will call its method addListenerPlugin with an object of
- type PortalUserEventListenerImpl. Each time a new user will be created
- (apart the predefined ones in the list above) methods of the
- PortalUserEventListenerImpl will be called by the service.</para>
-
- <para>As you can see there are several types of init parameters, from a
- simple value param which binds a key with a value to a more complex object
- mapping that fills a JavaBean with the info defined in the XML.</para>
-
- <para>Many other examples exist such as for the Scheduler Service where
- you can add a job with a simple XML configuration or the JCR Service where
- you can add a NodeType from your own configuration.xml file.</para>
- </section>
-
- <section>
- <title>JMX auto wiring</title>
-
- <para>For JMX wiring please refer to <link
- linkend="Kernel.JMXMBeanServer">JMX MBean Server</link>.</para>
- </section>
-
- <section>
- <title>Configuration retrieval and log of this retrieval</title>
-
- <para>When the RootContainer is starting the configuration retrieval looks
- for configuration files in each jar available from the classpath at jar
- path /conf/portal/configuration.xml and from each war at path
- /WEB-INF/conf/configuration.xml. These configurations are added to a set.
- If a component was configured in a previous jar and the current jar
- contains a new configuration of that component the latest (from the
- current jar) will replace the previous configuration.</para>
-
- <para>After the processing of all configurations available on the system
- the container will initialize it and start each component in order of the
- dependency injection (DI).</para>
-
- <para>So, in general the user/developer should be careful when configuring
- the same components in different configuration files. It's recommended to
- configure service in its own jar only. Or, in case of a portal
- configuration, strictly reconfigure the component in portal files.</para>
-
- <para>But, there are components that can be (or should be) configured more
- than one time. This depends on the business logic of the component. A
- component may initialize the same resource (shared with other players) or
- may add a particular object to a set of objects (shared with other players
- too). In the first case it's critical who will be the last, i.e. whose
- configuration will be used. In second case it doesn't matter who is the
- first and who is the last (if the parameter objects are
- independent).</para>
-
- <para>In case of problems with configuration of component it's important
- to know from which jar/war it comes. For that purpose user/developer can
- set JVM system property <emphasis
- role="bold">org.exoplatform.container.configuration.debug</emphasis>, in
- command line:</para>
-
- <programlisting>java -Dorg.exoplatform.container.configuration.debug ...</programlisting>
-
- <para>With that property container configuration manager will report
- configuration adding process to the standard output (System.out).</para>
-
- <programlisting> ......
- Add configuration jar:file:/D:/Projects/eXo/dev/exo-working/exo-tomcat/lib/exo.kernel.container-trunk.jar!/conf/portal/configuration.xml
- Add configuration jar:file:/D:/Projects/eXo/dev/exo-working/exo-tomcat/lib/exo.kernel.component.cache-trunk.jar!/conf/portal/configuration.xml
- Add configuration jndi:/localhost/portal/WEB-INF/conf/configuration.xml
- import jndi:/localhost/portal/WEB-INF/conf/common/common-configuration.xml
- import jndi:/localhost/portal/WEB-INF/conf/database/database-configuration.xml
- import jndi:/localhost/portal/WEB-INF/conf/ecm/jcr-component-plugins-configuration.xml
- import jndi:/localhost/portal/WEB-INF/conf/jcr/jcr-configuration.xml
- ......</programlisting>
- </section>
-</chapter>
+<?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">
+<chapter id="Kernel.ServicesWiring">
+ <?dbhtml filename="ch-services-wiring.html"?>
+
+ <title id="KernelServicesWiring.Title">Services Wiring</title>
+
+ <section>
+ <title>Overview</title>
+
+ <para>The container package is responsible of building a hierarchy of
+ containers. Each service will then be registered in one container or the
+ other according to the XML configuration file it is defined in. It is
+ important to understand that there can be several PortalContainer
+ instances that all are children of the RootContainer.</para>
+
+ <para>The behavior of the hierarchy is similar to a class loader one,
+ hence when you will lookup a service that depends on another one, the
+ container will look for it in the current container and if it does not
+ find it then it will look in the parent container. That way you can load
+ all the reusable business logic components in the same container (here the
+ RootContainer) and differentiate the service implementation from one
+ portal instance to the other by just loading different service
+ implementations in two sibling PortalContainers.</para>
+
+ <para>Therefore, if you look at the Portal Container as a service
+ repository for all the business logic in a portal instance then you
+ understand why having several PortalContainers allows you to manage
+ several portals (each one deployed as a single war) in the same server by
+ just changing XML configuration files.</para>
+
+ <para>The default configuration XML files are packaged in the service jar.
+ There are three configuration.xml files, one for each container type. In
+ that XML file, we define the list of services and their init parameters
+ that will be loaded in the corresponding container.</para>
+ </section>
+
+ <section>
+ <title>Portal Instance</title>
+
+ <para>As there can be several portal container instances per JVM it is
+ important to be able to configure the loaded services per instance.
+ Therefore all the default configuration files located in the service impl
+ jar can be overridden from the portal war. For more information refer to
+ <link linkend="Kernel.ServiceConfigurationforBeginners">Service
+ Configuration for Beginners</link>.</para>
+ </section>
+
+ <section>
+ <title>Introduction to the XML schema of the configuration.xml
+ file</title>
+
+ <para>After deploying you find the configuration.xml file in
+ webapps/portal/WEB-INF/conf Use component registration tags. Let's look at
+ the key tag that defines the interface and the type tag that defines the
+ implementation. Note that the key tag is not mandatory, but its use
+ improves performance.</para>
+
+ <programlisting><!-- Portlet container hooks -->
+ <component>
+ <key>org.exoplatform.services.portletcontainer.persistence.PortletPreferencesPersister</key>
+ <type>org.exoplatform.services.portal.impl.PortletPreferencesPersisterImpl</type>
+ </component></programlisting>
+
+ <para>Register plugins that can act as listeners or external plugin to
+ bundle some plugin classes in other jar modules. The usual example is the
+ hibernate service to which we can add hbm mapping files even if those are
+ deployed in an other maven artifact.</para>
+
+ <programlisting><external-component-plugins>
+ <target-component>org.exoplatform.services.database.HibernateService</target-component>
+ <component-plugin>
+ <name>add.hibernate.mapping</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
+ <init-params>
+ <values-param>
+ <name>hibernate.mapping</name>
+ <value>org/exoplatform/services/portal/impl/PortalConfigData.hbm.xml</value>
+ <value>org/exoplatform/services/portal/impl/PageData.hbm.xml</value>
+ <value>org/exoplatform/services/portal/impl/NodeNavigationData.hbm.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+</external-component-plugins></programlisting>
+
+ <para>In that sample we target the HibernateService and we will call its
+ addPlugin() method with an argument of the type AddHibernateMappingPlugin.
+ That object will first have been filled with the init parameters.</para>
+
+ <para>Therefore, it is possible to define services that will be able to
+ receive plugins without implementing any framework interface.</para>
+
+ <para>Another example of use is the case of listeners as in the following
+ code where a listener is added to the OrganisationService and will be
+ called each time a new user is created:</para>
+
+ <programlisting><external-component-plugins>
+ <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
+ <component-plugin>
+ <name>portal.new.user.event.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.portal.impl.PortalUserEventListenerImpl</type>
+ <description>this listener create the portal configuration for the new user</description>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.services.portal.impl.NewPortalConfig">
+ <field name="predefinedUser">
+ <collection type="java.util.HashSet">
+ <value><string>admin</string></value>
+ <value><string>exo</string></value>
+ <value><string>company</string></value>
+ <value><string>community</string></value>
+ <value><string>portal</string></value>
+ <value><string>exotest</string></value>
+ </collection>
+ </field>
+ <field name="templateUser"><string>template</string></field>
+ <field name="templateLocation"><string>war:/conf/users</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+...</programlisting>
+
+ <para>In the previous XML configuration we reference the organization
+ service and we will call its method addListenerPlugin with an object of
+ type PortalUserEventListenerImpl. Each time a new user will be created
+ (apart the predefined ones in the list above) methods of the
+ PortalUserEventListenerImpl will be called by the service.</para>
+
+ <para>As you can see there are several types of init parameters, from a
+ simple value param which binds a key with a value to a more complex object
+ mapping that fills a JavaBean with the info defined in the XML.</para>
+
+ <para>Many other examples exist such as for the Scheduler Service where
+ you can add a job with a simple XML configuration or the JCR Service where
+ you can add a NodeType from your own configuration.xml file.</para>
+ </section>
+
+ <section>
+ <title>Configuration retrieval and log of this retrieval</title>
+
+ <para>When the RootContainer is starting the configuration retrieval looks
+ for configuration files in each jar available from the classpath at jar
+ path /conf/portal/configuration.xml and from each war at path
+ /WEB-INF/conf/configuration.xml. These configurations are added to a set.
+ If a component was configured in a previous jar and the current jar
+ contains a new configuration of that component the latest (from the
+ current jar) will replace the previous configuration.</para>
+
+ <para>After the processing of all configurations available on the system
+ the container will initialize it and start each component in order of the
+ dependency injection (DI).</para>
+
+ <para>So, in general the user/developer should be careful when configuring
+ the same components in different configuration files. It's recommended to
+ configure service in its own jar only. Or, in case of a portal
+ configuration, strictly reconfigure the component in portal files.</para>
+
+ <para>But, there are components that can be (or should be) configured more
+ than one time. This depends on the business logic of the component. A
+ component may initialize the same resource (shared with other players) or
+ may add a particular object to a set of objects (shared with other players
+ too). In the first case it's critical who will be the last, i.e. whose
+ configuration will be used. In second case it doesn't matter who is the
+ first and who is the last (if the parameter objects are
+ independent).</para>
+
+ <para>In case of problems with configuration of component it's important
+ to know from which jar/war it comes. For that purpose user/developer can
+ set JVM system property <emphasis
+ role="bold">org.exoplatform.container.configuration.debug</emphasis>, in
+ command line:</para>
+
+ <programlisting>java -Dorg.exoplatform.container.configuration.debug ...</programlisting>
+
+ <para>With that property container configuration manager will report
+ configuration adding process to the standard output (System.out).</para>
+
+ <programlisting> ......
+ Add configuration jar:file:/D:/Projects/eXo/dev/exo-working/exo-tomcat/lib/exo.kernel.container-trunk.jar!/conf/portal/configuration.xml
+ Add configuration jar:file:/D:/Projects/eXo/dev/exo-working/exo-tomcat/lib/exo.kernel.component.cache-trunk.jar!/conf/portal/configuration.xml
+ Add configuration jndi:/localhost/portal/WEB-INF/conf/configuration.xml
+ import jndi:/localhost/portal/WEB-INF/conf/common/common-configuration.xml
+ import jndi:/localhost/portal/WEB-INF/conf/database/database-configuration.xml
+ import jndi:/localhost/portal/WEB-INF/conf/ecm/jcr-component-plugins-configuration.xml
+ import jndi:/localhost/portal/WEB-INF/conf/jcr/jcr-configuration.xml
+ ......</programlisting>
+ </section>
+</chapter>
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel.xml 2010-08-17 09:55:11 UTC (rev 2921)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/reference/en/src/main/docbook/en-US/modules/kernel.xml 2010-08-17 14:20:04 UTC (rev 2922)
@@ -27,9 +27,6 @@
<xi:include href="kernel/services-wiring.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="kernel/jmx-bean-server.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
<xi:include href="kernel/component-plugin-priority.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
13 years, 10 months
exo-jcr SVN: r2921 - jcr/branches/1.12.x/patch/EXOJCR-898.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-08-17 05:55:11 -0400 (Tue, 17 Aug 2010)
New Revision: 2921
Modified:
jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch
Log:
EXOJCR-898: patch fixed
Modified: jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch
===================================================================
--- jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch 2010-08-17 09:14:41 UTC (rev 2920)
+++ jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch 2010-08-17 09:55:11 UTC (rev 2921)
@@ -1,117 +1,47 @@
Index: src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java (revision 2918)
+--- src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java (revision 2919)
+++ src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java (working copy)
-@@ -33,6 +33,7 @@
- import org.exoplatform.services.jcr.datamodel.ItemData;
- import org.exoplatform.services.jcr.datamodel.NodeData;
- import org.exoplatform.services.jcr.datamodel.PropertyData;
-+import org.exoplatform.services.jcr.datamodel.QPath;
- import org.exoplatform.services.jcr.datamodel.QPathEntry;
- import org.exoplatform.services.jcr.datamodel.ValueData;
- import org.exoplatform.services.jcr.impl.Constants;
-@@ -42,6 +43,7 @@
- import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
- import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
- import org.exoplatform.services.jcr.impl.util.NodeDataReader;
-+import org.exoplatform.services.jcr.util.IdGenerator;
- import org.exoplatform.services.log.ExoLogger;
- import org.exoplatform.services.log.Log;
+@@ -347,12 +347,13 @@
-@@ -343,16 +345,16 @@
- private void initStorage(NodeData nsSystem, boolean addACL) throws RepositoryException
- {
- PlainChangesLog changesLog = new PlainChangesLogImpl();
-- TransientNodeData exoNamespaces;
-+ TransientNodeData exoNamespaces =
-+ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.EXO_NAMESPACES), IdGenerator
-+ .generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem.getIdentifier(), nsSystem
-+ .getACL());
-
if (addACL)
{
- AccessControlList acl = new AccessControlList();
-+ AccessControlList acl = exoNamespaces.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
-- exoNamespaces =
-- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
--
+ exoNamespaces =
+ TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
+
++ AccessControlList acl = exoNamespaces.getACL();
++
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
-@@ -389,9 +391,6 @@
- }
- else
- {
-- exoNamespaces =
-- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED);
--
- TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
- false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
Index: src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java (revision 2918)
+--- src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java (revision 2919)
+++ src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java (working copy)
-@@ -38,6 +38,7 @@
- import org.exoplatform.services.jcr.datamodel.InternalQName;
- import org.exoplatform.services.jcr.datamodel.ItemData;
- import org.exoplatform.services.jcr.datamodel.NodeData;
-+import org.exoplatform.services.jcr.datamodel.QPath;
- import org.exoplatform.services.jcr.datamodel.QPathEntry;
- import org.exoplatform.services.jcr.datamodel.ValueData;
- import org.exoplatform.services.jcr.impl.Constants;
-@@ -147,19 +148,17 @@
- public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
- {
- PlainChangesLog changesLog = new PlainChangesLogImpl();
-- TransientNodeData jcrNodetypes;
--
-+ TransientNodeData jcrNodetypes =
-+ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.JCR_NODETYPES),
-+ Constants.NODETYPESROOT_UUID, -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem
-+ .getIdentifier(), nsSystem.getACL());
- long start = System.currentTimeMillis();
+@@ -153,13 +153,14 @@
if (addACL)
{
- AccessControlList acl = new AccessControlList();
-+ AccessControlList acl = jcrNodetypes.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
-- jcrNodetypes =
-- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
-- Constants.NODETYPESROOT_UUID);
--
+ jcrNodetypes =
+ TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
+ Constants.NODETYPESROOT_UUID);
+
++ AccessControlList acl = jcrNodetypes.getACL();
++
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
-@@ -196,10 +195,6 @@
- }
- else
- {
-- jcrNodetypes =
-- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
-- Constants.NODETYPESROOT_UUID);
--
- TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
- new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
Index: src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java (revision 2918)
+--- src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java (revision 2919)
+++ src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java (working copy)
-@@ -76,8 +76,6 @@
-
- private final String accessControlType;
-
-- // private final NamespaceDataPersister nsPersister;
--
- private final String rootPermissions;
-
- private final InternalQName rootNodeType;
-@@ -139,9 +137,6 @@
+@@ -139,9 +139,6 @@
: Constants.NT_UNSTRUCTURED;
this.dataManager = dataManager;
@@ -121,41 +51,23 @@
}
public NodeData initWorkspace() throws RepositoryException
-@@ -269,17 +264,16 @@
- boolean addACL = !accessControlType.equals(AccessControlPolicy.DISABLE);
+@@ -273,13 +270,14 @@
- PlainChangesLog changesLog = new PlainChangesLogImpl();
-- TransientNodeData jcrSystem;
-
-+ TransientNodeData jcrSystem =
-+ new TransientNodeData(QPath.makeChildPath(root.getQPath(), Constants.JCR_SYSTEM), Constants.SYSTEM_UUID, -1,
-+ Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, root.getIdentifier(), root.getACL());
-+
if (addACL)
{
- AccessControlList acl = new AccessControlList();
-+ AccessControlList acl = jcrSystem.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
-- jcrSystem =
-- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
-- Constants.SYSTEM_UUID);
--
+ jcrSystem =
+ TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
+ Constants.SYSTEM_UUID);
+
++ AccessControlList acl = jcrSystem.getACL();
++
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
-@@ -316,10 +310,6 @@
- }
- else
- {
-- jcrSystem =
-- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED,
-- Constants.SYSTEM_UUID);
--
- TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
- new TransientValueData(jcrSystem.getPrimaryTypeName()));
-@@ -340,15 +330,6 @@
+@@ -340,15 +338,6 @@
dataManager.save(new TransactionChangesLog(changesLog));
13 years, 10 months
exo-jcr SVN: r2920 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core: nodetype/registration and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-08-17 05:14:41 -0400 (Tue, 17 Aug 2010)
New Revision: 2920
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
Log:
EXOJCR-898: fixed
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-08-17 06:50:57 UTC (rev 2919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-08-17 09:14:41 UTC (rev 2920)
@@ -33,7 +33,6 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
@@ -43,7 +42,6 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
import org.exoplatform.services.jcr.impl.util.NodeDataReader;
-import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -345,16 +343,17 @@
private void initStorage(NodeData nsSystem, boolean addACL) throws RepositoryException
{
PlainChangesLog changesLog = new PlainChangesLogImpl();
- TransientNodeData exoNamespaces =
- new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.EXO_NAMESPACES), IdGenerator
- .generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem.getIdentifier(), nsSystem
- .getACL());
+ TransientNodeData exoNamespaces;
if (addACL)
{
- AccessControlList acl = exoNamespaces.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+ exoNamespaces =
+ TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
+
+ AccessControlList acl = exoNamespaces.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
@@ -391,6 +390,9 @@
}
else
{
+ exoNamespaces =
+ TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED);
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-08-17 06:50:57 UTC (rev 2919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-08-17 09:14:41 UTC (rev 2920)
@@ -76,6 +76,8 @@
private final String accessControlType;
+ // private final NamespaceDataPersister nsPersister;
+
private final String rootPermissions;
private final InternalQName rootNodeType;
@@ -264,16 +266,18 @@
boolean addACL = !accessControlType.equals(AccessControlPolicy.DISABLE);
PlainChangesLog changesLog = new PlainChangesLogImpl();
+ TransientNodeData jcrSystem;
- TransientNodeData jcrSystem =
- new TransientNodeData(QPath.makeChildPath(root.getQPath(), Constants.JCR_SYSTEM), Constants.SYSTEM_UUID, -1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, root.getIdentifier(), root.getACL());
-
if (addACL)
{
- AccessControlList acl = jcrSystem.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+ jcrSystem =
+ TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
+ Constants.SYSTEM_UUID);
+
+ AccessControlList acl = jcrSystem.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
@@ -310,6 +314,10 @@
}
else
{
+ jcrSystem =
+ TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED,
+ Constants.SYSTEM_UUID);
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-08-17 06:50:57 UTC (rev 2919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-08-17 09:14:41 UTC (rev 2920)
@@ -38,7 +38,6 @@
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
@@ -148,17 +147,20 @@
public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
{
PlainChangesLog changesLog = new PlainChangesLogImpl();
- TransientNodeData jcrNodetypes =
- new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.JCR_NODETYPES),
- Constants.NODETYPESROOT_UUID, -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem
- .getIdentifier(), nsSystem.getACL());
+ TransientNodeData jcrNodetypes;
+
long start = System.currentTimeMillis();
if (addACL)
{
- AccessControlList acl = jcrNodetypes.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+ jcrNodetypes =
+ TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
+ Constants.NODETYPESROOT_UUID);
+
+ AccessControlList acl = jcrNodetypes.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
@@ -195,6 +197,10 @@
}
else
{
+ jcrNodetypes =
+ TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
+ Constants.NODETYPESROOT_UUID);
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
13 years, 10 months
exo-jcr SVN: r2919 - in jcr/branches/1.12.x: patch and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-08-17 02:50:57 -0400 (Tue, 17 Aug 2010)
New Revision: 2919
Added:
jcr/branches/1.12.x/patch/
jcr/branches/1.12.x/patch/EXOJCR-898/
jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch
Log:
EXOJCR-898: patch proposed
Added: jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch
===================================================================
--- jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch (rev 0)
+++ jcr/branches/1.12.x/patch/EXOJCR-898/EXOJCR-898.patch 2010-08-17 06:50:57 UTC (rev 2919)
@@ -0,0 +1,240 @@
+Index: src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
+===================================================================
+--- src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java (revision 2918)
++++ src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java (working copy)
+@@ -33,6 +33,7 @@
+ import org.exoplatform.services.jcr.datamodel.ItemData;
+ import org.exoplatform.services.jcr.datamodel.NodeData;
+ import org.exoplatform.services.jcr.datamodel.PropertyData;
++import org.exoplatform.services.jcr.datamodel.QPath;
+ import org.exoplatform.services.jcr.datamodel.QPathEntry;
+ import org.exoplatform.services.jcr.datamodel.ValueData;
+ import org.exoplatform.services.jcr.impl.Constants;
+@@ -42,6 +43,7 @@
+ import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+ import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
+ import org.exoplatform.services.jcr.impl.util.NodeDataReader;
++import org.exoplatform.services.jcr.util.IdGenerator;
+ import org.exoplatform.services.log.ExoLogger;
+ import org.exoplatform.services.log.Log;
+
+@@ -343,16 +345,16 @@
+ private void initStorage(NodeData nsSystem, boolean addACL) throws RepositoryException
+ {
+ PlainChangesLog changesLog = new PlainChangesLogImpl();
+- TransientNodeData exoNamespaces;
++ TransientNodeData exoNamespaces =
++ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.EXO_NAMESPACES), IdGenerator
++ .generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem.getIdentifier(), nsSystem
++ .getACL());
+
+ if (addACL)
+ {
+- AccessControlList acl = new AccessControlList();
++ AccessControlList acl = exoNamespaces.getACL();
+ InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+
+- exoNamespaces =
+- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
+ false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
+@@ -389,9 +391,6 @@
+ }
+ else
+ {
+- exoNamespaces =
+- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
+ false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
+Index: src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
+===================================================================
+--- src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java (revision 2918)
++++ src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java (working copy)
+@@ -38,6 +38,7 @@
+ import org.exoplatform.services.jcr.datamodel.InternalQName;
+ import org.exoplatform.services.jcr.datamodel.ItemData;
+ import org.exoplatform.services.jcr.datamodel.NodeData;
++import org.exoplatform.services.jcr.datamodel.QPath;
+ import org.exoplatform.services.jcr.datamodel.QPathEntry;
+ import org.exoplatform.services.jcr.datamodel.ValueData;
+ import org.exoplatform.services.jcr.impl.Constants;
+@@ -147,19 +148,17 @@
+ public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
+ {
+ PlainChangesLog changesLog = new PlainChangesLogImpl();
+- TransientNodeData jcrNodetypes;
+-
++ TransientNodeData jcrNodetypes =
++ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.JCR_NODETYPES),
++ Constants.NODETYPESROOT_UUID, -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem
++ .getIdentifier(), nsSystem.getACL());
+ long start = System.currentTimeMillis();
+
+ if (addACL)
+ {
+- AccessControlList acl = new AccessControlList();
++ AccessControlList acl = jcrNodetypes.getACL();
+ InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+
+- jcrNodetypes =
+- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
+- Constants.NODETYPESROOT_UUID);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
+@@ -196,10 +195,6 @@
+ }
+ else
+ {
+- jcrNodetypes =
+- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
+- Constants.NODETYPESROOT_UUID);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
+Index: src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
+===================================================================
+--- src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java (revision 2918)
++++ src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java (working copy)
+@@ -76,8 +76,6 @@
+
+ private final String accessControlType;
+
+- // private final NamespaceDataPersister nsPersister;
+-
+ private final String rootPermissions;
+
+ private final InternalQName rootNodeType;
+@@ -139,9 +137,6 @@
+ : Constants.NT_UNSTRUCTURED;
+
+ this.dataManager = dataManager;
+- // this.nsPersister = nsPersister;
+- // this.ntRegistry = ntRegistry;
+-
+ }
+
+ public NodeData initWorkspace() throws RepositoryException
+@@ -269,17 +264,16 @@
+ boolean addACL = !accessControlType.equals(AccessControlPolicy.DISABLE);
+
+ PlainChangesLog changesLog = new PlainChangesLogImpl();
+- TransientNodeData jcrSystem;
+
++ TransientNodeData jcrSystem =
++ new TransientNodeData(QPath.makeChildPath(root.getQPath(), Constants.JCR_SYSTEM), Constants.SYSTEM_UUID, -1,
++ Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, root.getIdentifier(), root.getACL());
++
+ if (addACL)
+ {
+- AccessControlList acl = new AccessControlList();
++ AccessControlList acl = jcrSystem.getACL();
+ InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
+
+- jcrSystem =
+- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
+- Constants.SYSTEM_UUID);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrSystem.getPrimaryTypeName()));
+@@ -316,10 +310,6 @@
+ }
+ else
+ {
+- jcrSystem =
+- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED,
+- Constants.SYSTEM_UUID);
+-
+ TransientPropertyData primaryType =
+ TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrSystem.getPrimaryTypeName()));
+@@ -340,15 +330,6 @@
+
+ dataManager.save(new TransactionChangesLog(changesLog));
+
+- //nsPersister.initStorage(jcrSystem, addACL, NamespaceRegistryImpl.DEF_NAMESPACES);
+- // nodeTypes save
+- // changesLog = new PlainChangesLogImpl();
+- // changesLog.addAll(ntPersister.initNodetypesRoot(jcrSystem,
+- // addACL).getAllStates());
+- // changesLog.addAll(ntPersister.initStorage(nodeTypeDataManager.getAllNodeTypes()).getAllStates());
+- // ntPersister.saveChanges(changesLog);
+-
+- // nodeTypeDataManager.initDefaultNodeTypes(addACL);
+ return jcrSystem;
+ }
+
+Index: src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java
+===================================================================
+--- src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java (revision 0)
++++ src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java (revision 0)
+@@ -0,0 +1,62 @@
++/*
++ * 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.
++ */
++package org.exoplatform.services.jcr.impl.access;
++
++import org.exoplatform.services.jcr.BaseStandaloneTest;
++import org.exoplatform.services.jcr.core.CredentialsImpl;
++
++import javax.jcr.AccessDeniedException;
++import javax.jcr.Credentials;
++import javax.jcr.Node;
++import javax.jcr.Repository;
++import javax.jcr.Session;
++
++/**
++ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
++ * @version $Id: TestRemoveSysteNode.java 111 2010-11-11 11:11:11Z tolusha $
++ *
++ */
++public class TestRemoveNodeTypeNode extends BaseStandaloneTest {
++
++ /**
++ * {@inheritDoc}
++ */
++ @Override
++ protected String getRepositoryName() {
++ return null;
++ }
++
++ public void testRemove() throws Exception {
++ Repository repository = repositoryService.getRepository("db1tck");
++ Credentials credentials = new CredentialsImpl("demo", "exo".toCharArray());
++ Session session = repository.login(credentials, "ws");
++
++ Node node = session.getRootNode()
++ .getNode("jcr:system")
++ .getNode("jcr:nodetypes")
++ .getNode("nt:base");
++ try {
++ node.remove();
++ session.save();
++
++ fail("Exception should be thrown.");
++ } catch (AccessDeniedException e) {
++ }
++ }
++}
13 years, 10 months
exo-jcr SVN: r2918 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-08-16 11:05:10 -0400 (Mon, 16 Aug 2010)
New Revision: 2918
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
Log:
EXOJCR-898: Apply fixes for Incorrect jcr:system node's permission initialization in ScratchWorkspaceInitializer
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-08-16 08:29:40 UTC (rev 2917)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-08-16 15:05:10 UTC (rev 2918)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
@@ -42,6 +43,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
import org.exoplatform.services.jcr.impl.util.NodeDataReader;
+import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -343,16 +345,16 @@
private void initStorage(NodeData nsSystem, boolean addACL) throws RepositoryException
{
PlainChangesLog changesLog = new PlainChangesLogImpl();
- TransientNodeData exoNamespaces;
+ TransientNodeData exoNamespaces =
+ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.EXO_NAMESPACES), IdGenerator
+ .generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem.getIdentifier(), nsSystem
+ .getACL());
if (addACL)
{
- AccessControlList acl = new AccessControlList();
+ AccessControlList acl = exoNamespaces.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
- exoNamespaces =
- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
@@ -389,9 +391,6 @@
}
else
{
- exoNamespaces =
- TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-08-16 08:29:40 UTC (rev 2917)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-08-16 15:05:10 UTC (rev 2918)
@@ -76,8 +76,6 @@
private final String accessControlType;
- // private final NamespaceDataPersister nsPersister;
-
private final String rootPermissions;
private final InternalQName rootNodeType;
@@ -139,9 +137,6 @@
: Constants.NT_UNSTRUCTURED;
this.dataManager = dataManager;
- // this.nsPersister = nsPersister;
- // this.ntRegistry = ntRegistry;
-
}
public NodeData initWorkspace() throws RepositoryException
@@ -269,17 +264,16 @@
boolean addACL = !accessControlType.equals(AccessControlPolicy.DISABLE);
PlainChangesLog changesLog = new PlainChangesLogImpl();
- TransientNodeData jcrSystem;
+ TransientNodeData jcrSystem =
+ new TransientNodeData(QPath.makeChildPath(root.getQPath(), Constants.JCR_SYSTEM), Constants.SYSTEM_UUID, -1,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, root.getIdentifier(), root.getACL());
+
if (addACL)
{
- AccessControlList acl = new AccessControlList();
+ AccessControlList acl = jcrSystem.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
- jcrSystem =
- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
- Constants.SYSTEM_UUID);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
@@ -316,10 +310,6 @@
}
else
{
- jcrSystem =
- TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED,
- Constants.SYSTEM_UUID);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
@@ -340,15 +330,6 @@
dataManager.save(new TransactionChangesLog(changesLog));
- //nsPersister.initStorage(jcrSystem, addACL, NamespaceRegistryImpl.DEF_NAMESPACES);
- // nodeTypes save
- // changesLog = new PlainChangesLogImpl();
- // changesLog.addAll(ntPersister.initNodetypesRoot(jcrSystem,
- // addACL).getAllStates());
- // changesLog.addAll(ntPersister.initStorage(nodeTypeDataManager.getAllNodeTypes()).getAllStates());
- // ntPersister.saveChanges(changesLog);
-
- // nodeTypeDataManager.initDefaultNodeTypes(addACL);
return jcrSystem;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-08-16 08:29:40 UTC (rev 2917)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-08-16 15:05:10 UTC (rev 2918)
@@ -38,6 +38,7 @@
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
@@ -147,19 +148,17 @@
public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
{
PlainChangesLog changesLog = new PlainChangesLogImpl();
- TransientNodeData jcrNodetypes;
-
+ TransientNodeData jcrNodetypes =
+ new TransientNodeData(QPath.makeChildPath(nsSystem.getQPath(), Constants.JCR_NODETYPES),
+ Constants.NODETYPESROOT_UUID, -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, nsSystem
+ .getIdentifier(), nsSystem.getACL());
long start = System.currentTimeMillis();
if (addACL)
{
- AccessControlList acl = new AccessControlList();
+ AccessControlList acl = jcrNodetypes.getACL();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
- jcrNodetypes =
- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
- Constants.NODETYPESROOT_UUID);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
@@ -196,10 +195,6 @@
}
else
{
- jcrNodetypes =
- TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
- Constants.NODETYPESROOT_UUID);
-
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java 2010-08-16 15:05:10 UTC (rev 2918)
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.exoplatform.services.jcr.impl.access;
+
+import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+/**
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
+ * @version $Id: TestRemoveSysteNode.java 111 2010-11-11 11:11:11Z tolusha $
+ *
+ */
+public class TestRemoveNodeTypeNode extends BaseStandaloneTest {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getRepositoryName() {
+ return null;
+ }
+
+ public void testRemove() throws Exception {
+ Repository repository = repositoryService.getRepository("db1tck");
+ Credentials credentials = new CredentialsImpl("demo", "exo".toCharArray());
+ Session session = repository.login(credentials, "ws");
+
+ Node node = session.getRootNode()
+ .getNode("jcr:system")
+ .getNode("jcr:nodetypes")
+ .getNode("nt:base");
+ try {
+ node.remove();
+ session.save();
+
+ fail("Exception should be thrown.");
+ } catch (AccessDeniedException e) {
+ }
+ }
+}
13 years, 10 months
exo-jcr SVN: r2917 - jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-08-16 04:29:40 -0400 (Mon, 16 Aug 2010)
New Revision: 2917
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
Log:
EXOJCR-865 : Registration required node types in single DB configuration for testTEstImport was added.
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-08-13 12:26:42 UTC (rev 2916)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-08-16 08:29:40 UTC (rev 2917)
@@ -118,6 +118,7 @@
<property name="rma" value="http://www.rma.com/jcr/"/>
<property name="metadata" value="http://www.exoplatform.com/jcr/metadata/1.1/"/>
<property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ <property name="publication" value="http://www.exoplatform.com/jcr/publication/1.1/"/>
</properties-param>
</init-params>
</component-plugin>
@@ -134,6 +135,9 @@
<value>jar:/conf/test/nodetypes-usecase.xml</value>
<value>jar:/conf/test/nodetypes-config.xml</value>
<value>jar:/conf/test/nodetypes-config-extended.xml</value>
+ <value>jar:/conf/test/wcm-nodetypes.xml</value>
+ <value>jar:/conf/test/nodetypes-publication-config.xml</value>
+ <value>jar:/conf/test/publication-plugins-nodetypes-config.xml</value>
</values-param>
<values-param>
13 years, 10 months
exo-jcr SVN: r2916 - jcr/branches/1.14-ISPN/docs/reference/en/src/main/docbook/en-US/modules/kernel.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-08-13 08:26:42 -0400 (Fri, 13 Aug 2010)
New Revision: 2916
Modified:
jcr/branches/1.14-ISPN/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml
Log:
EXOJCR-802: The doc
Modified: jcr/branches/1.14-ISPN/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml
===================================================================
--- jcr/branches/1.14-ISPN/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml 2010-08-13 12:25:27 UTC (rev 2915)
+++ jcr/branches/1.14-ISPN/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml 2010-08-13 12:26:42 UTC (rev 2916)
@@ -1,1089 +1,1538 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter>
- <?dbhtml filename="ch-cache.html"?>
- <title>eXo Cache</title>
-
- <section>
- <title>Basic concepts</title>
-
- <para>All applications on the top of eXo JCR that need a cache, can rely
- on an <envar>org.exoplatform.services.cache.ExoCache</envar> instance that
- is managed by the
- <envar>org.exoplatform.services.cache.CacheService</envar>. The main
- implementation of this service is
- <envar>org.exoplatform.services.cache.impl.CacheServiceImpl</envar> which
- depends on the
- <envar>org.exoplatform.services.cache.ExoCacheConfig</envar> in order to
- create new <envar>ExoCache</envar> instances. See below an example of
- <envar>org.exoplatform.services.cache.CacheService</envar>
- definition:<programlisting> <component>
- <key>org.exoplatform.services.cache.CacheService</key>
- <jmx-name>cache:type=CacheService</jmx-name>
- <type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
- <init-params>
- <object-param>
- <name>cache.config.default</name>
- <description>The default cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>default</string></field>
- <field name="maxSize"><int>300</int></field>
- <field name="liveTime"><long>600</long></field>
- <field name="distributed"><boolean>false</boolean></field>
- <field name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
- </object>
- </object-param>
- </init-params>
- </component></programlisting></para>
-
- <para><note>
- <para>The <envar>ExoCacheConfig</envar> which name is
- <envar>default</envar>, will be the default configuration of all the
- <envar>ExoCache</envar> instances that don't have dedicated
- configuration.</para>
- </note>See below an example of how to define a new
- <envar>ExoCacheConfig</envar> thanks to a
- <emphasis>external-component-plugin</emphasis>:<programlisting> <external-component-plugins>
- <target-component>org.exoplatform.services.cache.CacheService</target-component>
- <component-plugin>
- <name>addExoCacheConfig</name>
- <set-method>addExoCacheConfig</set-method>
- <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
- <description>Configures the cache for query service</description>
- <init-params>
- <object-param>
- <name>cache.config.wcm.composer</name>
- <description>The default cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>wcm.composer</string></field>
- <field name="maxSize"><int>300</int></field>
- <field name="liveTime"><long>600</long></field>
- <field name="distributed"><boolean>false</boolean></field>
- <field name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins></programlisting></para>
-
- <table>
- <title>Descriptions of the fields of
- <envar>ExoCacheConfig</envar></title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>name</entry>
-
- <entry>The name of the cache. This field is mandatory since it
- will be used to retrieve the <envar>ExoCacheConfig</envar>
- corresponding to a given cache name.</entry>
- </row>
-
- <row>
- <entry>label</entry>
-
- <entry>The label of the cache. This field is optional. It is
- mainly used to indicate the purpose of the cache.</entry>
- </row>
-
- <row>
- <entry>maxSize</entry>
-
- <entry>The maximum numbers of elements in cache. This field is
- mandatory.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The amount of time (in seconds) an element is not written
- or read before it is evicted. This field is mandatory.</entry>
- </row>
-
- <row>
- <entry>implementation</entry>
-
- <entry>The full qualified name of the cache implementation to use.
- This field is optional. This field is only used for simple cache
- implementation. The default and main implementation is
- <envar>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</envar>,
- this implementation only works with local caches with FIFO as
- eviction policy. For more complex implementation see the next
- sections.</entry>
- </row>
-
- <row>
- <entry>distributed</entry>
-
- <entry>Indicates if the cache is distributed. This field is
- optional. This field is used for backward compatibility.</entry>
- </row>
-
- <row>
- <entry>replicated</entry>
-
- <entry>Indicates if the cache is replicated. This field is
- optional. This field is deprecated.</entry>
- </row>
-
- <row>
- <entry>logEnabled</entry>
-
- <entry>Indicates if the log is enabled. This field is optional.
- This field is used for backward compatibility.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para></para>
- </section>
-
- <section>
- <title>eXo Cache extension</title>
-
- <para>In the previous versions of eXo kernel, it was quite complex to
- implement your own ExoCache because it was not open enough. Since kernel
- 2.0.8, it is possible to easily integrate your favorite cache provider in
- eXo Products.</para>
-
- <para>You just need to implement your own <envar>ExoCacheFactory</envar>
- and register it in an eXo container, as described below:<programlisting>package org.exoplatform.services.cache;
-...
-public interface ExoCacheFactory {
-
- /**
- * Creates a new instance of {@link org.exoplatform.services.cache.ExoCache}
- * @param config the cache to create
- * @return the new instance of {@link org.exoplatform.services.cache.ExoCache}
- * @exception ExoCacheInitException if an exception happens while initializing the cache
- */
- public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException;
-}</programlisting></para>
-
- <para>As you can see, there is only one method to implement which cans be
- seen as a converter of an <envar>ExoCacheConfig</envar> to get an instance
- of <envar>ExoCache</envar>. Once, you created your own implementation you
- can simply register your factory by adding a file
- <emphasis>conf/portal/configuration.xml</emphasis> with a content of the
- following type:<programlisting><configuration>
- <component>
- <key>org.exoplatform.services.cache.ExoCacheFactory</key>
- <type>org.exoplatform.tutorial.MyExoCacheFactoryImpl</type>
- ...
- </component>
-</configuration></programlisting></para>
- </section>
-
- <section>
- <title>eXo Cache based on JBoss Cache</title>
-
- <section>
- <title>Configure the ExoCacheFactory</title>
-
- <para>When you add, the eXo library in your classpath, the eXo service
- container will use the default configuration provided in the library
- itself but of course you can still redefined the configuration if you
- wish as you can do with any components.</para>
-
- <para>The default configuration of the factory is:<programlisting><configuration>
- <component>
- <key>org.exoplatform.services.cache.ExoCacheFactory</key>
- <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryImpl</type>
- <init-params>
- <value-param>
- <name>cache.config.template</name>
- <value>jar:/conf/portal/cache-configuration-template.xml</value>
- </value-param>
- </init-params>
- </component>
-</configuration></programlisting></para>
-
- <para>As you can see the factory requires one single parameter which is
- <emphasis>cache.config.template</emphasis>, this parameter allows you to
- define the location of the default configuration template of your jboss
- cache. In the default configuration, we ask the eXo container to get the
- file shipped into the jar at
- <emphasis>/conf/portal/cache-configuration-template.xml</emphasis>.</para>
-
- <para>The default configuration template aims to be the skeleton from
- which we will create any type of jboss cache instance, thus it must be
- very generic.<note>
- <para>The default configuration template provided with the jar aims
- to work with any application servers, but if you intend to use JBoss
- AS, you should redefine it in your custom configuration to fit
- better with your AS.</para>
- </note></para>
- </section>
-
- <section>
- <title>Add specific configuration for a cache</title>
-
- <para>If for a given reason, you need to use a specific configuration
- for a cache, you can register one thanks to an "<emphasis>external
- plugin</emphasis>", see an example below:<programlisting><configuration>
- ...
- <external-component-plugins>
- <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
- <component-plugin>
- <name>addConfig</name>
- <set-method>addConfig</set-method>
- <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryConfigPlugin</type>
- <description>add Custom Configurations</description>
- <init-params>
- <value-param>
- <name>myCustomCache</name>
- <value>jar:/conf/portal/custom-cache-configuration.xml</value>
- </value-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
- ...
-</configuration></programlisting></para>
-
- <para>In the example above, I call the method
- <emphasis>addConfig(ExoCacheFactoryConfigPlugin plugin)</emphasis> on
- the current implementation of <envar>ExoCacheFactory</envar> which is
- actually the jboss cache implementation.</para>
-
- <para>In the <emphasis>init-params</emphasis> block, you can define a
- set of <emphasis>value-param</emphasis> blocks and for each
- <emphasis>value-param</emphasis>, we expect the name of cache that needs
- a specific configuration as name and the location of your custom
- configuration as <emphasis>value</emphasis>.</para>
-
- <para>In this example, we indicates to the factory that we would like
- that the cache <emphasis>myCustomCache</emphasis> use the configuration
- available at
- <emphasis>jar:/conf/portal/custom-cache-configuration.xml</emphasis>.</para>
- </section>
-
- <section>
- <title>Add a cache creator</title>
-
- <section>
- <title>Understanding a cache creator</title>
-
- <para>The factory for jboss cache, delegates the cache creation to
- <envar>ExoCacheCreator</envar> that is defines as
- below:<programlisting>package org.exoplatform.services.cache.impl.jboss;
-...
-public interface ExoCacheCreator {
-
- /**
- * Creates an eXo cache according to the given configuration {@link org.exoplatform.services.cache.ExoCacheConfig}
- * @param config the configuration of the cache to apply
- * @param cache the cache to initialize
- * @exception ExoCacheInitException if an exception happens while initializing the cache
- */
- public ExoCache create(ExoCacheConfig config, Cache<Serializable, Object> cache) throws ExoCacheInitException;
-
- /**
- * Returns the type of {@link org.exoplatform.services.cache.ExoCacheConfig} expected by the creator
- * @return the expected type
- */
- public Class<? extends ExoCacheConfig> getExpectedConfigType();
-
- /**
- * Returns the name of the implementation expected by the creator. This is mainly used to be backward compatible
- * @return the expected by the creator
- */
- public String getExpectedImplementation();
-}</programlisting></para>
-
- <para>The <envar>ExoCacheCreator</envar> allows you to define any kind
- of jboss cache instance that you would like to have. It has been
- designed to give you the ability to have your own type of
- configuration and to always be backward compatible.</para>
-
- <para>In an <envar>ExoCacheCreator</envar>, you need to implement 3
- methods which are:</para>
-
- <itemizedlist>
- <listitem>
- <para><emphasis>create</emphasis> - this method is used to create
- a new <envar>ExoCache</envar> from the
- <envar>ExoCacheConfig</envar> and a jboss cache instance.</para>
- </listitem>
-
- <listitem>
- <para><emphasis>getExpectedConfigType</emphasis> - this method is
- used to indicate the factory the subtype of
- <envar>ExoCacheConfig</envar> supported by the creator.</para>
- </listitem>
-
- <listitem>
- <para><emphasis>getExpectedImplementation</emphasis> - this method
- is used to indicate the factory the value of field implementation
- of <envar>ExoCacheConfig</envar> that is supported by the creator.
- This is used for backward compatibility, in other words you can
- still configure your cache with a super class
- <envar>ExoCacheConfig</envar>.</para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Register a cache creator</title>
-
- <para>You can register any cache creator you want thanks to an
- <emphasis>"external plugin"</emphasis>, see an example
- below:<programlisting> <external-component-plugins>
- <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
- <component-plugin>
- <name>addCreator</name>
- <set-method>addCreator</set-method>
- <type>org.exoplatform.services.cache.impl.jboss.ExoCacheCreatorPlugin</type>
- <description>add Exo Cache Creator</description>
- <init-params>
- <object-param>
- <name>LRU</name>
- <description>The lru cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator">
- <field name="defaultTimeToLive"><long>1500</long></field>
- <field name="defaultMaxAge"><long>2000</long></field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins></programlisting></para>
-
- <para>In the example above, I call the method
- <emphasis>addCreator(ExoCacheCreatorPlugin plugin)</emphasis> on the
- current implementation of <envar>ExoCacheFactory</envar> which is
- actually the jboss cache implementation.</para>
-
- <para>In the <emphasis>init-params</emphasis> block, you can define a
- set of <emphasis>object-param</emphasis> blocks and for each
- <emphasis>object-param</emphasis>, we expect any object definition of
- type <envar>ExoCacheCreator</envar>.</para>
-
- <para>In this example, we register the action creator related to the
- eviction policy <emphasis>LRU</emphasis>.</para>
- </section>
-
- <section>
- <title>The cache creators available</title>
-
- <para>By default, no cache creator are defined, so you need to define
- them yourself by adding them in your configuration files.</para>
-
- <section>
- <title>LRU Cache Creator - Least Recently Used</title>
-
- <programlisting>..
-<object-param>
- <name>LRU</name>
- <description>The lru cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator">
- <field name="defaultTimeToLive"><long>${my-value}</long></field>
- <field name="defaultMaxAge"><long>${my-value}</long></field>
- </object>
-</object-param>
-...</programlisting>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>defaultTimeToLive</entry>
-
- <entry>This is the default value of the field
- <emphasis>timeToLive</emphasis> described in the section
- dedicated to this cache type. This value is only use when we
- define a cache of this type with the old
- configuration.</entry>
- </row>
-
- <row>
- <entry>defaultMaxAge</entry>
-
- <entry>his is the default value of the field
- <emphasis>maxAge</emphasis> described in the section
- dedicated to this cache type. This value is only use when we
- define a cache of this type with the old
- configuration.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
- <section>
- <title>FIFO Cache Creator - First In, First Out</title>
-
- <programlisting>...
-<object-param>
- <name>FIFO</name>
- <description>The fifo cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.fifo.FIFOExoCacheCreator"></object>
-</object-param>
-...</programlisting>
- </section>
-
- <section>
- <title>MRU Cache Creator - Most Recently Used</title>
-
- <programlisting>...
-<object-param>
- <name>MRU</name>
- <description>The mru cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.mru.MRUExoCacheCreator"></object>
-</object-param>
-...</programlisting>
- </section>
-
- <section>
- <title>LFU Cache Creator - Least Frequently Used</title>
-
- <programlisting>...
-<object-param>
- <name>LFU</name>
- <description>The lfu cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lfu.LFUExoCacheCreator">
- <field name="defaultMinNodes"><int>${my-value}</int></field>
- </object>
-</object-param>
-...</programlisting>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>defaultMinNodes</entry>
-
- <entry>This is the default value of the field
- <emphasis>minNodes</emphasis> described in the section
- dedicated to this cache type. This value is only use when we
- define a cache of this type with the old
- configuration.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
- <section>
- <title>EA Cache Creator - Expiration Algorithm</title>
-
- <programlisting>...
-<object-param>
- <name>EA</name>
- <description>The ea cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator">
- <field name="defaultExpirationTimeout"><long>2000</long></field>
- </object>
-</object-param>
-...</programlisting>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>defaultExpirationTimeout</entry>
-
- <entry>This is the default value of the field
- <emphasis>minNodes</emphasis> described in the section
- dedicated to this cache type. This value is only use when we
- define a cache of this type with the old
- configuration.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- </section>
- </section>
-
- <section>
- <title>Define a cache</title>
-
- <section>
- <title>How to define a cache?</title>
-
- <para>You have 2 ways to define a cache which are:</para>
-
- <itemizedlist>
- <listitem>
- <para>At <envar>CacheService</envar> initialization</para>
- </listitem>
-
- <listitem>
- <para>With an <emphasis>"external plugin"</emphasis></para>
- </listitem>
- </itemizedlist>
-
- <section>
- <title>At <envar>CacheService</envar> initialization</title>
-
- <programlisting>...
- <component>
- <key>org.exoplatform.services.cache.CacheService</key>
- <type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
- <init-params>
- ...
- <object-param>
- <name>fifocache</name>
- <description>The default cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>fifocache</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="distributed"><boolean>false</boolean></field>
- <field name="implementation"><string>org.exoplatform.services.cache.FIFOExoCache</string></field>
- </object>
- </object-param>
- ...
- </init-params>
- </component>
-...</programlisting>
-
- <para>In this example, we define a new cache called
- <emphasis>fifocache</emphasis>.</para>
- </section>
-
- <section>
- <title>With an <emphasis>"external plugin"</emphasis></title>
-
- <programlisting>...
- <external-component-plugins>
- <target-component>org.exoplatform.services.cache.CacheService</target-component>
- <component-plugin>
- <name>addExoCacheConfig</name>
- <set-method>addExoCacheConfig</set-method>
- <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
- <description>add ExoCache configuration component plugin </description>
- <init-params>
- ...
- <object-param>
- <name>fifoCache</name>
- <description>The fifo cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>fifocache</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="distributed"><boolean>false</boolean></field>
- <field name="implementation"><string>org.exoplatform.services.cache.FIFOExoCache</string></field>
- </object>
- </object-param>
-...
- </init-params>
- </component-plugin>
- </external-component-plugins>
-...</programlisting>
-
- <para>In this example, we define a new cache called
- <emphasis>fifocache</emphasis> which is in fact the same cache as in
- previous example but defined in a different manner.</para>
- </section>
- </section>
-
- <section>
- <title>How to define a distributed or a local cache?</title>
-
- <para>Actually, if you use a custom configuration for your cache as
- described in a previous section, we will use the cache mode define in
- your configuration file.</para>
-
- <para>In case, you decide to use the default configuration template,
- we use the field <emphasis>distributed</emphasis> of your
- <envar>ExoCacheConfig</envar> to decide. In other words, if the value
- of this field is false (the default value), the cache will be a local
- cache otherwise it will be the cache mode defined in your default
- configuration template that should be distributed.</para>
- </section>
-
- <section>
- <title>LRU Cache - Least Recently Used</title>
-
- <itemizedlist>
- <listitem>
- <para>New configuration</para>
-
- <para><programlisting>...
- <object-param>
- <name>lru</name>
- <description>The lru cache configuration</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheConfig">
- <field name="name"><string>lru</string></field>
- <field name="maxNodes"><int>${my-value}</int></field>
- <field name="minTimeToLive"><long>${my-value}</long></field>
- <field name="maxAge"><long>${my-value}</long></field>
- <field name="timeToLive"><long>${my-value}</long></field>
- </object>
- </object-param>
-...</programlisting><table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxNodes</entry>
-
- <entry>This is the maximum number of nodes allowed in
- this region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>minTimeToLive</entry>
-
- <entry>The minimum amount of time (in milliseconds) a
- node must be allowed to live after being accessed before
- it is allowed to be considered for eviction. 0 denotes
- that this feature is disabled, which is the default
- value.</entry>
- </row>
-
- <row>
- <entry>maxAge</entry>
-
- <entry>Lifespan of a node (in milliseconds) regardless
- of idle time before the node is swept away. 0 denotes
- immediate expiry, -1 denotes no limit.</entry>
- </row>
-
- <row>
- <entry>timeToLive</entry>
-
- <entry>The amount of time a node is not written to or
- read (in milliseconds) before the node is swept away. 0
- denotes immediate expiry, -1 denotes no limit.</entry>
- </row>
- </tbody>
- </tgroup>
- </table></para>
- </listitem>
-
- <listitem>
- <para>Old configuration</para>
-
- <programlisting>...
- <object-param>
- <name>lru-with-old-config</name>
- <description>The lru cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>lru-with-old-config</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="implementation"><string>LRU</string></field>
- </object>
- </object-param>
-...</programlisting>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxSize</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The minimum amount of time (in seconds) a node must
- be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para><note>
- <para>For the fields <emphasis>maxAge</emphasis> and
- <emphasis>timeToLive</emphasis> needed by JBoss cache, we will
- use the default values provided by the creator.</para>
- </note></para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>FIFO Cache - First In, First Out</title>
-
- <itemizedlist>
- <listitem>
- <para>New configuration<programlisting>...
- <object-param>
- <name>fifo</name>
- <description>The fifo cache configuration</description>
- <object type="org.exoplatform.services.cache.impl.jboss.fifo.FIFOExoCacheConfig">
- <field name="name"><string>fifo</string></field>
- <field name="maxNodes"><int>${my-value}</int></field>
- <field name="minTimeToLive"><long>${my-value}</long></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxNodes</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>minTimeToLive</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
-
- <listitem>
- <para>Old configuration<programlisting>...
- <object-param>
- <name>fifo-with-old-config</name>
- <description>The fifo cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>fifo-with-old-config</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="implementation"><string>FIFO</string></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxSize</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The minimum amount of time (in seconds) a node must
- be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>MRU Cache - Most Recently Used</title>
-
- <itemizedlist>
- <listitem>
- <para>New configuration<programlisting>...
- <object-param>
- <name>mru</name>
- <description>The mru cache configuration</description>
- <object type="org.exoplatform.services.cache.impl.jboss.mru.MRUExoCacheConfig">
- <field name="name"><string>mru</string></field>
- <field name="maxNodes"><int>${my-value}</int></field>
- <field name="minTimeToLive"><long>${my-value}</long></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxNodes</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>minTimeToLive</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
-
- <listitem>
- <para>Old configuration<programlisting>...
- <object-param>
- <name>mru-with-old-config</name>
- <description>The mru cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>mru-with-old-config</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="implementation"><string>MRU</string></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxSize</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The minimum amount of time (in seconds) a node must
- be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>LFU Cache - Least Frequently Used</title>
-
- <itemizedlist>
- <listitem>
- <para>New configuration<programlisting>...
- <object-param>
- <name>lfu</name>
- <description>The lfu cache configuration</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lfu.LFUExoCacheConfig">
- <field name="name"><string>lfu</string></field>
- <field name="maxNodes"><int>${my-value}</int></field>
- <field name="minNodes"><int>${my-value}</int></field>
- <field name="minTimeToLive"><long>${my-value}</long></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxNodes</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>minNodes</entry>
-
- <entry>This is the minimum number of nodes allowed in this
- region. This value determines what the eviction queue
- should prune down to per pass. e.g. If minNodes is 10 and
- the cache grows to 100 nodes, the cache is pruned down to
- the 10 most frequently used nodes when the eviction timer
- makes a pass through the eviction algorithm.</entry>
- </row>
-
- <row>
- <entry>minTimeToLive</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
-
- <listitem>
- <para>Old configuration<programlisting>...
- <object-param>
- <name>lfu-with-old-config</name>
- <description>The lfu cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>lfu-with-old-config</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="implementation"><string>LFU</string></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxSize</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para><note>
- <para>For the fields <emphasis>minNodes</emphasis> and
- <emphasis>timeToLive</emphasis> needed by JBoss cache, we will
- use the default values provided by the creator.</para>
- </note></para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>EA Cache - Expiration Algorithm</title>
-
- <itemizedlist>
- <listitem>
- <para>New configuration<programlisting>...
- <object-param>
- <name>ea</name>
- <description>The ea cache configuration</description>
- <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
- <field name="name"><string>ea</string></field>
- <field name="maxNodes"><int>${my-value}</int></field>
- <field name="minTimeToLive"><long>${my-value}</long></field>
- <field name="expirationTimeout"><long>${my-value}</long></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxNodes</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>minTimeToLive</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
-
- <row>
- <entry>expirationTimeout</entry>
-
- <entry>This is the timeout after which the cache entry
- must be evicted.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </listitem>
-
- <listitem>
- <para>Old configuration<programlisting>...
- <object-param>
- <name>ea-with-old-config</name>
- <description>The ea cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field name="name"><string>lfu-with-old-config</string></field>
- <field name="maxSize"><int>${my-value}</int></field>
- <field name="liveTime"><long>${my-value}</long></field>
- <field name="implementation"><string>EA</string></field>
- </object>
- </object-param>
-...</programlisting></para>
-
- <table>
- <title>Fields description</title>
-
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>maxSize</entry>
-
- <entry>This is the maximum number of nodes allowed in this
- region. 0 denotes immediate expiry, -1 denotes no
- limit.</entry>
- </row>
-
- <row>
- <entry>liveTime</entry>
-
- <entry>The minimum amount of time (in milliseconds) a node
- must be allowed to live after being accessed before it is
- allowed to be considered for eviction. 0 denotes that this
- feature is disabled, which is the default value.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para><note>
- <para>For the fields <emphasis>expirationTimeout</emphasis>
- needed by JBoss cache, we will use the default values provided
- by the creator.</para>
- </note></para>
- </listitem>
- </itemizedlist>
- </section>
- </section>
- </section>
-</chapter>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="ch-cache.html"?>
+
+ <title>eXo Cache</title>
+
+ <section>
+ <title>Basic concepts</title>
+
+ <para>All applications on the top of eXo JCR that need a cache, can rely
+ on an <envar>org.exoplatform.services.cache.ExoCache</envar> instance that
+ is managed by the
+ <envar>org.exoplatform.services.cache.CacheService</envar>. The main
+ implementation of this service is
+ <envar>org.exoplatform.services.cache.impl.CacheServiceImpl</envar> which
+ depends on the
+ <envar>org.exoplatform.services.cache.ExoCacheConfig</envar> in order to
+ create new <envar>ExoCache</envar> instances. See below an example of
+ <envar>org.exoplatform.services.cache.CacheService</envar>
+ definition:<programlisting> <component>
+ <key>org.exoplatform.services.cache.CacheService</key>
+ <jmx-name>cache:type=CacheService</jmx-name>
+ <type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
+ <init-params>
+ <object-param>
+ <name>cache.config.default</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>default</string></field>
+ <field name="maxSize"><int>300</int></field>
+ <field name="liveTime"><long>600</long></field>
+ <field name="distributed"><boolean>false</boolean></field>
+ <field name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component></programlisting></para>
+
+ <para><note>
+ <para>The <envar>ExoCacheConfig</envar> which name is
+ <envar>default</envar>, will be the default configuration of all the
+ <envar>ExoCache</envar> instances that don't have dedicated
+ configuration.</para>
+ </note>See below an example of how to define a new
+ <envar>ExoCacheConfig</envar> thanks to a
+ <emphasis>external-component-plugin</emphasis>:<programlisting> <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.CacheService</target-component>
+ <component-plugin>
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>Configures the cache for query service</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.wcm.composer</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>wcm.composer</string></field>
+ <field name="maxSize"><int>300</int></field>
+ <field name="liveTime"><long>600</long></field>
+ <field name="distributed"><boolean>false</boolean></field>
+ <field name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins></programlisting></para>
+
+ <table>
+ <title>Descriptions of the fields of
+ <envar>ExoCacheConfig</envar></title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>name</entry>
+
+ <entry>The name of the cache. This field is mandatory since it
+ will be used to retrieve the <envar>ExoCacheConfig</envar>
+ corresponding to a given cache name.</entry>
+ </row>
+
+ <row>
+ <entry>label</entry>
+
+ <entry>The label of the cache. This field is optional. It is
+ mainly used to indicate the purpose of the cache.</entry>
+ </row>
+
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>The maximum numbers of elements in cache. This field is
+ mandatory.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The amount of time (in seconds) an element is not written
+ or read before it is evicted. This field is mandatory.</entry>
+ </row>
+
+ <row>
+ <entry>implementation</entry>
+
+ <entry>The full qualified name of the cache implementation to use.
+ This field is optional. This field is only used for simple cache
+ implementation. The default and main implementation is
+ <envar>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</envar>,
+ this implementation only works with local caches with FIFO as
+ eviction policy. For more complex implementation see the next
+ sections.</entry>
+ </row>
+
+ <row>
+ <entry>distributed</entry>
+
+ <entry>Indicates if the cache is distributed. This field is
+ optional. This field is used for backward compatibility.</entry>
+ </row>
+
+ <row>
+ <entry>replicated</entry>
+
+ <entry>Indicates if the cache is replicated. This field is
+ optional. This field is deprecated.</entry>
+ </row>
+
+ <row>
+ <entry>logEnabled</entry>
+
+ <entry>Indicates if the log is enabled. This field is optional.
+ This field is used for backward compatibility.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>How to define a cache?</title>
+
+ <para>You have 2 ways to define a cache which are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>At <envar>CacheService</envar> initialization</para>
+ </listitem>
+
+ <listitem>
+ <para>With an <emphasis>"external plugin"</emphasis></para>
+ </listitem>
+ </itemizedlist>
+
+ <section>
+ <title>At <envar>CacheService</envar> initialization</title>
+
+ <programlisting>...
+ <component>
+ <key>org.exoplatform.services.cache.CacheService</key>
+ <type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
+ <init-params>
+ ...
+ <object-param>
+ <name>fifocache</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>fifocache</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="distributed"><boolean>false</boolean></field>
+ <field name="implementation"><string>org.exoplatform.services.cache.FIFOExoCache</string></field>
+ </object>
+ </object-param>
+ ...
+ </init-params>
+ </component>
+...</programlisting>
+
+ <para>In this example, we define a new cache called
+ <emphasis>fifocache</emphasis>.</para>
+ </section>
+
+ <section>
+ <title>With an <emphasis>"external plugin"</emphasis></title>
+
+ <programlisting>...
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.CacheService</target-component>
+ <component-plugin>
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add ExoCache configuration component plugin </description>
+ <init-params>
+ ...
+ <object-param>
+ <name>fifoCache</name>
+ <description>The fifo cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>fifocache</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="distributed"><boolean>false</boolean></field>
+ <field name="implementation"><string>org.exoplatform.services.cache.FIFOExoCache</string></field>
+ </object>
+ </object-param>
+...
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+...</programlisting>
+
+ <para>In this example, we define a new cache called
+ <emphasis>fifocache</emphasis> which is in fact the same cache as in
+ previous example but defined in a different manner.</para>
+ </section>
+ </section>
+
+ <section>
+ <title>eXo Cache extension</title>
+
+ <para>In the previous versions of eXo kernel, it was quite complex to
+ implement your own ExoCache because it was not open enough. Since kernel
+ 2.0.8, it is possible to easily integrate your favorite cache provider in
+ eXo Products.</para>
+
+ <para>You just need to implement your own <envar>ExoCacheFactory</envar>
+ and register it in an eXo container, as described below:<programlisting>package org.exoplatform.services.cache;
+...
+public interface ExoCacheFactory {
+
+ /**
+ * Creates a new instance of {@link org.exoplatform.services.cache.ExoCache}
+ * @param config the cache to create
+ * @return the new instance of {@link org.exoplatform.services.cache.ExoCache}
+ * @exception ExoCacheInitException if an exception happens while initializing the cache
+ */
+ public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException;
+}</programlisting></para>
+
+ <para>As you can see, there is only one method to implement which cans be
+ seen as a converter of an <envar>ExoCacheConfig</envar> to get an instance
+ of <envar>ExoCache</envar>. Once, you created your own implementation you
+ can simply register your factory by adding a file
+ <emphasis>conf/portal/configuration.xml</emphasis> with a content of the
+ following type:<programlisting><configuration>
+ <component>
+ <key>org.exoplatform.services.cache.ExoCacheFactory</key>
+ <type>org.exoplatform.tutorial.MyExoCacheFactoryImpl</type>
+ ...
+ </component>
+</configuration></programlisting></para>
+ </section>
+
+ <section>
+ <title>eXo Cache based on JBoss Cache</title>
+
+ <section>
+ <title>Configure the ExoCacheFactory</title>
+
+ <para>When you add the related jar file in your classpath, the eXo
+ service container will use the default configuration provided in the
+ library itself but of course you can still redefined the configuration
+ if you wish as you can do with any components.</para>
+
+ <para>The default configuration of the factory is:<programlisting><configuration>
+ <component>
+ <key>org.exoplatform.services.cache.ExoCacheFactory</key>
+ <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryImpl</type>
+ <init-params>
+ <value-param>
+ <name>cache.config.template</name>
+ <value>jar:/conf/portal/cache-configuration-template.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+</configuration></programlisting></para>
+
+ <para>As you can see the factory requires one single parameter which is
+ <emphasis>cache.config.template</emphasis>, this parameter allows you to
+ define the location of the default configuration template of your jboss
+ cache. In the default configuration, we ask the eXo container to get the
+ file shipped into the jar at
+ <emphasis>/conf/portal/cache-configuration-template.xml</emphasis>.</para>
+
+ <para>The default configuration template aims to be the skeleton from
+ which we will create any type of jboss cache instance, thus it must be
+ very generic.<note>
+ <para>The default configuration template provided with the jar aims
+ to work with any application servers, but if you intend to use JBoss
+ AS, you should redefine it in your custom configuration to fit
+ better with your AS.</para>
+ </note></para>
+ </section>
+
+ <section>
+ <title>Add specific configuration for a cache</title>
+
+ <para>If for a given reason, you need to use a specific configuration
+ for a cache, you can register one thanks to an "<emphasis>external
+ plugin</emphasis>", see an example below:<programlisting><configuration>
+ ...
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
+ <component-plugin>
+ <name>addConfig</name>
+ <set-method>addConfig</set-method>
+ <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryConfigPlugin</type>
+ <description>add Custom Configurations</description>
+ <init-params>
+ <value-param>
+ <name>myCustomCache</name>
+ <value>jar:/conf/portal/custom-cache-configuration.xml</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+ ...
+</configuration></programlisting></para>
+
+ <para>In the example above, I call the method
+ <emphasis>addConfig(ExoCacheFactoryConfigPlugin plugin)</emphasis> on
+ the current implementation of <envar>ExoCacheFactory</envar> which is
+ actually the jboss cache implementation.</para>
+
+ <para>In the <emphasis>init-params</emphasis> block, you can define a
+ set of <emphasis>value-param</emphasis> blocks and for each
+ <emphasis>value-param</emphasis>, we expect the name of cache that needs
+ a specific configuration as name and the location of your custom
+ configuration as <emphasis>value</emphasis>.</para>
+
+ <para>In this example, we indicates to the factory that we would like
+ that the cache <emphasis>myCustomCache</emphasis> use the configuration
+ available at
+ <emphasis>jar:/conf/portal/custom-cache-configuration.xml</emphasis>.</para>
+ </section>
+
+ <section>
+ <title>Add a cache creator</title>
+
+ <section>
+ <title>Understanding a cache creator</title>
+
+ <para>The factory for jboss cache, delegates the cache creation to
+ <envar>ExoCacheCreator</envar> that is defined as
+ below:<programlisting>package org.exoplatform.services.cache.impl.jboss;
+...
+public interface ExoCacheCreator {
+
+ /**
+ * Creates an eXo cache according to the given configuration {@link org.exoplatform.services.cache.ExoCacheConfig}
+ * @param config the configuration of the cache to apply
+ * @param cache the cache to initialize
+ * @exception ExoCacheInitException if an exception happens while initializing the cache
+ */
+ public ExoCache create(ExoCacheConfig config, Cache<Serializable, Object> cache) throws ExoCacheInitException;
+
+ /**
+ * Returns the type of {@link org.exoplatform.services.cache.ExoCacheConfig} expected by the creator
+ * @return the expected type
+ */
+ public Class<? extends ExoCacheConfig> getExpectedConfigType();
+
+ /**
+ * Returns the name of the implementation expected by the creator. This is mainly used to be backward compatible
+ * @return the expected by the creator
+ */
+ public String getExpectedImplementation();
+}</programlisting></para>
+
+ <para>The <envar>ExoCacheCreator</envar> allows you to define any kind
+ of jboss cache instance that you would like to have. It has been
+ designed to give you the ability to have your own type of
+ configuration and to always be backward compatible.</para>
+
+ <para>In an <envar>ExoCacheCreator</envar>, you need to implement 3
+ methods which are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>create</emphasis> - this method is used to create
+ a new <envar>ExoCache</envar> from the
+ <envar>ExoCacheConfig</envar> and a jboss cache instance.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>getExpectedConfigType</emphasis> - this method is
+ used to indicate the factory the subtype of
+ <envar>ExoCacheConfig</envar> supported by the creator.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>getExpectedImplementation</emphasis> - this method
+ is used to indicate the factory the value of the field
+ <emphasis>implementation</emphasis> of
+ <envar>ExoCacheConfig</envar> that is supported by the creator.
+ This is used for backward compatibility, in other words you can
+ still configure your cache with an instance of
+ <envar>ExoCacheConfig</envar>.</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Register a cache creator</title>
+
+ <para>You can register any cache creator you want thanks to an
+ <emphasis>"external plugin"</emphasis>, see an example
+ below:<programlisting> <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
+ <component-plugin>
+ <name>addCreator</name>
+ <set-method>addCreator</set-method>
+ <type>org.exoplatform.services.cache.impl.jboss.ExoCacheCreatorPlugin</type>
+ <description>add Exo Cache Creator</description>
+ <init-params>
+ <object-param>
+ <name>LRU</name>
+ <description>The lru cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator">
+ <field name="defaultTimeToLive"><long>1500</long></field>
+ <field name="defaultMaxAge"><long>2000</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins></programlisting></para>
+
+ <para>In the example above, I call the method
+ <emphasis>addCreator(ExoCacheCreatorPlugin plugin)</emphasis> on the
+ current implementation of <envar>ExoCacheFactory</envar> which is
+ actually the jboss cache implementation.</para>
+
+ <para>In the <emphasis>init-params</emphasis> block, you can define a
+ set of <emphasis>object-param</emphasis> blocks and for each
+ <emphasis>object-param</emphasis>, we expect any object definition of
+ type <envar>ExoCacheCreator</envar>.</para>
+
+ <para>In this example, we register the cache creator related to the
+ eviction policy <emphasis>LRU</emphasis>.</para>
+ </section>
+
+ <section>
+ <title>The cache creators available</title>
+
+ <para>By default, no cache creator are defined, so you need to define
+ them yourself by adding them in your configuration files.</para>
+
+ <section>
+ <title>LRU Cache Creator - Least Recently Used</title>
+
+ <programlisting>..
+<object-param>
+ <name>LRU</name>
+ <description>The lru cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator">
+ <field name="defaultTimeToLive"><long>${my-value}</long></field>
+ <field name="defaultMaxAge"><long>${my-value}</long></field>
+ </object>
+</object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>defaultTimeToLive</entry>
+
+ <entry>This is the default value of the field
+ <emphasis>timeToLive</emphasis> described in the section
+ dedicated to this cache type. This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+
+ <row>
+ <entry>defaultMaxAge</entry>
+
+ <entry>his is the default value of the field
+ <emphasis>maxAge</emphasis> described in the section
+ dedicated to this cache type. This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>FIFO Cache Creator - First In, First Out</title>
+
+ <programlisting>...
+<object-param>
+ <name>FIFO</name>
+ <description>The fifo cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.fifo.FIFOExoCacheCreator"></object>
+</object-param>
+...</programlisting>
+ </section>
+
+ <section>
+ <title>MRU Cache Creator - Most Recently Used</title>
+
+ <programlisting>...
+<object-param>
+ <name>MRU</name>
+ <description>The mru cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.mru.MRUExoCacheCreator"></object>
+</object-param>
+...</programlisting>
+ </section>
+
+ <section>
+ <title>LFU Cache Creator - Least Frequently Used</title>
+
+ <programlisting>...
+<object-param>
+ <name>LFU</name>
+ <description>The lfu cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lfu.LFUExoCacheCreator">
+ <field name="defaultMinNodes"><int>${my-value}</int></field>
+ </object>
+</object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>defaultMinNodes</entry>
+
+ <entry>This is the default value of the field
+ <emphasis>minNodes</emphasis> described in the section
+ dedicated to this cache type. This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>EA Cache Creator - Expiration Algorithm</title>
+
+ <programlisting>...
+<object-param>
+ <name>EA</name>
+ <description>The ea cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator">
+ <field name="defaultExpirationTimeout"><long>2000</long></field>
+ </object>
+</object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>defaultExpirationTimeout</entry>
+
+ <entry>This is the default value of the field
+ <emphasis>minNodes</emphasis> described in the section
+ dedicated to this cache type. This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>Define a JBoss cache instance</title>
+
+ <section>
+ <title>How to define a distributed or a local cache?</title>
+
+ <para>Actually, if you use a custom configuration for your cache as
+ described in a previous section, we will use the cache mode define in
+ your configuration file.</para>
+
+ <para>In case, you decide to use the default configuration template,
+ we use the field <emphasis>distributed</emphasis> of your
+ <envar>ExoCacheConfig</envar> to decide. In other words, if the value
+ of this field is false (the default value), the cache will be a local
+ cache otherwise it will be the cache mode defined in your default
+ configuration template that should be distributed.</para>
+ </section>
+
+ <section>
+ <title>LRU Cache - Least Recently Used</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration</para>
+
+ <para><programlisting>...
+ <object-param>
+ <name>lru</name>
+ <description>The lru cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheConfig">
+ <field name="name"><string>lru</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ <field name="maxAge"><long>${my-value}</long></field>
+ <field name="timeToLive"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting><table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in
+ this region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a
+ node must be allowed to live after being accessed before
+ it is allowed to be considered for eviction. 0 denotes
+ that this feature is disabled, which is the default
+ value.</entry>
+ </row>
+
+ <row>
+ <entry>maxAge</entry>
+
+ <entry>Lifespan of a node (in milliseconds) regardless
+ of idle time before the node is swept away. 0 denotes
+ immediate expiry, -1 denotes no limit.</entry>
+ </row>
+
+ <row>
+ <entry>timeToLive</entry>
+
+ <entry>The amount of time a node is not written to or
+ read (in milliseconds) before the node is swept away. 0
+ denotes immediate expiry, -1 denotes no limit.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table></para>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration</para>
+
+ <programlisting>...
+ <object-param>
+ <name>lru-with-old-config</name>
+ <description>The lru cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>lru-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>LRU</string></field>
+ </object>
+ </object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in seconds) a node must
+ be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para><note>
+ <para>For the fields <emphasis>maxAge</emphasis> and
+ <emphasis>timeToLive</emphasis> needed by JBoss cache, we will
+ use the default values provided by the creator.</para>
+ </note></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>FIFO Cache - First In, First Out</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration<programlisting>...
+ <object-param>
+ <name>fifo</name>
+ <description>The fifo cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.fifo.FIFOExoCacheConfig">
+ <field name="name"><string>fifo</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration<programlisting>...
+ <object-param>
+ <name>fifo-with-old-config</name>
+ <description>The fifo cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>fifo-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>FIFO</string></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in seconds) a node must
+ be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>MRU Cache - Most Recently Used</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration<programlisting>...
+ <object-param>
+ <name>mru</name>
+ <description>The mru cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.mru.MRUExoCacheConfig">
+ <field name="name"><string>mru</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration<programlisting>...
+ <object-param>
+ <name>mru-with-old-config</name>
+ <description>The mru cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>mru-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>MRU</string></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in seconds) a node must
+ be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>LFU Cache - Least Frequently Used</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration<programlisting>...
+ <object-param>
+ <name>lfu</name>
+ <description>The lfu cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lfu.LFUExoCacheConfig">
+ <field name="name"><string>lfu</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minNodes</entry>
+
+ <entry>This is the minimum number of nodes allowed in this
+ region. This value determines what the eviction queue
+ should prune down to per pass. e.g. If minNodes is 10 and
+ the cache grows to 100 nodes, the cache is pruned down to
+ the 10 most frequently used nodes when the eviction timer
+ makes a pass through the eviction algorithm.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration<programlisting>...
+ <object-param>
+ <name>lfu-with-old-config</name>
+ <description>The lfu cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>lfu-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>LFU</string></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para><note>
+ <para>For the fields <emphasis>minNodes</emphasis> and
+ <emphasis>timeToLive</emphasis> needed by JBoss cache, we will
+ use the default values provided by the creator.</para>
+ </note></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>EA Cache - Expiration Algorithm</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration<programlisting>...
+ <object-param>
+ <name>ea</name>
+ <description>The ea cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name"><string>ea</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ <field name="expirationTimeout"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+
+ <row>
+ <entry>expirationTimeout</entry>
+
+ <entry>This is the timeout after which the cache entry
+ must be evicted.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration<programlisting>...
+ <object-param>
+ <name>ea-with-old-config</name>
+ <description>The ea cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>lfu-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>EA</string></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para><note>
+ <para>For the fields <emphasis>expirationTimeout</emphasis>
+ needed by JBoss cache, we will use the default values provided
+ by the creator.</para>
+ </note></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>eXo Cache based on Infinispan</title>
+
+ <section>
+ <title>Configure the ExoCacheFactory</title>
+
+ <para>When you add the related jar file in your classpath, the eXo
+ service container will use the default configuration provided in the
+ library itself but of course you can still redefined the configuration
+ if you wish as you can do with any components.</para>
+
+ <para>The default configuration of the factory is:<programlisting><configuration>
+ <component>
+ <key>org.exoplatform.services.cache.ExoCacheFactory</key>
+ <type>org.exoplatform.services.cache.impl.infinispan.ExoCacheFactoryImpl</type>
+ <init-params>
+ <value-param>
+ <name>cache.config.template</name>
+ <value>jar:/conf/portal/cache-configuration-template.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+</configuration></programlisting></para>
+
+ <para>As you can see the factory requires one single parameter which is
+ <emphasis>cache.config.template</emphasis>, this parameter allows you to
+ define the location of the default configuration template of your
+ infinispan. In the default configuration, we ask the eXo container to
+ get the file shipped into the jar at
+ <emphasis>/conf/portal/cache-configuration-template.xml</emphasis>.</para>
+
+ <para>The default configuration template aims to be the skeleton from
+ which we will create any type of infinispan cache instance, thus it must
+ be very generic. <note>
+ <para>All the cache instances that will rely on this cache
+ configuration will share the same
+ <envar>EmbeddedCacheManager.</envar></para>
+ </note></para>
+ </section>
+
+ <section>
+ <title>Add specific configuration for a cache</title>
+
+ <para>If for a given reason, you need to use a specific configuration
+ for a cache, you can register one thanks to an "<emphasis>external
+ plugin</emphasis>", see an example below:<programlisting><configuration>
+ ...
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
+ <component-plugin>
+ <name>addConfig</name>
+ <set-method>addConfig</set-method>
+ <type>org.exoplatform.services.cache.impl.infinispan.ExoCacheFactoryConfigPlugin</type>
+ <description>add Custom Configurations</description>
+ <init-params>
+ <value-param>
+ <name>myCustomCache</name>
+ <value>jar:/conf/portal/custom-cache-configuration.xml</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+ ...
+</configuration></programlisting></para>
+
+ <para>In the example above, I call the method
+ <emphasis>addConfig(ExoCacheFactoryConfigPlugin plugin)</emphasis> on
+ the current implementation of <envar>ExoCacheFactory</envar> which is
+ actually the infinispan implementation.</para>
+
+ <para>In the <emphasis>init-params</emphasis> block, you can define a
+ set of <emphasis>value-param</emphasis> blocks and for each
+ <emphasis>value-param</emphasis>, we expect the name of cache that needs
+ a specific configuration as name and the location of your custom
+ configuration as <emphasis>value</emphasis>.</para>
+
+ <para>In this example, we indicates to the factory that we would like
+ that the cache <emphasis>myCustomCache</emphasis> use the configuration
+ available at
+ <emphasis>jar:/conf/portal/custom-cache-configuration.xml</emphasis>.</para>
+
+ <note>
+ <para>All the cache instances that will rely on the cache
+ configuration located at the same location will share the same
+ <envar>EmbeddedCacheManager</envar>.</para>
+ </note>
+ </section>
+
+ <section>
+ <title>Add a cache creator</title>
+
+ <section>
+ <title>Understanding a cache creator</title>
+
+ <para>The factory for infinispan, delegates the cache creation to
+ <envar>ExoCacheCreator</envar> that is defined as
+ below:<programlisting>package org.exoplatform.services.cache.impl.infinispan;
+...
+public interface ExoCacheCreator {
+
+ /**
+ * Creates an eXo cache according to the given configuration {@link org.exoplatform.services.cache.ExoCacheConfig}
+ * @param config the configuration of the cache to apply
+ * @param cacheConfig the configuration of the infinispan cache
+ * @param cacheGetter a {@link Callable} instance from which we can get the cache
+ * @exception ExoCacheInitException if an exception happens while initializing the cache
+ */
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Configuration cacheConfig, Callable<Cache<Serializable, Object>> cacheGetter) throws ExoCacheInitException;
+
+ /**
+ * Returns the type of {@link org.exoplatform.services.cache.ExoCacheConfig} expected by the creator
+ * @return the expected type
+ */
+ public Class<? extends ExoCacheConfig> getExpectedConfigType();
+
+ /**
+ * Returns a set of all the implementations expected by the creator. This is mainly used to be backward compatible
+ * @return the expected by the creator
+ */
+ public Set<String> getExpectedImplementations();
+}</programlisting></para>
+
+ <para>The <envar>ExoCacheCreator</envar> allows you to define any kind
+ of infinispan cache instance that you would like to have. It has been
+ designed to give you the ability to have your own type of
+ configuration and to always be backward compatible.</para>
+
+ <para>In an <envar>ExoCacheCreator</envar>, you need to implement 3
+ methods which are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>create</emphasis> - this method is used to create
+ a new <envar>ExoCache</envar> from the
+ <envar>ExoCacheConfig</envar>, an inifinispan cache configuration
+ and a Callable object to allow you to get the cache
+ instance.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>getExpectedConfigType</emphasis> - this method is
+ used to indicate the factory the subtype of
+ <envar>ExoCacheConfig</envar> supported by the creator.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>getExpectedImplementation</emphasis>s - this
+ method is used to indicate the factory the values of the field
+ <emphasis>implementation</emphasis> of
+ <envar>ExoCacheConfig</envar> that is supported by the creator.
+ This is used for backward compatibility, in other words you can
+ still configure your cache with an instance of
+ <envar>ExoCacheConfig</envar>.</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Register a cache creator</title>
+
+ <para>You can register any cache creator you want thanks to an
+ <emphasis>"external plugin"</emphasis>, see an example
+ below:<programlisting> <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
+ <component-plugin>
+ <name>addCreator</name>
+ <set-method>addCreator</set-method>
+ <type>org.exoplatform.services.cache.impl.infinispan.ExoCacheCreatorPlugin</type>
+ <description>add Exo Cache Creator</description>
+ <init-params>
+ <object-param>
+ <name>Test</name>
+ <description>The cache creator for testing purpose</description>
+ <object type="org.exoplatform.services.cache.impl.infinispan.TestExoCacheCreator"></object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins></programlisting></para>
+
+ <para>In the example above, I call the method
+ <emphasis>addCreator(ExoCacheCreatorPlugin plugin)</emphasis> on the
+ current implementation of <envar>ExoCacheFactory</envar> which is
+ actually the infinispan implementation.</para>
+
+ <para>In the <emphasis>init-params</emphasis> block, you can define a
+ set of <emphasis>object-param</emphasis> blocks and for each
+ <emphasis>object-param</emphasis>, we expect any object definition of
+ type <envar>ExoCacheCreator</envar>.</para>
+
+ <para>In this example, we register the cache creator related to the
+ eviction policy <emphasis>Test</emphasis>.</para>
+ </section>
+
+ <section>
+ <title>The cache creators available</title>
+
+ <para>By default, no cache creator are defined, so you need to define
+ them yourself by adding them in your configuration files.</para>
+
+ <section>
+ <title>Generic Cache Creator</title>
+
+ <para>This is the generic cache creator that allows you to use any
+ eviction strategies defined by default in Infinispan.</para>
+
+ <programlisting>..
+<object-param>
+ <name>GENERIC</name>
+ <description>The generic cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.infinispan.generic.GenericExoCacheCreator">
+ <field name="implementations">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>NONE</string>
+ </value>
+ <value>
+ <string>FIFO</string>
+ </value>
+ <value>
+ <string>LRU</string>
+ </value>
+ <value>
+ <string>UNORDERED</string>
+ </value>
+ <value>
+ <string>LIRS</string>
+ </value>
+ </collection>
+ </field>
+ <field name="defaultStrategy"><string>${my-value}</string></field>
+ <field name="defaultMaxIdle"><long>${my-value}</long></field>
+ <field name="defaultWakeUpInterval"><long>${my-value}</long></field>
+ </object>
+</object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>implementations</entry>
+
+ <entry>This is the list of all the
+ <emphasis>implementations</emphasis> supported by the cache
+ creator. Actualy, it is a subset of the full list of the
+ eviction strategies supported by infinispan to which you
+ want to give access to. In the configuraton above, you have
+ the full list of all the eviction strategies currently
+ supported by infinispan 4.1. This field is used to manage
+ the backward compatibility.</entry>
+ </row>
+
+ <row>
+ <entry>defaultStrategy</entry>
+
+ <entry>This is the name of the default eviction strategy to
+ use. By default the value is <emphasis>LRU</emphasis>. This
+ value is only use when we define a cache of this type with
+ the old configuration.</entry>
+ </row>
+
+ <row>
+ <entry>defaultMaxIdle</entry>
+
+ <entry>This is the default value of the field
+ <emphasis>maxIdle</emphasis> described in the section
+ dedicated to this cache type. By default the value is
+ <emphasis>-1</emphasis>.This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+
+ <row>
+ <entry>defaultWakeUpInterval</entry>
+
+ <entry>his is the default value of the field
+ <emphasis>wakeUpInterval</emphasis> described in the section
+ dedicated to this cache type. By default the value is
+ <emphasis>5000</emphasis>.This value is only use when we
+ define a cache of this type with the old
+ configuration</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>Define an infinispan cache instance</title>
+
+ <section>
+ <title>How to define a distributed or a local cache?</title>
+
+ <para>Actually, if you use a custom configuration for your cache as
+ described in a previous section, we will use the cache mode define in
+ your configuration file.</para>
+
+ <para>In case, you decide to use the default configuration template,
+ we use the field <emphasis>distributed</emphasis> of your
+ <envar>ExoCacheConfig</envar> to decide. In other words, if the value
+ of this field is false (the default value), the cache will be a local
+ cache otherwise it will be the cache mode defined in your default
+ configuration template that should be distributed.</para>
+ </section>
+
+ <section>
+ <title>How to define an infinispan cache instance</title>
+
+ <para>All the eviction strategies proposed by default in infinispan
+ rely on the generic cache creator.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration</para>
+
+ <para><programlisting>...
+ <object-param>
+ <name>myCache</name>
+ <description>My cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.infinispan.generic.GenericExoCacheConfig">
+ <field name="name"><string>myCacheName</string></field>
+ <field name="strategy"><int>${my-value}</int></field>
+ <field name="maxEntries"><long>${my-value}</long></field>
+ <field name="lifespan"><long>${my-value}</long></field>
+ <field name="maxIdle"><long>${my-value}</long></field>
+ <field name="wakeUpInterval"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting><table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>strategy</entry>
+
+ <entry>The name of the strategy to use such as
+ 'UNORDERED', 'FIFO', 'LRU', 'LIRS' and 'NONE' (to
+ disable eviction).</entry>
+ </row>
+
+ <row>
+ <entry>maxEntries</entry>
+
+ <entry>Maximum number of entries in a cache instance. If
+ selected value is not a power of two the actual value
+ will default to the least power of two larger than
+ selected value. -1 means no limit which is also the
+ default value.</entry>
+ </row>
+
+ <row>
+ <entry>lifespan</entry>
+
+ <entry>Maximum lifespan of a cache entry, after which
+ the entry is expired cluster-wide, in milliseconds. -1
+ means the entries never expire which is also the default
+ value.</entry>
+ </row>
+
+ <row>
+ <entry>maxIdle</entry>
+
+ <entry>Maximum idle time a cache entry will be
+ maintained in the cache, in milliseconds. If the idle
+ time is exceeded, the entry will be expired
+ cluster-wide. -1 means the entries never expire which is
+ also the default value.</entry>
+ </row>
+
+ <row>
+ <entry>wakeUpInterval</entry>
+
+ <entry>Interval between subsequent eviction runs, in
+ milliseconds. If you wish to disable the periodic
+ eviction process altogether, set wakeupInterval to -1.
+ The default value is 5000.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table></para>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration</para>
+
+ <programlisting>...
+ <object-param>
+ <name>myCache</name>
+ <description>My cache configuration</description>
+ <field name="name"><string>lru-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>${my-value}</string></field>
+ </object>
+ </object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>Maximum number of entries in a cache instance. If
+ selected value is not a power of two the actual value will
+ default to the least power of two larger than selected
+ value. -1 means no limit which is also the default
+ value.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>Maximum lifespan of a cache entry, after which the
+ entry is expired cluster-wide, in milliseconds. -1 means
+ the entries never expire which is also the default
+ value.</entry>
+ </row>
+
+ <row>
+ <entry>implementation</entry>
+
+ <entry>The name of the implementation to use the expected
+ value is one of the eviction strategies defined in the
+ field <emphasis>implementations</emphasis> of the generic
+ cache creator.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para><note>
+ <para>For the fields <emphasis>maxIdle</emphasis> and
+ <emphasis>wakeUpInterval</emphasis> needed by infinispan, we
+ will use the default values provided by the creator.</para>
+ </note></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+ </section>
+</chapter>
13 years, 11 months
exo-jcr SVN: r2915 - kernel/branches/2.3-ISPN.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-08-13 08:25:27 -0400 (Fri, 13 Aug 2010)
New Revision: 2915
Modified:
kernel/branches/2.3-ISPN/pom.xml
Log:
EXOJCR-802: Configured to use infinispan 4.1.0.CR2 and JGroups 2.10.0.GA
Modified: kernel/branches/2.3-ISPN/pom.xml
===================================================================
--- kernel/branches/2.3-ISPN/pom.xml 2010-08-13 12:22:34 UTC (rev 2914)
+++ kernel/branches/2.3-ISPN/pom.xml 2010-08-13 12:25:27 UTC (rev 2915)
@@ -180,7 +180,7 @@
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>2.10.0.CR1</version>
+ <version>2.10.0.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
@@ -190,7 +190,7 @@
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
- <version>4.1.0.CR1</version>
+ <version>4.1.0.CR2</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
13 years, 11 months
exo-jcr SVN: r2914 - kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-08-13 08:22:34 -0400 (Fri, 13 Aug 2010)
New Revision: 2914
Modified:
kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
Log:
EXOJCR-802: In case several caches use the same custom configuration, the same cache manger will be used
Modified: kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2010-08-13 11:56:46 UTC (rev 2913)
+++ kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2010-08-13 12:22:34 UTC (rev 2914)
@@ -95,6 +95,11 @@
* The mapping between the cache names and the configuration paths
*/
private final Map<String, String> mappingCacheNameConfig = new HashMap<String, String>();
+
+ /**
+ * The mapping between the configuration paths and the cache managers
+ */
+ private final Map<String, DefaultCacheManager> mappingConfigPathCacheManager = new HashMap<String, DefaultCacheManager>();
/**
* The default creator
@@ -245,8 +250,14 @@
// A custom configuration has been set
if (LOG.isInfoEnabled())
LOG.info("A custom configuration has been set for the cache '" + region + "'.");
- DefaultCacheManager cacheManager =
- new DefaultCacheManager(configManager.getInputStream(customConfig), false);
+ DefaultCacheManager cacheManager = mappingConfigPathCacheManager.get(customConfig);
+ if (cacheManager == null)
+ {
+ // No cache manager has been defined so far for this configuration file
+ cacheManager = new DefaultCacheManager(configManager.getInputStream(customConfig), false);
+ // We register this new cache manager
+ mappingConfigPathCacheManager.put(customConfig, cacheManager);
+ }
conf = cacheManager.getDefaultConfiguration().clone();
}
else
13 years, 11 months
exo-jcr SVN: r2913 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core: value and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-08-13 07:56:46 -0400 (Fri, 13 Aug 2010)
New Revision: 2913
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
Log:
EXOJCR-776 : Repository.toString returns also def.workspace and the whole list of workspaces, Value.toString returns value, if it is possible.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-08-13 09:06:03 UTC (rev 2912)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-08-13 11:56:46 UTC (rev 2913)
@@ -49,6 +49,7 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -637,7 +638,7 @@
public void removeWorkspace(String workspaceName) throws RepositoryException
{
if (!canRemoveWorkspace(workspaceName))
-
+
throw new RepositoryException("Workspace " + workspaceName + " in use. If you want to "
+ " remove workspace close all open sessions");
@@ -725,8 +726,10 @@
default :
stateTitle = "undefined";
}
- return String.format("Repository {\n name: %s;\n system workspace: %s;\n state: %s \n}", name,
- systemWorkspaceName, stateTitle);
+ String defaultWorkspaceName = config.getDefaultWorkspaceName();
+ return String.format(
+ "Repository {\n name: %s;\n system workspace: %s;\n default workspace: %s;\n workspaces: %s;\n state: %s \n}",
+ name, systemWorkspaceName, defaultWorkspaceName, Arrays.toString(getWorkspaceNames()), stateTitle);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2010-08-13 09:06:03 UTC (rev 2912)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2010-08-13 11:56:46 UTC (rev 2913)
@@ -426,6 +426,8 @@
public String toString()
{
String typeName;
+ // contains size or value
+ String info;
try
{
typeName = PropertyType.nameFromValue(type);
@@ -435,8 +437,27 @@
// Value has abnormal type
typeName = String.valueOf(type);
}
- return String.format("Value {\n type: %s;\n data-class: %s;\n size: %s bytes\n}", typeName, internalData == null
- ? null : internalData.getClass().getName(), internalData == null ? "undefined" : internalData.getLength());
+ if (type == PropertyType.BINARY)
+ {
+ info = "size: " + ((internalData == null) ? "undefined" : (internalData.getLength() + " bytes"));
+ }
+ else
+ {
+ try
+ {
+ info = "value: '" + getString() + "'";
+ }
+ catch (IllegalStateException e)
+ {
+ info = "can't retrieve value";
+ }
+ catch (RepositoryException e)
+ {
+ info = "can't retrieve value";
+ }
+ }
+ return String.format("Value {\n type: %s;\n data-class: %s;\n %s\n}", typeName, internalData == null ? null
+ : internalData.getClass().getName(), info);
}
}
13 years, 11 months