exo-jcr SVN: r1014 - in kernel/branches/config-branch/exo.kernel.container/src: main/resources/xsd_1_1 and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-11 16:41:36 -0500 (Fri, 11 Dec 2009)
New Revision: 1014
Added:
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-01.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-02.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-03.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-04.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-05.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-06.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-07.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-08.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-09.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-10.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-11.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-12.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-13.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-14.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-15.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-16.xml
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestXSD_1_1.java
Modified:
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
Log:
correct handling of namespace kernel 1.0 and 1.1
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-12-11 20:44:15 UTC (rev 1013)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -25,7 +25,9 @@
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -39,6 +41,7 @@
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMSource;
@@ -90,8 +93,8 @@
+ "XML declaration similar to\n"
+ "<configuration\n"
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
- + " xsi:schemaLocation=\"http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd\"\n"
- + " xmlns=\"http://www.exoplaform.org/xml/ns/kernel_1_0.xsd\">");
+ + " xsi:schemaLocation=\"http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd\"\n"
+ + " xmlns=\"http://www.exoplaform.org/xml/ns/kernel_1_1.xsd\">");
}
else
{
@@ -133,49 +136,39 @@
*/
public boolean isValid(URL url) throws NullPointerException, IOException
{
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- URL schemaURL = getClass().getResource("kernel-configuration_1_0.xsd");
- if (schemaURL != null)
- {
- try
- {
- Schema schema = factory.newSchema(schemaURL);
- Validator validator = schema.newValidator();
- Reporter reporter = new Reporter(url);
- validator.setErrorHandler(reporter);
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ String[] schemas = {
+ Namespaces.KERNEL_1_0_URI,
+ Namespaces.KERNEL_1_1_URI
+ };
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemas);
+ factory.setNamespaceAware(true);
+ factory.setValidating(true);
- // Validate the document
- validator.validate(new StreamSource(url.openStream()));
- return reporter.valid;
- }
- catch (SAXException e)
- {
- log.error("Got a sax exception when doing XSD validation");
- e.printStackTrace(System.err);
- return false;
- }
+ try
+ {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Reporter reporter = new Reporter(url);
+ builder.setErrorHandler(reporter);
+ builder.setEntityResolver(Namespaces.resolver);
+ builder.parse(url.openStream());
+ return reporter.valid;
}
- else
+ catch (ParserConfigurationException e)
{
- return true;
+ log.error("Got a parser configuration exception when doing XSD validation");
+ return false;
}
+ catch (SAXException e)
+ {
+ log.error("Got a sax exception when doing XSD validation");
+ return false;
+ }
}
public Configuration unmarshall(URL url) throws Exception
{
-
- /*
- byte[] bytes = new byte[256];
- InputStream in = url.openStream();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (int s = in.read(bytes);s != -1;s = in.read(bytes)) {
- out.write(bytes, 0, s);
- }
- String s = out.toString();
- log.info("s = " + s);
- */
-
- //
boolean valid = isValid(url);
if (!valid)
{
Added: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration;
+
+import org.exoplatform.commons.utils.IOUtil;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class EntityResolverImpl implements EntityResolver
+{
+
+ /** . */
+ private final Map<String, String> systemIdToResourcePath;
+
+ /** . */
+ private final ConcurrentMap<String, byte[]> systemIdToSource;
+
+ /** . */
+ private final ClassLoader loader;
+
+ public EntityResolverImpl(ClassLoader loader, Map<String, String> systemIdToResourcePath)
+ {
+ // Defensive copy
+ this.systemIdToResourcePath = new HashMap<String, String>(systemIdToResourcePath);
+ this.systemIdToSource = new ConcurrentHashMap<String, byte[]>();
+ this.loader = loader;
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+ {
+ if (systemId != null)
+ {
+ byte[] data = systemIdToSource.get(systemId);
+
+ //
+ if (data == null)
+ {
+ String path = systemIdToResourcePath.get(systemId);
+ if (path != null)
+ {
+ InputStream in = loader.getResourceAsStream(path);
+ if (in != null)
+ {
+ data = IOUtil.getStreamContentAsBytes(in);
+ }
+ }
+
+ // Black list it, we won't find it
+ if (data == null)
+ {
+ data = new byte[0];
+ }
+
+ // Put in cache
+ systemIdToSource.put(systemId, data);
+
+ // Some basic prevention against stupid use of this class that could cause OOME
+ if (systemIdToSource.size() > 1000)
+ {
+ systemIdToSource.clear();
+ }
+ }
+
+ //
+ if (data != null && data.length > 0)
+ {
+ return new InputSource(new ByteArrayInputStream(data));
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration;
+
+import org.xml.sax.EntityResolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Namespaces
+{
+
+ /** . */
+ public static final String KERNEL_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
+
+ /** . */
+ public static final String KERNEL_1_1_URI = "http://www.exoplaform.org/xml/ns/kernel_1_1.xsd";
+
+ /** . */
+ static final EntityResolver resolver;
+
+ static
+ {
+ Map<String, String> resourceMap = new HashMap<String, String>();
+ resourceMap.put(KERNEL_1_0_URI, "org/exoplatform/container/configuration/kernel-configuration_1_0.xsd");
+ resourceMap.put(KERNEL_1_1_URI, "org/exoplatform/container/configuration/kernel-configuration_1_1.xsd");
+ resolver = new EntityResolverImpl(Namespaces.class.getClassLoader(), resourceMap);
+ }
+}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-12-11 20:44:15 UTC (rev 1013)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -29,6 +29,7 @@
import java.util.HashSet;
import java.util.Set;
+import static org.exoplatform.container.configuration.Namespaces.*;
/**
* Removes kernel namespace declaration from the document to not confuse the jibx thing.
@@ -44,12 +45,6 @@
private static final Log log = ExoLogger.getExoLogger(NoKernelNamespaceSAXFilter.class);
/** . */
- private static final String KERNEL_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
-
- /** . */
- private static final String KERNEL_1_1_URI = "http://www.exoplaform.org/xml/ns/kernel_1_1.xsd";
-
- /** . */
private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
/** . */
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2009-12-11 20:44:15 UTC (rev 1013)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Set;
+import static org.exoplatform.container.configuration.Namespaces.*;
/**
* Filters a kernel DOM according to a list of active profiles.
@@ -38,12 +39,6 @@
{
/** . */
- private static final String KERNEL_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
-
- /** . */
- private static final String KERNEL_1_1_URI = "http://www.exoplaform.org/xml/ns/kernel_1_1.xsd";
-
- /** . */
private static final String PROFILE_ATTRIBUTE = "profile";
/** . */
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-01.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-01.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-01.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.portal.config.DataStorage</key>
+ <type>org.exoplatform.portal.config.jcr.DataStorageImpl</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.portal.application.UserGadgetStorage</key>
+ <type>org.exoplatform.portal.application.jcr.UserGadgetStorageImpl</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.portal.layout.PortalLayoutService</key>
+ <type>org.exoplatform.portal.layout.jcr.PortalLayoutServiceImpl</type>
+ <init-params>
+ <value-param>
+ <name>template.location</name>
+ <description>Location of container templates</description>
+ <value>war:/conf/portal/template/containers</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.portal.config.UserACL</key>
+ <type>org.exoplatform.portal.config.UserACL</type>
+ <init-params>
+ <value-param>
+ <name>super.user</name>
+ <description>administrator</description>
+ <value>root</value>
+ </value-param>
+
+ <value-param>
+ <name>portal.creator.groups</name>
+ <description>groups with membership type have permission to manage portal</description>
+ <value>*:/platform/administrators,*:/organization/management/executive-board</value>
+ </value-param>
+
+ <value-param>
+ <name>navigation.creator.membership.type</name>
+ <description>specific membership type have full permission with group navigation</description>
+ <value>manager</value>
+ </value-param>
+ <value-param>
+ <name>guests.group</name>
+ <description>guests group</description>
+ <value>/platform/guests</value>
+ </value-param>
+ <value-param>
+ <name>access.control.workspace</name>
+ <description>groups with memberships that have the right to access the User Control Workspace</description>
+ <value>*:/platform/administrators,*:/organization/management/executive-board</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.portal.config.UserPortalConfigService</key>
+ <type>org.exoplatform.portal.config.UserPortalConfigService</type>
+ <component-plugins>
+ <component-plugin>
+ <name>new.portal.config.user.listener</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <description>this listener init the portal configuration</description>
+ <init-params>
+ <value-param>
+ <name>default.portal</name>
+ <description>The default portal for checking db is empty or not</description>
+ <value>classic</value>
+ </value-param>
+ <object-param>
+ <name>portal.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value><string>classic</string></value>
+ </collection>
+ </field>
+ <field name="ownerType"><string>portal</string></field>
+ <field name="templateLocation"><string>war:/conf/portal</string></field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>group.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value><string>platform/administrators</string></value>
+ <value><string>platform/users</string></value>
+ <value><string>platform/guests</string></value>
+ <value><string>organization/management/executive-board</string></value>
+ </collection>
+ </field>
+ <field name="ownerType"><string>group</string></field>
+ <field name="templateLocation"><string>war:/conf/portal</string></field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>user.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value><string>root</string></value>
+ <value><string>john</string></value>
+ <value><string>marry</string></value>
+ <value><string>demo</string></value>
+ </collection>
+ </field>
+ <field name="ownerType"><string>user</string></field>
+ <field name="templateLocation"><string>war:/conf/portal</string></field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>page.templates</name>
+ <description>List of page templates</description>
+ <object type="org.exoplatform.portal.config.PageTemplateConfig">
+ <field name="templates">
+ <collection type="java.util.ArrayList"></collection>
+ </field>
+ <field name="location"><string>war:/conf/portal/template/pages</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </component-plugins>
+
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
+
+ <component-plugin>
+ <name>user.portal.config.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.portal.config.UserPortalConfigListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>group.portal.config.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.portal.config.GroupPortalConfigListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>ecm.new.user.event.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NewUserListener</type>
+ <description>description</description>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig">
+ <field name="repository"><string>repository</string></field>
+ <field name="workspaces">
+ <collection type="java.util.ArrayList">
+ <value><string>collaboration</string></value>
+ </collection>
+ </field>
+ <field name="jcrPaths">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig$JcrPath">
+ <field name="alias"><string>userApplicationData</string></field>
+ <field name="path"><string>ApplicationData</string></field>
+ <field name="nodeType"><string>nt:unstructured</string></field>
+ <field name="permissions">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig$Permission">
+ <field name="identity"><string>*:/platform/administrators</string></field>
+ <field name="read"><string>true</string></field>
+ <field name="addNode"><string>true</string></field>
+ <field name="setProperty"><string>true</string></field>
+ <field name="remove"><string>true</string></field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ <field name="mixinTypes">
+ <collection type="java.util.ArrayList">
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-02.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-02.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-02.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.application.gadget.GadgetRegistryService</key>
+ <type>org.exoplatform.application.gadget.jcr.GadgetRegistryServiceImpl</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.application.gadget.SourceStorage</key>
+ <type>org.exoplatform.application.gadget.jcr.SourceStorageImpl</type>
+ <init-params>
+ <properties-param>
+ <name>location</name>
+ <description>The location store source of gadgets</description>
+ <property name="repository" value="repository"></property>
+ <property name="workspace" value="gadgets"></property>
+ <property name="store.path" value="/"></property>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.application.registry.ApplicationRegistryService</key>
+ <type>org.exoplatform.application.registry.jcr.ApplicationRegistryServiceImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>new.portal.portlets.registry</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.application.registry.ApplicationCategoriesPlugins</type>
+ <description>this listener init the portlets are registered in PortletRegister</description>
+ <init-params>
+ <object-param>
+ <name>administration</name>
+ <description>description</description>
+ <object type="org.exoplatform.application.registry.ApplicationCategory">
+ <field name="name"><string>administration</string></field>
+ <field name="displayName"><string>Administration</string></field>
+ <field name="description"><string>application for administration</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/administrators</string></value>
+ <value><string>*:/organization/management/executive-board</string></value>
+ </collection>
+ </field>
+ <field name="applications">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="applicationName"><string>ApplicationRegistryPortlet</string></field>
+ <field name="categoryName"><string>administration</string></field>
+ <field name="displayName"><string>Application Registry</string></field>
+ <field name="description"><string>Application Registry</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>exoadmin</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/administrators</string></value>
+ <value><string>*:/organization/management/executive-board</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="applicationName"><string>OrganizationPortlet</string></field>
+ <field name="categoryName"><string>administration</string></field>
+ <field name="displayName"><string>Organization Management</string></field>
+ <field name="description"><string>Organization Management</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>exoadmin</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/administrators</string></value>
+ <value><string>*:/organization/management/executive-board</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="applicationName"><string>AccountPortlet</string></field>
+ <field name="categoryName"><string>administration</string></field>
+ <field name="displayName"><string>New Account</string></field>
+ <field name="description"><string>New Account</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>exoadmin</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/administrators</string></value>
+ <value><string>*:/organization/management/executive-board</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+
+ <object-param>
+ <name>web</name>
+ <description>description</description>
+ <object type="org.exoplatform.application.registry.ApplicationCategory">
+ <field name="name"><string>web</string></field>
+ <field name="displayName"><string>web</string></field>
+ <field name="description"><string>BasicPortlets</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ <field name="applications">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="categoryName"><string>web</string></field>
+ <field name="applicationName"><string>IFramePortlet</string></field>
+ <field name="displayName"><string>IFrame</string></field>
+ <field name="description"><string>IFrame</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>web</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="categoryName"><string>web</string></field>
+ <field name="applicationName"><string>SiteMapPortlet</string></field>
+ <field name="displayName"><string>SiteMap</string></field>
+ <field name="description"><string>SiteMap</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>web</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="categoryName"><string>web</string></field>
+ <field name="applicationName"><string>BrowserPortlet</string></field>
+ <field name="displayName"><string>Web Explorer</string></field>
+ <field name="description"><string>Web Explorer</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>web</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+
+ <object-param>
+ <name>dashboard</name>
+ <description>description</description>
+ <object type="org.exoplatform.application.registry.ApplicationCategory">
+ <field name="name"><string>dashboard</string></field>
+ <field name="displayName"><string>Dashboard</string></field>
+ <field name="description"><string>Dashboard</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ <field name="applications">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="categoryName"><string>dashboard</string></field>
+ <field name="applicationName"><string>DashboardPortlet</string></field>
+ <field name="displayName"><string>Dashboard Portlet</string></field>
+ <field name="description"><string>Dashboard Portlet</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>dashboard</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.application.registry.Application">
+ <field name="categoryName"><string>dashboard</string></field>
+ <field name="applicationName"><string>GadgetPortlet</string></field>
+ <field name="displayName"><string>Gadget Wrapper Portlet</string></field>
+ <field name="description"><string>Gadget Wrapper Portlet</string></field>
+ <field name="applicationType"><string>portlet</string></field>
+ <field name="applicationGroup"><string>dashboard</string></field>
+ <field name="accessPermissions">
+ <collection type="java.util.ArrayList" item-type="java.lang.String">
+ <value><string>*:/platform/users</string></value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </component-plugins>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-03.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-03.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-03.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
+ <component-plugin>
+ <name>init.service.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.organization.OrganizationDatabaseInitializer</type>
+ <description>this listener populate organization data for the first launch</description>
+ <init-params>
+ <value-param>
+ <name>checkDatabaseAlgorithm</name>
+ <description>check database</description>
+ <value>entry</value>
+ </value-param>
+ <value-param>
+ <name>printInformation</name>
+ <description>Print information init database</description>
+ <value>false</value>
+ </value-param>
+ <object-param>
+ <name>configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.services.organization.OrganizationConfig">
+ <field name="membershipType">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
+ <field name="type"><string>manager</string></field>
+ <field name="description"><string>manager membership type</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
+ <field name="type"><string>member</string></field>
+ <field name="description"><string>member membership type</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
+ <field name="type"><string>validator</string></field>
+ <field name="description"><string>validator membership type</string></field>
+ </object>
+ </value>
+ </collection>
+ </field>
+
+ <field name="group">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>platform</string></field>
+ <field name="parentId"><string></string></field>
+ <field name="description"><string>the /platform group</string></field>
+ <field name="label"><string>Platform</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>administrators</string></field>
+ <field name="parentId"><string>/platform</string></field>
+ <field name="description"><string>the /platform/administrators group</string></field>
+ <field name="label"><string>Administrators</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>users</string></field>
+ <field name="parentId"><string>/platform</string></field>
+ <field name="description"><string>the /platform/users group</string></field>
+ <field name="label"><string>Users</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>guests</string></field>
+ <field name="parentId"><string>/platform</string></field>
+ <field name="description"><string>the /platform/guests group</string></field>
+ <field name="label"><string>Guests</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>organization</string></field>
+ <field name="parentId"><string></string></field>
+ <field name="description"><string>the organization group</string></field>
+ <field name="label"><string>Organization</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>management</string></field>
+ <field name="parentId"><string>/organization</string></field>
+ <field name="description"><string>the /organization/management group</string></field>
+ <field name="label"><string>Management</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>executive-board</string></field>
+ <field name="parentId"><string>/organization/management</string></field>
+ <field name="description"><string>the /organization/management/executive-board group</string></field>
+ <field name="label"><string>Executive Board</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>human-resources</string></field>
+ <field name="parentId"><string>/organization/management</string></field>
+ <field name="description"><string>the /organization/management/human-resource group</string></field>
+ <field name="label"><string>Human Resources</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>communication</string></field>
+ <field name="parentId"><string>/organization</string></field>
+ <field name="description"><string>the /organization/communication group</string></field>
+ <field name="label"><string>Communication</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>marketing</string></field>
+ <field name="parentId"><string>/organization/communication</string></field>
+ <field name="description"><string>the /organization/communication/marketing group</string></field>
+ <field name="label"><string>Marketing</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>press-and-media</string></field>
+ <field name="parentId"><string>/organization/communication</string></field>
+ <field name="description"><string>the /organization/communication/press-and-media group</string></field>
+ <field name="label"><string>Press and Media</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>operations</string></field>
+ <field name="parentId"><string>/organization</string></field>
+ <field name="description"><string>the /organization/operations and media group</string></field>
+ <field name="label"><string>Operations</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>sales</string></field>
+ <field name="parentId"><string>/organization/operations</string></field>
+ <field name="description"><string>the /organization/operations/sales group</string></field>
+ <field name="label"><string>Sales</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>finances</string></field>
+ <field name="parentId"><string>/organization/operations</string></field>
+ <field name="description"><string>the /organization/operations/finances group</string></field>
+ <field name="label"><string>Finances</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>customers</string></field>
+ <field name="parentId"><string></string></field>
+ <field name="description"><string>the /customers group</string></field>
+ <field name="label"><string>Customers</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
+ <field name="name"><string>partners</string></field>
+ <field name="parentId"><string></string></field>
+ <field name="description"><string>the /partners group</string></field>
+ <field name="label"><string>Partners</string></field>
+ </object>
+ </value>
+ </collection>
+ </field>
+
+ <field name="user">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$User">
+ <field name="userName"><string>root</string></field>
+ <field name="password"><string>exo</string></field>
+ <field name="firstName"><string>Root</string></field>
+ <field name="lastName"><string>Root</string></field>
+ <field name="email"><string>root@localhost</string></field>
+ <field name="groups">
+ <string>
+ manager:/platform/administrators,member:/platform/users,
+ member:/organization/management/executive-board
+ </string>
+ </field>
+ </object>
+ </value>
+
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$User">
+ <field name="userName"><string>john</string></field>
+ <field name="password"><string>exo</string></field>
+ <field name="firstName"><string>John</string></field>
+ <field name="lastName"><string>Anthony</string></field>
+ <field name="email"><string>john@localhost</string></field>
+ <field name="groups">
+ <string>
+ member:/platform/administrators,member:/platform/users,
+ manager:/organization/management/executive-board
+ </string>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$User">
+ <field name="userName"><string>marry</string></field>
+ <field name="password"><string>exo</string></field>
+ <field name="firstName"><string>Marry</string></field>
+ <field name="lastName"><string>Kelly</string></field>
+ <field name="email"><string>marry@localhost</string></field>
+ <field name="groups">
+ <string>member:/platform/users</string>
+ </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.organization.OrganizationConfig$User">
+ <field name="userName"><string>demo</string></field>
+ <field name="password"><string>exo</string></field>
+ <field name="firstName"><string>Demo</string></field>
+ <field name="lastName"><string>exo</string></field>
+ <field name="email"><string>demo@localhost</string></field>
+ <field name="groups">
+ <string>member:/platform/guests,member:/platform/users</string>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+
+ <component-plugin>
+ <name>new.user.event.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.organization.impl.NewUserEventListener</type>
+ <description>this listener assign group and membership to a new created user</description>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.services.organization.impl.NewUserConfig">
+ <field name="group">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.organization.impl.NewUserConfig$JoinGroup">
+ <field name="groupId"><string>/platform/users</string></field>
+ <field name="membership"><string>member</string></field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ <field name="ignoredUser">
+ <collection type="java.util.HashSet">
+ <value><string>root</string></value>
+ <value><string>john</string></value>
+ <value><string>marry</string></value>
+ <value><string>demo</string></value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+
+ </external-component-plugins>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-04.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-04.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-04.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.ldap.LDAPService</key>
+ <type>org.exoplatform.services.ldap.impl.LDAPServiceImpl</type>
+ <init-params>
+ <object-param>
+ <name>ldap.config</name>
+ <description>Default ldap config</description>
+ <object type="org.exoplatform.services.ldap.impl.LDAPConnectionConfig">
+ <!-- for multiple ldap servers, use comma seperated list of host:port (Ex. ldap://127.0.0.1:389,10.0.0.1:389) -->
+ <!-- whether or not to enable ssl, if ssl is used ensure that the javax.net.ssl.keyStore & java.net.ssl.keyStorePassword properties are set -->
+ <!-- exo portal default installed javax.net.ssl.trustStore with file is java.home/lib/security/cacerts-->
+ <!-- ldap service will check protocol, if protocol is ldaps, ssl is enable (Ex. for enable ssl: ldaps://10.0.0.3:636 ;for disable ssl: ldap://10.0.0.3:389 ) -->
+ <!-- when enable ssl, ensure server name is *.directory and port (Ex. active.directory) -->
+ <field name="providerURL"><string>ldaps://10.0.0.3:636</string></field>
+ <field name="rootdn"><string>CN=Administrator,CN=Users, DC=exoplatform,DC=org</string></field>
+ <field name="password"><string>site</string></field>
+
+ <field name="version"><string>3</string></field>
+
+ <field name="minConnection"><int>5</int></field>
+
+ <field name="maxConnection"><int>10</int></field>
+
+ <field name="referralMode"><string>ignore</string></field>
+
+ <field name="serverName"><string>active.directory</string></field>
+
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.organization.OrganizationService</key>
+ <type>org.exoplatform.services.organization.ldap.OrganizationServiceImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>init.service.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.organization.ldap.OrganizationLdapInitializer</type>
+ <description>this listener populate organization ldap service create default dn</description>
+ </component-plugin>
+ </component-plugins>
+ <init-params>
+ <object-param>
+ <name>ldap.attribute.mapping</name>
+ <description>ldap attribute mapping</description>
+ <object type="org.exoplatform.services.organization.ldap.LDAPAttributeMapping">
+ <field name="userLDAPClasses"><string>top,person,organizationalPerson,user</string></field>
+ <field name="profileLDAPClasses"><string>top,organizationalPerson</string></field>
+ <field name="groupLDAPClasses"><string>top,organizationalUnit</string></field>
+ <field name="membershipTypeLDAPClasses"><string>top,group</string></field>
+ <field name="membershipLDAPClasses"><string>top,group</string></field>
+
+ <field name="baseURL"><string>dc=exoplatform,dc=org</string></field>
+ <field name="groupsURL"><string>ou=groups,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="membershipTypeURL"><string>ou=memberships,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="userURL"><string>ou=users,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="profileURL"><string>ou=profiles,ou=portal,dc=exoplatform,dc=org</string></field>
+
+ <field name="userAuthenticationAttr"><string>mail</string></field>
+ <field name="userUsernameAttr"><string>sAMAccountName</string></field>
+ <field name="userPassword"><string>unicodePwd</string></field>
+ <!--unicodePwd-->
+ <field name="userFirstNameAttr"><string>givenName</string></field>
+ <field name="userLastNameAttr"><string>sn</string></field>
+ <field name="userDisplayNameAttr"><string>displayName</string></field>
+ <field name="userMailAttr"><string>mail</string></field>
+ <field name="userObjectClassFilter"><string>objectClass=user</string></field>
+
+ <field name="membershipTypeMemberValue"><string>member</string></field>
+ <field name="membershipTypeRoleNameAttr"><string>cn</string></field>
+ <field name="membershipTypeNameAttr"><string>cn</string></field>
+ <field name="membershipTypeObjectClassFilter"><string>objectClass=group</string></field>
+ <field name="membershiptypeObjectClass"><string>group</string></field>
+
+ <field name="groupObjectClass"><string>organizationalUnit</string></field>
+ <field name="groupObjectClassFilter"><string>objectClass=organizationalUnit</string></field>
+
+ <field name="membershipObjectClass"><string>group</string></field>
+ <field name="membershipObjectClassFilter"><string>objectClass=group</string></field>
+
+ <field name="ldapCreatedTimeStampAttr"><string>createdTimeStamp</string></field>
+ <field name="ldapModifiedTimeStampAttr"><string>modifiedTimeStamp</string></field>
+ <field name="ldapDescriptionAttr"><string>description</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <!--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/organization/impl/UserProfileData.hbm.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins-->
+
+ <import>classpath:/conf/portal/organization-configuration.xml</import>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-05.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-05.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-05.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.ldap.LDAPService</key>
+ <type>org.exoplatform.services.ldap.impl.LDAPServiceImpl</type>
+ <init-params>
+ <object-param>
+ <name>ldap.config</name>
+ <description>Default ldap config</description>
+ <object type="org.exoplatform.services.ldap.impl.LDAPConnectionConfig">
+
+ <!-- for multiple ldap servers, use comma seperated list of host:port (Ex. ldap://127.0.0.1:389,10.0.0.1:389) -->
+ <field name="providerURL"><string>ldap://127.0.0.1:389,10.0.0.1:389</string></field>
+
+ <field name="rootdn"><string>CN=Manager,DC=exoplatform,DC=org</string></field>
+
+ <field name="password"><string>secret</string></field>
+
+ <field name="version"><string>3</string></field>
+
+ <field name="minConnection"><int>5</int></field>
+
+ <field name="maxConnection"><int>10</int></field>
+
+ <field name="referralMode"><string>follow</string></field>
+
+<!--
+ <field name="referralMode"><string>ignore</string></field>
+-->
+
+ <field name="serverName"><string>default</string></field>
+
+<!--
+ LDAP server names : default,
+ active.directory,
+ open.ldap,
+ netscape.directory,
+ redhat.directory;
+-->
+
+
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.organization.OrganizationService</key>
+ <type>org.exoplatform.services.organization.ldap.OrganizationServiceImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>init.service.listener</name>
+ <set-method>addListenerPlugin</set-method>
+ <type>org.exoplatform.services.organization.ldap.OrganizationLdapInitializer</type>
+ <description>this listener populate organization ldap service create default dn</description>
+ </component-plugin>
+ </component-plugins>
+ <init-params>
+ <value-param>
+ <name>ldap.userDN.key</name>
+ <description>The key used to compose user DN</description>
+ <value>cn</value>
+ </value-param>
+
+ <object-param>
+ <name>ldap.attribute.mapping</name>
+ <description>ldap attribute mapping</description>
+ <object type="org.exoplatform.services.organization.ldap.LDAPAttributeMapping">
+ <field name="userLDAPClasses"><string>top,person,organizationalPerson,inetOrgPerson</string></field>
+ <field name="profileLDAPClasses"><string>top,organizationalPerson</string></field>
+ <field name="groupLDAPClasses"><string>top,organizationalUnit</string></field>
+ <field name="membershipTypeLDAPClasses"><string>top,organizationalRole</string></field>
+ <field name="membershipLDAPClasses"><string>top,groupOfNames</string></field>
+
+ <field name="baseURL"><string>dc=exoplatform,dc=org</string></field>
+ <field name="groupsURL"><string>ou=groups,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="membershipTypeURL"><string>ou=memberships,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="userURL"><string>ou=users,ou=portal,dc=exoplatform,dc=org</string></field>
+ <field name="profileURL"><string>ou=profiles,ou=portal,dc=exoplatform,dc=org</string></field>
+
+ <field name="userUsernameAttr"><string>uid</string></field>
+ <field name="userPassword"><string>userPassword</string></field>
+ <field name="userFirstNameAttr"><string>givenName</string></field>
+ <field name="userLastNameAttr"><string>sn</string></field>
+ <field name="userDisplayNameAttr"><string>displayName</string></field>
+ <field name="userMailAttr"><string>mail</string></field>
+ <field name="userObjectClassFilter"><string>objectClass=person</string></field>
+
+ <field name="membershipTypeMemberValue"><string>member</string></field>
+ <field name="membershipTypeRoleNameAttr"><string>cn</string></field>
+ <field name="membershipTypeNameAttr"><string>cn</string></field>
+ <field name="membershipTypeObjectClassFilter"><string>objectClass=organizationalRole</string></field>
+ <field name="membershiptypeObjectClass"><string>organizationalRole</string></field>
+
+ <field name="groupObjectClass"><string>organizationalUnit</string></field>
+ <field name="groupObjectClassFilter"><string>objectClass=organizationalUnit</string></field>
+
+ <field name="membershipObjectClass"><string>groupOfNames</string></field>
+ <field name="membershipObjectClassFilter"><string>objectClass=groupOfNames</string></field>
+
+ <field name="ldapCreatedTimeStampAttr"><string>createdTimeStamp</string></field>
+ <field name="ldapModifiedTimeStampAttr"><string>modifiedTimeStamp</string></field>
+ <field name="ldapDescriptionAttr"><string>description</string></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <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/organization/impl/UserProfileData.hbm.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+ <!-- for ldap clean database
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.ldap.LDAPService</target-component>
+ <component-plugin>
+ <name>delete.object</name>
+ <set-method>addDeleteObject</set-method>
+ <type>org.exoplatform.services.ldap.DeleteObjectCommand</type>
+ <init-params>
+ <values-param>
+ <name>objects.to.delete</name>
+ <value>cn=demo,ou=users,ou=portal,dc=exoplatform,dc=org</value>
+ <value>cn=test,ou=users,ou=portal,dc=exoplatform,dc=org</value>
+ <value>cn=Benj,ou=users,ou=portal,dc=exoplatform,dc=org</value>
+ <value>cn=tuan,ou=users,ou=portal,dc=exoplatform,dc=org</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+ -->
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-06.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-06.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-06.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.organization.OrganizationService</key>
+ <type>org.exoplatform.services.organization.jdbc.OrganizationServiceImpl</type>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.listener.ListenerService</target-component>
+
+ <component-plugin>
+ <name>organization.user.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.RemoveUserProfileListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.user.postCreate</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.CreateUserListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.user.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.RemoveMembershipListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.user.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.portal.config.RemoveUserPortalConfigListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.membershipType.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.RemoveMembershipListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.group.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.RemoveMembershipListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.group.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.portal.config.RemoveGroupPortalConfigListener</type>
+ </component-plugin>
+
+ <component-plugin>
+ <name>organization.group.preDelete</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.services.organization.jdbc.listeners.RemoveGroupListener</type>
+ </component-plugin>
+
+ </external-component-plugins>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-07.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-07.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-07.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>war:/conf/jcr/repository-configuration.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ <property name="source-name" value="jdbcexo"/>
+ <property name="dialect" value="hsqldb"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
+ <init-params>
+ <properties-param>
+ <name>locations</name>
+ <property name="repository" value="system"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-08.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-08.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-08.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.mail.MailService</key>
+ <type>org.exoplatform.services.mail.impl.MailServiceImpl</type>
+ <init-params>
+ <properties-param>
+ <name>config</name>
+ <property name="mail.smtp.auth.username" value="exoservice(a)gmail.com" />
+ <property name="mail.smtp.auth.password" value="exoadmin" />
+ <property name="mail.smtp.host" value="smtp.gmail.com" />
+ <property name="mail.smtp.port" value="465" />
+ <property name="mail.smtp.starttls.enable" value="true" />
+ <property name="mail.smtp.auth" value="true" />
+ <property name="mail.smtp.debug" value="false" />
+ <property name="mail.smtp.socketFactory.port" value="465" />
+ <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory" />
+ <property name="mail.smtp.socketFactory.fallback" value="false" />
+ </properties-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-09.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-09.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-09.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</target-component>
+ <component-plugin>
+ <name>addPaths</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.ext.hierarchy.impl.AddPathPlugin</type>
+ <init-params>
+ <object-param>
+ <name>cms.configuration</name>
+ <description>configuration for the cms path</description>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig">
+ <field name="repository"><string>repository</string></field>
+ <field name="workspaces">
+ <collection type="java.util.ArrayList">
+ <value><string>collaboration</string></value>
+ </collection>
+ </field>
+ <field name="jcrPaths">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig$JcrPath">
+ <field name="alias"><string>usersPath</string></field>
+ <field name="path"><string>/Users</string></field>
+ <field name="permissions">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig$Permission">
+ <field name="identity"><string>*:/platform/administrators</string></field>
+ <field name="read"><string>true</string></field>
+ <field name="addNode"><string>true</string></field>
+ <field name="setProperty"><string>true</string></field>
+ <field name="remove"><string>true</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.jcr.ext.hierarchy.impl.HierarchyConfig$Permission">
+ <field name="identity"><string>*:/platform/users</string></field>
+ <field name="read"><string>true</string></field>
+ <field name="addNode"><string>false</string></field>
+ <field name="setProperty"><string>true</string></field>
+ <field name="remove"><string>false</string></field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-10.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-10.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-10.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>war:/conf/jcr/repository-configuration.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ <property name="source-name" value="jdbcexo"/>
+ <property name="dialect" value="hsqldb"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
+ <init-params>
+ <properties-param>
+ <name>locations</name>
+ <property name="repository" value="system"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-11.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-11.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-11.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.database.HibernateService</key>
+ <jmx-name>database:type=HibernateService</jmx-name>
+ <type>org.exoplatform.services.database.impl.HibernateServiceImpl</type>
+ <init-params>
+ <properties-param>
+ <name>hibernate.properties</name>
+ <description>Default Hibernate Service</description>
+ <property name="hibernate.show_sql" value="false"/>
+ <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.connection.autocommit" value="true"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.c3p0.min_size" value="5"/>
+ <property name="hibernate.c3p0.max_size" value="20"/>
+ <property name="hibernate.c3p0.timeout" value="1800"/>
+ <property name="hibernate.c3p0.max_statements" value="50"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <!--
+ <component>
+ <key>org.exoplatform.services.database.DatabaseService</key>
+ <type>org.exoplatform.services.database.impl.XAPoolTxSupportDatabaseService</type>
+ <init-params>
+ <properties-param>
+ <name>default</name>
+ <description>Connection configuration</description>
+ <property name='connection.driver' value='org.hsqldb.jdbcDriver'/>
+ <property name='connection.url' value='jdbc:hsqldb:file:../temp/data/exodb'/>
+ <property name='connection.login' value='sa'/>
+ <property name='connection.password' value=''/>
+ <property name='connection.min-size' value='3'/>
+ <property name='connection.max-size' value='5'/>
+ </properties-param>
+ </init-params>
+ </component>
+ -->
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcexo</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:../temp/data/exodb"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-12.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-12.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-12.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <type>org.exoplatform.services.portletcontainer.PortletContainerConf</type>
+ <init-params>
+ <object-param>
+ <name>conf</name>
+ <object type="org.exoplatform.services.portletcontainer.PortletContainer">
+ <field name="global">
+ <object type="org.exoplatform.services.portletcontainer.config.Global">
+ <field name="name"><string>ExoPortletContainer</string></field>
+ <field name="description">
+ <string>A JSR 286 compliant portlet container </string>
+ </field>
+ <field name="majorVersion"><int>2</int></field>
+ <field name="minorVersion"><int>0</int></field>
+ </object>
+ </field>
+ <field name="bundle">
+ <object type="org.exoplatform.services.portletcontainer.config.DelegatedBundle">
+ <field name="enable"><string>true</string></field>
+ </object>
+ </field>
+ <field name="cache">
+ <object type="org.exoplatform.services.portletcontainer.config.Cache">
+ <field name="enable"><string>true</string></field>
+ </object>
+ </field>
+ <field name="supportedContent">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"><string>text/html</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>text/wml</string> </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>audio/x-mpeg</string></field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>image/bmp</string> </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>image/jpg</string> </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>image/jpeg</string> </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.SupportedContent">
+ <field name="name"> <string>image/gif</string> </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ <field name="customMode">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.CustomMode">
+ <field name="name"> <string>config</string> </field>
+ <field name="description">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.Description">
+ <field name="lang"> <string>en</string></field>
+ <field name="description"><string>to let admin config portlets </string> </field>
+ </object>
+ </value>
+ <value>
+ <object type="org.exoplatform.services.portletcontainer.config.Description">
+ <field
+ name="lang">
+ <string>
+ fr
+ </string>
+ </field>
+ <field
+ name="description">
+ <string>
+ permet de
+ configurer
+ les portlets
+ </string>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ <field name="properties">
+ <collection type="java.util.ArrayList">
+ <value>
+ <object
+ type="org.exoplatform.services.portletcontainer.config.Properties">
+ <field name="description">
+ <string>
+ a testing property
+ </string>
+ </field>
+ <field name="name">
+ <string>test</string>
+ </field>
+ <field name="value">
+ <string>test_value</string>
+ </field>
+ </object>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-13.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-13.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-13.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <import>war:/conf/common/common-configuration.xml</import>
+ <import>war:/conf/common/logs-configuration.xml</import>
+ <import>war:/conf/database/database-configuration.xml</import>
+ <import>war:/conf/jcr/jcr-configuration.xml</import>
+ <import>war:/conf/common/portlet-container-configuration.xml</import>
+
+ <!--if organization service is database, import hibernate-organization-configuration.xml-->
+ <import>war:/conf/organization/hibernate-configuration.xml</import>
+
+ <!-- <import>war:/conf/jdbc-configuration.xml</import> -->
+ <!--for organization service used active directory which is user lookup server -->
+ <!--
+ <import>war:/conf/activedirectory-configuration.xml</import>
+ -->
+
+ <!--for organization service used ldap server which is user lookup server -->
+ <!--
+ <import>war:/conf/ldap-configuration.xml</import>
+ -->
+ <!-- <import>war:/conf/security-configuration.xml</import> -->
+ <import>war:/conf/organization/organization-configuration.xml</import>
+ <import>war:/conf/jcr/component-plugins-configuration.xml</import>
+ <import>war:/conf/mail/portal-mail-configuration.xml</import>
+ <import>war:/conf/portal/portal-configuration.xml</import>
+ <import>war:/conf/portal/application-registry-configuration.xml</import>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-14.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-14.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-14.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.security.SecurityService</key>
+ <type>org.exoplatform.services.security.impl.SecurityServiceImpl</type>
+ <init-params>
+ <value-param>
+ <name>security.authentication</name>
+ <value>sso</value>
+ </value-param>
+ <value-param>
+ <name>security.sso-authentication</name>
+ <value>cas</value>
+ </value-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-15.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-15.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-15.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+
+ <!-- JDK -->
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Jdk14Configurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>jdk1.4 Logger properties</description>
+ <property name="handlers" value="java.util.logging.ConsoleHandler"/>
+ <property name=".level" value="FINE"/>
+ <property name="java.util.logging.ConsoleHandler.level" value="FINE"/>
+ </properties-param>
+ <!-- end JDK -->
+ <!-- Log4J -->
+ <!--
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="DEBUG, stdout, file"/>
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender"/>
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d {dd.MM.yyyy HH:mm:ss} %c {1}: %m (%F, line %L) %n"/>
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender"/>
+ <property name="log4j.appender.file.File" value="jcr.log"/>
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %m (%F, line %L) %n"/>
+ </properties-param>
+ -->
+ <!-- end Log4J-->
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-16.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-16.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-16.xml 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <properties-param>
+ <name>default-properties</name>
+ <description>Default initial context properties</description>
+ <!--
+ <property name="java.naming.factory.initial" value="org.exoplatform.services.naming.SimpleContextFactory"/>
+ -->
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.resources.LocaleConfigService</key>
+ <type>org.exoplatform.services.resources.impl.LocaleConfigServiceImpl</type>
+ <init-params>
+ <value-param>
+ <name>locale.config.file</name>
+ <value>war:/conf/common/locales-config.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.resources.ResourceBundleService</key>
+ <type>org.exoplatform.services.resources.jcr.ResourceBundleServiceImpl</type>
+ <init-params>
+ <values-param>
+ <name>classpath.resources</name>
+ <description>The resources that start with the following package name should be load from file system</description>
+ <value>locale.portlet</value>
+ </values-param>
+ <values-param>
+ <name>init.resources</name>
+ <description>Store the following resources into the db for the first launch </description>
+ <value>locale.portal.expression</value>
+ <value>locale.portal.services</value>
+ <value>locale.portal.webui</value>
+ <value>locale.portal.custom</value>
+ <value>locale.navigation.portal.classic</value>
+ <value>locale.navigation.group.platform.administrators</value>
+ <value>locale.navigation.group.platform.users</value>
+ <value>locale.navigation.group.platform.guests</value>
+ <value>locale.navigation.group.organization.management.executive-board</value>
+ </values-param>
+ <values-param>
+ <name>portal.resource.names</name>
+ <description>The properties files of the portal , those file will be merged
+ into one ResoruceBundle properties </description>
+ <value>locale.portal.expression</value>
+ <value>locale.portal.services</value>
+ <value>locale.portal.webui</value>
+ <value>locale.portal.custom</value>
+ </values-param>
+ </init-params>
+ </component>
+
+ <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>-1</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>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestXSD_1_1.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestXSD_1_1.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestXSD_1_1.java 2009-12-11 21:41:36 UTC (rev 1014)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2009 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.container.configuration.test;
+
+import org.exoplatform.container.configuration.ConfigurationUnmarshaller;
+import org.exoplatform.test.BasicTestCase;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestXSD_1_1 extends BasicTestCase
+{
+
+ public void testValidation() throws Exception
+ {
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller();
+ String baseDirPath = System.getProperty("basedir");
+ File baseDir = new File(baseDirPath + "/src/main/resources/xsd_1_1");
+ int count = 0;
+ for (File f : baseDir.listFiles(new FileFilter()
+ {
+ public boolean accept(File pathname)
+ {
+ return pathname.getName().endsWith(".xml");
+ }
+ }))
+ {
+ count++;
+ try
+ {
+ URL url = f.toURI().toURL();
+ assertTrue("XML configuration file " + url + " is not valid", unmarshaller.isValid(url));
+ }
+ catch (MalformedURLException e)
+ {
+ fail("Was not expecting such exception " + e.getMessage());
+ }
+ }
+ assertEquals(17, count);
+ }
+}
\ No newline at end of file
16 years, 7 months
exo-jcr SVN: r1013 - in kernel/branches/config-branch: exo.kernel.container/src/main/java/org/exoplatform/container/configuration and 5 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-11 15:44:15 -0500 (Fri, 11 Dec 2009)
New Revision: 1013
Added:
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
kernel/branches/config-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-17.xml
Modified:
kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-01.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-02.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-03.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-04.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-05.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-06.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-07.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-08.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-09.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-10.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-11.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-12.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-13.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-14.xml
kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-16.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml
Log:
- profile handling using a profile attribute
- added kernel 1.1 schema to handle profile attribute in the schema
Modified: kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2009-12-11 20:44:15 UTC (rev 1013)
@@ -51,4 +51,17 @@
return set;
}
+ public static Set<String> parseCommaList(String s)
+ {
+ Set<String> set = new HashSet<String>();
+ for (String v : s.split(","))
+ {
+ v = v.trim();
+ if (v.length() > 0)
+ {
+ set.add(v);
+ }
+ }
+ return set;
+ }
}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-12-11 20:44:15 UTC (rev 1013)
@@ -18,15 +18,14 @@
*/
package org.exoplatform.container.configuration;
-import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.Configuration;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
+import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -35,14 +34,15 @@
import java.io.StringWriter;
import java.net.URL;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Set;
import javax.xml.XMLConstants;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
@@ -182,25 +182,32 @@
log.info("The configuration file " + url + " was not found valid according to its XSD");
}
- // The buffer
+ // Perform
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(url.openStream());
+
+ // Filter DOM
+ ProfileDOMFilter filter = new ProfileDOMFilter(profiles);
+ filter.process(doc.getDocumentElement());
+
+ // SAX event stream -> String
StringWriter buffer = new StringWriter();
-
- // Create a sax transformer result that will serialize the output
SAXTransformerFactory tf = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
- final TransformerHandler hd = tf.newTransformerHandler();
- hd.setResult(new StreamResult(buffer));
+ TransformerHandler hd = tf.newTransformerHandler();
+ StreamResult result = new StreamResult(buffer);
+ hd.setResult(result);
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
- // Perform
- InputSource source = new InputSource(url.openStream());
- SAXParserFactory spf = SAXParserFactory.newInstance();
- SAXParser saxParser = spf.newSAXParser();
- saxParser.getXMLReader().setFeature("http://xml.org/sax/features/namespaces", true);
- saxParser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- saxParser.parse(source, new NoKernelNamespaceSAXFilter(profiles, hd));
+ // Transform -> SAX event stream
+ SAXResult saxResult = new SAXResult(new NoKernelNamespaceSAXFilter(hd));
+ // DOM -> Transform
+ serializer.transform(new DOMSource(doc), saxResult);
+
// Reuse the parsed document
String document = buffer.toString();
@@ -212,5 +219,4 @@
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
return (Configuration)uctx.unmarshalDocument(new StringReader(document), null);
}
-
}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-12-11 20:44:15 UTC (rev 1013)
@@ -44,24 +44,24 @@
private static final Log log = ExoLogger.getExoLogger(NoKernelNamespaceSAXFilter.class);
/** . */
- private static final String KERNEL_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
+ private static final String KERNEL_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
/** . */
- private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
+ private static final String KERNEL_1_1_URI = "http://www.exoplaform.org/xml/ns/kernel_1_1.xsd";
/** . */
- private final Set<String> activeProfiles;
+ private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
/** . */
private ContentHandler contentHandler;
/** . */
- private final Set<String> blackListedPrefixes = new HashSet<String>();
+ private final Set<String> blackListedPrefixes;
- NoKernelNamespaceSAXFilter(Set<String> activeProfiles, ContentHandler contentHandler)
+ NoKernelNamespaceSAXFilter(ContentHandler contentHandler)
{
this.contentHandler = contentHandler;
- this.activeProfiles = activeProfiles;
+ this.blackListedPrefixes = new HashSet<String>();
}
public void setDocumentLocator(Locator locator)
@@ -81,176 +81,117 @@
public void startPrefixMapping(String prefix, String uri) throws SAXException
{
- if (depth == 0)
+ if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri) || XSI_URI.equals(uri))
{
- if (KERNEL_URI.equals(uri) || XSI_URI.equals(uri))
- {
- blackListedPrefixes.add(prefix);
- log.debug("Black listing prefix " + prefix + " with uri " + uri);
- }
- else
- {
- contentHandler.startPrefixMapping(prefix, uri);
- log.debug("Start prefix mapping " + prefix + " with uri " + uri);
- }
+ blackListedPrefixes.add(prefix);
+ log.debug("Black listing prefix " + prefix + " with uri " + uri);
}
+ else
+ {
+ contentHandler.startPrefixMapping(prefix, uri);
+ log.debug("Start prefix mapping " + prefix + " with uri " + uri);
+ }
}
public void endPrefixMapping(String prefix) throws SAXException
{
- if (depth == 0)
+ if (!blackListedPrefixes.remove(prefix))
{
- if (!blackListedPrefixes.remove(prefix))
- {
- log.debug("Ending prefix mapping " + prefix);
- contentHandler.endPrefixMapping(prefix);
- }
- else
- {
- log.debug("Removed prefix mapping " + prefix + " from black list ");
- }
+ log.debug("Ending prefix mapping " + prefix);
+ contentHandler.endPrefixMapping(prefix);
}
+ else
+ {
+ log.debug("Removed prefix mapping " + prefix + " from black list ");
+ }
}
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
{
- if (depth == 0)
+ Set<String> profiles = null;
+ AttributesImpl noNSAtts = new AttributesImpl();
+ for (int i = 0;i < atts.getLength();i++)
{
- AttributesImpl noNSAtts = new AttributesImpl();
- for (int i = 0;i < atts.getLength();i++)
+ String attQName = atts.getQName(i);
+ if ((attQName.equals("xmlns")) && blackListedPrefixes.contains(""))
{
- String attQName = atts.getQName(i);
- if ((attQName.equals("xmlns")) && blackListedPrefixes.contains(""))
- {
- // Skip
- log.debug("Skipping black listed xmlns attribute");
- }
- else if (attQName.startsWith("xmlns:") && blackListedPrefixes.contains(attQName.substring(6)))
- {
- // Skip
- log.debug("Skipping black listed " + attQName + " attribute");
- }
- else
- {
- String attURI = atts.getURI(i);
- String attLocalName = atts.getLocalName(i);
- String attType = atts.getType(i);
- String attValue = atts.getValue(i);
-
- //
- if (XSI_URI.equals(attURI))
- {
- // Skip
- log.debug("Skipping XSI " + attQName + " attribute");
- continue;
- }
-
- //
- noNSAtts.addAttribute(attURI, attLocalName, attQName, attType, attValue);
- }
+ // Skip
+ log.debug("Skipping black listed xmlns attribute");
}
-
- //
- if (KERNEL_URI.equals(uri))
+ else if (attQName.startsWith("xmlns:") && blackListedPrefixes.contains(attQName.substring(6)))
{
- if (!localName.equals(qName))
+ // Skip
+ log.debug("Skipping black listed " + attQName + " attribute");
+ }
+ else
+ {
+ String attURI = atts.getURI(i);
+ String attLocalName = atts.getLocalName(i);
+ String attType = atts.getType(i);
+ String attValue = atts.getValue(i);
+
+ //
+ if (XSI_URI.equals(attURI))
{
- String prefix = qName.substring(0, qName.indexOf(':'));
- if (activeProfiles.contains(prefix))
- {
- log.debug("Requalifying active profile " + qName + " start element to " + localName);
- qName = localName;
- uri = null;
- }
- else
- {
- log.debug("Inhibitting element passive profile " + qName + " start element");
- depth++;
- }
+ // Skip
+ log.debug("Skipping XSI " + attQName + " attribute");
+ continue;
}
- else
+ else if (KERNEL_1_0_URI.equals(attURI) || KERNEL_1_1_URI.equals(attURI))
{
- // Need to clear the URI
- uri = null;
+ log.debug("Requalifying prefixed attribute " + attQName + " attribute to " + localName);
+ attURI = null;
+ attQName = localName;
}
- }
- //
- if (depth == 0)
- {
- log.debug("Propagatting " + qName + " start element");
- contentHandler.startElement(uri, localName, qName, noNSAtts);
+ //
+ noNSAtts.addAttribute(attURI, attLocalName, attQName, attType, attValue);
}
}
- else
+
+ //
+ if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri))
{
- log.debug("Skipping " + qName + " start element");
- depth++;
+ log.debug("Requalifying active profile " + qName + " start element to " + localName);
+ qName = localName;
+ uri = null;
}
+ //
+ contentHandler.startElement(uri, localName, qName, noNSAtts);
}
- private int depth;
-
public void endElement(String uri, String localName, String qName) throws SAXException
{
- if (depth == 0)
+ if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri))
{
- if (KERNEL_URI.endsWith(uri))
- {
- log.debug("Requalifying " + qName + " end element");
- qName = localName;
- uri = null;
- }
-
- //
- log.debug("Propagatting " + qName + " end element");
- contentHandler.endElement(uri, localName, qName);
+ log.debug("Requalifying " + qName + " end element");
+ qName = localName;
+ uri = null;
}
- else
- {
- log.debug("Skipping " + qName + " end element");
- depth--;
- }
+
+ //
+ log.debug("Propagatting " + qName + " end element");
+ contentHandler.endElement(uri, localName, qName);
}
public void characters(char[] ch, int start, int length) throws SAXException
{
- if (depth == 0)
- {
- contentHandler.characters(ch, start, length);
- }
- else
- {
- log.debug("Skipping " + new String(ch, start, length) + " end element");
- }
+ contentHandler.characters(ch, start, length);
}
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
{
- if (depth == 0)
- {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- else
- {
- log.debug("Skipping " + new String(ch, start, length) + " white space");
- }
+ contentHandler.ignorableWhitespace(ch, start, length);
}
public void processingInstruction(String target, String data) throws SAXException
{
- if (depth == 0)
- {
- contentHandler.processingInstruction(target, data);
- }
+ contentHandler.processingInstruction(target, data);
}
public void skippedEntity(String name) throws SAXException
{
- if (depth == 0)
- {
- contentHandler.skippedEntity(name);
- }
+ contentHandler.skippedEntity(name);
}
}
Added: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2009-12-11 20:44:15 UTC (rev 1013)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration;
+
+import org.exoplatform.commons.utils.Tools;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Filters a kernel DOM according to a list of active profiles.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class ProfileDOMFilter
+{
+
+ /** . */
+ private static final String KERNEL_1_0_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
+
+ /** . */
+ private static final String KERNEL_1_1_URI = "http://www.exoplaform.org/xml/ns/kernel_1_1.xsd";
+
+ /** . */
+ private static final String PROFILE_ATTRIBUTE = "profile";
+
+ /** . */
+ private static final Set<String> kernelURIs = Tools.set(KERNEL_1_0_URI, KERNEL_1_1_URI);
+
+ /** . */
+ private static final Set<String> kernelWithProfileURIs = Tools.set(KERNEL_1_1_URI);
+
+ /** . */
+ private final Set<String> activeProfiles;
+
+ public ProfileDOMFilter(Set<String> activeProfiles)
+ {
+ this.activeProfiles = activeProfiles;
+ }
+
+ public void process(Element elt)
+ {
+ if (kernelURIs.contains(elt.getNamespaceURI()))
+ {
+ // Check if element must be removed
+ NamedNodeMap attrs = elt.getAttributes();
+ if (attrs != null)
+ {
+ Set<String> profiles = null;
+ List<Attr> toRemove = null;
+ for (int i = 0;i < attrs.getLength();i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String attrURI = attr.getNamespaceURI();
+ if ((attrURI == null || kernelWithProfileURIs.contains(attrURI)) && PROFILE_ATTRIBUTE.equals(attr.getLocalName()))
+ {
+ if (profiles == null)
+ {
+ profiles = Tools.parseCommaList(attr.getValue());
+ }
+ else
+ {
+ profiles.addAll(Tools.parseCommaList(attr.getValue()));
+ }
+
+ //
+ if (toRemove == null)
+ {
+ toRemove = new ArrayList<Attr>();
+ }
+ toRemove.add(attr);
+ }
+ }
+
+ // Check if must we delete this node
+ if (profiles != null && Collections.disjoint(activeProfiles, profiles))
+ {
+ Node parent = elt.getParentNode();
+
+ // Remove it
+ parent.removeChild(elt);
+
+ // No more processing
+ return;
+ }
+
+ // Remove profile attributes
+ if (toRemove != null)
+ {
+ for (Attr attr : toRemove)
+ {
+ elt.removeAttributeNode(attr);
+ }
+ }
+ }
+ }
+
+ // Make a copy as children may be removed and result
+ // in a concurrent modification
+ NodeList children = elt.getChildNodes();
+ ArrayList<Element> childElts = new ArrayList<Element>();
+ for (int i = 0;i < children.getLength();i++)
+ {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ {
+ childElts.add((Element)child);
+ }
+ }
+
+ // Process recursively
+ for (Element childElt : childElts)
+ {
+ process(childElt);
+ }
+ }
+}
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd 2009-12-11 20:44:15 UTC (rev 1013)
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ targetNamespace="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:element name="configuration" type="configurationType"/>
+
+ <xsd:complexType abstract="true" name="profiledElementType">
+ <xsd:attribute name="profile" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType abstract="true" name="baseObjectType">
+ <xsd:choice>
+ <xsd:element name="string" type="xsd:string"/>
+ <xsd:element name="int" type="xsd:int"/>
+ <xsd:element name="long" type="xsd:long"/>
+ <xsd:element name="boolean" type="xsd:boolean"/>
+ <xsd:element name="date" type="xsd:date"/>
+ <xsd:element name="double" type="xsd:double"/>
+ <xsd:element name="map" type="mapType"/>
+ <xsd:element name="collection" type="collectionType"/>
+ <xsd:element name="native-array" type="nativeArraytype"/>
+ <xsd:element name="object" type="objectType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="valueType">
+ <xsd:complexContent>
+ <xsd:extension base="baseObjectType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="entryType">
+ <xsd:sequence>
+ <xsd:element name="key" type="baseObjectType" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="value" type="baseObjectType" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="mapType">
+ <xsd:sequence>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="collectionType">
+ <xsd:sequence>
+ <xsd:element name="value" type="valueType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="item-type" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="nativeArraytype">
+ <xsd:complexContent>
+ <xsd:extension base="baseObjectType">
+ <xsd:sequence>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="array" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="fieldType">
+ <xsd:complexContent >
+ <xsd:extension base="baseObjectType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="objectType">
+ <xsd:sequence>
+ <xsd:element name="field" type="fieldType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="propertyType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="value" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="paramType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="profile" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="valueParamType">
+ <xsd:complexContent>
+ <xsd:extension base="paramType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="valuesParamType">
+ <xsd:complexContent>
+ <xsd:extension base="paramType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="propertiesParamType">
+ <xsd:complexContent>
+ <xsd:extension base="paramType">
+ <xsd:sequence>
+ <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="objectParamType">
+ <xsd:complexContent>
+ <xsd:extension base="paramType">
+ <xsd:sequence>
+ <xsd:element name="object" type="objectType" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="initParamsType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="object-param" type="objectParamType"/>
+ <xsd:element name="properties-param" type="propertiesParamType"/>
+ <xsd:element name="value-param" type="valueParamType"/>
+ <xsd:element name="values-param" type="valuesParamType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="componentPluginType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="set-method" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="priority" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="init-params" type="initParamsType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="externalComponentPluginType">
+ <xsd:sequence>
+ <xsd:element name="target-component" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="component-plugin" type="componentPluginType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="containerLifecyclePluginType">
+ <xsd:sequence>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="init-params" type="initParamsType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="manageableComponentsType">
+ <xsd:sequence>
+ <xsd:element name="component-type" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="componentLifecyclePluginType">
+ <xsd:sequence>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="manageable-components" type="manageableComponentsType" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="init-params" type="initParamsType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="componentType">
+ <xsd:sequence>
+ <xsd:element name="key" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="jmx-name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="show-deploy-info" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="multi-instance" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="component-plugins" minOccurs="0" maxOccurs="1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="component-plugin" type="componentPluginType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="init-params" type="initParamsType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="profile" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="configurationType">
+ <xsd:sequence>
+ <xsd:element name="container-lifecycle-plugin" type="containerLifecyclePluginType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="component-lifecycle-plugin" type="componentLifecyclePluginType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="component" type="componentType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="external-component-plugins" type="externalComponentPluginType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="import" type="importType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="remove-configuration" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="importType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="profile" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-01.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-01.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-01.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.portal.config.DataStorage</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-02.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-02.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-02.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.application.gadget.GadgetRegistryService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-03.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-03.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-03.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<external-component-plugins>
<target-component>org.exoplatform.services.organization.OrganizationService</target-component>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-04.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-04.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-04.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.ldap.LDAPService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-05.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-05.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-05.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.ldap.LDAPService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-06.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-06.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-06.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-07.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-07.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-07.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-08.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-08.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-08.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.mail.MailService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-09.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-09.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-09.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<external-component-plugins>
<target-component>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</target-component>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-10.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-10.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-10.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-11.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-11.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-11.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.database.HibernateService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-12.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-12.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-12.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<type>org.exoplatform.services.portletcontainer.PortletContainerConf</type>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-13.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-13.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-13.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<import>war:/conf/common/common-configuration.xml</import>
<import>war:/conf/common/logs-configuration.xml</import>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-14.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-14.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-14.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.security.SecurityService</key>
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-16.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-16.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_0/sample-configuration-16.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -20,9 +20,9 @@
-->
<configuration
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd ../java/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
<key>org.exoplatform.services.naming.InitialContextInitializer</key>
Added: kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-17.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-17.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/resources/xsd_1_1/sample-configuration-17.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profile="a">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profile="a,b">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profile="a">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profile="a,b">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <properties-param>
+ <name>properties</name>
+ </properties-param>
+ <properties-param profile="a">
+ <name>properties</name>
+ </properties-param>
+ <properties-param profile="a,b">
+ <name>properties</name>
+ </properties-param>
+ <value-param>
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profile="a">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profile="a,b">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <values-param>
+ <name>values</name>
+ </values-param>
+ <values-param profile="a">
+ <name>values</name>
+ </values-param>
+ <values-param profile="a,b">
+ <name>values</name>
+ </values-param>
+ </init-params>
+ </component>
+
+ <import>import_1</import>
+ <import profile="a">import_1</import>
+ <import profile="a,b">import_1</import>
+
+</configuration>
\ No newline at end of file
Modified: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -21,19 +21,17 @@
-->
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
- <bar:component>
+ <component profile="bar">
<key>Component</key>
<type>ComponentImpl</type>
- </bar:component>
+ </component>
- <foo:component>
+ <component profile="foo">
<key>Component</key>
<type>FooComponent</type>
- </foo:component>
+ </component>
</configuration>
\ No newline at end of file
Modified: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -21,13 +21,11 @@
-->
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<import>empty</import>
- <foo:import>foo</foo:import>
- <bar:import>bar</bar:import>
+ <import profile="foo">foo</import>
+ <import profile="bar">bar</import>
</configuration>
\ No newline at end of file
Modified: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml 2009-12-11 16:34:30 UTC (rev 1012)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml 2009-12-11 20:44:15 UTC (rev 1013)
@@ -21,10 +21,8 @@
-->
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<component>
<key>Component</key>
@@ -34,14 +32,14 @@
<name>param</name>
<value>empty</value>
</value-param>
- <foo:value-param>
+ <value-param profile="foo">
<name>param</name>
<value>foo</value>
- </foo:value-param>
- <bar:value-param>
+ </value-param>
+ <value-param profile="bar">
<name>param</name>
<value>bar</value>
- </bar:value-param>
+ </value-param>
</init-params>
</component>
16 years, 7 months
exo-jcr SVN: r1012 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-11 11:34:30 -0500 (Fri, 11 Dec 2009)
New Revision: 1012
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-199: removed depricated code
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-11 16:34:14 UTC (rev 1011)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-11 16:34:30 UTC (rev 1012)
@@ -532,98 +532,8 @@
}
/**
- * @deprecated version of getItemData(NodeData parentData, QPathEntry name) .
- * Should be removed
* {@inheritDoc}
- *
*/
- @Deprecated
- public ItemData getItemData_old(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- // try as Node
- // TODO validate ParentNotFound for both Node and Property
- Node<Serializable, Object> childNode = nodesRoot.getChild(makeChildNodeFqn(parentData.getIdentifier(), name));
- if (childNode != null)
- {
- String nodeId = (String)childNode.get(ITEM_ID);
- if (nodeId != null)
- {
- Node<Serializable, Object> node = nodesRoot.getChild(makeNodeFqn(nodeId));
- if (node != null)
- {
- NodeData itemData = (NodeData)node.get(ITEM_DATA);
- if (itemData != null)
- {
- return itemData;
- }
- else
- {
- throw new RepositoryException("FATAL NodeData empty " + parentData.getQPath()
- + name.getAsString(true));
- }
- }
- else
- {
- throw new RepositoryException("FATAL Node record not found (" + name.getAsString(true)
- + "), but listed in childs of " + parentData.getQPath());
- }
- }
- else
- {
- throw new RepositoryException("FATAL Node Id empty " + parentData.getQPath() + name.getAsString(true));
- }
- }
- else
- {
- // try as Property
- Node<Serializable, Object> parent = nodesRoot.getChild(makeNodeFqn(parentData.getIdentifier()));
- if (parent != null)
- {
- // get property id
- String propId = (String)parent.get(name.getAsString(false));
- if (propId != null)
- {
- Node<Serializable, Object> prop = propsRoot.getChild(makePropFqn(propId));
- if (prop != null)
- {
- Object itemData = prop.get(ITEM_DATA);
- if (itemData != null)
- {
- return (PropertyData)itemData;
- }
- else
- {
- throw new RepositoryException("FATAL PropertyData empty " + parentData.getQPath()
- + name.getAsString(true));
- }
- }
- else
- {
- throw new RepositoryException("FATAL Property record not found(" + name.getAsString(true)
- + "), but listed in proprties of " + parentData.getQPath().getAsString());
- }
- }
- }
- else
- {
- if (LOG.isDebugEnabled())
- {
- LOG.debug("FATAL Parent not found " + parentData.getQPath().getAsString() + " for "
- + name.getAsString(true));
- }
-
- // TODO should be Exception, but after OPT branch optimization merge, current impl requires it as null returned
- //throw new RepositoryException("FATAL Parent not found " + parentData.getQPath().getAsString() + " for "
- // + name.getAsString(true));
- }
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
{
16 years, 7 months
exo-jcr SVN: r1011 - in jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr: cluster and 1 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-11 11:34:14 -0500 (Fri, 11 Dec 2009)
New Revision: 1011
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java
Log:
EXOJCR-313 : The tests WebdavAddNodeTest and WebdavRemoveNodeTest.
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java 2009-12-11 16:34:14 UTC (rev 1011)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.cluster;
+
+import org.exoplatform.common.http.client.CookieModule;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public abstract class BaseClusteringFunctionalTest
+ extends TestCase
+{
+ protected JCRWebdavConnection connection;
+
+ private String host = "localhost";
+
+ private int port = 8080;
+
+ private String realm = "eXo REST services";
+
+ private String user = "root";
+
+ private String password = "exo";
+
+ private String workspacePath = "/rest/jcr/repository/production/";
+
+ protected String nodeName;
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ CookieModule.setCookiePolicyHandler(null);
+ connection = new JCRWebdavConnection(host, port, user, password, realm, workspacePath);
+
+ nodeName = generateUniqueName("removed_node_over_webdav");
+ }
+
+ public String generateUniqueName(String prefix)
+ {
+ return prefix + "-" + Math.random();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ connection.removeNode(nodeName);
+ connection.stop();
+ }
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-11 16:34:14 UTC (rev 1011)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.cluster;
+
+import java.io.IOException;
+
+import org.exoplatform.common.http.client.HTTPConnection;
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.common.http.client.HttpHeaderElement;
+import org.exoplatform.common.http.client.HttpOutputStream;
+import org.exoplatform.common.http.client.ModuleException;
+import org.exoplatform.common.http.client.NVPair;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class JCRWebdavConnection extends HTTPConnection
+{
+ public static final String CONTENT_TYPE = "Content-Type";
+
+ public static final String CONTENT_LENGTH = "Content-Length";
+
+ private String realm;
+
+ private String user;
+
+ private String pass;
+
+ private String workspacePath;
+
+ public JCRWebdavConnection(String host, int port, String user, String password, String realm, String workspacePath)
+ {
+ super(host, port);
+
+ this.user = user;
+ this.pass = password;
+ this.realm = realm;
+ this.workspacePath = workspacePath;
+
+ addBasicAuthorization(this.realm, this.user, this.pass);
+ }
+
+ public void addNode(String name, byte[] data) throws IOException, ModuleException
+ {
+ Put(workspacePath + name, data).getStatusCode();
+ }
+
+ public void addNode(String name, String nodeType, byte[] data) throws IOException, ModuleException
+ {
+ NVPair[] headers = new NVPair[1];
+ headers[0] = new NVPair("File-NodeType", nodeType);
+ Put(workspacePath + name, data).getStatusCode();
+ }
+
+ public HTTPResponse addNode(String name, HttpOutputStream stream) throws IOException, ModuleException
+ {
+ return Put(workspacePath + name, stream);
+ }
+
+ public void removeNode(String name) throws IOException, ModuleException
+ {
+ Delete(workspacePath + name).getStatusCode();
+ }
+
+ public HTTPResponse getNode(String name) throws IOException, ModuleException
+ {
+ HTTPResponse response = Get(workspacePath + name);
+ response.getStatusCode();
+ return response;
+ }
+
+ public void addProperty(String nodeName, String property) throws IOException, ModuleException
+ {
+ String xmlBody = "<?xml version='1.0' encoding='utf-8' ?>" +
+ "<D:propertyupdate xmlns:D='DAV:' xmlns:Z='http://www.w3.com/standards/z39.50/'>" +
+ "<D:set>" +
+ "<D:prop>" +
+ "<" + property + ">default value</" + property + ">" +
+ "</D:prop>" +
+ "</D:set>" +
+ "</D:propertyupdate>";
+
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers).getStatusCode();
+ }
+
+
+ public void setProperty(String nodeName, String property, String value) throws IOException, ModuleException
+ {
+ String xmlBody = "<?xml version='1.0' encoding='utf-8' ?>" +
+ "<D:propertyupdate xmlns:D='DAV:' xmlns:Z='http://www.w3.com/standards/z39.50/'>" +
+ "<D:set>" +
+ "<D:prop>" +
+ "<" + property + ">" +value + "</" + property + ">" +
+ "</D:prop>" +
+ "</D:set>" +
+ "</D:propertyupdate>";
+
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers).getStatusCode();
+ }
+
+ public void removeProperty(String nodeName, String property) throws IOException, ModuleException
+ {
+ String xmlBody = "<?xml version='1.0' encoding='utf-8' ?>" +
+ "<D:propertyupdate xmlns:D='DAV:' xmlns:Z='http://www.w3.com/standards/z39.50/'>" +
+ "<D:remove>" +
+ "<D:prop><" + property + "/></D:prop>" +
+ "</D:remove>" +
+ "</D:propertyupdate>";
+
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers).getStatusCode();
+ }
+
+}
\ No newline at end of file
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java 2009-12-11 16:34:14 UTC (rev 1011)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavAddNodeTest
+ extends BaseClusteringFunctionalTest
+{
+
+ public void testAddNode() throws Exception
+ {
+ // add
+ connection.addNode(nodeName, "_data_".getBytes());
+
+ // check
+ HTTPResponse response = connection.getNode(nodeName);
+
+ assertEquals(response.getStatusCode(), 200);
+ assertTrue("_data_".equals(new String(response.getData())));
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java 2009-12-11 16:34:14 UTC (rev 1011)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavRemoveNodeTest
+ extends BaseClusteringFunctionalTest
+{
+ public void testRemoveNode() throws Exception
+ {
+ // add
+ connection.addNode(nodeName, "".getBytes());
+
+ // remove
+ connection.removeNode(nodeName);
+
+ // check
+ HTTPResponse response = connection.getNode(nodeName);
+
+ assertEquals(response.getStatusCode(), 404);
+ }
+ public WebdavRemoveNodeTest()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void tearDown() throws Exception
+ {
+ connection.stop();
+ }
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 7 months
exo-jcr SVN: r1010 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-11 11:33:12 -0500 (Fri, 11 Dec 2009)
New Revision: 1010
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-199: Nicolas suggestion applied
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-11 16:01:37 UTC (rev 1009)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-11 16:33:12 UTC (rev 1010)
@@ -174,7 +174,7 @@
if (data.getParentIdentifier() != null)
{
// check if parent is cached
- Node<Serializable, Object> parent = nodesRoot.getChild(makeNodeFqn(data.getParentIdentifier()));
+ Node<Serializable, Object> parent = nodesRoot.getChild(makeNodeFqn(data.getParentIdentifier()));
if (parent == null)
{
throw new InvalidItemStateException("Node's parent doesn't exist or removed by another Session "
@@ -491,7 +491,56 @@
*/
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
{
+ ItemData itemData = null;
+ //try as Node
+ String nodeId =
+ (String)cache.get(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.NODES), makeChildNodeFqn(parentData
+ .getIdentifier(), name)), ITEM_ID);
+ if (nodeId != null)
+ {
+ itemData =
+ (ItemData)cache.get(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.NODES), makeNodeFqn(nodeId)),
+ ITEM_DATA);
+ // nodeId found but item not exist's
+ if (itemData == null)
+ {
+ throw new RepositoryException("FATAL NodeData empty " + parentData.getQPath() + name.getAsString(true));
+ }
+ }
+ else
+ {
+ // try as Property
+ String propId =
+ (String)cache.get(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.NODES), makeNodeFqn(parentData
+ .getIdentifier())), name.getAsString(false));
+ if (propId != null)
+ {
+ itemData =
+ (ItemData)cache.get(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.PROPS), makePropFqn(propId)),
+ ITEM_DATA);
+ // propId found but item not exist's
+ if (itemData == null)
+ {
+ throw new RepositoryException("FATAL PropertyData empty " + parentData.getQPath()
+ + name.getAsString(true));
+ }
+
+ }
+ }
+ return itemData;
+ }
+
+ /**
+ * @deprecated version of getItemData(NodeData parentData, QPathEntry name) .
+ * Should be removed
+ * {@inheritDoc}
+ *
+ */
+ @Deprecated
+ public ItemData getItemData_old(NodeData parentData, QPathEntry name) throws RepositoryException,
+ IllegalStateException
+ {
// try as Node
// TODO validate ParentNotFound for both Node and Property
Node<Serializable, Object> childNode = nodesRoot.getChild(makeChildNodeFqn(parentData.getIdentifier(), name));
@@ -569,7 +618,6 @@
// + name.getAsString(true));
}
}
-
return null;
}
@@ -592,24 +640,24 @@
throw new RepositoryException("FATAL NodeData empty " + identifier);
}
}
-
+
// TODO only Nodes by Id
-// else
-// {
-// Node<Serializable, Object> prop = propsRoot.getChild(makePropFqn(identifier));
-// if (prop != null)
-// {
-// Object itemData = prop.get(ITEM_DATA);
-// if (itemData != null)
-// {
-// return (PropertyData)itemData;
-// }
-// else
-// {
-// throw new RepositoryException("FATAL PropertyData empty " + identifier);
-// }
-// }
-// }
+ // else
+ // {
+ // Node<Serializable, Object> prop = propsRoot.getChild(makePropFqn(identifier));
+ // if (prop != null)
+ // {
+ // Object itemData = prop.get(ITEM_DATA);
+ // if (itemData != null)
+ // {
+ // return (PropertyData)itemData;
+ // }
+ // else
+ // {
+ // throw new RepositoryException("FATAL PropertyData empty " + identifier);
+ // }
+ // }
+ // }
return null;
}
@@ -622,7 +670,8 @@
{
ArrayList<PropertyData> references = new ArrayList<PropertyData>();
- Node<Serializable, Object> node = this.refsRoot.getChild(Fqn.fromElements(IdTreeHelper.buildPath(nodeIdentifier)));
+ Node<Serializable, Object> node =
+ this.refsRoot.getChild(Fqn.fromElements(IdTreeHelper.buildPath(nodeIdentifier)));
if (node != null)
{
Set<Object> props = node.getChildrenNames();
@@ -1246,7 +1295,7 @@
for (String id : addSet)
{
Fqn nodeFqn = makeNodeFqn(id);
- Node<Serializable, Object> node = refsRoot.getChild(nodeFqn);
+ Node<Serializable, Object> node = refsRoot.getChild(nodeFqn);
if (node == null)
{
@@ -1313,7 +1362,7 @@
public List<LockData> getLocksData() throws RepositoryException
{
Set<Node<Serializable, Object>> lockSet = locksRoot.getChildren();
-
+
List<LockData> locksData = new ArrayList<LockData>();
for (Node<Serializable, Object> node : lockSet)
{
@@ -1328,38 +1377,40 @@
}
return locksData;
}
-
-
+
/**
* Traverse tree and getting all nodes without children.
*
* @param node
* @return
*/
- private Set<Node<Serializable, Object>> getNodes(Node<Serializable, Object> node) {
- Set<Node<Serializable, Object>> lockSet = new HashSet<Node<Serializable,Object>>();
-
+ private Set<Node<Serializable, Object>> getNodes(Node<Serializable, Object> node)
+ {
+ Set<Node<Serializable, Object>> lockSet = new HashSet<Node<Serializable, Object>>();
+
traverseTree(lockSet, node);
-
+
return lockSet;
}
-
- private void traverseTree(Set<Node<Serializable, Object>> resultSet, Node<Serializable, Object> node) {
+
+ private void traverseTree(Set<Node<Serializable, Object>> resultSet, Node<Serializable, Object> node)
+ {
Set<Node<Serializable, Object>> childNodes = node.getChildren();
-
- for (Node<Serializable, Object> childNode : childNodes)
+
+ for (Node<Serializable, Object> childNode : childNodes)
{
if (childNode.isLeaf())
{
resultSet.add(childNode);
- } else
+ }
+ else
{
- traverseTree(resultSet, childNode);
+ traverseTree(resultSet, childNode);
}
-
+
}
}
-
+
/**
* @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#addLockData(org.exoplatform.services.jcr.impl.core.lock.LockData)
*/
@@ -1372,7 +1423,7 @@
}
// addChild will add if absent or return old if present
Node<Serializable, Object> node = locksRoot.addChild(Fqn.fromString(lockData.getNodeIdentifier()));
-
+
// this will prevent from deleting by eviction.
node.setResident(true);
@@ -1395,8 +1446,8 @@
// token is the same, then Lock is just refreshed. Putting new LockData.
if (!node.replace(JBossCacheStorage.LOCK_DATA, oldLockData, lockData))
{
- throw new LockException("Unable to re-write LockData. Possibly LockData for the Node[" + lockData.getNodeIdentifier()
- + "] has just been changed!");
+ throw new LockException("Unable to re-write LockData. Possibly LockData for the Node["
+ + lockData.getNodeIdentifier() + "] has just been changed!");
}
}
}
@@ -1414,7 +1465,7 @@
}
locksRoot.removeChild(Fqn.fromString(identifier));
}
-
+
/**
* Will be removed empty tree.
*
16 years, 7 months
exo-jcr SVN: r1009 - in kernel/branches/mc-int-branch/exo.kernel.mc-integration: exo.kernel.mc-int-demo/src/main/java/org/exoplatform/kernel/demos/mc and 4 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2009-12-11 11:01:37 -0500 (Fri, 11 Dec 2009)
New Revision: 1009
Added:
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/ExternalMCInjectionTest.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/java/org/exoplatform/kernel/it/TestExternalMCInjectionIntegration.java
Modified:
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/java/org/exoplatform/kernel/demos/mc/ExternallyControlledInjectingBean.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/resources/conf/mc-int-config.xml
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest3.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCComponentAdapter.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntegrationImpl.java
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/src/main/java/org/jboss/dependency/plugins/helpers/StatelessController.java
Log:
Fix imports + add test for external property injection config
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCComponentAdapter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCComponentAdapter.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCComponentAdapter.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -2,7 +2,6 @@
import org.jboss.beans.info.spi.BeanAccessMode;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.dependency.plugins.helpers.StatelessController;
import org.jboss.dependency.spi.ControllerState;
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntegrationImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntegrationImpl.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntegrationImpl.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -5,22 +5,14 @@
import org.exoplatform.services.log.Log;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
import org.jboss.beans.metadata.spi.AnnotationMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.plugins.dependency.AbstractKernelController;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.mc.common.ThreadLocalUtils;
import org.jboss.mc.servlet.vdf.api.VDFThreadLocalUtils;
import org.picocontainer.ComponentAdapter;
import javax.servlet.ServletContext;
-import java.io.IOException;
import java.lang.annotation.Annotation;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
/**
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/java/org/exoplatform/kernel/demos/mc/ExternallyControlledInjectingBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/java/org/exoplatform/kernel/demos/mc/ExternallyControlledInjectingBean.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/java/org/exoplatform/kernel/demos/mc/ExternallyControlledInjectingBean.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -16,9 +16,11 @@
private String stringValue;
private int startCount;
+ private ConfigurationHolder config;
+
public ExternallyControlledInjectingBean()
{
-
+ config = new ConfigurationHolder();
}
public TransactionManager getTransactionManager()
@@ -74,4 +76,24 @@
public void stop()
{
}
+
+ public ConfigurationHolder getConfig()
+ {
+ return config;
+ }
+
+ public static class ConfigurationHolder
+ {
+ private String someProperty;
+
+ public String getSomeProperty()
+ {
+ return someProperty;
+ }
+
+ public void setSomeProperty(String someProperty)
+ {
+ this.someProperty = someProperty;
+ }
+ }
}
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/resources/conf/mc-int-config.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/resources/conf/mc-int-config.xml 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-demo/src/main/resources/conf/mc-int-config.xml 2009-12-11 16:01:37 UTC (rev 1009)
@@ -24,6 +24,8 @@
</map>
</property>
<property name="stringValue"><inject bean="InjectedBean" property="someString"/></property>
+ <!-- You can't use nested properties for injected properties, as property injection order is random -->
<!--property name="bean.anotherProperty">Test value</property-->
+ <property name="config.someProperty">Test value</property>
</bean>
</deployment>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/ExternalMCInjectionTest.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/ExternalMCInjectionTest.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/ExternalMCInjectionTest.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -0,0 +1,158 @@
+package org.exoplatform.kernel.it;
+
+import org.exoplatform.commons.Environment;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.kernel.demos.mc.ExternallyControlledInjectingBean;
+import org.exoplatform.kernel.demos.mc.InjectedBean;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.jboss.dependency.spi.Controller;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.transaction.TransactionManager;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class ExternalMCInjectionTest
+{
+ protected Log log = ExoLogger.getLogger(getClass());
+
+ protected String beanName;
+ protected ExternallyControlledInjectingBean bean;
+ protected boolean inJboss;
+ protected boolean mcIntActive = true;
+
+ public ExternalMCInjectionTest()
+ {
+ beanName = "ExternallyControlledInjectingBean";
+ }
+
+ protected void init()
+ {
+ log.info("init() method called");
+ RootContainer rootContainer = RootContainer.getInstance();
+ bean = (ExternallyControlledInjectingBean) rootContainer.getComponentInstance(beanName);
+ log.info("Retrieved " + beanName + ": " + bean);
+ Assert.assertNotNull(beanName + " not installed", bean);
+ inJboss = Environment.getInstance().getPlatform() == Environment.JBOSS_PLATFORM;
+ log.info("Running inside JBoss? " + inJboss);
+ }
+
+ @Test
+ public void test()
+ {
+ init();
+ tests();
+ }
+
+ protected void tests()
+ {
+ testTransactionManager();
+ testNameLookupMethodInjection();
+ testMapInjection();
+ testPropertyValueMethodInjection();
+ testNestedPropertyInjection();
+ testStarted();
+ }
+
+ private void testTransactionManager()
+ {
+ TransactionManager tm = bean.getTransactionManager();
+
+ if (inJboss && mcIntActive)
+ {
+ try
+ {
+ int status = tm.getStatus();
+ log.info("Status before tx: " + tm.getStatus());
+ tm.begin();
+ Assert.assertFalse("TX status didn't change: ", status == tm.getStatus());
+ log.info("Status in tx: " + tm.getStatus());
+ tm.commit();
+ Assert.assertTrue("TX status didn't return to original: ", status == tm.getStatus());
+ log.info("Status after tx: " + tm.getStatus());
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Failed to use TransactionManager: ", ex);
+ }
+ }
+ else
+ {
+ Assert.assertNull("Injection should not have worked", tm);
+ }
+ log.info("testTransactionManager passed");
+ }
+
+ protected void testNameLookupMethodInjection()
+ {
+ boolean found = bean.getBean() != null;
+ if (inJboss && mcIntActive)
+ {
+ Assert.assertTrue("Method injection by name lookup not executed", found);
+ }
+ else
+ {
+ Assert.assertFalse("Method injection by name lookup should not have worked", found);
+ }
+ log.info("testNameLookupMethodInjection passed");
+ }
+
+ protected void testMapInjection()
+ {
+ Map bindings = bean.getBindingsMap();
+ boolean found = bindings != null;
+ if (inJboss && mcIntActive)
+ {
+ Assert.assertTrue("Map injection not executed", found);
+ Assert.assertEquals("Bindings size", bindings.size(), 1);
+ Assert.assertTrue("Controller not bound", bindings.get(Controller.class) instanceof Controller);
+ }
+ else
+ {
+ Assert.assertFalse("Map injection should not have worked", found);
+ }
+ log.info("testMapInjection passed");
+ }
+
+ protected void testPropertyValueMethodInjection()
+ {
+ String propertyValue = bean.getStringValue();
+ boolean found = propertyValue != null;
+ if (inJboss && mcIntActive)
+ {
+ Assert.assertTrue("Property value method injection not executed", found);
+ Assert.assertEquals("Invalid injected value", propertyValue, InjectedBean.SOME_PROPERTY_VALUE);
+ }
+ else
+ {
+ Assert.assertFalse("Property value method injection should not have worked", found);
+ }
+ log.info("testPropertyValueMethodInjection passed");
+ }
+
+ protected void testNestedPropertyInjection()
+ {
+ String propertyValue = bean.getConfig().getSomeProperty();
+ boolean found = propertyValue != null;
+ if (inJboss && mcIntActive)
+ {
+ Assert.assertTrue("Nested property value method injection not executed", found);
+ Assert.assertEquals("Invalid injected value", propertyValue, "Test value");
+ }
+ else
+ {
+ Assert.assertFalse("Nested property value method injection should not have worked", found);
+ }
+ log.info("testNestedPropertyInjection passed");
+ }
+
+ protected void testStarted()
+ {
+ Assert.assertEquals("start() method not called exactly once", 1, bean.getStartCount());
+ log.info("testStarted passed");
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -15,10 +15,7 @@
import org.junit.Assert;
import org.junit.Test;
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -78,10 +75,13 @@
{
try
{
+ int status = tm.getStatus();
log.info("Status before tx: " + tm.getStatus());
tm.begin();
+ Assert.assertFalse("TX status didn't change: ", status == tm.getStatus());
log.info("Status in tx: " + tm.getStatus());
tm.commit();
+ Assert.assertTrue("TX status didn't return to original: ", status == tm.getStatus());
log.info("Status after tx: " + tm.getStatus());
}
catch (Exception ex)
@@ -181,24 +181,4 @@
Assert.assertEquals("start() method not called exactly once", 1, bean.getStartCount());
log.info("testStarted passed");
}
-
- static class CallCounter
- {
- private Map<String, Integer> called = new HashMap<String, Integer>();
-
- public void add(String name)
- {
- Integer count = called.get(name);
- if (count == null)
- {
- count = 0;
- }
- called.put(name, 1 + count);
- }
-
- public Map<String, Integer> getCallMap()
- {
- return called;
- }
- }
}
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest3.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest3.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/main/java/org/exoplatform/kernel/it/MCInjectionTest3.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -1,7 +1,5 @@
package org.exoplatform.kernel.it;
-import java.util.HashMap;
-
/**
* @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
*/
Added: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/java/org/exoplatform/kernel/it/TestExternalMCInjectionIntegration.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/java/org/exoplatform/kernel/it/TestExternalMCInjectionIntegration.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/java/org/exoplatform/kernel/it/TestExternalMCInjectionIntegration.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -0,0 +1,12 @@
+package org.exoplatform.kernel.it;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class TestExternalMCInjectionIntegration extends TestMCInjectionIntegration
+{
+ public TestExternalMCInjectionIntegration()
+ {
+ testClass = org.exoplatform.kernel.it.ExternalMCInjectionTest.class.getName();
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/src/main/java/org/jboss/dependency/plugins/helpers/StatelessController.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/src/main/java/org/jboss/dependency/plugins/helpers/StatelessController.java 2009-12-11 15:14:51 UTC (rev 1008)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/src/main/java/org/jboss/dependency/plugins/helpers/StatelessController.java 2009-12-11 16:01:37 UTC (rev 1009)
@@ -22,10 +22,9 @@
package org.jboss.dependency.plugins.helpers;
import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.plugins.AbstractController;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.plugins.AbstractController;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
16 years, 7 months
exo-jcr SVN: r1008 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache and 2 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-11 10:14:51 -0500 (Fri, 11 Dec 2009)
New Revision: 1008
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
Log:
EXOJCR-291: Re-viewed and re-worked setIoMode() control flow. Now QueryHandler is initialized after IO mode is determined. Also Merger is started only when RW assigned and safely stopped when becomes RO. Added Index lists re-reading on getIndexReader(). This is temporary dirty solution till list of indexes is not stored in cache.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -21,6 +21,7 @@
import javax.jcr.RepositoryException;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,6 +42,8 @@
*/
private QueryHandlerContext context;
+ protected boolean initialized = false;
+
/**
* The {@link OnWorkspaceInconsistency} handler. Defaults to 'fail'.
*/
@@ -58,16 +61,31 @@
private String idleTime;
/**
- * Initializes this query handler by setting all properties in this class
- * with appropriate parameter values.
- *
- * @param context the context for this query handler.
- * @throws RepositoryException
+ * Indexer io mode
*/
- public final void init(QueryHandlerContext context) throws IOException, RepositoryException
+ protected IndexerIoMode ioMode = IndexerIoMode.READ_ONLY;
+
+ public boolean isInitialized()
{
+ return initialized;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setContext(org.exoplatform.services.jcr.impl.core.query.QueryHandlerContext)
+ */
+ public void setContext(QueryHandlerContext context)
+ {
this.context = context;
+ }
+
+ /**
+ * Initializes QueryHandler with given IoMode (RW/RO)
+ */
+ public void init() throws IOException, RepositoryException, RepositoryConfigurationException
+ {
+ // TODO Auto-generated method stub
doInit();
+ initialized = true;
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core.query;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -43,14 +44,26 @@
* @param parentIndexingTree
* @param handler
* @param parentHandler
+ * @throws IOException
+ * @throws RepositoryConfigurationException
+ * @throws RepositoryException
*/
public DefaultChangesFilter(SearchManager searchManager, SearchManager parentSearchManager,
QueryHandlerEntry config, IndexingTree indexingTree, IndexingTree parentIndexingTree, QueryHandler handler,
- QueryHandler parentHandler)
+ QueryHandler parentHandler) throws IOException, RepositoryConfigurationException, RepositoryException
{
super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree, handler, parentHandler);
handler.setIndexerIoMode(IndexerIoMode.READ_WRITE);
parentHandler.setIndexerIoMode(IndexerIoMode.READ_WRITE);
+
+ if (!parentHandler.isInitialized())
+ {
+ parentHandler.init();
+ }
+ if (!handler.isInitialized())
+ {
+ handler.init();
+ }
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -41,7 +41,7 @@
/**
* Returns the query handler context that passed in {@link
- * #init(QueryHandlerContext)}.
+ * #setContext(QueryHandlerContext)}.
*
* @return the query handler context.
*/
@@ -81,9 +81,31 @@
*/
void close();
- void init(QueryHandlerContext context) throws IOException, RepositoryException, RepositoryConfigurationException;
+ /**
+ * Sets QueryHandlerContext
+ * @param context
+ */
+ void setContext(QueryHandlerContext context);
/**
+ *
+ * initializes QueryHandler
+ *
+ * @param ioMode
+ * @throws IOException
+ * @throws RepositoryException
+ * @throws RepositoryConfigurationException
+ */
+ void init() throws IOException, RepositoryException, RepositoryConfigurationException;
+
+ /**
+ * Checks whether QueryHandler is initialized or not
+ *
+ * @return
+ */
+ boolean isInitialized();
+
+ /**
* Creates a new query by specifying the query statement itself and the
* language in which the query is stated. If the query statement is
* syntactically invalid, given the language specified, an
@@ -110,7 +132,7 @@
*/
void logErrorChanges(Set<String> removed, Set<String> added) throws IOException;
- void setIndexerIoMode(IndexerIoMode ioMode);
+ void setIndexerIoMode(IndexerIoMode ioMode) throws IOException;
/**
* @return the name of the query class to use.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -768,7 +768,7 @@
handler = (QueryHandler)constuctor.newInstance(config, cfm);
QueryHandler parentHandler = (this.parentSearchManager != null) ? parentSearchManager.getHandler() : null;
QueryHandlerContext context = createQueryHandlerContext(parentHandler);
- handler.init(context);
+ handler.setContext(context);
if (parentSearchManager != null)
{
@@ -803,10 +803,6 @@
{
throw new RepositoryException(e.getMessage(), e);
}
- catch (IOException e)
- {
- throw new RepositoryException(e.getMessage(), e);
- }
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -80,6 +80,7 @@
log.info("Received list wrapper, start indexing...");
}
ChangesFilterListsWrapper wrapper = (ChangesFilterListsWrapper)val;
+ log.info("Loader=" + this + " changes=" + wrapper.dump());
updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
.getParentRemovedNodes());
}
@@ -154,13 +155,20 @@
*/
public void setMode(IndexerIoMode ioMode)
{
- if (handler != null)
+ try
{
- handler.setIndexerIoMode(ioMode);
+ if (handler != null)
+ {
+ handler.setIndexerIoMode(ioMode);
+ }
+ if (parentHandler != null)
+ {
+ parentHandler.setIndexerIoMode(ioMode);
+ }
}
- if (parentHandler != null)
+ catch (IOException e)
{
- parentHandler.setIndexerIoMode(ioMode);
+ log.error("Unable to set indexer mode to " + ioMode, e);
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -43,20 +43,6 @@
{
private final Log log = ExoLogger.getLogger(this.getClass().getName());
- @CacheListener
- public class InitialStateListener
- {
- /**
- * Cache started, check whether the node is the coordinator and set indexer mode.
- */
- @CacheStarted
- public void cacheStarted(Event e)
- {
- // set whether this cluster node is writable or not
- setIndexerMode(cache.getRPCManager().isCoordinator());
- }
- }
-
/**
* @see org.jboss.cache.loader.SingletonStoreCacheLoader#activeStatusChanged(boolean)
*/
@@ -69,17 +55,7 @@
super.activeStatusChanged(newActiveState);
}
- /**
- * @see org.jboss.cache.loader.SingletonStoreCacheLoader#create()
- */
@Override
- public void create() throws Exception
- {
- super.create();
- cache.addCacheListener(new InitialStateListener());
- }
-
- @Override
protected Callable<?> createPushStateTask()
{
return new Callable()
@@ -138,6 +114,7 @@
// if newActiveState is true IndexerCacheLoader is coordinator with write enabled;
((IndexerCacheLoader)getCacheLoader()).setMode(writeEnabled ? IndexerIoMode.READ_WRITE
: IndexerIoMode.READ_ONLY);
+ log.info("Set indexer io mode to:" + (writeEnabled ? IndexerIoMode.READ_WRITE : IndexerIoMode.READ_ONLY));
}
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.config.QueryHandlerParams;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
@@ -30,15 +31,19 @@
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import java.io.IOException;
import java.io.Serializable;
import java.util.Properties;
import java.util.Set;
+import javax.jcr.RepositoryException;
+
/**
* @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
@@ -71,7 +76,7 @@
*/
public JbossCacheIndexChangesFilter(SearchManager searchManager, SearchManager parentSearchManager,
QueryHandlerEntry config, IndexingTree indexingTree, IndexingTree parentIndexingTree, QueryHandler handler,
- QueryHandler parentHandler) throws RepositoryConfigurationException
+ QueryHandler parentHandler) throws IOException, RepositoryException, RepositoryConfigurationException
{
super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree, handler, parentHandler);
String jbcConfig = config.getParameterValue(QueryHandlerParams.PARAM_CHANGES_FILTER_CONFIG_PATH);
@@ -112,6 +117,22 @@
this.cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
this.cache.create();
this.cache.start();
+ // start will invoke cache listener which will notify handler that mode is changed
+ IndexerIoMode ioMode =
+ ((CacheSPI)cache).getRPCManager().isCoordinator() ? IndexerIoMode.READ_WRITE : IndexerIoMode.READ_ONLY;
+
+ handler.setIndexerIoMode(ioMode);
+ parentHandler.setIndexerIoMode(ioMode);
+
+ if (!parentHandler.isInitialized())
+ {
+ parentHandler.init();
+ }
+ if (!handler.isInitialized())
+ {
+ handler.init();
+ }
+
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -85,7 +85,7 @@
/**
* Names of active persistent index directories.
*/
- private final IndexInfos indexNames = new IndexInfos("indexes");
+ private IndexInfos indexNames = new IndexInfos("indexes");
/**
* Names of index directories that can be deleted.
@@ -176,7 +176,7 @@
/**
* The RedoLog of this <code>MultiIndex</code>.
*/
- private final RedoLog redoLog;
+ private RedoLog redoLog = null;
/**
* The indexing queue with pending text extraction jobs.
@@ -211,10 +211,10 @@
/**
* Indexer io mode
*/
- private IndexerIoMode ioMode;
+ private IndexerIoMode ioMode = IndexerIoMode.READ_ONLY;
/**
- * Creates a new MultiIndex.
+ * Creates a new MultiIndex in READ ONLY MODE! setIndexerIoMode(READ_WRITE) later.
*
* @param handler
* the search handler
@@ -231,7 +231,6 @@
this.indexDir = directoryManager.getDirectory(".");
this.handler = handler;
this.cache = new DocNumberCache(handler.getCacheSize());
- this.redoLog = new RedoLog(indexDir);
this.indexingTree = indexingTree;
this.nsMappings = handler.getNamespaceMappings();
this.flushTask = null;
@@ -292,47 +291,11 @@
{
reader.release();
}
-
indexingQueue.initialize(this);
-
if (ioMode == IndexerIoMode.READ_WRITE)
{
- redoLogApplied = redoLog.hasEntries();
-
- // run recovery
- Recovery.run(this, redoLog);
-
- // enqueue unused segments for deletion
- enqueueUnusedSegments();
- attemptDelete();
-
- // now that we are ready, start index merger
- merger.start();
-
- if (redoLogApplied)
- {
- // wait for the index merge to finish pending jobs
- try
- {
- merger.waitUntilIdle();
- }
- catch (InterruptedException e)
- {
- // move on
- }
- flush();
- }
-
- if (indexNames.size() > 0)
- {
- scheduleFlushTask();
- }
+ setReadWrite();
}
- else
- {
- redoLogApplied = false;
- }
-
}
/**
@@ -653,6 +616,11 @@
}
}
+ if (ioMode == IndexerIoMode.READ_ONLY)
+ {
+ throw new UnsupportedOperationException("Can't create index in READ_ONLY mode.");
+ }
+
// otherwise open / create it
if (indexName == null)
{
@@ -833,6 +801,13 @@
{
synchronized (updateMonitor)
{
+
+ // TODO: re-implement in less aggressive way
+ if (ioMode == IndexerIoMode.READ_ONLY)
+ {
+ // this is temporary and extensive solution to re-read list of indexes.
+ refreshIndexesList();
+ }
if (multiReader != null)
{
multiReader.acquire();
@@ -1130,13 +1105,19 @@
}
}
+ /**
+ * Cancel flush task and add new one
+ */
private void scheduleFlushTask()
{
- lastFlushTime = System.currentTimeMillis();
+ // cancel task
if (flushTask != null)
{
flushTask.cancel();
}
+ // clear canceled tasks
+ FLUSH_TIMER.purge();
+ // new flush task, cause canceled can't be re-used
flushTask = new TimerTask()
{
public void run()
@@ -1148,6 +1129,7 @@
}
};
FLUSH_TIMER.schedule(flushTask, 0, 1000);
+ lastFlushTime = System.currentTimeMillis();
}
/**
@@ -2349,8 +2331,9 @@
/**
* Set indexer io mode.
* @param ioMode
+ * @throws IOException
*/
- public void setIndexerIoMode(IndexerIoMode ioMode)
+ public void setIndexerIoMode(IndexerIoMode ioMode) throws IOException
{
log.info("Indexer io mode=" + ioMode);
//do some thing if changed
@@ -2360,14 +2343,112 @@
switch (ioMode)
{
case READ_ONLY :
- // stop timer
- flushTask.cancel();
+ setReadOny();
break;
case READ_WRITE :
- scheduleFlushTask();
+ setReadWrite();
break;
}
}
}
+
+ /**
+ * Sets mode to READ_ONLY, discarding flush task
+ */
+ protected void setReadOny()
+ {
+ // try to stop merger in safe way
+ merger.dispose();
+ flushTask.cancel();
+ FLUSH_TIMER.purge();
+ this.redoLog = null;
+ }
+
+ /**
+ * Sets mode to READ_WRITE, initiating recovery process
+ *
+ * @throws IOException
+ */
+ protected void setReadWrite() throws IOException
+ {
+ this.redoLog = new RedoLog(indexDir);
+ redoLogApplied = redoLog.hasEntries();
+
+ // run recovery
+ Recovery.run(this, redoLog);
+
+ // enqueue unused segments for deletion
+ enqueueUnusedSegments();
+ attemptDelete();
+
+ // now that we are ready, start index merger
+ merger.start();
+ if (redoLogApplied)
+ {
+ // wait for the index merge to finish pending jobs
+ try
+ {
+ merger.waitUntilIdle();
+ }
+ catch (InterruptedException e)
+ {
+ // move on
+ }
+ flush();
+ }
+
+ if (indexNames.size() > 0)
+ {
+ scheduleFlushTask();
+ }
+ }
+
+ /**
+ * Temporary solution for indexer in cluster. This method re-reads list of indexes from FS.
+ * @throws IOException
+ */
+ protected void refreshIndexesList() throws IOException
+ {
+ log.info("Refreshing list of indexes...");
+ // release reader if any
+ releaseMultiReader();
+ // close all indexes
+ for (Object index : indexes)
+ {
+ if (index instanceof AbstractIndex)
+ {
+ ((AbstractIndex)index).close();
+ }
+ }
+ indexes.clear();
+ // re-read all indexes
+ indexNames = new IndexInfos("indexes");
+ if (indexNames.exists(indexDir))
+ {
+ indexNames.read(indexDir);
+ }
+
+ for (int i = 0; i < indexNames.size(); i++)
+ {
+ String name = indexNames.getName(i);
+ // only open if it still exists
+ // it is possible that indexNames still contains a name for
+ // an index that has been deleted, but indexNames has not been
+ // written to disk.
+ if (!directoryManager.hasDirectory(name))
+ {
+ log.debug("index does not exist anymore: " + name);
+ // move on to next index
+ continue;
+ }
+ PersistentIndex index =
+ new PersistentIndex(name, handler.getTextAnalyzer(), handler.getSimilarity(), cache, indexingQueue,
+ directoryManager);
+ index.setMaxFieldLength(handler.getMaxFieldLength());
+ index.setUseCompoundFile(handler.getUseCompoundFile());
+ index.setTermInfosIndexDivisor(handler.getTermInfosIndexDivisor());
+ indexes.add(index);
+ }
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -416,11 +416,6 @@
private final ConfigurationManager cfm;
/**
- * Indexer io mode
- */
- private IndexerIoMode ioMode = IndexerIoMode.READ_ONLY;
-
- /**
* Working constructor.
*
* @throws RepositoryConfigurationException
@@ -521,41 +516,43 @@
analyzer.setIndexingConfig(indexingConfig);
index = new MultiIndex(this, context.getIndexingTree(), ioMode);
- if (index.numDocs() == 0 && context.isCreateInitialIndex())
+ // if RW mode, create initial index and start check
+ if (ioMode == IndexerIoMode.READ_WRITE)
{
-
- index.createInitialIndex(context.getItemStateManager());
- }
- if (consistencyCheckEnabled && (index.getRedoLogApplied() || forceConsistencyCheck))
- {
- log.info("Running consistency check...");
- try
+ if (index.numDocs() == 0 && context.isCreateInitialIndex())
{
- ConsistencyCheck check = ConsistencyCheck.run(index, context.getItemStateManager());
- if (autoRepair)
+ index.createInitialIndex(context.getItemStateManager());
+ }
+ if (consistencyCheckEnabled && (index.getRedoLogApplied() || forceConsistencyCheck))
+ {
+ log.info("Running consistency check...");
+ try
{
- check.repair(true);
- }
- else
- {
- List<ConsistencyCheckError> errors = check.getErrors();
- if (errors.size() == 0)
+ ConsistencyCheck check = ConsistencyCheck.run(index, context.getItemStateManager());
+ if (autoRepair)
{
- log.info("No errors detected.");
+ check.repair(true);
}
- for (Iterator<ConsistencyCheckError> it = errors.iterator(); it.hasNext();)
+ else
{
- ConsistencyCheckError err = it.next();
- log.info(err.toString());
+ List<ConsistencyCheckError> errors = check.getErrors();
+ if (errors.size() == 0)
+ {
+ log.info("No errors detected.");
+ }
+ for (Iterator<ConsistencyCheckError> it = errors.iterator(); it.hasNext();)
+ {
+ ConsistencyCheckError err = it.next();
+ log.info(err.toString());
+ }
}
}
+ catch (Exception e)
+ {
+ log.warn("Failed to run consistency check on index: " + e);
+ }
}
- catch (Exception e)
- {
- log.warn("Failed to run consistency check on index: " + e);
- }
}
-
// initialize spell checker
spellChecker = createSpellChecker();
@@ -2646,23 +2643,27 @@
}
/**
+ * @throws IOException
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setIndexerIoMode(org.exoplatform.services.jcr.impl.core.query.IndexerIoMode)
*/
- public void setIndexerIoMode(IndexerIoMode ioMode)
+ public void setIndexerIoMode(IndexerIoMode ioMode) throws IOException
{
log.info("Indexer io mode=" + ioMode);
//do some thing if changed
if (!this.ioMode.equals(ioMode))
{
this.ioMode = ioMode;
- switch (ioMode)
+ if (index != null)
{
- case READ_ONLY :
- index.setIndexerIoMode(ioMode);
- break;
- case READ_WRITE :
- index.setIndexerIoMode(ioMode);
- break;
+ switch (ioMode)
+ {
+ case READ_ONLY :
+ index.setIndexerIoMode(ioMode);
+ break;
+ case READ_WRITE :
+ index.setIndexerIoMode(ioMode);
+ break;
+ }
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2009-12-11 14:44:56 UTC (rev 1007)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2009-12-11 15:14:51 UTC (rev 1008)
@@ -81,12 +81,6 @@
}
- public void setContext(QueryHandlerContext context) throws IOException
- {
- // TODO Auto-generated method stub
-
- }
-
/**
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#executeQuery(org.apache.lucene.search.Query)
*/
16 years, 7 months
exo-jcr SVN: r1007 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: dataflow and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-11 09:44:56 -0500 (Fri, 11 Dec 2009)
New Revision: 1007
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
Log:
EXOJCR-300: create editable copy
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java 2009-12-11 14:21:29 UTC (rev 1006)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java 2009-12-11 14:44:56 UTC (rev 1007)
@@ -138,22 +138,13 @@
* */
public void update(InputStream stream, long length, long position) throws IOException, RepositoryException
{
- // if (changedData == null)
- // {
- // ValueData internalData = this.getInternalData();
- //
- // if (internalData instanceof TransientValueData)
- // {
- // changedData = ((TransientValueData)internalData).createEditableCopy();
- // }
- // else
- // {
- // changedData = ((PersistedValueData)internalData).createTransientCopy();
- // }
- // }
- //
- // this.changedData.update(stream, length, position);
- // this.changed = true;
+ if (changedData == null)
+ {
+ changedData = createEditableCopy(this.getInternalData());
+ }
+
+ this.changedData.update(stream, length, position);
+ this.changed = true;
}
/**
@@ -164,13 +155,13 @@
*/
public void setLength(long size) throws IOException, RepositoryException
{
- // if (changedData == null)
- // {
- // changedData = ((TransientValueData)this.getInternalData()).createEditableCopy();
- // }
- //
- // this.changedData.setLength(size);
- // this.changed = true;
+ if (changedData == null)
+ {
+ changedData = createEditableCopy(this.getInternalData());
+ }
+
+ this.changedData.setLength(size);
+ this.changed = true;
}
/**
@@ -212,11 +203,11 @@
}
catch (FileNotFoundException e)
{
- throw new RepositoryException("Create transient copy error. " + e, e);
+ throw new RepositoryException("Create editable copy error. " + e, e);
}
catch (IOException e)
{
- throw new RepositoryException("Create transient copy error. " + e, e);
+ throw new RepositoryException("Create editable copy error. " + e, e);
}
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-11 14:21:29 UTC (rev 1006)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-11 14:44:56 UTC (rev 1007)
@@ -19,14 +19,17 @@
package org.exoplatform.services.jcr.impl.dataflow;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
@@ -120,29 +123,25 @@
this.maxIOBuffSize = calcMaxIOSize();
- File sf = null;
- FileChannel sch = null;
+ File sf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ OutputStream sfout = new FileOutputStream(sf);
try
{
- sf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ byte[] tmpBuff = new byte[2048];
+ int read = 0;
+ int len = 0;
- sch = new RandomAccessFile(sf, "rw").getChannel();
-
- FileChannel sourceCh = new FileInputStream(spoolFile).getChannel();
- try
+ while ((read = stream.read(tmpBuff)) >= 0)
{
- sch.transferFrom(sourceCh, 0, sourceCh.size());
+ sfout.write(tmpBuff, 0, read);
+ len += read;
}
- finally
- {
- sourceCh.close();
- }
}
catch (final IOException e)
{
try
{
- sch.close();
+ sfout.close();
sf.delete();
}
catch (Exception e1)
@@ -161,7 +160,7 @@
this.data = null;
this.spoolFile = sf;
- this.spoolChannel = sch;
+ this.spoolChannel = new RandomAccessFile(sf, "rw").getChannel();
this.spooled = true;
}
16 years, 7 months
exo-jcr SVN: r1006 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: dataflow and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-11 09:21:29 -0500 (Fri, 11 Dec 2009)
New Revision: 1006
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java
Log:
EXOJCR-300: bugfix
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java 2009-12-11 13:04:44 UTC (rev 1005)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BinaryValue.java 2009-12-11 14:21:29 UTC (rev 1006)
@@ -21,12 +21,14 @@
import org.exoplatform.services.jcr.core.value.EditableBinaryValue;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.EditableValueData;
+import org.exoplatform.services.jcr.impl.dataflow.PersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -85,11 +87,10 @@
}
/** used in ValueFactory.loadValue */
- BinaryValue(ValueData data, FileCleaner fileCleaner, File tempDirectory, int maxFufferSize)
- throws IOException
+ BinaryValue(ValueData data, FileCleaner fileCleaner, File tempDirectory, int maxFufferSize) throws IOException
{
super(TYPE, data);
-
+
// TODO
//internalData.setFileCleaner(fileCleaner);
//internalData.setTempDirectory(tempDirectory);
@@ -137,15 +138,22 @@
* */
public void update(InputStream stream, long length, long position) throws IOException, RepositoryException
{
- // TODO impl it
-// if (changedData == null)
-// {
-// changedData = this.getInternalData().createEditableCopy();
-// }
-//
-// this.changedData.update(stream, length, position);
-//
-// this.changed = true;
+ // if (changedData == null)
+ // {
+ // ValueData internalData = this.getInternalData();
+ //
+ // if (internalData instanceof TransientValueData)
+ // {
+ // changedData = ((TransientValueData)internalData).createEditableCopy();
+ // }
+ // else
+ // {
+ // changedData = ((PersistedValueData)internalData).createTransientCopy();
+ // }
+ // }
+ //
+ // this.changedData.update(stream, length, position);
+ // this.changed = true;
}
/**
@@ -156,16 +164,61 @@
*/
public void setLength(long size) throws IOException, RepositoryException
{
-
- // TODO impl it
-// if (changedData == null)
-// {
-// changedData = this.getInternalData().createEditableCopy();
-// }
-//
-// this.changedData.setLength(size);
-//
-// this.changed = true;
+ // if (changedData == null)
+ // {
+ // changedData = ((TransientValueData)this.getInternalData()).createEditableCopy();
+ // }
+ //
+ // this.changedData.setLength(size);
+ // this.changed = true;
}
+ /**
+ * Create editable ValueData copy.
+ *
+ * @return EditableValueData
+ * @throws RepositoryException
+ * if error occurs
+ * @throws IOException
+ * @throws IllegalStateException
+ */
+ private EditableValueData createEditableCopy(ValueData oldValue) throws RepositoryException, IllegalStateException,
+ IOException
+ {
+ if (oldValue.isByteArray())
+ {
+ // bytes, make a copy of real data
+ byte[] oldBytes = oldValue.getAsByteArray();
+ byte[] newBytes = new byte[oldBytes.length];
+ System.arraycopy(oldBytes, 0, newBytes, 0, newBytes.length);
+
+ try
+ {
+ return new EditableValueData(newBytes, oldValue.getOrderNumber(), null, -1, null);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+ else
+ {
+ // edited BLOB file, make a copy
+ try
+ {
+ EditableValueData copy =
+ new EditableValueData(oldValue.getAsStream(), oldValue.getOrderNumber(), null, -1, null);
+ return copy;
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new RepositoryException("Create transient copy error. " + e, e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException("Create transient copy error. " + e, e);
+ }
+ }
+ }
+
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-11 13:04:44 UTC (rev 1005)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-11 14:21:29 UTC (rev 1006)
@@ -40,7 +40,7 @@
{
protected final static Log LOG = ExoLogger.getLogger("jcr.EditableValueData");
-
+
protected final int maxIOBuffSize;
public EditableValueData(byte[] bytes, int orderNumber, FileCleaner fileCleaner, int maxBufferSize,
@@ -111,6 +111,61 @@
this.spooled = true;
}
+ public EditableValueData(InputStream stream, int orderNumber, FileCleaner fileCleaner, int maxBufferSize,
+ File tempDirectory) throws IOException
+ {
+
+ // don't send any data there (no stream, no bytes)
+ super(orderNumber, null, null, null, fileCleaner, maxBufferSize, tempDirectory, true);
+
+ this.maxIOBuffSize = calcMaxIOSize();
+
+ File sf = null;
+ FileChannel sch = null;
+ try
+ {
+ sf = File.createTempFile("jcrvdedit", null, tempDirectory);
+
+ sch = new RandomAccessFile(sf, "rw").getChannel();
+
+ FileChannel sourceCh = new FileInputStream(spoolFile).getChannel();
+ try
+ {
+ sch.transferFrom(sourceCh, 0, sourceCh.size());
+ }
+ finally
+ {
+ sourceCh.close();
+ }
+ }
+ catch (final IOException e)
+ {
+ try
+ {
+ sch.close();
+ sf.delete();
+ }
+ catch (Exception e1)
+ {
+ }
+ throw new IOException("init error " + e.getMessage())
+ {
+ @Override
+ public Throwable getCause()
+ {
+ return e;
+ }
+ };
+ }
+
+ this.data = null;
+
+ this.spoolFile = sf;
+ this.spoolChannel = sch;
+
+ this.spooled = true;
+ }
+
protected int calcMaxIOSize()
{
return maxBufferSize < 1024 ? 1024 : maxBufferSize < (250 * 1024) ? maxBufferSize : 250 * 1024;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java 2009-12-11 13:04:44 UTC (rev 1005)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java 2009-12-11 14:21:29 UTC (rev 1006)
@@ -32,7 +32,7 @@
{
protected final static Log LOG = ExoLogger.getLogger("jcr.PersistedValueData");
-
+
protected int orderNumber;
protected PersistedValueData(int orderNumber)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2009-12-11 13:04:44 UTC (rev 1005)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2009-12-11 14:21:29 UTC (rev 1006)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.dataflow.persistent;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.dataflow.EditableValueData;
import org.exoplatform.services.jcr.impl.dataflow.PersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.log.ExoLogger;
@@ -162,4 +163,5 @@
throw new RepositoryException(e);
}
}
+
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java 2009-12-11 13:04:44 UTC (rev 1005)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java 2009-12-11 14:21:29 UTC (rev 1006)
@@ -22,12 +22,14 @@
import org.exoplatform.services.jcr.impl.dataflow.PersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
@@ -77,11 +79,11 @@
/**
* {@inheritDoc}
+ * @throws IOException
*/
- public byte[] getAsByteArray() throws IllegalStateException
+ public byte[] getAsByteArray() throws IllegalStateException, IOException
{
- throw new IllegalStateException(
- "It is illegal to call on FileStreamPersistedValueData due to potential lack of memory");
+ return fileToByteArray();
}
/**
@@ -193,4 +195,36 @@
throw new RepositoryException(e);
}
}
+
+ /**
+ * Convert File to byte array. <br/>
+ * WARNING: Potential lack of memory due to call getAsByteArray() on stream data.
+ *
+ * @return byte[] bytes array
+ */
+ private byte[] fileToByteArray() throws IOException
+ {
+ FileChannel fch = new FileInputStream(file).getChannel();
+
+ try
+ {
+ ByteBuffer bb = ByteBuffer.allocate((int)fch.size());
+ fch.read(bb);
+ if (bb.hasArray())
+ {
+ return bb.array();
+ }
+ else
+ {
+ // impossible code in most cases, as we use heap backed buffer
+ byte[] tmpb = new byte[bb.capacity()];
+ bb.get(tmpb);
+ return tmpb;
+ }
+ }
+ finally
+ {
+ fch.close();
+ }
+ }
}
16 years, 7 months
exo-jcr SVN: r1005 - in kernel/branches: config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons and 8 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-11 08:04:44 -0500 (Fri, 11 Dec 2009)
New Revision: 1005
Added:
kernel/branches/config-branch/
kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Platform.java
kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestEnvironment.java
kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentPluginProfile.java
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentProfile.java
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestImportProfile.java
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestInitParamProfile.java
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-plugin-configuration.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml
kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml
Removed:
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/Environnment.java
Modified:
kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Environment.java
kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertyManager.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java
kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestContainer.java
Log:
configuration branch
Copied: kernel/branches/config-branch (from rev 760, kernel/tags/2.2.0-Beta03)
Modified: kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Environment.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.commons/src/main/java/org/exoplatform/commons/Environment.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Environment.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -21,63 +21,80 @@
public class Environment
{
- static final public int UNKNOWN = 0;
+ /** The jonas profile name. */
+ public static final String JONAS_PROFILE = "jonas";
- static final public int STAND_ALONE = 1;
+ /** The JBoss profile name. */
+ public static final String JBOSS_PROFILE = "jboss";
- static final public int TOMCAT_PLATFORM = 2;
+ /** The test profile name. */
+ public static final String TEST_PROFILE = "test";
- static final public int JBOSS_PLATFORM = 3;
+ /** The standalone profile name. */
+ public static final String STANDALONE_PROFILE = "standalone";
- static final public int JETTY_PLATFORM = 4;
+ /** The jetty profile name. */
+ public static final String JETTY_PROFILE = "jetty";
- static final public int WEBSHPERE_PLATFORM = 5;
+ /** The websphere profile name. */
+ public static final String WEBSPHERE_PROFILE = "webpshere";
- static final public int WEBLOGIC_PLATFORM = 6;
+ /** The weblogic profile name. */
+ public static final String WEBLOGIC_PROFILE = "weblogic";
+ /** The tomcat profile name. */
+ public static final String TOMCAT_PROFILE = "tomcat";
+
static private Environment singleton_;
- private int platform_;
+ private final Platform platform_;
private Environment()
{
+ String jonasHome = System.getProperty("jonas.base");
String catalinaHome = System.getProperty("catalina.home");
String jbossHome = System.getProperty("jboss.home.dir");
String jettyHome = System.getProperty("jetty.home");
String websphereHome = System.getProperty("was.install.root");
String weblogicHome = System.getProperty("weblogic.Name");
String standAlone = System.getProperty("maven.exoplatform.dir");
- if (jbossHome != null)
+
+ //
+ if (jonasHome != null)
{
- platform_ = JBOSS_PLATFORM;
+ platform_ = Platform.JONAS_PLATFORM;
}
+ else if (jbossHome != null)
+ {
+ platform_ = Platform.JBOSS_PLATFORM;
+ }
else if (catalinaHome != null)
{
- platform_ = TOMCAT_PLATFORM;
+ platform_ = Platform.TOMCAT_PLATFORM;
}
else if (jettyHome != null)
{
- platform_ = JETTY_PLATFORM;
+ platform_ = Platform.JETTY_PLATFORM;
}
else if (websphereHome != null)
{
- platform_ = WEBSHPERE_PLATFORM;
+ platform_ = Platform.WEBSHPERE_PLATFORM;
}
else if (weblogicHome != null)
{
- platform_ = WEBLOGIC_PLATFORM;
+ platform_ = Platform.WEBLOGIC_PLATFORM;
}
else if (standAlone != null)
{
- platform_ = STAND_ALONE;
+ platform_ = Platform.STAND_ALONE;
}
else
{
- platform_ = UNKNOWN;
+ platform_ = Platform.UNKNOWN_PLATFORM;
}
}
- public int getPlatform()
+ public Platform getPlatform()
{
return platform_;
}
@@ -93,4 +110,9 @@
}
return singleton_;
}
+
+ public static boolean isJBoss()
+ {
+ return getInstance().getPlatform() == Platform.JBOSS_PLATFORM;
+ }
}
Added: kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Platform.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Platform.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/Platform.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.commons;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum Platform
+{
+
+ JONAS_PLATFORM(Environment.JONAS_PROFILE, getDefaultDataDir()),
+
+ STAND_ALONE(Environment.STANDALONE_PROFILE, getDefaultDataDir()),
+
+ TOMCAT_PLATFORM(Environment.TOMCAT_PROFILE, getDefaultDataDir()),
+
+ JBOSS_PLATFORM(Environment.JBOSS_PROFILE, System.getProperty("jboss.server.data.dir")),
+
+ JETTY_PLATFORM(Environment.JETTY_PROFILE, getDefaultDataDir()),
+
+ WEBSHPERE_PLATFORM(Environment.WEBSPHERE_PROFILE, getDefaultDataDir()),
+
+ WEBLOGIC_PLATFORM(Environment.WEBLOGIC_PROFILE, getDefaultDataDir()),
+
+ UNKNOWN_PLATFORM(null, getDefaultDataDir());
+
+ /** The profile name of the server. */
+ private final String profile;
+
+ /** The profile name of the server. */
+ private final String dataDir;
+
+ Platform(String profile, String dataDir)
+ {
+ this.profile = profile;
+ this.dataDir = dataDir;
+ }
+
+ public String getProfile()
+ {
+ return profile;
+ }
+
+ public String getDataDir()
+ {
+ return dataDir;
+ }
+
+ private static String getDefaultDataDir()
+ {
+ try
+ {
+ File dataDir = new File("../temp");
+ return dataDir.getCanonicalPath();
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredThrowableException(e);
+ }
+ }
+}
Modified: kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertyManager.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertyManager.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertyManager.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.commons.utils;
+import org.exoplatform.commons.Environment;
+
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -38,6 +40,12 @@
public static final String DEVELOPING = "exo.product.developing";
/** . */
+ public static final String RUNTIME_PROFILES = "exo.profiles";
+
+ /** . */
+ public static final String DATA_DIR = "exo.data.dir";
+
+ /** . */
private static final ConcurrentMap<String, String> cache = new ConcurrentHashMap<String, String>();
/** This is read only once at startup. */
@@ -59,8 +67,12 @@
*/
public static String getProperty(String propertyName)
{
- if (useCache)
+ if (DATA_DIR.endsWith(propertyName))
{
+ return Environment.getInstance().getPlatform().getProfile();
+ }
+ else if (useCache)
+ {
if (DEVELOPING.equals(propertyName))
{
return developping ? "true" : "false";
Added: kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.commons.utils;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Tools
+{
+
+ /**
+ * Instantiates a {@link HashSet} object and fills it with the provided element array.
+ *
+ * @param elements the list of elements to add
+ * @param <E> the element type
+ * @return the set of elements
+ * @throws NullPointerException if the element array is null
+ */
+ public static <E> Set<E> set(E... elements) throws NullPointerException
+ {
+ if (elements == null)
+ {
+ throw new NullPointerException("No null element array accepted");
+ }
+ HashSet<E> set = new HashSet<E>();
+ if (elements.length > 0)
+ {
+ for (E element : elements)
+ {
+ set.add(element);
+ }
+ }
+ return set;
+ }
+
+}
Added: kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestEnvironment.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestEnvironment.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestEnvironment.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.commons.utils;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.exoplatform.commons.Environment;
+import org.exoplatform.commons.Platform;
+
+import java.lang.reflect.Field;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestEnvironment extends TestCase
+{
+
+ private void forceEnvReset()
+ {
+ try
+ {
+ Field field = Environment.class.getDeclaredField("singleton_");
+ field.setAccessible(true);
+ field.set(null, null);
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
+ }
+
+ System.clearProperty("jboss.home.dir");
+ System.clearProperty("jboss.server.data.dir");
+ System.clearProperty("catalina.home");
+ }
+
+ public void testJBoss()
+ {
+ forceEnvReset();
+ System.setProperty("jboss.home.dir", "jboss_home");
+ System.setProperty("jboss.server.data.dir", "jboss_server_data");
+ Environment env = Environment.getInstance();
+ Platform platform = env.getPlatform();
+ assertEquals(Platform.JBOSS_PLATFORM, platform);
+ assertEquals(Environment.JBOSS_PROFILE, platform.getProfile());
+ assertEquals("jboss_server_data", platform.getDataDir());
+ }
+
+ public void testTomcat()
+ {
+ forceEnvReset();
+ System.setProperty("catalina.home", "catalina_home");
+ Environment env = Environment.getInstance();
+ Platform platform = env.getPlatform();
+ assertEquals(Platform.TOMCAT_PLATFORM, platform);
+ assertEquals(Environment.TOMCAT_PROFILE, platform.getProfile());
+ }
+}
Added: kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.commons.utils;
+
+import junit.framework.TestCase;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestTools extends TestCase
+{
+
+ public void testEmtySet()
+ {
+ Set<String> strings = Tools.set();
+ assertTrue(strings instanceof HashSet);
+ assertTrue(strings.isEmpty());
+ }
+
+ public void testSingletonSet1()
+ {
+ Set<String> strings = Tools.set("a");
+ assertTrue(strings instanceof HashSet);
+ assertEquals(1, strings.size());
+ assertTrue(strings.contains("a"));
+ }
+
+ public void testSingletonSet2()
+ {
+ Set<String> strings = Tools.set("a", "a");
+ assertTrue(strings instanceof HashSet);
+ assertEquals(1, strings.size());
+ assertTrue(strings.contains("a"));
+ }
+
+ public void testTwoElementsInSet()
+ {
+ Set<String> strings = Tools.set("a", "b");
+ assertTrue(strings instanceof HashSet);
+ assertEquals(2, strings.size());
+ assertTrue(strings.contains("a"));
+ assertTrue(strings.contains("b"));
+ }
+
+ public void testSetThrowsNPE()
+ {
+ try
+ {
+ Tools.set((String[])null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ }
+}
Deleted: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/Environnment.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/Environnment.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/Environnment.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2009 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.container;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class Environnment
-{
- static boolean isJBoss()
- {
- return System.getProperty("jboss.server.name") != null;
- }
-}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.component.ComponentLifecyclePlugin;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.jmx.ManageableContainer;
@@ -31,9 +32,12 @@
import java.lang.reflect.Constructor;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* Created by The eXo Platform SAS Author : Tuan Nguyen
@@ -42,6 +46,32 @@
public class ExoContainer extends ManageableContainer
{
+ /**
+ * Returns an unmodifable set of profiles defined by the value returned by invoking
+ * {@link PropertyManager#getProperty(String)} with the {@link org.exoplatform.commons.utils.PropertyManager#RUNTIME_PROFILES}
+ * property.
+ *
+ * @return the set of profiles
+ */
+ public static Set<String> getProfiles()
+ {
+ //
+ Set<String> profiles = new HashSet<String>();
+
+ // Obtain profile list by runtime properties
+ String profileList = PropertyManager.getProperty(PropertyManager.RUNTIME_PROFILES);
+ if (profileList != null)
+ {
+ for (String profile : profileList.split(","))
+ {
+ profiles.add(profile.trim());
+ }
+ }
+
+ //
+ return Collections.unmodifiableSet(profiles);
+ }
+
Log log = ExoLogger.getLogger(ExoContainer.class);
private Map<String, ComponentLifecyclePlugin> componentLifecylePlugin_ =
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container;
+import org.exoplatform.commons.Environment;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.configuration.ConfigurationManagerImpl;
import org.exoplatform.container.configuration.MockConfigurationManagerImpl;
@@ -40,6 +41,7 @@
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.Set;
@@ -84,6 +86,8 @@
private final J2EEServerInfo serverenv_ = new J2EEServerInfo();
+ private final Set<String> profiles;
+
/**
* The list of all the tasks to execute while initializing the corresponding portal containers
*/
@@ -98,7 +102,26 @@
public RootContainer()
{
super(new ManagementContextImpl(findMBeanServer(), new HashMap<String, String>()));
+
+ //
+ Set<String> profiles = new HashSet<String>();
+
+ // Add the profile defined by the server
+ String envProfile = Environment.getInstance().getPlatform().getProfile();
+ if (envProfile != null)
+ {
+ profiles.add(envProfile);
+ }
+
+ // Obtain profile list by runtime properties
+ profiles.addAll(ExoContainer.getProfiles());
+
+ // Lof the active profiles
+ log.info("Active profiles " + profiles);
+
+ //
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
+ this.profiles= profiles;
this.registerComponentInstance(J2EEServerInfo.class, serverenv_);
}
@@ -259,7 +282,7 @@
// Set the full classloader of the portal container
Thread.currentThread().setContextClassLoader(pcontainer.getPortalClassLoader());
hasChanged = true;
- ConfigurationManagerImpl cService = new ConfigurationManagerImpl(pcontainer.getPortalContext());
+ ConfigurationManagerImpl cService = new ConfigurationManagerImpl(pcontainer.getPortalContext(), profiles);
// add configs from services
try
@@ -273,7 +296,7 @@
// Add configuration that depends on the environment
String uri;
- if (Environnment.isJBoss())
+ if (Environment.isJBoss())
{
uri = "conf/portal/jboss-configuration.xml";
}
@@ -379,7 +402,7 @@
try
{
RootContainer rootContainer = new RootContainer();
- ConfigurationManagerImpl service = new ConfigurationManagerImpl();
+ ConfigurationManagerImpl service = new ConfigurationManagerImpl(rootContainer.profiles);
service.addConfiguration(ContainerUtil.getConfigurationURL("conf/configuration.xml"));
if (System.getProperty("maven.exoplatform.dir") != null)
{
@@ -638,7 +661,7 @@
* Executes the task
*
* @param context the servlet context of the web application
- * @param container The portal container on which we would like to execute the task
+ * @param portalContainer The portal container on which we would like to execute the task
*/
public void execute(ServletContext context, PortalContainer portalContainer);
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.configuration.ConfigurationException;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.configuration.ConfigurationManagerImpl;
@@ -28,7 +29,9 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* Created by The eXo Platform SAS .
@@ -71,7 +74,9 @@
private StandaloneContainer(ClassLoader configClassLoader)
{
super(new MX4JComponentAdapterFactory(), null);
- configurationManager = new ConfigurationManagerImpl(configClassLoader);
+
+ //
+ configurationManager = new ConfigurationManagerImpl(configClassLoader, ExoContainer.getProfiles());
this.registerComponentInstance(ConfigurationManager.class, configurationManager);
registerComponentImplementation(SessionManagerImpl.class);
}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -34,6 +34,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import javax.servlet.ServletContext;
@@ -67,6 +68,9 @@
private boolean validateSchema = true;
+ /** . */
+ private final Set<String> profiles;
+
/** The URL of the current document being unmarshalled. */
private static final ThreadLocal<URL> currentURL = new ThreadLocal<URL>();
@@ -79,18 +83,21 @@
return currentURL.get();
}
- public ConfigurationManagerImpl()
+ public ConfigurationManagerImpl(Set<String> profiles)
{
+ this.profiles = profiles;
}
- public ConfigurationManagerImpl(ServletContext context)
+ public ConfigurationManagerImpl(ServletContext context, Set<String> profiles)
{
scontext_ = context;
+ this.profiles = profiles;
}
- public ConfigurationManagerImpl(ClassLoader loader)
+ public ConfigurationManagerImpl(ClassLoader loader, Set<String> profiles)
{
scontextClassLoader_ = loader;
+ this.profiles = profiles;
}
public Configuration getConfiguration()
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container.configuration;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.Configuration;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -33,6 +34,9 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.parsers.SAXParser;
@@ -105,6 +109,19 @@
}
}
+ /** . */
+ private final Set<String> profiles;
+
+ public ConfigurationUnmarshaller(Set<String> profiles)
+ {
+ this.profiles = profiles;
+ }
+
+ public ConfigurationUnmarshaller()
+ {
+ this.profiles = Collections.emptySet();
+ }
+
/**
* Returns true if the configuration file is valid according to its schema declaration. If the file
* does not have any schema declaration, the file will be reported as valid.
@@ -180,7 +197,9 @@
InputSource source = new InputSource(url.openStream());
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser saxParser = spf.newSAXParser();
- saxParser.parse(source, new NoKernelNamespaceSAXFilter(hd));
+ saxParser.getXMLReader().setFeature("http://xml.org/sax/features/namespaces", true);
+ saxParser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ saxParser.parse(source, new NoKernelNamespaceSAXFilter(profiles, hd));
// Reuse the parsed document
String document = buffer.toString();
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.container.configuration;
+import org.exoplatform.container.ExoContainer;
+
import java.net.URL;
import javax.servlet.ServletContext;
@@ -36,7 +38,7 @@
public MockConfigurationManagerImpl(ServletContext context) throws Exception
{
- super(context);
+ super(context, ExoContainer.getProfiles());
confDir_ = System.getProperty("mock.portal.dir") + "/WEB-INF";
}
Modified: kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.container.configuration;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
@@ -25,8 +27,12 @@
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.DefaultHandler;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* Removes kernel namespace declaration from the document to not confuse the jibx thing.
+ * It also filters the active profiles from the XML stream.
*
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -34,11 +40,28 @@
class NoKernelNamespaceSAXFilter extends DefaultHandler
{
+ /** . */
+ private static final Log log = ExoLogger.getExoLogger(NoKernelNamespaceSAXFilter.class);
+
+ /** . */
+ private static final String KERNEL_URI = "http://www.exoplaform.org/xml/ns/kernel_1_0.xsd";
+
+ /** . */
+ private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
+
+ /** . */
+ private final Set<String> activeProfiles;
+
+ /** . */
private ContentHandler contentHandler;
- NoKernelNamespaceSAXFilter(ContentHandler contentHandler)
+ /** . */
+ private final Set<String> blackListedPrefixes = new HashSet<String>();
+
+ NoKernelNamespaceSAXFilter(Set<String> activeProfiles, ContentHandler contentHandler)
{
this.contentHandler = contentHandler;
+ this.activeProfiles = activeProfiles;
}
public void setDocumentLocator(Locator locator)
@@ -58,47 +81,176 @@
public void startPrefixMapping(String prefix, String uri) throws SAXException
{
- contentHandler.startPrefixMapping(prefix, uri);
+ if (depth == 0)
+ {
+ if (KERNEL_URI.equals(uri) || XSI_URI.equals(uri))
+ {
+ blackListedPrefixes.add(prefix);
+ log.debug("Black listing prefix " + prefix + " with uri " + uri);
+ }
+ else
+ {
+ contentHandler.startPrefixMapping(prefix, uri);
+ log.debug("Start prefix mapping " + prefix + " with uri " + uri);
+ }
+ }
}
public void endPrefixMapping(String prefix) throws SAXException
{
- contentHandler.endPrefixMapping(prefix);
+ if (depth == 0)
+ {
+ if (!blackListedPrefixes.remove(prefix))
+ {
+ log.debug("Ending prefix mapping " + prefix);
+ contentHandler.endPrefixMapping(prefix);
+ }
+ else
+ {
+ log.debug("Removed prefix mapping " + prefix + " from black list ");
+ }
+ }
}
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
{
- if (qName.equals("configuration"))
+ if (depth == 0)
{
- atts = new AttributesImpl();
+ AttributesImpl noNSAtts = new AttributesImpl();
+ for (int i = 0;i < atts.getLength();i++)
+ {
+ String attQName = atts.getQName(i);
+ if ((attQName.equals("xmlns")) && blackListedPrefixes.contains(""))
+ {
+ // Skip
+ log.debug("Skipping black listed xmlns attribute");
+ }
+ else if (attQName.startsWith("xmlns:") && blackListedPrefixes.contains(attQName.substring(6)))
+ {
+ // Skip
+ log.debug("Skipping black listed " + attQName + " attribute");
+ }
+ else
+ {
+ String attURI = atts.getURI(i);
+ String attLocalName = atts.getLocalName(i);
+ String attType = atts.getType(i);
+ String attValue = atts.getValue(i);
+
+ //
+ if (XSI_URI.equals(attURI))
+ {
+ // Skip
+ log.debug("Skipping XSI " + attQName + " attribute");
+ continue;
+ }
+
+ //
+ noNSAtts.addAttribute(attURI, attLocalName, attQName, attType, attValue);
+ }
+ }
+
+ //
+ if (KERNEL_URI.equals(uri))
+ {
+ if (!localName.equals(qName))
+ {
+ String prefix = qName.substring(0, qName.indexOf(':'));
+ if (activeProfiles.contains(prefix))
+ {
+ log.debug("Requalifying active profile " + qName + " start element to " + localName);
+ qName = localName;
+ uri = null;
+ }
+ else
+ {
+ log.debug("Inhibitting element passive profile " + qName + " start element");
+ depth++;
+ }
+ }
+ else
+ {
+ // Need to clear the URI
+ uri = null;
+ }
+ }
+
+ //
+ if (depth == 0)
+ {
+ log.debug("Propagatting " + qName + " start element");
+ contentHandler.startElement(uri, localName, qName, noNSAtts);
+ }
}
+ else
+ {
+ log.debug("Skipping " + qName + " start element");
+ depth++;
+ }
- //
- contentHandler.startElement(uri, localName, qName, atts);
}
+ private int depth;
+
public void endElement(String uri, String localName, String qName) throws SAXException
{
- contentHandler.endElement(uri, localName, qName);
+ if (depth == 0)
+ {
+ if (KERNEL_URI.endsWith(uri))
+ {
+ log.debug("Requalifying " + qName + " end element");
+ qName = localName;
+ uri = null;
+ }
+
+ //
+ log.debug("Propagatting " + qName + " end element");
+ contentHandler.endElement(uri, localName, qName);
+ }
+ else
+ {
+ log.debug("Skipping " + qName + " end element");
+ depth--;
+ }
}
public void characters(char[] ch, int start, int length) throws SAXException
{
- contentHandler.characters(ch, start, length);
+ if (depth == 0)
+ {
+ contentHandler.characters(ch, start, length);
+ }
+ else
+ {
+ log.debug("Skipping " + new String(ch, start, length) + " end element");
+ }
}
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
{
- contentHandler.ignorableWhitespace(ch, start, length);
+ if (depth == 0)
+ {
+ contentHandler.ignorableWhitespace(ch, start, length);
+ }
+ else
+ {
+ log.debug("Skipping " + new String(ch, start, length) + " white space");
+ }
}
public void processingInstruction(String target, String data) throws SAXException
{
- contentHandler.processingInstruction(target, data);
+ if (depth == 0)
+ {
+ contentHandler.processingInstruction(target, data);
+ }
}
public void skippedEntity(String name) throws SAXException
{
- contentHandler.skippedEntity(name);
+ if (depth == 0)
+ {
+ contentHandler.skippedEntity(name);
+ }
}
}
Added: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentPluginProfile.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentPluginProfile.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentPluginProfile.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration.test;
+
+import junit.framework.TestCase;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.container.configuration.ConfigurationUnmarshaller;
+import org.exoplatform.container.xml.Component;
+import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestComponentPluginProfile extends TestCase
+{
+
+/*
+ public void testNoProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller();
+ URL url = f.toURI().toURL();
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "");
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("empty", valueParam.getValue());
+ }
+*/
+
+ public void testFooProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/component-plugin-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ System.out.println("component.getComponentPlugins() = " + component.getComponentPlugins());
+/*
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("foo", valueParam.getValue());
+*/
+ }
+
+/*
+ public void testFooBarProfiles() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller();
+ URL url = f.toURI().toURL();
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "foo,bar");
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("bar", valueParam.getValue());
+ }
+*/
+}
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentProfile.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentProfile.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestComponentProfile.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration.test;
+
+import junit.framework.TestCase;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.container.configuration.ConfigurationUnmarshaller;
+import org.exoplatform.container.xml.Configuration;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestComponentProfile extends TestCase
+{
+
+ public void testNoProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.<String>set());
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(0, config.getComponents().size());
+ }
+
+ public void testFooProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(1, config.getComponents().size());
+ }
+
+ public void testFooBarProfiles() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo", "bar"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(1, config.getComponents().size());
+ }
+}
Added: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestImportProfile.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestImportProfile.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestImportProfile.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration.test;
+
+import junit.framework.TestCase;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.container.configuration.ConfigurationUnmarshaller;
+import org.exoplatform.container.xml.Configuration;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestImportProfile extends TestCase
+{
+
+ public void testNoProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.<String>set());
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(1, config.getImports().size());
+ }
+
+ public void testFooProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(2, config.getImports().size());
+ }
+
+ public void testFooBarProfiles() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo", "bar"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ assertEquals(3, config.getImports().size());
+ }
+}
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestInitParamProfile.java
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestInitParamProfile.java (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/test/TestInitParamProfile.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.container.configuration.test;
+
+import junit.framework.TestCase;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.container.configuration.ConfigurationUnmarshaller;
+import org.exoplatform.container.xml.Component;
+import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestInitParamProfile extends TestCase
+{
+
+ public void testNoProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.<String>set());
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("empty", valueParam.getValue());
+ }
+
+ public void testFooProfile() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("foo", valueParam.getValue());
+ }
+
+ public void testFooBarProfiles() throws Exception
+ {
+ String basedir = System.getProperty("basedir");
+ File f = new File(basedir + "/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml");
+ ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller(Tools.set("foo", "bar"));
+ URL url = f.toURI().toURL();
+ Configuration config = unmarshaller.unmarshall(url);
+ Component component = config.getComponent("Component");
+ InitParams initParams = component.getInitParams();
+ ValueParam valueParam = initParams.getValueParam("param");
+ assertEquals("bar", valueParam.getValue());
+ }
+}
\ No newline at end of file
Modified: kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestContainer.java
===================================================================
--- kernel/tags/2.2.0-Beta03/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestContainer.java 2009-11-18 16:40:15 UTC (rev 760)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestContainer.java 2009-12-11 13:04:44 UTC (rev 1005)
@@ -25,6 +25,7 @@
import org.exoplatform.container.configuration.ConfigurationManagerImpl;
import java.net.URL;
+import java.util.HashSet;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -38,7 +39,7 @@
try
{
RootContainer container = new RootContainer();
- ConfigurationManager manager = new ConfigurationManagerImpl();
+ ConfigurationManager manager = new ConfigurationManagerImpl(new HashSet<String>());
URL url = AbstractTestContainer.class.getResource(relativeConfigurationFile);
assertNotNull(url);
manager.addConfiguration(url);
Added: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-configuration.xml 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <bar:component>
+ <key>Component</key>
+ <type>ComponentImpl</type>
+ </bar:component>
+
+ <foo:component>
+ <key>Component</key>
+ <type>FooComponent</type>
+ </foo:component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-plugin-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-plugin-configuration.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/component-plugin-configuration.xml 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Component</key>
+ <type>ComponentImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>Plugin</name>
+ <set-method>set_method</set-method>
+ <type>PluginA</type>
+ </component-plugin>
+ <foo:component-plugin>
+ <name>Plugin</name>
+ <set-method>set_method</set-method>
+ <type>PluginA</type>
+ </foo:component-plugin>
+ </component-plugins>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/import-configuration.xml 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <import>empty</import>
+ <foo:import>foo</foo:import>
+ <bar:import>bar</bar:import>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml
===================================================================
--- kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml (rev 0)
+++ kernel/branches/config-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/init-param-configuration.xml 2009-12-11 13:04:44 UTC (rev 1005)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:foo="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns:bar="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Component</key>
+ <type>ComponentImpl</type>
+ <init-params>
+ <value-param>
+ <name>param</name>
+ <value>empty</value>
+ </value-param>
+ <foo:value-param>
+ <name>param</name>
+ <value>foo</value>
+ </foo:value-param>
+ <bar:value-param>
+ <name>param</name>
+ <value>bar</value>
+ </bar:value-param>
+ </init-params>
+ </component>
+
+</configuration>
\ No newline at end of file
16 years, 7 months