gatein SVN: r4171 - portal/trunk/testsuite/selenium-snifftests/src/main/java/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: vuthelinh
Date: 2010-09-13 06:54:28 -0400 (Mon, 13 Sep 2010)
New Revision: 4171
Modified:
portal/trunk/testsuite/selenium-snifftests/src/main/java/org/exoplatform/portal/selenium/SeleniumTestCaseGenerator.java
Log:
add assertAlert() command. it is used in Test_SNF_ECMS_03_CreateCLVPageByContent_ecmdemo
Modified: portal/trunk/testsuite/selenium-snifftests/src/main/java/org/exoplatform/portal/selenium/SeleniumTestCaseGenerator.java
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/main/java/org/exoplatform/portal/selenium/SeleniumTestCaseGenerator.java 2010-09-13 10:33:00 UTC (rev 4170)
+++ portal/trunk/testsuite/selenium-snifftests/src/main/java/org/exoplatform/portal/selenium/SeleniumTestCaseGenerator.java 2010-09-13 10:54:28 UTC (rev 4171)
@@ -162,7 +162,11 @@
sb.append("TestCase.assertTrue(selenium.getConfirmation().matches(\"^");
sb.append(param2);
sb.append("$\"));\n");
- } else if (param1.equals("assertLocation")) {
+ } else if (param1.equals("assertAlert")) {
+ sb.append("TestCase.assertTrue(selenium.getAlert().matches(\"^");
+ sb.append(param2);
+ sb.append("$\"));\n");
+ }else if (param1.equals("assertLocation")) {
sb.append("TestCase.assertTrue(selenium.getLocation().matches(\"^");
sb.append(param2);
sb.append("$\"));\n");
14 years, 3 months
gatein SVN: r4170 - in portal/branches/branch-r4047/examples: extension/war/src/main/resources and 4 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-09-13 06:33:00 -0400 (Mon, 13 Sep 2010)
New Revision: 4170
Added:
portal/branches/branch-r4047/examples/extension/war/src/main/resources/
portal/branches/branch-r4047/examples/extension/war/src/main/resources/tomcat/
portal/branches/branch-r4047/examples/extension/war/src/main/resources/tomcat/sample-ext.xml
portal/branches/branch-r4047/examples/portal/war/src/main/resources/
portal/branches/branch-r4047/examples/portal/war/src/main/resources/tomcat/
portal/branches/branch-r4047/examples/portal/war/src/main/resources/tomcat/sample-portal.xml
Log:
GTNPORTAL-1475 Add context path file for sample portal and sample extension
Added: portal/branches/branch-r4047/examples/extension/war/src/main/resources/tomcat/sample-ext.xml
===================================================================
--- portal/branches/branch-r4047/examples/extension/war/src/main/resources/tomcat/sample-ext.xml (rev 0)
+++ portal/branches/branch-r4047/examples/extension/war/src/main/resources/tomcat/sample-ext.xml 2010-09-13 10:33:00 UTC (rev 4170)
@@ -0,0 +1 @@
+<Context path="/sample-ext" docBase="../../../../../examples/extension/war/src/main/webapp/" debug="0" reloadable="true" crossContext="true"/>
Added: portal/branches/branch-r4047/examples/portal/war/src/main/resources/tomcat/sample-portal.xml
===================================================================
--- portal/branches/branch-r4047/examples/portal/war/src/main/resources/tomcat/sample-portal.xml (rev 0)
+++ portal/branches/branch-r4047/examples/portal/war/src/main/resources/tomcat/sample-portal.xml 2010-09-13 10:33:00 UTC (rev 4170)
@@ -0,0 +1 @@
+<Context path="/sample-portal" docBase="../../../../../examples/portal/war/src/main/webapp/" debug="0" reloadable="true" crossContext="true"/>
14 years, 3 months
gatein SVN: r4169 - in portal/branches/navcontroller: component/web/controller/src/main/java/org/exoplatform/web/controller/router and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-13 06:29:08 -0400 (Mon, 13 Sep 2010)
New Revision: 4169
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
Log:
update to use new RenderContext
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java 2010-09-13 09:33:19 UTC (rev 4168)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/ControllerContext.java 2010-09-13 10:29:08 UTC (rev 4169)
@@ -20,6 +20,8 @@
package org.exoplatform.web;
import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.router.RenderContext;
+import org.exoplatform.web.controller.router.SimpleRenderContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -44,6 +46,9 @@
/** . */
private final Map<QualifiedName, String> parameters;
+ /** . */
+ private SimpleRenderContext renderContext;
+
ControllerContext(
WebAppController controller,
HttpServletRequest request,
@@ -54,6 +59,7 @@
this.request = request;
this.response = response;
this.parameters = parameters;
+ this.renderContext = null;
}
public WebAppController getController()
@@ -76,8 +82,32 @@
return parameters.get(parameter);
}
+ public void renderURL(Map<QualifiedName, String> parameters, RenderContext renderContext)
+ {
+ renderContext.appendPath(request.getContextPath());
+
+ //
+ controller.router.render(parameters, renderContext);
+ }
+
public String renderURL(Map<QualifiedName, String> parameters)
{
- return request.getContextPath() + controller.router.render(parameters);
+ if (renderContext == null)
+ {
+ renderContext = new SimpleRenderContext();
+ }
+ else
+ {
+ renderContext.reset();
+ }
+
+ //
+ renderContext.appendPath(request.getContextPath());
+
+ //
+ controller.router.render(parameters, renderContext);
+
+ //
+ return renderContext.getPath();
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java 2010-09-13 09:33:19 UTC (rev 4168)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java 2010-09-13 10:29:08 UTC (rev 4169)
@@ -36,6 +36,15 @@
/** . */
private Map<String, String> queryParams = Collections.emptyMap();
+ public SimpleRenderContext()
+ {
+ }
+
+ public SimpleRenderContext(StringBuilder sb)
+ {
+ this.sb = sb;
+ }
+
public String getPath()
{
return sb != null ? sb.toString() : null;
@@ -46,6 +55,18 @@
return queryParams;
}
+ public void reset()
+ {
+ if (sb != null)
+ {
+ sb.setLength(0);
+ }
+ if (queryParams.size() > 0)
+ {
+ queryParams.clear();
+ }
+ }
+
public void appendPath(char c)
{
if (sb == null)
Modified: portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml 2010-09-13 09:33:19 UTC (rev 4168)
+++ portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml 2010-09-13 10:29:08 UTC (rev 4169)
@@ -277,7 +277,25 @@
<url-pattern>/</url-pattern>
</servlet-mapping>
+ <!-- Explicit mappings (due to portal servlet on '/') for UIHomePagePortlet, need to find out how to improve that -->
<servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>*.jpg</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>*.png</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>*.gif</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>*.css</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
<servlet-name>GateInServlet</servlet-name>
<url-pattern>/gateinservlet</url-pattern>
</servlet-mapping>
Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-13 09:33:19 UTC (rev 4168)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-13 10:29:08 UTC (rev 4169)
@@ -24,6 +24,8 @@
import org.exoplatform.web.ControllerContext;
import org.exoplatform.web.WebAppController;
import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.router.RenderContext;
+import org.exoplatform.web.controller.router.SimpleRenderContext;
import org.exoplatform.web.url.ResourceLocator;
import org.exoplatform.web.url.ResourceURL;
@@ -41,6 +43,12 @@
/** . */
private final PortalRequestContext requestContext;
+ /** . */
+ private StringBuilder buffer;
+
+ /** . */
+ private SimpleRenderContext renderContext;
+
public PortalURL(PortalRequestContext requestContext, L locator, Boolean ajax)
{
super(locator, ajax);
@@ -58,7 +66,15 @@
public String toString()
{
//
- StringBuilder url = new StringBuilder();
+ if (renderContext == null)
+ {
+ buffer = new StringBuilder();
+ renderContext = new SimpleRenderContext(buffer);
+ }
+ else
+ {
+ renderContext.reset();
+ }
//
if (locator.getResource() == null)
@@ -69,7 +85,7 @@
//
if (ajax)
{
- url.append("javascript:ajaxGet('");
+ buffer.append("javascript:ajaxGet('");
}
//
@@ -92,20 +108,16 @@
parameters.put(WebAppController.HANDLER_PARAM, "portal");
//
- ControllerContext controllerContext = requestContext.getControllerContext();
- String s = controllerContext.renderURL(parameters);
+ requestContext.getControllerContext().renderURL(parameters, renderContext);
//
- url.append(s);
-
- //
if (ajax)
{
- url.append("?ajaxRequest=true");
- url.append("')");
+ buffer.append("?ajaxRequest=true");
+ buffer.append("')");
}
//
- return url.toString();
+ return buffer.toString();
}
}
14 years, 3 months
gatein SVN: r4168 - in portal/branches/navcontroller/component/web/controller/src: test/java/org/exoplatform/web/controller/router and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-13 05:33:19 -0400 (Mon, 13 Sep 2010)
New Revision: 4168
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java
Log:
finished impl of request param support
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RenderContext.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -0,0 +1,35 @@
+/*
+ * 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.router;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface RenderContext
+{
+
+ void appendPath(char s);
+
+ void appendPath(String s);
+
+ void appendQueryParameter(String parameterName, String paramaterValue);
+
+}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java 2010-09-13 09:30:45 UTC (rev 4167)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -50,33 +50,26 @@
//
PatternBuilder matchValue = new PatternBuilder();
matchValue.expr("^");
- boolean litteral = true;
+ int level = 0;
for (char c : descriptor.getMatchValue().toCharArray())
{
switch (c)
{
case '{':
- if (litteral)
+
+ if (level++ > 0)
{
- litteral = false;
- }
- else
- {
matchValue.expr('{');
}
break;
case '}':
- if (litteral)
+ if (--level > 0)
{
- litteral = true;
- }
- else
- {
matchValue.expr('}');
}
break;
default:
- if (litteral)
+ if (level == 0)
{
matchValue.litteral(c);
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 09:30:45 UTC (rev 4167)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -74,55 +74,57 @@
* 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 String render(Map<QualifiedName, String> blah)
+ final void render(Map<QualifiedName, String> blah, RenderContext renderContext)
{
Route r = find(blah);
- if (r == null)
+ if (r != null)
{
- return null;
+ r._render(blah, renderContext);
}
- else
- {
- if (r instanceof PatternRoute || r instanceof SegmentRoute)
- {
- StringBuilder sb = new StringBuilder();
- r.render(blah, sb);
- return sb.toString();
- }
- else
- {
- return "/";
- }
- }
}
- private void render(Map<QualifiedName, String> blah, StringBuilder sb)
+ private void _render(Map<QualifiedName, String> blah, RenderContext renderContext)
{
- if (parent != null)
+ if (parent != null && parent.parent != null)
{
- parent.render(blah, sb);
+ parent._render(blah, renderContext);
}
//
+ if (requestParamDefs.size() > 0)
+ {
+ for (RequestParamDef requestParamDef : requestParamDefs.values())
+ {
+ String s = blah.get(requestParamDef.getName());
+ renderContext.appendQueryParameter(requestParamDef.getMatchName(), s);
+ }
+ }
+
+ //
if (this instanceof SegmentRoute)
{
SegmentRoute sr = (SegmentRoute)this;
- sb.append('/').append(sr.name);
+ renderContext.appendPath('/');
+ renderContext.appendPath(sr.name);
}
else if (this instanceof PatternRoute)
{
PatternRoute pr = (PatternRoute)this;
- sb.append('/');
+ renderContext.appendPath('/');
int i = 0;
while (i < pr.parameterNames.size())
{
- sb.append(pr.chunks.get(i));
+ renderContext.appendPath(pr.chunks.get(i));
String value = blah.get(pr.parameterNames.get(i));
- sb.append(value);
+ renderContext.appendPath(value);
i++;
}
- sb.append(pr.chunks.get(i));
+ renderContext.appendPath(pr.chunks.get(i));
}
+ else
+ {
+ renderContext.appendPath("/");
+ }
}
final Route find(Map<QualifiedName, String> blah)
@@ -145,6 +147,25 @@
}
}
+ // Match any request parameter
+ if (requestParamDefs.size() > 0)
+ {
+ for (RequestParamDef requestParamDef : requestParamDefs.values())
+ {
+ String a = blah.get(requestParamDef.name);
+ if (a != null)
+ {
+ if (requestParamDef.matchValue.matcher(a).matches())
+ {
+ //
+ abc.remove(requestParamDef.name);
+ continue;
+ }
+ }
+ return null;
+ }
+ }
+
// Match any pattern parameter
if (this instanceof PatternRoute)
{
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 09:30:45 UTC (rev 4167)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -53,9 +53,16 @@
root.append(routeMetaData);
}
+ public void render(Map<QualifiedName, String> parameters, RenderContext renderContext)
+ {
+ root.render(parameters, renderContext);
+ }
+
public String render(Map<QualifiedName, String> parameters)
{
- return root.render(parameters);
+ SimpleRenderContext renderContext = new SimpleRenderContext();
+ render(parameters, renderContext);
+ return renderContext.getPath();
}
public Map<QualifiedName, String> route(String path) throws IOException
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRenderContext.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -0,0 +1,76 @@
+/*
+ * 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.router;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class SimpleRenderContext implements RenderContext
+{
+
+ /** . */
+ private StringBuilder sb = null;
+
+ /** . */
+ private Map<String, String> queryParams = Collections.emptyMap();
+
+ public String getPath()
+ {
+ return sb != null ? sb.toString() : null;
+ }
+
+ public Map<String, String> getQueryParams()
+ {
+ return queryParams;
+ }
+
+ public void appendPath(char c)
+ {
+ if (sb == null)
+ {
+ sb = new StringBuilder();
+ }
+ sb.append(c);
+ }
+
+ public void appendPath(String s)
+ {
+ if (sb == null)
+ {
+ sb = new StringBuilder();
+ }
+ sb.append(s);
+ }
+
+ public void appendQueryParameter(String parameterName, String paramaterValue)
+ {
+ if (queryParams.isEmpty())
+ {
+ queryParams = new HashMap<String, String>();
+ }
+ queryParams.put(parameterName, paramaterValue);
+ }
+
+}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java 2010-09-13 09:30:45 UTC (rev 4167)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java 2010-09-13 09:33:19 UTC (rev 4168)
@@ -39,8 +39,17 @@
RouterDescriptor descriptor = new RouterDescriptor();
descriptor.addRoute(new RouteDescriptor("/").addRequestParam("foo", "a", "a"));
Router router = new Router(descriptor);
+
+ //
assertNull(router.route("/"));
assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/", Collections.singletonMap("a", new String[]{"a"})));
+
+ //
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
+ SimpleRenderContext renderContext = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("foo"), "a"), renderContext);
+ assertEquals("/", renderContext.getPath());
+ assertEquals(Collections.singletonMap("a", "a"), renderContext.getQueryParams());
}
public void testSegment() throws Exception
@@ -48,19 +57,61 @@
RouterDescriptor descriptor = new RouterDescriptor();
descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a"));
Router router = new Router(descriptor);
+
+ //
assertNull(router.route("/a"));
assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
+
+ //
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
+ SimpleRenderContext renderContext = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("foo"), "a"), renderContext);
+ assertEquals("/a", renderContext.getPath());
+ assertEquals(Collections.singletonMap("a", "a"), renderContext.getQueryParams());
}
+ public void testValuePattern() throws Exception
+ {
+ RouterDescriptor descriptor = new RouterDescriptor();
+ descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "{[0-9]+}"));
+ Router router = new Router(descriptor);
+
+ //
+ assertNull(router.route("/a"));
+ assertNull(router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "0123"), router.route("/a", Collections.singletonMap("a", new String[]{"0123"})));
+
+ //
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
+ assertNull(router.render(Collections.singletonMap(QualifiedName.parse("foo"), "a")));
+ SimpleRenderContext renderContext = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("foo"), "12"), renderContext);
+ assertEquals("/a", renderContext.getPath());
+ assertEquals(Collections.singletonMap("a", "12"), renderContext.getQueryParams());
+ }
+
public void testPrecedence() throws Exception
{
RouterDescriptor descriptor = new RouterDescriptor();
descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a"));
descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("bar", "b", "b"));
Router router = new Router(descriptor);
+
+ //
assertNull(router.route("/a"));
assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
assertEquals(Collections.singletonMap(QualifiedName.parse("bar"), "b"), router.route("/a", Collections.singletonMap("b", new String[]{"b"})));
+
+ //
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
+ SimpleRenderContext renderContext1 = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("foo"), "a"), renderContext1);
+ assertEquals("/a", renderContext1.getPath());
+ assertEquals(Collections.singletonMap("a", "a"), renderContext1.getQueryParams());
+ SimpleRenderContext renderContext2 = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("bar"), "b"), renderContext2);
+ assertEquals("/a", renderContext2.getPath());
+ assertEquals(Collections.singletonMap("b", "b"), renderContext2.getQueryParams());
}
public void testInheritance() throws Exception
@@ -68,6 +119,8 @@
RouterDescriptor descriptor = new RouterDescriptor();
descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a").addChild(new RouteDescriptor("/b").addRequestParam("bar", "b", "b")));
Router router = new Router(descriptor);
+
+ //
assertNull(router.route("/a"));
assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
assertNull(router.route("/a/b"));
@@ -78,6 +131,21 @@
expectedParameters.put(QualifiedName.parse("foo"), "a");
expectedParameters.put(QualifiedName.parse("bar"), "b");
assertEquals(expectedParameters, router.route("/a/b", requestParameters));
+
+ //
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
+ SimpleRenderContext renderContext1 = new SimpleRenderContext();
+ router.render(Collections.singletonMap(QualifiedName.parse("foo"), "a"), renderContext1);
+ assertEquals("/a", renderContext1.getPath());
+ assertEquals(Collections.singletonMap("a", "a"), renderContext1.getQueryParams());
+
+ SimpleRenderContext renderContext2 = new SimpleRenderContext();
+ router.render(expectedParameters, renderContext2);
+ assertEquals("/a/b", renderContext2.getPath());
+ Map<String, String> expectedRequestParameters = new HashMap<String, String>();
+ expectedRequestParameters.put("a", "a");
+ expectedRequestParameters.put("b", "b");
+ assertEquals(expectedRequestParameters, renderContext2.getQueryParams());
}
}
14 years, 3 months
gatein SVN: r4167 - in portal/branches/branch-r4047/component/scripting/src: test/java/org/exoplatform/groovyscript and 1 other directory.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-09-13 05:30:45 -0400 (Mon, 13 Sep 2010)
New Revision: 4167
Modified:
portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
Log:
GTNPORTAL-1377 Modify GroovyPrinter to use DateFormat.MEDIUM instead of FULL
Modified: portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
===================================================================
--- portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-09-13 09:16:57 UTC (rev 4166)
+++ portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-09-13 09:30:45 UTC (rev 4167)
@@ -111,7 +111,7 @@
{
if (locale != null)
{
- DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
+ DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
o = dateFormat.format((Date)o);
}
}
Modified: portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
===================================================================
--- portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-09-13 09:16:57 UTC (rev 4166)
+++ portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-09-13 09:30:45 UTC (rev 4167)
@@ -49,8 +49,8 @@
public void testDate1() throws Exception
{
GroovyTemplate template = new GroovyTemplate("<% print(new Date(0)); %>");
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970", template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
@@ -58,8 +58,8 @@
{
GroovyTemplate template = new GroovyTemplate("<% def date = new Date(0) %>$date");
System.out.println("template.getGroovy() = " + template.getGroovy());
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970", template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
@@ -67,8 +67,8 @@
{
GroovyTemplate template = new GroovyTemplate("<%= new Date(0) %>");
System.out.println("template.getGroovy() = " + template.getGroovy());
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970", template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
14 years, 3 months
gatein SVN: r4166 - in portal/branches/branch-r4047: web/eXoResources/src/main/webapp/javascript/eXo/webui and 6 other directories.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-09-13 05:16:57 -0400 (Mon, 13 Sep 2010)
New Revision: 4166
Modified:
portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js
portal/branches/branch-r4047/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/webui/core/UIConfirmation.gtmpl
portal/branches/branch-r4047/webui/core/src/main/java/org/exoplatform/webui/core/UIConfirmation.java
portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIEditInlineWorkspace.java
Log:
GTNPORTAL-1368 Add confirmation message when leaving page edition page without saving
Modified: portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
===================================================================
--- portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2010-09-13 09:16:57 UTC (rev 4166)
@@ -126,7 +126,7 @@
blockContainer.appendChild(maskLayer) ;
maskLayer.className = "MaskLayer" ;
maskLayer.id = "MaskLayer" ;
- maskLayer.maxZIndex = 4; //3 ;
+ maskLayer.maxZIndex = eXo.webui.UIPopup.zIndex + 1; //3 ;
maskLayer.style.width = Browser.getBrowserWidth() + "px";
maskLayer.style.height = Browser.getBrowserHeight() + "px";
maskLayer.style.top = "0px" ;
Modified: portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js
===================================================================
--- portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js 2010-09-13 09:16:57 UTC (rev 4166)
@@ -71,7 +71,7 @@
var mask = popup.previousSibling;
if(isShowPopup) {
//Modal if popup is portal component
- if (popup.parentNode.id == "UIPortalApplication") {
+ if (eXo.core.DOMUtil.findAncestorByClass(popup, "PORTLET-FRAGMENT") == null) {
eXo.core.UIMaskLayer.createMask(popup.parentNode, popup, 1) ;
} else {
//If popup is portlet's component, modal with just its parent
Modified: portal/branches/branch-r4047/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- portal/branches/branch-r4047/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-09-13 09:16:57 UTC (rev 4166)
@@ -485,6 +485,14 @@
UIPageEditor.action.SwitchMode=Switch View mode
#############################################################################
+ # org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace #
+ #############################################################################
+
+UIEditInlineWorkspace.confirm.close=Modifications have been made. Are you sure you want to close without saving ?
+UIEditInlineWorkspace.confirm.yes=Yes
+UIEditInlineWorkspace.confirm.no=No
+
+ #############################################################################
# org.exoplatform.portal.component.customization.UIPageForm #
#############################################################################
Modified: portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
===================================================================
--- portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2010-09-13 09:16:57 UTC (rev 4166)
@@ -14,7 +14,7 @@
<div class="OverflowContainer">
<div class="<%=uicomponent.isCollapsed ? "CollapseIcon" : "ExpandIcon"%>" onclick="eXo.portal.UIPortal.toggleComposer(this)"><span></span></div>
<% if(uicomponent.isShowControl) { %>
- <a class="CloseButton" title="<%=_ctx.appRes("word.abort")%>" href="<%=uicomponent.event("Abort")%>"><span></span></a>
+ <a class="CloseButton" title="<%=_ctx.appRes("word.abort")%>" href="<%=uicomponent.event("CloseComposer")%>"><span></span></a>
<% if (uicomponent.isUsedInWizard()) { %>
<a class="<%= isEditted ? "EdittedSaveButton" : "SaveButton" %>" title="<%=_ctx.appRes("word.finish")%>" href="<%=uicomponent.url("Finish")%>" onclick="eXo.core.DOMUtil.disableOnClick(this);" ><span></span></a>
<a class="BackButton"" title="<%=_ctx.appRes("word.back")%>" href="<%=uicomponent.event("Back")%>">
Modified: portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/webui/core/UIConfirmation.gtmpl
===================================================================
--- portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/webui/core/UIConfirmation.gtmpl 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/web/portal/src/main/webapp/groovy/webui/core/UIConfirmation.gtmpl 2010-09-13 09:16:57 UTC (rev 4166)
@@ -76,7 +76,7 @@
}
}
%>
- <div class="UIPopupWindow" id="$popupId" style="width: 550px; display: none;">
+ <div class="UIPopupWindow UIDragObject" id="$popupId" style="width: 550px; display: none;">
<div class="ExoMessageDecorator">
<div class="TopLeftCornerDecorator">
<div class="TopRightCornerDecorator">
@@ -136,9 +136,9 @@
</div>
<%
- rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.init('$popupId', false);");
+ rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.init('$popupId', false, null, null, $uicomponent.showMask);");
if(uicomponent.hasMessage()){
- rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.show('$popupId');");
+ rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.show('$popupId', $uicomponent.showMask);");
rcontext.getJavascriptManager().addJavascript("window.setTimeout(\"eXo.webui.UIPopupWindow.increasezIndex('$popupId')\", 100);");
}
%>
\ No newline at end of file
Modified: portal/branches/branch-r4047/webui/core/src/main/java/org/exoplatform/webui/core/UIConfirmation.java
===================================================================
--- portal/branches/branch-r4047/webui/core/src/main/java/org/exoplatform/webui/core/UIConfirmation.java 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/webui/core/src/main/java/org/exoplatform/webui/core/UIConfirmation.java 2010-09-13 09:16:57 UTC (rev 4166)
@@ -24,7 +24,6 @@
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.form.UIFormInputWithActions.ActionData;
/**
* Created by The eXo Platform SAS
@@ -56,6 +55,7 @@
{
this.message_ = "";
this.caller_ = new Object();
+ setShowMask(true);
setShow(true);
}
@@ -63,6 +63,7 @@
{
this.message_ = message;
this.caller_ = caller;
+ setShowMask(true);
setShow(true);
}
@@ -116,19 +117,16 @@
return (message_!=null) && (!message_.equals(""));
}
- private void hidePopup(WebuiRequestContext context)
+ private void hidePopup(Event<UIConfirmation> event) throws Exception
{
+ WebuiRequestContext context = event.getRequestContext();
this.clearMessage();
- if(this.getParent() == null)
- {
- context.addUIComponentToUpdateByAjax(this);
- return;
- }
-
- if(!this.isShow())
- {
- return;
- }
+ context.addUIComponentToUpdateByAjax(this);
+ UIComponent uiParent = getParent();
+ Event<UIComponent> pEvent =
+ uiParent.createEvent("ClosePopup", event.getExecutionPhase(), event.getRequestContext());
+ if (pEvent != null)
+ pEvent.broadcast();
}
public static class CloseActionListener extends EventListener<UIConfirmation>
@@ -137,8 +135,7 @@
public void execute(Event<UIConfirmation> event) throws Exception
{
UIConfirmation uiConfirmation = event.getSource();
- WebuiRequestContext context = event.getRequestContext();
- uiConfirmation.hidePopup(context);
+ uiConfirmation.hidePopup(event);
}
}
@@ -158,7 +155,7 @@
xEvent.broadcast();
}
- uiConfirmation.hidePopup(context);
+ uiConfirmation.hidePopup(event);
}
}
Modified: portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-09-13 09:16:57 UTC (rev 4166)
@@ -60,6 +60,7 @@
import org.exoplatform.webui.event.Event.Phase;
import java.util.List;
+import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
@@ -67,6 +68,7 @@
@ComponentConfigs({
@ComponentConfig(template = "app:/groovy/portal/webui/portal/UIPortalComposer.gtmpl", events = {
@EventConfig(listeners = UIPortalComposer.ViewPropertiesActionListener.class),
+ @EventConfig(listeners = UIPortalComposer.CloseComposerActionListener.class),
@EventConfig(listeners = UIPortalComposer.AbortActionListener.class),
@EventConfig(listeners = UIPortalComposer.FinishActionListener.class),
@EventConfig(listeners = UIPortalComposer.SwitchModeActionListener.class),
@@ -74,6 +76,7 @@
@EventConfig(listeners = UIPortalComposer.ToggleActionListener.class)}),
@ComponentConfig(id = "UIPageEditor", template = "app:/groovy/portal/webui/portal/UIPortalComposer.gtmpl", events = {
@EventConfig(name = "ViewProperties", listeners = UIPortalComposer.ViewProperties2ActionListener.class),
+ @EventConfig(listeners = UIPortalComposer.CloseComposerActionListener.class),
@EventConfig(name = "Abort", listeners = UIPortalComposer.Abort2ActionListener.class),
@EventConfig(name = "Finish", listeners = UIPortalComposer.Finish2ActionListener.class),
@EventConfig(name = "Back", listeners = UIPortalComposer.BackActionListener.class),
@@ -95,7 +98,7 @@
UITabPane uiTabPane = addChild(UITabPane.class, "UIPortalComposerTab", null);
uiTabPane.addChild(UIApplicationList.class, null, null).setRendered(true);
uiTabPane.addChild(UIContainerList.class, null, null);
- uiTabPane.setSelectedTab(1);
+ uiTabPane.setSelectedTab(1);
}
public int getPortalMode()
@@ -619,6 +622,27 @@
event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
}
}
+
+ static public class CloseComposerActionListener extends EventListener<UIPortalComposer>
+ {
+ public void execute(Event<UIPortalComposer> event) throws Exception
+ {
+ UIPortalComposer uiPortalComposer = event.getSource();
+ UIEditInlineWorkspace uiEditInlineWorkspace = uiPortalComposer.getAncestorOfType(UIEditInlineWorkspace.class);
+ if (uiPortalComposer.isEditted())
+ {
+ ResourceBundle resourceBundle = event.getRequestContext().getApplicationResourceBundle();
+ String closeMessage = resourceBundle.getString("UIEditInlineWorkspace.confirm.close");
+
+ uiEditInlineWorkspace.showConfirmWindow(closeMessage);
+ }
+ else
+ {
+ Event<UIComponent> abortEvent = uiPortalComposer.createEvent("Abort", event.getExecutionPhase(), event.getRequestContext());
+ abortEvent.broadcast();
+ }
+ }
+ }
static public class Abort2ActionListener extends EventListener<UIPortalComposer>
{
Modified: portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIEditInlineWorkspace.java
===================================================================
--- portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIEditInlineWorkspace.java 2010-09-13 08:56:44 UTC (rev 4165)
+++ portal/branches/branch-r4047/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIEditInlineWorkspace.java 2010-09-13 09:16:57 UTC (rev 4166)
@@ -19,19 +19,29 @@
package org.exoplatform.portal.webui.workspace;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
import org.exoplatform.portal.webui.portal.UIPortalComposer;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIConfirmation;
import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIConfirmation.ActionConfirm;
import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
/**
- * Created by The eXo Platform SAS
- * Author : Tan Pham Dinh
- * pdtanit(a)gmail.com
- * Aug 27, 2009
+ * Created by The eXo Platform SAS Author : Tan Pham Dinh pdtanit(a)gmail.com Aug
+ * 27, 2009
*/
-@ComponentConfig(lifecycle = UIContainerLifecycle.class)
+@ComponentConfig(lifecycle = UIContainerLifecycle.class, events = {
+ @EventConfig(listeners = UIEditInlineWorkspace.ConfirmCloseActionListener.class),
+ @EventConfig(listeners = UIEditInlineWorkspace.AbortCloseActionListener.class)})
public class UIEditInlineWorkspace extends UIContainer
{
@@ -39,6 +49,17 @@
{
addChild(UIPortalComposer.class, null, null);
addChild(UIPortalToolPanel.class, null, null);
+
+ ResourceBundle resourceBundle = WebuiRequestContext.getCurrentInstance().getApplicationResourceBundle();
+ String yes = resourceBundle.getString("UIEditInlineWorkspace.confirm.yes");
+ String no = resourceBundle.getString("UIEditInlineWorkspace.confirm.no");
+
+ List<ActionConfirm> actionConfirms = new ArrayList<ActionConfirm>();
+ actionConfirms.add(new ActionConfirm("ConfirmClose", yes));
+ actionConfirms.add(new ActionConfirm("AbortClose", no));
+ UIConfirmation uiConfirmation = addChild(UIConfirmation.class, null, null);
+ uiConfirmation.setCaller(this);
+ uiConfirmation.setActions(actionConfirms);
}
public void setUIComponent(UIComponent uiComp)
@@ -55,4 +76,41 @@
{
return getChild(UIPortalComposer.class);
}
+
+ public void showConfirmWindow(String message)
+ {
+ UIConfirmation uiConfirmation = getChild(UIConfirmation.class);
+ uiConfirmation.setMessage(message);
+ ((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).addUIComponentToUpdateByAjax(uiConfirmation);
+ }
+
+ static public class ConfirmCloseActionListener extends EventListener<UIEditInlineWorkspace>
+ {
+
+ @Override
+ public void execute(Event<UIEditInlineWorkspace> event) throws Exception
+ {
+ UIEditInlineWorkspace uiEditInlineWorkspace = event.getSource();
+
+ UIConfirmation uiConfirmation = uiEditInlineWorkspace.getChild(UIConfirmation.class);
+ uiConfirmation.createEvent("Close", event.getExecutionPhase(), event.getRequestContext()).broadcast();
+
+ UIPortalComposer uiPortalComposer = uiEditInlineWorkspace.getChild(UIPortalComposer.class);
+ Event<UIComponent> abortEvent =
+ uiPortalComposer.createEvent("Abort", event.getExecutionPhase(), event.getRequestContext());
+ abortEvent.broadcast();
+ }
+ }
+
+ static public class AbortCloseActionListener extends EventListener<UIEditInlineWorkspace>
+ {
+
+ @Override
+ public void execute(Event<UIEditInlineWorkspace> event) throws Exception
+ {
+ UIEditInlineWorkspace uiEditInlineWorkspace = event.getSource();
+ UIConfirmation uiConfirmation = uiEditInlineWorkspace.getChild(UIConfirmation.class);
+ uiConfirmation.createEvent("Close", event.getExecutionPhase(), event.getRequestContext()).broadcast();
+ }
+ }
}
14 years, 3 months
gatein SVN: r4165 - in components/wsrp/trunk/consumer/src: main/java/org/gatein/wsrp/consumer/migration and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-09-13 04:56:44 -0400 (Mon, 13 Sep 2010)
New Revision: 4165
Added:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/BaseMigrationInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ImportInfo.java
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
Log:
- Started implementing importPortlets on the consumer.
- Added injection of MigrationService on ConsumerRegistry.
- Added export context support on ExportInfo.
- Added BaseMigrationInfo and ImportInfo classes.
- Mostly synchronization commit.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-09-13 08:08:14 UTC (rev 4164)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -50,6 +50,7 @@
import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
import org.gatein.wsrp.consumer.handlers.SessionHandler;
import org.gatein.wsrp.consumer.migration.ExportInfo;
+import org.gatein.wsrp.consumer.migration.ImportInfo;
import org.gatein.wsrp.consumer.migration.MigrationService;
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
@@ -61,6 +62,9 @@
import org.oasis.wsrp.v2.ExportedPortlet;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.ImportPortlet;
+import org.oasis.wsrp.v2.ImportPortletsFailed;
+import org.oasis.wsrp.v2.ImportedPortlet;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.Lifetime;
@@ -107,6 +111,8 @@
private ProducerInfo producerInfo;
+ private transient MigrationService migrationService;
+
/** A registration data element used to indicate when no registration was required by the producer */
private final static RegistrationData REGISTRATION_NOT_NEEDED = WSRPTypeFactory.createDefaultRegistrationData();
@@ -130,14 +136,13 @@
/** The set of supported user scopes */
private Set supportedUserScopes = WSRP_DEFAULT_USER_SCOPE; // todo: make it possible to support different user scopes
private transient boolean started;
- private MigrationService migrationService;
public WSRPConsumerImpl()
{
- this(new ProducerInfo());
+ this(new ProducerInfo(), new MigrationService());
}
- public WSRPConsumerImpl(ProducerInfo info)
+ public WSRPConsumerImpl(ProducerInfo info, MigrationService migrationService)
{
ParameterValidation.throwIllegalArgExceptionIfNull(info, "ProducerInfo");
@@ -145,7 +150,7 @@
sessionHandler = new SessionHandler(this);
dispatcher = new InvocationDispatcher(this);
- migrationService = new MigrationService(); // todo: inject this
+ this.migrationService = migrationService;
}
public ProducerInfo getProducerInfo()
@@ -822,7 +827,7 @@
XMLGregorianCalendar terminationTime = lifetime.getTerminationTime();
}
- ExportInfo exportInfo = new ExportInfo(System.currentTimeMillis(), handleToState, errorCodeToHandle);
+ ExportInfo exportInfo = new ExportInfo(System.currentTimeMillis(), errorCodeToHandle, handleToState, exportContextHolder.value);
migrationService.add(exportInfo);
return exportInfo;
}
@@ -883,6 +888,110 @@
}
}
+ public ImportInfo importPortlets(ExportInfo exportInfo, List<String> portlets) throws PortletInvokerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(exportInfo, "ExportInfo to import from");
+
+ if (ParameterValidation.existsAndIsNotEmpty(portlets))
+ {
+ try
+ {
+ List<ImportPortlet> importPortlets = new ArrayList<ImportPortlet>(portlets.size());
+ for (String portlet : portlets)
+ {
+ // todo: check semantics
+ importPortlets.add(WSRPTypeFactory.createImportPortlet(portlet, exportInfo.getPortletStateFor(portlet)));
+ }
+
+ Holder<List<ImportedPortlet>> importedPortletsHolder = new Holder<List<ImportedPortlet>>();
+ Holder<List<ImportPortletsFailed>> failedPortletsHolder = new Holder<List<ImportPortletsFailed>>();
+ Holder<ResourceList> resourceListHolder = new Holder<ResourceList>();
+ getPortletManagementService().importPortlets(getRegistrationContext(), exportInfo.getExportContext(),
+ importPortlets, UserAccess.getUserContext(), null, importedPortletsHolder, failedPortletsHolder,
+ resourceListHolder, new Holder<List<Extension>>());
+
+ List<ImportedPortlet> importedPortlets = importedPortletsHolder.value;
+ SortedMap<String, PortletContext> importIdToPortletContext = null;
+ if (ParameterValidation.existsAndIsNotEmpty(importedPortlets))
+ {
+ for (ImportedPortlet importedPortlet : importedPortlets)
+ {
+ org.oasis.wsrp.v2.PortletContext portletContext = importedPortlet.getNewPortletContext();
+ importIdToPortletContext.put(importedPortlet.getImportID(),
+ PortletContext.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState()));
+ }
+ }
+
+ SortedMap<QName, List<String>> errorCodeToHandle = null;
+ List<ImportPortletsFailed> failedPortlets = failedPortletsHolder.value;
+ if (ParameterValidation.existsAndIsNotEmpty(failedPortlets))
+ {
+ errorCodeToHandle = new TreeMap<QName, List<String>>();
+ for (ImportPortletsFailed failedPortletsForReason : failedPortlets)
+ {
+ errorCodeToHandle.put(failedPortletsForReason.getErrorCode(), failedPortletsForReason.getImportID());
+ }
+ }
+
+ return new ImportInfo(System.currentTimeMillis(), errorCodeToHandle, importIdToPortletContext);
+ }
+ catch (OperationNotSupported operationNotSupported)
+ {
+ throw new UnsupportedOperationException(operationNotSupported);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw new IllegalArgumentException(inconsistentParameters);
+ }
+ /*
+ // GTNWSRP-62
+ catch (AccessDenied accessDenied)
+ {
+ accessDenied.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (ExportByValueNotSupported exportByValueNotSupported)
+ {
+ exportByValueNotSupported.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ invalidHandle.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ invalidRegistration.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ invalidUserCategory.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (MissingParameters missingParameters)
+ {
+ missingParameters.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (ModifyRegistrationRequired modifyRegistrationRequired)
+ {
+ modifyRegistrationRequired.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (OperationFailed operationFailed)
+ {
+ operationFailed.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ catch (ResourceSuspended resourceSuspended)
+ {
+ resourceSuspended.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }*/
+ catch (Exception e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Must provide a non-null, non-empty list of portlet handles.");
+ }
+ }
+
public MigrationService getMigrationService()
{
return migrationService;
Added: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/BaseMigrationInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/BaseMigrationInfo.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/BaseMigrationInfo.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -0,0 +1,82 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.gatein.wsrp.consumer.migration;
+
+import org.gatein.common.util.ParameterValidation;
+
+import javax.xml.namespace.QName;
+import java.text.DateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class BaseMigrationInfo
+{
+ protected final static SortedMap<QName, List<String>> EMPTY_FAILED = new TreeMap<QName, List<String>>();
+ protected final SortedMap<QName, List<String>> errorCodeToHandles;
+ protected final long exportTime;
+
+ public BaseMigrationInfo(long exportTime, SortedMap<QName, List<String>> errorCodeToHandles)
+ {
+ if (ParameterValidation.existsAndIsNotEmpty(errorCodeToHandles))
+ {
+ this.errorCodeToHandles = errorCodeToHandles;
+ }
+ else
+ {
+ this.errorCodeToHandles = EMPTY_FAILED;
+ }
+ this.exportTime = exportTime;
+ }
+
+ public SortedMap<QName, List<String>> getErrorCodesToFailedPortletHandlesMapping()
+ {
+ return Collections.unmodifiableSortedMap(errorCodeToHandles);
+ }
+
+ public long getExportTime()
+ {
+ return exportTime;
+ }
+
+ public String getHumanReadableExportTime(Locale locale)
+ {
+ return getHumanReadableTime(locale, exportTime);
+ }
+
+ protected String getHumanReadableTime(Locale locale, final long time)
+ {
+ if (locale == null)
+ {
+ locale = Locale.getDefault();
+ }
+ return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale).format(new Date(time));
+ }
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java 2010-09-13 08:08:14 UTC (rev 4164)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -26,10 +26,7 @@
import org.gatein.common.util.ParameterValidation;
import javax.xml.namespace.QName;
-import java.text.DateFormat;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.SortedMap;
@@ -39,18 +36,17 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-public class ExportInfo
+public class ExportInfo extends BaseMigrationInfo
{
- private final long exportTime;
+ private final byte[] exportContext;
private long expirationTime;
private final SortedMap<String, byte[]> handleToExportedState;
- private final SortedMap<QName, List<String>> errorCodeToHandles;
private final static SortedMap<String, byte[]> EMPTY_EXPORTED = new TreeMap<String, byte[]>();
- private final static SortedMap<QName, List<String>> EMPTY_FAILED = new TreeMap<QName, List<String>>();
- public ExportInfo(long exportTime, SortedMap<String, byte[]> handleToState, SortedMap<QName, List<String>> errorCodeToHandles)
+ public ExportInfo(long exportTime, SortedMap<QName, List<String>> errorCodeToHandles, SortedMap<String, byte[]> handleToState, byte[] exportContext)
{
- this.exportTime = exportTime;
+ super(exportTime, errorCodeToHandles);
+
if (ParameterValidation.existsAndIsNotEmpty(handleToState))
{
this.handleToExportedState = handleToState;
@@ -60,26 +56,9 @@
handleToExportedState = EMPTY_EXPORTED;
}
- if (ParameterValidation.existsAndIsNotEmpty(errorCodeToHandles))
- {
- this.errorCodeToHandles = errorCodeToHandles;
- }
- else
- {
- this.errorCodeToHandles = EMPTY_FAILED;
- }
+ this.exportContext = exportContext;
}
- public long getExportTime()
- {
- return exportTime;
- }
-
- public String getHumanReadableExportTime(Locale locale)
- {
- return getHumanReadableTime(locale, exportTime);
- }
-
public long getExpirationTime()
{
return expirationTime;
@@ -90,15 +69,6 @@
return getHumanReadableTime(locale, expirationTime);
}
- private String getHumanReadableTime(Locale locale, final long time)
- {
- if(locale == null)
- {
- locale = Locale.getDefault();
- }
- return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale).format(new Date(time));
- }
-
public List<String> getExportedPortletHandles()
{
return new ArrayList<String>(handleToExportedState.keySet());
@@ -109,11 +79,6 @@
return handleToExportedState.get(portletHandle);
}
- public SortedMap<QName, List<String>> getErrorCodesToFailedPortletHandlesMapping()
- {
- return Collections.unmodifiableSortedMap(errorCodeToHandles);
- }
-
@Override
public boolean equals(Object o)
{
@@ -141,4 +106,9 @@
{
return (int)(exportTime ^ (exportTime >>> 32));
}
+
+ public byte[] getExportContext()
+ {
+ return exportContext;
+ }
}
Added: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ImportInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ImportInfo.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ImportInfo.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -0,0 +1,56 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.gatein.wsrp.consumer.migration;
+
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.PortletContext;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ImportInfo extends BaseMigrationInfo
+{
+ private final SortedMap<String, PortletContext> importIdToPortletContext;
+ private static final SortedMap<String, PortletContext> EMPTY_IMPORTED = new TreeMap<String, PortletContext>();
+
+ public ImportInfo(long exportTime, SortedMap<QName, List<String>> errorCodeToHandles, SortedMap<String, PortletContext> importIdToPortletContext)
+ {
+ super(exportTime, errorCodeToHandles);
+ if (ParameterValidation.existsAndIsNotEmpty(importIdToPortletContext))
+ {
+ this.importIdToPortletContext = importIdToPortletContext;
+ }
+ else
+ {
+ this.importIdToPortletContext = EMPTY_IMPORTED;
+ }
+ }
+
+
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2010-09-13 08:08:14 UTC (rev 4164)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -33,6 +33,7 @@
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.consumer.migration.MigrationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,6 +61,7 @@
private Map<String, String> keysToIds;
private SessionEventBroadcaster sessionEventBroadcaster;
+ private MigrationService migrationService;
private static final String CONSUMER_WITH_ID = "Consumer with id '";
private static final String RELEASE_SESSIONS_LISTENER = "release_sessions_listener_";
@@ -81,6 +83,16 @@
this.sessionEventBroadcaster = sessionEventBroadcaster;
}
+ public MigrationService getMigrationService()
+ {
+ return migrationService;
+ }
+
+ public void setMigrationService(MigrationService migrationService)
+ {
+ this.migrationService = migrationService;
+ }
+
public WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds, String wsdlURL)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Creating a Consumer");
@@ -171,7 +183,7 @@
private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
{
- WSRPConsumer consumer = new WSRPConsumerImpl(producerInfo);
+ WSRPConsumer consumer = new WSRPConsumerImpl(producerInfo, migrationService);
add(consumer);
return consumer;
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java 2010-09-13 08:08:14 UTC (rev 4164)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -28,6 +28,7 @@
import org.gatein.wsrp.api.SessionEventBroadcaster;
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
+import org.gatein.wsrp.consumer.migration.MigrationService;
import java.util.List;
@@ -76,4 +77,8 @@
void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker);
ProducerInfo getProducerInfoByKey(String key);
+
+ MigrationService getMigrationService();
+
+ void setMigrationService(MigrationService migrationService);
}
\ No newline at end of file
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java 2010-09-13 08:08:14 UTC (rev 4164)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java 2010-09-13 08:56:44 UTC (rev 4165)
@@ -49,7 +49,7 @@
public void testAddExport()
{
- ExportInfo info = new ExportInfo(System.currentTimeMillis(), new TreeMap<String, byte[]>(), null);
+ ExportInfo info = new ExportInfo(System.currentTimeMillis(), null, new TreeMap<String, byte[]>(), null);
service.add(info);
List<ExportInfo> exports = service.getAvailableExportInfos();
14 years, 3 months
gatein SVN: r4164 - in portal/branches/navcontroller/component/web/controller/src: main/java/org/exoplatform/web/controller/metadata and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-13 04:08:14 -0400 (Mon, 13 Sep 2010)
New Revision: 4164
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RequestParamDescriptor.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestHierarchy.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
Log:
start to implement request parameter matching
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -151,7 +151,7 @@
log.info("Portal path: " + portalPath);
//
- Map<QualifiedName, String> parameters = router.process(portalPath);
+ Map<QualifiedName, String> parameters = router.route(portalPath);
log.info("Decoded parameters: " + parameters);
//
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RequestParamDescriptor.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RequestParamDescriptor.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RequestParamDescriptor.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -0,0 +1,75 @@
+/*
+ * 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.metadata;
+
+import org.exoplatform.web.controller.QualifiedName;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RequestParamDescriptor
+{
+
+ /** . */
+ private QualifiedName name;
+
+ /** . */
+ private String matchName;
+
+ /** . */
+ private String matchValue;
+
+ public RequestParamDescriptor(QualifiedName name, String matchName, String matchValue)
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+ if (matchName == null)
+ {
+ throw new NullPointerException("No null match name accepted");
+ }
+ if (matchValue == null)
+ {
+ throw new NullPointerException("No null match value accepted");
+ }
+
+ //
+ this.name = name;
+ this.matchName = matchName;
+ this.matchValue = matchValue;
+ }
+
+ public QualifiedName getName()
+ {
+ return name;
+ }
+
+ public String getMatchName()
+ {
+ return matchName;
+ }
+
+ public String getMatchValue()
+ {
+ return matchValue;
+ }
+}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -40,7 +40,7 @@
private final Map<QualifiedName, String> parameters;
/** . */
- private final Map<QualifiedName, String> queryParams;
+ private final Map<String, RequestParamDescriptor> requestParams;
/** . */
private final List<RouteDescriptor> children;
@@ -49,7 +49,7 @@
{
this.path = path;
this.parameters = new HashMap<QualifiedName, String>();
- this.queryParams = new HashMap<QualifiedName, String>();
+ this.requestParams = new HashMap<String, RequestParamDescriptor>();
this.children = new ArrayList<RouteDescriptor>();
}
@@ -66,7 +66,7 @@
public RouteDescriptor addParameter(String name, String value)
{
- return addParameter(new QualifiedName(name), value);
+ return addParameter(QualifiedName.parse(name), value);
}
public Map<QualifiedName, String> getParameters()
@@ -74,22 +74,26 @@
return parameters;
}
- public RouteDescriptor addQueryParam(QualifiedName name, String value)
+ public RouteDescriptor addRequestParam(QualifiedName name, String matchName, String matchValue)
{
- queryParams.put(name, value);
- return this;
+ return addRequestParam(new RequestParamDescriptor(name, matchName, matchValue));
}
- public RouteDescriptor addQueryParam(String name, String value)
+ public RouteDescriptor addRequestParam(String name, String matchName, String matchValue)
{
- return addQueryParam(new QualifiedName(name), value);
+ return addRequestParam(QualifiedName.parse(name), matchName, matchValue);
}
- public Map<QualifiedName, String> getQueryParams()
+ public RouteDescriptor addRequestParam(RequestParamDescriptor requestParam)
{
- return queryParams;
+ requestParams.put(requestParam.getMatchName(), requestParam);
+ return this;
}
+ public Map<String, RequestParamDescriptor> getRequestParams()
+ {
+ return requestParams;
+ }
public RouteDescriptor addChild(RouteDescriptor child)
{
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternBuilder.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -34,32 +34,46 @@
/** . */
private final StringBuilder buffer = new StringBuilder();
- public void appendExpression(String s)
+ public PatternBuilder expr(String s)
{
buffer.append(s);
+ return this;
}
- public void append(String s, int from, int to)
+ public PatternBuilder expr(char s)
{
+ buffer.append(s);
+ return this;
+ }
+
+ public PatternBuilder litteral(String s, int from, int to)
+ {
for (int i = from;i < to;i++)
{
char c = s.charAt(i);
- append(c);
+ litteral(c);
}
+ return this;
}
- public void append(String s, int from)
+ public PatternBuilder litteral(String s, int from)
{
- append(s, from, s.length());
+ return litteral(s, from, s.length());
}
- public void append(char c)
+ public PatternBuilder litteral(String s)
{
+ return litteral(s, 0, s.length());
+ }
+
+ public PatternBuilder litteral(char c)
+ {
buffer.append("\\u");
buffer.append(TABLE[(c & 0xF000) >> 12]);
buffer.append(TABLE[(c & 0x0F00) >> 8]);
buffer.append(TABLE[(c & 0x00F0) >> 4]);
buffer.append(TABLE[c & 0x000F]);
+ return this;
}
public Pattern build()
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/RequestParamDef.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -0,0 +1,133 @@
+/*
+ * 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.router;
+
+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$
+ */
+class RequestParamDef
+{
+
+ /** . */
+ final QualifiedName name;
+
+ /** . */
+ final String matchName;
+
+ /** . */
+ final Pattern matchValue;
+
+ RequestParamDef(RequestParamDescriptor descriptor)
+ {
+ if (descriptor == null)
+ {
+ throw new NullPointerException("No null descriptor accepted");
+ }
+
+ //
+ PatternBuilder matchValue = new PatternBuilder();
+ matchValue.expr("^");
+ boolean litteral = true;
+ for (char c : descriptor.getMatchValue().toCharArray())
+ {
+ switch (c)
+ {
+ case '{':
+ if (litteral)
+ {
+ litteral = false;
+ }
+ else
+ {
+ matchValue.expr('{');
+ }
+ break;
+ case '}':
+ if (litteral)
+ {
+ litteral = true;
+ }
+ else
+ {
+ matchValue.expr('}');
+ }
+ break;
+ default:
+ if (litteral)
+ {
+ matchValue.litteral(c);
+ }
+ else
+ {
+ matchValue.expr(c);
+ }
+ break;
+ }
+ }
+ matchValue.expr("$");
+
+ //
+ this.name = descriptor.getName();
+ this.matchName = descriptor.getMatchName();
+ this.matchValue = matchValue.build();
+ }
+
+ RequestParamDef(QualifiedName name, String matchName, Pattern matchValue)
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+ if (matchName == null)
+ {
+ throw new NullPointerException("No null match name accepted");
+ }
+ if (matchValue == null)
+ {
+ throw new NullPointerException("No null match value accepted");
+ }
+
+ //
+ this.name = name;
+ this.matchName = matchName;
+ this.matchValue = matchValue;
+ }
+
+ public QualifiedName getName()
+ {
+ return name;
+ }
+
+ public String getMatchName()
+ {
+ return matchName;
+ }
+
+ public Pattern getMatchValue()
+ {
+ return matchValue;
+ }
+}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -20,9 +20,11 @@
package org.exoplatform.web.controller.router;
import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.metadata.RequestParamDescriptor;
import org.exoplatform.web.controller.metadata.RouteDescriptor;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -56,7 +58,7 @@
private final Map<QualifiedName, String> routeParameters;
/** . */
- private final Map<QualifiedName, String> queryParams;
+ private final Map<String, RequestParamDef> requestParamDefs;
Route()
{
@@ -65,7 +67,7 @@
this.segments = new LinkedHashMap<String, List<SegmentRoute>>();
this.patterns = new ArrayList<PatternRoute>();
this.routeParameters = new HashMap<QualifiedName, String>();
- this.queryParams = new HashMap<QualifiedName, String>();
+ this.requestParamDefs = new HashMap<String, RequestParamDef>();
}
/**
@@ -195,12 +197,41 @@
/**
* @param path the path
+ * @param requestParams the query parameters
* @return null or the parameters when it matches
*/
- final Map<QualifiedName, String> route(String path)
+ final Map<QualifiedName, String> route(String path, Map<String, String[]> requestParams)
{
Map<QualifiedName, String> ret = null;
+ // Check request parameters
+ Map<QualifiedName, String> routeRequestParams = Collections.emptyMap();
+ if (requestParamDefs.size() > 0)
+ {
+ for (RequestParamDef requestParamDef : requestParamDefs.values())
+ {
+ String[] values = requestParams.get(requestParamDef.getMatchName());
+ if (values != null && values.length > 0)
+ {
+ String value = values[0];
+ if (value != null)
+ {
+ Matcher matcher = requestParamDef.matchValue.matcher(value);
+ if (matcher.matches())
+ {
+ if (routeRequestParams.isEmpty())
+ {
+ routeRequestParams = new HashMap<QualifiedName, String>();
+ }
+ routeRequestParams.put(requestParamDef.getName(), value);
+ continue;
+ }
+ }
+ }
+ return null;
+ }
+ }
+
// Anything that does not begin with '/' returns null
if (path.length() > 0 && path.charAt(0) == '/')
{
@@ -242,7 +273,7 @@
for (SegmentRoute route : routes)
{
// Delegate the process to the next route
- Map<QualifiedName, String> response = route.route(nextPath);
+ Map<QualifiedName, String> response = route.route(nextPath, requestParams);
// If we do have a response we return it
if (response != null)
@@ -277,7 +308,7 @@
}
// Delegate to next route
- Map<QualifiedName, String> response = route.route(nextPath);
+ Map<QualifiedName, String> response = route.route(nextPath, requestParams);
// If we do have a response we return it
if (response != null)
@@ -310,6 +341,16 @@
}
}
}
+ if (routeRequestParams.size() > 0)
+ {
+ for (Map.Entry<QualifiedName, String> entry : routeRequestParams.entrySet())
+ {
+ if (!ret.containsKey(entry.getKey()))
+ {
+ ret.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
}
}
@@ -389,6 +430,11 @@
//
route.terminal = true;
route.routeParameters.putAll(descriptor.getParameters());
+ for (RequestParamDescriptor requestParamDescriptor : descriptor.getRequestParams().values())
+ {
+ RequestParamDef requestParamDef = new RequestParamDef(requestParamDescriptor);
+ route.requestParamDefs.put(requestParamDef.getMatchName(), requestParamDef);
+ }
//
for (RouteDescriptor childDescriptor : descriptor.getChildren())
@@ -471,13 +517,13 @@
{
List<QualifiedName> parameterNames = new ArrayList<QualifiedName>();
PatternBuilder builder = new PatternBuilder();
- builder.appendExpression("^");
+ builder.expr("^");
List<String> chunks = new ArrayList<String>();
List<Pattern> parameterPatterns = new ArrayList<Pattern>();
int previous = 0;
for (int i = 0;i < start.size();i++)
{
- builder.append(path, previous, start.get(i));
+ builder.litteral(path, previous, start.get(i));
chunks.add(path.substring(previous, start.get(i)));
String parameterDef = path.substring(start.get(i) + 1, end.get(i));
int colon = parameterDef.indexOf(':');
@@ -510,14 +556,14 @@
//
- builder.appendExpression("(");
- builder.appendExpression(regex);
- builder.appendExpression(")");
+ builder.expr("(");
+ builder.expr(regex);
+ builder.expr(")");
parameterNames.add(parameterQName);
parameterPatterns.add(Pattern.compile("^" + regex + "$"));
previous = end.get(i) + 1;
}
- builder.append(path, previous, pos);
+ builder.litteral(path, previous, pos);
chunks.add(path.substring(previous, pos));
// Julien : should the pattern end with a $ ?????? I don't see that for now
// we need to figure out clearly
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -24,7 +24,7 @@
import org.exoplatform.web.controller.metadata.RouterDescriptor;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.Map;
/**
@@ -58,8 +58,13 @@
return root.render(parameters);
}
- public Map<QualifiedName, String> process(String path) throws IOException
+ public Map<QualifiedName, String> route(String path) throws IOException
{
- return root.route(path);
+ return route(path, Collections.<String, String[]>emptyMap());
}
+
+ public Map<QualifiedName, String> route(String path, Map<String, String[]> queryParams) throws IOException
+ {
+ return root.route(path, queryParams);
+ }
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestHierarchy.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestHierarchy.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestHierarchy.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -45,12 +45,12 @@
Router router = new Router(new RouterDescriptor().addRoute(descriptor));
//
- assertEquals(Collections.singletonMap(new QualifiedName("foo"), "bar"), router.process("/a"));
+ assertEquals(Collections.singletonMap(new QualifiedName("foo"), "bar"), router.route("/a"));
//
Map<QualifiedName, String> expected = new HashMap<QualifiedName, String>();
expected.put(new QualifiedName("foo"), "bar");
expected.put(new QualifiedName("juu"), "daa");
- assertEquals(expected, router.process("/a/b"));
+ assertEquals(expected, router.route("/a/b"));
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -41,16 +41,16 @@
Router router = new Router(routerMD);
//
- assertNull(router.process(""));
+ assertNull(router.route(""));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/"));
//
- assertNull(router.process("/a"));
+ assertNull(router.route("/a"));
//
- assertNull(router.process("a"));
+ assertNull(router.route("a"));
}
public void testA() throws Exception
@@ -60,31 +60,31 @@
Router router = new Router(routerMD);
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a"));
//
- assertNull(router.process("a"));
+ assertNull(router.route("a"));
//
- assertNull(router.process("a/"));
+ assertNull(router.route("a/"));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a/"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a/"));
//
- assertNull(router.process(""));
+ assertNull(router.route(""));
//
- assertNull(router.process("/"));
+ assertNull(router.route("/"));
//
- assertNull(router.process("/b"));
+ assertNull(router.route("/b"));
//
- assertNull(router.process("b"));
+ assertNull(router.route("b"));
//
- assertNull(router.process("/a/b"));
+ assertNull(router.route("/a/b"));
}
public void testAB() throws Exception
@@ -94,31 +94,31 @@
Router router = new Router( routerMD);
//
- assertNull(router.process("a/b"));
+ assertNull(router.route("a/b"));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a/b"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a/b"));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a/b/"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a/b/"));
//
- assertNull(router.process("a/b/"));
+ assertNull(router.route("a/b/"));
//
- assertNull(router.process(""));
+ assertNull(router.route(""));
//
- assertNull(router.process("/"));
+ assertNull(router.route("/"));
//
- assertNull(router.process("/b"));
+ assertNull(router.route("/b"));
//
- assertNull(router.process("b"));
+ assertNull(router.route("b"));
//
- assertNull(router.process("/a/b/c"));
+ assertNull(router.route("/a/b/c"));
}
public void testParameter() throws Exception
@@ -126,7 +126,7 @@
RouterDescriptor routerMD = new RouterDescriptor();
routerMD.addRoute(new RouteDescriptor("/{p}"));
Router router = new Router(routerMD);
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(("/a")));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.route(("/a")));
}
public void testParameterPropagationToDescendants() throws Exception
@@ -135,7 +135,7 @@
routerMD.addRoute(new RouteDescriptor("/").addParameter("p", "a"));
routerMD.addRoute(new RouteDescriptor("/a"));
Router router = new Router(routerMD);
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(("/a")));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.route(("/a")));
}
public void testWildcardPattern() throws Exception
@@ -145,16 +145,16 @@
Router router = new Router(routerMD);
//
- assertEquals(Collections.singletonMap(new QualifiedName("p"), ""), router.process("/"));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), ""), router.route("/"));
//
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.process("/a"));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.route("/a"));
//
- assertNull(router.process(("a")));
+ assertNull(router.route(("a")));
//
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a/b"), router.process("/a/b"));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a/b"), router.route("/a/b"));
}
public void testSimplePattern() throws Exception
@@ -164,16 +164,16 @@
Router router = new Router(routerMD);
//
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.process("/a"));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.route("/a"));
//
- assertNull(router.process("a"));
+ assertNull(router.route("a"));
//
- assertNull(router.process("/ab"));
+ assertNull(router.route("/ab"));
//
- assertNull(router.process("ab"));
+ assertNull(router.route("ab"));
}
public void testPrecedence() throws Exception
@@ -184,16 +184,16 @@
Router router = new Router(routerMD);
//
- assertNull(router.process(("a")));
+ assertNull(router.route(("a")));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a"));
//
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a/"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a/"));
//
- assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.process("/a/b"));
+ assertEquals(Collections.singletonMap(new QualifiedName("p"), "a"), router.route("/a/b"));
}
public void testTwoRules1() throws Exception
@@ -204,8 +204,8 @@
Router router = new Router(routerMD);
//
- assertEquals(Collections.singletonMap(new QualifiedName("b"), "b"), router.process("/a"));
- assertEquals(Collections.<QualifiedName, String>emptyMap(), router.process("/a/b"));
+ assertEquals(Collections.singletonMap(new QualifiedName("b"), "b"), router.route("/a"));
+ assertEquals(Collections.<QualifiedName, String>emptyMap(), router.route("/a/b"));
}
public void testTwoRules2() throws Exception
@@ -219,7 +219,7 @@
Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
expectedParameters.put(new QualifiedName("a"), "a");
expectedParameters.put(new QualifiedName("b"), "b");
- assertEquals(expectedParameters, router.process("/a"));
- assertEquals(Collections.singletonMap(new QualifiedName("a"), "a"), router.process("/a/b"));
+ assertEquals(expectedParameters, router.route("/a"));
+ assertEquals(Collections.singletonMap(new QualifiedName("a"), "a"), router.route("/a/b"));
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-13 06:48:21 UTC (rev 4163)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -72,13 +72,13 @@
expectedParameters.put(new QualifiedName("gtn", "path"), "");
//
- assertEquals(expectedParameters, router.process("/private/classic"));
+ assertEquals(expectedParameters, router.route("/private/classic"));
assertEquals("/private/classic", router.render(expectedParameters));
}
public void testPrivateClassicSlash() throws Exception
{
- router.process("/private/classic/");
+ router.route("/private/classic/");
Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
expectedParameters.put(new QualifiedName("gtn", "controller"), "site");
expectedParameters.put(new QualifiedName("gtn", "sitename"), "classic");
@@ -86,7 +86,7 @@
expectedParameters.put(new QualifiedName("gtn", "path"), "/");
//
- assertEquals(expectedParameters, router.process("/private/classic/"));
+ assertEquals(expectedParameters, router.route("/private/classic/"));
assertEquals("/private/classic/", router.render(expectedParameters));
}
@@ -99,7 +99,7 @@
expectedParameters.put(new QualifiedName("gtn", "path"), "/home");
//
- assertEquals(expectedParameters, router.process("/private/classic/home"));
+ assertEquals(expectedParameters, router.route("/private/classic/home"));
assertEquals("/private/classic/home", router.render(expectedParameters));
}
}
Added: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRequestParam.java 2010-09-13 08:08:14 UTC (rev 4164)
@@ -0,0 +1,83 @@
+/*
+ * 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.router;
+
+import org.exoplatform.web.controller.QualifiedName;
+import org.exoplatform.web.controller.metadata.RouteDescriptor;
+import org.exoplatform.web.controller.metadata.RouterDescriptor;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestRequestParam extends AbstractTestController
+{
+
+ public void testRoot() throws Exception
+ {
+ RouterDescriptor descriptor = new RouterDescriptor();
+ descriptor.addRoute(new RouteDescriptor("/").addRequestParam("foo", "a", "a"));
+ Router router = new Router(descriptor);
+ assertNull(router.route("/"));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/", Collections.singletonMap("a", new String[]{"a"})));
+ }
+
+ public void testSegment() throws Exception
+ {
+ RouterDescriptor descriptor = new RouterDescriptor();
+ descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a"));
+ Router router = new Router(descriptor);
+ assertNull(router.route("/a"));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
+ }
+
+ public void testPrecedence() throws Exception
+ {
+ RouterDescriptor descriptor = new RouterDescriptor();
+ descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a"));
+ descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("bar", "b", "b"));
+ Router router = new Router(descriptor);
+ assertNull(router.route("/a"));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("bar"), "b"), router.route("/a", Collections.singletonMap("b", new String[]{"b"})));
+ }
+
+ public void testInheritance() throws Exception
+ {
+ RouterDescriptor descriptor = new RouterDescriptor();
+ descriptor.addRoute(new RouteDescriptor("/a").addRequestParam("foo", "a", "a").addChild(new RouteDescriptor("/b").addRequestParam("bar", "b", "b")));
+ Router router = new Router(descriptor);
+ assertNull(router.route("/a"));
+ assertEquals(Collections.singletonMap(QualifiedName.parse("foo"), "a"), router.route("/a", Collections.singletonMap("a", new String[]{"a"})));
+ assertNull(router.route("/a/b"));
+ Map<String, String[]> requestParameters = new HashMap<String, String[]>();
+ requestParameters.put("a", new String[]{"a"});
+ requestParameters.put("b", new String[]{"b"});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
+ expectedParameters.put(QualifiedName.parse("foo"), "a");
+ expectedParameters.put(QualifiedName.parse("bar"), "b");
+ assertEquals(expectedParameters, router.route("/a/b", requestParameters));
+ }
+
+}
14 years, 3 months
gatein SVN: r4163 - in portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller: router and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-13 02:48:21 -0400 (Mon, 13 Sep 2010)
New Revision: 4163
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
Log:
- start to add query param
- improves the route parameter map collecting process
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-09-13 03:21:15 UTC (rev 4162)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-09-13 06:48:21 UTC (rev 4163)
@@ -40,12 +40,16 @@
private final Map<QualifiedName, String> parameters;
/** . */
+ private final Map<QualifiedName, String> queryParams;
+
+ /** . */
private final List<RouteDescriptor> children;
public RouteDescriptor(String path)
{
this.path = path;
this.parameters = new HashMap<QualifiedName, String>();
+ this.queryParams = new HashMap<QualifiedName, String>();
this.children = new ArrayList<RouteDescriptor>();
}
@@ -70,6 +74,23 @@
return parameters;
}
+ public RouteDescriptor addQueryParam(QualifiedName name, String value)
+ {
+ queryParams.put(name, value);
+ return this;
+ }
+
+ public RouteDescriptor addQueryParam(String name, String value)
+ {
+ return addQueryParam(new QualifiedName(name), value);
+ }
+
+ public Map<QualifiedName, String> getQueryParams()
+ {
+ return queryParams;
+ }
+
+
public RouteDescriptor addChild(RouteDescriptor child)
{
children.add(child);
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 03:21:15 UTC (rev 4162)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-13 06:48:21 UTC (rev 4163)
@@ -55,6 +55,9 @@
/** . */
private final Map<QualifiedName, String> routeParameters;
+ /** . */
+ private final Map<QualifiedName, String> queryParams;
+
Route()
{
this.parent = null;
@@ -62,6 +65,7 @@
this.segments = new LinkedHashMap<String, List<SegmentRoute>>();
this.patterns = new ArrayList<PatternRoute>();
this.routeParameters = new HashMap<QualifiedName, String>();
+ this.queryParams = new HashMap<QualifiedName, String>();
}
/**
@@ -190,29 +194,22 @@
}
/**
- * Note : the parameters arguments is modified, I don't like it much but as this is only used
- * by the framework, there is no side effects, but I should investigate about doing this in a
- * better way.
- *
* @param path the path
- * @param parameters the parameters
* @return null or the parameters when it matches
*/
- final Map<QualifiedName, String> route(String path, Map<QualifiedName, String> parameters)
+ final Map<QualifiedName, String> route(String path)
{
Map<QualifiedName, String> ret = null;
// Anything that does not begin with '/' returns null
if (path.length() > 0 && path.charAt(0) == '/')
{
-
-
// The '/' means the current controller if any, otherwise it may be processed by the pattern matching
if (path.length() == 1)
{
if (terminal)
{
- ret = parameters;
+ ret = new HashMap<QualifiedName, String>();
}
}
else
@@ -245,7 +242,7 @@
for (SegmentRoute route : routes)
{
// Delegate the process to the next route
- Map<QualifiedName, String> response = route.route(nextPath, parameters);
+ Map<QualifiedName, String> response = route.route(nextPath);
// If we do have a response we return it
if (response != null)
@@ -267,13 +264,6 @@
// We match
if (matcher.find())
{
- // Update parameters
- int group = 1;
- for (QualifiedName parameterName : route.parameterNames)
- {
- parameters.put(parameterName, matcher.group(group++));
- }
-
// Build next controller context
int nextPos = matcher.end() + 1;
String nextPath;
@@ -287,11 +277,19 @@
}
// Delegate to next route
- Map<QualifiedName, String> response = route.route(nextPath, parameters);
+ Map<QualifiedName, String> response = route.route(nextPath);
// If we do have a response we return it
if (response != null)
{
+ // Append parameters
+ int group = 1;
+ for (QualifiedName parameterName : route.parameterNames)
+ {
+ response.put(parameterName, matcher.group(group++));
+ }
+
+ //
ret = response;
break;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 03:21:15 UTC (rev 4162)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-13 06:48:21 UTC (rev 4163)
@@ -60,6 +60,6 @@
public Map<QualifiedName, String> process(String path) throws IOException
{
- return root.route(path, new HashMap<QualifiedName, String>());
+ return root.route(path);
}
}
14 years, 3 months
gatein SVN: r4162 - in epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US: extras/PortalDevelopment_DefaultPortalNavigationConfiguration and 4 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-09-12 23:21:15 -0400 (Sun, 12 Sep 2010)
New Revision: 4162
Modified:
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Preface.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Reference_Guide.ent
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/navigation.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jdbc-data-container-config.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/Gadgets.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/SetupGadgetServer.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/InternationalizationConfiguration.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/WSRP.xml
Log:
JBEPP-370: Fixes for JBEPP-435, JBEPP-436, JBEPP-437, JBEPP-439
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Preface.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Preface.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Preface.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -6,7 +6,7 @@
<preface id="pref-Reference_Guide-Preface">
<title>Preface</title>
<xi:include href="Common_Content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Middleware_Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
</preface>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Reference_Guide.ent
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Reference_Guide.ent 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/Reference_Guide.ent 2010-09-13 03:21:15 UTC (rev 4162)
@@ -9,3 +9,5 @@
<!ENTITY HOLDER "Red Hat, Inc">
<!ENTITY RHEL "Red Hat Enterprise Linux">
+<!ENTITY BZCOMPONENT "doc-triage">
+<!ENTITY BZURL "<ulink url='https://bugzilla.redhat.com/enter_bug.cgi?product=JBoss_Enterprise_Portal...'>http://bugzilla.redhat.com/</ulink>">
\ No newline at end of file
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/navigation.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/navigation.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/navigation.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -1,50 +1,22 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="ISO-8859-1"?>
<node-navigation
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">
<priority>1</priority>
<page-nodes>
- <node>
- <uri>home</uri>
- <name>home</name>
- <label>#{portal.classic.home}</label>
- <page-reference>portal::classic::homepage</page-reference>
- </node>
- <node>
- <uri>sitemap</uri>
- <name>sitemap</name>
- <label>#{portal.classic.sitemap}</label>
- <visibility>DISPLAYED</visibility>
- <page-reference>portal::classic::sitemap</page-reference>
- </node>
- <node>
- <uri>groupnavigation</uri>
- <name>groupnavigation</name>
- <label>#{portal.classic.groupnavigation}</label>
- <visibility>SYSTEM</visibility>
- <page-reference>portal::classic::groupnavigation</page-reference>
- </node>
- <node>
- <uri>portalnavigation</uri>
- <name>portalnavigation</name>
- <label>#{portal.classic.portalnavigation}</label>
- <visibility>SYSTEM</visibility>
- <page-reference>portal::classic::portalnavigation</page-reference>
- </node>
- <node>
- <uri>register</uri>
- <name>register</name>
- <label>#{portal.classic.register}</label>
- <visibility>SYSTEM</visibility>
- <page-reference>portal::classic::register</page-reference>
- </node>
- <!-- NOT FOUND node -->
- <node>
- <uri>notfound</uri>
- <name>notfound</name>
- <label>NotFound</label>
- <visibility>SYSTEM</visibility>
- </node>
+ <node>
+ <uri>home</uri>
+ <name>home</name>
+ <label>#{portal.classic.home}</label>
+ <page-reference>portal::classic::homepage</page-reference>
+ </node>
+ <node>
+ <uri>sitemap</uri>
+ <name>sitemap</name>
+ <label>#{portal.classic.sitemap}</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::sitemap</page-reference>
+ </node>
</page-nodes>
-</node-navigation>
+</node-navigation>
\ No newline at end of file
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -7,8 +7,8 @@
<page>
<name>homepage</name>
<title>Home Page</title>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
<portlet-application>
<portlet>
<application-ref>web</application-ref>
@@ -27,60 +27,12 @@
<show-application-state>false</show-application-state>
<show-application-mode>false</show-application-mode>
</portlet-application>
- </page>
-
+ </page>
<page>
- <name>groupnavigation</name>
- <title>Group Navigation</title>
- <access-permissions>*:/platform/users</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <portlet-application>
- <portlet>
- <application-ref>exoadmin</application-ref>
- <portlet-ref>GroupNavigationPortlet</portlet-ref>
- </portlet>
- <title>Group Navigation</title>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- </portlet-application>
- </page>
-
- <page>
- <name>portalnavigation</name>
- <title>Portal Navigation</title>
- <access-permissions>*:/platform/users</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <portlet-application>
- <portlet>
- <application-ref>exoadmin</application-ref>
- <portlet-ref>PortalNavigationPortlet</portlet-ref>
- </portlet>
- <title>Portal Navigation</title>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- </portlet-application>
- </page>
-
- <page>
- <name>register</name>
- <title>Register</title>
- <access-permissions>*:/platform/guests</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <portlet-application>
- <portlet>
- <application-ref>exoadmin</application-ref>
- <portlet-ref>RegisterPortlet</portlet-ref>
- </portlet>
- <title>Register Account</title>
- <access-permissions>*:/platform/guests</access-permissions>
- <show-info-bar>false</show-info-bar>
- </portlet-application>
- </page>
- <page>
<name>sitemap</name>
<title>Site Map</title>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
<portlet-application>
<portlet>
<application-ref>web</application-ref>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jdbc-data-container-config.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jdbc-data-container-config.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jdbc-data-container-config.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -18,7 +18,7 @@
<term>JDBC</term>
<listitem>
<para>
-
+ Java DataBase Connectivity (JDBC) is an industry standard API for connecting Java-based applications to a wide range of databases. The API enables dynamically loading Java packages (and registering them with the Driver Manager which creates JDBC connections). JDBC connections are used to create and execute statements. These may be update statements (such as CREATE, INSERT, UPDATE and DELETE), or query statements (such as SELECT). JDBC is oriented towards relational databases (See RDBMS below).
</para>
</listitem>
</varlistentry>
@@ -26,7 +26,7 @@
<term>Workspace</term>
<listitem>
<para>
-
+ Would the 'Workspace' definition be better utilized here?
</para>
</listitem>
</varlistentry>
@@ -34,35 +34,51 @@
<term>JCR Service Mode</term>
<listitem>
<para>
-
+ Can't find any conctrete definition of this (our documents seem to be the main source for this sort of info). Does 'Service Mode' mean that the JCR is 'servicing' another application (ie EPP) as opposed to running in standalone mode?
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>RDBMS</term>
+ <term>Relational Database</term>
<listitem>
<para>
-
+ Relational Databases store data in tables (as opposed to flat databases which stored information in a flat, sequential file) which can be leveraged to gather information from specific fields using mathematical relations.
</para>
+ <para>
+ The relationships between the data groups in relational database tables is also stored in tables and all tables in the database have a unique identifier.
+ </para>
+ <para>
+ This approach gives relational databases the ability to build new tables of information from existing data tables, increasing the speed and versatility of the database.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
+ <term>Relational DataBase Management Systems (RDBMS)</term>
+ <listitem>
+ <para>
+ Relational database management systems allow users to create, administer and use relational databases. Most RDBMSs use the Structured Query Language (SQL) to access the data held in the database.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>ANSI</term>
<listitem>
<para>
-
+ The American National Standards Association is a voluntary organization that produces computer industry standards. ANSI standards cover most areas of computing from programming languages to electrical specifications.
</para>
+ <para>
+ While ANSI standards are not formal requirements in computing, adherence to them increases interoperability between platforms and products.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
- <term>database dialect</term>
+ <term>Database Dialect</term>
<listitem>
<para>
-
+ The database dialect defines which version of the programming language (MYSQL, Oracle, Sybase) an database management system should use when interacting with the database.
</para>
</listitem>
</varlistentry>
-
</variablelist>
</section>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/Gadgets.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/Gadgets.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/Gadgets.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -4,83 +4,19 @@
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Gadgets">
- <title>Gadgets</title>
+ <title>Concept</title>
<para>
A gadget is a mini web application, embedded in a web page and running on an application server platform. These small applications help users perform various tasks.
</para>
+
+<section>
+ <title>Basic Usage</title>
<para>
- &PRODUCT; supports gadgets such as: Todo gadget, Calendar gadget, Calculator gadget, Weather Forecasts and and RSS Reader.
+ &PRODUCT; includes a Todo gadget, Calendar gadget, Calculator gadget and RSS Reader gadget by default. Many other, third-party gadgets are also supported. Refer to the &PRODUCT; User Guide at <ulink type="http" url="http://docs.redhat.com"></ulink> for information about obtaining and installing gadgets.
</para>
- <variablelist id="vari-Reference_Guide-Gadgets-Default_Gadgets">
- <title>Default Gadgets:</title>
- <varlistentry>
- <term>Calendar</term>
- <listitem>
- <para>
- The calendar gadget allows users to switch easily between daily, monthly and yearly view and, again, is customizable to match your portal's theme.
- </para>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/GadgetDevelopment/Calendar.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>ToDo</term>
- <listitem>
- <para>
- This application helps you organize your day and work group. It is designed to keep track of your tasks in a convenient and transparent way. Tasks can be highlighted with different colors.
- </para>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/GadgetDevelopment/Todo.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>Calculator</term>
- <listitem>
- <para>
- This mini-application lets you perform most basic arithmetic operations and can be themed to match the rest of your portal.
- </para>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/GadgetDevelopment/Calculator.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>RSS Reader</term>
- <listitem>
- <para>
- An RSS reader, or aggregator, collates content from various, user-specified feed sources and displays them in one location. This content can include, but isn't limited to, news headlines, blog posts or email. The RSS Reader gadget displays this content in a single window on your Portal page.
- </para>
- <!-- <mediaobject>
- <imageobject>
- <imagedata fileref="images/GadgetDevelopment/RSS.png" format="PNG"></imagedata>
- </imageobject>
- </mediaobject> -->
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>More Gadgets</term>
- <listitem>
- <para>
- Further gadgets can be obtained from the <ulink type="http" url="http://www.google.com/ig/directory?synd=open">Google Gadget</ulink> site. &PRODUCT; is compatible with most of the gadgets available here.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-<!-- DOC TODO
- <important>
- <para>
- The following sections require more textual information.
- </para>
- </important> -->
-
+</section>
+<!--Removed list of default gadgets as covered in User Guide-->
+<!--Removing the following sections as they add nothing to the document
<section id="sect-Reference_Guide-Gadgets-Existing_Gadgets">
<title>Existing Gadgets</title>
<mediaobject>
@@ -178,7 +114,7 @@
<imagedata fileref="images/GadgetDevelopment/Dashboard.png" format="PNG" align="center" contentwidth="150mm" />
</imageobject>
</mediaobject>
- </section>
+ </section> -->
</section>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/SetupGadgetServer.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/SetupGadgetServer.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment/SetupGadgetServer.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -4,11 +4,11 @@
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Setup_a_Gadget_Server">
- <title>Setup a Gadget Server</title>
+ <title>Advanced Gadget Administration</title>
<section id="sect-Reference_Guide-Setup_a_Gadget_Server-Virtual_servers_for_gadget_rendering">
<title>Virtual servers for gadget rendering</title>
<para>
- &PRODUCT; recommends using two virtual hosts for security. If the gadget is running on a different domain than the container (the website that 'contains' the app), it is unable to interfere with the portal by modifying code or cookies.
+ &PRODUCT; recommends using two virtual hosts for security. If the gadget is running on a different domain than the container, it is unable to interfere with the portal by modifying code or cookies.
</para>
<para>
An example would hosting the portal from <emphasis role="bold">http://www.sample.com</emphasis> and the gadgets from <emphasis role="bold">http://www.samplemodules.com</emphasis>.
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/GadgetDevelopment.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -4,7 +4,7 @@
%BOOK_ENTITIES;
]>
<chapter id="chap-Reference_Guide-Gadget_development">
- <title>Gadget development</title>
+ <title>Gadgets</title>
<xi:include href="GadgetDevelopment/Gadgets.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="GadgetDevelopment/SetupGadgetServer.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</chapter>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -183,9 +183,62 @@
This file defines all the navigation nodes the portal will have. The syntax is simple and uses nested node tags. Each node references a page defined in <filename>pages.xml</filename> file.
</para>
<para>
- When the <literal>#{...}</literal> syntax is used, the enclosed property name serves as a key that is automatically passed to internationalization mechanism so the literal property name is replaced by a localized value taken from the associated properties file matching the current locale.
+ When the <literal>#{...}</literal> syntax is used in a <literal><label></literal> element, the enclosed property name serves as a key that is automatically passed to internationalization mechanism which replaces the literal property name with a localized value taken from the associated properties file matching the current locale.
</para>
<programlisting role="XML" language="XML"><xi:include href="../../extras/PortalDevelopment_DefaultPortalNavigationConfiguration/navigation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
+
+<!-- Replaced code navigation.xml with code from GateIn commit r3831 (as per instruction from theute)
+<?xml version="1.0" encoding="UTF-8"?>
+<node-navigation
+ 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">
+ <priority>1</priority>
+ <page-nodes>
+ <node>
+ <uri>home</uri>
+ <name>home</name>
+ <label>#{portal.classic.home}</label>
+ <page-reference>portal::classic::homepage</page-reference>
+ </node>
+ <node>
+ <uri>sitemap</uri>
+ <name>sitemap</name>
+ <label>#{portal.classic.sitemap}</label>
+ <visibility>DISPLAYED</visibility>
+ <page-reference>portal::classic::sitemap</page-reference>
+ </node>
+ <node>
+ <uri>groupnavigation</uri>
+ <name>groupnavigation</name>
+ <label>#{portal.classic.groupnavigation}</label>
+ <visibility>SYSTEM</visibility>
+ <page-reference>portal::classic::groupnavigation</page-reference>
+ </node>
+ <node>
+ <uri>portalnavigation</uri>
+ <name>portalnavigation</name>
+ <label>#{portal.classic.portalnavigation}</label>
+ <visibility>SYSTEM</visibility>
+ <page-reference>portal::classic::portalnavigation</page-reference>
+ </node>
+ <node>
+ <uri>register</uri>
+ <name>register</name>
+ <label>#{portal.classic.register}</label>
+ <visibility>SYSTEM</visibility>
+ <page-reference>portal::classic::register</page-reference>
+ </node>
+ <!- NOT FOUND node ->
+ <node>
+ <uri>notfound</uri>
+ <name>notfound</name>
+ <label>NotFound</label>
+ <visibility>SYSTEM</visibility>
+ </node>
+ </page-nodes>
+</node-navigation> -->
+
<para>
This navigation tree can have multiple views inside portlets (such as the breadcrumbs portlet) that render the current view node, the site map or the menu portlets.
</para>
@@ -213,7 +266,7 @@
<calloutlist>
<callout arearefs="area-Reference_Guide-Portal_Navigation_Configuration-Portal_Navigation-subpage">
<para>
- This element defines the parent/child relationship btween a page and a subpage.
+ This element defines the parent/child relationship between a page and a subpage.
</para>
</callout>
</calloutlist>
@@ -227,6 +280,103 @@
This configuration file structure is very similar to <filename>portal.xml</filename> and it can also contain container tags. Each application can decide whether to render the portlet border, the window state, the icons or portlet's mode.
</para>
<programlisting role="XML" language="XML"><xi:include href="../../extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
+
+<!-- Replaced code pages.xml with code from GateIn commit r3831 (as per instruction from theute)
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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>homepage</name>
+ <title>Home Page</title>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ </portlet-application>
+ </page>
+
+ <page>
+ <name>groupnavigation</name>
+ <title>Group Navigation</title>
+ <access-permissions>*:/platform/users</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>exoadmin</application-ref>
+ <portlet-ref>GroupNavigationPortlet</portlet-ref>
+ </portlet>
+ <title>Group Navigation</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </portlet-application>
+ </page>
+
+ <page>
+ <name>portalnavigation</name>
+ <title>Portal Navigation</title>
+ <access-permissions>*:/platform/users</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>exoadmin</application-ref>
+ <portlet-ref>PortalNavigationPortlet</portlet-ref>
+ </portlet>
+ <title>Portal Navigation</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </portlet-application>
+ </page>
+
+ <page>
+ <name>register</name>
+ <title>Register</title>
+ <access-permissions>*:/platform/guests</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>exoadmin</application-ref>
+ <portlet-ref>RegisterPortlet</portlet-ref>
+ </portlet>
+ <title>Register Account</title>
+ <access-permissions>*:/platform/guests</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </portlet-application>
+ </page>
+ <page>
+ <name>sitemap</name>
+ <title>Site Map</title>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>SiteMapPortlet</portlet-ref>
+ </portlet>
+ <title>SiteMap</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ </portlet-application>
+ </page>
+</page-set> -->
+
</listitem>
</varlistentry>
</variablelist>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/InternationalizationConfiguration.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/InternationalizationConfiguration.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/PortalDevelopment/InternationalizationConfiguration.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -304,12 +304,11 @@
javax.portlet.keywords=Breadcrumbs, Breadcrumb]]></programlisting>-->
</section>
-<!-- DOC TODO: This section requires more information. Source content and unmark section for next release.
+<!-- DOC TODO: This section requires more information. Source content and unmark section for next release. -->
<section id="sect-Reference_Guide-_Portlets_-Debugging_Resource_Bundle_Usage">
<title>Debugging Resource Bundle Usage</title>
-
<para>
When translating an application it can sometimes be difficult to find the right key for a given property.
</para>
@@ -322,7 +321,7 @@
<para>
For example, the translated value for the key "<parameter>organization.title</parameter>" is simply the value "<parameter>organization.title</parameter>". Selecting that language allows use of the portal and its applications with all the keys visible. This makes it easier to find out the correct key for a given label in the portal page.
</para>
- </section> -->
+ </section>
</section>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/WSRP.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/WSRP.xml 2010-09-12 23:55:04 UTC (rev 4161)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/WSRP.xml 2010-09-13 03:21:15 UTC (rev 4162)
@@ -134,10 +134,10 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>$GATEIN_HOME/lib/wsrp-producer-lib-$WSRP_VERSION.jar</term>
+ <term>$GATEIN_HOME/lib/wsrp-wsrp2-ws-$WSRP_VERSION.jar</term>
<listitem>
<para>
- This file contains the classes needed by the WSRP producer.
+ This file contains the JAX-WS classes for WSRP version 2.
</para>
</listitem>
</varlistentry>
14 years, 3 months