[gatein-commits] gatein SVN: r4999 - in portal/branches/navcontroller/component/web/controller/src: test/java/org/exoplatform/web/controller/router and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Nov 10 01:08:37 EST 2010
Author: julien_viet
Date: 2010-11-10 01:08:36 -0500 (Wed, 10 Nov 2010)
New Revision: 4999
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java
Removed:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternParam.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
Log:
minor renaming
Copied: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java (from rev 4991, portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternParam.java)
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PathParam.java 2010-11-10 06:08:36 UTC (rev 4999)
@@ -0,0 +1,48 @@
+/*
+ * 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 java.util.regex.Pattern;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class PathParam
+{
+
+ /** . */
+ final QualifiedName name;
+
+ /** . */
+ final EncodingMode encodingMode;
+
+ /** . */
+ final Pattern pattern;
+
+ PathParam(QualifiedName name, EncodingMode encodingMode, Pattern pattern)
+ {
+ this.name = name;
+ this.encodingMode = encodingMode;
+ this.pattern = pattern;
+ }
+}
Deleted: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternParam.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternParam.java 2010-11-10 05:00:42 UTC (rev 4998)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternParam.java 2010-11-10 06:08:36 UTC (rev 4999)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.web.controller.router;
-
-import org.exoplatform.web.controller.QualifiedName;
-
-import java.util.regex.Pattern;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class PatternParam
-{
-
- /** . */
- final QualifiedName name;
-
- /** . */
- final EncodingMode encodingMode;
-
- /** . */
- final Pattern pattern;
-
- PatternParam(QualifiedName name, EncodingMode encodingMode, Pattern pattern)
- {
- this.name = name;
- this.encodingMode = encodingMode;
- this.pattern = pattern;
- }
-}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2010-11-10 05:00:42 UTC (rev 4998)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2010-11-10 06:08:36 UTC (rev 4999)
@@ -33,14 +33,14 @@
final Pattern pattern;
/** . */
- final List<PatternParam> params;
+ final List<PathParam> params;
/** . */
final List<String> chunks;
PatternRoute(
Pattern pattern,
- List<PatternParam> params,
+ List<PathParam> params,
List<String> chunks)
{
if (chunks.size() != params.size() + 1)
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-11-10 05:00:42 UTC (rev 4998)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-11-10 06:08:36 UTC (rev 4999)
@@ -62,7 +62,7 @@
private final Map<QualifiedName, String> routeParameters;
/** . */
- private final Map<String, RequestParam> requestParamDefs;
+ private final Map<String, RequestParam> requestParams;
Route()
{
@@ -71,7 +71,7 @@
this.segments = new LinkedHashMap<String, List<SegmentRoute>>();
this.patterns = new ArrayList<PatternRoute>();
this.routeParameters = new HashMap<QualifiedName, String>();
- this.requestParamDefs = new HashMap<String, RequestParam>();
+ this.requestParams = new HashMap<String, RequestParam>();
}
/*
@@ -95,9 +95,9 @@
}
//
- if (requestParamDefs.size() > 0)
+ if (requestParams.size() > 0)
{
- for (RequestParam requestParamDef : requestParamDefs.values())
+ for (RequestParam requestParamDef : requestParams.values())
{
String s = blah.get(requestParamDef.getName());
if (s != null)
@@ -122,7 +122,7 @@
while (i < pr.params.size())
{
renderContext.appendPath(pr.chunks.get(i), true);
- PatternParam def = pr.params.get(i);
+ PathParam def = pr.params.get(i);
String value = blah.get(def.name);
//
@@ -178,9 +178,9 @@
}
// Match any request parameter
- if (requestParamDefs.size() > 0)
+ if (requestParams.size() > 0)
{
- for (RequestParam requestParamDef : requestParamDefs.values())
+ for (RequestParam requestParamDef : requestParams.values())
{
String a = blah.get(requestParamDef.name);
boolean matched = false;
@@ -212,7 +212,7 @@
PatternRoute prt = (PatternRoute)this;
for (int i = 0;i < prt.params.size();i++)
{
- PatternParam param = prt.params.get(i);
+ PathParam param = prt.params.get(i);
String s = blah.get(param.name);
boolean matched = false;
if (s != null)
@@ -284,9 +284,9 @@
// Check request parameters
Map<QualifiedName, String> routeRequestParams = Collections.emptyMap();
- if (requestParamDefs.size() > 0)
+ if (this.requestParams.size() > 0)
{
- for (RequestParam requestParamDef : requestParamDefs.values())
+ for (RequestParam requestParamDef : this.requestParams.values())
{
String value = null;
String[] values = requestParams.get(requestParamDef.getMatchName());
@@ -394,7 +394,7 @@
int group = 1;
for (int i = 0;i < route.params.size();i++)
{
- PatternParam param = route.params.get(i);
+ PathParam param = route.params.get(i);
String value = matcher.group(group++);
if (param.encodingMode == EncodingMode.DEFAULT_FORM)
{
@@ -513,7 +513,7 @@
for (RequestParamDescriptor requestParamDescriptor : descriptor.getRequestParams().values())
{
RequestParam requestParamDef = new RequestParam(requestParamDescriptor);
- route.requestParamDefs.put(requestParamDef.getMatchName(), requestParamDef);
+ route.requestParams.put(requestParamDef.getMatchName(), requestParamDef);
}
//
@@ -600,7 +600,7 @@
PatternBuilder builder = new PatternBuilder();
builder.expr("^").expr('/');
List<String> chunks = new ArrayList<String>();
- List<PatternParam> parameterPatterns = new ArrayList<PatternParam>();
+ List<PathParam> parameterPatterns = new ArrayList<PathParam>();
//
int previous = 0;
@@ -633,7 +633,7 @@
builder.expr("(").expr(regex).expr(")");
//
- parameterPatterns.add(new PatternParam(
+ parameterPatterns.add(new PathParam(
parameterQName,
encodingMode,
Pattern.compile("^" + regex + "$")
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-11-10 05:00:42 UTC (rev 4998)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-11-10 06:08:36 UTC (rev 4999)
@@ -170,8 +170,8 @@
assertEquals(((PatternRoute)expectedRoute).params.size(), ((PatternRoute)route).params.size());
for (int i = 0;i < ((PatternRoute)expectedRoute).params.size();i++)
{
- PatternParam expectedParam = ((PatternRoute)expectedRoute).params.get(i);
- PatternParam param = ((PatternRoute)route).params.get(i);
+ PathParam expectedParam = ((PatternRoute)expectedRoute).params.get(i);
+ PathParam param = ((PatternRoute)route).params.get(i);
assertEquals(expectedParam.name, param.name);
assertEquals(expectedParam.pattern.toString(), param.pattern.toString());
assertEquals(expectedParam.encodingMode, param.encodingMode);
More information about the gatein-commits
mailing list