exo-jcr SVN: r1938 - in kernel/trunk/exo.kernel.container/src: test/java/org/exoplatform/container/configuration and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-02-22 12:04:15 -0500 (Mon, 22 Feb 2010)
New Revision: 1938
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
Log:
EXOJCR-534: resolve invalid url of type file:, file:/ or file://
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2010-02-22 16:22:32 UTC (rev 1937)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2010-02-22 17:04:15 UTC (rev 1938)
@@ -317,8 +317,8 @@
}
else if (url.startsWith("file:"))
{
- url = Deserializer.resolveVariables(url);
- return new URL(url.replace('\\', '/'));
+ url = resolveFileURL(url);
+ return new URL(url);
}
else if (url.indexOf(":") < 0 && contextPath != null)
{
@@ -327,6 +327,48 @@
return null;
}
+ /**
+ * This methods is used to convert the given into a valid url, it will:
+ * <ol>
+ * <li>Resolve variables in the path if they exist</li>
+ * <li>Replace windows path separators with proper separators</li>
+ * <li>Ensure that the path start with file:///</li>
+ * </ol>
+ * , then it will
+ * @param url the url to resolve
+ * @return the resolved url
+ */
+ private String resolveFileURL(String url)
+ {
+ url = Deserializer.resolveVariables(url);
+ // we ensure that we don't have windows path separator in the url
+ url = url.replace('\\', '/');
+ if (!url.startsWith("file:///"))
+ {
+ // The url is invalid, so we will fix it
+ // it happens when we use a path of type file://${path}, under
+ // linux or mac os the path will start with a '/' so the url
+ // will be correct but under windows we will have something
+ // like C:\ so the first '/' is missing
+ if (url.startsWith("file://"))
+ {
+ // The url is of type file://, so one '/' is missing
+ url = "file:///" + url.substring(7);
+ }
+ else if (url.startsWith("file:/"))
+ {
+ // The url is of type file:/, so two '/' are missing
+ url = "file:///" + url.substring(6);
+ }
+ else
+ {
+ // The url is of type file:, so three '/' are missing
+ url = "file:///" + url.substring(5);
+ }
+ }
+ return url;
+ }
+
public boolean isDefault(String value)
{
return value == null || value.length() == 0 || "default".equals(value);
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java 2010-02-22 16:22:32 UTC (rev 1937)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java 2010-02-22 17:04:15 UTC (rev 1938)
@@ -84,6 +84,18 @@
checkURL(url);
url = cm.getURL(sURL + "\\configuration\\empty-config-fake.xml");
checkURL(url, true);
+ String incompleteURL = "file:/" + getClass().getResource("empty-config.xml").getPath();
+ incompleteURL = incompleteURL.substring(0, incompleteURL.lastIndexOf('/'));
+ url = cm.getURL(incompleteURL + "/empty-config.xml");
+ checkURL(url);
+ url = cm.getURL(incompleteURL + "/empty-config-fake.xml");
+ checkURL(url, true);
+ incompleteURL = "file:" + getClass().getResource("empty-config.xml").getPath();
+ incompleteURL = incompleteURL.substring(0, incompleteURL.lastIndexOf('/'));
+ url = cm.getURL(incompleteURL + "/empty-config.xml");
+ checkURL(url);
+ url = cm.getURL(incompleteURL + "/empty-config-fake.xml");
+ checkURL(url, true);
url = cm.getURL("org/exoplatform/container/configuration/empty-config.xml");
assertNull(url);
url = cm.getURL("org/exoplatform/container/configuration/empty-config-fake.xml");
14 years, 3 months
exo-jcr SVN: r1937 - jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-02-22 11:22:32 -0500 (Mon, 22 Feb 2010)
New Revision: 1937
Modified:
jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-532 ArjunaTransactionService renamed to JBossTransactionsService
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-02-22 16:21:59 UTC (rev 1936)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-02-22 16:22:32 UTC (rev 1937)
@@ -138,7 +138,7 @@
<component>
<key>org.exoplatform.services.transaction.TransactionService</key>
- <type>org.exoplatform.services.transaction.jbosscache.ArjunaTransactionService</type>
+ <type>org.exoplatform.services.transaction.jbosscache.JBossTransactionsService</type>
<init-params>
<value-param>
<name>timeout</name>
14 years, 3 months
exo-jcr SVN: r1936 - in jcr/trunk/exo.jcr.component.core/src: test/resources/conf/standalone and 1 other directories.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-02-22 11:21:59 -0500 (Mon, 22 Feb 2010)
New Revision: 1936
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/JBossTransactionsService.java
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/ArjunaTransactionService.java
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-532 ArjunaTransactionService renamed to JBossTransactionsService
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/ArjunaTransactionService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/ArjunaTransactionService.java 2010-02-22 14:52:26 UTC (rev 1935)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/ArjunaTransactionService.java 2010-02-22 16:21:59 UTC (rev 1936)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.transaction.jbosscache;
-
-import com.arjuna.ats.jta.xa.XidImple;
-
-import org.exoplatform.container.xml.InitParams;
-import org.jboss.cache.transaction.TransactionManagerLookup;
-
-import javax.transaction.UserTransaction;
-import javax.transaction.xa.Xid;
-
-/**
- * Add the specific part for Arjuna
- *
- * @author <a href="mailto:nicolas.filotto@exoplatform.com">Nicolas Filotto</a>
- * @version $Id$
- *
- */
-public class ArjunaTransactionService extends GenericTransactionService
-{
-
- public ArjunaTransactionService(TransactionManagerLookup tmLookup)
- {
- super(tmLookup);
- }
-
- public ArjunaTransactionService(TransactionManagerLookup tmLookup, InitParams params)
- {
- super(tmLookup, params);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Xid createXid()
- {
- return new XidImple();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public UserTransaction getUserTransaction()
- {
- return com.arjuna.ats.jta.UserTransaction.userTransaction();
- }
-}
Copied: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/JBossTransactionsService.java (from rev 1935, jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/ArjunaTransactionService.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/JBossTransactionsService.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/transaction/jbosscache/JBossTransactionsService.java 2010-02-22 16:21:59 UTC (rev 1936)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.transaction.jbosscache;
+
+import com.arjuna.ats.jta.xa.XidImple;
+
+import org.exoplatform.container.xml.InitParams;
+import org.jboss.cache.transaction.TransactionManagerLookup;
+
+import javax.transaction.UserTransaction;
+import javax.transaction.xa.Xid;
+
+/**
+ * Add the specific part for Arjuna
+ *
+ * @author <a href="mailto:nicolas.filotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class JBossTransactionsService extends GenericTransactionService
+{
+
+ public JBossTransactionsService(TransactionManagerLookup tmLookup)
+ {
+ super(tmLookup);
+ }
+
+ public JBossTransactionsService(TransactionManagerLookup tmLookup, InitParams params)
+ {
+ super(tmLookup, params);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Xid createXid()
+ {
+ return new XidImple();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public UserTransaction getUserTransaction()
+ {
+ return com.arjuna.ats.jta.UserTransaction.userTransaction();
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-02-22 14:52:26 UTC (rev 1935)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-02-22 16:21:59 UTC (rev 1936)
@@ -201,7 +201,7 @@
<component>
<key>org.exoplatform.services.transaction.TransactionService</key>
- <type>org.exoplatform.services.transaction.jbosscache.ArjunaTransactionService</type>
+ <type>org.exoplatform.services.transaction.jbosscache.JBossTransactionsService</type>
<init-params>
<value-param>
<name>timeout</name>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-02-22 14:52:26 UTC (rev 1935)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-02-22 16:21:59 UTC (rev 1936)
@@ -202,7 +202,7 @@
<component>
<key>org.exoplatform.services.transaction.TransactionService</key>
- <type>org.exoplatform.services.transaction.jbosscache.ArjunaTransactionService</type>
+ <type>org.exoplatform.services.transaction.jbosscache.JBossTransactionsService</type>
<init-params>
<value-param>
<name>timeout</name>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-02-22 14:52:26 UTC (rev 1935)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-02-22 16:21:59 UTC (rev 1936)
@@ -202,7 +202,7 @@
<component>
<key>org.exoplatform.services.transaction.TransactionService</key>
- <type>org.exoplatform.services.transaction.jbosscache.ArjunaTransactionService</type>
+ <type>org.exoplatform.services.transaction.jbosscache.JBossTransactionsService</type>
<init-params>
<value-param>
<name>timeout</name>
14 years, 3 months
exo-jcr SVN: r1935 - in kernel/trunk/exo.kernel.container/src: test/java/org/exoplatform/container/configuration and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-02-22 09:52:26 -0500 (Mon, 22 Feb 2010)
New Revision: 1935
Added:
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/empty-config.xml
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
Log:
EXOJCR-534: character of type "\" are now replaced with "/" in the url
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2010-02-22 13:26:46 UTC (rev 1934)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java 2010-02-22 14:52:26 UTC (rev 1935)
@@ -246,7 +246,9 @@
public URL getResource(String url, String defaultURL) throws Exception
{
- return null;
+ if (url == null)
+ url = defaultURL;
+ return getResource(url);
}
public URL getResource(String uri) throws Exception
@@ -279,8 +281,12 @@
private URL getURL(ServletContext context, String url) throws Exception
{
- if (url.startsWith("jar:"))
+ if (url == null)
{
+ return null;
+ }
+ else if (url.startsWith("jar:"))
+ {
String path = removePrefix("jar:/", url);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return cl.getResource(path);
@@ -300,6 +306,11 @@
}
if (scontextClassLoader_ != null)
{
+ if (path.startsWith("/"))
+ {
+ // The ClassLoader doesn't support the first "/"
+ path = path.substring(1);
+ }
return scontextClassLoader_.getResource(path);
}
throw new Exception("unsupport war uri in this configuration service");
@@ -307,11 +318,11 @@
else if (url.startsWith("file:"))
{
url = Deserializer.resolveVariables(url);
- return new URL(url);
+ return new URL(url.replace('\\', '/'));
}
else if (url.indexOf(":") < 0 && contextPath != null)
{
- return new URL(contextPath + url);
+ return new URL(contextPath + url.replace('\\', '/'));
}
return null;
}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestConfigurationManagerImpl.java 2010-02-22 14:52:26 UTC (rev 1935)
@@ -0,0 +1,394 @@
+/*
+ * Copyright (C) 2003-2010 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 junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto
+ * nicolas.filotto(a)exoplatform.com
+ * 22 f�vr. 2010
+ */
+public class TestConfigurationManagerImpl extends TestCase
+{
+ public void testGetURL() throws Exception
+ {
+ // Empty CM
+ ConfigurationManager cm = new ConfigurationManagerImpl();
+ URL url = cm.getURL(null);
+ assertNull(url);
+ url = cm.getURL("jar:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm.getURL("jar:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm.getURL("classpath:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm.getURL("classpath:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ try
+ {
+ url = cm.getURL("war:/org/exoplatform/container/configuration/empty-config.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ try
+ {
+ url = cm.getURL("war:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ String sURL = getClass().getResource("empty-config.xml").toString();
+ assertNotNull(sURL);
+ assertTrue("the expected path should starts with file:", sURL.startsWith("file:"));
+ sURL = sURL.substring(0, sURL.lastIndexOf('/'));
+ sURL = sURL.substring(0, sURL.lastIndexOf('/'));
+ url = cm.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm.getURL(sURL + "\\configuration\\empty-config.xml");
+ checkURL(url);
+ url = cm.getURL(sURL + "\\configuration\\empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm.getURL("org/exoplatform/container/configuration/empty-config.xml");
+ assertNull(url);
+ url = cm.getURL("org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+
+ // CM with ClassLoader
+ ConfigurationManager cm1 = new ConfigurationManagerImpl(Thread.currentThread().getContextClassLoader(), null);
+ url = cm1.getURL(null);
+ assertNull(url);
+ url = cm1.getURL("jar:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm1.getURL("jar:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm1.getURL("classpath:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm1.getURL("classpath:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm1.getURL("war:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm1.getURL("war:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm1.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm1.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm1.getURL("org/exoplatform/container/configuration/empty-config.xml");
+ assertNull(url);
+ url = cm1.getURL("org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+
+ // CM with ServletContext
+ ConfigurationManager cm2 = new ConfigurationManagerImpl(new MockServletContext(), null);
+ url = cm2.getURL(null);
+ assertNull(url);
+ url = cm2.getURL("jar:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm2.getURL("jar:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm2.getURL("classpath:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm2.getURL("classpath:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm2.getURL("war:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm2.getURL("war:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm2.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm2.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm2.getURL("org/exoplatform/container/configuration/empty-config.xml");
+ assertNull(url);
+ url = cm2.getURL("org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+
+ // CM with Context path
+ ConfigurationManager cm3 = new ConfigurationManagerImpl();
+ String path = getClass().getResource("empty-config.xml").getPath();
+ assertNotNull(path);
+ path = path.substring(0, path.lastIndexOf('/'));
+ cm3.addConfiguration((new File(path)).toURI().toURL());
+ url = cm3.getURL(null);
+ assertNull(url);
+ url = cm3.getURL("jar:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm3.getURL("jar:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ url = cm3.getURL("classpath:/org/exoplatform/container/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm3.getURL("classpath:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ assertNull(url);
+ try
+ {
+ url = cm3.getURL("war:/org/exoplatform/container/configuration/empty-config.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ try
+ {
+ url = cm3.getURL("war:/org/exoplatform/container/configuration/empty-config-fake.xml");
+ fail("An error should be thrown");
+ }
+ catch (Exception e)
+ {
+ // ok;
+ }
+ url = cm3.getURL(sURL + "/configuration/empty-config.xml");
+ checkURL(url);
+ url = cm3.getURL(sURL + "/configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm3.getURL("configuration/empty-config.xml");
+ checkURL(url);
+ url = cm3.getURL("configuration/empty-config-fake.xml");
+ checkURL(url, true);
+ url = cm3.getURL("configuration\\empty-config.xml");
+ checkURL(url);
+ url = cm3.getURL("configuration\\empty-config-fake.xml");
+ checkURL(url, true);
+ }
+
+ private void checkURL(URL url) throws Exception
+ {
+ checkURL(url, false);
+ }
+
+ private void checkURL(URL url, boolean empty) throws Exception
+ {
+ assertNotNull(url);
+ InputStream is = null;
+ try
+ {
+ is = url.openStream();
+ if (empty)
+ {
+ assertNull(is);
+ }
+ else
+ {
+ assertNotNull(is);
+ assertTrue(is.available() > 0);
+ }
+ }
+ catch (IOException e)
+ {
+ if (empty)
+ {
+ // OK
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
+ }
+ }
+ }
+
+ private static class MockServletContext implements ServletContext
+ {
+
+ public Object getAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ServletContext getContext(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getContextPath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getInitParameter(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMajorVersion()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getMimeType(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMinorVersion()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getRealPath(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public URL getResource(String arg0) throws MalformedURLException
+ {
+ // We remove "/WEB-INF/
+ String path = arg0.substring(ConfigurationManagerImpl.WAR_CONF_LOCATION.length() + 1);
+ return Thread.currentThread().getContextClassLoader().getResource(path);
+ }
+
+ public InputStream getResourceAsStream(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getResourcePaths(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getServerInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getServletContextName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getServletNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Enumeration getServlets()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void log(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void log(Exception arg0, String arg1)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void log(String arg0, Throwable arg1)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+}
Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/empty-config.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/empty-config.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/configuration/empty-config.xml 2010-02-22 14:52:26 UTC (rev 1935)
@@ -0,0 +1,27 @@
+<?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_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+</configuration>
\ No newline at end of file
14 years, 3 months
exo-jcr SVN: r1934 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/i18n.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-02-22 08:26:46 -0500 (Mon, 22 Feb 2010)
New Revision: 1934
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/i18n/TestI18nValues.java
Log:
EXOJCR-530: add testLongItem
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/i18n/TestI18nValues.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/i18n/TestI18nValues.java 2010-02-22 10:12:55 UTC (rev 1933)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/i18n/TestI18nValues.java 2010-02-22 13:26:46 UTC (rev 1934)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
import javax.jcr.Node;
import javax.jcr.Property;
@@ -126,6 +127,36 @@
}
}
+ public void setLongItem(String item, String source) throws RepositoryException
+ {
+
+ if (log.isDebugEnabled())
+ log.debug("String as string value: '" + source + "'");
+
+ try
+ {
+ testNode.setProperty(item, source);
+ testNode.save();
+ }
+ catch (RepositoryException e)
+ {
+ fail("Error create proeprty '" + item + "': " + e);
+ }
+
+ Session session1 = repository.login(credentials, WORKSPACE);
+ Node test = session1.getRootNode().getNode(TEST_I18N);
+
+ try
+ {
+ Property prop = test.getProperty(item);
+ assertEquals("Content must be identical", prop.getString(), source);
+ }
+ catch (RepositoryException e)
+ {
+ fail("Error read property '" + item + "': " + e);
+ }
+ }
+
/**
* Tests property values with I18n content stored in BINARY values using
* Node.setProperty(String, String, int) method
@@ -451,4 +482,11 @@
s1.logout();
}
+ public void testLongItem() throws RepositoryException
+ {
+ char item[] = new char[500];
+ Arrays.fill(item, '0');
+
+ setLongItem(new String(item), TEST_I18N_CONTENT_CYR);
+ }
}
14 years, 3 months
exo-jcr SVN: r1933 - in jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav: command and 1 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-02-22 05:12:55 -0500 (Mon, 22 Feb 2010)
New Revision: 1933
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedCollectionResource.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedFileResource.java
Log:
EXOJCR-533 WebDAV GET and FileResource improvements (less JCR consumption)
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -100,7 +100,7 @@
* Created by The eXo Platform SARL .<br/>
*
* @author Gennady Azarenkov
- * @version $Id: $
+ * @version $Id$
*/
@Path("/jcr")
@@ -490,6 +490,9 @@
@HeaderParam(ExtHttpHeaders.IF_MODIFIED_SINCE) String ifModifiedSince, @QueryParam("version") String version,
@Context UriInfo uriInfo)
{
+ // TODO EXOJCR-533
+ // long startGet = System.currentTimeMillis();
+ // try {
if (log.isDebugEnabled())
{
@@ -506,7 +509,6 @@
if (rangeHeader != null)
{
-
if (log.isDebugEnabled())
{
log.debug(rangeHeader);
@@ -560,6 +562,11 @@
log.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
+
+ // TODO EXOJCR-533
+ // } finally {
+ // System.out.println(System.currentTimeMillis() + ":Get:" + repoPath + ":" + (System.currentTimeMillis() - startGet));
+ // }
}
/**
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -58,7 +58,7 @@
* Created by The eXo Platform SAS Author : <a
* href="gavrikvetal(a)gmail.com">Vitaly Guly</a>.
*
- * @version $Id: $
+ * @version $Id$
*/
public class GetCommand
@@ -81,8 +81,12 @@
* @param ranges ranges
* @return the instance of javax.ws.rs.core.Response
*/
- public Response get(Session session, String path, String version, String baseURI, List<Range> ranges, String ifModifiedSince, HashMap<MediaType, String> cahceControls)
+ public Response get(Session session, String path, String version, String baseURI, List<Range> ranges,
+ String ifModifiedSince, HashMap<MediaType, String> cahceControls)
{
+ // TODO EXOJCR-533
+ // long startGet = System.currentTimeMillis();
+ // try {
if (version == null)
{
@@ -95,7 +99,6 @@
try
{
-
Node node = (Node)session.getItem(path);
WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session);
@@ -119,36 +122,36 @@
istream = ((FileResource)resource).getContentAsStream();
}
- HierarchicalProperty contentLengthProperty = resource.getProperty(FileResource.GETCONTENTLENGTH);
- long contentLength = new Long(contentLengthProperty.getValue());
+ // TODO EXOJCR-533 why we need fileResource if we have resource?
+ // FileResource fileResource = new FileResource(uri, node, nsContext);
+ // HierarchicalProperty lastModifiedProperty = fileResource.getProperty(FileResource.GETLASTMODIFIED);
+ HierarchicalProperty lastModifiedProperty = resource.getProperty(FileResource.GETLASTMODIFIED);
- HierarchicalProperty mimeTypeProperty = resource.getProperty(FileResource.GETCONTENTTYPE);
- String contentType = mimeTypeProperty.getValue();
-
- FileResource fileResource = new FileResource(uri, node, nsContext);
- HierarchicalProperty lastModifiedProperty = fileResource.getProperty(FileResource.GETLASTMODIFIED);
-
- if((ifModifiedSince != null) && (ifModifiedSince.equals(lastModifiedProperty.getValue()))){
+ // check before any other reads
+ if ((ifModifiedSince != null) && (ifModifiedSince.equals(lastModifiedProperty.getValue())))
+ {
return Response.notModified().entity("Not Modified").build();
}
+ HierarchicalProperty contentLengthProperty = resource.getProperty(FileResource.GETCONTENTLENGTH);
+ long contentLength = new Long(contentLengthProperty.getValue());
+
// content length is not present
if (contentLength == 0)
{
return Response.ok().header(ExtHttpHeaders.ACCEPT_RANGES, "bytes").entity(istream).build();
}
+ HierarchicalProperty mimeTypeProperty = resource.getProperty(FileResource.GETCONTENTTYPE);
+ String contentType = mimeTypeProperty.getValue();
+
// no ranges request
-
if (ranges.size() == 0)
{
-
-
return Response.ok().header(HttpHeaders.CONTENT_LENGTH, Long.toString(contentLength)).header(
ExtHttpHeaders.ACCEPT_RANGES, "bytes").header(ExtHttpHeaders.LAST_MODIFIED,
lastModifiedProperty.getValue()).header(ExtHttpHeaders.CACHE_CONTROL,
generateCacheControl(cahceControls, contentType)).entity(istream).type(contentType).build();
-
}
// one range
@@ -213,6 +216,11 @@
log.error(exc.getMessage(), exc);
return Response.serverError().entity(exc.getMessage()).build();
}
+
+ // TODO EXOJCR-533
+ // } finally {
+ // System.out.println(System.currentTimeMillis() + ":GetCommand:" + path + ":" + (System.currentTimeMillis() - startGet));
+ // }
}
/**
@@ -270,26 +278,30 @@
*/
private String generateCacheControl(HashMap<MediaType, String> cacheControlMap, String contentType)
{
-
+
ArrayList<MediaType> mediaTypesList = new ArrayList<MediaType>(cacheControlMap.keySet());
Collections.sort(mediaTypesList, MediaTypeHelper.MEDIA_TYPE_COMPARATOR);
String cacheControlValue = "no-cache";
-
- if(contentType == null || contentType.equals("")){
+
+ if (contentType == null || contentType.equals(""))
+ {
return cacheControlValue;
}
-
+
for (MediaType mediaType : mediaTypesList)
{
- if(contentType.equals(MediaType.WILDCARD)){
+ if (contentType.equals(MediaType.WILDCARD))
+ {
cacheControlValue = cacheControlMap.get(MediaType.WILDCARD_TYPE);
break;
- } else if (mediaType.isCompatible(new MediaType(contentType.split("/")[0], contentType.split("/")[1]) )) {
+ }
+ else if (mediaType.isCompatible(new MediaType(contentType.split("/")[0], contentType.split("/")[1])))
+ {
cacheControlValue = cacheControlMap.get(mediaType);
break;
}
}
- return cacheControlValue;
+ return cacheControlValue;
}
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -153,8 +153,9 @@
final WebDavNamespaceContext namespaceContext) throws IllegalResourceTypeException, RepositoryException
{
super(type, identifier, new WebDavNamespaceContext(node.getSession()));
- if (ResourceUtil.isFile(node))
- throw new IllegalResourceTypeException("Node type is not applicable for COLLECTION resource " + node.getPath());
+ // TODO EXOJCR-533
+ //if (ResourceUtil.isFile(node))
+ // throw new IllegalResourceTypeException("Node type is not applicable for COLLECTION resource " + node.getPath());
this.node = node;
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -45,9 +45,8 @@
* nt:file's URI jcr:content's jcr:data property contains file's payload
*
* @author Gennady Azarenkov
- * @version $Id: $
+ * @version $Id$
*/
-
public class FileResource extends GenericResource
{
@@ -88,6 +87,16 @@
protected final Node node;
/**
+ * Content Node (jcr:content).
+ */
+ private Node contentNode;
+
+ /**
+ * Data Property (jcr:data).
+ */
+ private Property contentData;
+
+ /**
* @param identifier resource identifier
* @param node node
* @param namespaceContext namespace context
@@ -113,8 +122,9 @@
throws IllegalResourceTypeException, RepositoryException
{
super(type, identifier, namespaceContext);
- if (!ResourceUtil.isFile(node))
- throw new IllegalResourceTypeException("Node type is not applicable for FILE resource " + node.getPath());
+ // TODO EXOJCR-533
+ //if (!ResourceUtil.isFile(node))
+ // throw new IllegalResourceTypeException("Node type is not applicable for FILE resource " + node.getPath());
this.node = node;
}
@@ -125,7 +135,6 @@
public Set<HierarchicalProperty> getProperties(boolean namesOnly) throws PathNotFoundException,
AccessDeniedException, RepositoryException
{
-
Set<HierarchicalProperty> props = super.getProperties(namesOnly);
props.add(namesOnly ? new HierarchicalProperty(GETLASTMODIFIED) : getProperty(GETLASTMODIFIED));
@@ -193,7 +202,6 @@
if (name.equals(DISPLAYNAME))
{
return new HierarchicalProperty(name, node.getName());
-
}
else if (name.equals(CREATIONDATE))
{
@@ -202,22 +210,18 @@
HierarchicalProperty creationDate = new HierarchicalProperty(name, created, CREATION_PATTERN);
creationDate.setAttribute("b:dt", "dateTime.tz");
return creationDate;
-
}
else if (name.equals(CHILDCOUNT))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(GETCONTENTLENGTH))
{
- return new HierarchicalProperty(name, "" + node.getNode("jcr:content").getProperty("jcr:data").getLength());
-
+ return new HierarchicalProperty(name, String.valueOf(dataProperty().getLength()));
}
else if (name.equals(GETCONTENTTYPE))
{
- return new HierarchicalProperty(name, node.getNode("jcr:content").getProperty("jcr:mimeType").getString());
-
+ return new HierarchicalProperty(name, contentNode().getProperty("jcr:mimeType").getString());
}
else if (name.equals(GETLASTMODIFIED))
{
@@ -225,37 +229,30 @@
HierarchicalProperty lastModified = new HierarchicalProperty(name, modified, MODIFICATION_PATTERN);
lastModified.setAttribute("b:dt", "dateTime.rfc1123");
return lastModified;
-
}
else if (name.equals(HASCHILDREN))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(ISCOLLECTION))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(ISFOLDER))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(ISROOT))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(PARENTNAME))
{
return new HierarchicalProperty(name, node.getParent().getName());
-
}
else if (name.equals(RESOURCETYPE))
{
return new HierarchicalProperty(name);
-
}
else if (name.equals(SUPPORTEDLOCK))
{
@@ -279,12 +276,10 @@
else if (name.equals(ISVERSIONED))
{
return new HierarchicalProperty(name, "0");
-
}
else if (name.equals(SUPPORTEDMETHODSET))
{
return supportedMethodSet();
-
}
else
{
@@ -294,7 +289,6 @@
String propertyValue;
if (property.getDefinition().isMultiple())
{
-
if (property.getValues().length == 0)
{
throw new PathNotFoundException();
@@ -342,7 +336,7 @@
*/
public String getContentAsText() throws RepositoryException
{
- return contentNode().getProperty("jcr:data").getString();
+ return dataProperty().getString();
}
/**
@@ -353,7 +347,7 @@
*/
public InputStream getContentAsStream() throws RepositoryException
{
- return contentNode().getProperty("jcr:data").getStream();
+ return dataProperty().getStream();
}
/**
@@ -365,7 +359,7 @@
{
try
{
- return contentNode().getProperty("jcr:data").getType() != PropertyType.BINARY;
+ return dataProperty().getType() != PropertyType.BINARY;
}
catch (RepositoryException exc)
{
@@ -377,12 +371,37 @@
/**
* Returns the content node.
*
- * @return the content node
+ * @return Node, the content node
* @throws RepositoryException {@link RepositoryException}
*/
- public Node contentNode() throws RepositoryException
+ protected Node contentNode() throws RepositoryException
{
- return node.getNode("jcr:content");
+ if (contentNode == null)
+ {
+ return contentNode = node.getNode("jcr:content");
+ }
+ else
+ {
+ return contentNode;
+ }
}
+ /**
+ * Returns the data property.
+ *
+ * @return Property, the content data property
+ * @throws RepositoryException {@link RepositoryException}
+ */
+ protected Property dataProperty() throws RepositoryException
+ {
+ if (contentData == null)
+ {
+ return contentData = contentNode().getProperty("jcr:data");
+ }
+ else
+ {
+ return contentData;
+ }
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedCollectionResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedCollectionResource.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedCollectionResource.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -51,9 +51,10 @@
throws IllegalResourceTypeException, RepositoryException
{
super(VERSIONED_COLLECTION, identifier, node, namespaceContext);
- if (!node.isNodeType("mix:versionable"))
- throw new IllegalResourceTypeException("Node type is not applicable for Versioned FILE resource "
- + node.getPath());
+ // TODO EXOJCR-533
+ // if (!node.isNodeType("mix:versionable"))
+ // throw new IllegalResourceTypeException("Node type is not applicable for Versioned FILE resource "
+ // + node.getPath());
}
/**
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedFileResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedFileResource.java 2010-02-19 21:30:05 UTC (rev 1932)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionedFileResource.java 2010-02-22 10:12:55 UTC (rev 1933)
@@ -60,9 +60,10 @@
throws IllegalResourceTypeException, RepositoryException
{
super(VERSIONED_FILE, identifier, node, namespaceContext);
- if (!node.isNodeType("mix:versionable"))
- throw new IllegalResourceTypeException("Node type is not applicable for Versioned FILE resource "
- + node.getPath());
+ // TODO EXOJCR-533
+ // if (!node.isNodeType("mix:versionable"))
+ // throw new IllegalResourceTypeException("Node type is not applicable for Versioned FILE resource "
+ // + node.getPath());
}
/**
14 years, 3 months
exo-jcr SVN: r1932 - in jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules: kernel and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-02-19 16:30:05 -0500 (Fri, 19 Feb 2010)
New Revision: 1932
Added:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/configuration.xml
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel.xml
Log:
EXOJCR-528: Documentation in Docbook added
Added: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/configuration.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/configuration.xml (rev 0)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/configuration.xml 2010-02-19 21:30:05 UTC (rev 1932)
@@ -0,0 +1,750 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <title>Configuration</title>
+
+ <section>
+ <title>Kernel configuration namespace</title>
+
+ <para>To be effective the namespace URI <link
+ linkend="???">http://www.exoplaform.org/xml/ns/kernel_1_1.xsd</link> must
+ be target namespace of the XML configuration file.</para>
+
+ <programlisting><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:schema></programlisting>
+ </section>
+
+ <section>
+ <title>Understanding How configuration files are loaded</title>
+
+ <section>
+ <title>First concepts</title>
+
+ <para>You can find the first concepts of <emphasis>How are the
+ configuration files loaded</emphasis> <ulink
+ url="http://wiki.exoplatform.org/xwiki/bin/view/Kernel/Container+Configuration">here</ulink>.</para>
+ </section>
+
+ <section>
+ <title>Advanced concepts for the <emphasis>PortalContainers</emphasis>
+ </title>
+
+ <para>Since eXo JCR 1.12, we added a set of new features that have been
+ designed to extend portal applications such as GateIn.</para>
+
+ <section>
+ <title>Add new configuration files from a WAR file</title>
+
+ <para>A <envar>ServletContextListener</envar> called
+ <envar>org.exoplatform.container.web.PortalContainerConfigOwner</envar>
+ has been added in order to notify the application that a given web
+ application provides some configuration to the portal container, and
+ this configuration file is the file
+ <emphasis>WEB-INF/conf/configuration.xml</emphasis> available in the
+ web application itself.</para>
+
+ <para>If your war file contains some configuration to add to the
+ <envar>PortalContainer</envar> simply add the following lines in your
+ <emphasis>web.xml</emphasis> file.</para>
+
+ <programlisting><?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+...
+ <!-- ================================================================== -->
+ <!-- LISTENER -->
+ <!-- ================================================================== -->
+ <listener>
+ <listener-class>org.exoplatform.container.web.PortalContainerConfigOwner</listener-class>
+ </listener>
+...
+</web-app></programlisting>
+ </section>
+
+ <section>
+ <title>Create your <emphasis>PortalContainers</emphasis> from a WAR
+ file</title>
+
+ <para>A <envar>ServletContextListener</envar> called
+ <envar>org.exoplatform.container.web.PortalContainerCreator</envar>
+ has been added in order to create the current portal containers that
+ have been registered. We assume that all the web applications have
+ already been loaded before calling
+ <envar>PortalContainerCreator.contextInitialized<replaceable><optional>.</optional></replaceable></envar></para>
+
+ <para><note>
+ <para>In GateIn, the <envar>PortalContainerCreator</envar> is
+ already managed by the file
+ <emphasis>starter.war/ear.</emphasis></para>
+ </note></para>
+ </section>
+
+ <section>
+ <title>Define a <emphasis>PortalContainer</emphasis> with its
+ dependencies and its settings</title>
+
+ <para>Now we can define precisely a portal container and its
+ dependencies and settings thanks to the
+ <envar>PortalContainerDefinition</envar> that currently contains the
+ name of the portal container, the name of the rest context, the name
+ of the realm he web application dependencies ordered by loading
+ priority (i.e. the first dependency must be loaded at first and so
+ on..) and the settings.</para>
+
+ <para>To be able to define a <envar>PortalContainerDefinition</envar>,
+ we need to ensure first of all that a
+ <envar>PortalContainerConfig</envar> has been defined at the
+ <envar>RootContainer</envar> level, see below an example:</para>
+
+ <programlisting> <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ </init-params>
+ </component></programlisting>
+
+ <table>
+ <title>Descriptions of the fields of
+ <envar>PortalContainerConfig</envar></title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>default.portal.container</entry>
+
+ <entry>The name of the default portal container. This field is
+ optional.</entry>
+ </row>
+
+ <row>
+ <entry>default.rest.context</entry>
+
+ <entry>The name of the default rest
+ <envar>ServletContext</envar>. This field is optional.</entry>
+ </row>
+
+ <row>
+ <entry>default.realm.name</entry>
+
+ <entry>The name of the default realm. This field is
+ optional.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para> A new <envar>PortalContainerDefinition</envar> can be defined
+ at the <envar>RootContainer</envar> level thanks to an external
+ plugin, see below an example:<programlisting> <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-domain</string>
+ </field>
+ <!-- All the dependencies of the portal container ordered by loading priority -->
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>foo</string>
+ </value>
+ <value>
+ <string>foo2</string>
+ </value>
+ <value>
+ <string>foo3</string>
+ </value>
+ </collection>
+ </field>
+ <!-- A map of settings tied to the portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>10</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>10</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>10</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins></programlisting></para>
+
+ <table>
+ <title>Descriptions of the fields of
+ <envar>PortalContainerDefinition</envar></title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>name</entry>
+
+ <entry>The name of the portal container. This field is
+ mandatory.</entry>
+ </row>
+
+ <row>
+ <entry>restContextName</entry>
+
+ <entry>The name of the context name of the rest web
+ application. This field is optional. The default value will
+ the value define at the <envar>PortalContainerConfig</envar>
+ level if it is not null, "rest" otherwise.</entry>
+ </row>
+
+ <row>
+ <entry>realmName</entry>
+
+ <entry>The name of the realm. This field is optional. The
+ default value will the value define at the
+ <envar>PortalContainerConfig</envar> level if it is not null,
+ "exo-domain" otherwise.</entry>
+ </row>
+
+ <row>
+ <entry>dependencies</entry>
+
+ <entry>All the dependencies of the portal container ordered by
+ loading priority. The dependencies are in fact the list of the
+ context names of the web applications from which the portal
+ container depends. This field is optional. The dependency
+ order is really crucial since it will be interpreted the same
+ way by several components of the platform. All those
+ components, will consider the 1st element in the list less
+ important than the second element and so on. It is currently
+ used to:<itemizedlist>
+ <listitem>
+ <para>Know the loading order of all the
+ dependencies.</para>
+ </listitem>
+
+ <listitem>
+ <para>If we have several
+ <envar>PortalContainerConfigOwner</envar><itemizedlist>
+ <listitem>
+ <para>The <envar>ServletContext</envar> of all the
+ <envar>PortalContainerConfigOwner</envar> will be
+ unified, if we use the unified
+ <envar>ServletContext</envar>
+ (<emphasis>PortalContainer.getPortalContext()</emphasis>)
+ to get a resource, it will try to get the resource
+ in the <envar>ServletContext</envar> of the most
+ important <envar>PortalContainerConfigOwner</envar>
+ (i.e. last in the dependency list) and if it cans
+ find it, it will try with the second most important
+ <envar>PortalContainerConfigOwner</envar> and so
+ on.</para>
+ </listitem>
+
+ <listitem>
+ <para>The <envar>ClassLoader</envar> of all the
+ <envar>PortalContainerConfigOwner</envar> will be
+ unified, if we use the unified
+ <envar>ClassLoader</envar>
+ (<emphasis>PortalContainer.getPortalClassLoader()</emphasis>)
+ to get a resource, it will try to get the resource
+ in the <envar>ClassLoader</envar> of the most
+ important <envar>PortalContainerConfigOwner</envar>
+ (i.e. last in the dependency list) and if it cans
+ find it, it will try with the second most important
+ <envar>PortalContainerConfigOwner</envar> and so
+ on.</para>
+ </listitem>
+ </itemizedlist></para>
+ </listitem>
+ </itemizedlist></entry>
+ </row>
+
+ <row>
+ <entry>settings</entry>
+
+ <entry>A <envar>java.util.Map</envar> of internal parameters
+ that we would like to tie the portal container. Those
+ parameters could have any type of value. This field is
+ optional.</entry>
+ </row>
+
+ <row>
+ <entry>externalSettingsPath</entry>
+
+ <entry>The path of the external properties file to load as
+ default settings to the portal container. This field is
+ optional. The external properties files can be either of type
+ "properties" or of type "xml". The path will be interpreted as
+ follows:<orderedlist>
+ <listitem>
+ <para>The path doesn't contain any prefix of type
+ "classpath:", "jar:" or "file:", we assume that the file
+ could be externalized so we apply the following
+ rules:<orderedlist>
+ <listitem>
+ <para>A file exists at
+ <emphasis>${exo-conf-dir}/portal/${portalContainerName}/${externalSettingsPath}</emphasis>,
+ we will load this file.</para>
+ </listitem>
+
+ <listitem>
+ <para>No file exists at the previous path, we then
+ assume that the path cans be interpreted by the
+ <envar>ConfigurationManager</envar>.</para>
+ </listitem>
+ </orderedlist></para>
+ </listitem>
+
+ <listitem>
+ <para>The path contains a prefix, we then assume that
+ the path cans be interpreted by the
+ <envar>ConfigurationManager</envar>.</para>
+ </listitem>
+ </orderedlist></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Internal and external settings are both optional, but if we give
+ a non empty value for both the application will merge the settings. If
+ the same setting name exists in both settings, we apply the following
+ rules:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>The value of the external setting is
+ <emphasis>null</emphasis>, we ignore the value.</para>
+ </listitem>
+
+ <listitem>
+ <para>The value of the external setting is not
+ <emphasis>null</emphasis> and the value of the internal setting is
+ <emphasis>null</emphasis>, the final value will be the external
+ setting value that is of type <envar>String</envar>.</para>
+ </listitem>
+
+ <listitem>
+ <para>Both values are not <envar>null</envar>, we will have to
+ convert the external setting value into the target type which is
+ the type of the internal setting value, thanks to the static
+ method <emphasis>valueOf(String)</emphasis>, the following
+ sub-rules are then applied:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>The method cannot be found, the final value will be the
+ external setting value that is of type
+ <envar>String</envar>.</para>
+ </listitem>
+
+ <listitem>
+ <para>The method can be found and the external setting value
+ is an empty <envar>String</envar>, we ignore the external
+ setting value.</para>
+ </listitem>
+
+ <listitem>
+ <para>The method can be found and the external setting value
+ is not an empty <envar>String</envar> but the method call
+ fails, we ignore the external setting value.</para>
+ </listitem>
+
+ <listitem>
+ <para>The method can be found and the external setting value
+ is not an empty <envar>String</envar> and the method call
+ succeeds, the final value will be the external setting value
+ that is of type of the internal setting value.</para>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ </orderedlist>
+ </section>
+
+ <section>
+ <title><envar>PortalContainer</envar> settings</title>
+
+ <para>We can inject the value of the portal container settings into
+ the portal container configuration files thanks to the variables which
+ name start with "<emphasis>portal.container.</emphasis>", so to get
+ the value of a setting called "<emphasis>foo</emphasis>" just use the
+ following syntax <emphasis>${portal.container.foo}</emphasis>. You can
+ also use internal variables, such as: </para>
+
+ <table>
+ <title>Definition of the internal variables</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>portal.container.name</entry>
+
+ <entry>Gives the name of the current portal container.</entry>
+ </row>
+
+ <row>
+ <entry>portal.container.rest</entry>
+
+ <entry>Gives the context name of the rest web application of
+ the current portal container.</entry>
+ </row>
+
+ <row>
+ <entry>portal.container.realm</entry>
+
+ <entry>Gives the realm name of the current portal
+ container.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>You can find below an example of how to use the
+ variables:<programlisting><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.container.TestPortalContainer$MyComponent</type>
+ <init-params>
+ <!-- The name of the portal container -->
+ <value-param>
+ <name>portal</name>
+ <value>${portal.container.name}</value>
+ </value-param>
+ <!-- The name of the rest ServletContext -->
+ <value-param>
+ <name>rest</name>
+ <value>${portal.container.rest}</value>
+ </value-param>
+ <!-- The name of the realm -->
+ <value-param>
+ <name>realm</name>
+ <value>${portal.container.realm}</value>
+ </value-param>
+ <value-param>
+ <name>foo</name>
+ <value>${portal.container.foo}</value>
+ </value-param>
+ <value-param>
+ <name>before foo after</name>
+ <value>before ${portal.container.foo} after</value>
+ </value-param>
+ </init-params>
+ </component>
+</configuration></programlisting></para>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>System property configuration</title>
+
+ <para>A new property configurator service has been developed for taking
+ care of configuring system properties from the inline kernel configuration
+ or from specified property files.</para>
+
+ <para>The services is scoped at the root container level because it is
+ used by all the services in the different portal containers in the
+ application runtime.</para>
+
+ <section>
+ <title>Properties init param</title>
+
+ <para>The properties init param takes a property declared to configure
+ various properties.</para>
+
+ <programlisting><component>
+ <key>PropertyManagerConfigurator</key>
+ <type>org.exoplatform.container.PropertyConfigurator</type>
+ <init-params>
+ <properties-param>
+ <name>properties</name>
+ <property name="foo" value="bar"/>
+ </properties-param>
+ </init-params>
+</component></programlisting>
+ </section>
+
+ <section>
+ <title>Properties URL init param</title>
+
+ <para>The properties URL init param allow to load an external file by
+ specifying its URL. Both property and XML format are supported, see the
+ javadoc of the <emphasis><envar>java.util.Properties</envar></emphasis>
+ class for more information. When a property file is loaded the various
+ property declarations are loaded in the order in which the properties
+ are declared sequentially in the file.</para>
+
+ <programlisting><component>
+ <key>PropertyManagerConfigurator</key>
+ <type>org.exoplatform.container.PropertyConfigurator</type>
+ <init-params>
+ <value-param>
+ <name>properties.url</name>
+ <value>classpath:configuration.properties</value>
+ </value-param>
+ </init-params>
+</component></programlisting>
+ </section>
+
+ <section>
+ <title>System Property configuration of the properties URL</title>
+
+ <para>It is possible to replace the properties URL init param by a
+ system property that overwrites it. The name of that property is
+ <emphasis>exo.properties.url</emphasis>.</para>
+ </section>
+ </section>
+
+ <section>
+ <title>Runtime configuration profiles</title>
+
+ <para>The kernel configuration is able to handle configuration profiles at
+ runtime (as opposed to packaging time).</para>
+
+ <section>
+ <title>Profiles activation</title>
+
+ <para>An active profile list is obtained during the boot of the root
+ container and is composed of the system property
+ <emphasis>exo.profiles</emphasis> sliced according the "," delimiter and
+ also a server specific profile value (tomcat for tomcat, jboss for
+ jboss, etc...).</para>
+
+ <programlisting># runs GateIn on Tomcat with the profiles tomcat and foo
+sh gatein.sh -Dexo.profiles=foo
+
+# runs GateIn on JBoss with the profiles jboss, foo and bar
+sh run.sh -Dexo.profiles=foo,bar</programlisting>
+ </section>
+
+ <section>
+ <title>Profiles configuration</title>
+
+ <para>Profiles are configured in the configuration files of the eXo
+ kernel.</para>
+
+ <section>
+ <title>Profiles definition</title>
+
+ <para>Profile activation occurs at XML to configuration object
+ unmarshalling time. It is based on an "profile" attribute that is
+ present on some of the XML element of the configuration files. To
+ enable this the kernel configuration schema has been upgraded to
+ kernel_1_1.xsd. The configuration is based on the following
+ rules:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Any kernel element with the no <emphasis>profiles</emphasis>
+ attribute will create a configuration object</para>
+ </listitem>
+
+ <listitem>
+ <para>Any kernel element having a <emphasis>profiles</emphasis>
+ attribute containing at least one of the active profiles will
+ create a configuration object</para>
+ </listitem>
+
+ <listitem>
+ <para>Any kernel element having a <emphasis>profiles</emphasis>
+ attribute matching none of the active profile will not create a
+ configuration object</para>
+ </listitem>
+
+ <listitem>
+ <para>Resolution of duplicates (such as two components with same
+ type) is left up to the kernel</para>
+ </listitem>
+ </orderedlist>
+ </section>
+
+ <section>
+ <title>Profiles capable configuration elements</title>
+
+ <para>A configuration element is <emphasis>profiles</emphasis> capable
+ when it carries a profiles element.</para>
+
+ <section>
+ <title>Component element</title>
+
+ <para>The component element declares a component when activated. It
+ will shadow any element with the same key declared before in the
+ same configuration file:</para>
+
+ <programlisting><component>
+ <key>Component</key>
+ <type>Component</type>
+</component>
+
+<component profile="foo">
+ <key>Component</key>
+ <type>FooComponent</type>
+</component></programlisting>
+ </section>
+
+ <section>
+ <title>Import element</title>
+
+ <para>The import element imports a referenced configuration file
+ when activated:</para>
+
+ <programlisting><import>empty</import>
+<import profile="foo">foo</import>
+<import profile="bar">bar</import></programlisting>
+ </section>
+
+ <section>
+ <title>Init param element</title>
+
+ <para>The init param element configures the parameter argument of
+ the construction of a component service:</para>
+
+ <programlisting><component>
+ <key>Component</key>
+ <type>ComponentImpl</type>
+ <init-params>
+ <value-param>
+ <name>param</name>
+ <value>empty</value>
+ </value-param>
+ <value-param profile="foo">
+ <name>param</name>
+ <value>foo</value>
+ </value-param>
+ <value-param profile="bar">
+ <name>param</name>
+ <value>bar</value>
+ </value-param>
+ </init-params>
+</component></programlisting>
+ </section>
+
+ <section>
+ <title>Value collection element</title>
+
+ <para>The value collection element configures one of the value of
+ collection data:</para>
+
+ <programlisting><object type="org.exoplatform.container.configuration.ConfigParam">
+ <field name="role">
+ <collection type="java.util.ArrayList">
+ <value><string>manager</string></value>
+ <value profile="foo"><string>foo_manager</string></value>
+ <value profile="foo,bar"><string>foo_bar_manager</string></value>
+ </collection>
+ </field>
+</object></programlisting>
+ </section>
+
+ <section>
+ <title>Field configuration element</title>
+
+ <para>The field configuration element configures the field of an
+ object:</para>
+
+ <programlisting><object-param>
+ <name>test.configuration</name>
+ <object type="org.exoplatform.container.configuration.ConfigParam">
+ <field name="role">
+ <collection type="java.util.ArrayList">
+ <value><string>manager</string></value>
+ </collection>
+ </field>
+ <field name="role" profile="foo,bar">
+ <collection type="java.util.ArrayList">
+ <value><string>foo_bar_manager</string></value>
+ </collection>
+ </field>
+ <field name="role" profile="foo">
+ <collection type="java.util.ArrayList">
+ <value><string>foo_manager</string></value>
+ </collection>
+ </field>
+ </object>
+</object-param></programlisting>
+ </section>
+ </section>
+ </section>
+ </section>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel.xml 2010-02-19 20:21:30 UTC (rev 1931)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel.xml 2010-02-19 21:30:05 UTC (rev 1932)
@@ -8,6 +8,9 @@
<xi:include href="kernel/kernel.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="kernel/configuration.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="kernel/transaction-service.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
14 years, 3 months
exo-jcr SVN: r1931 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-02-19 15:21:30 -0500 (Fri, 19 Feb 2010)
New Revision: 1931
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
Log:
EXOJCR-528: Typo issue in the Javadoc
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-02-19 16:57:53 UTC (rev 1930)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-02-19 20:21:30 UTC (rev 1931)
@@ -503,15 +503,15 @@
* a file of type "properties" or "xml". The given path will be interpreted as follows:
* <ol>
* <li>The path doesn't contain any prefix of type "classpath:", "jar:" or "file:", we
- * assume then apply the following rules
+ * assume that the file could be externalized so we apply the following rules:
* <ol>
* <li>A file exists at ${exo-conf-dir}/portal/${portalContainerName}/${path}, we
* will load this file</li>
- * <li>No file exists at the previous path, we then assume that the path can be
+ * <li>No file exists at the previous path, we then assume that the path cans be
* interpreted by the {@link ConfigurationManager}</li>
* </ol>
* </li>
- * <li>The path contains a prefix, we then assume that the path can be interpreted
+ * <li>The path contains a prefix, we then assume that the path cans be interpreted
* by the {@link ConfigurationManager}</li>
* </ol>
* @param path the path of the external settings to load
14 years, 3 months
exo-jcr SVN: r1930 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock: jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-19 11:57:53 -0500 (Fri, 19 Feb 2010)
New Revision: 1930
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableSessionLockManager.java
Log:
EXOJCR-531: LockException on adding new subnodes fixed
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java 2010-02-19 15:25:19 UTC (rev 1929)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java 2010-02-19 16:57:53 UTC (rev 1930)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core.lock;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import javax.jcr.RepositoryException;
@@ -47,9 +48,27 @@
*/
protected abstract boolean isLockedPersisted(NodeData node) throws LockException;
+ protected abstract boolean isPersitedLockHolder(NodeImpl node) throws RepositoryException;
+
/**
* {@inheritDoc}
*/
+ public boolean isLockHolder(NodeImpl node) throws RepositoryException
+ {
+ //check is parent node also new
+ if (transientManager.isNew(node.getIdentifier()) && transientManager.isNew(node.getParentIdentifier()))
+ {
+ return true;
+ }
+ else
+ {
+ return isPersitedLockHolder(node);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean isLocked(NodeData data) throws LockException
{
if (transientManager.isNew(data.getIdentifier()))
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManagerImpl.java 2010-02-19 15:25:19 UTC (rev 1929)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManagerImpl.java 2010-02-19 16:57:53 UTC (rev 1930)
@@ -94,7 +94,7 @@
/**
* {@inheritDoc}
*/
- public boolean isLockHolder(NodeImpl node) throws RepositoryException
+ protected boolean isPersitedLockHolder(NodeImpl node) throws RepositoryException
{
return lockManager.isLockHolder(node);
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableSessionLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableSessionLockManager.java 2010-02-19 15:25:19 UTC (rev 1929)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableSessionLockManager.java 2010-02-19 16:57:53 UTC (rev 1930)
@@ -87,7 +87,8 @@
* @param sessionID - session identifier
* @param lockManager - workspace lock manager
*/
- public CacheableSessionLockManager(String sessionID, CacheableLockManager lockManager, SessionDataManager transientManager)
+ public CacheableSessionLockManager(String sessionID, CacheableLockManager lockManager,
+ SessionDataManager transientManager)
{
super(transientManager);
this.sessionID = sessionID;
@@ -207,7 +208,7 @@
/**
* {@inheritDoc}
*/
- public boolean isLockHolder(NodeImpl node) throws RepositoryException
+ protected boolean isPersitedLockHolder(NodeImpl node) throws RepositoryException
{
//TODO optimise it
LockData lData = lockManager.getExactNodeOrCloseParentLock((NodeData)node.getData());
14 years, 3 months
exo-jcr SVN: r1929 - jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-02-19 10:25:19 -0500 (Fri, 19 Feb 2010)
New Revision: 1929
Modified:
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql
Log:
EXOJCR-530: fix index len for InnoDB engine
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql 2010-02-19 13:56:18 UTC (rev 1928)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql 2010-02-19 15:25:19 UTC (rev 1929)
@@ -15,8 +15,8 @@
CONSTRAINT JCR_PK_MITEM PRIMARY KEY(ID),
CONSTRAINT JCR_FK_MITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_MITEM(ID)
);
-CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME(300), I_INDEX, I_CLASS, VERSION DESC);
-CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME(300), I_INDEX, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME(255), I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_ID ON JCR_MITEM(I_CLASS, PARENT_ID, ID, VERSION DESC);
CREATE TABLE JCR_MVALUE(
ID SERIAL NOT NULL,
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql 2010-02-19 13:56:18 UTC (rev 1928)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql 2010-02-19 15:25:19 UTC (rev 1929)
@@ -16,8 +16,8 @@
CONSTRAINT JCR_PK_SITEM PRIMARY KEY(ID),
CONSTRAINT JCR_FK_SITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_SITEM(ID)
);
-CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME(300), I_INDEX, I_CLASS, VERSION DESC);
-CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, NAME(300), I_INDEX, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, NAME(255), I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_ID ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, ID, VERSION DESC);
CREATE TABLE JCR_SVALUE(
ID SERIAL NOT NULL,
14 years, 3 months