exo-jcr SVN: r4260 - ws/tags.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2011-04-20 06:04:27 -0400 (Wed, 20 Apr 2011)
New Revision: 4260
Removed:
ws/tags/exo.ws.frameworks.servlet-2.1.8-bonita/
Log:
WS-264 useless tag removed
15 years
exo-jcr SVN: r4259 - ws/tags.
by do-not-reply@jboss.org
Author: aheritier
Date: 2011-04-19 18:14:10 -0400 (Tue, 19 Apr 2011)
New Revision: 4259
Added:
ws/tags/exo.ws.frameworks.servlet-2.1.8-GA-bonita/
Log:
Fork for bonita
15 years
exo-jcr SVN: r4258 - ws/tags.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2011-04-19 11:51:00 -0400 (Tue, 19 Apr 2011)
New Revision: 4258
Added:
ws/tags/2.1.8-bonita/
Removed:
ws/tags/2.1.8-GA-BONITA/
Log:
WS-264 rename from 2.1.8-GA-BONITA to 2.1.8-bonita
15 years
exo-jcr SVN: r4257 - ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2011-04-19 11:42:02 -0400 (Tue, 19 Apr 2011)
New Revision: 4257
Modified:
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
Log:
WS-264 commit of patch https://jira.exoplatform.org/secure/attachment/33914/2011-04-14.patch
Modified: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java 2011-04-19 15:38:43 UTC (rev 4256)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java 2011-04-19 15:42:02 UTC (rev 4257)
@@ -80,13 +80,25 @@
LOG.error("Error of configurationURL read", e);
}
+ // If no configuration in web.xml check system property.
+ if (configurationURL == null)
+ configurationURL = System.getProperty(CONF_URL_PARAMETER);
+
try
{
StandaloneContainer.addConfigurationURL(configurationURL);
}
catch (MalformedURLException e)
{
- LOG.error("Error of addConfigurationURL", e);
+ // Try to use path, we do not need have full path (file:/path/conf) to configuration. Any relative path is OK.
+ try
+ {
+ StandaloneContainer.addConfigurationPath(configurationURL);
+ }
+ catch (MalformedURLException e2)
+ {
+ LOG.error("Error of addConfiguration", e2);
+ }
}
try
15 years
exo-jcr SVN: r4256 - in ws/tags: 2.1.8-GA-BONITA and 9 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2011-04-19 11:38:43 -0400 (Tue, 19 Apr 2011)
New Revision: 4256
Added:
ws/tags/2.1.8-GA-BONITA/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/pom.xml
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AnonymousUserContextRedirectionFilter.java
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/PortalContainerInitializedFilter.java
ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
ws/tags/2.1.8-GA-BONITA/pom.xml
Log:
WS-264 2.1.8-GA-BONITA tag
Added: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/pom.xml
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/pom.xml (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/pom.xml 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,53 @@
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>ws-parent</artifactId>
+ <version>2.1.8-GA-BONITA</version>
+ </parent>
+
+ <artifactId>exo.ws.frameworks.servlet</artifactId>
+
+ <name>eXo WS :: Framework :: Servlet</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,234 @@
+/*
+ * 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.ws.frameworks.servlet;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * Created by The eXo Platform SAS.
+ * @author <a href="mailto:vitaly.parfonov@gmail.com">Vitaly Parfonov</a>
+ * @version $Id: $
+ */
+public class AliasedURLRequestRedirector implements Filter
+{
+
+ //TODO
+ private static String START_ESCAPED = "%7B$";
+
+ private static String END_ESCAPED = "%7D";
+
+ private static String START = "{$";
+
+ private static String END = "}";
+
+ Map<String, String> replaceMap = new HashMap<String, String>();
+
+ /**
+ * Filter configuration.
+ */
+ // private FilterConfig conf;
+
+ // private String contextName;
+
+ /**
+ * Filter initialization method.
+ *
+ * @param conf filter configuration
+ * @throws ServletException exception
+ * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
+ */
+ @SuppressWarnings("unchecked")
+ public void init(FilterConfig conf) throws ServletException
+ {
+ // this.contextName = conf.getServletContext().getServletContextName();
+ // this.conf = conf;
+ Enumeration<String> enumeration = conf.getInitParameterNames();
+ while (enumeration.hasMoreElements())
+ {
+ String key = (String)enumeration.nextElement();
+ String val = conf.getInitParameter(key);
+ replaceMap.put(key, val);
+ }
+ }
+
+ /**
+ * Filter finalization method.
+ *
+ * @see javax.servlet.Filter#destroy()
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The main filter method. Wraps the original http request with the custom wrapper and calls chain.
+ *
+ * @param req original request
+ * @param res original response
+ * @param chain filter chain
+ * @throws IOException exception
+ * @throws ServletException exception
+ * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
+ */
+ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,
+ ServletException
+ {
+ chain.doFilter(createRequestWrapper(req), res);
+ }
+
+ /**
+ * Locates PageProvider component in the container, gets map of the URL parameters to replace,
+ * then creates the custom wrapper and passes the map to it.
+ *
+ * @param req original request
+ * @return
+ */
+ private ServletRequest createRequestWrapper(ServletRequest req)
+ {
+ // replaceMap.put("context", contextName);
+ return new UrlReplacerWrapper((HttpServletRequest)req, replaceMap);
+ }
+
+ /**
+ * The custom http request wrapper that is designed to substitute given parameters in URLs
+ * with corresponding values. Parameters are marked at an URL in the form: {$parameter-name}
+ *
+ */
+ public class UrlReplacerWrapper extends HttpServletRequestWrapper
+ {
+
+ /**
+ * Map with substitutes.
+ */
+ private final Map<String, String> replaceMap;
+
+ /**
+ * Generated path info.
+ */
+ private String pathInfo;
+
+ /**
+ * Generated request uri.
+ */
+ private String requestUri;
+
+ /**
+ * Generated request url.
+ */
+ private StringBuffer requestUrl;
+
+ /**
+ * @param request original request
+ * @param replaceMap replace map
+ */
+ public UrlReplacerWrapper(HttpServletRequest request, Map<String, String> replaceMap)
+ {
+ super(request);
+ this.replaceMap = replaceMap;
+ pathInfo = replaceByMap(super.getPathInfo());
+ requestUri = replaceByMap(super.getRequestURI());
+ StringBuffer sb = super.getRequestURL();
+ if (sb != null)
+ requestUrl = new StringBuffer(replaceByMap(sb.toString()));
+ else
+ requestUrl = null;
+ }
+
+ /**
+ * Actual URL substitution method.
+ *
+ * @param path
+ * @return
+ */
+ //TODO
+ private String replaceByMap(String path)
+ {
+ if (path == null)
+ return null;
+ // if (path.indexOf(START) < 0 || path.indexOf(START_ESCAPED)< 0)
+ // return path;
+ String result = path;
+ for (Iterator<String> i = replaceMap.keySet().iterator(); i.hasNext();)
+ {
+ String name = i.next();
+ String value = replaceMap.get(name);
+ if (value != null)
+ {
+ if (path.indexOf(START) > 0)
+ {
+ result = result.replace(START + name + END, value);
+ }
+ if (path.indexOf(START_ESCAPED) > 0)
+ {
+ result = result.replace(START_ESCAPED + name + END_ESCAPED, value);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Overridden method.
+ *
+ * @return actual path info
+ * @see javax.servlet.http.HttpServletRequestWrapper#getPathInfo()
+ */
+ public String getPathInfo()
+ {
+ return pathInfo;
+ }
+
+ /**
+ * Overridden method.
+ *
+ * @return actual URI
+ * @see javax.servlet.http.HttpServletRequestWrapper#getRequestURI()
+ */
+ public String getRequestURI()
+ {
+ return requestUri;
+ }
+
+ /**
+ * Overridden method.
+ *
+ * @return actual URL
+ * @see javax.servlet.http.HttpServletRequestWrapper#getRequestURL()
+ */
+ public StringBuffer getRequestURL()
+ {
+ return requestUrl;
+ }
+
+ }
+
+}
Added: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AnonymousUserContextRedirectionFilter.java
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AnonymousUserContextRedirectionFilter.java (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AnonymousUserContextRedirectionFilter.java 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,161 @@
+/*
+ * 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.ws.frameworks.servlet;
+
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Checks out if username present in HttpServletRequest then initializes
+ * SessionProvider by getting current credentials from AuthenticationService
+ * and keeps SessionProvider in ThreadLocalSessionProviderService.
+ * Otherwise redirect request to alternative URL. Alternative web application
+ * can ask about authentication again or not and gives or denies access to
+ * requested resource.
+ * Filter requires parameter <code>context-name</code>, otherwise
+ * ServletException will be thrown.
+ *
+ * @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a>
+ * @version $Id: $
+ */
+public class AnonymousUserContextRedirectionFilter implements Filter
+{
+
+ /**
+ * context-name.
+ */
+ private final static String CONTEXT_NAME_PARAMETER = "context-name";
+
+ /**
+ * Logger.
+ */
+ private final static Log LOG = ExoLogger.getLogger("exo.ws.frameworks.servlet.AnonymousUserContextRedirectionFilter");
+
+ /**
+ * The name of context.
+ */
+ private String contextName;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void destroy()
+ {
+ // nothing to do.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
+ ServletException
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ String user = httpRequest.getRemoteUser();
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Current user '" + user + "'.");
+
+ if (user != null)
+ {
+ filterChain.doFilter(request, response);
+ }
+ else
+ {
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Redirect user to context '" + contextName + "'.");
+
+ String pathInfo = httpRequest.getPathInfo();
+ String query = httpRequest.getQueryString();
+
+ /* Problem with LinkGenerator required to do this!
+ * It is necessary to encode URI before redirect, otherwise
+ * we get invalid URL (if it contains not ASCII characters).
+ * When client (MS Word, for example) we get unparsed 'plus'
+ * in URL in WebDAV server. Currently it works and best
+ * solution for now.
+ *
+ * ******************************************************
+ * NOTE: We are not care about query parameters here!!!
+ *
+ * j2ee documentation says about method HttpServletRequest#getQueryString():
+ * "The value is not decoded by the container."
+ * This string must be encoded by client, for LinkGenerator.
+ */
+ ((HttpServletResponse)response).sendRedirect(encodeURL(contextName + pathInfo)
+ + (query != null ? "?" + query : ""));
+
+ }
+ }
+
+ /**
+ * Encode URL by URLEncoder#encode(url), then replace all '+' by '%20' .
+ * @param url source String.
+ * @return encoded String.
+ * @throws UnsupportedEncodingException if encoding is unsupported.
+ */
+ private static String encodeURL(String url) throws UnsupportedEncodingException
+ {
+
+ StringBuffer sb = new StringBuffer();
+ String[] paths = url.split("/");
+ for (int i = 0; i < paths.length; i++)
+ {
+ if ("".equals(paths[i]))
+ continue;
+
+ String t = URLEncoder.encode(paths[i], "UTF-8");
+ t = t.replace("+", "%20");
+ sb.append('/').append(t);
+
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Get context name. It must be specified as init parameter.
+ * {@inheritDoc}
+ */
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ contextName = filterConfig.getInitParameter(CONTEXT_NAME_PARAMETER);
+ if (contextName == null)
+ {
+ LOG.error("AnonymousUserContextRedirectionFilter is not deployed. Set Init-param '" + CONTEXT_NAME_PARAMETER
+ + " pointed to the target context name in the web.xml");
+ throw new ServletException("Filter error. Init-param '" + CONTEXT_NAME_PARAMETER + "' is null.");
+ }
+ }
+
+}
Added: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/PortalContainerInitializedFilter.java
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/PortalContainerInitializedFilter.java (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/PortalContainerInitializedFilter.java 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,94 @@
+/*
+ * 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.ws.frameworks.servlet;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.container.web.AbstractFilter;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * Created by The eXo Platform SAS .<br/>
+ * Servlet Filter that is used to initialize and remove the portal container from the ThreadLocal
+ * of PortalContainer, it relies on PortalContainer.getCurrentInstance to retrieve the right portal container.
+ *
+ * @author Gennady Azarenkov
+ * @version $Id: $
+ */
+public class PortalContainerInitializedFilter extends AbstractFilter
+{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.servlet.PortatContainerInitializedFilter");
+
+ /**
+ * initializes PortalContainer instance.
+ *
+ * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
+ * javax.servlet.ServletResponse, javax.servlet.FilterChain)
+ */
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
+ ServletException
+ {
+ ExoContainer container = getContainer();
+ if (!(container instanceof PortalContainer))
+ {
+ container = RootContainer.getInstance().getPortalContainer(PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME);
+ if (container == null)
+ {
+ throw new ServletException("Could not initialize PortalContainer." + "Current ExoContainer is: "
+ + ExoContainerContext.getCurrentContainer());
+ }
+ }
+ PortalContainer pcontainer = (PortalContainer)container;
+ try
+ {
+ PortalContainer.setInstance(pcontainer);
+ chain.doFilter(request, response);
+ }
+ finally
+ {
+ try
+ {
+ PortalContainer.setInstance(null);
+ }
+ catch (Exception e)
+ {
+ LOG.warn("An error occured while cleaning the ThreadLocal", e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void destroy()
+ {
+ }
+
+}
Added: ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
===================================================================
--- ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,121 @@
+/*
+ * 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.ws.frameworks.servlet;
+
+import org.exoplatform.container.StandaloneContainer;
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.naming.InitialContextInitializer;
+
+import java.net.MalformedURLException;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/**
+ * Created by The eXo Platform SAS .<br/> Servlet context initializer that
+ * initializes standalone container at the context startup time. To activate
+ * this your web.xml have to be configured like:<br/>
+ * <listener><br/>
+ * <listener-class>org.exoplatform.frameworks.web.common.StandaloneContainerInitializedListener</listener-class><br/>
+ * </listener><br/>
+ * You may also specify an URL to the
+ * configuration.xml stored the configuration for StandaloneContainer as
+ * servlet's init parameter called 'org.exoplatform.container.standalone.config'
+ *
+ * @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady
+ * Azarenkov</a>
+ * @version $Id: StandaloneContainerInitializedListener.java 6739 2006-07-04
+ * 14:34:49Z gavrikvetal $
+ */
+
+public class StandaloneContainerInitializedListener implements ServletContextListener
+{
+
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.frameworks.servlet.StandaloneContainerInitializedListener");
+
+ private static final String CONF_URL_PARAMETER = "org.exoplatform.container.standalone.config";
+
+ private static final String PREFIX_WAR = "war:";
+
+ /**
+ * Container.
+ */
+ private StandaloneContainer container;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void contextInitialized(ServletContextEvent event)
+ {
+ String configurationURL = event.getServletContext().getInitParameter(CONF_URL_PARAMETER);
+
+ try
+ {
+ if (configurationURL != null && configurationURL.startsWith(PREFIX_WAR))
+ {
+ configurationURL =
+ event.getServletContext().getResource(configurationURL.substring(PREFIX_WAR.length())).toExternalForm();
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Error of configurationURL read", e);
+ }
+
+ try
+ {
+ StandaloneContainer.addConfigurationURL(configurationURL);
+ }
+ catch (MalformedURLException e)
+ {
+ LOG.error("Error of addConfigurationURL", e);
+ }
+
+ try
+ {
+ container = StandaloneContainer.getInstance(Thread.currentThread().getContextClassLoader());
+
+ // Patch for tomcat InitialContext
+ InitialContextInitializer ic =
+ (InitialContextInitializer)container.getComponentInstanceOfType(InitialContextInitializer.class);
+
+ if (ic != null)
+ {
+ ic.recall();
+ }
+
+ event.getServletContext().setAttribute("org.exoplatform.frameworks.web.eXoContainer", container);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Error of StandaloneContainer initialization", e);
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ // container.stop();
+ }
+}
Added: ws/tags/2.1.8-GA-BONITA/pom.xml
===================================================================
--- ws/tags/2.1.8-GA-BONITA/pom.xml (rev 0)
+++ ws/tags/2.1.8-GA-BONITA/pom.xml 2011-04-19 15:38:43 UTC (rev 4256)
@@ -0,0 +1,179 @@
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.exoplatform</groupId>
+ <artifactId>foundation-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>ws-parent</artifactId>
+ <version>2.1.8-GA-BONITA</version>
+ <packaging>pom</packaging>
+ <name>eXo WS BONITA</name>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/ws/tags/2.1.8-GA-BONITA</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/ws/tags/2.1.8-GA-BONITA</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/ws/tags/2.1.8-GA-BONITA</url>
+ </scm>
+
+ <properties>
+ <exo.product.name>exo-ws</exo.product.name>
+ <exo.product.specification>2.1</exo.product.specification>
+
+ <org.exoplatform.kernel.version>2.2.8-GA</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.8-GA</org.exoplatform.core.version>
+ </properties>
+
+ <modules>
+ <module>exo.ws.frameworks.servlet</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.common</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.xml-processing</artifactId>
+ <version>${org.exoplatform.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.frameworks.json</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.testframework</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.rest.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>picocontainer</groupId>
+ <artifactId>picocontainer</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>jtidy</groupId>
+ <artifactId>jtidy</artifactId>
+ <version>4aug2000r7-dev</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <!-- <version>1.2.1</version>-->
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.3.4.O</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.6.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
15 years
exo-jcr SVN: r4255 - ws/tags.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2011-04-19 11:20:22 -0400 (Tue, 19 Apr 2011)
New Revision: 4255
Added:
ws/tags/exo.ws.frameworks.servlet-2.1.8-bonita/
Log:
WS-264 Fork for bonita
15 years
exo-jcr SVN: r4254 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-19 08:49:57 -0400 (Tue, 19 Apr 2011)
New Revision: 4254
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
Log:
EXOJCR-1311: can restore without cache locks
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2011-04-19 11:27:53 UTC (rev 4253)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2011-04-19 12:49:57 UTC (rev 4254)
@@ -39,6 +39,7 @@
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestor;
+import org.exoplatform.services.jcr.impl.backup.DummyDataRestor;
import org.exoplatform.services.jcr.impl.backup.rdbms.DBBackup;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
@@ -871,6 +872,13 @@
try
{
File contentFile = new File(storageDir, "CacheLocks" + DBBackup.CONTENT_FILE_SUFFIX);
+
+ // it is possible that backup was created on configuration without Backupable WorkspaceLockManager class
+ if (!PrivilegedFileHelper.exists(contentFile))
+ {
+ return new DummyDataRestor();
+ }
+
in = new ObjectInputStream(PrivilegedFileHelper.fileInputStream(contentFile));
int count = in.readInt();
15 years
exo-jcr SVN: r4253 - in jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src: main/java/org/exoplatform/services/jcr/webdav/command/propfind and 4 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-04-19 07:27:53 -0400 (Tue, 19 Apr 2011)
New Revision: 4253
Modified:
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java
Log:
JCR-1605 PLF-1483
What is the problem to fix?
Can't open file containing special characters (e.g Japanese characters) in file name/path via WebDav in Nautilus. In case of cadaver, when using "ls" command, cadaver can't list such files.
How is the problem fixed?
Set the selected tab after user add any permission to the wanted one.
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -35,7 +35,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.HashSet;
import java.util.Set;
@@ -172,7 +171,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- xmlStreamWriter.writeCharacters(URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8"));
+ xmlStreamWriter.writeCharacters(resource.getIdentifier().toASCIIString());
xmlStreamWriter.writeEndElement();
PropstatGroupedRepresentation propstat = new PropstatGroupedRepresentation(resource, properties, false);
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -32,7 +32,6 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
-import java.net.URLDecoder;
import java.util.Set;
import javax.jcr.RepositoryException;
@@ -172,7 +171,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- String href = URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8");
+ String href = resource.getIdentifier().toASCIIString();
if (resource.isCollection())
{
xmlStreamWriter.writeCharacters(href + "/");
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -37,7 +37,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -155,7 +154,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- xmlStreamWriter.writeCharacters(URLDecoder.decode(uri.toASCIIString(), "UTF-8"));
+ xmlStreamWriter.writeCharacters(uri.toASCIIString());
xmlStreamWriter.writeEndElement();
Map<String, Set<HierarchicalProperty>> propStats = getPropStat();
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -29,9 +29,7 @@
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import java.io.UnsupportedEncodingException;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
@@ -418,10 +416,8 @@
writer.writeStartElement(XML_NODE);
writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
- String itemName = URLDecoder.decode(node.getName(), "UTF-8");
- writer.writeAttribute(XML_NAME, itemName);
- String itemPath = node.getPath();
- writer.writeAttribute(XML_HREF, rootHref + itemPath);
+ writer.writeAttribute(XML_NAME, node.getName());
+ writer.writeAttribute(XML_HREF, rootHref + TextUtil.escape(node.getPath(), '%', true));
// add properties
for (PropertyIterator pi = node.getProperties(); pi.hasNext();)
{
@@ -437,8 +433,8 @@
{
Node childNode = ni.nextNode();
writer.writeStartElement(XML_NODE);
- writer.writeAttribute(XML_NAME, URLDecoder.decode(childNode.getName(), "UTF-8"));
- String childNodeHref = rootHref + URLDecoder.decode(childNode.getPath(), "UTF-8");
+ writer.writeAttribute(XML_NAME, childNode.getName());
+ String childNodeHref = rootHref + TextUtil.escape(childNode.getPath(), '%', true);
writer.writeAttribute(XML_HREF, childNodeHref);
writer.writeEndElement();
}
@@ -453,10 +449,6 @@
{
LOG.error("Error has occured while xml processing : ", e);
}
- catch (UnsupportedEncodingException e)
- {
- LOG.warn(e.getMessage());
- }
finally
{
try
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -20,8 +20,6 @@
import org.exoplatform.common.util.HierarchicalProperty;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -135,21 +133,8 @@
}
writeAttributes(xmlStreamWriter, prop);
+ xmlStreamWriter.writeCharacters(prop.getValue());
- if (prop.getName().getLocalPart().equals("displayname") && containsEncodedChar(prop.getValue()))
- {
- try
- {
- xmlStreamWriter.writeCharacters(URLDecoder.decode(prop.getValue(), "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- } else {
- xmlStreamWriter.writeCharacters(prop.getValue());
- }
-
xmlStreamWriter.writeEndElement();
}
}
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -30,6 +30,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.net.URLDecoder;
import javax.jcr.Node;
import javax.ws.rs.core.HttpHeaders;
@@ -101,6 +102,42 @@
assertEquals(HTTPStatus.MULTISTATUS, containerResponseFind.getStatus());
}
+ /**
+ * Here we test WebDAV PROPFIND method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters and 'displayname' element containing
+ * non-latin characters.
+ * @throws Exception
+ */
+ public void testSimplePropFindWithNonLatin() throws Exception
+ {
+ // prepare file name and content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+ String content = TestUtils.getFileContent();
+ TestUtils.addContent(session, decodedfileName, new ByteArrayInputStream(content.getBytes()), nt_webdave_file, "");
+ TestUtils.addNodeProperty(session, decodedfileName, authorProp, author);
+
+ ContainerResponse response =
+ service(WebDAVMethods.PROPFIND, getPathWS() + "/" + encodedfileName, "", null, allPropsXML.getBytes());
+
+ // serialize response entity to string
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PropFindResponseEntity entity = (PropFindResponseEntity)response.getEntity();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======PropFind response==========");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertTrue(resp.contains(decodedfileName));
+ }
+
public void testPropFind() throws Exception
{
String content = TestUtils.getFileContent();
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -25,6 +25,7 @@
import org.exoplatform.services.rest.impl.ContainerResponse;
import java.io.ByteArrayOutputStream;
+import java.net.URLDecoder;
import java.util.Calendar;
import javax.jcr.Node;
@@ -159,6 +160,52 @@
}
+ /**
+ * Here we test WebDAV PROPPATCH method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters.
+ * @throws Exception
+ */
+ public void testPropPatchWithNonLatin() throws Exception
+ {
+
+ // prepare file names, content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+
+ Node node = session.getRootNode().addNode(decodedfileName, nt_webdave_file);
+ node.setProperty(authorProp, author);
+
+ node.addNode("jcr:content", "nt:resource");
+ Node content = node.getNode("jcr:content");
+ content.setProperty("jcr:mimeType", "text/xml");
+ content.setProperty("jcr:lastModified", Calendar.getInstance());
+ content.setProperty("jcr:data", "data");
+ node.addMixin("mix:lockable");
+ session.save();
+ node.lock(true, true);
+ session.save();
+
+ ContainerResponse response =
+ service(WebDAVMethods.PROPPATCH, getPathWS() + "/" + encodedfileName, "", null, patch.getBytes());
+
+ // serialize response entity to string
+ PropPatchResponseEntity entity = (PropPatchResponseEntity)response.getEntity();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======PropPatch response=========");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertFalse(resp.contains(decodedfileName));
+ }
+
// public void testPropPatch() throws Exception {
// String description = "test description property";
// String rights = "test rights property";
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java 2011-04-19 11:11:34 UTC (rev 4252)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java 2011-04-19 11:27:53 UTC (rev 4253)
@@ -28,6 +28,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.net.URLDecoder;
import javax.ws.rs.core.MediaType;
@@ -45,6 +46,10 @@
private final String fileContent = "TEST FILE CONTENT...";
+ private final String sql = "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>"
+ + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')" + "</D:sql>" + "</D:searchrequest>";
+
+
public void testBasicSearch() throws Exception
{
@@ -55,9 +60,6 @@
// "</D:xpath>" +
// "</D:searchrequest>";
- String sql =
- "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>" + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')"
- + "</D:sql>" + "</D:searchrequest>";
InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
TestUtils.addContent(session, fileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
@@ -70,6 +72,41 @@
assertTrue(result.contains(fileName));
}
+ /**
+ * Here we test WebDAV SEARCH method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters and 'displayname' element containing
+ * non-latin characters.
+ * @throws Exception
+ */
+ public void testBasicSearchWithNonLatin() throws Exception
+ {
+ // prepare file name, content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+ InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
+ TestUtils.addContent(session, decodedfileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
+
+ ContainerResponse response = service(WebDAVMethods.SEARCH, getPathWS(), "", null, sql.getBytes());
+
+ // serialize response entity to string
+ SearchResultResponseEntity entity = (SearchResultResponseEntity)response.getEntity();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======Search response============");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertTrue(resp.contains(decodedfileName));
+
+ }
+
@Override
protected String getRepositoryName()
{
15 years
exo-jcr SVN: r4252 - in jcr/tags/1.12.8_CP01/exo.jcr.component.core: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache and 3 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-04-19 07:11:34 -0400 (Tue, 19 Apr 2011)
New Revision: 4252
Added:
jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml
Modified:
jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java
Log:
JCR-1604 - PLF-1483
What is the problem to fix?
JCR addNode within a transaction causes javax.transaction.HeuristicMixedException (internally, org.exoplatform.services.transaction.TransactionException caused by org.jboss.cache.lock.TimeoutException) in the first access to the node
How is the problem fixed?
Perform loading data in cache outside the current transaction
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml 2011-04-19 10:59:36 UTC (rev 4251)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml 2011-04-19 11:11:34 UTC (rev 4252)
@@ -383,11 +383,26 @@
<name>emma.coverage.out.file</name>
<value>target/emma/coverage.ec</value>
</property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>org/exoplatform/services/jcr/api/**/Test*.java</include>
@@ -575,6 +590,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>org/apache/jackrabbit/test/api/*Test.java</include>
@@ -647,6 +677,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<!-- From default tests -->
@@ -725,6 +770,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>**/**/reading_/Test*.java</include>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-04-19 10:59:36 UTC (rev 4251)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-04-19 11:11:34 UTC (rev 4252)
@@ -40,6 +40,7 @@
import java.util.Map;
import java.util.Set;
+import javax.transaction.Status;
import javax.transaction.TransactionManager;
/**
@@ -64,6 +65,8 @@
private final boolean useExpiration;
private final long expirationTimeOut;
+
+ private final TransactionManager tm;
protected static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache");
@@ -71,6 +74,7 @@
public BufferedJBossCache(Cache<Serializable, Object> parentCache, boolean useExpiration, long expirationTimeOut)
{
super();
+ this.tm = ((CacheSPI<Serializable, Object>)parentCache).getTransactionManager();
this.parentCache = parentCache;
this.useExpiration = useExpiration;
this.expirationTimeOut = expirationTimeOut;
@@ -109,7 +113,53 @@
//log.info("After=" + changesContainer.toString());
for (ChangesContainer cacheChange : containers)
{
- cacheChange.apply();
+ boolean isTxCreated = false;
+ try
+ {
+ if (cacheChange.isTxRequired() && tm != null && tm.getStatus() == Status.STATUS_NO_TRANSACTION)
+ {
+ // No tx exists so we create a new tx
+ if (LOG.isTraceEnabled()) LOG.trace("No Tx is active we then create a new tx");
+ tm.begin();
+ isTxCreated = true;
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Could not create a new tx", e);
+ }
+ try
+ {
+ cacheChange.apply();
+ }
+ catch (RuntimeException e)
+ {
+ if (isTxCreated)
+ {
+ try
+ {
+ if (LOG.isTraceEnabled()) LOG.trace("An error occurs the tx will be rollbacked");
+ tm.rollback();
+ }
+ catch (Exception e1)
+ {
+ LOG.warn("Could not rollback the tx", e1);
+ }
+ }
+ throw e;
+ }
+ if (isTxCreated)
+ {
+ try
+ {
+ if (LOG.isTraceEnabled()) LOG.trace("The tx will be committed");
+ tm.commit();
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Could not commit the tx", e);
+ }
+ }
}
}
finally
@@ -118,6 +168,7 @@
changesContainer = null;
}
}
+
/**
* Tries to get buffer and if it is null throws an exception otherwise returns buffer.
@@ -471,6 +522,31 @@
return parentCache.get(fqn, key);
}
+ /**
+ * in case putIfAbsent is set to <code>true</code> this method will call cache.putIfAbsent(Fqn fqn, Serializable key, Object value)
+ * otherwise it will call cache.put(Fqn fqn, Serializable key, Object value)
+ */
+ protected Object put(Fqn fqn, Serializable key, Object value, boolean putIfAbsent)
+ {
+ if (putIfAbsent)
+ {
+ putIfAbsent(fqn, key, value);
+ return null;
+ }
+ return put(fqn, key, value);
+ }
+
+ /**
+ * This method will create and add a ChangesContainer that will put the value only if no value has been added
+ */
+ protected Object putIfAbsent(Fqn fqn, Serializable key, Object value)
+ {
+ CompressedChangesBuffer changesContainer = getChangesBufferSafe();
+ changesContainer.add(new PutIfAbsentKeyValueContainer(fqn, key, value, parentCache, changesContainer
+ .getHistoryIndex(), local.get(), useExpiration, expirationTimeOut));
+ return null;
+ }
+
public Object putInBuffer(Fqn fqn, Serializable key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
@@ -758,6 +834,11 @@
}
public abstract void apply();
+
+ public boolean isTxRequired()
+ {
+ return false;
+ }
}
/**
@@ -789,6 +870,48 @@
}
/**
+ * PutIfAbsent container.
+ */
+ public static class PutIfAbsentKeyValueContainer extends ChangesContainer
+ {
+ private final Serializable key;
+
+ private final Object value;
+
+ public PutIfAbsentKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public void apply()
+ {
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
+ if (cache.get(fqn, key) != null)
+ {
+ // skip
+ return;
+ }
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
+ setCacheLocalMode();
+ cache.put(fqn, key, value);
+ }
+
+ @Override
+ public boolean isTxRequired()
+ {
+ return true;
+ }
+ }
+
+ /**
* Put container.
*/
public static class PutKeyValueContainer extends ChangesContainer
@@ -871,6 +994,12 @@
+ existingObject.getClass().getName());
}
}
+
+ @Override
+ public boolean isTxRequired()
+ {
+ return true;
+ }
}
/**
@@ -913,6 +1042,12 @@
cache.put(fqn, key, newSet);
}
}
+
+ @Override
+ public boolean isTxRequired()
+ {
+ return false;
+ }
}
/**
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-04-19 10:59:36 UTC (rev 4251)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-04-19 11:11:34 UTC (rev 4252)
@@ -60,6 +60,7 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
+import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
/**
@@ -417,7 +418,7 @@
cache.setLocal(false);
if (!inTransaction)
{
- cache.commitTransaction();
+ dedicatedTxCommit();
}
}
}
@@ -556,23 +557,20 @@
cache.setLocal(true);
- // remove previous all
- cache.removeNode(makeRefFqn(identifier));
-
Set<Object> set = new HashSet<Object>();
for (PropertyData prop : refProperties)
{
putProperty(prop, ModifyChildOption.NOT_MODIFY);
set.add(prop.getIdentifier());
}
- cache.put(makeRefFqn(identifier), ITEM_LIST, set);
+ cache.putIfAbsent(makeRefFqn(identifier), ITEM_LIST, set);
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
- cache.commitTransaction();
+ dedicatedTxCommit();
}
}
}
@@ -592,8 +590,6 @@
}
cache.setLocal(true);
- // remove previous all (to be sure about consistency)
- cache.removeNode(makeChildListFqn(childNodesList, parent.getIdentifier()));
if (childs.size() > 0)
{
@@ -603,12 +599,13 @@
putNode(child, ModifyChildOption.NOT_MODIFY);
set.add(child.getIdentifier());
}
- cache.put(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST, set);
+ cache.putIfAbsent(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST, set);
}
else
{
// cache fact of empty childs list
- cache.put(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST, new HashSet<Object>());
+ cache.putIfAbsent(makeChildListFqn(childNodesList, parent.getIdentifier()), ITEM_LIST,
+ new HashSet<Object>());
}
}
finally
@@ -616,7 +613,7 @@
cache.setLocal(false);
if (!inTransaction)
{
- cache.commitTransaction();
+ dedicatedTxCommit();
}
}
}
@@ -634,8 +631,6 @@
cache.beginTransaction();
}
cache.setLocal(true);
- // remove previous all (to be sure about consistency)
- cache.removeNode(makeChildListFqn(childPropsList, parent.getIdentifier()));
if (childs.size() > 0)
{
// add all new
@@ -645,7 +640,7 @@
putProperty(child, ModifyChildOption.NOT_MODIFY);
set.add(child.getIdentifier());
}
- cache.put(makeChildListFqn(childPropsList, parent.getIdentifier()), ITEM_LIST, set);
+ cache.putIfAbsent(makeChildListFqn(childPropsList, parent.getIdentifier()), ITEM_LIST, set);
}
else
@@ -658,7 +653,7 @@
cache.setLocal(false);
if (!inTransaction)
{
- cache.commitTransaction();
+ dedicatedTxCommit();
}
}
}
@@ -669,17 +664,6 @@
public void addChildPropertiesList(NodeData parent, List<PropertyData> childProperties)
{
// TODO not implemented, will force read from DB
- // try
- // {
- // cache.beginTransaction();
- // cache.setLocal(true);
- //
- // }
- // finally
- // {
- // cache.setLocal(false);
- // cache.commitTransaction();
- // }
}
/**
@@ -945,18 +929,19 @@
if (node.getParentIdentifier() != null)
{
// add in CHILD_NODES
- cache.put(
- makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier(),
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
- cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST,
- node.getIdentifier(), modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
+ cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST, node
+ .getIdentifier(), modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
}
}
// add in ITEMS
- return (ItemData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
+ return (ItemData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
protected ItemData putNodeInBufferedCache(NodeData node, ModifyChildOption modifyListsOfChild)
@@ -965,14 +950,13 @@
if (node.getParentIdentifier() != null)
{
// add in CHILD_NODES
- cache.put(
- makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
- cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST,
- node.getIdentifier(), modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
+ cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST, node
+ .getIdentifier(), modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
}
}
// add in ITEMS
@@ -988,9 +972,8 @@
protected PropertyData putProperty(PropertyData prop, ModifyChildOption modifyListsOfChild)
{
// add in CHILD_PROPS
- cache.put(
- makeChildFqn(childProps, prop.getParentIdentifier(),
- prop.getQPath().getEntries()[prop.getQPath().getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
+ cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
+ .getEntries().length - 1]), ITEM_ID, prop.getIdentifier(), modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
@@ -1025,7 +1008,8 @@
}
// add in ITEMS
- return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop);
+ return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
protected void removeItem(ItemData item)
@@ -1041,8 +1025,8 @@
.getQPath().getEntries().length - 1]));
// remove from CHILD_NODES_LIST of parent
- cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST,
- item.getIdentifier());
+ cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST, item
+ .getIdentifier());
// remove from CHILD_NODES as parent
cache.removeNode(makeChildListFqn(childNodes, item.getIdentifier()));
@@ -1066,8 +1050,8 @@
.getQPath().getEntries().length - 1]));
// remove from CHILD_PROPS_LIST
- cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST,
- item.getIdentifier());
+ cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST, item
+ .getIdentifier());
}
// remove from ITEMS
cache.removeNode(makeItemFqn(item.getIdentifier()));
@@ -1096,10 +1080,10 @@
}
/**
- * Update Node hierachy in case of same-name siblings reorder.
- * Assumes the new (updated) nodes already putted in the cache. Previous name of updated nodes will be calculated
- * and that node will be deleted (if has same id as the new node). Childs paths will be updated to a new node path.
- *
+ * Update Node hierarchy in case of same-name siblings reorder.
+ * Assumes the new (updated) nodes already put in the cache. Previous name of updated nodes will be calculated
+ * and that node will be deleted (if has same id as the new node). Children paths will be updated to a new node path. *
+ *
* @param node NodeData
* @param prevNode NodeData
*/
@@ -1205,9 +1189,9 @@
NodeData prevNode = (NodeData)data;
TransientNodeData newNode =
- new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
- prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
+ new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
+ .getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
+ .getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
}
@@ -1225,8 +1209,8 @@
}
TransientPropertyData newProp =
- new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
- prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+ new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
+ .getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
}
@@ -1260,8 +1244,8 @@
QPath
.makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
TransientPropertyData newProp =
- new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
- prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+ new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
+ .getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
@@ -1274,9 +1258,9 @@
QPath
.makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
TransientNodeData newNode =
- new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
- prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
+ new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
+ .getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
+ .getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
@@ -1292,22 +1276,22 @@
*/
protected void updateChildsACL(final String parentId, final AccessControlList acl)
{
- for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
+ loop : for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
{
NodeData prevNode = iter.next();
- // is ACL changes on this node (i.e. ACL inheritance brokes)
+ // is ACL changes on this node (i.e. ACL inheritance broken)
for (InternalQName mixin : prevNode.getMixinTypeNames())
{
if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
{
- continue;
+ continue loop;
}
}
// recreate with new path for child Nodes only
TransientNodeData newNode =
new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
- prevNode.getParentIdentifier(), acl);
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
+ .getParentIdentifier(), acl);
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
@@ -1347,4 +1331,44 @@
NOT_MODIFY, MODIFY, FORCE_MODIFY
}
+ /**
+ * Allows to commit the cache changes in a dedicated XA Tx in order to avoid potential
+ * deadlocks
+ */
+ private void dedicatedTxCommit()
+ {
+ // Ensure that the commit is done in a dedicated tx to avoid deadlock due
+ // to global XA Tx
+ TransactionManager tm = getTransactionManager();
+ Transaction tx = null;
+ try
+ {
+ if (tm != null)
+ {
+ try
+ {
+ tx = tm.suspend();
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Cannot suspend the current transaction", e);
+ }
+ }
+ cache.commitTransaction();
+ }
+ finally
+ {
+ if (tx != null)
+ {
+ try
+ {
+ tm.resume(tx);
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Cannot resume the current transaction", e);
+ }
+ }
+ }
+ }
}
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java 2011-04-19 10:59:36 UTC (rev 4251)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java 2011-04-19 11:11:34 UTC (rev 4252)
@@ -71,6 +71,60 @@
return ntFile;
}
+ public void testSpecialCharacters() throws Exception
+ {
+ Node queryNode = testNode.addNode("node-testSpecialCharacters");
+ String[] specialChar = {"a", "+", "-", "&&", "||", "!", "(", ")", "{", "}", "[", "]", "^","\"", "~", "*", "?", ":", "\\", "&", "$", "@", "%", "|", "(1+1):2", "\\(1\\+1\\)\\:2"};
+ StringBuilder buffer = new StringBuilder();
+ for (String sChar : specialChar)
+ {
+ buffer.append(' ').append(sChar);
+ }
+ queryNode.setProperty("full-content", buffer.toString());
+ session.save();
+ for (String sChar : specialChar)
+ {
+ QueryManager manager = session.getWorkspace().getQueryManager();
+ String sqlQuery = "SELECT * FROM nt:base WHERE jcr:path LIKE '" + testNode.getPath() + "/%' and contains(*, '" + sChar + "')";
+ Query query = manager.createQuery(sqlQuery, Query.SQL);
+
+ QueryResult queryResult;
+ try
+ {
+ queryResult = query.execute();
+ assertNotNull(queryResult.getNodes());
+ if (queryResult.getNodes().hasNext())
+ System.out.println("It works well with '" + sChar + "' path =" + queryResult.getNodes().nextNode().getPath());
+ else
+ System.err.println("No results could be found for '" + sChar + "'");
+ }
+ catch (Exception e)
+ {
+ System.err.println("It fails with '" + sChar + "' let's escape it");
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < sChar.length(); i++)
+ {
+ sb.append('\\').append(sChar.charAt(i));
+ }
+ sChar = sb.toString();
+ sqlQuery = "SELECT * FROM nt:base WHERE jcr:path LIKE '" + testNode.getPath() + "/%' and contains(*, '" + sChar + "')";
+ query = manager.createQuery(sqlQuery, Query.SQL);
+ try
+ {
+ queryResult = query.execute();
+ assertNotNull(queryResult.getNodes());
+ if (queryResult.getNodes().hasNext())
+ System.out.println("It works well with '" + sChar + "' path =" + queryResult.getNodes().nextNode().getPath());
+ else
+ System.err.println("No results could be found for '" + sChar + "'");
+ }
+ catch (Exception e1)
+ {
+ System.out.println("It fails also with '" + sChar + "'");
+ }
+ }
+ }
+ }
public void testAllofNodeType() throws Exception
{
Added: jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (rev 0)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java 2011-04-19 11:11:34 UTC (rev 4252)
@@ -0,0 +1,648 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
+import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
+import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.transaction.TransactionService;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
+/**
+ * @author <a href="mailto:nicolas.filotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ */
+public class TestJBossCacheWorkspaceStorageCacheInClusterMode extends JcrImplBaseTest
+{
+
+ public JBossCacheWorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ TransactionService transactionService =
+ (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
+
+ ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
+ list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
+ "jar:/conf/standalone/cluster/test-jbosscache-data-no-mux.xml"));
+ list.add(new SimpleParameterEntry("jbosscache-cluster-name", "TestJBossCacheWorkspaceStorageCacheInClusterMode"));
+
+ CacheEntry entry = new CacheEntry(list);
+ WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setCache(entry);
+ return new JBossCacheWorkspaceStorageCache(workspaceEntry,
+ transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
+ }
+
+ public void testRaceConditions() throws Exception
+ {
+ JBossCacheWorkspaceStorageCache cache1 = null, cache2 = null;
+ try
+ {
+ MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
+ WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
+ CacheableWorkspaceDataManager cwdmNode1 =
+ new CacheableWorkspaceDataManager(wdc, cache1 = getCacheImpl(), new SystemDataContainerHolder(wdc));
+ CacheableWorkspaceDataManager cwdmNode2 =
+ new CacheableWorkspaceDataManager(wdc, cache2 = getCacheImpl(), new SystemDataContainerHolder(wdc));
+ NodeData parentNode = new PersistedNodeData("parent-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ // Test getChildNodesData
+ Action readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getChildNodesData(parentNode);
+ }
+ };
+ Action writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getChildNodesData(parentNode);
+ chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdm.save(chlog);
+ }
+ };
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
+ parentNode = new PersistedNodeData("parent-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node2")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
+ // Test getChildPropertiesData
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getChildPropertiesData(parentNode);
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getChildPropertiesData(parentNode);
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdm.save(chlog);
+ }
+ };
+ parentNode = new PersistedNodeData("parent-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node3")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
+ parentNode = new PersistedNodeData("parent-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node4")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
+ // Test getReferencesData
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getReferencesData(parentNode.getIdentifier(), false);
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getReferencesData(parentNode.getIdentifier(), false);
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
+ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
+ cwdm.save(chlog);
+ }
+ };
+ parentNode = new PersistedNodeData("parent-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node5")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
+ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
+ parentNode = new PersistedNodeData("parent-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node6")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
+ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
+
+ // Test getItemData by Id
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getItemData(parentNode.getIdentifier());
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getItemData(parentNode.getIdentifier());
+ chlog.add(ItemState.createUpdatedState(new PersistedNodeData(parentNode.getIdentifier(), parentNode.getQPath(), Constants.ROOT_UUID, 2, 1,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdm.save(chlog);
+ }
+ };
+ parentNode = new PersistedNodeData("parent-id7", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node7")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getItemData(parentNode.getIdentifier()));
+ assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
+ assertNotNull(cwdmNode2.getItemData(parentNode.getIdentifier()));
+ assertEquals(2, cwdmNode2.getItemData(parentNode.getIdentifier()).getPersistedVersion());
+ parentNode = new PersistedNodeData("parent-id8", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node8")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getItemData(parentNode.getIdentifier()));
+ assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
+ assertNotNull(cwdmNode2.getItemData(parentNode.getIdentifier()));
+ assertEquals(2, cwdmNode2.getItemData(parentNode.getIdentifier()).getPersistedVersion());
+
+ // Test getItemData by Path
+ final QPathEntry qpe = new QPathEntry(null, "my-property", 1);
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getItemData(parentNode, qpe, ItemType.PROPERTY);
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getItemData(parentNode, qpe, ItemType.PROPERTY);
+ chlog.add(ItemState.createUpdatedState(new PersistedPropertyData("property-by-path"
+ + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), qpe), parentNode
+ .getIdentifier(), 2, PropertyType.STRING, false, Arrays
+ .asList((ValueData)new ByteArrayPersistedValueData(0, "some new data".getBytes("UTF-8"))))));
+ cwdm.save(chlog);
+ }
+ };
+ parentNode = new PersistedNodeData("parent-id9", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node9")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY));
+ assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+ assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
+ assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+ parentNode = new PersistedNodeData("parent-id10", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node10")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY));
+ assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+ assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
+ assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+ }
+ finally
+ {
+ if (cache1 != null)
+ {
+ try
+ {
+ cache1.cache.stop();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
+ }
+ if (cache2 != null)
+ {
+ try
+ {
+ cache2.cache.stop();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
+ }
+ }
+ }
+
+ /**
+ * @param con
+ * @param cwdm
+ * @param mode
+ * @param idNode
+ * @throws InterruptedException
+ */
+ private void executeConcurrentReadNWrite(final MyWorkspaceStorageConnection con, final Action readAction,
+ final Action writeAction, final Mode mode, final NodeData parentNode) throws InterruptedException
+ {
+ final CountDownLatch goSignal = con.initCountDownLatch();
+ con.setParentNode(parentNode);
+ final AtomicReference<Exception> ex = new AtomicReference<Exception>();
+ final CountDownLatch startSignal = new CountDownLatch(1);
+ final CountDownLatch doneSignal = new CountDownLatch(2);
+ Thread writer = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ startSignal.await();
+ con.wait.set(mode != Mode.WRITE_FIRST);
+ writeAction.execute(parentNode);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ ex.set(e);
+ }
+ finally
+ {
+ if (mode == Mode.WRITE_FIRST) goSignal.countDown();
+ doneSignal.countDown();
+ }
+ }
+ };
+ writer.start();
+ Thread reader = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ startSignal.await();
+ con.wait.set(mode != Mode.READ_FIRST);
+ readAction.execute(parentNode);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ ex.set(e);
+ }
+ finally
+ {
+ if (mode == Mode.READ_FIRST) goSignal.countDown();
+ doneSignal.countDown();
+ }
+ }
+ };
+ reader.start();
+ startSignal.countDown();
+ doneSignal.await();
+ assertNull(ex.get());
+ }
+
+ private abstract class Action
+ {
+
+ protected final CacheableWorkspaceDataManager cwdm;
+ public Action(CacheableWorkspaceDataManager cwdm)
+ {
+ this.cwdm = cwdm;
+ }
+ protected abstract void execute(NodeData parentNode) throws Exception;
+ }
+ private static enum Mode
+ {
+ READ_FIRST, WRITE_FIRST;
+ }
+ private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+ {
+ public ThreadLocal<Boolean> wait = new ThreadLocal<Boolean>();
+ private NodeData parentNode;
+ private CountDownLatch goSignal;
+
+ public CountDownLatch initCountDownLatch()
+ {
+ return this.goSignal = new CountDownLatch(1);
+ }
+
+ public void setParentNode(NodeData parentNode)
+ {
+ this.parentNode = parentNode;
+ }
+
+ public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void close() throws IllegalStateException, RepositoryException
+ {
+ }
+
+ public void commit() throws IllegalStateException, RepositoryException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ return -1;
+ }
+
+ public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ List<NodeData> children = new ArrayList<NodeData>();
+ children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
+ return children;
+ }
+
+ public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException,
+ IllegalStateException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ try
+ {
+ children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+ return children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
+ IllegalStateException
+ {
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ if (itemType == ItemType.NODE)
+ {
+ return new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), name), Constants.ROOT_UUID, 1, 1,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ }
+ try
+ {
+ return new PersistedPropertyData("property-by-path"
+ + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), name), parentNode
+ .getIdentifier(), 1, PropertyType.STRING, false, Arrays
+ .asList((ValueData)new ByteArrayPersistedValueData(0, "some new data".getBytes("UTF-8"))));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ return parentNode;
+ }
+
+ public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException,
+ IllegalStateException, UnsupportedOperationException
+ {
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ try
+ {
+ children.add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
+ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8")))));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+ return children;
+ }
+
+ public boolean isOpened()
+ {
+ return true;
+ }
+
+ public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException,
+ IllegalStateException
+ {
+ return null;
+ }
+
+ public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void rollback() throws IllegalStateException, RepositoryException
+ {
+ }
+
+ public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+ };
+
+ private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
+ {
+
+ private WorkspaceStorageConnection con;
+
+ public MyWorkspaceDataContainer(WorkspaceStorageConnection con)
+ {
+ this.con = con;
+ }
+
+ public boolean isCheckSNSNewConnection()
+ {
+ return false;
+ }
+
+ public boolean isSame(WorkspaceDataContainer another)
+ {
+ return false;
+ }
+
+ public WorkspaceStorageConnection openConnection() throws RepositoryException
+ {
+ return con;
+ }
+
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ return con;
+ }
+
+ public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
+ {
+ return con;
+ }
+
+ public String getInfo()
+ {
+ return "MyWorkspaceDataContainer";
+ }
+
+ public String getName()
+ {
+ return "MyWorkspaceDataContainer";
+ }
+
+ public String getStorageVersion()
+ {
+ return "0";
+ }
+ };
+}
\ No newline at end of file
Added: jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml (rev 0)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml 2011-04-19 11:11:34 UTC (rev 4252)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="500" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+ <transaction syncRollbackPhase="true" syncCommitPhase="true" />
+
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <sync replTimeout="20000"/>
+ <jgroupsConfig configFile="udp.xml">
+ </jgroupsConfig>
+ </clustering>
+
+ <!-- Eviction configuration -->
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+ actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
+ eventQueueSize="1000000">
+ <property name="maxNodes" value="1000000" />
+ <property name="warnNoExpirationKey" value="false" />
+ </default>
+ </eviction>
+</jbosscache>
\ No newline at end of file
15 years
exo-jcr SVN: r4251 - jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1604.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-04-19 06:59:36 -0400 (Tue, 19 Apr 2011)
New Revision: 4251
Modified:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1604/JCR-1604.patch
Log:
JCR-1604: Patch with the right system properties
Modified: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1604/JCR-1604.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1604/JCR-1604.patch 2011-04-19 10:38:33 UTC (rev 4250)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1604/JCR-1604.patch 2011-04-19 10:59:36 UTC (rev 4251)
@@ -652,6 +652,71 @@
+ };
+}
\ No newline at end of file
+Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java
+===================================================================
+--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java (revision 4238)
++++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/search/TestSearch.java (working copy)
+@@ -71,6 +71,60 @@
+ return ntFile;
+ }
+
++ public void testSpecialCharacters() throws Exception
++ {
++ Node queryNode = testNode.addNode("node-testSpecialCharacters");
++ String[] specialChar = {"a", "+", "-", "&&", "||", "!", "(", ")", "{", "}", "[", "]", "^","\"", "~", "*", "?", ":", "\\", "&", "$", "@", "%", "|", "(1+1):2", "\\(1\\+1\\)\\:2"};
++ StringBuilder buffer = new StringBuilder();
++ for (String sChar : specialChar)
++ {
++ buffer.append(' ').append(sChar);
++ }
++ queryNode.setProperty("full-content", buffer.toString());
++ session.save();
++ for (String sChar : specialChar)
++ {
++ QueryManager manager = session.getWorkspace().getQueryManager();
++ String sqlQuery = "SELECT * FROM nt:base WHERE jcr:path LIKE '" + testNode.getPath() + "/%' and contains(*, '" + sChar + "')";
++ Query query = manager.createQuery(sqlQuery, Query.SQL);
++
++ QueryResult queryResult;
++ try
++ {
++ queryResult = query.execute();
++ assertNotNull(queryResult.getNodes());
++ if (queryResult.getNodes().hasNext())
++ System.out.println("It works well with '" + sChar + "' path =" + queryResult.getNodes().nextNode().getPath());
++ else
++ System.err.println("No results could be found for '" + sChar + "'");
++ }
++ catch (Exception e)
++ {
++ System.err.println("It fails with '" + sChar + "' let's escape it");
++ StringBuilder sb = new StringBuilder();
++ for (int i = 0; i < sChar.length(); i++)
++ {
++ sb.append('\\').append(sChar.charAt(i));
++ }
++ sChar = sb.toString();
++ sqlQuery = "SELECT * FROM nt:base WHERE jcr:path LIKE '" + testNode.getPath() + "/%' and contains(*, '" + sChar + "')";
++ query = manager.createQuery(sqlQuery, Query.SQL);
++ try
++ {
++ queryResult = query.execute();
++ assertNotNull(queryResult.getNodes());
++ if (queryResult.getNodes().hasNext())
++ System.out.println("It works well with '" + sChar + "' path =" + queryResult.getNodes().nextNode().getPath());
++ else
++ System.err.println("No results could be found for '" + sChar + "'");
++ }
++ catch (Exception e1)
++ {
++ System.out.println("It fails also with '" + sChar + "'");
++ }
++ }
++ }
++ }
+ public void testAllofNodeType() throws Exception
+ {
+
Index: exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml
===================================================================
--- exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data-no-mux.xml (revision 0)
@@ -684,7 +749,7 @@
\ No newline at end of file
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java (revision 4237)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java (revision 4238)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java (working copy)
@@ -40,6 +40,7 @@
import java.util.Map;
@@ -895,7 +960,7 @@
/**
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4237)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4238)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (working copy)
@@ -60,6 +60,7 @@
@@ -1244,3 +1309,105 @@
+ }
+ }
}
+Index: exo.jcr.component.core/pom.xml
+===================================================================
+--- exo.jcr.component.core/pom.xml (revision 4238)
++++ exo.jcr.component.core/pom.xml (working copy)
+@@ -383,11 +383,26 @@
+ <name>emma.coverage.out.file</name>
+ <value>target/emma/coverage.ec</value>
+ </property>
+- <!-- Uncomment the line below if you want to enable the statistics -->
+- <!--property>
+- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+- <value>true</value>
+- </property-->
++ <!-- Uncomment the line below if you want to enable the statistics -->
++ <!--property>
++ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
++ <value>true</value>
++ </property-->
++ <!-- We add this system property due to some incompatibility between IPv6 and
++ some JVM of Linux distributions such as Ubuntu and Fedora-->
++ <property>
++ <name>java.net.preferIPv4Stack</name>
++ <value>true</value>
++ </property>
++ <!-- Avoid the firewall -->
++ <property>
++ <name>bind.address</name>
++ <value>127.0.0.1</value>
++ </property>
++ <property>
++ <name>jgroups.stack</name>
++ <value>udp</value>
++ </property>
+ </systemProperties>
+ <includes>
+ <include>org/exoplatform/services/jcr/api/**/Test*.java</include>
+@@ -575,6 +590,21 @@
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
++ <!-- We add this system property due to some incompatibility between IPv6 and
++ some JVM of Linux distributions such as Ubuntu and Fedora-->
++ <property>
++ <name>java.net.preferIPv4Stack</name>
++ <value>true</value>
++ </property>
++ <!-- Avoid the firewall -->
++ <property>
++ <name>bind.address</name>
++ <value>127.0.0.1</value>
++ </property>
++ <property>
++ <name>jgroups.stack</name>
++ <value>udp</value>
++ </property>
+ </systemProperties>
+ <includes>
+ <include>org/apache/jackrabbit/test/api/*Test.java</include>
+@@ -647,6 +677,21 @@
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
++ <!-- We add this system property due to some incompatibility between IPv6 and
++ some JVM of Linux distributions such as Ubuntu and Fedora-->
++ <property>
++ <name>java.net.preferIPv4Stack</name>
++ <value>true</value>
++ </property>
++ <!-- Avoid the firewall -->
++ <property>
++ <name>bind.address</name>
++ <value>127.0.0.1</value>
++ </property>
++ <property>
++ <name>jgroups.stack</name>
++ <value>udp</value>
++ </property>
+ </systemProperties>
+ <includes>
+ <!-- From default tests -->
+@@ -725,6 +770,21 @@
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
++ <!-- We add this system property due to some incompatibility between IPv6 and
++ some JVM of Linux distributions such as Ubuntu and Fedora-->
++ <property>
++ <name>java.net.preferIPv4Stack</name>
++ <value>true</value>
++ </property>
++ <!-- Avoid the firewall -->
++ <property>
++ <name>bind.address</name>
++ <value>127.0.0.1</value>
++ </property>
++ <property>
++ <name>jgroups.stack</name>
++ <value>udp</value>
++ </property>
+ </systemProperties>
+ <includes>
+ <include>**/**/reading_/Test*.java</include>
15 years