gatein SVN: r7454 - in portal/trunk/component/web/controller: src/main/java/org/exoplatform/web and 13 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-09-16 08:28:21 -0400 (Fri, 16 Sep 2011)
New Revision: 7454
Added:
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/BitStack.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Regex.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RegexFactory.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/ControllerRendererDriver.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/NullAppendable.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/Standalone.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/JRegexFactory.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/RegexTestCase.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBitStack.java
portal/trunk/component/web/controller/src/test/resources/
portal/trunk/component/web/controller/src/test/resources/org/
portal/trunk/component/web/controller/src/test/resources/org/exoplatform/
portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/
portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/
portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/performance/
portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/performance/controller.xml
Modified:
portal/trunk/component/web/controller/pom.xml
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/QualifiedName.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerDescriptor.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParam.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RouteEscaper.java
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPatternBuilder.java
Log:
GTNPORTAL-2106 : Navigation controller renderer performance improvements
Modified: portal/trunk/component/web/controller/pom.xml
===================================================================
--- portal/trunk/component/web/controller/pom.xml 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/pom.xml 2011-09-16 12:28:21 UTC (rev 7454)
@@ -31,6 +31,11 @@
<description>The GateIn web controller takes care of managing portal requests and delegate the processing to
the appropriate subsystem.</description>
+ <properties>
+ <japex.runIterations>100000</japex.runIterations>
+ <japex.numberOfThreads>1</japex.numberOfThreads>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
@@ -44,6 +49,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.portal</artifactId>
</dependency>
+
<!-- Used only for pretty printing, need to find a better solution than this -->
<!--
<dependency>
@@ -67,5 +73,104 @@
<groupId>org.staxnav</groupId>
<artifactId>staxnav.core</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.jregex</groupId>
+ <artifactId>jregex</artifactId>
+ <version>1.2_01</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.japex</groupId>
+ <artifactId>japex</artifactId>
+ <version>1.2.3</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.sun.japex</groupId>
+ <artifactId>japex-maven-plugin</artifactId>
+ <version>1.2.3</version>
+ <executions>
+ <execution>
+ <id>japex</id>
+ <goals>
+ <goal>japex</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <japexConfig>
+ <testSuite name="ParsingPerformance" xmlns="http://www.sun.com/japex/testSuite">
+ <param name="japex.namedClassPath" value="maven.test.classpath"/>
+ <param name="japex.resultUnit" value="ms"/>
+ <param name="japex.warmupIterations" value="10000"/>
+ <param name="japex.runIterations" value="${japex.runIterations}"/>
+ <param name="japex.numberOfThreads" value="${japex.numberOfThreads}"/>
+ <driver name="JavaUtilRegex">
+ <param name="japex.driverClass" value="org.exoplatform.web.controller.performance.ControllerRendererDriver"/>
+ <param name="description" value="Controller performance with the java.util.regex package"/>
+ <param name="regex" value="java"/>
+ </driver>
+ <driver name="JRegex">
+ <param name="japex.driverClass" value="org.exoplatform.web.controller.performance.ControllerRendererDriver"/>
+ <param name="description" value="Controller performance with the jregex package"/>
+ <param name="regex" value="jregex"/>
+ </driver>
+ <testCase name="classic">
+ <param name="parameters" value="{ 'gtn:handler' : 'portal', 'gtn:sitetype' : 'portal' , 'gtn:sitename' : 'classic', 'gtn:path' : 'page' }"/>
+ </testCase>
+ <testCase name="fr/classic">
+ <param name="parameters" value="{ 'gtn:handler' : 'portal', 'gtn:lang' : 'fr', 'gtn:sitetype' : 'portal' , 'gtn:sitename' : 'classic', 'gtn:path' : 'page' }"/>
+ </testCase>
+ <testCase name="group">
+ <param name="parameters" value="{ 'gtn:handler' : 'portal', 'gtn:sitetype' : 'group' , 'gtn:sitename' : '/platform/administrator', 'gtn:path' : 'page' }"/>
+ </testCase>
+ <testCase name="user">
+ <param name="parameters" value="{ 'gtn:handler' : 'portal', 'gtn:sitetype' : 'user' , 'gtn:sitename' : 'root', 'gtn:path' : 'page' }"/>
+ </testCase>
+ </testSuite>
+ </japexConfig>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>japex</id>
+ <properties>
+ <japex.runIterations>1000000</japex.runIterations>
+ <japex.numberOfThreads>4</japex.numberOfThreads>
+ </properties>
+ </profile>
+ <profile>
+ <!-- A never ending test used to profile the rendering execution -->
+ <id>standalone</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/Standalone.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -20,6 +20,7 @@
package org.exoplatform.web;
import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.router.RenderContext;
import org.exoplatform.web.controller.router.Router;
import org.exoplatform.web.controller.router.URIWriter;
@@ -53,6 +54,9 @@
/** . */
private final String contextName;
+ /** . */
+ private final RenderContext renderContext;
+
public ControllerContext(
WebAppController controller,
Router router,
@@ -66,6 +70,7 @@
this.parameters = parameters;
this.contextName = request.getContextPath().substring(1);
this.router = router;
+ this.renderContext = new RenderContext();
}
public WebAppController getController()
@@ -88,14 +93,11 @@
return parameters.get(parameter);
}
- public void renderURL(Map<QualifiedName, String> parameters, URIWriter renderContext) throws IOException
+ public void renderURL(Map<QualifiedName, String> parameters, URIWriter uriWriter) throws IOException
{
- renderContext.append('/');
-
- //
- renderContext.appendSegment(contextName);
-
- //
- router.render(parameters, renderContext);
+ renderContext.reset(parameters);
+ uriWriter.append('/');
+ uriWriter.appendSegment(contextName);
+ router.render(renderContext, uriWriter);
}
}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/QualifiedName.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/QualifiedName.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/QualifiedName.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -92,6 +92,9 @@
/** The name. */
private final String name;
+ /** The cached hash code. */
+ private int hashCode;
+
private QualifiedName(String name) throws NullPointerException, IllegalArgumentException
{
this("", name);
@@ -119,6 +122,7 @@
//
this.qualifier = qualifier;
this.name = name;
+ this.hashCode = qualifier.hashCode() ^ name.hashCode();
}
/**
@@ -161,7 +165,7 @@
@Override
public int hashCode()
{
- return qualifier.hashCode() ^ name.hashCode();
+ return hashCode;
}
@Override
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerDescriptor.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerDescriptor.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerDescriptor.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -19,6 +19,7 @@
package org.exoplatform.web.controller.metadata;
+import org.exoplatform.web.controller.router.RegexFactory;
import org.exoplatform.web.controller.router.RouterConfigException;
import org.exoplatform.web.controller.router.Router;
@@ -94,4 +95,9 @@
{
return new Router(this);
}
+
+ public Router build(RegexFactory regexFactory) throws RouterConfigException
+ {
+ return new Router(this, regexFactory);
+ }
}
Added: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/BitStack.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/BitStack.java (rev 0)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/BitStack.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,194 @@
+/*
+ * 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.web.controller.router;
+
+/**
+ * A bit stack optimized for speed.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class BitStack
+{
+
+ private static class Frame
+ {
+
+ /** . */
+ private Frame previous;
+
+ /** . */
+ private Frame next;
+
+ /** . */
+ private long bits;
+
+ /** . */
+ private int cardinality;
+
+ private Frame()
+ {
+ this(0, 0);
+ }
+
+ private Frame(long bits, int cardinality)
+ {
+ this.previous = null;
+ this.next = null;
+ this.bits = bits;
+ this.cardinality = cardinality;
+ }
+ }
+
+ /** . */
+ private Frame head;
+
+ /** . */
+ private Frame current;
+
+ /** . */
+ private int depth;
+
+ /** . */
+ private int size;
+
+ BitStack()
+ {
+ this.current = null;
+ this.depth = 0;
+ this.size = 0;
+ }
+
+ void init(int size)
+ {
+ if (depth > 0)
+ {
+ throw new IllegalStateException();
+ }
+ if (size < 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.size = size;
+ }
+
+ void reset()
+ {
+ if (depth > 0)
+ {
+ throw new IllegalStateException();
+ }
+ this.size = 0;
+ }
+
+ void push()
+ {
+ if (current == null)
+ {
+ if (head == null)
+ {
+ head = new Frame();
+ }
+ current = head;
+ depth++;
+ }
+ else
+ {
+ if (current.next == null)
+ {
+ Frame next = new Frame(current.bits, current.cardinality);
+ current.next = next;
+ next.previous = current;
+ current = next;
+ depth++;
+ }
+ else
+ {
+ Frame next = current.next;
+ next.bits = current.bits;
+ next.cardinality = current.cardinality;
+ current = next;
+ depth++;
+ }
+ }
+ }
+
+ void pop()
+ {
+ if (depth == 0)
+ {
+ throw new IllegalStateException();
+ }
+ current = current.previous;
+ depth--;
+ }
+
+ int getDepth()
+ {
+ return depth;
+ }
+
+ void set(int index)
+ {
+ if (index > 63)
+ {
+ throw new IllegalArgumentException("Index " + index + " > 63 not allowed");
+ }
+ if (depth < 1)
+ {
+ throw new IllegalStateException();
+ }
+ if (index > size)
+ {
+ throw new IllegalArgumentException();
+ }
+ long pre = current.bits;
+ current.bits |= 1L << index;
+ if (current.bits != pre)
+ {
+ current.cardinality++;
+ }
+ }
+
+ boolean get(int index)
+ {
+ if (index > 63)
+ {
+ throw new IllegalArgumentException("Index " + index + " > 63 not allowed");
+ }
+ if (depth < 1)
+ {
+ throw new IllegalStateException();
+ }
+ if (index > size)
+ {
+ throw new IllegalArgumentException();
+ }
+ return (current.bits & (1L << index)) != 0;
+ }
+
+ boolean isEmpty()
+ {
+ if (depth < 1)
+ {
+ throw new IllegalStateException();
+ }
+ return current.cardinality == size;
+ }
+}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -27,7 +27,6 @@
import org.exoplatform.web.controller.regexp.SyntaxException;
import java.io.IOException;
-import java.util.regex.Pattern;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -36,12 +35,12 @@
class PathParam extends Param
{
- static PathParam create(QualifiedName name)
+ static PathParam create(QualifiedName name, Router router)
{
- return create(new PathParamDescriptor(name));
+ return create(new PathParamDescriptor(name), router);
}
- static PathParam create(PathParamDescriptor descriptor)
+ static PathParam create(PathParamDescriptor descriptor, Router router)
{
if (descriptor == null)
{
@@ -111,7 +110,7 @@
descriptor.getQualifiedName(),
encodingMode,
routingRegex.toString(),
- renderingRegex.toString());
+ router.compile(renderingRegex.toString()));
}
/** . */
@@ -121,13 +120,13 @@
final String routingRegex;
/** . */
- final Pattern renderingPattern;
+ final Regex renderingPattern;
PathParam(
QualifiedName name,
EncodingMode encodingMode,
String routingRegex,
- String renderingRegex)
+ Regex renderingRegex)
{
super(name);
@@ -140,7 +139,7 @@
//
this.encodingMode = encodingMode;
this.routingRegex = routingRegex;
- this.renderingPattern = Pattern.compile(renderingRegex);
+ this.renderingPattern = renderingRegex;
}
@Override
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -21,8 +21,6 @@
import org.exoplatform.web.controller.regexp.Literal;
-import java.util.regex.Pattern;
-
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -33,6 +31,11 @@
/** . */
private final StringBuilder buffer = new StringBuilder();
+ /** . */
+ PatternBuilder()
+ {
+ }
+
public PatternBuilder expr(CharSequence s)
{
if (s == null)
@@ -93,8 +96,8 @@
return literal(Character.toString(c));
}
- public Pattern build()
+ public String build()
{
- return Pattern.compile(buffer.toString());
+ return buffer.toString();
}
}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -20,7 +20,6 @@
package org.exoplatform.web.controller.router;
import java.util.List;
-import java.util.regex.Pattern;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -30,7 +29,7 @@
{
/** . */
- final Pattern pattern;
+ final Regex pattern;
/** . */
final PathParam[] params;
@@ -43,7 +42,7 @@
PatternRoute(
Router router,
- Pattern pattern,
+ Regex pattern,
List<PathParam> params,
List<String> chunks)
{
Added: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Regex.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Regex.java (rev 0)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Regex.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,154 @@
+/*
+ * 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.web.controller.router;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
+public abstract class Regex
+{
+
+ /** . */
+ public static final Match[] NO_MATCHES = new Match[0];
+
+ /** . */
+ public static final Match NULL_MATCH = new Match(-1, -1, null);
+
+ /** An index set by the router to do matcher reuse easily, the regex implementation should not care about it. */
+ int index = -1;
+
+ public abstract String getPattern();
+
+ public abstract Matcher matcher();
+
+ public abstract static class Matcher
+ {
+
+ public abstract boolean matches(CharSequence s);
+
+ public abstract Match[] find(CharSequence s);
+
+ }
+
+ public static class Match
+ {
+
+ /** . */
+ private final int start;
+
+ /** . */
+ private final int end;
+
+ /** . */
+ private final String value;
+
+ protected Match(int start, int end, String value)
+ {
+ this.start = start;
+ this.end = end;
+ this.value = value;
+ }
+
+ public int getStart()
+ {
+ return start;
+ }
+
+ public int getEnd()
+ {
+ return end;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
+
+ public static class Java extends Regex
+ {
+
+ /** . */
+ private final java.util.regex.Pattern pattern;
+
+ public Java(String regex)
+ {
+ this.pattern = java.util.regex.Pattern.compile(regex);
+ }
+
+ public Matcher matcher()
+ {
+ return new Matcher()
+ {
+
+ /** . */
+ private java.util.regex.Matcher impl;
+
+ private java.util.regex.Matcher get(CharSequence s)
+ {
+ if (impl == null)
+ {
+ impl = pattern.matcher(s);
+ }
+ else
+ {
+ impl.reset(s);
+ }
+ return impl;
+ }
+
+ @Override
+ public boolean matches(CharSequence s)
+ {
+ return get(s).matches();
+ }
+
+ @Override
+ public Match[] find(CharSequence s)
+ {
+ java.util.regex.Matcher matcher = get(s);
+ if (matcher.find())
+ {
+ Match[] matches = new Match[1 + matcher.groupCount()];
+ for (int i = 0;i <= matcher.groupCount();i++)
+ {
+ if (matcher.group() != null)
+ {
+ matches[i] = new Match(matcher.start(i), matcher.end(i), matcher.group(i));
+ }
+ else
+ {
+ matches[i] = NULL_MATCH;
+ }
+ }
+ return matches;
+ }
+ else
+ {
+ return NO_MATCHES;
+ }
+ }
+ };
+ }
+
+ @Override
+ public String getPattern()
+ {
+ return pattern.pattern();
+ }
+ }
+}
Added: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RegexFactory.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RegexFactory.java (rev 0)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RegexFactory.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,48 @@
+/*
+ * 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.web.controller.router;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
+public abstract class RegexFactory implements Cloneable
+{
+
+ public static RegexFactory JAVA = new RegexFactory()
+ {
+ @Override
+ public Regex compile(String pattern)
+ {
+ return new Regex.Java(pattern);
+ }
+
+ @Override
+ public String getName()
+ {
+ return "java";
+ }
+ };
+
+ protected RegexFactory()
+ {
+ }
+
+ public abstract Regex compile(String pattern);
+
+ public abstract String getName();
+}
Added: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java (rev 0)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,179 @@
+/*
+ * 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.web.controller.router;
+
+import org.exoplatform.web.controller.QualifiedName;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The render context used to compute the rendering of a parameter map.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class RenderContext
+{
+
+ class Parameter
+ {
+
+ /** . */
+ private String value;
+
+ /** . */
+ private final int index;
+
+ private Parameter(String value, int index)
+ {
+ this.value = value;
+ this.index = index;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void remove()
+ {
+ if (stack.getDepth() < 1)
+ {
+ throw new IllegalStateException();
+ }
+ stack.set(index);
+ }
+ }
+
+ /** . */
+ private final Map<QualifiedName, Parameter> parameters;
+
+ /** . */
+ private BitStack stack = new BitStack();
+
+ /** . */
+ Regex.Matcher[] matchers;
+
+ public RenderContext(Map<QualifiedName, String> map)
+ {
+ this();
+
+ //
+ reset(map);
+ }
+
+ public RenderContext()
+ {
+ this.parameters = new HashMap<QualifiedName, Parameter>();
+ this.stack = new BitStack();
+ this.matchers = null;
+ }
+
+ Regex.Matcher matcher(Regex regex)
+ {
+ Regex.Matcher matcher = matchers[regex.index];
+ if (matcher == null)
+ {
+ matcher = matchers[regex.index] = regex.matcher();
+ }
+ return matcher;
+ }
+
+ /**
+ * Reuse the context with new parameters.
+ *
+ * @param map the map
+ */
+ public void reset(Map<QualifiedName, String> map)
+ {
+ this.parameters.clear();
+ this.stack.reset();
+
+ //
+ for (Map.Entry<QualifiedName, String> entry : map.entrySet())
+ {
+ addParameter(entry.getKey(), entry.getValue());
+ }
+ }
+
+ void addParameter(QualifiedName name, String value)
+ {
+ if (stack.getDepth() > 0)
+ {
+ throw new IllegalStateException();
+ }
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ if (value == null)
+ {
+ throw new NullPointerException();
+ }
+ Parameter parameter = parameters.get(name);
+ if (parameter == null)
+ {
+ parameter = new Parameter(value, parameters.size());
+ parameters.put(name, parameter);
+ }
+ else
+ {
+ parameter.value = value;
+ }
+ }
+
+ Parameter getParameter(QualifiedName name)
+ {
+ Parameter entry = parameters.get(name);
+ if (stack.getDepth() == 0 || (entry != null && !stack.get(entry.index)))
+ {
+ return entry;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ String getParameterValue(QualifiedName name)
+ {
+ Parameter entry = getParameter(name);
+ return entry != null ? entry.value : null;
+ }
+
+ boolean isEmpty()
+ {
+ return stack.getDepth() ==0 || stack.isEmpty();
+ }
+
+ void enter()
+ {
+ if (stack.getDepth() == 0)
+ {
+ stack.init(parameters.size());
+ }
+ stack.push();
+ }
+
+ void leave()
+ {
+ stack.pop();
+ }
+}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParam.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParam.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParam.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -22,8 +22,6 @@
import org.exoplatform.web.controller.QualifiedName;
import org.exoplatform.web.controller.metadata.RequestParamDescriptor;
-import java.util.regex.Pattern;
-
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -31,7 +29,7 @@
class RequestParam extends Param
{
- static RequestParam create(RequestParamDescriptor descriptor)
+ static RequestParam create(RequestParamDescriptor descriptor, Router router)
{
if (descriptor == null)
{
@@ -39,7 +37,7 @@
}
//
- Pattern matchValue = null;
+ Regex matchValue = null;
if (descriptor.getValue() != null)
{
PatternBuilder matchValueBuilder = new PatternBuilder();
@@ -53,7 +51,7 @@
matchValueBuilder.literal(descriptor.getValue());
}
matchValueBuilder.expr("$");
- matchValue = matchValueBuilder.build();
+ matchValue = router.compile(matchValueBuilder.build());
}
//
@@ -72,7 +70,7 @@
final String matchName;
/** . */
- final Pattern matchPattern;
+ final Regex matchPattern;
/** . */
final ControlMode controlMode;
@@ -80,7 +78,7 @@
/** . */
final ValueMapping valueMapping;
- RequestParam(QualifiedName name, String matchName, Pattern matchPattern, ControlMode controlMode, ValueMapping valueMapping)
+ RequestParam(QualifiedName name, String matchName, Regex matchPattern, ControlMode controlMode, ValueMapping valueMapping)
{
super(name);
@@ -108,6 +106,6 @@
boolean matchValue(String value)
{
- return matchPattern == null || matchPattern.matcher(value).matches();
+ return matchPattern == null || matchPattern.matcher().matches(value);
}
}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -42,7 +42,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.regex.Matcher;
/**
* The implementation of the routing algorithm.
@@ -88,7 +87,7 @@
}
//
- for (RouteParam routeParam : routeParams.values())
+ for (RouteParam routeParam : routeParamArray)
{
writer.writeStartElement("route-param");
writer.writeAttribute("qname", routeParam.name.getValue());
@@ -97,14 +96,14 @@
}
//
- for (RequestParam requestParam : requestParams.values())
+ for (RequestParam requestParam : requestParamArray)
{
writer.writeStartElement("request-param");
writer.writeAttribute("qname", requestParam.name.getValue());
writer.writeAttribute("name", requestParam.matchName);
if (requestParam.matchPattern != null)
{
- writer.writeAttribute("value", requestParam.matchPattern.pattern());
+ writer.writeAttribute("value", requestParam.matchPattern.getPattern());
}
writer.writeEndElement();
}
@@ -155,6 +154,12 @@
private static final Route[] EMPTY_ROUTE_ARRAY = new Route[0];
/** . */
+ private static final RouteParam[] EMPTY_ROUTE_PARAM_ARRAY = new RouteParam[0];
+
+ /** . */
+ private static final RequestParam[] EMPTY_REQUEST_PARAM_ARRAY = new RequestParam[0];
+
+ /** . */
private final Router router;
/** . */
@@ -167,19 +172,27 @@
private Route[] children;
/** . */
- private final Map<QualifiedName, RouteParam> routeParams;
+ private Map<QualifiedName, RouteParam> routeParamMap;
/** . */
- private final Map<String, RequestParam> requestParams;
+ private RouteParam[] routeParamArray;
+ /** . */
+ private Map<String, RequestParam> requestParamMap;
+
+ /** . */
+ private RequestParam[] requestParamArray;
+
Route(Router router)
{
this.router = router;
this.parent = null;
this.terminal = true;
this.children = EMPTY_ROUTE_ARRAY;
- this.routeParams = new HashMap<QualifiedName, RouteParam>();
- this.requestParams = new HashMap<String, RequestParam>();
+ this.routeParamMap = Collections.emptyMap();
+ this.routeParamArray = EMPTY_ROUTE_PARAM_ARRAY;
+ this.requestParamMap = Collections.emptyMap();
+ this.requestParamArray = EMPTY_REQUEST_PARAM_ARRAY;
}
final boolean isTerminal()
@@ -191,27 +204,27 @@
* Ok, so this is not the fastest way to do it, but for now it's OK, it's what is needed, we'll find
* a way to optimize it later with some precompilation.
*/
- final void render(Map<QualifiedName, String> blah, URIWriter writer) throws IOException
+ final void render(RenderContext context, URIWriter writer) throws IOException
{
- Route r = find(blah);
+ Route r = find(context);
// We found a route we need to render it now
if (r != null)
{
// Append path first
- r.renderPath(blah, writer, false);
+ r.renderPath(context, writer, false);
// Append query parameters after
- r.renderQueryString(blah, writer);
+ r.renderQueryString(context, writer);
}
}
- private boolean renderPath(Map<QualifiedName, String> blah, URIWriter writer, boolean hasChildren) throws IOException
+ private boolean renderPath(RenderContext context, URIWriter writer, boolean hasChildren) throws IOException
{
boolean endWithSlash;
if (parent != null)
{
- endWithSlash = parent.renderPath(blah, writer, true);
+ endWithSlash = parent.renderPath(context, writer, true);
}
else
{
@@ -251,7 +264,7 @@
//
PathParam def = pr.params[i];
- String value = blah.get(def.name);
+ String value = context.getParameterValue(def.name);
count += value.length();
// Write value
@@ -303,57 +316,58 @@
return endWithSlash;
}
- private void renderQueryString(Map<QualifiedName, String> blah, URIWriter writer) throws IOException
+ private void renderQueryString(RenderContext context, URIWriter writer) throws IOException
{
if (parent != null)
{
- parent.renderQueryString(blah, writer);
+ parent.renderQueryString(context, writer);
}
//
- if (requestParams.size() > 0)
+ for (RequestParam requestParamDef : requestParamArray)
{
- for (RequestParam requestParamDef : requestParams.values())
+ String s = context.getParameterValue(requestParamDef.name);
+ switch (requestParamDef.valueMapping)
{
- String s = blah.get(requestParamDef.name);
- switch (requestParamDef.valueMapping)
- {
- case CANONICAL:
- break;
- case NEVER_EMPTY:
- if (s != null && s.length() == 0)
- {
- s = null;
- }
- break;
- case NEVER_NULL:
- if (s == null)
- {
- s = "";
- }
- break;
- }
- if (s != null)
- {
- writer.appendQueryParameter(requestParamDef.matchName, s);
- }
+ case CANONICAL:
+ break;
+ case NEVER_EMPTY:
+ if (s != null && s.length() == 0)
+ {
+ s = null;
+ }
+ break;
+ case NEVER_NULL:
+ if (s == null)
+ {
+ s = "";
+ }
+ break;
}
+ if (s != null)
+ {
+ writer.appendQueryParameter(requestParamDef.matchName, s);
+ }
}
}
- final Route find(Map<QualifiedName, String> blah)
+ final Route find(RenderContext context)
{
+ context.enter();
+ Route route = _find(context);
+ context.leave();
+ return route;
+ }
- // Remove what is matched
- Map<QualifiedName, String> abc = new HashMap<QualifiedName, String>(blah);
-
+ private Route _find(RenderContext context)
+ {
// Match first the static parameteters
- for (RouteParam param : routeParams.values())
+ for (RouteParam param : routeParamArray)
{
- String value = blah.get(param.name);
- if (param.value.equals(value))
+ RenderContext.Parameter entry = context.getParameter(param.name);
+ if (entry != null && param.value.equals(entry.getValue()))
{
- abc.remove(param.name);
+ entry.remove();
}
else
{
@@ -362,36 +376,33 @@
}
// Match any request parameter
- if (requestParams.size() > 0)
+ for (RequestParam requestParamDef : requestParamArray)
{
- for (RequestParam requestParamDef : requestParams.values())
+ RenderContext.Parameter entry = context.getParameter(requestParamDef.name);
+ boolean matched = false;
+ if (entry != null)
{
- String a = blah.get(requestParamDef.name);
- boolean matched = false;
- if (a != null)
+ if (requestParamDef.matchPattern == null || context.matcher(requestParamDef.matchPattern).matches(entry.getValue()))
{
- if (requestParamDef.matchValue(a))
- {
- matched = true;
- }
+ matched = true;
}
- if (matched)
+ }
+ if (matched)
+ {
+ entry.remove();
+ }
+ else
+ {
+ switch (requestParamDef.controlMode)
{
- abc.remove(requestParamDef.name);
+ case OPTIONAL:
+ // Do nothing
+ break;
+ case REQUIRED:
+ return null;
+ default:
+ throw new AssertionError();
}
- else
- {
- switch (requestParamDef.controlMode)
- {
- case OPTIONAL:
- // Do nothing
- break;
- case REQUIRED:
- return null;
- default:
- throw new AssertionError();
- }
- }
}
}
@@ -402,17 +413,17 @@
for (int i = 0;i < prt.params.length;i++)
{
PathParam param = prt.params[i];
- String s = blah.get(param.name);
+ RenderContext.Parameter s = context.getParameter(param.name);
boolean matched = false;
if (s != null)
{
switch (param.encodingMode)
{
case FORM:
- matched = param.renderingPattern.matcher(s).matches();
+ matched = context.matcher(param.renderingPattern).matches(s.getValue());
break;
case PRESERVE_PATH:
- matched = param.renderingPattern.matcher(s).matches();
+ matched = context.matcher(param.renderingPattern).matches(s.getValue());
break;
default:
throw new AssertionError();
@@ -420,7 +431,7 @@
}
if (matched)
{
- abc.remove(param.name);
+ s.remove();
}
else
{
@@ -430,7 +441,7 @@
}
//
- if (abc.isEmpty() && terminal)
+ if (context.isEmpty() && terminal)
{
return this;
}
@@ -438,7 +449,7 @@
//
for (Route route : children)
{
- Route a = route.find(abc);
+ Route a = route.find(context);
if (a != null)
{
return a;
@@ -526,16 +537,13 @@
}
parameters.putAll(frame.matches);
}
- if (frame.route.routeParams.size() > 0)
+ for (RouteParam param : frame.route.routeParamArray)
{
if (parameters == null)
{
parameters = new HashMap<QualifiedName, String>();
}
- for (RouteParam param : frame.route.routeParams.values())
- {
- parameters.put(param.name, param.value);
- }
+ parameters.put(param.name, param.value);
}
}
return parameters != null ? parameters : Collections.<QualifiedName, String>emptyMap();
@@ -622,58 +630,55 @@
boolean matched = true;
// We enter a frame
- if (current.route.requestParams.size() > 0)
+ for (RequestParam requestParamDef : current.route.requestParamArray)
{
- for (RequestParam requestParamDef : current.route.requestParams.values())
+ String value = null;
+ String[] values = requestParams.get(requestParamDef.matchName);
+ if (values != null && values.length > 0 && values[0] != null)
{
- String value = null;
- String[] values = requestParams.get(requestParamDef.matchName);
- if (values != null && values.length > 0 && values[0] != null)
+ value = values[0];
+ }
+ if (value == null)
+ {
+ switch (requestParamDef.controlMode)
{
- value = values[0];
+ case OPTIONAL:
+ // Do nothing
+ break;
+ case REQUIRED:
+ matched = false;
+ break;
}
- if (value == null)
- {
- switch (requestParamDef.controlMode)
+ }
+ else if (!requestParamDef.matchValue(value))
+ {
+ matched = false;
+ break;
+ }
+ switch (requestParamDef.valueMapping)
+ {
+ case CANONICAL:
+ break;
+ case NEVER_EMPTY:
+ if (value != null && value.length() == 0)
{
- case OPTIONAL:
- // Do nothing
- break;
- case REQUIRED:
- matched = false;
- break;
+ value = null;
}
- }
- else if (!requestParamDef.matchValue(value))
- {
- matched = false;
break;
- }
- switch (requestParamDef.valueMapping)
- {
- case CANONICAL:
- break;
- case NEVER_EMPTY:
- if (value != null && value.length() == 0)
- {
- value = null;
- }
- break;
- case NEVER_NULL:
- if (value == null)
- {
- value = "";
- }
- break;
- }
- if (value != null)
- {
- if (current.matches == null)
+ case NEVER_NULL:
+ if (value == null)
{
- current.matches = new HashMap<QualifiedName, String>();
+ value = "";
}
- current.matches.put(requestParamDef.name, value);
+ break;
+ }
+ if (value != null)
+ {
+ if (current.matches == null)
+ {
+ current.matches = new HashMap<QualifiedName, String>();
}
+ current.matches.put(requestParamDef.name, value);
}
}
@@ -774,13 +779,13 @@
PatternRoute patternRoute = (PatternRoute)child;
//
- Matcher matcher = patternRoute.pattern.matcher(current.path.getValue());
+ Regex.Match[] matches = patternRoute.pattern.matcher().find(current.path.getValue());
// We match
- if (matcher.find())
+ if (matches.length > 0)
{
// Build next controller context
- int nextPos = matcher.end();
+ int nextPos = matches[0].getEnd();
Path nextPath;
if (current.path.length() == nextPos)
{
@@ -802,22 +807,19 @@
// JULIEN : this can be done lazily
// Append parameters
- int group = 1;
for (int i = 0;i < patternRoute.params.length;i++)
{
PathParam param = patternRoute.params[i];
+ Regex.Match match = matches[1 + i];
//
- int end = matcher.end(group);
-
- //
- if (end != -1)
+ if (match.getEnd() != -1)
{
String value;
if (param.encodingMode == EncodingMode.FORM)
{
StringBuilder sb = new StringBuilder();
- for (int from = matcher.start(group);from < end;from++)
+ for (int from = match.getStart();from < match.getEnd();from++)
{
char c = current.path.charAt(from);
if (c == child.router.separatorEscape && current.path.getRawLength(from) == 1)
@@ -830,7 +832,7 @@
}
else
{
- value = matcher.group(group);
+ value = match.getValue();
}
if (next.matches == null)
{
@@ -842,9 +844,6 @@
{
// We have an optional match
}
-
- //
- group++;
}
}
else
@@ -1034,7 +1033,7 @@
//
for (RequestParamDescriptor requestParamDesc : descriptor.getRequestParams())
{
- route.add(RequestParam.create(requestParamDesc));
+ route.add(RequestParam.create(requestParamDesc, router));
}
//
@@ -1054,7 +1053,12 @@
{
throw new MalformedRouteException("Duplicate parameter " + param.name);
}
- routeParams.put(param.name, param);
+ if (routeParamArray.length == 0)
+ {
+ routeParamMap = new HashMap<QualifiedName, RouteParam>();
+ }
+ routeParamMap.put(param.name, param);
+ routeParamArray = Tools.appendTo(routeParamArray, param);
return this;
}
@@ -1065,7 +1069,12 @@
{
throw new MalformedRouteException("Duplicate parameter " + param.name);
}
- requestParams.put(param.matchName, param);
+ if (requestParamArray.length == 0)
+ {
+ requestParamMap = new HashMap<String, RequestParam>();
+ }
+ requestParamMap.put(param.matchName, param);
+ requestParamArray = Tools.appendTo(requestParamArray, param);
return this;
}
@@ -1151,11 +1160,11 @@
PathParam param;
if (parameterDescriptor != null)
{
- param = PathParam.create(parameterDescriptor);
+ param = PathParam.create(parameterDescriptor, router);
}
else
{
- param = PathParam.create(parameterQName);
+ param = PathParam.create(parameterQName, router);
}
// Append routing regex to the route regex
@@ -1177,7 +1186,7 @@
//
chunks.add(path.substring(previous, pos));
- PatternRoute route = new PatternRoute(router, builder.build(), parameterPatterns, chunks);
+ PatternRoute route = new PatternRoute(router, router.compile(builder.build()), parameterPatterns, chunks);
// Wire
add(route);
@@ -1204,31 +1213,30 @@
private Param getParam(QualifiedName name)
{
- if (routeParams.containsKey(name))
+ Param param = routeParamMap.get(name);
+ if (param == null)
{
- return routeParams.get(name);
- }
- else
- {
- for (RequestParam param : requestParams.values())
+ for (RequestParam requestParam : requestParamArray)
{
- if (param.name.equals(name))
+ if (requestParam.name.equals(name))
{
- return param;
+ param = requestParam;
+ break;
}
}
- }
- if (this instanceof PatternRoute)
- {
- for (PathParam param : ((PatternRoute)this).params)
+ if (param == null && this instanceof PatternRoute)
{
- if (param.name.equals(name))
+ for (PathParam pathParam : ((PatternRoute)this).params)
{
- return param;
+ if (pathParam.name.equals(name))
+ {
+ param = pathParam;
+ break;
+ }
}
}
}
- return null;
+ return param;
}
private Param findParam(QualifiedName name)
@@ -1243,14 +1251,11 @@
private void findParams(List<Param> params)
{
- for (RouteParam param : routeParams.values())
+ Collections.addAll(params, routeParamArray);
+ for (RequestParam param : requestParamArray)
{
params.add(param);
}
- for (RequestParam param : requestParams.values())
- {
- params.add(param);
- }
if (this instanceof PatternRoute)
{
Collections.addAll(params, ((PatternRoute)this).params);
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RouteEscaper.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RouteEscaper.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RouteEscaper.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -19,6 +19,7 @@
package org.exoplatform.web.controller.router;
+import org.exoplatform.web.controller.regexp.GroupType;
import org.exoplatform.web.controller.regexp.RENode;
/**
@@ -89,12 +90,10 @@
else if (expr instanceof RENode.Group)
{
RENode.Group group = (RENode.Group)expr;
-/*
if (group.getType() == GroupType.CAPTURING_GROUP)
{
group.setType(GroupType.NON_CAPTURING_GROUP);
}
-*/
visit(group.getDisjunction());
}
else if (expr instanceof RENode.Any)
@@ -108,9 +107,9 @@
RENode.CharacterClass characterClass = (RENode.CharacterClass)expr;
RENode.CharacterClassExpr ccExpr = characterClass.getExpr();
ccExpr = ccExpr.replace(src, dst);
- RENode.CharacterClassExpr.And ccRepl = new RENode.CharacterClassExpr.And(null, new RENode.CharacterClassExpr.Not(new RENode.CharacterClassExpr.Char('/')));
- ccExpr.replaceBy(ccRepl);
- ccRepl.setLeft(ccExpr);
+// RENode.CharacterClassExpr.And ccRepl = new RENode.CharacterClassExpr.And(null, new RENode.CharacterClassExpr.Not(new RENode.CharacterClassExpr.Char('/')));
+// ccExpr.replaceBy(ccRepl);
+// ccRepl.setLeft(ccExpr);
}
}
}
Modified: portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -24,12 +24,16 @@
import org.exoplatform.web.controller.metadata.ControllerDescriptor;
import org.exoplatform.web.url.MimeType;
import org.gatein.common.io.UndeclaredIOException;
+import org.gatein.common.util.Tools;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* The router takes care of mapping a request to a a map.
@@ -62,6 +66,9 @@
escapeSet = bs;
}
+ /** . */
+ private final RegexFactory regexFactory;
+
/** The root route. */
final Route root;
@@ -74,8 +81,16 @@
/** . */
final char separatorEscapeNible2;
+ /** . */
+ private Regex[] regexes;
+
public Router(ControllerDescriptor metaData) throws RouterConfigException
{
+ this(metaData, RegexFactory.JAVA);
+ }
+
+ public Router(ControllerDescriptor metaData, RegexFactory regexFactory) throws RouterConfigException
+ {
char separtorEscape = metaData.getSeparatorEscape();
//
@@ -91,33 +106,59 @@
separatorEscapeNible2 = s.charAt(1);
//
+ this.regexFactory = regexFactory;
this.root = new Route(this);
this.separatorEscape = separtorEscape;
+ this.regexes = new Regex[0];
//
for (RouteDescriptor routeMetaData : metaData.getRoutes())
{
- addRoute(routeMetaData);
+ root.append(routeMetaData);
}
}
- public void addRoute(RouteDescriptor routeMetaData) throws RouterConfigException
+ Regex compile(String pattern)
{
- root.append(routeMetaData);
+ for (Regex regex : regexes)
+ {
+ if (regex.getPattern().equals(pattern))
+ {
+ return regex;
+ }
+ }
+ Regex regex = regexFactory.compile(pattern);
+ regex.index = regexes.length;
+ regexes = Tools.appendTo(regexes, regex);
+ return regex;
}
public void render(Map<QualifiedName, String> parameters, URIWriter writer) throws IOException
{
- root.render(parameters, writer);
+ render(new RenderContext(parameters), writer);
}
public String render(Map<QualifiedName, String> parameters)
{
+ return render(new RenderContext(parameters));
+ }
+
+ public void render(RenderContext context, URIWriter writer) throws IOException
+ {
+ if (context.matchers == null)
+ {
+ context.matchers = new Regex.Matcher[regexes.length];
+ }
+ root.render(context, writer);
+ }
+
+ public String render(RenderContext context)
+ {
try
{
StringBuilder sb = new StringBuilder();
URIWriter renderContext = new URIWriter(sb, MimeType.PLAIN);
- render(parameters, renderContext);
+ render(context, renderContext);
return sb.toString();
}
catch (IOException e)
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/ControllerRendererDriver.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/ControllerRendererDriver.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/ControllerRendererDriver.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,137 @@
+/**
+ * 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.web.controller.performance;
+
+import com.sun.japex.JapexDriverBase;
+import com.sun.japex.TestCase;
+import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.metadata.ControllerDescriptor;
+import org.exoplatform.web.controller.metadata.DescriptorBuilder;
+import org.exoplatform.web.controller.router.JRegexFactory;
+import org.exoplatform.web.controller.router.RegexFactory;
+import org.exoplatform.web.controller.router.RenderContext;
+import org.exoplatform.web.controller.router.Router;
+import org.exoplatform.web.controller.router.URIWriter;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
+public class ControllerRendererDriver extends JapexDriverBase
+{
+
+ /** . */
+ private RegexFactory regexFactory;
+
+ /** . */
+ private Router router;
+
+ /** . */
+ private RenderContext input;
+
+ /** . */
+ private URIWriter writer;
+
+ @Override
+ public void initializeDriver()
+ {
+ String regexFactoryName = getParam("regex");
+ if (regexFactoryName.equals("jregex")) {
+ regexFactory = JRegexFactory.INSTANCE;
+ } else if (regexFactoryName.equals("java")) {
+ regexFactory = RegexFactory.JAVA;
+ }
+
+ //
+ this.regexFactory = regexFactory;
+ }
+
+ @Override
+ public void prepare(TestCase testCase)
+ {
+ try
+ {
+ URL url = ControllerRendererDriver.class.getResource("controller.xml");
+ DescriptorBuilder builder = new DescriptorBuilder();
+ ControllerDescriptor descriptor = builder.build(url.openStream());
+ Router router = descriptor.build(regexFactory);
+
+ //
+ Map<QualifiedName, String> input = new HashMap<QualifiedName, String>();
+ String parameters = testCase.getParam("parameters");
+ JSONObject o = new JSONObject(parameters);
+ for (Iterator<String> i = o.keys();i.hasNext();)
+ {
+ String key = i.next();
+ String value = (String)o.get(key);
+ input.put(QualifiedName.parse(key), value);
+ }
+
+ //
+ if (router.render(input) == null)
+ {
+ throw new Exception("Could not render " + input);
+ }
+
+ //
+ this.router = router;
+ this.input = new RenderContext(input);
+ this.writer = new URIWriter(NullAppendable.INSTANCE);
+ }
+ catch (Exception e)
+ {
+ AssertionError afe = new AssertionError("Could not load controller configuration");
+ afe.initCause(e);
+ throw afe;
+ }
+ }
+
+ @Override
+ public void run(TestCase testCase)
+ {
+ try
+ {
+ router.render(input, writer);
+ writer.reset(NullAppendable.INSTANCE);
+ }
+ catch (IOException e)
+ {
+ AssertionError err = new AssertionError("Unexpected IOException");
+ err.initCause(e);
+ throw err;
+ }
+ }
+
+ @Override
+ public void finish(TestCase testCase)
+ {
+ this.router = null;
+ this.input = null;
+ this.writer = null;
+ }
+
+ @Override
+ public void terminateDriver()
+ {
+ }
+}
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/NullAppendable.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/NullAppendable.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/NullAppendable.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.web.controller.performance;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NullAppendable implements Appendable
+{
+
+ /** . */
+ public static final NullAppendable INSTANCE = new NullAppendable();
+
+ private NullAppendable()
+ {
+ }
+
+ public Appendable append(CharSequence csq) throws IOException
+ {
+ return this;
+ }
+
+ public Appendable append(CharSequence csq, int start, int end) throws IOException
+ {
+ return this;
+ }
+
+ public Appendable append(char c) throws IOException
+ {
+ return this;
+ }
+}
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/Standalone.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/Standalone.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/performance/Standalone.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,76 @@
+package org.exoplatform.web.controller.performance;
+
+import junit.framework.TestCase;
+import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.metadata.ControllerDescriptor;
+import org.exoplatform.web.controller.metadata.DescriptorBuilder;
+import org.exoplatform.web.controller.router.RegexFactory;
+import org.exoplatform.web.controller.router.RenderContext;
+import org.exoplatform.web.controller.router.Router;
+import org.exoplatform.web.controller.router.URIWriter;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
+public class Standalone extends TestCase
+{
+
+ /** . */
+ private static final QualifiedName HANDLER = QualifiedName.parse("gtn:handler");
+
+ /** . */
+ private static final QualifiedName LANG = QualifiedName.parse("gtn:lang");
+
+ /** . */
+ private static final QualifiedName SITETYPE = QualifiedName.parse("gtn:sitetype");
+
+ /** . */
+ private static final QualifiedName SITENAME = QualifiedName.parse("gtn:sitename");
+
+ /** . */
+ private static final QualifiedName PATH = QualifiedName.parse("gtn:path");
+
+ /** . */
+ private static final QualifiedName COMPONENT_ID = QualifiedName.parse("gtn:componentid");
+
+ /** . */
+ private static final QualifiedName ACTION = QualifiedName.parse("gtn:action");
+
+ /** . */
+ private static final QualifiedName OBJECT_ID = QualifiedName.parse("gtn:objectid");
+
+ public void testFoo() throws Exception
+ {
+
+ URL url = ControllerRendererDriver.class.getResource("controller.xml");
+ DescriptorBuilder builder = new DescriptorBuilder();
+ ControllerDescriptor descriptor = builder.build(url.openStream());
+ Router router = descriptor.build(RegexFactory.JAVA);
+
+ //
+ Map<QualifiedName, String> map = new HashMap<QualifiedName, String>();
+ map.put(HANDLER, "portal");
+ map.put(SITETYPE, "portal");
+ map.put(SITENAME, "classic");
+ map.put(PATH, "page");
+
+ //
+ RenderContext context = new RenderContext(map);
+
+ //
+ URIWriter writer = new URIWriter(NullAppendable.INSTANCE);
+
+ //
+ String s = router.render(map);
+ assertNotNull(s);
+
+ //
+ while (true)
+ {
+ writer.reset(NullAppendable.INSTANCE);
+ router.render(context, writer);
+ }
+ }
+}
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/JRegexFactory.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/JRegexFactory.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/JRegexFactory.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,120 @@
+/*
+ * 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.web.controller.router;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class JRegexFactory extends RegexFactory
+{
+
+ /** . */
+ public static final RegexFactory INSTANCE = new JRegexFactory();
+
+ private JRegexFactory()
+ {
+ }
+
+ @Override
+ public Regex compile(String pattern)
+ {
+ return new JRegex(pattern);
+ }
+
+ @Override
+ public String getName()
+ {
+ return "jregex";
+ }
+
+ public static class JRegex extends Regex
+ {
+
+ /** . */
+ private final jregex.Pattern pattern;
+
+ public JRegex(String regex)
+ {
+ this.pattern = new jregex.Pattern(regex);
+ }
+
+ public Matcher matcher()
+ {
+ return new Matcher()
+ {
+
+ /** . */
+ private jregex.Matcher impl;
+
+ private jregex.Matcher get(CharSequence seq)
+ {
+ String s = seq.toString();
+ if (impl == null)
+ {
+ impl = pattern.matcher(s);
+ }
+ else
+ {
+ impl.setTarget(s);
+ }
+ return impl;
+ }
+
+ @Override
+ public boolean matches(CharSequence s)
+ {
+ return get(s).matches();
+ }
+
+ @Override
+ public Match[] find(CharSequence s)
+ {
+ jregex.Matcher matcher = get(s);
+ if (matcher.find())
+ {
+ Match[] matches = new Match[matcher.groupCount()];
+ for (int i = 0;i < matcher.groupCount();i++)
+ {
+ if (matcher.isCaptured(i))
+ {
+ matches[i] = new Match(matcher.start(i), matcher.end(i), matcher.group(i));
+ }
+ else
+ {
+ matches[i] = NULL_MATCH;
+ }
+ }
+ return matches;
+ }
+ else
+ {
+ return NO_MATCHES;
+ }
+ }
+ };
+ }
+
+ @Override
+ public String getPattern()
+ {
+ return pattern.toString();
+ }
+ }
+}
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/RegexTestCase.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/RegexTestCase.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/RegexTestCase.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,73 @@
+/*
+ * 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.web.controller.router;
+
+import junit.framework.TestCase;
+
+/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
+public class RegexTestCase extends TestCase
+{
+
+ public void testLiteral()
+ {
+ Regex regex = JRegexFactory.INSTANCE.compile("abc");
+ Regex.Match[] matches = regex.matcher().find("abc");
+ assertEquals(1, matches.length);
+ assertEquals(0, matches[0].getStart());
+ assertEquals(3, matches[0].getEnd());
+ assertEquals("abc", matches[0].getValue());
+ }
+
+ public void testSimpleGroup1()
+ {
+ Regex regex = JRegexFactory.INSTANCE.compile("(abc)");
+ Regex.Match[] matches = regex.matcher().find("abc");
+ assertEquals(2, matches.length);
+ assertEquals(0, matches[0].getStart());
+ assertEquals(3, matches[0].getEnd());
+ assertEquals("abc", matches[0].getValue());
+ assertEquals(0, matches[1].getStart());
+ assertEquals(3, matches[1].getEnd());
+ assertEquals("abc", matches[1].getValue());
+ }
+
+ public void testSimpleGroup2()
+ {
+ Regex regex = JRegexFactory.INSTANCE.compile("a(b)c");
+ Regex.Match[] matches = regex.matcher().find("abc");
+ assertEquals(2, matches.length);
+ assertEquals(0, matches[0].getStart());
+ assertEquals(3, matches[0].getEnd());
+ assertEquals("abc", matches[0].getValue());
+ assertEquals(1, matches[1].getStart());
+ assertEquals(2, matches[1].getEnd());
+ assertEquals("b", matches[1].getValue());
+ }
+
+ public void testNonCapturingGroup()
+ {
+ Regex regex = JRegexFactory.INSTANCE.compile("a(?:b)c");
+ Regex.Match[] matches = regex.matcher().find("abc");
+ assertEquals(1, matches.length);
+ assertEquals(0, matches[0].getStart());
+ assertEquals(3, matches[0].getEnd());
+ assertEquals("abc", matches[0].getValue());
+ }
+}
Added: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBitStack.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBitStack.java (rev 0)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBitStack.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,85 @@
+/*
+ * 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.web.controller.router;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestBitStack extends TestCase
+{
+
+ public void testSimple()
+ {
+ BitStack bs = new BitStack();
+ assertEquals(0, bs.getDepth());
+ bs.init(2);
+ bs.push();
+ assertEquals(1, bs.getDepth());
+ bs.set(1);
+ assertFalse(bs.isEmpty());
+ bs.push();
+ assertEquals(2, bs.getDepth());
+ bs.set(0);
+ assertTrue(bs.isEmpty());
+ bs.pop();
+ assertEquals(1, bs.getDepth());
+ assertFalse(bs.isEmpty());
+ bs.pop();
+ assertEquals(0, bs.getDepth());
+ }
+
+ public void testReuse()
+ {
+ BitStack bs = new BitStack();
+ bs.init(2);
+ bs.push();
+ bs.set(0);
+ bs.push();
+ bs.set(1);
+ assertTrue(bs.isEmpty());
+ bs.pop();
+ bs.push();
+ assertFalse(bs.isEmpty());
+ }
+
+ public void testState()
+ {
+ BitStack bs = new BitStack();
+ try
+ {
+ bs.set(0);
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ try
+ {
+ bs.pop();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+}
Modified: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -38,10 +38,10 @@
assertEquals(0, router.root.getSegmentNames().size());
assertEquals(1, router.root.getPatternSize());
PatternRoute patternRoute = router.root.getPattern(0);
- assertEquals("^/([^/]+)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.toString());
+ assertEquals("^/([^/]+)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.getPattern());
assertEquals(1, patternRoute.params.length);
assertEquals(Names.A, patternRoute.params[0].name);
- assertEquals("^.+$", patternRoute.params[0].renderingPattern.toString());
+ assertEquals("^.+$", patternRoute.params[0].renderingPattern.getPattern());
assertEquals(EncodingMode.FORM, patternRoute.params[0].encodingMode);
assertEquals(2, patternRoute.chunks.length);
assertEquals("", patternRoute.chunks[0]);
@@ -56,10 +56,10 @@
assertEquals(0, router.root.getSegmentNames().size());
assertEquals(1, router.root.getPatternSize());
PatternRoute patternRoute = router.root.getPattern(0);
- assertEquals("^/([^/]+)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.toString());
+ assertEquals("^/([^/]+)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.getPattern());
assertEquals(1, patternRoute.params.length);
assertEquals(Names.Q_A, patternRoute.params[0].name);
- assertEquals("^.+$", patternRoute.params[0].renderingPattern.toString());
+ assertEquals("^.+$", patternRoute.params[0].renderingPattern.getPattern());
assertEquals(EncodingMode.FORM, patternRoute.params[0].encodingMode);
assertEquals(2, patternRoute.chunks.length);
assertEquals("", patternRoute.chunks[0]);
@@ -74,10 +74,10 @@
assertEquals(0, router.root.getSegmentNames().size());
assertEquals(1, router.root.getPatternSize());
PatternRoute patternRoute = router.root.getPattern(0);
- assertEquals("^/([^/]*)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.toString());
+ assertEquals("^/([^/]*)(?:(?<=^/)|(?=/)|$)", patternRoute.pattern.getPattern());
assertEquals(1, patternRoute.params.length);
assertEquals(Names.A, patternRoute.params[0].name);
- assertEquals("^.*$", patternRoute.params[0].renderingPattern.toString());
+ assertEquals("^.*$", patternRoute.params[0].renderingPattern.getPattern());
assertEquals(EncodingMode.FORM, patternRoute.params[0].encodingMode);
assertEquals(2, patternRoute.chunks.length);
assertEquals("", patternRoute.chunks[0]);
Modified: portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPatternBuilder.java
===================================================================
--- portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPatternBuilder.java 2011-09-16 11:25:56 UTC (rev 7453)
+++ portal/trunk/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPatternBuilder.java 2011-09-16 12:28:21 UTC (rev 7454)
@@ -21,8 +21,6 @@
import junit.framework.TestCase;
-import java.util.regex.Pattern;
-
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -51,7 +49,7 @@
pb.expr("^");
pb.literal(c);
pb.expr("$");
- Pattern pattern = pb.build();
- assertTrue(pattern.matcher(Character.toString(c)).matches());
+ Regex pattern = RegexFactory.JAVA.compile(pb.build());
+ assertTrue(pattern.matcher().matches(Character.toString(c)));
}
}
Added: portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/performance/controller.xml
===================================================================
--- portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/performance/controller.xml (rev 0)
+++ portal/trunk/component/web/controller/src/test/resources/org/exoplatform/web/controller/performance/controller.xml 2011-09-16 12:28:21 UTC (rev 7454)
@@ -0,0 +1,138 @@
+<!--
+ ~ 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.
+ -->
+
+<controller
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_controller_1_0 http://www.gatein.org/xml/ns/gatein_controller_1_0"
+ xmlns="http://www.gatein.org/xml/ns/gatein_controller_1_0"
+ separator-escape=":">
+
+ <route path="/upload">
+ <route-param qname="gtn:handler">
+ <value>upload</value>
+ </route-param>
+ </route>
+
+ <route path="/download">
+ <route-param qname="gtn:handler">
+ <value>download</value>
+ </route-param>
+ </route>
+
+ <!-- The legacy route -->
+ <route path="/public">
+ <route path="/">
+ <route-param qname="gtn:handler">
+ <value>default</value>
+ </route-param>
+ </route>
+ <route path="/{gtn:sitename}/{gtn:path}">
+ <route-param qname="gtn:handler">
+ <value>legacy</value>
+ </route-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*</pattern>
+ </path-param>
+ </route>
+ </route>
+ <route path="/private">
+ <route path="/">
+ <route-param qname="gtn:handler">
+ <value>default</value>
+ </route-param>
+ </route>
+ <route path="/{gtn:sitename}/{gtn:path}">
+ <route-param qname="gtn:handler">
+ <value>legacy</value>
+ </route-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*</pattern>
+ </path-param>
+ </route>
+ </route>
+
+ <route path="/{gtn:path}">
+ <route-param qname="gtn:handler">
+ <value>staticResource</value>
+ </route-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*\.(jpg|png|gif|ico|css)</pattern>
+ </path-param>
+ </route>
+
+ <route path="/">
+
+ <!-- The portal handler -->
+ <route-param qname="gtn:handler">
+ <value>portal</value>
+ </route-param>
+
+ <!-- Webui parameters -->
+ <request-param qname="gtn:componentid" name="portal:componentId"/>
+ <request-param qname="gtn:action" name="portal:action"/>
+ <request-param qname="gtn:objectid" name="objectId"/>
+
+ <!-- The group access -->
+ <route path="/groups/{gtn:sitename}/{gtn:path}">
+ <request-param qname="gtn:lang" name="lang" value-mapping="never-empty">
+ <pattern>([A-Za-z]{2}(-[A-Za-z]{2})?)?</pattern>
+ </request-param>
+ <route-param qname="gtn:sitetype">
+ <value>group</value>
+ </route-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*</pattern>
+ </path-param>
+ </route>
+
+ <!-- The user access -->
+ <route path="/users/{gtn:sitename}/{gtn:path}">
+ <request-param qname="gtn:lang" name="lang" value-mapping="never-empty">
+ <pattern>([A-Za-z]{2}(-[A-Za-z]{2})?)?</pattern>
+ </request-param>
+ <route-param qname="gtn:sitetype">
+ <value>user</value>
+ </route-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*</pattern>
+ </path-param>
+ </route>
+
+ <!-- The portal access -->
+ <route path="/{gtn:lang}/{gtn:sitename}/{gtn:path}">
+ <route-param qname="gtn:sitetype">
+ <value>portal</value>
+ </route-param>
+ <path-param qname="gtn:lang" encoding="preserve-path">
+ <pattern>([A-Za-z]{2}(-[A-Za-z]{2})?)?</pattern>
+ </path-param>
+ <path-param qname="gtn:path" encoding="preserve-path">
+ <pattern>.*</pattern>
+ </path-param>
+ </route>
+
+ </route>
+
+ <!-- Default handler -->
+ <route path="/">
+ <route-param qname="gtn:handler">
+ <value>default</value>
+ </route-param>
+ </route>
+</controller>
12 years, 9 months
gatein SVN: r7453 - in components/wsrp/trunk/consumer/src: test/java/org/gatein/wsrp/consumer and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-09-16 07:25:56 -0400 (Fri, 16 Sep 2011)
New Revision: 7453
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
Log:
- GTNWSRP-241: if status is FAILURE, then didRefreshHappen should return false. Added test case.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-16 11:25:45 UTC (rev 7452)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-16 11:25:56 UTC (rev 7453)
@@ -25,8 +25,7 @@
import org.oasis.wsrp.v2.ServiceDescription;
-import static org.gatein.wsrp.consumer.RefreshResult.Status.BYPASSED;
-import static org.gatein.wsrp.consumer.RefreshResult.Status.SUCCESS;
+import static org.gatein.wsrp.consumer.RefreshResult.Status.*;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -77,7 +76,7 @@
public boolean didRefreshHappen()
{
- return !BYPASSED.equals(status);
+ return !BYPASSED.equals(status) && !FAILURE.equals(status);
}
public boolean hasIssues()
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-16 11:25:45 UTC (rev 7452)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-16 11:25:56 UTC (rev 7453)
@@ -96,6 +96,13 @@
assertEquals(info, regInfo2.getParent());
}
+ public void testRefreshDidNotHappenIfFailure() throws PortletInvokerException
+ {
+ serviceFactory.setFailed(true);
+ final boolean refresh = info.refresh(false);
+ assertFalse(refresh);
+ }
+
public void testSetNullRegistrationInfo()
{
try
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-16 11:25:45 UTC (rev 7452)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-16 11:25:56 UTC (rev 7453)
@@ -69,6 +69,7 @@
private String wsdl = DEFAULT_WSDL_URL;
public static final String DEFAULT_WSDL_URL = "http://example.com/producer?wsdl";
private int timeout = DEFAULT_TIMEOUT_MS;
+ private boolean failed = false;
public BehaviorBackedServiceFactory()
@@ -167,12 +168,12 @@
public boolean isFailed()
{
- return false;
+ return failed;
}
public void setFailed(boolean failed)
{
- // do nothing
+ this.failed = failed;
}
public void setWSOperationTimeOut(int msBeforeTimeOut)
@@ -197,6 +198,11 @@
public void start() throws Exception
{
+ if (failed)
+ {
+ throw new RuntimeException("ServiceFactory has failed!");
+ }
+
initialized = true;
}
12 years, 9 months
gatein SVN: r7452 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2011-09-16 07:25:45 -0400 (Fri, 16 Sep 2011)
New Revision: 7452
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
Log:
GTNPORTAL-1974 Add Node button always create new node on the top level
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java 2011-09-16 09:06:42 UTC (rev 7451)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java 2011-09-16 11:25:45 UTC (rev 7452)
@@ -394,7 +394,11 @@
TreeNode node;
if (ParameterValidation.isNullOrEmpty(nodeID))
{
- node = uiNodeSelector.getRootNode();
+ node = uiNodeSelector.getSelectedNode();
+ if(node == null)
+ {
+ node = uiNodeSelector.getRootNode();
+ }
}
else
{
12 years, 9 months
gatein SVN: r7451 - in portal/trunk/component/portal/src: main/java/org/exoplatform/portal/config and 2 other directories.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2011-09-16 05:06:42 -0400 (Fri, 16 Sep 2011)
New Revision: 7451
Modified:
portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
Log:
GTNPORTAL-2104 Use enum to present the data import status
Modified: portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-09-16 06:17:30 UTC (rev 7450)
+++ portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-09-16 09:06:42 UTC (rev 7451)
@@ -22,7 +22,7 @@
<supertypes>
</supertypes>
<propertyDefinitions>
- <propertyDefinition name="gtn:status" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <propertyDefinition name="gtn:status" requiredType="int" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
<propertyDefinition name="gtn:creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-09-16 06:17:30 UTC (rev 7450)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-09-16 09:06:42 UTC (rev 7451)
@@ -31,6 +31,7 @@
import org.exoplatform.portal.config.model.NavigationFragment;
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
import org.exoplatform.portal.mop.importer.NavigationImporter;
import org.exoplatform.portal.mop.importer.PageImporter;
import org.exoplatform.portal.mop.importer.PortalConfigImporter;
@@ -194,7 +195,7 @@
Workspace workspace = session.getWorkspace();
Imported imported = workspace.adapt(Imported.class);
imported.setLastModificationDate(new Date());
- imported.setStatus(Imported.DONE);
+ imported.setStatus(Status.DONE.status());
session.save();
}
finally
@@ -236,7 +237,8 @@
else
{
Imported imported = workspace.adapt(Imported.class);
- perform = Imported.WANT_REIMPORT.equals(imported.getStatus());
+ Status status = Status.getStatus(imported.getStatus());
+ perform = (Status.WANT_REIMPORT == status);
}
if (overrideExistingData)
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-09-16 06:17:30 UTC (rev 7450)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-09-16 09:06:42 UTC (rev 7451)
@@ -32,16 +32,46 @@
@MixinType(name = "gtn:imported")
public abstract class Imported
{
- final public static String FAILED = "failed";
+ public enum Status {
+
+ UNKNOWN(-1),
+
+ FAILED(0),
+
+ DONE(1),
+
+ WANT_REIMPORT(2);
+
+ private final int status;
+
+ Status(int status)
+ {
+ this.status = status;
+ }
+
+ public int status()
+ {
+ return this.status;
+ }
+
+ public static Status getStatus(int status)
+ {
+ for (Status type : Status.values())
+ {
+ if (type.status() == status)
+ {
+ return type;
+ }
+ }
+
+ return UNKNOWN;
+ }
+ }
- final public static String DONE = "done";
-
- final public static String WANT_REIMPORT = "want_reimport";
-
@Property(name = "gtn:status")
- public abstract String getStatus();
+ public abstract int getStatus();
- public abstract void setStatus(String status);
+ public abstract void setStatus(int status);
@Property(name = "gtn:creationdate")
public abstract Date getCreationDate();
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java 2011-09-16 06:17:30 UTC (rev 7450)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java 2011-09-16 09:06:42 UTC (rev 7451)
@@ -26,6 +26,7 @@
import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.gatein.mop.api.workspace.Workspace;
@@ -194,7 +195,7 @@
POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- workspace.adapt(Imported.class).setStatus(Imported.WANT_REIMPORT);
+ workspace.adapt(Imported.class).setStatus(Status.WANT_REIMPORT.status());
long creationTime1 = workspace.adapt(Imported.class).getCreationDate().getTime();
long lastModificationTime1 = workspace.adapt(Imported.class).getLastModificationDate().getTime();
mgr.getSession().save();
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-09-16 06:17:30 UTC (rev 7450)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-09-16 09:06:42 UTC (rev 7451)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.mop.importer.Imported.Status;
import org.exoplatform.portal.mop.navigation.NavigationContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.Node;
@@ -160,7 +161,7 @@
afterTwoPhaseNoOverrideReboot(root);
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- workspace.adapt(Imported.class).setStatus(Imported.WANT_REIMPORT);
+ workspace.adapt(Imported.class).setStatus(Status.WANT_REIMPORT.status());
mgr.getSession().save();
RequestLifeCycle.end();
bootstrap.dispose();
12 years, 9 months
gatein SVN: r7450 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/config and 12 other directories.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2011-09-16 02:17:30 -0400 (Fri, 16 Sep 2011)
New Revision: 7450
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PageImporter.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PortalConfigImporter.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml
Removed:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
Modified:
portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
GTNPORTAL-2104 Import Mode for Portal Config and Page data import
Modified: portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -22,6 +22,9 @@
<supertypes>
</supertypes>
<propertyDefinitions>
+ <propertyDefinition name="gtn:status" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
<propertyDefinition name="gtn:creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -45,8 +45,6 @@
private String importMode;
- final Set<String> createdOwners = new HashSet<String>();
-
/**
* @deprecated use the location instead
*/
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -32,6 +32,8 @@
import org.exoplatform.portal.mop.importer.ImportMode;
import org.exoplatform.portal.mop.importer.Imported;
import org.exoplatform.portal.mop.importer.NavigationImporter;
+import org.exoplatform.portal.mop.importer.PageImporter;
+import org.exoplatform.portal.mop.importer.PortalConfigImporter;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelUnmarshaller;
import org.exoplatform.portal.config.model.Page;
@@ -49,7 +51,6 @@
import org.gatein.mop.api.workspace.Workspace;
import org.jibx.runtime.*;
-import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
@@ -116,6 +117,10 @@
/** . */
private DescriptionService descriptionService_;
+ final Set<String> createdOwners = new HashSet<String>();
+
+ private boolean isFirstStartup = false;
+
public NewPortalConfigListener(
UserPortalConfigService owner,
POMSessionManager pomMgr,
@@ -189,6 +194,7 @@
Workspace workspace = session.getWorkspace();
Imported imported = workspace.adapt(Imported.class);
imported.setLastModificationDate(new Date());
+ imported.setStatus(Imported.DONE);
session.save();
}
finally
@@ -197,34 +203,49 @@
}
}
- private boolean performImport()
+ private boolean performImport() throws Exception
{
RequestLifeCycle.begin(PortalContainer.getInstance());
try
{
+
+ POMSession session = pomMgr.getSession();
+
+ // Obtain the status
+ Workspace workspace = session.getWorkspace();
+ boolean perform = !workspace.isAdapted(Imported.class);
+
+
+ // We mark it
+ if (perform)
+ {
+ Imported imported = workspace.adapt(Imported.class);
+ imported.setCreationDate(new Date());
+ session.save();
+
+ // for legacy checking
+ if (dataStorage_.getPortalConfig(defaultPortal) != null)
+ {
+ perform = false;
+ }
+ else
+ {
+ isFirstStartup = true;
+ }
+ }
+ else
+ {
+ Imported imported = workspace.adapt(Imported.class);
+ perform = Imported.WANT_REIMPORT.equals(imported.getStatus());
+ }
+
if (overrideExistingData)
{
return true;
}
- else
- {
- POMSession session = pomMgr.getSession();
- // Obtain the status
- Workspace workspace = session.getWorkspace();
- boolean perform = !workspace.isAdapted(Imported.class);
-
- // We mark it
- if (perform)
- {
- Imported imported = workspace.adapt(Imported.class);
- imported.setCreationDate(new Date());
- session.save();
- }
-
- //
- return perform;
- }
+ //
+ return perform;
}
finally
{
@@ -249,7 +270,7 @@
{
try
{
- initPortletPreferencesDB(ele);
+ initPortalConfigDB(ele);
}
catch (Exception e)
{
@@ -260,7 +281,7 @@
{
try
{
- initPortalConfigDB(ele);
+ initPortletPreferencesDB(ele);
}
catch (Exception e)
{
@@ -313,9 +334,6 @@
log.error("NewPortalConfig error: " + e.getMessage(), e);
}
}
-
- //
- touchImport();
}
else
{
@@ -324,11 +342,11 @@
{
for (NewPortalConfig ele : configs)
{
- initPortletPreferencesDB(ele);
+ initPortalConfigDB(ele);
}
for (NewPortalConfig ele : configs)
{
- initPortalConfigDB(ele);
+ initPortletPreferencesDB(ele);
}
}
finally
@@ -355,10 +373,10 @@
{
ele.getPredefinedOwner().clear();
}
-
- //
- touchImport();
}
+
+ //
+ touchImport();
}
String getDefaultPortal()
@@ -435,7 +453,7 @@
{
if (createPortalConfig(config, owner))
{
- config.createdOwners.add(owner);
+ this.createdOwners.add(owner);
}
}
}
@@ -444,7 +462,7 @@
{
for (String owner : config.getPredefinedOwner())
{
- if (config.createdOwners.contains(owner))
+ if (this.createdOwners.contains(owner))
{
createPage(config, owner);
}
@@ -473,45 +491,28 @@
public boolean createPortalConfig(NewPortalConfig config, String owner) throws Exception
{
String type = config.getOwnerType();
- PortalConfig currentPortalConfig = dataStorage_.getPortalConfig(type, owner);
- if (currentPortalConfig == null)
+ UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type, PortalConfig.class);
+
+ ImportMode importMode = getRightMode(config.getImportMode());
+
+ PortalConfig pConfig = (obj != null) ? obj.getObject() : null;
+ if (pConfig == null)
{
- try
- {
- UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type, PortalConfig.class);
-
- if (obj == null)
- {
- // Ensure that the PortalConfig has been defined
- // The PortalConfig could be empty if the related PortalConfigListener
- // has been launched after starting this service
- PortalConfig cfg = dataStorage_.getPortalConfig(type, owner);
- if (cfg == null)
- {
- cfg = new PortalConfig(type);
- cfg.setPortalLayout(new Container());
- cfg.setName(owner);
- dataStorage_.create(cfg);
- return true;
- }
- }
- else
- {
- PortalConfig pconfig = obj.getObject();
- // We use that owner value because it may have been fixed for group names
- owner = pconfig.getName();
- dataStorage_.create(pconfig);
- return true;
- }
- }
- catch (IOException e)
- {
- log.error("Could not load portal configuration", e);
- }
+ pConfig = new PortalConfig(type);
+ pConfig.setPortalLayout(new Container());
+ pConfig.setName(owner);
}
-
- //
- return false;
+
+ PortalConfigImporter portalImporter = new PortalConfigImporter(importMode, pConfig, dataStorage_);
+ try
+ {
+ portalImporter.perform();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
}
public void createPage(NewPortalConfig config, String owner) throws Exception
@@ -526,8 +527,11 @@
{
RequestLifeCycle.begin(PortalContainer.getInstance());
try
- {
- dataStorage_.create(page);
+ { //
+ ImportMode importMode = getRightMode(config.getImportMode());
+
+ PageImporter importer = new PageImporter(importMode, page, dataStorage_);
+ importer.perform();
}
finally
{
@@ -548,15 +552,7 @@
PageNavigation navigation = obj.getObject();
//
- ImportMode importMode;
- if (config.getImportMode() != null)
- {
- importMode = ImportMode.valueOf(config.getImportMode().trim().toUpperCase());
- }
- else
- {
- importMode = owner_.getDefaultImportMode();
- }
+ ImportMode importMode = getRightMode(config.getImportMode());
//
Locale locale;
@@ -885,4 +881,24 @@
page.setOwnerId(fixOwnerName(page.getOwnerType(), page.getOwnerId()));
fixOwnerName((Container)page);
}
+
+ private ImportMode getRightMode(String mode)
+ {
+ ImportMode importMode;
+ if (mode != null)
+ {
+ importMode = ImportMode.valueOf(mode.trim().toUpperCase());
+ }
+ else
+ {
+ importMode = owner_.getDefaultImportMode();
+ }
+
+ if (isFirstStartup && (importMode == ImportMode.CONSERVE || importMode == ImportMode.INSERT))
+ {
+ return ImportMode.MERGE;
+ }
+
+ return importMode;
+ }
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/Imported.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -32,7 +32,17 @@
@MixinType(name = "gtn:imported")
public abstract class Imported
{
+ final public static String FAILED = "failed";
+
+ final public static String DONE = "done";
+
+ final public static String WANT_REIMPORT = "want_reimport";
+
+ @Property(name = "gtn:status")
+ public abstract String getStatus();
+ public abstract void setStatus(String status);
+
@Property(name = "gtn:creationdate")
public abstract Date getCreationDate();
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/NavigationImporter.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -53,7 +53,7 @@
/** . */
private final DescriptionService descriptionService;
-
+
public NavigationImporter(
Locale portalLocale,
ImportMode mode,
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PageImporter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PageImporter.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PageImporter.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,81 @@
+/*
+ * 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.portal.mop.importer;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.Page;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class PageImporter
+{
+ /** . */
+ private final Page src;
+
+ /** . */
+ private final DataStorage service;
+
+ /** . */
+ private final ImportMode mode;
+
+ public PageImporter(ImportMode importMode, Page page, DataStorage dataStorage_)
+ {
+ this.mode = importMode;
+ this.src = page;
+ this.service = dataStorage_;
+ }
+
+ public void perform() throws Exception
+ {
+ Page existingPage = service.getPage(src.getPageId());
+ Page dst;
+
+ //
+ switch (mode)
+ {
+ case CONSERVE:
+ dst = null;
+ break;
+ case INSERT:
+ if (existingPage == null)
+ {
+ dst = src;
+ }
+ else
+ {
+ dst = null;
+ }
+ break;
+ case MERGE:
+ case OVERWRITE:
+ dst = src;
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ if (dst != null)
+ {
+ service.create(dst);
+ }
+ }
+}
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PortalConfigImporter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PortalConfigImporter.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/importer/PortalConfigImporter.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,88 @@
+/*
+ * 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.portal.mop.importer;
+
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.model.PortalConfig;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class PortalConfigImporter
+{
+ /** . */
+ private final PortalConfig src;
+
+ /** . */
+ private final DataStorage service;
+
+ /** . */
+ private final ImportMode mode;
+
+ public PortalConfigImporter(ImportMode importMode, PortalConfig portal, DataStorage dataStorage_)
+ {
+ this.mode = importMode;
+ this.src = portal;
+ this.service = dataStorage_;
+ }
+
+ public void perform() throws Exception
+ {
+ PortalConfig existingPortalConfig = service.getPortalConfig(src.getType(), src.getName());
+ PortalConfig dst = null;
+
+ //
+ switch (mode)
+ {
+ case CONSERVE:
+ dst = null;
+ break;
+ case INSERT:
+ if (existingPortalConfig == null)
+ {
+ dst = src;
+ }
+ else
+ {
+ dst = null;
+ }
+ break;
+ case MERGE:
+ case OVERWRITE:
+ dst = src;
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ if (dst != null)
+ {
+ if (existingPortalConfig == null)
+ {
+ service.create(dst);
+ }
+ else
+ {
+ service.save(dst);
+ }
+ }
+ }
+}
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractDataImportTest.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,272 @@
+/*
+ * 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.portal.config;
+
+import org.exoplatform.component.test.AbstractGateInTest;
+import org.exoplatform.component.test.ContainerScope;
+import org.exoplatform.component.test.KernelBootstrap;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDataImportTest extends AbstractGateInTest
+{
+ private Set<String> clearProperties = new HashSet<String>();
+
+ protected abstract ImportMode getMode();
+
+ protected abstract String getConfig2();
+
+ protected abstract String getConfig1();
+
+ protected abstract void afterOneBootWithExtention(PortalContainer container) throws Exception;
+
+ protected abstract void afterFirstBoot(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBoot(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBootWithOverride(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBootWithWantReimport(PortalContainer container) throws Exception;
+
+ protected abstract void afterSecondBootWithNoMixin(PortalContainer container) throws Exception;
+
+ protected void setSystemProperty(String key, String value)
+ {
+ clearProperties.add(key);
+ System.setProperty(key, value);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ for (String key : clearProperties)
+ {
+ System.clearProperty(key);
+ }
+ clearProperties.clear();
+ }
+
+ public void testOneBootWithExtension() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport2-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+ setSystemProperty("override_2", "false");
+ setSystemProperty("import.mode_2", getMode().toString());
+ setSystemProperty("import.portal_2", getConfig2());
+
+ //
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterOneBootWithExtention(container);
+ bootstrap.dispose();
+ }
+
+ public void testOneBoot() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ //
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBoots() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBoot(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithOverride() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "true");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithOverride(container);
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithWantReimport() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+
+ RequestLifeCycle.begin(container);
+ POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ workspace.adapt(Imported.class).setStatus(Imported.WANT_REIMPORT);
+ long creationTime1 = workspace.adapt(Imported.class).getCreationDate().getTime();
+ long lastModificationTime1 = workspace.adapt(Imported.class).getLastModificationDate().getTime();
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithWantReimport(container);
+
+ RequestLifeCycle.begin(container);
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ long creationTime2 = workspace.adapt(Imported.class).getCreationDate().getTime();
+ assertEquals(creationTime1, creationTime2);
+ long lastModificationTime2 = workspace.adapt(Imported.class).getLastModificationDate().getTime();
+ assertTrue(lastModificationTime2 > lastModificationTime1);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+ bootstrap.dispose();
+ }
+
+ public void testTwoBootsWithNoMixin() throws Exception
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
+ bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
+
+ //
+ setSystemProperty("override.1", "false");
+ setSystemProperty("import.mode.1", getMode().toString());
+ setSystemProperty("import.portal.1", getConfig1());
+
+ bootstrap.boot();
+ PortalContainer container = bootstrap.getContainer();
+ afterFirstBoot(container);
+
+ RequestLifeCycle.begin(container);
+ POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ Imported imported = workspace.adapt(Imported.class);
+ long creationTime1 = imported.getCreationDate().getTime();
+ workspace.removeAdapter(Imported.class);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+
+ bootstrap.dispose();
+
+ //
+ setSystemProperty("import.portal.1", getConfig2());
+
+ bootstrap.boot();
+ container = bootstrap.getContainer();
+ afterSecondBootWithNoMixin(container);
+
+ RequestLifeCycle.begin(container);
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+ imported = workspace.adapt(Imported.class);
+ long creationTime2 = imported.getCreationDate().getTime();
+ assertTrue(creationTime2 > creationTime1);
+ mgr.getSession().save();
+ RequestLifeCycle.end();
+ bootstrap.dispose();
+ }
+}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportFragmentTest.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -62,12 +62,6 @@
}
@Override
- protected final void afterOnePhaseBoot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
{
assertState(root);
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportNavigationTest.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -39,39 +39,11 @@
return "navigation2";
}
- protected abstract void assertState(NodeContext<?> root);
-
@Override
- protected final void afterTwoPhasesBoot(NodeContext<?> root)
- {
- assertEquals(2, root.getNodeCount());
- assertNotNull(root.get("foo"));
- assertNotNull(root.get("daa"));
- }
-
- @Override
protected final void afterTwoPhaseNoOverrideReboot(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
assertNotNull(root.get("foo"));
assertNotNull(root.get("daa"));
}
-
- @Override
- protected final void afterOnePhaseBoot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
- protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
- {
- assertState(root);
- }
-
- @Override
- protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
- {
- assertState(root);
- }
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -160,8 +160,7 @@
afterTwoPhaseNoOverrideReboot(root);
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- workspace.removeAdapter(Imported.class);
- assertFalse(workspace.isAdapted(Imported.class));
+ workspace.adapt(Imported.class).setStatus(Imported.WANT_REIMPORT);
mgr.getSession().save();
RequestLifeCycle.end();
bootstrap.dispose();
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,122 @@
+package org.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.Imported;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.gatein.mop.api.workspace.Workspace;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public abstract class AbstractSiteDataImportTest extends AbstractDataImportTest
+{
+
+ @Override
+ protected final String getConfig1()
+ {
+ return "site1";
+ }
+
+ @Override
+ protected final String getConfig2()
+ {
+ return "site2";
+ }
+
+ @Override
+ protected final void afterOneBootWithExtention(PortalContainer container) throws Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+
+ //
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout", dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ protected final void afterFirstBoot(PortalContainer container) throws Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ Workspace workspace = mgr.getSession().getWorkspace();
+ assertTrue(workspace.isAdapted(Imported.class));
+
+ //
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout", dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 1", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNull(page2);
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNull(dashboard1);
+
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ protected final void afterSecondBoot(PortalContainer container) throws Exception
+ {
+ afterFirstBoot(container);
+ }
+
+ @Override
+ protected void afterSecondBootWithWantReimport(PortalContainer container) throws Exception
+ {
+ afterSecondBootWithOverride(container);
+ }
+
+ @Override
+ protected final void afterSecondBootWithNoMixin(PortalContainer container) throws Exception
+ {
+ afterSecondBoot(container);
+ }
+}
Deleted: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -1,174 +0,0 @@
-/*
- * 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.portal.config;
-
-import org.exoplatform.component.test.AbstractGateInTest;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.component.test.KernelBootstrap;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.importer.Imported;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.Node;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.gatein.mop.api.workspace.Workspace;
-
-import java.io.File;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestImport extends AbstractGateInTest
-{
-
- public void testMixin() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "navigation1");
-
- //
- bootstrap.boot();
- PortalContainer container = bootstrap.getContainer();
- POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
-
- //
- RequestLifeCycle.begin(container);
- Workspace workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-
- public void testDefaultMode() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport0-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
- System.setProperty("import.portal.0", "navigation2");
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "merge");
- System.setProperty("import.portal.1", "navigation1");
-
- //
- bootstrap.boot();
-
- //
- PortalContainer container = bootstrap.getContainer();
- NavigationService service = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
- RequestLifeCycle.begin(container);
- NavigationContext nav = service.loadNavigation(SiteKey.portal("classic"));
- NodeContext<Node> root = service.loadNode(Node.MODEL, nav, Scope.ALL, null);
- Collection<Node> c = root.getNodes();
- assertEquals(3, c.size());
- assertNotNull(root.get("foo"));
- assertNotNull(root.get("daa"));
- assertNotNull(root.get("bar"));
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-
- public void testNoMixin() throws Exception
- {
- KernelBootstrap bootstrap = new KernelBootstrap();
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.test.jcr-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.identity-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "conf/exo.portal.component.portal-configuration.xml");
- bootstrap.addConfiguration(ContainerScope.PORTAL, "org/exoplatform/portal/config/TestImport1-configuration.xml");
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "site1");
-
- //
- bootstrap.boot();
- PortalContainer container = bootstrap.getContainer();
- DataStorage service = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- RequestLifeCycle.begin(container);
- POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- Workspace workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- long when1 = workspace.adapt(Imported.class).getCreationDate().getTime();
- PortalConfig portal = service.getPortalConfig("classic");
- Container layout = portal.getPortalLayout();
- assertEquals(1, layout.getChildren().size());
- Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
- assertEquals("site1/layout", service.getId(layoutPortlet.getState()));
- Page page1 = service.getPage("portal::classic::page1");
- assertEquals(1, page1.getChildren().size());
- Application<Portlet> page1Portlet = (Application<Portlet>)page1.getChildren().get(0);
- assertEquals("site1/page1", service.getId(page1Portlet.getState()));
- workspace.removeAdapter(Imported.class);
- mgr.getSession().save();
- RequestLifeCycle.end();
- bootstrap.dispose();
-
- //
- System.setProperty("override.1", "false");
- System.setProperty("import.mode.1", "conserve");
- System.setProperty("import.portal.1", "site2");
-
- //
- bootstrap.boot();
- container = bootstrap.getContainer();
- service = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- RequestLifeCycle.begin(container);
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- workspace = mgr.getSession().getWorkspace();
- assertTrue(workspace.isAdapted(Imported.class));
- long when2 = workspace.adapt(Imported.class).getCreationDate().getTime();
- assertTrue(when2 > when1);
- portal = service.getPortalConfig("classic");
- layout = portal.getPortalLayout();
- assertEquals(1, layout.getChildren().size());
- layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
- assertEquals("site1/layout", service.getId(layoutPortlet.getState()));
- page1 = service.getPage("portal::classic::page1");
- assertEquals(1, page1.getChildren().size());
- page1Portlet = (Application<Portlet>)page1.getChildren().get(0);
- assertEquals("site1/page1", service.getId(page1Portlet.getState()));
- Page page2 = service.getPage("portal::classic::page2");
- assertNull(page2);
- RequestLifeCycle.end();
- bootstrap.dispose();
- }
-}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentConserve.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -35,6 +35,16 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(1, root.getNodeSize());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeSize());
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentInsert.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -35,6 +35,12 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportFragmentOverwrite.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -35,6 +35,12 @@
}
@Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
protected void assertState(NodeContext<?> root)
{
assertEquals(1, root.getNodeSize());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationConserve.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -33,8 +33,49 @@
{
return ImportMode.CONSERVE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(3, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_2", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> juu = foo.get("juu");
+ assertNotNull(juu);
+ assertEquals("juu_icon", juu.getState().getIcon());
+ assertEquals(0, juu.getNodeCount());
+ NodeContext<?> bar = root.get("bar");
+ assertNotNull(bar);
+ assertEquals("bar_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ NodeContext<?> daa = root.get("daa");
+ assertNotNull(daa);
+ assertEquals("daa_icon", daa.getState().getIcon());
+ assertEquals(0, daa.getNodeCount());
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationInsert.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -33,8 +33,49 @@
{
return ImportMode.INSERT;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertEquals(3, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_2", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> juu = foo.get("juu");
+ assertNotNull(juu);
+ assertEquals("juu_icon", juu.getState().getIcon());
+ assertEquals(0, juu.getNodeCount());
+ NodeContext<?> bar = root.get("bar");
+ assertNotNull(bar);
+ assertEquals("bar_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ NodeContext<?> daa = root.get("daa");
+ assertNotNull(daa);
+ assertEquals("daa_icon", daa.getState().getIcon());
+ assertEquals(0, daa.getNodeCount());
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(3, root.getNodeCount());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationMerge.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -33,8 +33,33 @@
{
return ImportMode.MERGE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ assertNotNull(root.get("foo"));
+ assertNotNull(root.get("daa"));
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(3, root.getNodeCount());
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImportNavigationOverwrite.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -33,8 +33,39 @@
{
return ImportMode.OVERWRITE;
}
+
+ @Override
+ protected final void afterOnePhaseBoot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
@Override
+ protected final void afterTwoPhasesBoot(NodeContext<?> root)
+ {
+ assertEquals(2, root.getNodeCount());
+ NodeContext<?> foo = root.get("foo");
+ assertNotNull(foo);
+ assertEquals("foo_icon_1", foo.getState().getIcon());
+ assertEquals(1, foo.getNodeCount());
+ NodeContext<?> bar = root.get("daa");
+ assertNotNull(bar);
+ assertEquals("daa_icon", bar.getState().getIcon());
+ assertEquals(0, bar.getNodeCount());
+ }
+
+ @Override
+ protected final void afterTwoPhaseOverrideReboot(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
+ @Override
+ protected final void afterTwoPhaseNoOverrideReconfigure(NodeContext<?> root)
+ {
+ assertState(root);
+ }
+
protected void assertState(NodeContext<?> root)
{
assertEquals(2, root.getNodeCount());
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportConserve.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,43 @@
+/*
+ * 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.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.mop.importer.ImportMode;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportConserve extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.CONSERVE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws Exception
+ {
+ afterSecondBoot(container);
+ }
+}
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportInsert.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,76 @@
+/*
+ * 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.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportInsert extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.INSERT;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws Exception
+ {
+ //
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout", dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 1", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportMerge.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,76 @@
+/*
+ * 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.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportMerge extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.MERGE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout", dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSiteDataImportOverwrite.java 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,76 @@
+/*
+ * 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.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.importer.ImportMode;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+
+/**
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TestSiteDataImportOverwrite extends AbstractSiteDataImportTest
+{
+
+ @Override
+ protected ImportMode getMode()
+ {
+ return ImportMode.OVERWRITE;
+ }
+
+ @Override
+ protected void afterSecondBootWithOverride(PortalContainer container) throws Exception
+ {
+ RequestLifeCycle.begin(container);
+
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ PortalConfig portal = dataStorage.getPortalConfig("classic");
+ Container layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ Application<Portlet> layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site2/layout", dataStorage.getId(layoutPortlet.getState()));
+
+ //
+ Page home = dataStorage.getPage("portal::classic::home");
+ assertNotNull(home);
+ assertEquals("site 1", home.getTitle());
+
+ Page page1 = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page1);
+ assertEquals("site 2", page1.getTitle());
+
+ Page page2 = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page2);
+ assertEquals("site 2", page2.getTitle());
+
+ Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
+ assertNotNull(dashboard1);
+ assertEquals("site 2", dashboard1.getTitle());
+
+ RequestLifeCycle.end();
+ }
+}
Modified: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport0-configuration.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -28,7 +28,6 @@
<name>new.portal.config.user.listener</name>
<set-method>initListener</set-method>
<type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <priority>1</priority>
<init-params>
<value-param>
<name>default.portal</name>
Modified: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -18,48 +18,70 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
- xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
- <external-component-plugins>
- <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
- <component-plugin>
- <name>new.portal.config.user.listener</name>
- <set-method>initListener</set-method>
- <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <init-params>
- <value-param>
- <name>default.portal</name>
- <value>classic</value>
- </value-param>
- <value-param>
- <name>override</name>
- <value>${override.1}</value>
- </value-param>
- <object-param>
- <name>portal.configuration</name>
- <object type="org.exoplatform.portal.config.NewPortalConfig">
- <field name="predefinedOwner">
- <collection type="java.util.HashSet">
- <value>
- <string>classic</string>
- </value>
- </collection>
- </field>
- <field name="ownerType">
- <string>portal</string>
- </field>
- <field name="templateLocation">
- <string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
- </field>
- <field name="importMode">
- <string>${import.mode.1}</string>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
+ <external-component-plugins>
+ <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
+ <component-plugin>
+ <name>new.portal.config.user.listener</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <priority>1</priority>
+ <init-params>
+ <value-param>
+ <name>default.portal</name>
+ <value>classic</value>
+ </value-param>
+ <value-param>
+ <name>override</name>
+ <value>${override.1}</value>
+ </value-param>
+ <object-param>
+ <name>portal.configuration</name>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>classic</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>portal</string>
+ </field>
+ <field name="templateLocation">
+ <string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode.1}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>user.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>root</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>user</string>
+ </field>
+ <field name="templateLocation">
+ <string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode.1}</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -22,45 +22,67 @@
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd http://www.exoplaform.org/xml/ns/kernel_1_2.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
- <external-component-plugins>
- <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
- <component-plugin>
- <name>new.portal.config.user.listener</name>
- <set-method>initListener</set-method>
- <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
- <priority>1</priority>
- <init-params>
- <value-param>
- <name>default.portal</name>
- <value>classic</value>
- </value-param>
- <value-param>
- <name>override</name>
- <value>${override_2}</value>
- </value-param>
- <object-param>
- <name>portal.configuration</name>
- <object type="org.exoplatform.portal.config.NewPortalConfig">
- <field name="predefinedOwner">
- <collection type="java.util.HashSet">
- <value>
- <string>classic</string>
- </value>
- </collection>
- </field>
- <field name="ownerType">
- <string>portal</string>
- </field>
- <field name="templateLocation">
- <string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
- </field>
- <field name="importMode">
- <string>${import.mode_2}</string>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
+ <external-component-plugins>
+ <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
+ <component-plugin>
+ <name>new.portal.config.user.listener</name>
+ <set-method>initListener</set-method>
+ <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
+ <priority>2</priority>
+ <init-params>
+ <value-param>
+ <name>default.portal</name>
+ <value>classic</value>
+ </value-param>
+ <value-param>
+ <name>override</name>
+ <value>${override_2}</value>
+ </value-param>
+ <object-param>
+ <name>portal.configuration</name>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>classic</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>portal</string>
+ </field>
+ <field name="templateLocation">
+ <string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode_2}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>user.configuration</name>
+ <description>description</description>
+ <object type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>root</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>user</string>
+ </field>
+ <field name="templateLocation">
+ <string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode_2}</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/portal/classic/pages.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -25,16 +25,30 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>page1</name>
- <portlet-application>
- <portlet>
- <application-ref>site1</application-ref>
- <portlet-ref>page1</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </page>
+ <page>
+ <name>home</name>
+ <title>site 1</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site1</application-ref>
+ <portlet-ref>home</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+
+ <page>
+ <name>page1</name>
+ <title>site 1</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site1</application-ref>
+ <portlet-ref>page1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
</page-set>
Added: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/navigation.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>3</priority>
+</node-navigation>
Added: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/user/root/pages.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<page-set
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
+ </page-set>
+
Modified: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/portal/classic/pages.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -25,28 +25,30 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <page>
- <name>page1</name>
- <portlet-application>
- <portlet>
- <application-ref>site2</application-ref>
- <portlet-ref>page1</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </page>
-
<page>
- <name>page2</name>
- <portlet-application>
- <portlet>
- <application-ref>site2</application-ref>
- <portlet-ref>page2</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
+ <name>page1</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>page1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
</portlet-application>
</page>
+ <page>
+ <name>page2</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>page2</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+
</page-set>
Added: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/navigation.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>3</priority>
+
+ <page-nodes>
+ <node>
+ <name>Default_Tab</name>
+ <icon>Default_Tab_icon</icon>
+ </node>
+ </page-nodes>
+</node-navigation>
Added: portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml (rev 0)
+++ portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/user/root/pages.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<page-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
+
+ <page>
+ <name>dashboard1</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>dashboard1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+</page-set>
+
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-09-16 05:19:40 UTC (rev 7449)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-09-16 06:17:30 UTC (rev 7450)
@@ -180,7 +180,6 @@
</field>
<field name="ownerType"><string>portal</string></field>
<field name="templateLocation"><string>war:/conf/portal/</string></field>
- <field name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -197,7 +196,6 @@
</field>
<field name="ownerType"><string>group</string></field>
<field name="templateLocation"><string>war:/conf/portal</string></field>
- <field name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -211,7 +209,6 @@
</field>
<field name="ownerType"><string>user</string></field>
<field name="templateLocation"><string>war:/conf/portal</string></field>
- <field name="importMode"><string>conserve</string></field>
</object>
</object-param>
</init-params>
12 years, 9 months
gatein SVN: r7449 - epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-09-16 01:19:40 -0400 (Fri, 16 Sep 2011)
New Revision: 7449
Modified:
epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Book_Info.xml
epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Installation.xml
epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Revision_History.xml
Log:
JBEPP-777: Removed 'optional' deployment steps
Modified: epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Book_Info.xml 2011-09-15 23:29:13 UTC (rev 7448)
+++ epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Book_Info.xml 2011-09-16 05:19:40 UTC (rev 7449)
@@ -9,7 +9,7 @@
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.2</productnumber>
<edition>5.2.0</edition>
- <pubsnumber>1</pubsnumber>
+ <pubsnumber>2</pubsnumber>
<abstract>
<para>
This book provides information about obtaining, installing and running the JBoss Enterprise Portal Platform Site Publisher extension. It forms the documentation suite along with the Site Publisher User Guide available at <ulink type="http" url="http://docs.redhat.com/docs/en-US/JBoss_Site_Publisher/index.html" />
Modified: epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Installation.xml
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Installation.xml 2011-09-15 23:29:13 UTC (rev 7448)
+++ epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Installation.xml 2011-09-16 05:19:40 UTC (rev 7449)
@@ -119,9 +119,41 @@
</step>
<step>
<para>
- Copy the <filename>gatein-wcm-extension-<replaceable><version></replaceable>-GA.ear</filename> file from the extracted location to the configuration location of your JBoss Enterprise Portal Platform installation (as discussed in <xref linkend="sect-Installation_Guide-Installation-Configuration_Locations" />).
+ Copy the files in the list below from the extracted location to the configuration location of your JBoss Enterprise Portal Platform installation (as discussed in <xref linkend="sect-Installation_Guide-Installation-Configuration_Locations" />):
</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <filename>gatein-wcm-extension-<replaceable><version></replaceable>-GA.ear</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>gatein-eppspdemo-portal-<replaceable><version></replaceable>-GA.ear</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>gatein-ds.xml</filename>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <filename>wcm-ds.xml</filename>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <note>
+ <title>Overwriting gatein-ds.xml</title>
+ <para>
+ Be aware that a base installation of JBoss Enterprise Portal Platform already contains a <filename>gatein-ds.xml</filename> file in the <filename>deploy</filename> directory. It is recommended that this file be backed-up before copying the new Site Publisher version of the file.
+ </para>
+ <para>
+ This ensures that if you wish to 'uninstall' the Site Publisher add-on, you can revert to the original <filename>gatein-ds.xml</filename> file.
+ </para>
+ </note>
</step>
+ <!-- Removed from live text as SP documentation relies on ecmdemo being deployed.
<step>
<para>
<emphasis role="bold">Optional step</emphasis>:
@@ -161,7 +193,7 @@
This ensures that if you wish to 'uninstall' the Site Publisher add-on, you can revert to the original <filename>gatein-ds.xml</filename> file.
</para>
</note>
- </step>
+ </step> -->
<step>
<para>
Start JBoss Enterprise Portal Platform using your established method, the procedures outlined in the JBoss Enterprise Portal Platform Installation Guide or by following the steps below:
Modified: epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Revision_History.xml 2011-09-15 23:29:13 UTC (rev 7448)
+++ epp/docs/branches/5.2/Site_Publisher/Installation_Guide/en-US/Revision_History.xml 2011-09-16 05:19:40 UTC (rev 7449)
@@ -8,7 +8,7 @@
<simpara>
<revhistory>
<revision>
- <revnumber>5.2.0-1</revnumber>
+ <revnumber>5.2.0-2</revnumber>
<date>Mon Aug 29 2011</date>
<author>
<firstname>Scott</firstname>
12 years, 9 months
gatein SVN: r7448 - portal/trunk/docs/reference-guide/en-US/modules/PortletDevelopment.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-09-15 19:29:13 -0400 (Thu, 15 Sep 2011)
New Revision: 7448
Modified:
portal/trunk/docs/reference-guide/en-US/modules/PortletDevelopment/Global_portlet.xml
Log:
Minor edits to Global Portlet content
Modified: portal/trunk/docs/reference-guide/en-US/modules/PortletDevelopment/Global_portlet.xml
===================================================================
--- portal/trunk/docs/reference-guide/en-US/modules/PortletDevelopment/Global_portlet.xml 2011-09-15 23:27:28 UTC (rev 7447)
+++ portal/trunk/docs/reference-guide/en-US/modules/PortletDevelopment/Global_portlet.xml 2011-09-15 23:29:13 UTC (rev 7448)
@@ -4,24 +4,24 @@
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Global_Portlet">
- <title>Global porlet.xml file</title>
+ <title>Global portlet.xml file</title>
<section id="sect-Reference_Guide-Global_Portlet-Global_usecase">
<title>Global portlet.xml usecase</title>
<para>The Portlet Specification introduces PortletFilter as a standard approach to extend the behaviors of portlet
objects. For example, a filter can transform the content of portlet requests and portlet responses.
According to the Portlet Specification, normally there are three steps in setting up a portlet filter:
</para>
- <orderedlist>
- <listitem>
+ <procedure>
+ <step>
<para>Implement a PortletFilter object</para>
- </listitem>
- <listitem>
+ </step>
+ <step>
<para>Define the filter in portlet application deployment descriptor</para>
- </listitem>
- <listitem>
+ </step>
+ <step>
<para>Define the filter mapping in portlet definitions</para>
- </listitem>
- </orderedlist>
+ </step>
+ </procedure>
<para>Two first steps are quite simple and easy to be done, however, at the step 3, developers/administrators
need to replicate the filter mapping in many portlet definitions, that makes work error and tedious in
several use cases.
12 years, 9 months
gatein SVN: r7447 - in epp/docs/branches/5.2: Site_Publisher/Installation_Guide and 2 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-09-15 19:27:28 -0400 (Thu, 15 Sep 2011)
New Revision: 7447
Modified:
epp/docs/branches/5.2/PicketLink_IDM_Reference_Guide/publican.cfg
epp/docs/branches/5.2/Site_Publisher/Installation_Guide/publican.cfg
epp/docs/branches/5.2/Site_Publisher/Release_Notes/publican.cfg
epp/docs/branches/5.2/Site_Publisher/User_Guide/publican.cfg
Log:
Updated publican conf files for new iteration
Modified: epp/docs/branches/5.2/PicketLink_IDM_Reference_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.2/PicketLink_IDM_Reference_Guide/publican.cfg 2011-09-15 23:26:42 UTC (rev 7446)
+++ epp/docs/branches/5.2/PicketLink_IDM_Reference_Guide/publican.cfg 2011-09-15 23:27:28 UTC (rev 7447)
@@ -8,5 +8,5 @@
show_remarks: 1
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
-cvs_pkg: JBoss_Enterprise_Portal_Platform-PicketLink_IDM_Reference_Guide-5.1-web-__LANG__
+cvs_pkg: JBoss_Enterprise_Portal_Platform-PicketLink_IDM_Reference_Guide-5.2-web-__LANG__
Modified: epp/docs/branches/5.2/Site_Publisher/Installation_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/Installation_Guide/publican.cfg 2011-09-15 23:26:42 UTC (rev 7446)
+++ epp/docs/branches/5.2/Site_Publisher/Installation_Guide/publican.cfg 2011-09-15 23:27:28 UTC (rev 7447)
@@ -7,4 +7,4 @@
#show_remarks: 1
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
-cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_Installation_Guide-5.1-web-__LANG__
+cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_Installation_Guide-5.2-web-__LANG__
Modified: epp/docs/branches/5.2/Site_Publisher/Release_Notes/publican.cfg
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/Release_Notes/publican.cfg 2011-09-15 23:26:42 UTC (rev 7446)
+++ epp/docs/branches/5.2/Site_Publisher/Release_Notes/publican.cfg 2011-09-15 23:27:28 UTC (rev 7447)
@@ -7,4 +7,4 @@
#show_remarks: 1
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
-cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_5.1.1_Release_Notes-5.1-web-__LANG__
\ No newline at end of file
+cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_5.2.0_Release_Notes-5.2-web-__LANG__
\ No newline at end of file
Modified: epp/docs/branches/5.2/Site_Publisher/User_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/User_Guide/publican.cfg 2011-09-15 23:26:42 UTC (rev 7446)
+++ epp/docs/branches/5.2/Site_Publisher/User_Guide/publican.cfg 2011-09-15 23:27:28 UTC (rev 7447)
@@ -11,4 +11,4 @@
condition: redhat
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
-cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_User_Guide-5.1-web-__LANG__
\ No newline at end of file
+cvs_pkg: JBoss_Enterprise_Portal_Platform-Site_Publisher_User_Guide-5.2-web-__LANG__
\ No newline at end of file
12 years, 9 months
gatein SVN: r7446 - in epp/docs/branches/5.2/Reference_Guide: en-US and 2 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-09-15 19:26:42 -0400 (Thu, 15 Sep 2011)
New Revision: 7446
Modified:
epp/docs/branches/5.2/Reference_Guide/en-US/Book_Info.xml
epp/docs/branches/5.2/Reference_Guide/en-US/Revision_History.xml
epp/docs/branches/5.2/Reference_Guide/en-US/modules/Advanced/JCR/intro.xml
epp/docs/branches/5.2/Reference_Guide/en-US/modules/PortletDevelopment/Global_Portlet.xml
epp/docs/branches/5.2/Reference_Guide/publican.cfg
Log:
Add Global Portlet content, uncommented text in JCR intro, incremented.
Modified: epp/docs/branches/5.2/Reference_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.2/Reference_Guide/en-US/Book_Info.xml 2011-09-15 23:23:53 UTC (rev 7445)
+++ epp/docs/branches/5.2/Reference_Guide/en-US/Book_Info.xml 2011-09-15 23:26:42 UTC (rev 7446)
@@ -9,7 +9,7 @@
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.2</productnumber>
<edition>5.2.0</edition>
- <pubsnumber>1</pubsnumber>
+ <pubsnumber>5</pubsnumber>
<abstract>
<para>
This Reference Guide is a high-level usage document. It deals with more advanced topics than the Installation and User Guides, adding new content or taking concepts discussed in the earlier documents further. It aims to provide supporting documentation for advanced users of the JBoss Enterprise Portal Platform product. Its primary focus is on advanced use of the product and it assumes an intermediate or advanced knowledge of the technology and terms.
Modified: epp/docs/branches/5.2/Reference_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.2/Reference_Guide/en-US/Revision_History.xml 2011-09-15 23:23:53 UTC (rev 7445)
+++ epp/docs/branches/5.2/Reference_Guide/en-US/Revision_History.xml 2011-09-15 23:26:42 UTC (rev 7446)
@@ -7,6 +7,20 @@
<title>Revision History</title>
<simpara>
<revhistory>
+ <revision>
+ <revnumber>5.2.0-5</revnumber>
+ <date>Wed Sep 14 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email></email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Added Global Portlet Data section.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
<revision>
<revnumber>5.2.0-1</revnumber>
<date>Mon Aug 29 2011</date>
Modified: epp/docs/branches/5.2/Reference_Guide/en-US/modules/Advanced/JCR/intro.xml
===================================================================
--- epp/docs/branches/5.2/Reference_Guide/en-US/modules/Advanced/JCR/intro.xml 2011-09-15 23:23:53 UTC (rev 7445)
+++ epp/docs/branches/5.2/Reference_Guide/en-US/modules/Advanced/JCR/intro.xml 2011-09-15 23:26:42 UTC (rev 7446)
@@ -4,7 +4,7 @@
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Introduction">
- <title>Introduction</title>
+ <title>Introduction</title>
<warning>
<title>eXo JCR usage</title>
<para>
@@ -14,99 +14,98 @@
The information below is intended to assist users to understand particular low level details on how the JBoss Enterprise Portal Platform works and how it can be fine-tuned.
</para>
</warning>
- <para>
- The term <emphasis role="bold">JCR</emphasis> refers to the Java Content Repository. The JCR is the data store of JBoss Enterprise Portal Platform. All content is stored and managed via the JCR.
- </para>
- <para>
- The eXo JCR included with JBoss Enterprise Portal Platform 5.1 is a (<ulink type="http" url="http://www.jcp.org/en/jsr/detail?id=170">JSR-170</ulink>) compliant implementation of the JCR 1.0 specification. The JCR provides versioning, textual search, access control, content event monitoring, and is used to storing text and binary data for the portal internal usage. The back-end storage of the JCR is configurable and can be a file system or a database.
- </para>
- <section id="sect-Reference_Guide-Introduction-Concepts">
- <title>Concepts</title>
- <variablelist>
- <varlistentry>
- <term>Repository</term>
- <listitem>
- <para>
- A repository is a form of data storage device. A 'repository' differs from a 'database' in the nature of the information contained. While a database holds hard data in rigid tables, a repository may access the data on a database by using less rigid <emphasis>meta</emphasis>-data. In this sense a repository operates as an 'interpreter' between the database(s) and the user.
- </para>
- <note>
- <para>
- The data model for the interface (the repository) is rarely the same as the data model used by the repository's underlying storage subsystems (such as a database), however the repository is able to make persistent data changes in the storage subsystem.
- </para>
- </note>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>Workspace</term>
- <listitem>
- <para>
- The eXo JCR uses 'workspaces' as the main data abstraction in its data model. The content is stored in a workspace as a hierarchy of <emphasis>items</emphasis> and each workspace has its own hierarchy of items.
- </para>
- <para>
- Repositories access one or more workspaces. Persistent JCR workspaces consist of a directed acyclic graph of <emphasis>items</emphasis> where the edges represent the parent-child relation.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>Items</term>
- <listitem>
- <para>
- An <emphasis>item</emphasis> is either a <emphasis>node</emphasis> or a <emphasis>property</emphasis>. Properties contain the data (either simple values or binary data). The nodes of a workspace give it its structure while the properties hold the data itself.
- </para>
- <variablelist>
- <varlistentry>
- <term>Nodes</term>
- <listitem>
- <para>
- Nodes are identified using accepted <emphasis>namespacing</emphasis> conventions. Changed nodes may be versioned through an associated version graph to preserve data integrity.
- </para>
- <para>
- Nodes can have various properties or child nodes associated to them.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>Properties</term>
- <listitem>
- <para>
- Properties hold data as values of predefined types, such as: <emphasis role="bold">String</emphasis>, <emphasis role="bold">Binary</emphasis>, <emphasis role="bold">Long</emphasis>, <emphasis role="bold">Boolean</emphasis>, <emphasis role="bold">Double</emphasis>, <emphasis role="bold">Date</emphasis>, <emphasis role="bold">Reference</emphasis> and <emphasis role="bold">Path</emphasis>.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </listitem>
- </varlistentry>
- <!-- Commented as possibly not required in this document.
-<varlistentry>
-<term>The Data Model</term>
-<listitem>
-<para>
-The core of any Content Repository is the data model. The data model defines the 'data elements' (fields, columns, attributes, etc.) that are stored in the CR and the relationships between these elements.
-</para>
-<para>
-Data elements can be singular pieces of information (the value 3.14, for example), or compound values ('<emphasis>pi</emphasis>' = 3.14). A data model uses concepts like 'nodes', 'arrays' and 'links' to define relationships between data elements.
-</para>
-<para>
-The use and structure of these elements forms the content repository's 'data model'.
-</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>Data Abstraction</term>
-<listitem>
-<para>
-Data abstraction describes the separation between <emphasis>abstract</emphasis> and <emphasis>concrete</emphasis> properties of data stored in a repository. The <emphasis>concrete</emphasis> properties of the data refer to its implementation details.
-</para>
-<para>
-The <emphasis>concrete</emphasis> properties of the data implementation may be changed without affecting the <emphasis>abstract</emphasis> properties of the data itself, which are read by the data client.
-</para>
-<para>
-Consider the presentation of data in a list, graph or table. While the information <emphasis>implementation</emphasis> may change, the data itself is unaffected, and readers to whom the data is presented can perform a mental abstraction to interpret it correctly, regardless of the implementation.
-</para>
-</listitem>
-</varlistentry> -->
- </variablelist>
- <!-- Commented until image can be redrawn for RedHat. Reinstitue for 5.1.0 release
+ <para>
+ The term <emphasis role="bold">JCR</emphasis> refers to the Java Content Repository. The JCR is the data store of JBoss Enterprise Portal Platform. All content is stored and managed via the JCR.
+ </para>
+ <para>
+ The eXo JCR included with JBoss Enterprise Portal Platform &VY; is a (<ulink type="http" url="http://www.jcp.org/en/jsr/detail?id=170">JSR-170</ulink>) compliant implementation of the JCR 1.0 specification. The JCR provides versioning, textual search, access control, content event monitoring, and is used to storing text and binary data for the portal internal usage. The back-end storage of the JCR is configurable and can be a file system or a database.
+ </para>
+ <section id="sect-Reference_Guide-Introduction-Concepts">
+ <title>Concepts</title>
+ <variablelist>
+ <varlistentry>
+ <term>Repository</term>
+ <listitem>
+ <para>
+ A repository is a form of data storage device. A 'repository' differs from a 'database' in the nature of the information contained. While a database holds hard data in rigid tables, a repository may access the data on a database by using less rigid <emphasis>meta</emphasis>-data. In this sense a repository operates as an 'interpreter' between the database(s) and the user.
+ </para>
+ <note>
+ <para>
+ The data model for the interface (the repository) is rarely the same as the data model used by the repository's underlying storage subsystems (such as a database), however the repository is able to make persistent data changes in the storage subsystem.
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Workspace</term>
+ <listitem>
+ <para>
+ The eXo JCR uses 'workspaces' as the main data abstraction in its data model. The content is stored in a workspace as a hierarchy of <emphasis>items</emphasis> and each workspace has its own hierarchy of items.
+ </para>
+ <para>
+ Repositories access one or more workspaces. Persistent JCR workspaces consist of a directed acyclic graph of <emphasis>items</emphasis> where the edges represent the parent-child relation.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Items</term>
+ <listitem>
+ <para>
+ An <emphasis>item</emphasis> is either a <emphasis>node</emphasis> or a <emphasis>property</emphasis>. Properties contain the data (either simple values or binary data). The nodes of a workspace give it its structure while the properties hold the data itself.
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>Nodes</term>
+ <listitem>
+ <para>
+ Nodes are identified using accepted <emphasis>namespacing</emphasis> conventions. Changed nodes may be versioned through an associated version graph to preserve data integrity.
+ </para>
+ <para>
+ Nodes can have various properties or child nodes associated to them.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Properties</term>
+ <listitem>
+ <para>
+ Properties hold data as values of predefined types, such as: <emphasis role="bold">String</emphasis>, <emphasis role="bold">Binary</emphasis>, <emphasis role="bold">Long</emphasis>, <emphasis role="bold">Boolean</emphasis>, <emphasis role="bold">Double</emphasis>, <emphasis role="bold">Date</emphasis>, <emphasis role="bold">Reference</emphasis> and <emphasis role="bold">Path</emphasis>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>The Data Model</term>
+ <listitem>
+ <para>
+ The core of any Content Repository is the data model. The data model defines the 'data elements' (fields, columns, attributes, etc.) that are stored in the CR and the relationships between these elements.
+ </para>
+ <para>
+ Data elements can be singular pieces of information (the value 3.14, for example), or compound values ('<emphasis>pi</emphasis>' = 3.14). A data model uses concepts like 'nodes', 'arrays' and 'links' to define relationships between data elements.
+ </para>
+ <para>
+ The use and structure of these elements forms the content repository's 'data model'.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Data Abstraction</term>
+ <listitem>
+ <para>
+ Data abstraction describes the separation between <emphasis>abstract</emphasis> and <emphasis>concrete</emphasis> properties of data stored in a repository. The <emphasis>concrete</emphasis> properties of the data refer to its implementation details.
+ </para>
+ <para>
+ The <emphasis>concrete</emphasis> properties of the data implementation may be changed without affecting the <emphasis>abstract</emphasis> properties of the data itself, which are read by the data client.
+ </para>
+ <para>
+ Consider the presentation of data in a list, graph or table. While the information <emphasis>implementation</emphasis> may change, the data itself is unaffected, and readers to whom the data is presented can perform a mental abstraction to interpret it correctly, regardless of the implementation.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <!-- Commented until image can be redrawn for RedHat.
<mediaobject>
<imageobject role="html">
<imagedata fileref="images/Advanced/JCR/repository_diagram.png" format="PNG" align="center" scale="90" />
@@ -129,7 +128,7 @@
Source Author: Day Management AG
Source Author email:
Source License: http://www.day.com/specs/jcr/2.0/license.html] -->
- </section>
+ </section>
</section>
Modified: epp/docs/branches/5.2/Reference_Guide/en-US/modules/PortletDevelopment/Global_Portlet.xml
===================================================================
--- epp/docs/branches/5.2/Reference_Guide/en-US/modules/PortletDevelopment/Global_Portlet.xml 2011-09-15 23:23:53 UTC (rev 7445)
+++ epp/docs/branches/5.2/Reference_Guide/en-US/modules/PortletDevelopment/Global_Portlet.xml 2011-09-15 23:26:42 UTC (rev 7446)
@@ -3,8 +3,8 @@
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
%BOOK_ENTITIES;
]>
-<chapter id="chap-Reference_Guide-Global_Portlet_Data_Data">
- <title>Global Portlet Data</title>
+<chapter id="chap-Reference_Guide-Global_Portlet_Data">
+ <title><remark>Global Portlet Data</remark></title>
<section id="sect-Reference_Guide-Global_Portlet_Data-The_Global_Data_File">
<title>The Global Data File</title>
<para>
@@ -67,7 +67,7 @@
</listitem>
</orderedlist>
- <section id="sect-Reference_Guide-Global_Metadata_Elements-Global_Portlet-Portlet_Filter">
+ <section id="sect-Reference_Guide-Global_Portlet_Data-Global_Metadata_Elements-Portlet_Filter">
<title>Portlet Filter</title>
<para>
Portlet filter mappings declared in the global <filename>portlet.xml</filename> file are applied across portlet applications.
Modified: epp/docs/branches/5.2/Reference_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.2/Reference_Guide/publican.cfg 2011-09-15 23:23:53 UTC (rev 7445)
+++ epp/docs/branches/5.2/Reference_Guide/publican.cfg 2011-09-15 23:26:42 UTC (rev 7446)
@@ -5,7 +5,7 @@
type: Book
brand: JBoss
debug:1
-#show_remarks: 1
+show_remarks: 1
cvs_branch: DOCS-RHEL-6
cvs_root: :ext:cvs.devel.redhat.com:/cvs/dist
cvs_pkg: JBoss_Enterprise_Portal_Platform-Reference_Guide-5.2-web-__LANG__
\ No newline at end of file
12 years, 9 months
gatein SVN: r7445 - epp/docs/branches/5.2/User_Guide/en-US.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-09-15 19:23:53 -0400 (Thu, 15 Sep 2011)
New Revision: 7445
Modified:
epp/docs/branches/5.2/User_Guide/en-US/Book_Info.xml
epp/docs/branches/5.2/User_Guide/en-US/Revision_History.xml
Log:
Updated for new iteration
Modified: epp/docs/branches/5.2/User_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.2/User_Guide/en-US/Book_Info.xml 2011-09-15 23:23:25 UTC (rev 7444)
+++ epp/docs/branches/5.2/User_Guide/en-US/Book_Info.xml 2011-09-15 23:23:53 UTC (rev 7445)
@@ -7,7 +7,7 @@
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.2</productnumber>
<edition>5.2.0</edition>
- <pubsnumber>3</pubsnumber>
+ <pubsnumber>4</pubsnumber>
<abstract>
<para>
This document provides an easy to follow guide to the functions and
Modified: epp/docs/branches/5.2/User_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.2/User_Guide/en-US/Revision_History.xml 2011-09-15 23:23:25 UTC (rev 7444)
+++ epp/docs/branches/5.2/User_Guide/en-US/Revision_History.xml 2011-09-15 23:23:53 UTC (rev 7445)
@@ -8,7 +8,7 @@
<simpara>
<revhistory>
<revision>
- <revnumber>5.2.0-3</revnumber>
+ <revnumber>5.2.0-4</revnumber>
<date>Mon Sep 12 2011</date>
<author>
<firstname>Scott</firstname>
@@ -17,7 +17,7 @@
</author>
<revdescription>
<simplelist>
- <member>Added warning to <emphasis>Publication date ∓ time</emphasis> text.</member>
+ <member>Added warning to Publication Date text.</member>
</simplelist>
</revdescription>
</revision>
12 years, 9 months