gatein SVN: r4048 - portal/branches.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-09-05 23:21:52 -0400 (Sun, 05 Sep 2010)
New Revision: 4048
Added:
portal/branches/branch-r4047/
Log:
Create a branch from gatein trunk at revision #4047 for committing current works
Copied: portal/branches/branch-r4047 (from rev 4047, portal/trunk)
14 years, 3 months
gatein SVN: r4047 - in exo/portal/branches/3.1.x: gadgets and 32 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-09-05 19:14:05 -0400 (Sun, 05 Sep 2010)
New Revision: 4047
Modified:
exo/portal/branches/3.1.x/
exo/portal/branches/3.1.x/gadgets/
exo/portal/branches/3.1.x/gadgets/eXoGadgets/
exo/portal/branches/3.1.x/gadgets/server/
exo/portal/branches/3.1.x/packaging/
exo/portal/branches/3.1.x/packaging/module/
exo/portal/branches/3.1.x/packaging/pkg/
exo/portal/branches/3.1.x/packaging/product/
exo/portal/branches/3.1.x/packaging/reports/
exo/portal/branches/3.1.x/portlet/
exo/portal/branches/3.1.x/portlet/dashboard/
exo/portal/branches/3.1.x/portlet/exoadmin/
exo/portal/branches/3.1.x/portlet/web/
exo/portal/branches/3.1.x/server/
exo/portal/branches/3.1.x/server/jboss/
exo/portal/branches/3.1.x/server/jboss/patch-ear/
exo/portal/branches/3.1.x/server/jboss/plugin/
exo/portal/branches/3.1.x/server/tomcat/
exo/portal/branches/3.1.x/server/tomcat/patch/
exo/portal/branches/3.1.x/server/tomcat/plugin/
exo/portal/branches/3.1.x/starter/
exo/portal/branches/3.1.x/starter/ear/
exo/portal/branches/3.1.x/starter/war/
exo/portal/branches/3.1.x/testsuite/
exo/portal/branches/3.1.x/testsuite/selenium-snifftests/
exo/portal/branches/3.1.x/testsuite/webuibasedsamples/
exo/portal/branches/3.1.x/web/
exo/portal/branches/3.1.x/web/eXoResources/
exo/portal/branches/3.1.x/web/portal/
exo/portal/branches/3.1.x/web/rest/
exo/portal/branches/3.1.x/webui/
exo/portal/branches/3.1.x/webui/core/
exo/portal/branches/3.1.x/webui/eXo/
exo/portal/branches/3.1.x/webui/portal/
Log:
Add/Update svn:ignore property to not commit IDEs/Maven generated files and directories
Property changes on: exo/portal/branches/3.1.x
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/gadgets
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/gadgets/eXoGadgets
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/gadgets/server
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/packaging
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
profiles.xml
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/packaging/module
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/packaging/pkg
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/packaging/product
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/packaging/reports
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/portlet
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/portlet/dashboard
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/portlet/exoadmin
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/portlet/web
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/jboss
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/jboss/patch-ear
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/jboss/plugin
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/tomcat
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/tomcat/patch
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/server/tomcat/plugin
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/starter
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/starter/ear
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/starter/war
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/testsuite
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/testsuite/selenium-snifftests
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
profiles.xml
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/testsuite/webuibasedsamples
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/web
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/web/eXoResources
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/web/portal
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/web/rest
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/webui
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/webui/core
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/webui/eXo
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/webui/portal
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
14 years, 3 months
gatein SVN: r4046 - in portal/branches/navcontroller: component/web/controller/src/main/java/org/exoplatform/web/url and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-05 15:22:29 -0400 (Sun, 05 Sep 2010)
New Revision: 4046
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
Log:
start to use url api for creating navigation node urls in the SiteMapPortlet
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-05 11:49:55 UTC (rev 4045)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-05 19:22:29 UTC (rev 4046)
@@ -83,6 +83,17 @@
public final <R, L extends ResourceLocator<R>> ResourceURL<R, L> createURL(ResourceType<R, L> resourceType, R resource)
{
+ ResourceURL<R, L> url = createURL(resourceType);
+
+ // Set the resource on the URL
+ url.setResource(resource);
+
+ //
+ return url;
+ }
+
+ public final <R, L extends ResourceLocator<R>> ResourceURL<R, L> createURL(ResourceType<R, L> resourceType)
+ {
// Get the provider
LocatorProvider provider = getLocatorProvider();
@@ -96,13 +107,7 @@
}
// Create an URL from the locator
- ResourceURL<R, L> url = newURL(resourceType, locator);
-
- // Set the resource on the URL
- url.setResource(resource);
-
- // Returns the URL object
- return url;
+ return newURL(resourceType, locator);
}
/**
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-05 11:49:55 UTC (rev 4045)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-05 19:22:29 UTC (rev 4046)
@@ -73,9 +73,10 @@
*
* @param resource the new resource
*/
- public final void setResource(R resource)
+ public final ResourceURL setResource(R resource)
{
locator.setResource(resource);
+ return this;
}
/**
Modified: portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
===================================================================
--- portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2010-09-05 11:49:55 UTC (rev 4045)
+++ portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2010-09-05 19:22:29 UTC (rev 4046)
@@ -4,21 +4,23 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.navigation.TreeNode;
-%>
+ import org.exoplatform.web.url.ResourceURL;
+%>
<%
def navigations = uicomponent.getNavigations();
PortalRequestContext pcontext = Util.getPortalRequestContext();
- def String portalURI = pcontext.getPortalURI();
-
+
UIPortletApplication siteMapPortlet = uicomponent.getParent();
def useAJAX = siteMapPortlet.isUseAjax();
def actionExpandAll = uicomponent.event("ExpandAllNode");
def actionCollapseAll = uicomponent.event("CollapseAllNode");
+
+ ResourceURL nodeURL = pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
- public void renderNodes(TreeNode rootTree, String portalUri, boolean useAjax) {
+ public void renderNodes(TreeNode rootTree, ResourceURL nodeURL, boolean useAjax) {
List childrenNodes=rootTree.getChildren();
int childrenSize = childrenNodes.size() ;
int size = 0;
@@ -36,7 +38,7 @@
if(useAjax){
actionLink = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri());
}else{
- actionLink = portalUri + node.getUri();
+ actionLink = nodeURL.setResource(node).toString();
}
lastNode = '';
@@ -59,7 +61,7 @@
<div class="ChildrenContainer" style="display: block">
""";
- renderNodes(treeNode, portalUri, useAjax);
+ renderNodes(treeNode, nodeURL, useAjax);
} else {
println """
@@ -110,7 +112,7 @@
<div class="SitemapContent">
<div class="UISiteTree">
<% TreeNode treeNodeRoot = uicomponent.getTreeNodes() ;%>
- <% renderNodes(treeNodeRoot,portalURI,useAJAX); %>
+ <% renderNodes(treeNodeRoot,nodeURL,useAJAX); %>
</div>
</div>
</div>
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-05 11:49:55 UTC (rev 4045)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-05 19:22:29 UTC (rev 4046)
@@ -23,6 +23,8 @@
import org.exoplatform.web.url.ResourceLocator;
import org.exoplatform.web.url.ResourceURL;
+import java.io.IOException;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -61,6 +63,18 @@
sb.append(requestContext.getPortalURI());
//
+ try
+ {
+ locator.append(sb);
+ }
+ catch (IOException e)
+ {
+ AssertionError ae = new AssertionError();
+ ae.initCause(e);
+ throw ae;
+ }
+
+ //
return sb.toString();
}
}
14 years, 3 months
gatein SVN: r4045 - in portal/branches/navcontroller: component/web/controller/src/main/java/org/exoplatform/web/url and 6 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-05 07:49:55 -0400 (Sun, 05 Sep 2010)
New Revision: 4045
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorProvider.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/LocatorProviderService.java
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/ResourceLocatorPlugin.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java
Removed:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
portal/branches/navcontroller/webui/portal/src/main/java/conf/portal/configuration.xml
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
Log:
attempt to plugin the resource url in the request context pipeline
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -20,7 +20,10 @@
package org.exoplatform.web.application;
import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.web.url.LocatorFactory;
+import org.exoplatform.web.url.LocatorProvider;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceType;
+import org.exoplatform.web.url.ResourceURL;
import java.io.Writer;
import java.util.HashMap;
@@ -74,8 +77,34 @@
*
* @return the locator factory
*/
- public abstract LocatorFactory getLocatorFactory();
+ public abstract LocatorProvider getLocatorProvider();
+ public abstract <R, L extends ResourceLocator<R>> ResourceURL<R, L> newURL(ResourceType<R, L> resourceType, L locator);
+
+ public final <R, L extends ResourceLocator<R>> ResourceURL<R, L> createURL(ResourceType<R, L> resourceType, R resource)
+ {
+ // Get the provider
+ LocatorProvider provider = getLocatorProvider();
+
+ // Obtain a locator for the resource type
+ L locator = provider.newLocator(resourceType);
+
+ //
+ if (locator == null)
+ {
+ throw new IllegalArgumentException("No resource locator found for the resource type " + resourceType);
+ }
+
+ // Create an URL from the locator
+ ResourceURL<R, L> url = newURL(resourceType, locator);
+
+ // Set the resource on the URL
+ url.setResource(resource);
+
+ // Returns the URL object
+ return url;
+ }
+
/**
* Returns the orientation for the current request.
*
Deleted: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -1,53 +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.url;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class LocatorFactory
-{
-
- /**
- * Returns a resource context for a resource type or null if none can be found.
- *
- * @param resourceType the resource type
- * @param <R> the resource parameter type
- * @param <C> the resource context parameter type
- * @param <L> the resource locator parameter type
- * @return the context
- * @throws NullPointerException if the resource type is null
- */
- protected abstract <R, C, L extends ResourceLocator<R>> C getContext(ResourceType<R, C, L> resourceType) throws NullPointerException;
-
- public <R, C, U extends ResourceLocator<R>> U newLocator(ResourceType<R, C, U> resourceType)
- {
- C context = getContext(resourceType);
- return resourceType.newLocator(context);
- }
-
- public <R, C, L extends ResourceLocator<R>> L newLocator(ResourceType<R, C, L> resourceType, R resource)
- {
- L locator = newLocator(resourceType);
- locator.setResource(resource);
- return locator;
- }
-}
Copied: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorProvider.java (from rev 4044, portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java)
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorProvider.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorProvider.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,40 @@
+/*
+ * 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.url;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class LocatorProvider
+{
+
+ /**
+ * Creates a new locator.
+ *
+ * @param resourceType the resource type
+ * @param <R> the resource parameter type
+ * @param <L> the resource locator parameter type
+ * @return the context
+ * @throws NullPointerException if the resource type is null
+ */
+ public abstract <R, L extends ResourceLocator<R>> L newLocator(ResourceType<R, L> resourceType) throws NullPointerException;
+
+}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -22,28 +22,30 @@
import java.io.IOException;
/**
- * Abstracts the URL of a resource.
+ * <p>A locator for a resource.</p>
*
+ * <p>This class is abstract to allow locator subclass to add specific parameters.</p>
+ *
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
* @param <R> the resource parameter type
*/
-public abstract class ResourceLocator<R>
+public interface ResourceLocator<R>
{
/**
- * Returns the current resource actually set.
+ * Returns the current resource actually set on this locator.
*
* @return the resource
*/
- public abstract R getResource();
+ R getResource();
/**
* Set the resource on this locator.
*
* @param resource the resource to set
*/
- public abstract void setResource(R resource);
+ void setResource(R resource);
/**
* Append the resource locator path.
@@ -51,6 +53,6 @@
* @param appendable the appendable
* @throws IOException any IOException thrown by the appendable
*/
- public abstract void append(Appendable appendable) throws IOException;
+ void append(Appendable appendable) throws IOException;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -25,20 +25,8 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
* @param <R> the resource parameter type
- * @param <C> the resource context parameter type
* @param <L> the resource locator parameter type
*/
-public abstract class ResourceType<R, C, L extends ResourceLocator<R>>
+public abstract class ResourceType<R, L extends ResourceLocator<R>>
{
-
- public abstract Class<C> getContextType();
-
- /**
- * Creates a new locator instance with the specified context.
- *
- * @param context the context
- * @return a new locator instance
- */
- protected abstract L newLocator(C context);
-
}
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,87 @@
+/*
+ * 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.url;
+
+/**
+ * An URL for a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ResourceURL<R, L extends ResourceLocator<R>>
+{
+
+ /** . */
+ protected final L locator;
+
+ /**
+ * Create a new instance.
+ *
+ * @param locator the resource locator that can't be null
+ * @throws NullPointerException if the resource locator is null
+ */
+ public ResourceURL(L locator) throws NullPointerException
+ {
+ if (locator == null)
+ {
+ throw new NullPointerException("No null locator");
+ }
+
+ //
+ this.locator = locator;
+ }
+
+ /**
+ * Returns the resource locator of this URL.
+ *
+ * @return the resource locator
+ */
+ public final L getResourceLocator()
+ {
+ return locator;
+ }
+
+ /**
+ * Returns the current resource associated with this URL.
+ *
+ * @return the resource
+ */
+ public final R getResource()
+ {
+ return locator.getResource();
+ }
+
+ /**
+ * Set a new resource on this URL.
+ *
+ * @param resource the new resource
+ */
+ public final void setResource(R resource)
+ {
+ locator.setResource(resource);
+ }
+
+ /**
+ * Generates the URL value.
+ *
+ * @return the URL value
+ */
+ public abstract String toString();
+}
Modified: portal/branches/navcontroller/webui/portal/src/main/java/conf/portal/configuration.xml
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/conf/portal/configuration.xml 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/webui/portal/src/main/java/conf/portal/configuration.xml 2010-09-05 11:49:55 UTC (rev 4045)
@@ -37,4 +37,15 @@
<!--type>org.exoplatform.portal.application.NoBrowserLocalePolicyService</type-->
<type>org.exoplatform.portal.application.localization.DefaultLocalePolicyService</type>
</component>
+
+ <component>
+ <type>org.exoplatform.portal.url.LocatorProviderService</type>
+ <component-plugins>
+ <component-plugin>
+ <name>navigation.locator.plugin</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.portal.url.navigation.NavigationLocatorPlugin</type>
+ </component-plugin>
+ </component-plugins>
+ </component>
</configuration>
Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -22,11 +22,13 @@
import org.exoplatform.Constants;
import org.exoplatform.commons.utils.PortalPrinter;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.url.PortalLocatorFactory;
+import org.exoplatform.portal.url.LocatorProviderService;
+import org.exoplatform.portal.url.PortalURL;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -36,7 +38,10 @@
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.web.url.LocatorFactory;
+import org.exoplatform.web.url.LocatorProvider;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceType;
+import org.exoplatform.web.url.ResourceURL;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
@@ -125,7 +130,7 @@
private PageNode targetNode_;
/** . */
- private final PortalLocatorFactory locatorFactory;
+ private final LocatorProviderService locatorFactory;
public JavascriptManager getJavascriptManager()
{
@@ -150,7 +155,7 @@
super(app);
//
- locatorFactory = new PortalLocatorFactory();
+ locatorFactory = (LocatorProviderService)PortalContainer.getComponent(LocatorProviderService.class);
//
request_ = req;
@@ -223,6 +228,12 @@
urlBuilder = new PortalURLBuilder(requestURI_);
}
+ @Override
+ public <R, L extends ResourceLocator<R>> ResourceURL<R, L> newURL(ResourceType<R, L> resourceType, L locator)
+ {
+ return new PortalURL<R,L>(this, locator);
+ }
+
public void refreshResourceBundle() throws Exception
{
appRes_ = getApplication().getResourceBundle(getLocale());
@@ -264,7 +275,7 @@
}
@Override
- public LocatorFactory getLocatorFactory()
+ public LocatorProvider getLocatorProvider()
{
return locatorFactory;
}
Added: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/LocatorProviderService.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/LocatorProviderService.java (rev 0)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/LocatorProviderService.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,62 @@
+/*
+ * 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.portal.url;
+
+import org.exoplatform.web.url.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class LocatorProviderService extends LocatorProvider
+{
+
+ /** . */
+ private final Map<ResourceType<?,?>, ResourceLocatorPlugin> plugins;
+
+ public LocatorProviderService()
+ {
+ this.plugins = new HashMap<ResourceType<?,?>, ResourceLocatorPlugin>();
+ }
+
+ @Override
+ public <R, L extends ResourceLocator<R>> L newLocator(ResourceType<R, L> resourceType) throws NullPointerException
+ {
+ if (resourceType == null)
+ {
+ throw new NullPointerException("No null resource type accepted");
+ }
+
+ // Can't really make that checked
+ @SuppressWarnings("unchecked")
+ ResourceLocatorPlugin<R, L> plugin = (ResourceLocatorPlugin<R,L>)plugins.get(resourceType);
+
+ //
+ return plugin != null ? plugin.newLocator() : null;
+ }
+
+ public void addPlugin(ResourceLocatorPlugin plugin)
+ {
+ plugins.put(plugin.getResourceType(), plugin);
+ }
+}
Added: 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 (rev 0)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.url;
+
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceURL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalURL<R, L extends ResourceLocator<R>> extends ResourceURL<R, L>
+{
+
+ /** . */
+ private final PortalRequestContext requestContext;
+
+ public PortalURL(PortalRequestContext requestContext, L locator)
+ {
+ super(locator);
+
+ //
+ if (requestContext == null)
+ {
+ throw new NullPointerException("No null request context");
+ }
+
+ //
+ this.requestContext = requestContext;
+ }
+
+ public String toString()
+ {
+ if (locator.getResource() == null)
+ {
+ throw new IllegalStateException("No resource set of the portal URL");
+ }
+
+ //
+ StringBuilder sb = new StringBuilder();
+
+ //
+ sb.append(requestContext.getPortalURI());
+
+ //
+ return sb.toString();
+ }
+}
Added: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/ResourceLocatorPlugin.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/ResourceLocatorPlugin.java (rev 0)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/ResourceLocatorPlugin.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,49 @@
+/*
+ * 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.portal.url;
+
+import org.exoplatform.container.component.BaseComponentPlugin;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceType;
+
+/**
+ * A plugin for adding resource locator to the {@link LocatorProviderService}.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ResourceLocatorPlugin<R, L extends ResourceLocator<R>> extends BaseComponentPlugin
+{
+
+ /**
+ * Returns the resource type.
+ *
+ * @return the resource type
+ */
+ protected abstract ResourceType<R, L> getResourceType();
+
+ /**
+ * Returns a new locator instance.
+ *
+ * @return a new locator instance
+ */
+ protected abstract L newLocator();
+
+}
Added: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java (rev 0)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,57 @@
+/*
+ * 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.portal.url.navigation;
+
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceType;
+
+import java.io.IOException;
+
+/**
+ * A resource locator for navigation nodes.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationLocator implements ResourceLocator<PageNode>
+{
+
+ /** . */
+ public static final ResourceType<PageNode, NavigationLocator> TYPE = new ResourceType<PageNode, NavigationLocator>(){};
+
+ /** . */
+ private PageNode resource;
+
+ public PageNode getResource()
+ {
+ return resource;
+ }
+
+ public void setResource(PageNode resource)
+ {
+ this.resource = resource;
+ }
+
+ public void append(Appendable appendable) throws IOException
+ {
+ appendable.append(resource.getUri());
+ }
+}
Added: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java (rev 0)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -0,0 +1,44 @@
+/*
+ * 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.portal.url.navigation;
+
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.url.ResourceLocatorPlugin;
+import org.exoplatform.web.url.ResourceType;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationLocatorPlugin extends ResourceLocatorPlugin<PageNode, NavigationLocator>
+{
+
+ @Override
+ protected ResourceType<PageNode, NavigationLocator> getResourceType()
+ {
+ return NavigationLocator.TYPE;
+ }
+
+ @Override
+ protected NavigationLocator newLocator()
+ {
+ return new NavigationLocator();
+ }
+}
Modified: portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
+++ portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-05 11:49:55 UTC (rev 4045)
@@ -22,7 +22,10 @@
import org.exoplatform.commons.utils.WriterPrinter;
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.web.url.LocatorFactory;
+import org.exoplatform.web.url.LocatorProvider;
+import org.exoplatform.web.url.ResourceLocator;
+import org.exoplatform.web.url.ResourceType;
+import org.exoplatform.web.url.ResourceURL;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -74,6 +77,12 @@
urlBuilder = new PortletURLBuilder();
}
+ @Override
+ public <R, L extends ResourceLocator<R>> ResourceURL<R, L> newURL(ResourceType<R, L> resourceType, L locator)
+ {
+ return parentAppRequestContext_.newURL(resourceType, locator);
+ }
+
public void init(Writer writer, PortletRequest req, PortletResponse res)
{
request_ = req;
@@ -134,9 +143,9 @@
}
@Override
- public LocatorFactory getLocatorFactory()
+ public LocatorProvider getLocatorProvider()
{
- return parentAppRequestContext_.getLocatorFactory();
+ return parentAppRequestContext_.getLocatorProvider();
}
public String getRemoteUser()
14 years, 3 months
gatein SVN: r4044 - in portal/branches/navcontroller: component/web/controller/src/main/java/org/exoplatform/web/url and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-05 05:31:13 -0400 (Sun, 05 Sep 2010)
New Revision: 4044
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java
Removed:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
Log:
improve a bit
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -20,7 +20,7 @@
package org.exoplatform.web.application;
import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.web.url.URLFactory;
+import org.exoplatform.web.url.LocatorFactory;
import java.io.Writer;
import java.util.HashMap;
@@ -70,11 +70,11 @@
}
/**
- * Returns the URL factory associated with this context.
+ * Returns the locator factory associated with this context.
*
- * @return the URL factory
+ * @return the locator factory
*/
- public abstract URLFactory getURLFactory();
+ public abstract LocatorFactory getLocatorFactory();
/**
* Returns the orientation for the current request.
Copied: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java (from rev 4043, portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java)
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/LocatorFactory.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -0,0 +1,53 @@
+/*
+ * 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.url;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class LocatorFactory
+{
+
+ /**
+ * Returns a resource context for a resource type or null if none can be found.
+ *
+ * @param resourceType the resource type
+ * @param <R> the resource parameter type
+ * @param <C> the resource context parameter type
+ * @param <L> the resource locator parameter type
+ * @return the context
+ * @throws NullPointerException if the resource type is null
+ */
+ protected abstract <R, C, L extends ResourceLocator<R>> C getContext(ResourceType<R, C, L> resourceType) throws NullPointerException;
+
+ public <R, C, U extends ResourceLocator<R>> U newLocator(ResourceType<R, C, U> resourceType)
+ {
+ C context = getContext(resourceType);
+ return resourceType.newLocator(context);
+ }
+
+ public <R, C, L extends ResourceLocator<R>> L newLocator(ResourceType<R, C, L> resourceType, R resource)
+ {
+ L locator = newLocator(resourceType);
+ locator.setResource(resource);
+ return locator;
+ }
+}
Copied: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java (from rev 4043, portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java)
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceLocator.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -0,0 +1,56 @@
+/*
+ * 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.url;
+
+import java.io.IOException;
+
+/**
+ * Abstracts the URL of a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ * @param <R> the resource parameter type
+ */
+public abstract class ResourceLocator<R>
+{
+
+ /**
+ * Returns the current resource actually set.
+ *
+ * @return the resource
+ */
+ public abstract R getResource();
+
+ /**
+ * Set the resource on this locator.
+ *
+ * @param resource the resource to set
+ */
+ public abstract void setResource(R resource);
+
+ /**
+ * Append the resource locator path.
+ *
+ * @param appendable the appendable
+ * @throws IOException any IOException thrown by the appendable
+ */
+ public abstract void append(Appendable appendable) throws IOException;
+
+}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -26,17 +26,19 @@
* @version $Revision$
* @param <R> the resource parameter type
* @param <C> the resource context parameter type
- * @param <U> the resource URL parameter type
+ * @param <L> the resource locator parameter type
*/
-public abstract class ResourceType<R, C, U extends ResourceURL<R>>
+public abstract class ResourceType<R, C, L extends ResourceLocator<R>>
{
+ public abstract Class<C> getContextType();
+
/**
- * Creates a new URL instance with the specified context.
+ * Creates a new locator instance with the specified context.
*
* @param context the context
- * @return a new URL instance
+ * @return a new locator instance
*/
- protected abstract U newURL(C context);
+ protected abstract L newLocator(C context);
}
Deleted: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -1,47 +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.url;
-
-/**
- * Abstracts the URL of a resource.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- * @param <R> the resource parameter type
- */
-public abstract class ResourceURL<R>
-{
-
- /**
- * Returns the current resource actually set.
- *
- * @return the resource
- */
- public abstract R getResource();
-
- /**
- * Set the resource on this URL.
- *
- * @param resource the resource to set
- */
- public abstract void setResource(R resource);
-
-
-}
Deleted: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -1,43 +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.url;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class URLFactory
-{
-
- protected abstract <R, C, U extends ResourceURL<R>> C getContext(ResourceType<R, C, U> resourceType);
-
- public <R, C, U extends ResourceURL<R>> U newURL(ResourceType<R, C, U> resourceType)
- {
- C context = getContext(resourceType);
- return resourceType.newURL(context);
- }
-
- public <R, C, U extends ResourceURL<R>> U newURL(ResourceType<R, C, U> resourceType, R resource)
- {
- U url = newURL(resourceType);
- url.setResource(resource);
- return url;
- }
-}
Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -26,6 +26,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.url.PortalLocatorFactory;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -35,7 +36,7 @@
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.web.url.URLFactory;
+import org.exoplatform.web.url.LocatorFactory;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
@@ -123,6 +124,9 @@
private PageNode targetNode_;
+ /** . */
+ private final PortalLocatorFactory locatorFactory;
+
public JavascriptManager getJavascriptManager()
{
return jsmanager_;
@@ -144,6 +148,11 @@
public PortalRequestContext(WebuiApplication app, HttpServletRequest req, HttpServletResponse res) throws Exception
{
super(app);
+
+ //
+ locatorFactory = new PortalLocatorFactory();
+
+ //
request_ = req;
response_ = res;
response_.setBufferSize(1024 * 100);
@@ -255,9 +264,9 @@
}
@Override
- public URLFactory getURLFactory()
+ public LocatorFactory getLocatorFactory()
{
- throw new UnsupportedOperationException();
+ return locatorFactory;
}
/**
Modified: portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
+++ portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-05 09:31:13 UTC (rev 4044)
@@ -22,7 +22,7 @@
import org.exoplatform.commons.utils.WriterPrinter;
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.web.url.URLFactory;
+import org.exoplatform.web.url.LocatorFactory;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -134,9 +134,9 @@
}
@Override
- public URLFactory getURLFactory()
+ public LocatorFactory getLocatorFactory()
{
- return parentAppRequestContext_.getURLFactory();
+ return parentAppRequestContext_.getLocatorFactory();
}
public String getRemoteUser()
14 years, 3 months
gatein SVN: r4043 - in portal/branches/navcontroller: component/web/controller/src/main/java/org/exoplatform/web/application and 3 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-04 03:27:43 -0400 (Sat, 04 Sep 2010)
New Revision: 4043
Added:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
Log:
start to scratch the internal API for dealing with URL generation properly
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-03 21:19:40 UTC (rev 4042)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/application/RequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -20,6 +20,7 @@
package org.exoplatform.web.application;
import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.web.url.URLFactory;
import java.io.Writer;
import java.util.HashMap;
@@ -69,6 +70,13 @@
}
/**
+ * Returns the URL factory associated with this context.
+ *
+ * @return the URL factory
+ */
+ public abstract URLFactory getURLFactory();
+
+ /**
* Returns the orientation for the current request.
*
* @return the orientation
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceType.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -0,0 +1,42 @@
+/*
+ * 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.url;
+
+/**
+ * The type of a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ * @param <R> the resource parameter type
+ * @param <C> the resource context parameter type
+ * @param <U> the resource URL parameter type
+ */
+public abstract class ResourceType<R, C, U extends ResourceURL<R>>
+{
+
+ /**
+ * Creates a new URL instance with the specified context.
+ *
+ * @param context the context
+ * @return a new URL instance
+ */
+ protected abstract U newURL(C context);
+
+}
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/ResourceURL.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -0,0 +1,47 @@
+/*
+ * 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.url;
+
+/**
+ * Abstracts the URL of a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ * @param <R> the resource parameter type
+ */
+public abstract class ResourceURL<R>
+{
+
+ /**
+ * Returns the current resource actually set.
+ *
+ * @return the resource
+ */
+ public abstract R getResource();
+
+ /**
+ * Set the resource on this URL.
+ *
+ * @param resource the resource to set
+ */
+ public abstract void setResource(R resource);
+
+
+}
Added: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java (rev 0)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/url/URLFactory.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -0,0 +1,43 @@
+/*
+ * 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.url;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class URLFactory
+{
+
+ protected abstract <R, C, U extends ResourceURL<R>> C getContext(ResourceType<R, C, U> resourceType);
+
+ public <R, C, U extends ResourceURL<R>> U newURL(ResourceType<R, C, U> resourceType)
+ {
+ C context = getContext(resourceType);
+ return resourceType.newURL(context);
+ }
+
+ public <R, C, U extends ResourceURL<R>> U newURL(ResourceType<R, C, U> resourceType, R resource)
+ {
+ U url = newURL(resourceType);
+ url.setResource(resource);
+ return url;
+ }
+}
Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-03 21:19:40 UTC (rev 4042)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -35,6 +35,7 @@
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
+import org.exoplatform.web.url.URLFactory;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
@@ -253,6 +254,12 @@
return title;
}
+ @Override
+ public URLFactory getURLFactory()
+ {
+ throw new UnsupportedOperationException();
+ }
+
/**
* Process current Portal Request URI. if current require uri is not equal to last one then
* an event of type UIPortalApplication.CHANGE_NODE will be retuned, otherwise it returns <code>null</code>
Modified: portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
===================================================================
--- portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-03 21:19:40 UTC (rev 4042)
+++ portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2010-09-04 07:27:43 UTC (rev 4043)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.WriterPrinter;
import org.exoplatform.services.resources.Orientation;
import org.exoplatform.web.application.URLBuilder;
+import org.exoplatform.web.url.URLFactory;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -132,6 +133,12 @@
return response_;
}
+ @Override
+ public URLFactory getURLFactory()
+ {
+ return parentAppRequestContext_.getURLFactory();
+ }
+
public String getRemoteUser()
{
return parentAppRequestContext_.getRemoteUser();
14 years, 3 months
gatein SVN: r4042 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp/spec/v1 and 9 other directories.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-09-03 17:19:40 -0400 (Fri, 03 Sep 2010)
New Revision: 4042
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2ToV1ConverterTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/RegistrationEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/PortletManagementEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/RegistrationEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
Log:
GTNWSRP-43: update calls to WSRP 2 type constructors to use the WSRPTypeFactory instead of directly.
GTNWSRP-42: update WSRPTypeFactory to be conform to the xsd.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -105,72 +105,68 @@
}
}
- EmployerInfo employerInfo = new EmployerInfo();
- employerInfo.setEmployer(userInfos.get(INFO_USER_EMPLOYER));
- employerInfo.setDepartment(userInfos.get(INFO_USER_DEPARTMENT));
- employerInfo.setJobtitle(userInfos.get(INFO_USER_JOB_TITLE));
+ String employer = userInfos.get(INFO_USER_EMPLOYER);
+ String department = userInfos.get(INFO_USER_DEPARTMENT);
+ String jobTitle = userInfos.get(INFO_USER_JOB_TITLE);
+ EmployerInfo employerInfo = WSRPTypeFactory.createEmployerInfo(employer, department, jobTitle);
- UserProfile userProfile = new UserProfile();
- userProfile.setName(name);
- userProfile.setBdate(bdate);
- userProfile.setGender(userInfos.get(INFO_USER_GENDER));
- userProfile.setEmployerInfo(employerInfo);
- userProfile.setHomeInfo(createContactFrom(userInfos, false));
- userProfile.setBusinessInfo(createContactFrom(userInfos, true));
+ Contact homeInfo = createContactFrom(userInfos, false);
+ Contact businessInfo = createContactFrom(userInfos, true);
+ UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, userInfos.get(INFO_USER_GENDER), employerInfo, homeInfo, businessInfo);
+
return userProfile;
}
private static PersonName createNameFrom(Map<String, String> userInfos)
{
- PersonName name = new PersonName();
- name.setPrefix(userInfos.get(INFO_USER_NAME_PREFIX));
- name.setFamily(userInfos.get(INFO_USER_NAME_FAMILY));
- name.setGiven(userInfos.get(INFO_USER_NAME_GIVEN));
- name.setMiddle(userInfos.get(INFO_USER_NAME_MIDDLE));
- name.setSuffix(userInfos.get(INFO_USER_NAME_SUFFIX));
- name.setNickname(userInfos.get(INFO_USER_NAME_NICKNAME));
+ String prefix = userInfos.get(INFO_USER_NAME_PREFIX);
+ String given = userInfos.get(INFO_USER_NAME_GIVEN);
+ String family = userInfos.get(INFO_USER_NAME_FAMILY);
+ String middle = userInfos.get(INFO_USER_NAME_MIDDLE);
+ String suffix = userInfos.get(INFO_USER_NAME_SUFFIX);
+ String nickName = userInfos.get(INFO_USER_NAME_NICKNAME);
+
+ PersonName name = WSRPTypeFactory.createPersonName(prefix, given, family, middle, suffix, nickName);
+
return name;
}
private static Contact createContactFrom(Map<String, String> infos, boolean isBusiness)
{
- Online online = new Online();
- online.setEmail(infos.get(getOnlineUserInfoKey(OnlineInfo.EMAIL, isBusiness)));
- online.setUri(infos.get(getOnlineUserInfoKey(OnlineInfo.URI, isBusiness)));
+ String email = infos.get(getOnlineUserInfoKey(OnlineInfo.EMAIL, isBusiness));
+ String uri = infos.get(getOnlineUserInfoKey(OnlineInfo.URI, isBusiness));
+ Online online = WSRPTypeFactory.createOnline(email, uri);
- Postal postal = new Postal();
- postal.setName(infos.get(getPostalUserInfoKey(PostalInfo.NAME, isBusiness)));
- postal.setStreet(infos.get(getPostalUserInfoKey(PostalInfo.STREET, isBusiness)));
- postal.setCity(infos.get(getPostalUserInfoKey(PostalInfo.CITY, isBusiness)));
- postal.setStateprov(infos.get(getPostalUserInfoKey(PostalInfo.STATEPROV, isBusiness)));
- postal.setPostalcode(infos.get(getPostalUserInfoKey(PostalInfo.POSTALCODE, isBusiness)));
- postal.setCountry(infos.get(getPostalUserInfoKey(PostalInfo.COUNTRY, isBusiness)));
- postal.setOrganization(infos.get(getPostalUserInfoKey(PostalInfo.ORGANIZATION, isBusiness)));
+ String name = infos.get(getPostalUserInfoKey(PostalInfo.NAME, isBusiness));
+ String street = infos.get(getPostalUserInfoKey(PostalInfo.STREET, isBusiness));
+ String city = infos.get(getPostalUserInfoKey(PostalInfo.CITY, isBusiness));
+ String stateprov = infos.get(getPostalUserInfoKey(PostalInfo.STATEPROV, isBusiness));
+ String postalCode = infos.get(getPostalUserInfoKey(PostalInfo.POSTALCODE, isBusiness));
+ String country = infos.get(getPostalUserInfoKey(PostalInfo.COUNTRY, isBusiness));
+ String organization = infos.get(getPostalUserInfoKey(PostalInfo.ORGANIZATION, isBusiness));
+ Postal postal = WSRPTypeFactory.createPostal(name, street, city, stateprov, postalCode, country, organization);
- Telecom telecom = new Telecom();
- telecom.setTelephone(createTelephoneNumFrom(infos, TelecomType.TELEPHONE, isBusiness));
- telecom.setFax(createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness));
- telecom.setMobile(createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness));
- telecom.setPager(createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness));
+ TelephoneNum telephone = createTelephoneNumFrom(infos, TelecomType.TELEPHONE, isBusiness);
+ TelephoneNum fax = createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness);
+ TelephoneNum mobile = createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness);
+ TelephoneNum pager = createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness);
+ Telecom telecom = WSRPTypeFactory.createTelecom(telephone, fax, mobile, pager);
+
+ Contact contact = WSRPTypeFactory.createContact(postal, telecom, online);
- Contact contact = new Contact();
- contact.setPostal(postal);
- contact.setTelecom(telecom);
- contact.setOnline(online);
-
return contact;
}
private static TelephoneNum createTelephoneNumFrom(Map<String, String> infos, TelecomType type, boolean isBusiness)
{
- TelephoneNum num = new TelephoneNum();
- num.setIntcode(infos.get(getTelecomInfoKey(type, TelecomInfo.INTCODE, isBusiness)));
- num.setLoccode(infos.get(getTelecomInfoKey(type, TelecomInfo.LOCCODE, isBusiness)));
- num.setNumber(infos.get(getTelecomInfoKey(type, TelecomInfo.NUMBER, isBusiness)));
- num.setExt(infos.get(getTelecomInfoKey(type, TelecomInfo.EXT, isBusiness)));
- num.setComment(infos.get(getTelecomInfoKey(type, TelecomInfo.COMMENT, isBusiness)));
+ String intCode = infos.get(getTelecomInfoKey(type, TelecomInfo.INTCODE, isBusiness));
+ String loccode = infos.get(getTelecomInfoKey(type, TelecomInfo.LOCCODE, isBusiness));
+ String number = infos.get(getTelecomInfoKey(type, TelecomInfo.NUMBER, isBusiness));
+ String ext = infos.get(getTelecomInfoKey(type, TelecomInfo.EXT, isBusiness));
+ String comment = infos.get(getTelecomInfoKey(type, TelecomInfo.COMMENT, isBusiness));
+ TelephoneNum telephoneNum = WSRPTypeFactory.createTelephoneNum(intCode, loccode, number, ext, comment);
- return num;
+ return telephoneNum;
}
/**
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -44,8 +44,10 @@
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.ClonePortlet;
+import org.oasis.wsrp.v2.Contact;
import org.oasis.wsrp.v2.DestroyPortlets;
import org.oasis.wsrp.v2.DestroyPortletsResponse;
+import org.oasis.wsrp.v2.EmployerInfo;
import org.oasis.wsrp.v2.Event;
import org.oasis.wsrp.v2.EventDescription;
import org.oasis.wsrp.v2.EventParams;
@@ -53,6 +55,7 @@
import org.oasis.wsrp.v2.ExportPortlets;
import org.oasis.wsrp.v2.ExportPortletsResponse;
import org.oasis.wsrp.v2.ExportedPortlet;
+import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.GetPortletDescription;
@@ -69,6 +72,7 @@
import org.oasis.wsrp.v2.ImportedPortlet;
import org.oasis.wsrp.v2.InitCookie;
import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.ItemDescription;
import org.oasis.wsrp.v2.Lifetime;
import org.oasis.wsrp.v2.LocalizedString;
import org.oasis.wsrp.v2.MarkupContext;
@@ -76,17 +80,22 @@
import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.MimeResponse;
+import org.oasis.wsrp.v2.MissingParametersFault;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModifyRegistration;
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NamedStringArray;
import org.oasis.wsrp.v2.NavigationalContext;
+import org.oasis.wsrp.v2.Online;
+import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.ParameterDescription;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
+import org.oasis.wsrp.v2.PersonName;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.PortletDescriptionResponse;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v2.Postal;
import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.PropertyDescription;
import org.oasis.wsrp.v2.PropertyList;
@@ -95,21 +104,29 @@
import org.oasis.wsrp.v2.ReleaseExport;
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ResetProperty;
+import org.oasis.wsrp.v2.Resource;
import org.oasis.wsrp.v2.ResourceContext;
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.ResourceParams;
import org.oasis.wsrp.v2.ResourceResponse;
+import org.oasis.wsrp.v2.ResourceValue;
+import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.SessionParams;
import org.oasis.wsrp.v2.SetExportLifetime;
import org.oasis.wsrp.v2.SetPortletProperties;
import org.oasis.wsrp.v2.StateChange;
+import org.oasis.wsrp.v2.Telecom;
+import org.oasis.wsrp.v2.TelephoneNum;
import org.oasis.wsrp.v2.Templates;
import org.oasis.wsrp.v2.UpdateResponse;
import org.oasis.wsrp.v2.UploadContext;
import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.UserProfile;
+import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.Collection;
@@ -119,7 +136,6 @@
import static org.gatein.wsrp.WSRPRewritingConstants.*;
/**
- * TODO: NEEDS TO BE UPDATED TO CONFORM TO WSRP 2 XSD, see GTNWSRP-42
* <p/>
* Creates minimally valid instances of WSRP types, populated with default values where possible, as per
* wsrp_v2_types.xsd.
@@ -154,17 +170,6 @@
}
/**
- * Same as createMarkupRequest(handle, createDefaultRuntimeContext(), createDefaultMarkupParams())
- *
- * @param handle
- * @return
- */
- public static GetMarkup createDefaultGetMarkup(String handle)
- {
- return createGetMarkup(null, createPortletContext(handle), createDefaultRuntimeContext(), null, createDefaultMarkupParams());
- }
-
- /**
* {@link RegistrationContext} (nillable), {@link PortletContext}, {@link RuntimeContext}, {@link UserContext}
* (nillable), {@link MarkupParams}
*
@@ -221,19 +226,6 @@
}
/**
- * Same as createPerformBlockingInteraction(portletHandle, {@link #createDefaultRuntimeContext}(), {@link
- * #createDefaultMarkupParams}(), {@link #createDefaultInteractionParams}());
- *
- * @param portletHandle
- * @return
- */
- public static PerformBlockingInteraction createDefaultPerformBlockingInteraction(String portletHandle)
- {
- return createPerformBlockingInteraction(null, createPortletContext(portletHandle), createDefaultRuntimeContext(), null, createDefaultMarkupParams(),
- createDefaultInteractionParams());
- }
-
- /**
* {@link RegistrationContext} (nillable), {@link PortletContext}, {@link RuntimeContext}, {@link UserContext}
* (nillable), {@link MarkupParams}, {@link InteractionParams}
*
@@ -309,8 +301,10 @@
*/
public static GetPortletDescription createGetPortletDescription(RegistrationContext registrationContext, String portletHandle)
{
+ PortletContext portletContext = createPortletContext(portletHandle);
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
GetPortletDescription description = new GetPortletDescription();
- description.setPortletContext(createPortletContext(portletHandle));
+ description.setPortletContext(portletContext);
description.setRegistrationContext(registrationContext);
return description;
}
@@ -418,18 +412,6 @@
}
}
- /**
- * Same as createMarkupParams(false, {@link WSRPConstants#getDefaultLocales()}, {@link
- * WSRPConstants#getDefaultMimeTypes()}, {@link WSRPConstants#VIEW_MODE}, {@link WSRPConstants#NORMAL_WINDOW_STATE})
- *
- * @return
- */
- public static MarkupParams createDefaultMarkupParams()
- {
- return createMarkupParams(false, WSRPConstants.getDefaultLocales(), WSRPConstants.getDefaultMimeTypes(),
- WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE);
- }
-
public static MarkupParams createMarkupParams(boolean secureClientCommunication, List<String> locales,
List<String> mimeTypes, String mode, String windowState)
{
@@ -438,6 +420,11 @@
{
throw new IllegalArgumentException("Cannot create a MarkupParams with an empty list of locales!");
}
+
+ if (mimeTypes.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a MarkupParams with an empty list of mimeTypes!");
+ }
ParameterValidation.throwIllegalArgExceptionIfNull(mimeTypes, "MIME types");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mode, "mode", "MarkupParams");
@@ -471,6 +458,13 @@
{
throw new IllegalArgumentException("Cannot create a ResourceParams with an empty list of locales!");
}
+
+ ParameterValidation.throwIllegalArgExceptionIfNull(mimeTypes, "locales");
+ if (mimeTypes.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a MarkupParams with an empty list of mimeTypes!");
+ }
+
ParameterValidation.throwIllegalArgExceptionIfNull(mimeTypes, "MIME types");
ParameterValidation.throwIllegalArgExceptionIfNull(stateChange, "State Change");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mode, "mode", "ResourceParams");
@@ -497,23 +491,16 @@
return resourceParams;
}
- /**
- * Same as createRuntimeContext({@link WSRPConstants#NONE_USER_AUTHENTICATION})
- *
- * @return
- */
- public static RuntimeContext createDefaultRuntimeContext()
+ public static RuntimeContext createRuntimeContext(String userAuthentication, String portletInstanceKey, String namespacePrefix)
{
- return createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION);
- }
-
- public static RuntimeContext createRuntimeContext(String userAuthentication)
- {
- //TODO: portletInstanceKey and NameSpacepPrefix are also required;
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAuthentication, "user authentication", "RuntimeContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletInstanceKey, "Portlet Instance Key", "RuntimeContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(namespacePrefix, "Namespace Prefix", "RuntimeContext");
RuntimeContext runtimeContext = new RuntimeContext();
runtimeContext.setUserAuthentication(userAuthentication);
+ runtimeContext.setPortletInstanceKey(portletInstanceKey);
+ runtimeContext.setNamespacePrefix(namespacePrefix);
return runtimeContext;
}
@@ -534,16 +521,6 @@
return pc;
}
- /**
- * Same as createInteractionParams(StateChange.readOnly)
- *
- * @return
- */
- public static InteractionParams createDefaultInteractionParams()
- {
- return createInteractionParams(StateChange.READ_ONLY);
- }
-
public static InteractionParams createInteractionParams(StateChange portletStateChange)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletStateChange, "portletStateChange");
@@ -593,6 +570,7 @@
*/
public static MarkupContext createMarkupContext(String mediaType, String markupString)
{
+ //TODO: this should be allowed to be null
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "Media type", "MarkupContext");
if (markupString == null)
{
@@ -614,6 +592,7 @@
*/
public static MarkupContext createMarkupContext(String mediaType, byte[] markupBinary)
{
+ //TODO: this should be allowed to be null
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "MIME type", "MarkupContext");
if (markupBinary == null || markupBinary.length == 0)
{
@@ -640,6 +619,7 @@
public static <T extends MimeResponse> T createMimeResponse(String mimeType, String itemString, byte[] itemBinary, Class<T> clazz)
{
+ //TODO: this should be allowed to be null
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME type", "MimeResponse");
if ((itemString == null) && (itemBinary == null || itemBinary.length == 0))
{
@@ -710,12 +690,13 @@
* method="get".
* @return
*/
- public static RegistrationData createRegistrationData(String consumerName, boolean methodGetSupported)
+ public static RegistrationData createRegistrationData(String consumerName, String consumerAgent, boolean methodGetSupported)
{
- //TODO: consumer agent requirement
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "consumer name", "RegistrationData");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent, "consumer agent", "RegistrationData");
RegistrationData regData = createDefaultRegistrationData();
regData.setConsumerName(consumerName);
+ regData.setConsumerAgent(consumerAgent);
regData.setMethodGetSupported(methodGetSupported);
return regData;
}
@@ -745,10 +726,8 @@
public static Property createProperty(QName name, String lang, String stringValue)
{
- //TODO: stringValue is not required
ParameterValidation.throwIllegalArgExceptionIfNull(name, "name");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "language", "Property");
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(stringValue, "String value", "Property");
Property property = new Property();
property.setName(name);
@@ -878,6 +857,21 @@
return templates;
}
+
+ public static Templates createTemplates(String defaultTemplate, String blockingActionTemplate, String renderTemplate, String resourceTemplate, String secureDefaultTemplate, String secureBlockingActionTemplate, String secureRenderTemplate, String secureResourceTemplate)
+ {
+ Templates templates = new Templates();
+ templates.setDefaultTemplate(defaultTemplate);
+ templates.setBlockingActionTemplate(blockingActionTemplate);
+ templates.setRenderTemplate(renderTemplate);
+ templates.setResourceTemplate(resourceTemplate);
+ templates.setSecureDefaultTemplate(secureDefaultTemplate);
+ templates.setSecureBlockingActionTemplate(secureBlockingActionTemplate);
+ templates.setSecureRenderTemplate(secureRenderTemplate);
+ templates.setSecureResourceTemplate(secureResourceTemplate);
+
+ return templates;
+ }
private static String createTemplate(PortletInvocationContext context, ContainerURL url, Boolean secure)
{
@@ -1232,8 +1226,20 @@
public static MarkupType createMarkupType(String mimeType, List<String> modeNames, List<String> windowStateNames, List<String> localeNames)
{
- //TODO: modes and windowstates might need a check for null
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME Type", "MarkupContext");
+
+ ParameterValidation.throwIllegalArgExceptionIfNull(modeNames, "modeNames");
+ if (modeNames.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a MarkupType with an empty list of modes!");
+ }
+
+ ParameterValidation.throwIllegalArgExceptionIfNull(windowStateNames, "windowStatesNames");
+ if (windowStateNames.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a MarkupType with an empty list of windowStates!");
+ }
+
MarkupType markupType = new MarkupType();
markupType.setMimeType(mimeType);
@@ -1262,7 +1268,6 @@
*/
public static FailedPortlets createFailedPortlets(Collection<String> portletHandles, ErrorCodes.Codes errorCode, String reason)
{
- //TODO: reason should be a LocalizedString
ParameterValidation.throwIllegalArgExceptionIfNull(errorCode, "ErrorCode");
if (ParameterValidation.existsAndIsNotEmpty(portletHandles))
{
@@ -1328,6 +1333,19 @@
return null;
}
+
+ public static NavigationalContext createNavigationalContext(String opaqueValue, List<NamedString> publicValues)
+ {
+ NavigationalContext navigationalContext = new NavigationalContext();
+ navigationalContext.setOpaqueValue(opaqueValue);
+
+ if (publicValues != null && !publicValues.isEmpty())
+ {
+ navigationalContext.getPublicValues().addAll(publicValues);
+ }
+
+ return navigationalContext;
+ }
public static ParameterDescription createParameterDescription(String identifier)
{
@@ -1388,6 +1406,7 @@
public static NamedString createNamedString(String name, String value)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "name");
NamedString namedString = new NamedString();
namedString.setName(name);
namedString.setValue(value);
@@ -1437,6 +1456,7 @@
public static ExportedPortlet createExportedPortlet(String portletHandle, byte[] exportData)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletHandle, "PortletHandle");
+ ParameterValidation.throwIllegalArgExceptionIfNull(exportData, "ExportData");
ExportedPortlet exportedPortlet = new ExportedPortlet();
exportedPortlet.setPortletHandle(portletHandle);
@@ -1486,7 +1506,6 @@
public static ImportPortletsFailed createImportPortletsFailed(List<String> importIds, ErrorCodes.Codes errorCode, String reason)
{
- //TODO: reason should be a LocalizedString
ParameterValidation.throwIllegalArgExceptionIfNull(errorCode, "ErrorCode");
if (ParameterValidation.existsAndIsNotEmpty(importIds))
{
@@ -1501,7 +1520,7 @@
return failedPortlets;
}
- throw new IllegalArgumentException("Must provide non-null, non-empty portlet handle list.");
+ throw new IllegalArgumentException("Must provide non-null, non-empty portlet id list.");
}
public static ImportedPortlet createImportedPortlet(String portletID, PortletContext portletContext)
@@ -1518,6 +1537,7 @@
public static ReleaseExport createReleaseExport(RegistrationContext registrationContext, byte[] exportContext, UserContext userContext)
{
+ //Can the exportContext be empty?
if (exportContext == null || exportContext.length == 0)
{
throw new IllegalArgumentException("Must provide a non null or empty exportContext to ReleaseExport.");
@@ -1533,6 +1553,7 @@
public static SetExportLifetime createSetExportLifetime(RegistrationContext registrationContext, byte[] exportContext, UserContext userContext, Lifetime lifetime)
{
+ //Can the exportContext be empty?
if (exportContext == null || exportContext.length == 0)
{
throw new IllegalArgumentException("Must provide a non null or empty exportContext to SetExportLifetime.");
@@ -1546,4 +1567,180 @@
return setExportLifetime;
}
+
+ public static Contact createContact(Postal postal, Telecom telecom, Online online)
+ {
+ Contact contact = new Contact();
+ contact.setPostal(postal);
+ contact.setTelecom(telecom);
+ contact.setOnline(online);
+
+ return contact;
+ }
+
+ public static Postal createPostal(String name, String street, String city, String stateprov, String postalCode, String country, String organization)
+ {
+ Postal postal = new Postal();
+ postal.setName(name);
+ postal.setStreet(street);
+ postal.setCity(city);
+ postal.setStateprov(stateprov);
+ postal.setPostalcode(postalCode);
+ postal.setCountry(country);
+ postal.setOrganization(organization);
+
+ return postal;
+ }
+
+ public static Telecom createTelecom(TelephoneNum telephone, TelephoneNum fax, TelephoneNum mobile, TelephoneNum pager)
+ {
+ Telecom telecom = new Telecom();
+ telecom.setTelephone(telephone);
+ telecom.setFax(fax);
+ telecom.setMobile(mobile);
+ telecom.setPager(pager);
+
+ return telecom;
+ }
+
+ public static TelephoneNum createTelephoneNum(String intCode, String loccode, String number, String ext, String comment)
+ {
+ TelephoneNum telephoneNum = new TelephoneNum();
+ telephoneNum.setIntcode(intCode);
+ telephoneNum.setLoccode(loccode);
+ telephoneNum.setNumber(number);
+ telephoneNum.setExt(ext);
+ telephoneNum.setComment(comment);
+
+ return telephoneNum;
+ }
+
+ public static Online createOnline(String email, String uri)
+ {
+ Online online = new Online();
+ online.setEmail(email);
+ online.setUri(uri);
+ return online;
+ }
+
+ public static EmployerInfo createEmployerInfo(String employer, String department, String jobTitle)
+ {
+ EmployerInfo employerInfo = new EmployerInfo();
+ employerInfo.setEmployer(employer);
+ employerInfo.setDepartment(department);
+ employerInfo.setJobtitle(jobTitle);
+
+ return employerInfo;
+ }
+
+ public static PersonName createPersonName(String prefix, String given, String family, String middle, String suffix, String nickname)
+ {
+ PersonName personName = new PersonName();
+ personName.setPrefix(prefix);
+ personName.setGiven(given);
+ personName.setFamily(family);
+ personName.setMiddle(middle);
+ personName.setSuffix(suffix);
+ personName.setNickname(nickname);
+
+ return personName;
+ }
+
+ public static Extension createExtension(Object any)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(any, "Any");
+ Extension extension = new Extension();
+ extension.setAny(any);
+
+ return extension;
+ }
+
+ public static MissingParametersFault createMissingParametersFault()
+ {
+ MissingParametersFault missingParametersFault = new MissingParametersFault();
+ return missingParametersFault;
+ }
+
+ public static OperationFailedFault createOperationFailedFault()
+ {
+ OperationFailedFault operationFailedFault = new OperationFailedFault();
+ return operationFailedFault;
+ }
+
+ public static ItemDescription createItemDescription(LocalizedString description, LocalizedString displayName, String itemName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(itemName, "ItemName");
+
+ ItemDescription itemDescription = new ItemDescription();
+ itemDescription.setDescription(description);
+ itemDescription.setDisplayName(displayName);
+ itemDescription.setItemName(itemName);
+
+ return itemDescription;
+ }
+
+ public static Resource createResource(String resourceName, List<ResourceValue> resourceValue)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(resourceName, "ResourceName");
+ Resource resource = new Resource();
+ resource.setResourceName(resourceName);
+
+ if (resourceValue != null && !resourceValue.isEmpty())
+ {
+ resource.getValues().addAll(resourceValue);
+ }
+
+ return resource;
+ }
+
+ public static ResourceList createResourceList(List<Resource> resources)
+ {
+ if (ParameterValidation.existsAndIsNotEmpty(resources))
+ {
+ ResourceList resourceList = new ResourceList();
+ resourceList.getResources().addAll(resources);
+
+ return resourceList;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Must provide non-null, non-empty resource list.");
+ }
+ }
+
+ public static ResourceValue createResourceValue(String lang, String value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(lang, "Lang");
+ ResourceValue resourceValue = new ResourceValue();
+ resourceValue.setLang(value);
+ resourceValue.setValue(value);
+
+ return resourceValue;
+ }
+
+ public static ReturnAny createReturnAny()
+ {
+ return new ReturnAny();
+ }
+
+ public static SessionParams createSessionParams(String sessionID)
+ {
+ SessionParams sessionParams = new SessionParams();
+ sessionParams.setSessionID(sessionID);
+
+ return sessionParams;
+ }
+
+ public static UserProfile createUserProfile(PersonName name, XMLGregorianCalendar bdate, String gender, EmployerInfo employerInfo, Contact homeInfo, Contact businessInfo)
+ {
+ UserProfile userProfile = new UserProfile();
+ userProfile.setName(name);
+ userProfile.setBdate(bdate);
+ userProfile.setGender(gender);
+ userProfile.setEmployerInfo(employerInfo);
+ userProfile.setHomeInfo(homeInfo);
+ userProfile.setBusinessInfo(businessInfo);
+
+ return userProfile;
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -142,6 +142,8 @@
import java.util.Collections;
import java.util.List;
+import javax.xml.datatype.XMLGregorianCalendar;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -271,13 +273,9 @@
{
if (v1RuntimeContext != null)
{
- RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(v1RuntimeContext.getUserAuthentication());
- runtimeContext.setNamespacePrefix(v1RuntimeContext.getNamespacePrefix());
- runtimeContext.setPortletInstanceKey(v1RuntimeContext.getPortletInstanceKey());
+ RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(v1RuntimeContext.getUserAuthentication(), v1RuntimeContext.getPortletInstanceKey(), v1RuntimeContext.getNamespacePrefix());
- //TODO: handle the SessionParams better
- SessionParams sessionParams = new SessionParams();
- sessionParams.setSessionID(v1RuntimeContext.getSessionID());
+ SessionParams sessionParams = WSRPTypeFactory.createSessionParams(v1RuntimeContext.getSessionID());
runtimeContext.setSessionParams(sessionParams);
runtimeContext.setTemplates(toV2Templates(v1RuntimeContext.getTemplates()));
@@ -300,15 +298,15 @@
{
if (v1Templates != null)
{
- //TODO: should we be using the WSRP1TypeFactory,createTemplates(PortletInvocationContext) instead?
- Templates templates = new Templates();
- templates.setBlockingActionTemplate(v1Templates.getBlockingActionTemplate());
- templates.setDefaultTemplate(v1Templates.getDefaultTemplate());
- templates.setRenderTemplate(v1Templates.getRenderTemplate());
- templates.setResourceTemplate(v1Templates.getResourceTemplate());
- templates.setSecureBlockingActionTemplate(v1Templates.getSecureBlockingActionTemplate());
- templates.setSecureRenderTemplate(v1Templates.getSecureRenderTemplate());
- templates.setSecureResourceTemplate(v1Templates.getSecureResourceTemplate());
+ String defaultTemplate = v1Templates.getDefaultTemplate();
+ String blockingActionTemplate = v1Templates.getBlockingActionTemplate();
+ String renderTemplate = v1Templates.getRenderTemplate();
+ String resourceTemplate = v1Templates.getResourceTemplate();
+ String secureDefaultTemplate = v1Templates.getSecureDefaultTemplate();
+ String secureBlockingActionTemplate = v1Templates.getSecureBlockingActionTemplate();
+ String secureRenderTemplate = v1Templates.getSecureRenderTemplate();
+ String secureResourceTemplate = v1Templates.getSecureResourceTemplate();
+ Templates templates = WSRPTypeFactory.createTemplates(defaultTemplate, blockingActionTemplate, renderTemplate, resourceTemplate, secureDefaultTemplate, secureBlockingActionTemplate, secureRenderTemplate, secureResourceTemplate);
List<V1Extension> extensions = v1Templates.getExtensions();
if (extensions != null)
@@ -354,13 +352,13 @@
{
if (v1UserProfile != null)
{
- UserProfile userProfile = new UserProfile();
- userProfile.setBdate(v1UserProfile.getBdate());
- userProfile.setBusinessInfo(toV2Context(v1UserProfile.getBusinessInfo()));
- userProfile.setEmployerInfo(toV2EmployerInfo(v1UserProfile.getEmployerInfo()));
- userProfile.setGender(v1UserProfile.getGender());
- userProfile.setHomeInfo(toV2Context(v1UserProfile.getHomeInfo()));
- userProfile.setName(toV2PersonName(v1UserProfile.getName()));
+ PersonName name = toV2PersonName(v1UserProfile.getName());
+ XMLGregorianCalendar bdate = v1UserProfile.getBdate();
+ String gender = v1UserProfile.getGender();
+ EmployerInfo employerInfo = toV2EmployerInfo(v1UserProfile.getEmployerInfo());
+ Contact homeInfo = toV2Context(v1UserProfile.getHomeInfo());
+ Contact businessInfo = toV2Context(v1UserProfile.getBusinessInfo());
+ UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, gender, employerInfo, homeInfo, businessInfo);
return userProfile;
}
@@ -374,10 +372,10 @@
{
if (v1EmployerInfo != null)
{
- EmployerInfo employerInfo = new EmployerInfo();
- employerInfo.setDepartment(v1EmployerInfo.getDepartment());
- employerInfo.setEmployer(v1EmployerInfo.getEmployer());
- employerInfo.setJobtitle(v1EmployerInfo.getJobtitle());
+ String employer = v1EmployerInfo.getEmployer();
+ String department = v1EmployerInfo.getEmployer();
+ String jobTitle = v1EmployerInfo.getJobtitle();
+ EmployerInfo employerInfo = WSRPTypeFactory.createEmployerInfo(employer, department, jobTitle);
List<V1Extension> extensions = v1EmployerInfo.getExtensions();
if (extensions != null)
@@ -397,14 +395,8 @@
{
if (v1PersonName != null)
{
- PersonName personName = new PersonName();
- personName.setFamily(v1PersonName.getFamily());
- personName.setGiven(v1PersonName.getGiven());
- personName.setMiddle(v1PersonName.getMiddle());
- personName.setNickname(v1PersonName.getNickname());
- personName.setPrefix(v1PersonName.getPrefix());
- personName.setSuffix(v1PersonName.getSuffix());
-
+ PersonName personName = WSRPTypeFactory.createPersonName(v1PersonName.getPrefix(), v1PersonName.getGiven(), v1PersonName.getFamily(), v1PersonName.getMiddle(), v1PersonName.getSuffix(), v1PersonName.getNickname());
+
List<V1Extension> extensions = v1PersonName.getExtensions();
if (extensions != null)
{
@@ -423,10 +415,10 @@
{
if (v1Contact != null)
{
- Contact contact = new Contact();
- contact.setOnline(toV2Online(v1Contact.getOnline()));
- contact.setPostal(toV2Postal(v1Contact.getPostal()));
- contact.setTelecom(toV2Telecom(v1Contact.getTelecom()));
+ Postal postal = toV2Postal(v1Contact.getPostal());
+ Telecom teleCom = toV2Telecom(v1Contact.getTelecom());
+ Online online = toV2Online(v1Contact.getOnline());
+ Contact contact = WSRPTypeFactory.createContact(postal, teleCom, online);
List<V1Extension> extensions = v1Contact.getExtensions();
if (extensions != null)
@@ -446,9 +438,7 @@
{
if (v1Online != null)
{
- Online online = new Online();
- online.setEmail(v1Online.getEmail());
- online.setUri(v1Online.getUri());
+ Online online = WSRPTypeFactory.createOnline(v1Online.getEmail(), v1Online.getUri());
List<V1Extension> extensions = v1Online.getExtensions();
if (extensions != null)
@@ -468,14 +458,7 @@
{
if (v1Postal != null)
{
- Postal postal = new Postal();
- postal.setCity(v1Postal.getCity());
- postal.setCountry(v1Postal.getCountry());
- postal.setName(v1Postal.getName());
- postal.setOrganization(v1Postal.getOrganization());
- postal.setPostalcode(v1Postal.getPostalcode());
- postal.setStateprov(v1Postal.getStateprov());
- postal.setStreet(v1Postal.getStreet());
+ Postal postal = WSRPTypeFactory.createPostal(v1Postal.getName(), v1Postal.getStreet(), v1Postal.getCity(), v1Postal.getStateprov(), v1Postal.getPostalcode(), v1Postal.getCountry(), v1Postal.getOrganization());
List<V1Extension> extensions = v1Postal.getExtensions();
if (extensions != null)
@@ -495,11 +478,11 @@
{
if (v1Telecom != null)
{
- Telecom telecom = new Telecom();
- telecom.setFax(toV2TelephoneNum(v1Telecom.getFax()));
- telecom.setMobile(toV2TelephoneNum(v1Telecom.getMobile()));
- telecom.setPager(toV2TelephoneNum(v1Telecom.getPager()));
- telecom.setTelephone(toV2TelephoneNum(v1Telecom.getTelephone()));
+ TelephoneNum telephone = toV2TelephoneNum(v1Telecom.getTelephone());
+ TelephoneNum fax = toV2TelephoneNum(v1Telecom.getFax());
+ TelephoneNum mobile = toV2TelephoneNum(v1Telecom.getMobile());
+ TelephoneNum pager = toV2TelephoneNum(v1Telecom.getPager());
+ Telecom telecom = WSRPTypeFactory.createTelecom(telephone, fax, mobile, pager);
List<V1Extension> extensions = v1Telecom.getExtensions();
if (extensions != null)
@@ -519,12 +502,12 @@
{
if (v1TelephoneNum != null)
{
- TelephoneNum telephoneNum = new TelephoneNum();
- telephoneNum.setComment(v1TelephoneNum.getComment());
- telephoneNum.setExt(v1TelephoneNum.getExt());
- telephoneNum.setIntcode(v1TelephoneNum.getIntcode());
- telephoneNum.setLoccode(v1TelephoneNum.getLoccode());
- telephoneNum.setNumber(v1TelephoneNum.getNumber());
+ String intCode = v1TelephoneNum.getIntcode();
+ String loccode = v1TelephoneNum.getLoccode();
+ String number = v1TelephoneNum.getNumber();
+ String ext = v1TelephoneNum.getExt();
+ String comment = v1TelephoneNum.getComment();
+ TelephoneNum telephoneNum = WSRPTypeFactory.createTelephoneNum(intCode, loccode, number, ext, comment);
List<V1Extension> extensions = v1TelephoneNum.getExtensions();
if (extensions != null)
@@ -651,18 +634,14 @@
{
if (v1ResourceList != null)
{
- ResourceList result = new ResourceList();
+ List<Resource> resources = WSRPUtils.transform(v1ResourceList.getResources(), RESOURCE);
+ ResourceList result = WSRPTypeFactory.createResourceList(resources);
List<Extension> extensions = WSRPUtils.transform(v1ResourceList.getExtensions(), EXTENSION);
if (extensions != null)
{
result.getExtensions().addAll(extensions);
}
- List<Resource> resources = WSRPUtils.transform(v1ResourceList.getResources(), RESOURCE);
- if (resources != null)
- {
- result.getResources().addAll(resources);
- }
return result;
}
@@ -732,8 +711,7 @@
{
if (registrationData != null)
{
- RegistrationData result = WSRPTypeFactory.createRegistrationData(registrationData.getConsumerName(), registrationData.isMethodGetSupported());
- result.setConsumerAgent(registrationData.getConsumerAgent());
+ RegistrationData result = WSRPTypeFactory.createRegistrationData(registrationData.getConsumerName(), registrationData.getConsumerAgent(), registrationData.isMethodGetSupported());
List<Property> properties = WSRPUtils.transform(registrationData.getRegistrationProperties(), PROPERTY);
if (properties != null)
@@ -1076,8 +1054,7 @@
{
if (from != null)
{
- Extension extension = new Extension();
- extension.setAny(from.getAny());
+ Extension extension = WSRPTypeFactory.createExtension(from.getAny());
return extension;
}
else
@@ -1145,9 +1122,8 @@
{
if (from != null)
{
- ItemDescription result = new ItemDescription();
- result.setItemName(from.getItemName());
- result.setDescription(LOCALIZEDSTRING.apply(from.getDescription()));
+ LocalizedString description = LOCALIZEDSTRING.apply(from.getDescription());
+ ItemDescription result = WSRPTypeFactory.createItemDescription(description, null, from.getItemName());
List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
if (extensions != null)
{
@@ -1244,14 +1220,7 @@
{
if (from != null)
{
- Resource result = new Resource();
- result.setResourceName(from.getResourceName());
- List<ResourceValue> values = WSRPUtils.transform(from.getValues(), RESOURCEVALUE);
- if (values != null)
- {
- result.getValues().addAll(values);
- }
-
+ Resource result = WSRPTypeFactory.createResource(from.getResourceName(), WSRPUtils.transform(from.getValues(), RESOURCEVALUE));
return result;
}
else
@@ -1268,9 +1237,8 @@
{
if (from != null)
{
- ResourceValue result = new ResourceValue();
- result.setLang(from.getLang());
- result.setValue(from.getValue());
+ ResourceValue result = WSRPTypeFactory.createResourceValue(from.getLang(), from.getValue());
+
List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
if (extensions != null)
{
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -243,7 +243,7 @@
{
if (runtimeContext != null)
{
- V1RuntimeContext v1RuntimeContext = WSRP1TypeFactory.createRuntimeContext(runtimeContext.getUserAuthentication());
+ V1RuntimeContext v1RuntimeContext = WSRP1TypeFactory.createRuntimeContext(runtimeContext.getUserAuthentication(), runtimeContext.getPortletInstanceKey(), runtimeContext.getNamespacePrefix());
v1RuntimeContext.setNamespacePrefix(runtimeContext.getNamespacePrefix());
v1RuntimeContext.setPortletInstanceKey(runtimeContext.getPortletInstanceKey());
SessionParams sessionParams = runtimeContext.getSessionParams();
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -120,17 +120,6 @@
}
/**
- * Same as createMarkupRequest(handle, createDefaultRuntimeContext(), createDefaultMarkupParams())
- *
- * @param handle
- * @return
- */
- public static V1GetMarkup createDefaultMarkupRequest(String handle)
- {
- return createMarkupRequest(createPortletContext(handle), createDefaultRuntimeContext(), createDefaultMarkupParams());
- }
-
- /**
* registrationContext(RegistrationContext)?, portletContext(PortletContext), runtimeContext(RuntimeContext),
* userContext(UserContext)?, markupParams(MarkupParams)
*
@@ -154,19 +143,6 @@
}
/**
- * Same as createPerformBlockingInteraction(portletHandle, {@link #createDefaultRuntimeContext}(), {@link
- * #createDefaultMarkupParams}(), {@link #createDefaultInteractionParams}());
- *
- * @param portletHandle
- * @return
- */
- public static V1PerformBlockingInteraction createDefaultPerformBlockingInteraction(String portletHandle)
- {
- return createPerformBlockingInteraction(createPortletContext(portletHandle), createDefaultRuntimeContext(), createDefaultMarkupParams(),
- createDefaultInteractionParams());
- }
-
- /**
* {@link V1RegistrationContext}?, {@link V1PortletContext}, {@link V1RuntimeContext}, {@link V1UserContext}?, {@link
* V1MarkupParams}, {@link V1InteractionParams}
*
@@ -403,27 +379,19 @@
}
/**
- * Same as createRuntimeContext({@link WSRPConstants#NONE_USER_AUTHENTICATION})
- *
- * @return
- */
- public static V1RuntimeContext createDefaultRuntimeContext()
- {
- return createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION);
- }
-
- /**
* userAuthentication(xsd:string), portletInstanceKey(xsd:string)?, namespacePrefix(xsd:string)?,
* templates(Templates)?, sessionID(xsd:string)?, extensions(Extension)*
*
* @return
*/
- public static V1RuntimeContext createRuntimeContext(String userAuthentication)
+ public static V1RuntimeContext createRuntimeContext(String userAuthentication, String portletInstanceKey, String namespacePrefix)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAuthentication, "user authentication", "RuntimeContext");
V1RuntimeContext runtimeContext = new V1RuntimeContext();
runtimeContext.setUserAuthentication(userAuthentication);
+ runtimeContext.setPortletInstanceKey(portletInstanceKey);
+ runtimeContext.setNamespacePrefix(namespacePrefix);
return runtimeContext;
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -24,6 +24,7 @@
package org.gatein.wsrp.spec.v2;
import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.ExportByValueNotSupported;
import org.oasis.wsrp.v2.ExportNoLongerValid;
@@ -103,7 +104,7 @@
{
if (valueToCheck == null)
{
- throw new MissingParameters("Missing required " + valueName + (context != null ? " in " + context : ""), new MissingParametersFault());
+ throw new MissingParameters("Missing required " + valueName + (context != null ? " in " + context : ""), WSRPTypeFactory.createMissingParametersFault());
}
}
@@ -111,7 +112,7 @@
{
if (valueToCheck == null)
{
- throw new OperationFailed("Missing required " + valueName, new OperationFailedFault());
+ throw new OperationFailed("Missing required " + valueName, WSRPTypeFactory.createOperationFailedFault());
}
}
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2ToV1ConverterTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2ToV1ConverterTestCase.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2ToV1ConverterTestCase.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -24,6 +24,8 @@
package org.gatein.wsrp.spec.v1;
import junit.framework.TestCase;
+
+import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v1.V1InvalidSession;
import org.oasis.wsrp.v1.V1OperationFailed;
import org.oasis.wsrp.v2.OperationFailed;
@@ -38,7 +40,7 @@
public void testException() throws Exception
{
Throwable throwable = new Throwable();
- OperationFailed operationFailed = new OperationFailed("foo", new OperationFailedFault(), throwable);
+ OperationFailed operationFailed = new OperationFailed("foo", WSRPTypeFactory.createOperationFailedFault(), throwable);
V1OperationFailed v1OperationFailed = V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
assertNotNull(v1OperationFailed);
assertEquals("foo", v1OperationFailed.getMessage());
@@ -48,7 +50,7 @@
public void testExceptionMismatch()
{
Throwable throwable = new Throwable();
- OperationFailed operationFailed = new OperationFailed("foo", new OperationFailedFault(), throwable);
+ OperationFailed operationFailed = new OperationFailed("foo", WSRPTypeFactory.createOperationFailedFault(), throwable);
try
{
@@ -64,7 +66,7 @@
public void testExceptionWrongRequestedException()
{
Throwable throwable = new Throwable();
- OperationFailed operationFailed = new OperationFailed("foo", new OperationFailedFault(), throwable);
+ OperationFailed operationFailed = new OperationFailed("foo", WSRPTypeFactory.createOperationFailedFault(), throwable);
try
{
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -334,7 +334,16 @@
SecurityContext securityContext = invocation.getSecurityContext();
ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
- runtimeContext = WSRPTypeFactory.createRuntimeContext(authType);
+
+ String portletInstanceKey = invocation.getInstanceContext().getId();
+ String namespacePrefix = getNamespaceFrom(invocation.getWindowContext());
+
+ if (namespacePrefix == null)
+ {
+ namespacePrefix = getPortletHandle();
+ }
+
+ runtimeContext = WSRPTypeFactory.createRuntimeContext(authType, portletInstanceKey, namespacePrefix);
// user context
userContext = wsrpConsumer.getUserContextFrom(invocation, runtimeContext);
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -116,8 +116,8 @@
consumer.getMarkupService().getMarkup(request.getRegistrationContext(), request.getPortletContext(),
request.getRuntimeContext(), request.getUserContext(), request.getMarkupParams(),
markupContextHolder, sessionContextHolder, new Holder<List<Extension>>());
- MarkupResponse markupResponse = new MarkupResponse();
- markupResponse.setMarkupContext(markupContextHolder.value);
+
+ MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContextHolder.value);
markupResponse.setSessionContext(sessionContextHolder.value);
return markupResponse;
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -28,6 +28,7 @@
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.api.SessionEvent;
import org.gatein.wsrp.api.SessionEventListener;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
@@ -204,10 +205,13 @@
SessionParams sessionParams = runtimeContext.getSessionParams();
if (sessionParams == null)
{
- sessionParams = new SessionParams();
+ sessionParams = WSRPTypeFactory.createSessionParams(sessionId);
runtimeContext.setSessionParams(sessionParams);
}
- sessionParams.setSessionID(sessionId);
+ else
+ {
+ sessionParams.setSessionID(sessionId);
+ }
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -169,12 +169,7 @@
@WebParam(name = "sessionContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<SessionContext> sessionContext,
@WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
- GetMarkup gm = new GetMarkup();
- gm.setMarkupParams(markupParams);
- gm.setPortletContext(portletContext);
- gm.setRegistrationContext(registrationContext);
- gm.setRuntimeContext(runtimeContext);
- gm.setUserContext(userContext);
+ GetMarkup gm = WSRPTypeFactory.createGetMarkup(registrationContext, portletContext, runtimeContext, userContext, markupParams);
NavigationalContext navigationalContext = markupParams.getNavigationalContext();
String markupString = getMarkupString(WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()),
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -23,6 +23,9 @@
package org.gatein.wsrp.test.protocol.v2;
+import java.util.ArrayList;
+import java.util.List;
+
import org.gatein.common.net.media.MediaType;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
@@ -61,14 +64,21 @@
}
public PortletDescription createPortletDescription(String portletHandle, String suffix)
- {
- PortletDescription portletDesc = new PortletDescription();
- portletDesc.setPortletHandle(portletHandle);
- MarkupType markupType = new MarkupType();
- markupType.setMimeType(MediaType.TEXT_HTML.getValue());
- markupType.getModes().add(WSRPConstants.VIEW_MODE);
- markupType.getWindowStates().add(WSRPConstants.NORMAL_WINDOW_STATE);
- markupType.getLocales().addAll(WSRPConstants.getDefaultLocales());
+ {
+ String mimeType = MediaType.TEXT_HTML.getValue();
+ List<String> modes = new ArrayList<String>();
+ modes.add(WSRPConstants.VIEW_MODE);
+
+ List<String> windowStates = new ArrayList<String>();
+ windowStates.add(WSRPConstants.NORMAL_WINDOW_STATE);
+
+ MarkupType markupType = WSRPTypeFactory.createMarkupType(mimeType,modes, windowStates, WSRPConstants.getDefaultLocales());
+
+ List<MarkupType> markupTypes = new ArrayList<MarkupType>();
+ markupTypes.add(markupType);
+
+ PortletDescription portletDesc = WSRPTypeFactory.createPortletDescription(portletHandle, markupTypes);
+
portletDesc.getMarkupTypes().add(markupType);
String suffixString = suffix == null ? "" : suffix;
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -622,7 +622,7 @@
}
catch (Exception e)
{
- throw new OperationFailed("Operation Failed while trying to ExportPortlets.", new OperationFailedFault());
+ throw new OperationFailed("Operation Failed while trying to ExportPortlets.", WSRPTypeFactory.createOperationFailedFault());
}
finally
{
@@ -759,7 +759,7 @@
}
//this method shouldn't return anything
- return new ReturnAny().getExtensions();
+ return WSRPTypeFactory.createReturnAny().getExtensions();
}
public Lifetime setExportLifetime(SetExportLifetime setExportLifetime) throws OperationFailed, InvalidRegistration, OperationNotSupported
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/RegistrationEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/RegistrationEndpoint.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/RegistrationEndpoint.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -86,8 +86,8 @@
{
try
{
- RegistrationData registrationData = WSRPTypeFactory.createRegistrationData(consumerName, methodGetSupported);
- registrationData.setConsumerAgent(consumerAgent);
+ RegistrationData registrationData = WSRPTypeFactory.createRegistrationData(consumerName, consumerAgent, methodGetSupported);
+
if (ParameterValidation.existsAndIsNotEmpty(consumerModes))
{
registrationData.getConsumerModes().addAll(consumerModes);
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -125,9 +125,7 @@
{
forceSessionAccess();
- ReleaseSessions releaseSessions = new ReleaseSessions();
- releaseSessions.setRegistrationContext(registrationContext);
- releaseSessions.getSessionIDs().addAll(sessionIDs);
+ ReleaseSessions releaseSessions = WSRPTypeFactory.createReleaseSessions(registrationContext, sessionIDs);
return producer.releaseSessions(releaseSessions);
}
@@ -139,8 +137,7 @@
{
forceSessionAccess();
- InitCookie initCookie = new InitCookie();
- initCookie.setRegistrationContext(registrationContext);
+ InitCookie initCookie = WSRPTypeFactory.createInitCookie(registrationContext);
return producer.initCookie(initCookie);
}
@@ -149,12 +146,7 @@
{
forceSessionAccess();
- GetMarkup getMarkup = new GetMarkup();
- getMarkup.setRegistrationContext(registrationContext);
- getMarkup.setPortletContext(portletContext);
- getMarkup.setRuntimeContext(runtimeContext);
- getMarkup.setUserContext(userContext);
- getMarkup.setMarkupParams(markupParams);
+ GetMarkup getMarkup = WSRPTypeFactory.createGetMarkup(registrationContext, portletContext, runtimeContext, userContext, markupParams);
MarkupResponse response = producer.getMarkup(getMarkup);
@@ -177,12 +169,7 @@
ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
forceSessionAccess();
- GetResource getResource = new GetResource();
- getResource.setPortletContext(portletContext.value);
- getResource.setRegistrationContext(registrationContext);
- getResource.setResourceParams(resourceParams);
- getResource.setRuntimeContext(runtimeContext);
- getResource.setUserContext(userContext);
+ GetResource getResource = WSRPTypeFactory.createGetResource(registrationContext, portletContext.value, runtimeContext, userContext, resourceParams);
ResourceResponse response = producer.getResource(getResource);
@@ -196,13 +183,7 @@
{
forceSessionAccess();
- PerformBlockingInteraction performBlockingInteraction = new PerformBlockingInteraction();
- performBlockingInteraction.setPortletContext(portletContext);
- performBlockingInteraction.setRuntimeContext(runtimeContext);
- performBlockingInteraction.setMarkupParams(markupParams);
- performBlockingInteraction.setInteractionParams(interactionParams);
- performBlockingInteraction.setRegistrationContext(registrationContext);
- performBlockingInteraction.setUserContext(userContext);
+ PerformBlockingInteraction performBlockingInteraction = WSRPTypeFactory.createPerformBlockingInteraction(registrationContext, portletContext, runtimeContext, userContext, markupParams, interactionParams);
BlockingInteractionResponse interactionResponse = producer.performBlockingInteraction(performBlockingInteraction);
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/PortletManagementEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/PortletManagementEndpoint.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/PortletManagementEndpoint.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -106,11 +106,7 @@
throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- GetPortletPropertyDescription getPortletPropertyDescription = new GetPortletPropertyDescription();
- getPortletPropertyDescription.setRegistrationContext(registrationContext);
- getPortletPropertyDescription.setPortletContext(portletContext);
- getPortletPropertyDescription.setUserContext(userContext);
- getPortletPropertyDescription.getDesiredLocales().addAll(desiredLocales);
+ GetPortletPropertyDescription getPortletPropertyDescription = WSRPTypeFactory.createGetPortletPropertyDescription(registrationContext, portletContext, userContext, desiredLocales);
PortletPropertyDescriptionResponse descriptionResponse = producer.getPortletPropertyDescription(getPortletPropertyDescription);
@@ -130,10 +126,7 @@
throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- GetPortletDescription getPortletDescription = new GetPortletDescription();
- getPortletDescription.setRegistrationContext(registrationContext);
- getPortletDescription.setPortletContext(portletContext);
- getPortletDescription.setUserContext(userContext);
+ GetPortletDescription getPortletDescription = WSRPTypeFactory.createGetPortletDescription(registrationContext, portletContext, userContext);
getPortletDescription.getDesiredLocales().addAll(desiredLocales);
PortletDescriptionResponse description = producer.getPortletDescription(getPortletDescription);
@@ -155,10 +148,7 @@
throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- ClonePortlet clonePortlet = new ClonePortlet();
- clonePortlet.setRegistrationContext(registrationContext);
- clonePortlet.setPortletContext(portletContext);
- clonePortlet.setUserContext(userContext);
+ ClonePortlet clonePortlet = WSRPTypeFactory.createClonePortlet(registrationContext, portletContext, userContext);
PortletContext response = producer.clonePortlet(clonePortlet);
@@ -175,9 +165,7 @@
@WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions)
throws InconsistentParameters, InvalidRegistration, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- DestroyPortlets destroyPortlets = new DestroyPortlets();
- destroyPortlets.setRegistrationContext(registrationContext);
- destroyPortlets.getPortletHandles().addAll(portletHandles);
+ DestroyPortlets destroyPortlets = WSRPTypeFactory.createDestroyPortlets(registrationContext, portletHandles);
DestroyPortletsResponse destroyPortletsResponse = producer.destroyPortlets(destroyPortlets);
@@ -307,11 +295,8 @@
@WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions)
throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- SetPortletProperties setPortletProperties = new SetPortletProperties();
- setPortletProperties.setRegistrationContext(registrationContext);
- setPortletProperties.setPortletContext(portletContext);
+ SetPortletProperties setPortletProperties = WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext, propertyList);
setPortletProperties.setUserContext(userContext);
- setPortletProperties.setPropertyList(propertyList);
PortletContext response = producer.setPortletProperties(setPortletProperties);
@@ -322,11 +307,7 @@
public void getPortletProperties(@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext, @WebParam(name = "portletContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext, @WebParam(name = "userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name = "names", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") List<String> names, @WebParam(name = "properties", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Property>> properties, @WebParam(name = "resetProperties", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<ResetProperty>> resetProperties, @WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied, Inconsisten!
tParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- GetPortletProperties getPortletProperties = new GetPortletProperties();
- getPortletProperties.setRegistrationContext(registrationContext);
- getPortletProperties.setPortletContext(portletContext);
- getPortletProperties.setUserContext(userContext);
- getPortletProperties.getNames().addAll(names);
+ GetPortletProperties getPortletProperties = WSRPTypeFactory.createGetPortletProperties(registrationContext, portletContext, userContext, names);
PropertyList result = producer.getPortletProperties(getPortletProperties);
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/RegistrationEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/RegistrationEndpoint.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/RegistrationEndpoint.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -23,6 +23,7 @@
package org.gatein.wsrp.endpoints.v2;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.Extension;
@@ -99,9 +100,7 @@
@WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions)
throws InvalidRegistration, MissingParameters, OperationFailed, OperationNotSupported, ResourceSuspended
{
- ModifyRegistration modifyRegistration = new ModifyRegistration();
- modifyRegistration.setRegistrationContext(registrationContext);
- modifyRegistration.setRegistrationData(registrationData);
+ ModifyRegistration modifyRegistration = WSRPTypeFactory.createModifyRegistration(registrationContext, registrationData);
RegistrationState result = producer.modifyRegistration(modifyRegistration);
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -208,7 +208,7 @@
// let's see now if we can increment the counter
V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
producer.performBlockingInteraction(performBlockingInteraction);
@@ -279,7 +279,7 @@
public void testPerformBlockingInteractionRedirect() throws Exception
{
V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ createDefaultPerformBlockingInteraction(getDefaultHandle());
V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
// crappy way but this is a test! ;)
@@ -318,7 +318,7 @@
public void testPBIWithSessionID() throws Exception
{
String portletHandle = getDefaultHandle();
- V1PerformBlockingInteraction performBlockingInteraction = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
+ V1PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction(portletHandle);
V1RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
//the sessionID should never be set by the consumer. Sessions are handled by cookies instead
@@ -560,7 +560,7 @@
try
{
V1PerformBlockingInteraction action =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
List<V1NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
V1BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
@@ -579,13 +579,21 @@
checkMarkupResponse(response, "multi: value1, value2");
formParameters.clear();
- formParameters.add(new V1NamedString());
+ //TODO: use the WSRP1TypeFactory to create the named string
+ formParameters.add(createNamedString("foo", null));
actionResponse = producer.performBlockingInteraction(action);
markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
response = producer.getMarkup(markupRequest);
checkMarkupResponse(response, "multi: ");
}
+ catch (Exception e)
+ {
+ //Print error to the server logs since arquillian can't handle non serialzable errors
+ System.out.println("Failure in TestGetMarkupMultiValuedFromParams");
+ e.printStackTrace();
+ throw new Exception(e);
+ }
finally
{
undeploy(multiValuedPortletArchive);
@@ -608,7 +616,7 @@
ExtendedAssert.assertEquals("initial", markupString);
// modify the preference value
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
pbi.getInteractionParams().setPortletStateChange(V1StateChange.CLONE_BEFORE_WRITE); // request cloning if needed
String value = "new value";
pbi.getInteractionParams().getFormParameters().add(createNamedString("value", value));
@@ -710,7 +718,7 @@
try
{
// set appVar to value in the application scope by the first portlet
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
+ V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar", "value"));
producer.performBlockingInteraction(pbi);
@@ -751,7 +759,7 @@
{
configureRegistrationSettings(true, false);
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
try
{
producer.performBlockingInteraction(pbi);
@@ -791,7 +799,7 @@
private String checkPBIAndGetNavigationalState(String symbol) throws Exception
{
V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ createDefaultPerformBlockingInteraction(getDefaultHandle());
V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.getFormParameters().add(createNamedString("symbol", symbol));
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -206,7 +206,7 @@
*/
protected V1GetMarkup createMarkupRequest(String handle) throws RemoteException, V1InvalidRegistration, V1OperationFailed
{
- V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest(handle);
+ V1GetMarkup getMarkup = createDefaultMarkupRequest(handle);
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
return getMarkup;
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -188,7 +188,7 @@
producer.deregister(rc);
// try to get markup, portlet handle doesn't matter since it should fail before trying to retrieve the portlet
- V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+ V1GetMarkup getMarkup = createDefaultMarkupRequest("foo");
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
try
@@ -236,7 +236,7 @@
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().addRegistrationProperty(regProp);
// try to get markup, portlet handle doesn't matter since it should fail before trying to retrieve the portlet
- V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+ V1GetMarkup getMarkup = createDefaultMarkupRequest("foo");
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
getMarkup.setRegistrationContext(rc);
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -36,15 +36,19 @@
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
import org.gatein.wsrp.test.ExtendedAssert;
+import org.oasis.wsrp.v1.V1GetMarkup;
import org.oasis.wsrp.v1.V1GetServiceDescription;
import org.oasis.wsrp.v1.V1LocalizedString;
import org.oasis.wsrp.v1.V1MarkupType;
import org.oasis.wsrp.v1.V1MissingParameters;
import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
+import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1PropertyDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1ServiceDescription;
import javax.xml.namespace.QName;
@@ -265,4 +269,23 @@
// ExtendedAssert.assertTrue(cause instanceof SOAPFaultException);
// ExtendedAssert.assertEquals(errorCode, ((SOAPFaultException)cause).getFault().getLocalPart());
}
+
+
+ protected V1GetMarkup createDefaultMarkupRequest(String handle)
+ {
+ V1PortletContext portletContext = WSRP1TypeFactory.createPortletContext(handle);
+ return WSRP1TypeFactory.createMarkupRequest(portletContext, createDefaultRuntimeContext(), WSRP1TypeFactory.createDefaultMarkupParams());
+ }
+
+ protected V1PerformBlockingInteraction createDefaultPerformBlockingInteraction(String handle)
+ {
+ V1PortletContext portletContext = WSRP1TypeFactory.createPortletContext(handle);
+ return WSRP1TypeFactory.createPerformBlockingInteraction(portletContext, createDefaultRuntimeContext(), WSRP1TypeFactory.createDefaultMarkupParams(),
+ WSRP1TypeFactory.createDefaultInteractionParams());
+ }
+
+ protected V1RuntimeContext createDefaultRuntimeContext()
+ {
+ return WSRP1TypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "bar");
+ }
}
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -152,8 +152,7 @@
{
// The consumer should never have access to or be able to set a sessionID. Sessions are handled by the Producer using cookies.
GetMarkup getMarkup = createMarkupRequest();
- SessionParams sessionParams = new SessionParams();
- sessionParams.setSessionID("Hello World");
+ SessionParams sessionParams = WSRPTypeFactory.createSessionParams("Hello World");
getMarkup.getRuntimeContext().setSessionParams(sessionParams);
try
@@ -204,8 +203,7 @@
WSRPRenderURL julienRender = (WSRPRenderURL)julienURL;
// We're now trying to get a hello for Julien ;)
- NavigationalContext navigationalContext = new NavigationalContext();
- navigationalContext.setOpaqueValue(julienRender.getNavigationalState().getStringValue());
+ NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContext(julienRender.getNavigationalState().getStringValue(), null);
gm.getMarkupParams().setNavigationalContext(navigationalContext);
res = producer.getMarkup(gm);
markupString = res.getMarkupContext().getItemString();
@@ -217,8 +215,7 @@
WSRPActionURL incrementAction = (WSRPActionURL)incrementURL;
// let's see now if we can increment the counter
- PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
producer.performBlockingInteraction(performBlockingInteraction);
@@ -288,14 +285,11 @@
@Test
public void testPerformBlockingInteractionRedirect() throws Exception
{
- PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
// crappy way but this is a test! ;)
- NamedString namedString = new NamedString();
- namedString.setName("symbol");
- namedString.setValue("HELP");
+ NamedString namedString = WSRPTypeFactory.createNamedString("symbol", "HELP");
interactionParams.getFormParameters().add(namedString);
BlockingInteractionResponse response = producer.performBlockingInteraction(performBlockingInteraction);
@@ -329,12 +323,11 @@
public void testPBIWithSessionID() throws Exception
{
String portletHandle = getDefaultHandle();
- PerformBlockingInteraction performBlockingInteraction = WSRPTypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
+ PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction(portletHandle);
RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
//the sessionID should never be set by the consumer. Sessions are handled by cookies instead
- SessionParams sessionParams = new SessionParams();
- sessionParams.setSessionID("Hello World");
+ SessionParams sessionParams = WSRPTypeFactory.createSessionParams("Hello World");
runtimeContext.setSessionParams(sessionParams);
try
@@ -572,8 +565,7 @@
NamedString namedString = createNamedString("multi", "value1");
try
{
- PerformBlockingInteraction action =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ PerformBlockingInteraction action = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
@@ -592,7 +584,7 @@
checkMarkupResponse(response, "multi: value1, value2");
formParameters.clear();
- formParameters.add(new NamedString());
+ formParameters.add(WSRPTypeFactory.createNamedString("test", null));
actionResponse = producer.performBlockingInteraction(action);
markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalContext(actionResponse.getUpdateResponse().getNavigationalContext());
@@ -621,7 +613,7 @@
ExtendedAssert.assertEquals("initial", markupString);
// modify the preference value
- PerformBlockingInteraction pbi = WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
pbi.getInteractionParams().setPortletStateChange(StateChange.CLONE_BEFORE_WRITE); // request cloning if needed
String value = "new value";
pbi.getInteractionParams().getFormParameters().add(createNamedString("value", value));
@@ -651,9 +643,7 @@
private NamedString createNamedString(String name, String value)
{
- NamedString namedString = new NamedString();
- namedString.setName(name);
- namedString.setValue(value);
+ NamedString namedString = WSRPTypeFactory.createNamedString(name, value);
return namedString;
}
@@ -723,7 +713,7 @@
try
{
// set appVar to value in the application scope by the first portlet
- PerformBlockingInteraction pbi = WSRPTypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
+ PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar", "value"));
producer.performBlockingInteraction(pbi);
@@ -821,7 +811,7 @@
consumerHandle = portletHandle;
}
}
- PerformBlockingInteraction action = WSRPTypeFactory.createDefaultPerformBlockingInteraction(generatorHandle);
+ PerformBlockingInteraction action = createDefaultPerformBlockingInteraction(generatorHandle);
List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
@@ -837,8 +827,8 @@
// send event
HandleEvents handleEvents = WSRPTypeFactory.createHandleEvents(null,
- WSRPTypeFactory.createPortletContext(consumerHandle), WSRPTypeFactory.createDefaultRuntimeContext(), null,
- WSRPTypeFactory.createDefaultMarkupParams(), WSRPTypeFactory.createEventParams(events, StateChange.READ_ONLY));
+ WSRPTypeFactory.createPortletContext(consumerHandle), createDefaultRuntimeContext(consumerHandle), null,
+ createDefaultMarkupParams(), WSRPTypeFactory.createEventParams(events, StateChange.READ_ONLY));
HandleEventsResponse handleEventsResponse = producer.handleEvents(handleEvents);
// no failed events
@@ -880,7 +870,7 @@
consumerHandle = portletHandle;
}
}
- PerformBlockingInteraction action = WSRPTypeFactory.createDefaultPerformBlockingInteraction(generatorHandle);
+ PerformBlockingInteraction action = createDefaultPerformBlockingInteraction(generatorHandle);
List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
@@ -971,7 +961,7 @@
{
configureRegistrationSettings(true, false);
- PerformBlockingInteraction pbi = WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
try
{
producer.performBlockingInteraction(pbi);
@@ -1010,8 +1000,7 @@
private String checkPBIAndGetNavigationalState(String symbol) throws Exception
{
- PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.getFormParameters().add(createNamedString("symbol", symbol));
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -26,11 +26,17 @@
import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.GetServiceDescription;
+import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.MarkupParams;
import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PerformBlockingInteraction;
+import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
+import org.oasis.wsrp.v2.StateChange;
import java.rmi.RemoteException;
import java.util.ArrayList;
@@ -202,12 +208,45 @@
*/
protected GetMarkup createMarkupRequest(String handle) throws RemoteException, InvalidRegistration, OperationFailed
{
- GetMarkup getMarkup = WSRPTypeFactory.createDefaultGetMarkup(handle);
+ GetMarkup getMarkup = createDefaultGetMarkup(handle);
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
return getMarkup;
}
+
+ protected GetMarkup createDefaultGetMarkup(String handle)
+ {
+ PortletContext portletContext = WSRPTypeFactory.createPortletContext(handle);
+ RuntimeContext runtimeContext = createDefaultRuntimeContext(handle);
+ MarkupParams runtimeParams = createDefaultMarkupParams();
+ return WSRPTypeFactory.createGetMarkup(null, portletContext, runtimeContext, null, createDefaultMarkupParams());
+ }
+
+ protected PerformBlockingInteraction createDefaultPerformBlockingInteraction(String handle)
+ {
+ PortletContext portletContext = WSRPTypeFactory.createPortletContext(handle);
+ return WSRPTypeFactory.createPerformBlockingInteraction(null, portletContext, createDefaultRuntimeContext(handle), null, createDefaultMarkupParams(),
+ createDefaultInteractionParams());
+ }
+
+ protected InteractionParams createDefaultInteractionParams()
+ {
+ return WSRPTypeFactory.createInteractionParams(StateChange.READ_ONLY);
+ }
+
+ protected RuntimeContext createDefaultRuntimeContext(String handle)
+ {
+ String portletInstanceKey = "foo";
+ String namespacePrefix = handle;
+ return WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, portletInstanceKey, namespacePrefix);
+ }
+ protected MarkupParams createDefaultMarkupParams()
+ {
+ return WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), WSRPConstants.getDefaultMimeTypes(),
+ WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE);
+ }
+
protected String getPortletHandleFrom(String partialHandle)
{
List<String> handles = getHandlesForCurrentlyDeployedArchive();
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2010-09-03 12:31:59 UTC (rev 4041)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2010-09-03 21:19:40 UTC (rev 4042)
@@ -203,21 +203,31 @@
@Test
public void testExportRegistrationRequired() throws Exception
{
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+ try
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
- RegistrationData registrationData = WSRPTypeFactory.createRegistrationData("CONSUMER", true);
- RegistrationContext registrationContext = producer.register(registrationData);
+ RegistrationData registrationData = WSRPTypeFactory.createRegistrationData("CONSUMER", "CONSUMERAGENT.0.0", true);
+ RegistrationContext registrationContext = producer.register(registrationData);
- List<PortletContext> portletContexts = createPortletContextList(getDefaultHandle());
+ List<PortletContext> portletContexts = createPortletContextList(getDefaultHandle());
- boolean exportByValueRequired = true;
- Lifetime lifetime = null;
- UserContext userContext = null;
- ExportPortlets exportPortlets = WSRPTypeFactory.createExportPortlets(registrationContext, portletContexts, userContext, lifetime, exportByValueRequired);
+ boolean exportByValueRequired = true;
+ Lifetime lifetime = null;
+ UserContext userContext = null;
+ ExportPortlets exportPortlets = WSRPTypeFactory.createExportPortlets(registrationContext, portletContexts, userContext, lifetime, exportByValueRequired);
- ExportPortletsResponse response = producer.exportPortlets(exportPortlets);
+ ExportPortletsResponse response = producer.exportPortlets(exportPortlets);
- checkValidHandle(response, getDefaultHandle());
+ checkValidHandle(response, getDefaultHandle());
+ }
+ catch (Exception e)
+ {
+ //arquillian can't handle non serializable exceptions, print error message to the server logs
+ System.out.println("An exception occured calling " + this.getClass() + " testExportRegistrationRequired");
+ e.printStackTrace();
+ throw new Exception (e);
+ }
}
@Test
@@ -381,40 +391,50 @@
@Test
public void testImportRegistrationRequired() throws Exception
{
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
- RegistrationData registrationData = WSRPTypeFactory.createRegistrationData("CONSUMER", true);
- RegistrationContext registrationContext = producer.register(registrationData);
+ try
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+ RegistrationData registrationData = WSRPTypeFactory.createRegistrationData("CONSUMER", "CONSUMERAGENT.0.0", true);
+ RegistrationContext registrationContext = producer.register(registrationData);
- String importID = "foo";
+ String importID = "foo";
- Lifetime lifetime = null;
- UserContext userContext = null;
+ Lifetime lifetime = null;
+ UserContext userContext = null;
- List<String> portletList = new ArrayList<String>();
- portletList.add(getDefaultHandle());
- ExportContext exportContextData = new ExportContext();
- byte[] importContext = exportContextData.encodeAsBytes();
+ List<String> portletList = new ArrayList<String>();
+ portletList.add(getDefaultHandle());
+ ExportContext exportContextData = new ExportContext();
+ byte[] importContext = exportContextData.encodeAsBytes();
- ImportPortlet importPortlet = createSimpleImportPortlet(importID, getDefaultHandle());
- List<ImportPortlet> importPortletsList = createImportPortletList(importPortlet);
+ ImportPortlet importPortlet = createSimpleImportPortlet(importID, getDefaultHandle());
+ List<ImportPortlet> importPortletsList = createImportPortletList(importPortlet);
- ImportPortlets importPortlets = WSRPTypeFactory.createImportPortlets(registrationContext, importContext, importPortletsList, userContext, lifetime);
- ImportPortletsResponse response = producer.importPortlets(importPortlets);
+ ImportPortlets importPortlets = WSRPTypeFactory.createImportPortlets(registrationContext, importContext, importPortletsList, userContext, lifetime);
+ ImportPortletsResponse response = producer.importPortlets(importPortlets);
- assertEquals(1, response.getImportedPortlets().size());
- ImportedPortlet portlet = response.getImportedPortlets().get(0);
+ assertEquals(1, response.getImportedPortlets().size());
+ ImportedPortlet portlet = response.getImportedPortlets().get(0);
- assertEquals(importID, portlet.getImportID());
+ assertEquals(importID, portlet.getImportID());
- PortletContext portletContext = portlet.getNewPortletContext();
+ PortletContext portletContext = portlet.getNewPortletContext();
- //check that the new portlet handle is valid and we can access the portlet
- GetMarkup markup = createMarkupRequest(portletContext.getPortletHandle());
- markup.setRegistrationContext(registrationContext);
+ //check that the new portlet handle is valid and we can access the portlet
+ GetMarkup markup = createMarkupRequest(portletContext.getPortletHandle());
+ markup.setRegistrationContext(registrationContext);
- MarkupResponse markupResponse = producer.getMarkup(markup);
- assertNotNull(markupResponse.getMarkupContext());
- assertEquals("<p>symbol unset stock value: value unset</p>", new String(markupResponse.getMarkupContext().getItemString()));
+ MarkupResponse markupResponse = producer.getMarkup(markup);
+ assertNotNull(markupResponse.getMarkupContext());
+ assertEquals("<p>symbol unset stock value: value unset</p>", new String(markupResponse.getMarkupContext().getItemString()));
+ }
+ catch (Exception e)
+ {
+ //arquillian can't handle non serializable exceptions, print error message to the server logs
+ System.out.println("An exception occured calling " + this.getClass() + " testImportRegistrationRequired");
+ e.printStackTrace();
+ throw new Exception (e);
+ }
}
@Test
@@ -959,7 +979,7 @@
protected PortletContext performBlockingInteractionOnSessionPortlet(String handle, String value, StateChange stateChange) throws Exception
{
//perform a blocking interaction to set a state on the portlet;
- PerformBlockingInteraction pbi = WSRPTypeFactory.createDefaultPerformBlockingInteraction(handle);
+ PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction(handle);
pbi.getInteractionParams().setPortletStateChange(stateChange);
NamedString namedString = WSRPTypeFactory.createNamedString("value", value);
pbi.getInteractionParams().getFormParameters().add(namedString);
14 years, 3 months
gatein SVN: r4041 - epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-03 08:31:59 -0400 (Fri, 03 Sep 2010)
New Revision: 4041
Modified:
epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml
Log:
JBEPP-453: EPP 5.1 productization
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml 2010-09-03 11:51:00 UTC (rev 4040)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml 2010-09-03 12:31:59 UTC (rev 4041)
@@ -37,11 +37,6 @@
<target>1.5</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-help-plugin</artifactId>
- <version>2.1.1</version>
- </plugin>
</plugins>
</build>
@@ -172,4 +167,4 @@
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
14 years, 3 months
gatein SVN: r4040 - epp/portal/branches/EPP_5_1_Branch/packaging/pkg.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-03 07:51:00 -0400 (Fri, 03 Sep 2010)
New Revision: 4040
Modified:
epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml
Log:
JBEPP-453: EPP 5.1 productization
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml 2010-09-03 10:07:02 UTC (rev 4039)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml 2010-09-03 11:51:00 UTC (rev 4040)
@@ -135,106 +135,6 @@
<profiles>
<profile>
- <id>pkg-tomcat</id>
- <build>
- <finalName>GateIn-${project.version}</finalName>
- <plugins>
- <!-- Ensure your environment is correctly setup -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-check-environment-ready</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireProperty>
- <property>exo.projects.directory.dependencies</property>
- <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
- </requireProperty>
- <requireProperty>
- <property>exo.projects.app.tomcat.version</property>
- <message>"You must define the property exo.projects.app.tomcat.version to give the name of the directory where is stored tomcat"</message>
- </requireProperty>
- <requireFilesExist>
- <files>
- <file>${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}/</file>
- </files>
- <message>"The following Tomcat directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
- </requireFilesExist>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- run exo build -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-packaging</id>
- <phase>package</phase>
- <configuration>
- <executable>java</executable>
- <workingDirectory>${basedir}</workingDirectory>
- <arguments>
- <argument>-Dexo.package.home=${basedir}/target/packager</argument>
- <argument>-Dexo.current.dir=${basedir}</argument>
- <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
- <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
- <argument>-Dexo.working.dir=${gatein.working.dir}/</argument>
- <!--argument>-Dexo.src.dir=NONE</argument-->
- <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
- <argument>-Dexo.m2.repos=file:${settings.localRepository}</argument>
- <argument>-Dclean.server=${exo.projects.app.tomcat.version}</argument>
- <argument>-Dexo.m2.home=${maven.home}</argument>
- <argument>-Xms128m</argument>
- <argument>-Xmx512m</argument>
- <argument>-classpath</argument>
- <argument>${basedir}/target/packager/lib/js.jar</argument>
- <argument>org.mozilla.javascript.tools.shell.Main</argument>
- <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
- <argument>exobuild</argument>
- <argument>--product=portal</argument>
- <argument>--deploy=tomcat</argument>
- </arguments>
- </configuration>
- <goals>
- <goal>exec</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-<!--
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/tomcat-zip.xml</descriptor>
- </descriptors>
- <attach>false</attach>
- </configuration>
- </execution>
- </executions>
- </plugin>
--->
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>pkg-jbossas</id>
<build>
<finalName>GateIn-${project.version}</finalName>
@@ -334,107 +234,6 @@
</build>
</profile>
<profile>
- <id>pkg-tomcat-tests</id>
- <build>
- <finalName>GateIn-${project.version}</finalName>
- <plugins>
- <!-- Ensure your environment is correctly setup -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-check-environment-ready</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireProperty>
- <property>exo.projects.directory.dependencies</property>
- <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
- </requireProperty>
- <requireProperty>
- <property>exo.projects.app.tomcat.version</property>
- <message>"You must define the property exo.projects.app.tomcat.version to give the name of the directory where is stored tomcat"</message>
- </requireProperty>
- <requireFilesExist>
- <files>
- <file>${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}/</file>
- </files>
- <message>"The following Tomcat directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
- </requireFilesExist>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- run exo build -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-packaging</id>
- <phase>package</phase>
- <configuration>
- <executable>java</executable>
- <workingDirectory>${basedir}</workingDirectory>
- <arguments>
- <argument>-Dexo.package.home=${basedir}/target/packager</argument>
- <argument>-Dexo.current.dir=${basedir}</argument>
- <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
- <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
- <argument>-Dexo.working.dir=${gatein.working.dir}/</argument>
- <!--argument>-Dexo.src.dir=NONE</argument-->
- <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
- <argument>-Dexo.m2.repos=file:${settings.localRepository}</argument>
- <argument>-Dclean.server=${exo.projects.app.tomcat.version}</argument>
- <argument>-Dexo.m2.home=${maven.home}</argument>
- <argument>-Xms128m</argument>
- <argument>-Xmx512m</argument>
- <argument>-classpath</argument>
- <argument>${basedir}/target/packager/lib/js.jar</argument>
- <argument>org.mozilla.javascript.tools.shell.Main</argument>
- <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
- <argument>exobuild</argument>
- <argument>--product=portal</argument>
- <argument>--deploy=tomcat</argument>
- <argument>--integration-test</argument>
- </arguments>
- </configuration>
- <goals>
- <goal>exec</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-<!--
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>tomcat-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/tomcat-zip.xml</descriptor>
- </descriptors>
- <attach>false</attach>
- </configuration>
- </execution>
- </executions>
- </plugin>
--->
- </plugins>
- </build>
-
- </profile>
- <profile>
<id>pkg-jbossas-tests</id>
<build>
<finalName>GateIn-${project.version}</finalName>
14 years, 3 months
gatein SVN: r4039 - portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-03 06:07:02 -0400 (Fri, 03 Sep 2010)
New Revision: 4039
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
Log:
improve route rule for portal controller
Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-09-03 04:53:59 UTC (rev 4038)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-09-03 10:07:02 UTC (rev 4039)
@@ -53,7 +53,7 @@
protected static Log log = ExoLogger.getLogger("portal:PortalRequestHandler");
- private String[] PATHS = {"/public{gtn{path}:/.*}", "/private{gtn{path}:/.*}"};
+ private String[] PATHS = {"/public/{{gtn}sitename}{{gtn}path:.*}", "/private/{{gtn}sitename}{{gtn}path:.*}"};
public String[] getPath()
{
14 years, 3 months