gatein SVN: r6184 - in portal/branches/site-describability: portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component and 1 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2011-04-08 07:29:01 -0400 (Fri, 08 Apr 2011)
New Revision: 6184
Modified:
portal/branches/site-describability/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
GTNPORTAL-1854 Site instance is displayed in menu by label instead of portal name
Modified: portal/branches/site-describability/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
--- portal/branches/site-describability/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-04-08 10:38:06 UTC (rev 6183)
+++ portal/branches/site-describability/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-04-08 11:29:01 UTC (rev 6184)
@@ -19,6 +19,7 @@
package org.exoplatform.toolbar.webui.component;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -52,6 +53,19 @@
UserPortalConfigService dataStorage = getApplicationComponent(UserPortalConfigService.class);
return dataStorage.getAllPortalNames();
}
+
+ public String getPortalLabel(String portalName) throws Exception
+ {
+ DataStorage storage_ = getApplicationComponent(DataStorage.class);
+ PortalConfig portalConfig = storage_.getPortalConfig(portalName);
+ String label = portalConfig.getLabel();
+ if (label != null && label.trim().length() > 0)
+ {
+ return label;
+ }
+
+ return portalName;
+ }
public String getCurrentPortal()
{
Modified: portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
--- portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-04-08 10:38:06 UTC (rev 6183)
+++ portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-04-08 11:29:01 UTC (rev 6184)
@@ -35,12 +35,13 @@
if(isCurrent && nodes.size() > 0) clazz = "class='ArrowIcon'";
else clazz = "";
href = uicomponent.getPortalURI(portal);
+ label = uicomponent.getPortalLabel(portal);
EntityEncoder entityEncoder = EntityEncoder.FULL;
portal = entityEncoder.encode(portal);
print """
<div class="MenuItem portlet-menu-cascade-item">
<div $clazz>
- <a href="$href" class="ItemIcon SiteIcon">$portal</a>
+ <a href="$href" class="ItemIcon SiteIcon">$label</a>
</div>
""";
if(isCurrent) {
Modified: portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-04-08 10:38:06 UTC (rev 6183)
+++ portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-04-08 11:29:01 UTC (rev 6184)
@@ -323,6 +323,11 @@
dataService.save(portalConfig);
prContext.setAttribute(UserPortalConfig.class, service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser()));
uiPortalApp.reloadSkinPortal(prContext);
+
+ // We should use IPC to update some portlets in the future instead of
+ UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("PortalNavigationPortlet");
+ uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
}
else
{
13 years, 9 months
gatein SVN: r6183 - in components/pc/trunk: controller/src/test/java/org/gatein/pc/controller and 3 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-08 06:38:06 -0400 (Fri, 08 Apr 2011)
New Revision: 6183
Modified:
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java
components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java
components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
Log:
- GTNPC-58: Improved test cases so that they use properly formatted PortletContexts and extracted constants to avoid inadvertent collisions of values without the same semantics (i.e. same String "foo" being used for different purposes).
- GTNPC-61: Used new improved PortletContext to properly resolve invoker from compound PortletContext.
Modified: components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -147,7 +147,7 @@
assertNull(components.getStateId());
}
- public void testCreateFromComponents()
+ public void testCreateFromAppAndPortletName()
{
PortletContext fromId = PortletContext.createPortletContext("/applicationName.portletName");
Modified: components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java
===================================================================
--- components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/EventControllerContextFailureTestCase.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.controller;
import org.gatein.pc.portlet.support.PortletInvokerSupport;
@@ -36,9 +36,9 @@
import org.gatein.pc.controller.handlers.NoOpEventHandler;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.controller.PortletController;
import org.jboss.unit.api.pojo.annotations.Test;
import org.jboss.unit.api.pojo.annotations.Create;
+
import static org.jboss.unit.api.Assert.assertInstanceOf;
import static org.jboss.unit.api.Assert.assertEquals;
import static org.jboss.unit.api.Assert.assertTrue;
@@ -55,6 +55,8 @@
public class EventControllerContextFailureTestCase
{
+ public static final String DST_WINDOW_ID = "/webappdst.dst";
+
/** . */
private PortletController controller = new PortletController();
@@ -85,11 +87,11 @@
@Create
public void create()
{
- request = context.createActionRequest("foo");
- srcName = new QName("juu", "foo");
- dstName = new QName("juu", "bar");
- fooPortlet = invoker.addPortlet("foo");
- barPortlet = invoker.addPortlet("bar");
+ request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
+ srcName = new QName("ns1", "src");
+ dstName = new QName("ns2", "dst");
+ fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
called = false;
}
@@ -104,7 +106,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -126,7 +128,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
//
context.setEventControllerContext(ecc);
@@ -202,7 +204,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -224,7 +226,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, PortletInvokerSupport.BAR_PORTLET_ID);
//
context.setEventControllerContext(ecc);
@@ -254,7 +256,7 @@
throw new RuntimeException();
}
};
- ecc.createWire(srcName, "foo", dstName, "bar_");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, DST_WINDOW_ID);
// We test that a runtime exception thrown does not interrrupt the flow of the controller
context.setEventControllerContext(ecc);
@@ -276,7 +278,7 @@
throw error;
}
};
- ecc.createWire(srcName, "foo", dstName, "bar_");
+ ecc.createWire(srcName, PortletInvokerSupport.FOO_PORTLET_ID, dstName, DST_WINDOW_ID);
//
context.setEventControllerContext(ecc);
Modified: components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java
===================================================================
--- components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerRequestTestCase.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,28 +1,29 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.controller;
import static org.jboss.unit.api.Assert.*;
+
import org.jboss.unit.api.pojo.annotations.Test;
import org.gatein.pc.portlet.support.PortletInvokerSupport;
import org.gatein.pc.portlet.support.PortletSupport;
@@ -34,7 +35,6 @@
import org.gatein.pc.api.OpaqueStateString;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.cache.CacheLevel;
-import org.gatein.pc.controller.PortletController;
import org.gatein.pc.controller.request.PortletActionRequest;
import org.gatein.pc.controller.request.PortletResourceRequest;
import org.gatein.pc.controller.request.PortletRenderRequest;
@@ -88,7 +88,7 @@
@Test
public void testPortletControllerActionRequest() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -106,7 +106,7 @@
});
//
- PortletActionRequest action = new PortletActionRequest("foo", is, body, windowNS, pageNS);
+ PortletActionRequest action = new PortletActionRequest(PortletInvokerSupport.FOO_PORTLET_ID, is, body, windowNS, pageNS);
//
controller.process(context, action);
@@ -115,15 +115,15 @@
@Test
public void testPortletControllerRenderRequest() throws PortletInvokerException
{
- invoker.addPortlet("foo");
- PortletRenderRequest render = new PortletRenderRequest("foo", windowNS, new HashMap<String, String[]>(), pageNS);
+ invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ PortletRenderRequest render = new PortletRenderRequest(PortletInvokerSupport.FOO_PORTLET_ID, windowNS, new HashMap<String, String[]>(), pageNS);
controller.process(context, render);
}
@Test
public void testPortletControllerResourceRequestFullScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -134,26 +134,26 @@
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.FullScope());
controller.process(context, fullServing);
//
resourceHandler.expectedBody = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing2 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.FullScope());
controller.process(context, fullServing2);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest fullServing3 = new PortletResourceRequest("foo", null, rs, null, new PortletResourceRequest.FullScope());
+ PortletResourceRequest fullServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, null, new PortletResourceRequest.FullScope());
controller.process(context, fullServing3);
}
@Test
public void testPortletControllerResourceRequestPortletScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -164,7 +164,7 @@
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.MAXIMIZED;
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PortletScope(windowNS));
+ PortletResourceRequest portletServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PortletScope(windowNS));
controller.process(context, portletServing);
//
@@ -172,20 +172,20 @@
resourceHandler.expectedMode = Mode.VIEW;
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing2 = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PortletScope(null));
+ PortletResourceRequest portletServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PortletScope(null));
controller.process(context, portletServing2);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest portletServing3 = new PortletResourceRequest("foo", null, rs, body, new PortletResourceRequest.PortletScope(null));
+ PortletResourceRequest portletServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, body, new PortletResourceRequest.PortletScope(null));
controller.process(context, portletServing3);
}
@Test
public void testPortletControllerResourceRequestPageScope() throws PortletInvokerException
{
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
ResourceHandlerImpl resourceHandler = new ResourceHandlerImpl();
resourceHandler.expectedResourceId = "resourceid";
resourceHandler.expectedRS = rs;
@@ -196,7 +196,7 @@
resourceHandler.expectedCacheability = CacheLevel.PAGE;
resourceHandler.expectedPublicState = new ParameterMap();
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PageScope(windowNS, pageNS));
+ PortletResourceRequest pageServing = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PageScope(windowNS, pageNS));
controller.process(context, pageServing);
//
@@ -204,25 +204,25 @@
resourceHandler.expectedMode = Mode.VIEW;
resourceHandler.expectedWindowState = org.gatein.pc.api.WindowState.NORMAL;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing2 = new PortletResourceRequest("foo", "resourceid", rs, body, new PortletResourceRequest.PageScope(null, pageNS));
+ PortletResourceRequest pageServing2 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, body, new PortletResourceRequest.PageScope(null, pageNS));
controller.process(context, pageServing2);
//
resourceHandler.expectedBody = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing3 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.PageScope(null, pageNS));
+ PortletResourceRequest pageServing3 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.PageScope(null, pageNS));
controller.process(context, pageServing3);
//
resourceHandler.expectedPublicState = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing4 = new PortletResourceRequest("foo", "resourceid", rs, null, new PortletResourceRequest.PageScope(null, null));
+ PortletResourceRequest pageServing4 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, "resourceid", rs, null, new PortletResourceRequest.PageScope(null, null));
controller.process(context, pageServing4);
//
resourceHandler.expectedResourceId = null;
fooPortlet.addHandler(resourceHandler);
- PortletResourceRequest pageServing5 = new PortletResourceRequest("foo", null, rs, null, new PortletResourceRequest.PageScope(null, null));
+ PortletResourceRequest pageServing5 = new PortletResourceRequest(PortletInvokerSupport.FOO_PORTLET_ID, null, rs, null, new PortletResourceRequest.PageScope(null, null));
controller.process(context, pageServing5);
}
Modified: components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java
===================================================================
--- components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/controller/src/test/java/org/gatein/pc/controller/PortletControllerTestCase.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.controller;
import org.gatein.pc.controller.request.ControllerRequest;
@@ -45,11 +45,11 @@
import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.api.invocation.ActionInvocation;
import org.gatein.pc.api.invocation.EventInvocation;
-import org.gatein.pc.controller.PortletController;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.WindowState;
import org.jboss.unit.api.pojo.annotations.Test;
import org.jboss.unit.api.pojo.annotations.Create;
+
import static org.jboss.unit.api.Assert.*;
import javax.xml.namespace.QName;
@@ -75,6 +75,9 @@
/** . */
PortletInvokerSupport invoker = context.getInvoker();
+ public static final QName SRC_NAME = new QName("ns1", "src");
+ public static final QName DST_NAME = new QName("ns2", "dest");
+
@Create
public void create()
{
@@ -84,16 +87,16 @@
@Test
public void testPortletControllerRenderRequest() throws PortletInvokerException
{
- invoker.addPortlet("foo");
+ invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
StateString portletNS = new OpaqueStateString("abc");
PortletPageNavigationalState pageNS = context.getStateControllerContext().createPortletPageNavigationalState(true);
PortletWindowNavigationalState windowNS = new PortletWindowNavigationalState(portletNS, org.gatein.pc.api.Mode.EDIT, WindowState.MAXIMIZED);
- PortletRenderRequest render = new PortletRenderRequest("foo", windowNS, new HashMap<String, String[]>(), pageNS);
+ PortletRenderRequest render = new PortletRenderRequest(PortletInvokerSupport.FOO_PORTLET_ID, windowNS, new HashMap<String, String[]>(), pageNS);
ControllerResponse response = controller.process(context, render);
PageUpdateResponse pageUpdate = assertInstanceOf(response, PageUpdateResponse.class);
PortletPageNavigationalState pageNS2 = assertNotNull(pageUpdate.getPageNavigationalState());
- assertEquals(Tools.toSet("foo"), pageNS2.getPortletWindowIds());
- PortletWindowNavigationalState windowNS2 = pageNS2.getPortletWindowNavigationalState("foo");
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID), pageNS2.getPortletWindowIds());
+ PortletWindowNavigationalState windowNS2 = pageNS2.getPortletWindowNavigationalState(PortletInvokerSupport.FOO_PORTLET_ID);
assertNotNull(windowNS2);
assertEquals(portletNS, windowNS2.getPortletNavigationalState());
assertEquals(org.gatein.pc.api.Mode.EDIT, windowNS2.getMode());
@@ -114,11 +117,8 @@
private void testAction(final boolean publishEvent) throws PortletInvokerException
{
- final QName srcName = new QName("juu", "foo");
- final QName dstName = new QName("juu", "bar");
-
//
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -131,21 +131,21 @@
//
if (publishEvent)
{
- updateNS.queueEvent(new UpdateNavigationalStateResponse.Event(srcName, null));
+ updateNS.queueEvent(new UpdateNavigationalStateResponse.Event(SRC_NAME, null));
}
-
+
//
return updateNS;
}
});
//
- PortletSupport barPortlet = invoker.addPortlet("bar");
+ PortletSupport barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
barPortlet.addHandler(new PortletSupport.EventHandler()
{
protected PortletInvocationResponse invoke(EventInvocation action) throws PortletInvokerException
{
- assertEquals(dstName, action.getName());
+ assertEquals(DST_NAME, action.getName());
assertEquals(null, action.getPayload());
//
@@ -160,16 +160,16 @@
});
//
- eventControllerContext.createWire(srcName, "foo", dstName, "bar");
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, DST_NAME, PortletInvokerSupport.BAR_PORTLET_ID);
//
- ControllerRequest request = context.createActionRequest("foo");
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
ControllerResponse response = controller.process(context, request);
PageUpdateResponse pageUpdate = assertInstanceOf(response, PageUpdateResponse.class);
PortletPageNavigationalState pageNS = assertNotNull(pageUpdate.getPageNavigationalState());
//
- PortletWindowNavigationalState fooNS = assertNotNull(pageNS.getPortletWindowNavigationalState("foo"));
+ PortletWindowNavigationalState fooNS = assertNotNull(pageNS.getPortletWindowNavigationalState(PortletInvokerSupport.FOO_PORTLET_ID));
assertEquals(WindowState.MAXIMIZED, fooNS.getWindowState());
assertEquals(org.gatein.pc.api.Mode.EDIT, fooNS.getMode());
assertEquals(new OpaqueStateString("abc"), fooNS.getPortletNavigationalState());
@@ -177,17 +177,17 @@
//
if (publishEvent)
{
- assertEquals(Tools.toSet("foo", "bar"), pageNS.getPortletWindowIds());
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID, PortletInvokerSupport.BAR_PORTLET_ID), pageNS.getPortletWindowIds());
//
- PortletWindowNavigationalState barNS = assertNotNull(pageNS.getPortletWindowNavigationalState("bar"));
+ PortletWindowNavigationalState barNS = assertNotNull(pageNS.getPortletWindowNavigationalState(PortletInvokerSupport.BAR_PORTLET_ID));
assertEquals(WindowState.MINIMIZED, barNS.getWindowState());
assertEquals(org.gatein.pc.api.Mode.HELP, barNS.getMode());
assertEquals(new OpaqueStateString("def"), barNS.getPortletNavigationalState());
}
else
{
- assertEquals(Tools.toSet("foo"), pageNS.getPortletWindowIds());
+ assertEquals(Tools.toSet(PortletInvokerSupport.FOO_PORTLET_ID), pageNS.getPortletWindowIds());
}
}
@@ -195,7 +195,7 @@
public void testActionThrowsPortletInvokerException() throws PortletInvokerException
{
final PortletInvokerException e = new PortletInvokerException();
- PortletSupport fooPortlet = invoker.addPortlet("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
fooPortlet.addHandler(new PortletSupport.ActionHandler()
{
protected PortletInvocationResponse invoke(ActionInvocation action) throws PortletInvokerException
@@ -205,7 +205,7 @@
});
//
- ControllerRequest request = context.createActionRequest("foo");
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
try
{
@@ -221,14 +221,12 @@
@Test
public void testProcessActionProducedEventIsDistributed() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- QName dstName = new QName("juu", "bar");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- PortletSupport barPortlet = invoker.addPortlet("bar");
- EventProducerActionHandler eventProducerHandler = new EventProducerActionHandler(srcName);
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ PortletSupport barPortlet = invoker.addPortlet(PortletInvokerSupport.BAR_PORTLET_ID);
+ EventProducerActionHandler eventProducerHandler = new EventProducerActionHandler(SRC_NAME);
NoOpEventHandler eventConsumer = new NoOpEventHandler();
- eventControllerContext.createWire(srcName, "foo", dstName, "bar");
- ControllerRequest request = context.createActionRequest("foo");
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, DST_NAME, PortletInvokerSupport.BAR_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
controller.setDistributeNonProduceableEvents(true);
@@ -248,7 +246,7 @@
barPortlet.assertInvocationCountIs(1);
//
- barPortlet.getInfo().getEventing().addConsumedEvent(new EventInfoSupport(dstName));
+ barPortlet.getInfo().getEventing().addConsumedEvent(new EventInfoSupport(DST_NAME));
//
controller.setDistributeNonProduceableEvents(true);
@@ -285,7 +283,7 @@
barPortlet.assertInvocationCountIs(3);
//
- fooPortlet.getInfo().getEventing().addProducedEvent(new EventInfoSupport(srcName));
+ fooPortlet.getInfo().getEventing().addProducedEvent(new EventInfoSupport(SRC_NAME));
//
controller.setDistributeNonProduceableEvents(false);
@@ -309,14 +307,13 @@
@Test
public void testEventFloodDetection() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- eventControllerContext.createWire(srcName, "foo", srcName, "foo");
- ControllerRequest request = context.createActionRequest("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
- EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
- EventProducerEventHandler eventProducerEventHandler = new EventProducerEventHandler(srcName);
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(SRC_NAME);
+ EventProducerEventHandler eventProducerEventHandler = new EventProducerEventHandler(SRC_NAME);
//
controller.setConsumedEventThreshold(10);
@@ -340,13 +337,12 @@
@Test
public void testEventFloodInterruption() throws PortletInvokerException
{
- QName srcName = new QName("juu", "foo");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- eventControllerContext.createWire(srcName, "foo", srcName, "foo");
- ControllerRequest request = context.createActionRequest("foo");
+ PortletSupport fooPortlet = invoker.addPortlet(PortletInvokerSupport.FOO_PORTLET_ID);
+ eventControllerContext.createWire(SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID, SRC_NAME, PortletInvokerSupport.FOO_PORTLET_ID);
+ ControllerRequest request = context.createActionRequest(PortletInvokerSupport.FOO_PORTLET_ID);
//
- EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(SRC_NAME);
//
controller.setConsumedEventThreshold(10);
Modified: components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
--- components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -63,7 +63,7 @@
private static final Logger log = LoggerFactory.getLogger(FederatingPortletInvokerService.class);
/** The separator used in the id to route to the correct invoker. */
- static final String SEPARATOR = ".";
+ public static final String SEPARATOR = ".";
/** The registred FederatedPortletInvokers. */
private volatile Map<String, FederatedPortletInvoker> registry = new HashMap<String, FederatedPortletInvoker>();
@@ -72,7 +72,7 @@
public static PortletContext dereference(PortletContext compoundPortletContext, String invokerId)
{
- String portletId = compoundPortletContext.getId().substring(invokerId.length() + 1);
+ String portletId = compoundPortletContext.getId().substring(invokerId.length() + SEPARATOR.length());
if (compoundPortletContext instanceof StatefulPortletContext)
{
StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)compoundPortletContext;
@@ -315,18 +315,21 @@
throw new IllegalArgumentException("No null portlet id accepted");
}
- //
- String compoundPortletId = compoundPortletContext.getId();
+ PortletContext.PortletContextComponents components = compoundPortletContext.getComponents();
+ final String compoundPortletId = compoundPortletContext.getId();
+ if (components == null)
+ {
+ // force intepretation
+ compoundPortletContext = PortletContext.createPortletContext(compoundPortletId, true);
+ components = compoundPortletContext.getComponents();
+ }
- //
- int pos = compoundPortletId.indexOf(SEPARATOR);
- if (pos == -1)
+ final String invokerId = components.getInvokerName();
+ if (invokerId == null)
{
throw new IllegalArgumentException("Bad portlet id format " + compoundPortletId);
}
- //
- String invokerId = compoundPortletId.substring(0, pos);
FederatedPortletInvoker federated = registry.get(invokerId);
if (federated == null)
{
Modified: components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -51,6 +51,12 @@
public class FederatingPortletInvokerTestCase
{
+ private static final PortletContext PORTLET = PortletContext.createPortletContext("/webapp.portlet", false);
+ private static final String INVOKER_ID = "foo";
+ private static final PortletContext LOCAL_PORTLET = PortletContext.createPortletContext("/web.local", false);
+ private static final PortletContext REFERENCED_PORTLET = FederatingPortletInvokerService.reference(PORTLET, INVOKER_ID);
+ private static final PortletContext REFERENCED_LOCAL_PORTLET = FederatingPortletInvokerService.reference(LOCAL_PORTLET, PortletInvoker.LOCAL_PORTLET_INVOKER_ID);
+
/** . */
private FederatingPortletInvoker federatingInvoker;
@@ -75,17 +81,17 @@
federatedInvokerDelegate = new PortletInvokerSupport();
PortletInfoSupport fooInfo = new PortletInfoSupport();
fooInfo.getMeta().setDisplayName("FooPortlet");
- portlet = federatedInvokerDelegate.addPortlet("MyPortlet", fooInfo);
+ portlet = federatedInvokerDelegate.addPortlet(PORTLET.getId(), fooInfo);
portletContext = portlet.getContext();
- federatedInvoker = federatingInvoker.registerInvoker("foo", federatedInvokerDelegate);
+ federatedInvoker = federatingInvoker.registerInvoker(INVOKER_ID, federatedInvokerDelegate);
assertNotNull(federatedInvoker);
- assertEquals("foo", federatedInvoker.getId());
+ assertEquals(INVOKER_ID, federatedInvoker.getId());
// create 'local' invoker and register it with federating service
localInvokerDelegate = new PortletInvokerSupport();
PortletInfoSupport localInfo = new PortletInfoSupport();
localInfo.getMeta().setDisplayName("LocalPortlet");
- localInvokerDelegate.addPortlet("MyLocalPortlet", localInfo);
+ localInvokerDelegate.addPortlet(LOCAL_PORTLET.getId(), localInfo);
localInvoker = federatingInvoker.registerInvoker(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, localInvokerDelegate);
assertNotNull(localInvoker);
assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, localInvoker.getId());
@@ -108,22 +114,22 @@
assertNotNull(portlets);
assertEquals(2, portlets.size());
+
for (Portlet portlet : portlets)
{
PortletContext context = portlet.getContext();
- String id = context.getId();
- assertTrue("foo.MyPortlet".equals(id) || (PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet").equals(id));
+ assertTrue(REFERENCED_PORTLET.getId().equals(context.getId()) || REFERENCED_LOCAL_PORTLET.getId().equals(context.getId()));
}
}
@Test
public void testGetStatus() throws PortletInvokerException
{
- assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(PortletContext.createPortletContext("foo.MyPortlet")));
- assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet")));
+ assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(REFERENCED_PORTLET));
+ assertEquals(PortletStatus.OFFERED, federatingInvoker.getStatus(REFERENCED_LOCAL_PORTLET));
- assertEquals(PortletStatus.OFFERED, federatedInvoker.getStatus(PortletContext.createPortletContext("foo.MyPortlet")));
- assertEquals(PortletStatus.OFFERED, localInvoker.getStatus(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + ".MyLocalPortlet")));
+ assertEquals(PortletStatus.OFFERED, federatedInvoker.getStatus(REFERENCED_PORTLET));
+ assertEquals(PortletStatus.OFFERED, localInvoker.getStatus(REFERENCED_LOCAL_PORTLET));
}
@Test
@@ -133,9 +139,9 @@
assertNotNull(federateds);
assertEquals(2, federateds.size());
- FederatedPortletInvoker federated = federatingInvoker.getFederatedInvoker("foo");
+ FederatedPortletInvoker federated = federatingInvoker.getFederatedInvoker(INVOKER_ID);
assertNotNull(federated);
- assertEquals("foo", federated.getId());
+ assertEquals(INVOKER_ID, federated.getId());
assertEquals(federatedInvoker, federated);
assertEquals(federatedInvokerDelegate, federated.getPortletInvoker());
@@ -189,7 +195,7 @@
assertEquals(1, localPortlets.size());
Portlet localPortlet = localPortlets.iterator().next();
assertNotNull(localPortlet);
- assertEquals("local.MyLocalPortlet", localPortlet.getContext().getId());
+ assertEquals(REFERENCED_LOCAL_PORTLET, localPortlet.getContext());
}
@Test
@@ -199,7 +205,7 @@
assertEquals(1, portlets.size());
Portlet portlet = portlets.iterator().next();
assertNotNull(portlet);
- assertEquals("foo.MyPortlet", portlet.getContext().getId());
+ assertEquals(REFERENCED_PORTLET, portlet.getContext());
}
@Test
@@ -209,10 +215,12 @@
final TestFederatedPortletInvoker remote = new TestFederatedPortletInvoker();
PortletInfoSupport remoteInfo = new PortletInfoSupport();
remoteInfo.getMeta().setDisplayName("RemotePortlet");
- Portlet portlet = remote.addPortlet("RemotePortlet", remoteInfo);
+ final PortletContext context = PortletContext.createPortletContext("/app.RemotePortlet");
+ Portlet portlet = remote.addPortlet(context.getId(), remoteInfo);
// this invoker is not registered
- assertNull(federatingInvoker.getFederatedInvoker("inexistent"));
+ final String federatedId = "inexistent";
+ assertNull(federatingInvoker.getFederatedInvoker(federatedId));
federatingInvoker.setNullInvokerHandler(new NullInvokerHandler()
{
@@ -223,7 +231,8 @@
}
});
- assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext("inexistent.RemotePortlet")));
+ assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext(federatedId + FederatingPortletInvokerService.SEPARATOR + context.getId())));
+ assertEquals(portlet, federatingInvoker.getPortlet(FederatingPortletInvokerService.reference(context, federatedId)));
}
private class TestFederatedPortletInvoker extends PortletInvokerSupport implements FederatedPortletInvoker
@@ -239,9 +248,9 @@
{
// fake dereferencing of compound portlet id
String portletId = portletContext.getId();
- if (portletId.startsWith(getId() + "."))
+ if (portletId.startsWith(getId() + FederatingPortletInvokerService.SEPARATOR))
{
- return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf('.') + 1)));
+ return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf(FederatingPortletInvokerService.SEPARATOR) + 1)));
}
else
{
Modified: components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
===================================================================
--- components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-04-08 10:03:03 UTC (rev 6182)
+++ components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-04-08 10:38:06 UTC (rev 6183)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.portlet.support;
import org.gatein.pc.api.InvalidPortletIdException;
@@ -52,6 +52,8 @@
public class PortletInvokerSupport implements PortletInvoker
{
+ public static final String FOO_PORTLET_ID = "/webapp1.foo";
+ public static final String BAR_PORTLET_ID = "/webapp2.bar";
/** . */
private Map<String, PortletSupport> portlets;
13 years, 9 months
gatein SVN: r6182 - in portal/branches/site-describability: portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component and 3 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2011-04-08 06:03:03 -0400 (Fri, 08 Apr 2011)
New Revision: 6182
Modified:
portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UISiteManagement.gtmpl
portal/branches/site-describability/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
GTNPORTAL-1854 Allow edit site's label and description on UI
Modified: portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
===================================================================
--- portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-04-08 10:03:03 UTC (rev 6182)
@@ -55,10 +55,10 @@
assertEquals(expected, sb.toString());
}
- public void testGateInResources1_0() throws Exception
+ public void testGateInResources1_x() throws Exception
{
assertHash("d0591b0a022a0c2929e1aed8979857cd", "gatein_objects_1_0.xsd");
assertHash("99ae24c9bbfe1b59e066756a29ab6c79", "gatein_objects_1_1.xsd");
- assertHash("a3e06cf2a8c72cd8528e1112415e0b8b", "gatein_objects_1_2.xsd");
+ assertHash("616e7a91a5a841009f672af484f4861e", "gatein_objects_1_2.xsd");
}
}
Modified: portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UISiteManagement.gtmpl
===================================================================
--- portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UISiteManagement.gtmpl 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UISiteManagement.gtmpl 2011-04-08 10:03:03 UTC (rev 6182)
@@ -19,9 +19,20 @@
<tr>
<td class="Image"><img src="/exoadmin/skin/navigation/webui/component/background/PlImg.gif" alt=""/></td>
<td class="Content">
- <div class="Label"><%=uicomponent.getFieldValue(portalConfig, 'name') %></div>
-
- </td>
+ <div class="Label"><%=uicomponent.getFieldValue(portalConfig, 'name') %></div>
+ <%
+ def siteLabel = uicomponent.getFieldValue(portalConfig, 'label');
+ def siteDescription = uicomponent.getFieldValue(portalConfig, 'description');
+ if (siteLabel != null && siteLabel.trim().length() > 0)
+ {
+ print """<div>$siteLabel</div>""";
+ }
+ if (siteDescription != null && siteDescription.trim().length() > 0)
+ {
+ print """<div>$siteDescription</div>""";
+ }
+ %>
+ </td>
<td class="ActionBlock">
<a href="<%=uicomponent.event("EditPortalLayout", portalConfig.getName());%>" class="EditLayoutIcon"><%=_ctx.appRes("UISiteManagement.label.editLayout")%></a>
<a href="<%=uicomponent.event("EditNavigation", portalConfig.getName());%>" class="EditNavIcon"><%=_ctx.appRes("UISiteManagement.label.editNav")%></a>
Modified: portal/branches/site-describability/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- portal/branches/site-describability/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-04-08 10:03:03 UTC (rev 6182)
@@ -355,6 +355,8 @@
UIPortalForm.msg.sameName=This portal name already exists.
UIPortalForm.msg.notExistAnymore=This portal is not existed or may be deleted.
UIPortalForm.label.name=Portal Name :
+UIPortalForm.label.label=Label :
+UIPortalForm.label.description=Description :
UIPortalForm.label.locale=#{word.locale} :
UIPortalForm.label.date=#{word.date} :
UIPortalForm.label.factoryId=Portal Types
Modified: portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
--- portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-04-08 10:03:03 UTC (rev 6182)
@@ -89,6 +89,10 @@
private String ownerType;
private String locale;
+
+ private String label;
+
+ private String description;
private String editPermission;
@@ -378,6 +382,26 @@
setProperty(PortalProperties.SESSION_ALIVE, type);
}
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
private void localizePageNavigation(PageNavigation nav,Locale locale)
{
ResourceBundleManager mgr = getApplicationComponent(ResourceBundleManager.class);
Modified: portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-04-08 10:03:03 UTC (rev 6182)
@@ -96,6 +96,10 @@
private static final String FIELD_LOCALE = "locale";
private static final String FIELD_SESSION_ALIVE = "sessionAlive";
+
+ private static final String FIELD_LABEL = "label";
+
+ private static final String FIELD_DESCRIPTION = "description";
private String portalOwner_;
@@ -181,7 +185,6 @@
setActions(new String[]{"Save", "Close"});
}
- @SuppressWarnings("unchecked")
private class LanguagesComparator implements Comparator<SelectItemOption>
{
public int compare(SelectItemOption o1, SelectItemOption o2)
@@ -237,7 +240,10 @@
StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class).setEditable(false))
.addUIFormInput(
new UIFormSelectBox(FIELD_LOCALE, FIELD_LOCALE, languages).addValidator(MandatoryValidator.class));
-
+
+ uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_LABEL, FIELD_LABEL, null));
+ uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_DESCRIPTION, FIELD_DESCRIPTION, null));
+
List<SelectItemOption<String>> listSkin = new ArrayList<SelectItemOption<String>>();
SkinService skinService = getApplicationComponent(SkinService.class);
for (String skin : skinService.getAvailableSkinNames())
Modified: portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-04-08 07:54:33 UTC (rev 6181)
+++ portal/branches/site-describability/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-04-08 10:03:03 UTC (rev 6182)
@@ -198,6 +198,8 @@
PortalConfig model = new PortalConfig(uiPortal.getOwnerType(), uiPortal.getName(), uiPortal.getStorageId());
model.setAccessPermissions(uiPortal.getAccessPermissions());
model.setEditPermission(uiPortal.getEditPermission());
+ model.setLabel(uiPortal.getLabel());
+ model.setDescription(uiPortal.getDescription());
model.setLocale(uiPortal.getLocale());
model.setSkin(uiPortal.getSkin());
model.setModifiable(uiPortal.isModifiable());
@@ -347,6 +349,8 @@
uiPortal.setOwner(model.getName());
uiPortal.setModifiable(model.isModifiable());
+ uiPortal.setLabel(model.getLabel());
+ uiPortal.setDescription(model.getDescription());
uiPortal.setLocale(model.getLocale());
uiPortal.setSkin(model.getSkin());
uiPortal.setAccessPermissions(model.getAccessPermissions());
13 years, 9 months
gatein SVN: r6181 - portal/branches/site-describability/component/portal/src/main/java.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2011-04-08 03:54:33 -0400 (Fri, 08 Apr 2011)
New Revision: 6181
Modified:
portal/branches/site-describability/component/portal/src/main/java/gatein_objects_1_2.xsd
Log:
GTNPORTAL-1854 Update xsd for gatein_object_1_2
Modified: portal/branches/site-describability/component/portal/src/main/java/gatein_objects_1_2.xsd
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-04-08 07:24:45 UTC (rev 6180)
+++ portal/branches/site-describability/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-04-08 07:54:33 UTC (rev 6181)
@@ -88,6 +88,8 @@
<xs:complexType name="portalConfigType">
<xs:sequence>
<xs:element name="portal-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="label" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="locale" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
13 years, 9 months
gatein SVN: r6180 - in portal/branches/site-describability/component/portal/src: main/java/org/exoplatform/portal/config/model and 4 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2011-04-08 03:24:45 -0400 (Fri, 08 Apr 2011)
New Revision: 6180
Modified:
portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
portal/branches/site-describability/component/portal/src/main/resources/binding.xml
portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml
Log:
GTNPORTAL-1854 Init for adding label and description field in PortalConfig
Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -36,6 +36,10 @@
private String templateName;
private String location;
+
+ private String label;
+
+ private String description;
/**
* @deprecated use the location instead
@@ -52,10 +56,12 @@
this.ownerType = cfg.ownerType;
this.templateLocation = cfg.templateLocation;
this.location = cfg.location;
+ this.label = cfg.label;
+ this.description = cfg.description;
this.templateName = cfg.templateName;
this.predefinedOwner = new HashSet<String>(cfg.predefinedOwner);
}
-
+
public NewPortalConfig(String path)
{
this.location = path;
@@ -126,10 +132,30 @@
this.ownerType = ownerType;
}
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
@Override
public String toString()
{
- return "PortalConfig[predefinedOwner=" + predefinedOwner + ",ownerType=" + ownerType + ",templateName=" + templateName +
- "location=" + location + "]";
+ return "PortalConfig[predefinedOwner=" + predefinedOwner + ",ownerType=" + ownerType + ",templateName="
+ + templateName + ",label=" + label + ",description=" + description + ",location=" + location + "]";
}
}
Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -50,6 +50,10 @@
private String locale;
+ private String label;
+
+ private String description;
+
private String[] accessPermissions;
private String editPermission;
@@ -95,6 +99,8 @@
this.name = data.getName();
this.type = data.getType();
this.locale = data.getLocale();
+ this.label = data.getLabel();
+ this.description = data.getDescription();
this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
this.editPermission = data.getEditPermission();
this.properties = new Properties(data.getProperties());
@@ -238,6 +244,26 @@
setProperty(PortalProperties.SESSION_ALIVE, type);
}
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
static public class PortalConfigSet
{
private ArrayList<PortalConfig> portalConfigs;
@@ -281,6 +307,8 @@
name,
type,
locale,
+ label,
+ description,
accessPermissions,
editPermission,
properties,
Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.pom.data;
+import javassist.runtime.Desc;
+
import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.config.StaleModelException;
import org.exoplatform.portal.config.UserACL;
@@ -312,6 +314,8 @@
accessPermissions = pr.getAccessPermissions();
editPermission = pr.getEditPermission();
}
+
+ Described described = src.adapt(Described.class);
//
return new PortalData(
@@ -319,6 +323,8 @@
src.getName(),
type,
attrs.getValue(MappedAttributes.LOCALE),
+ described.getName(),
+ described.getDescription(),
accessPermissions,
editPermission,
Collections.unmodifiableMap(properties),
@@ -348,6 +354,10 @@
ProtectedResource pr = dst.adapt(ProtectedResource.class);
pr.setAccessPermissions(src.getAccessPermissions());
pr.setEditPermission(src.getEditPermission());
+
+ Described described = dst.adapt(Described.class);
+ described.setName(src.getLabel());
+ described.setDescription(src.getDescription());
//
org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");
Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -48,12 +48,18 @@
/** . */
private final ContainerData portalLayout;
-
+
+ private final String label;
+
+ private final String description;
+
public PortalData(
String storageId,
String name,
String type,
String locale,
+ String label,
+ String description,
List<String> accessPermissions,
String editPermission,
Map<String, String> properties,
@@ -65,6 +71,8 @@
//
this.key = new PortalKey(type, name);
this.locale = locale;
+ this.label = label;
+ this.description = description;
this.accessPermissions = accessPermissions;
this.editPermission = editPermission;
this.properties = properties;
@@ -116,4 +124,14 @@
{
return portalLayout;
}
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
}
Modified: portal/branches/site-describability/component/portal/src/main/resources/binding.xml
===================================================================
--- portal/branches/site-describability/component/portal/src/main/resources/binding.xml 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/resources/binding.xml 2011-04-08 07:24:45 UTC (rev 6180)
@@ -104,7 +104,9 @@
<mapping name="portal-config" class="org.exoplatform.portal.config.model.PortalConfig" ordered="false">
<value name="portal-name" field="name"/>
- <value name="locale" field="locale"/>
+ <value name="label" field="label" default="" />
+ <value name="description" field="description" default="" />
+ <value name="locale" field="locale" />
<value name="access-permissions" field="accessPermissions" usage="optional"/>
<value name="edit-permission" field="editPermission" usage="optional"/>
<value name="skin" field="skin" usage="optional"/>
Modified: portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -117,10 +117,14 @@
public void testCreatePortal() throws Exception
{
+ String label = "portal_foo";
+ String description = "This is new portal for testing";
PortalConfig portal = new PortalConfig();
portal.setType("portal");
portal.setName("foo");
portal.setLocale("en");
+ portal.setLabel(label);
+ portal.setDescription(description);
portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
//
@@ -130,6 +134,8 @@
assertNotNull(portal);
assertEquals("portal", portal.getType());
assertEquals("foo", portal.getName());
+ assertEquals(label, portal.getLabel());
+ assertEquals(description, portal.getDescription());
}
public void testPortalConfigSave() throws Exception
Modified: portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
===================================================================
--- portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java 2011-04-08 07:24:45 UTC (rev 6180)
@@ -159,6 +159,8 @@
"foo02",
"foo03",
"foo04",
+ "foo10",
+ "foo11",
Arrays.asList("foo05"),
"foo06",
Collections.singletonMap("foo07", "foo08"),
Modified: portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml
===================================================================
--- portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml 2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml 2011-04-08 07:24:45 UTC (rev 6180)
@@ -25,6 +25,8 @@
<locale>en</locale>
<access-permissions>Everyone</access-permissions>
<edit-permission>*:/platform/administrators</edit-permission>
+ <label>Classic</label>
+ <description>This is classic portal for testing</description>
<portal-layout>
<application>
13 years, 9 months
gatein SVN: r6179 - in epp/docs/branches/5.1/User_Guide: en-US and 1 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-04-07 19:52:39 -0400 (Thu, 07 Apr 2011)
New Revision: 6179
Modified:
epp/docs/branches/5.1/User_Guide/en-US/Book_Info.xml
epp/docs/branches/5.1/User_Guide/en-US/Revision_History.xml
epp/docs/branches/5.1/User_Guide/en-US/modules/portal/Manage_Portals.xml
epp/docs/branches/5.1/User_Guide/publican.cfg
Log:
JBEPP-871: Added links to JBDS and Ref Guide to 'Edit Layout' sect.
Modified: epp/docs/branches/5.1/User_Guide/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/5.1/User_Guide/en-US/Book_Info.xml 2011-04-07 23:50:42 UTC (rev 6178)
+++ epp/docs/branches/5.1/User_Guide/en-US/Book_Info.xml 2011-04-07 23:52:39 UTC (rev 6179)
@@ -7,7 +7,7 @@
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.1</productnumber>
<edition>1</edition>
- <pubsnumber>5.1</pubsnumber>
+ <pubsnumber>5.2</pubsnumber>
<abstract>
<para>
This document provides an easy to follow guide to the functions and
Modified: epp/docs/branches/5.1/User_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.1/User_Guide/en-US/Revision_History.xml 2011-04-07 23:50:42 UTC (rev 6178)
+++ epp/docs/branches/5.1/User_Guide/en-US/Revision_History.xml 2011-04-07 23:52:39 UTC (rev 6179)
@@ -8,6 +8,20 @@
<simpara>
<revhistory>
<revision>
+ <revnumber>1-5.2</revnumber>
+ <date>Thu Apr 7 2011</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Added reference to JBDS Portlet Tools Guide to section 5.2.3.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ <revision>
<revnumber>1-5.1</revnumber>
<date>Tue Dec 21 2010</date>
<author>
Modified: epp/docs/branches/5.1/User_Guide/en-US/modules/portal/Manage_Portals.xml
===================================================================
--- epp/docs/branches/5.1/User_Guide/en-US/modules/portal/Manage_Portals.xml 2011-04-07 23:50:42 UTC (rev 6178)
+++ epp/docs/branches/5.1/User_Guide/en-US/modules/portal/Manage_Portals.xml 2011-04-07 23:52:39 UTC (rev 6179)
@@ -161,7 +161,7 @@
</section>
<section id="proc-User_Guide-Manage_Portals-Edit_Layout">
- <title>Edit Layout</title>
+ <title>Edit Layout - PLEASE REVIEW</title>
<para>
To edit the layout of a portal, click the <emphasis>Edit Layout</emphasis> key beside the active portal you wish to edit:
</para>
@@ -198,6 +198,14 @@
<para>
Click the <guilabel>Finish</guilabel> or <guilabel>Abort</guilabel> buttons on the <emphasis role="bold">Edit Inline Composer</emphasis> window to save or discard your changes. <inlinemediaobject><imageobject><imagedata fileref="images/FinishAbortButtons.png"/></imageobject></inlinemediaobject>
</para>
+<remark>DOCS NOTE: The note below was added in response to JBEPP-871 (a customer suggestion). If you feel that it is extraneous or erroneous, please that back via the JIRA.
+</remark>
+ <note>
+ <title>Custom Portlets</title>
+ <para>
+ If you wish to include a custom portlet or gadget on a page, refer to the <emphasis>JBoss Portlet Tools User Guide</emphasis> in the JBoss Developer Studio documentation (<ulink type="http" url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/4.0/"></ulink>) and/or the <emphasis role="bold">Portlet development</emphasis> section of the <emphasis>&PRODUCT; Reference Guide</emphasis> (<ulink type="http" url="http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.1"></ulink>) for more information about creating and deploying portlets.
+ </para>
+ </note>
</section>
Modified: epp/docs/branches/5.1/User_Guide/publican.cfg
===================================================================
--- epp/docs/branches/5.1/User_Guide/publican.cfg 2011-04-07 23:50:42 UTC (rev 6178)
+++ epp/docs/branches/5.1/User_Guide/publican.cfg 2011-04-07 23:52:39 UTC (rev 6179)
@@ -4,7 +4,5 @@
xml_lang: en-US
type: Book
brand: JBoss
-#chunk_section_depth: 1
-chunk_first: 1
debug:1
-
+show_remarks: 1
13 years, 9 months
gatein SVN: r6178 - in epp/docs/branches/5.1/Reference_Guide/en-US: modules/AuthenticationAndIdentity and 1 other directory.
by do-not-reply@jboss.org
Author: smumford
Date: 2011-04-07 19:50:42 -0400 (Thu, 07 Apr 2011)
New Revision: 6178
Removed:
epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-openldap.xml
Modified:
epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-msad.xml
epp/docs/branches/5.1/Reference_Guide/en-US/modules/AuthenticationAndIdentity/LDAP.xml
Log:
Refined new LDAP content
Modified: epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-msad.xml
===================================================================
--- epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-msad.xml 2011-04-07 19:57:54 UTC (rev 6177)
+++ epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-msad.xml 2011-04-07 23:50:42 UTC (rev 6178)
@@ -1,28 +1,5 @@
- <repository>
- <id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>HibernateStore</default-identity-store-id>
- <default-attribute-store-id>HibernateStore</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>PortalLDAPStore</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>msad_roles_type</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>readOnly</name>
- <value>true</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
\ No newline at end of file
+ <identity-store-id>PortalLDAPStore</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>msad_roles_type</identity-object-type>
+ </identity-object-types>
Deleted: epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-openldap.xml
===================================================================
--- epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-openldap.xml 2011-04-07 19:57:54 UTC (rev 6177)
+++ epp/docs/branches/5.1/Reference_Guide/en-US/extras/Authentication_Identity_LDAP/readonly-openldap.xml 2011-04-07 23:50:42 UTC (rev 6178)
@@ -1,29 +0,0 @@
-<repository>
- <id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>HibernateStore</default-identity-store-id>
- <default-attribute-store-id>HibernateStore</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>PortalLDAPStore</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>acme_roles_type</identity-object-type>
- <identity-object-type>acme_ou_type</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>readOnly</name>
- <value>true</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
\ No newline at end of file
Modified: epp/docs/branches/5.1/Reference_Guide/en-US/modules/AuthenticationAndIdentity/LDAP.xml
===================================================================
--- epp/docs/branches/5.1/Reference_Guide/en-US/modules/AuthenticationAndIdentity/LDAP.xml 2011-04-07 19:57:54 UTC (rev 6177)
+++ epp/docs/branches/5.1/Reference_Guide/en-US/modules/AuthenticationAndIdentity/LDAP.xml 2011-04-07 23:50:42 UTC (rev 6178)
@@ -30,8 +30,6 @@
The following table is a list of Directory Servers that are supported and certified in &PRODUCT;.
</para>
-<remark>DOCS NOTE: Are these still the correct versions of the various Directory Servers supported in EPP? And how can I find that info out for myself?</remark>
-
<table>
<title>Supported and Certified directory servers</title>
<tgroup cols="2">
@@ -90,6 +88,11 @@
</tbody>
</tgroup>
</table>
+<!-- Source Metadata
+URL: http://www.jboss.com/products/platforms/portals/testedconfigurations/
+Author [w/email]: Red Hat Inc
+License:
+-->
<note>
<title>Examples</title>
<para>
@@ -103,38 +106,26 @@
<section id="sect-Reference_Guide-LDAP-LDAP_in_Readonly_Mode">
<title>LDAP in Readonly Mode</title>
<para>
- This section describes how to add LDAP users and organizations to &PRODUCT;.
+ This section will show you how to add LDAP in readonly mode. This means that user data entries (both pre-existing, and newly added through the &PRODUCT; User Interface) will be consumed though the Directory Server and LDAP services, but written to the underlying database. The only exception is that passwords updated via the UI will also be propagated into the appropriate LDAP entry.
</para>
- <para>
- This section will show you how to add LDAP in readonly mode. This means that user data entries (both pre-existing, and newly added through the &PRODUCT; User Interface) will be consumed though the Directory Server and LDAP services, but written to the underlying database.
- </para>
-
-<remark>DOCS NOTE: Is the above paragraph an accurate description of LDAP in Readonly mode? The Wiki original was a little unclear on this.
-</remark>
-<!-- Original draft content. Can be removed if current para gets approval.
- <para>
- All default accounts and groups that are already configured in &PRODUCT; will be created in the underlying database and the LDAP service will be configured in <emphasis>readonly</emphasis> mode. This means that, while users and groups will be consumed from the directory server, all new entries created using &PRODUCT;'s User Interface will be stored in the database.
- </para> -->
<procedure id="Reference_Guide-LDAP-LDAP_in_Readonly_Mode-LDAP_Set_Up">
<title>LDAP Set Up</title>
<step>
- <para>
- Install and populate your LDAP server.
- </para>
- <para>
- If you are installing the Red Hat Directory Server, you should refer to the Installation Guide at <ulink type="http" url="http://docs.redhat.com/docs/en-US/Red_Hat_Directory_Server/index.html"></ulink>.
- </para>
- <para>
- If you are using a third party directory server (OpenDS, OpenLDAP or MSAD), refer the appropriate documentation for that product.
- </para>
<substeps>
<step>
<para>
+ Install your <application>LDAP</application> server.
+ </para>
+ <para>
+ If you are installing the <application>Red Hat Directory Server</application> (RHDS), you should refer to the Installation Guide at <ulink type="http" url="http://docs.redhat.com/docs/en-US/Red_Hat_Directory_Server/index.html"></ulink>.
+ </para>
+ <para>
+ If you are using a third party directory server (<application>OpenDS</application>, <application>OpenLDAP</application> or <application>Miscrosoft Active Directory</application> (MSAD)), refer the appropriate documentation for that product.
+ </para>
+ <para>
The following values provide an example of working configuration settings for the different Directory Servers:
</para>
-<remark>DOCS NOTE: This table is a little light, using the info in the wiki article. Where can I find more settings (I've looked into documentation for the products). Alternatively, if this is straightforward for administrators, can this part be removed?
-</remark>
<table>
<title></title>
<tgroup cols="8">
@@ -265,12 +256,20 @@
</tbody>
</tgroup>
</table>
+ <para>
+ These, and other appropriate settings, should be adjusted to suit your circumstances.
+ </para>
</step>
<step>
<para>
- Start the Directory Server and, if desired, import an <filename>ldif</filename> file.
+ <emphasis role="bold">Optional</emphasis>: Import an <filename>ldif</filename> file and populate the Directory Server.
</para>
</step>
+ <step>
+ <para>
+ Start the Directory Server.
+ </para>
+ </step>
</substeps>
</step>
<step>
@@ -280,7 +279,7 @@
</step>
<step>
<para>
- Open the <filename><replaceable>LDAP_HOME</replaceable>/WEB-INF/conf/organization/idm-configuration.xml</filename> file and choose a procedure below depending on which Directory Server you are implementing.
+ Open the <filename><replaceable>LDAP_HOME</replaceable>/WEB-INF/conf/organization/idm-configuration.xml</filename> file and edit it as described below (depending on which Directory Server you are implementing):
</para>
<itemizedlist>
<listitem>
@@ -299,23 +298,29 @@
</para>
</listitem>
</itemizedlist>
-
-<remark>DOCS NOTE: Rather than re-write the same steps in theree procedures, I tried forking the one procedure in three directions. This is an EXPERIMENT! Let me know how you think it works.
-</remark>
<procedure id="proc-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-RHDS_or_OpenDS">
<title>Red Hat Directory Server or OpenDS</title>
<step>
<para>
- Uncomment the line under "<emphasis role="bold">Read Only "ACME" LDAP Example</emphasis>":
+ Uncomment the line under "<emphasis>Read Only "ACME" LDAP Example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<!--Read Only "ACME" LDAP Example-->
<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml</value>
]]></programlisting>
+<remark>DOCS NOTE: Once a 'value' line has been uncommented, does the current/previous 'value' line need to be commented?</remark>
+<para>
+</para>
+<remark>Currently the <parameter>config</parameter> value-param has <parameter>war:/conf/organization/picketlink-idm/picketlink-idm-config.xml</parameter> uncommented.
+</remark>
+<para>
+</para>
+<remark>Can the <filename>idm-configuration.xml</filename> file have two unobscured <parameter>value</parameter> entries under <parameter>config</parameter>?
+</remark>
</step>
<step>
<para>
- Uncomment the <emphasis>groupTypeMappings</emphasis> under "<emphasis role="bold">Uncomment for ACME LDAP example</emphasis>":
+ Uncomment the <parameter>groupTypeMappings</parameter> under "<emphasis>Uncomment for ACME LDAP example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<entry>
<key><string>/acme/roles/*</string></key>
@@ -326,36 +331,8 @@
<value><string>acme_ou_type</string></value>
</entry>
]]></programlisting>
- <para >
- These <emphasis>groupTypeMappings</emphasis> correspond to <emphasis>identity-object-type</emphasis> options defined in the <filename>picketlink-idm-ldap-acme-config.xml</filename> file (referenced above in <emphasis role="bold">Sub-step a</emphasis>):
- </para>
-
- <programlistingco>
- <areaspec>
- <areaset id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-opends" coords="">
- <area coords="10 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-users-opends" />
- <area coords="14 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-groups-opends" />
- </areaset>
- <area coords="17 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-readonly-opends" />
- </areaspec>
-<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-opends.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <calloutlist>
- <!--#1-->
- <callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-opends">
- <para>
- The PicketLink IDM configuration file dictates that users and those two group types be stored in LDAP.
- </para>
- </callout>
- <!--#2-->
- <callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-readonly-opends">
- <para>
- An additional option defines that nothing else (except password updates) should be written there.
- </para>
- </callout>
- </calloutlist>
- </programlistingco>
<para>
- All groups under <emphasis role="bold">/acme/roles</emphasis> will be stored in PicketLink IDM with the <emphasis role="bold">acme_roles_type</emphasis> group type name and groups under <emphasis role="bold">/acme/organization_units</emphasis> will be stored in PicketLink IDM with <emphasis role="bold">acme_ou_type group</emphasis> type name.
+ Refer to <xref linkend="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-groupTypeMappings"/> for more information about how these <parameter>groupTypeMappings</parameter> operate.
</para>
</step>
<step>
@@ -369,15 +346,15 @@
<title>Microsoft Active Directory</title>
<step>
<para>
- Uncomment the line under "<emphasis role="bold">MSAD Read Only "ACME" LDAP Example</emphasis>":
+ Uncomment the line under "<emphasis>MSAD Read Only "ACME" LDAP Example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<!--MSAD Read Only "ACME" LDAP Example-->
-<!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml</value>-->
+<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml</value>
]]></programlisting>
</step>
<step>
<para>
- Uncomment the <emphasis>groupTypeMappings</emphasis> under "<emphasis role="bold">Uncomment for MSAD ReadOnly LDAP example</emphasis>":
+ Uncomment the <parameter>groupTypeMappings</parameter> under "<emphasis>Uncomment for MSAD ReadOnly LDAP example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<entry>
<key><string>/acme/roles/*</string></key>
@@ -385,9 +362,13 @@
</entry>
]]></programlisting>
<para>
- These <emphasis>groupTypeMappings</emphasis> correspond to <emphasis>identity-object-type</emphasis> options defined in the <filename>picketlink-idm-msad-readonly-config.xml</filename> file (referenced above in <emphasis role="bold">Sub-step a</emphasis>):
+ Refer to <xref linkend="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-groupTypeMappings"/> for more information about how these <parameter>groupTypeMappings</parameter> operate.
</para>
+<!-- <para>
+ These <parameter>groupTypeMappings</parameter> correspond to <emphasis>identity-object-type</emphasis>s defined in the <filename>picketlink-idm-msad-readonly-config.xml</filename> file (referenced in <emphasis role="bold">Sub-step a</emphasis>):
+ </para>
+
<programlistingco>
<areaspec>
<areaset id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-MSAD" coords="">
@@ -398,13 +379,11 @@
</areaspec>
<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-msad.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<calloutlist>
- <!--#1-->
<callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-MSAD">
<para>
The PicketLink IDM configuration file dictates that users and those two group types be stored in LDAP.
</para>
</callout>
- <!--#2-->
<callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-readonly-MSAD">
<para>
An additional option defines that nothing else (except password updates) should be written there.
@@ -414,28 +393,28 @@
</programlistingco>
<para>
All groups under <emphasis role="bold">/acme/roles</emphasis> will be stored in PicketLink IDM with the <emphasis role="bold">acme_roles_type</emphasis> group type name and groups under <emphasis role="bold">/acme/organization_units</emphasis> will be stored in PicketLink IDM with <emphasis role="bold">acme_ou_type group</emphasis> type name.
- </para>
- </step>
+ </para> -->
+ </step>
<step>
<para>
Continue to <xref linkend="step-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-LDAP_Set_Up-Step-4"/>.
</para>
- </step>
+ </step>
</procedure>
<procedure id="proc-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-OpenLDAP">
<title>OpenLDAP</title>
<step>
<para>
- Uncomment the line under "<emphasis role="bold">OpenLDAP ReadOnly "ACME" LDAP Example</emphasis>":
+ Uncomment the line under "<emphasis>OpenLDAP ReadOnly "ACME" LDAP Example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<!--OpenLDAP ReadOnly "ACME" LDAP Example-->
-<!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml</value>-->
+<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-openldap-acme-config.xml</value>
]]></programlisting>
</step>
<step>
<para>
- Uncomment the <emphasis>groupTypeMappings</emphasis> under "<emphasis role="bold">Uncomment for ACME LDAP example</emphasis>":
+ Uncomment the <parameter>groupTypeMappings</parameter> under "<emphasis>Uncomment for ACME LDAP example</emphasis>":
</para>
<programlisting language="XML" role="XML"><![CDATA[<entry>
<key><string>/acme/roles/*</string></key>
@@ -447,9 +426,13 @@
</entry>
]]></programlisting>
<para>
- These <emphasis>groupTypeMappings</emphasis> correspond to <emphasis>identity-object-type</emphasis> options defined in the <filename>picketlink-idm-ldap-acme-config.xml</filename> file (referenced above in <emphasis role="bold">Sub-step a</emphasis>):
+ Refer to <xref linkend="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-groupTypeMappings"/> for more information about how these <parameter>groupTypeMappings</parameter> operate.
</para>
+<!-- <para>
+ These <parameter>groupTypeMappings</parameter> correspond to <emphasis>identity-object-type</emphasis>s defined in the <filename>picketlink-idm-ldap-acme-config.xml</filename> file (referenced in <emphasis role="bold">Sub-step a</emphasis>):
+ </para>
+
<programlistingco>
<areaspec>
<areaset id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-OpenLDAP" coords="">
@@ -458,15 +441,13 @@
</areaset>
<area coords="17 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-readonly-OpenLDAP" />
</areaspec>
-<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-openldap.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-opends.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<calloutlist>
- <!--#1-->
<callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-OpenLDAP">
<para>
The PicketLink IDM configuration file dictates that users and those two group types be stored in LDAP.
</para>
</callout>
- <!--#2-->
<callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-config-readonly-OpenLDAP">
<para>
An additional option defines that nothing else (except password updates) should be written there.
@@ -476,7 +457,7 @@
</programlistingco>
<para>
All groups under <emphasis role="bold">/acme/roles</emphasis> will be stored in PicketLink IDM with the <emphasis role="bold">acme_roles_type</emphasis> group type name and groups under <emphasis role="bold">/acme/organization_units</emphasis> will be stored in PicketLink IDM with <emphasis role="bold">acme_ou_type group</emphasis> type name.
- </para>
+ </para> -->
</step>
<step>
<para>
@@ -488,6 +469,14 @@
<step id="step-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-LDAP_Set_Up-Step-4">
<para>
+ To use a different LDAP server or directory data, edit the DS-specific <filename>.xml</filename> file you uncommented in <emphasis role="bold">Substep 3a</emphasis> above and change the values to suit your requirements.
+ </para>
+ <para>
+ Refer to the list in <xref linkend="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-LDAP_configuration_options"/> for some examples or refer to the product-specific documentation for more information.
+ </para>
+ </step>
+ <step>
+ <para>
Start the server.
</para>
</step>
@@ -534,115 +523,190 @@
</step>
</procedure>
-
<para>
Users defined in LDAP should be visable in "<emphasis>Users and groups management</emphasis>" and groups from LDAP should be present as children of <emphasis>/acme/roles</emphasis> and <emphasis>/acme/organization_units</emphasis>.
</para>
<para>
- To use a different LDAP server or directory data, edit the <filename><replaceable>LDAP_HOME</replaceable>/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml</filename> file and change the following values to suit your requirements:
+ More information about configuration can be found in <xref linkend="sect-Reference_Guide-PicketLink_IDM_integration"/> and in the PicketLink project <ulink type="http" url="http://anonsvn.jboss.org/repos/picketlink/idm/downloads/docs/1.0.0.GA/Ref...">Reference Guide</ulink>.
</para>
- <variablelist>
- <title>LDAP configuration options:</title>
-
-<remark>DOCS NOTE: Again, I tried collapsing content into one place, as opposed to three. Is this confusing?
-</remark>
-
- <varlistentry>
- <term>ctxDNs</term>
- <listitem>
+ <section>
+ <title>Examples</title>
+ <example id="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-LDAP_configuration_options">
+ <title>LDAP configuration</title>
<para>
- This is the DN that will be used as context for <emphasis>IdentityObject</emphasis> searches. More than one value can be specified.
+ The following settings are stored in the Picketlink configuration file that is nominated in the <filename>idm-configuration.xml</filename> file of your deployment (under the <parameter>config</parameter> parameter of the <parameter>PicketLinkIDMService</parameter> component):
</para>
<para>
- Some examples are:
+ This file could be:
</para>
<itemizedlist>
- <listitem>
- <para>
- ou=People,o=acme,dc=example,dc=com
- </para>
- </listitem>
- <listitem>
- <para>
- ou=Roles,o=acme,dc=example,dc=com
- </para>
- </listitem>
- <listitem>
- <para>
- ou=OrganizationUnits,o=acme,dc=example,dc=com
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis role="bold">MSAD</emphasis>: CN=Users,DC=test,DC=domain (in two places)
- </para>
- </listitem>
+ <listitem>
+ <para>
+ The default <filename>picketlink-idm-config.xml</filename>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ One of the three example configuration files discussed in <xref linkend="Reference_Guide-LDAP-LDAP_in_Readonly_Mode-LDAP_Set_Up"/>:
+ </para>
+ <simplelist>
+ <member><filename>picketlink-idm-ldap-acme-config.xml</filename></member>
+ <member><filename>picketlink-idm-msad-readonly-config.xml</filename></member>
+ <member><filename>picketlink-idm-openldap-acme-config.xml</filename></member>
+ </simplelist>
+ </listitem>
+ <listitem>
+ <para>
+ A custom file created by modifying one of the above files.
+ </para>
+ </listitem>
</itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>providerURL</term>
- <listitem>
+ <variablelist>
+ <title>Configuration options</title>
+ <varlistentry>
+ <term>ctxDNs</term>
+ <listitem>
+ <para>
+ This is the DN that will be used as context for <emphasis>IdentityObject</emphasis> searches. More than one value can be specified.
+ </para>
+ <para>
+ Some examples are:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ ou=People,o=acme,dc=example,dc=com
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ ou=Roles,o=acme,dc=example,dc=com
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ ou=OrganizationUnits,o=acme,dc=example,dc=com
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">MSAD</emphasis>: CN=Users,DC=test,DC=domain (in two places)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>providerURL</term>
+ <listitem>
+ <para>
+ The LDAP server connection URL. Formatted as "ldap://localhost:<replaceable><PORT></replaceable>". The default setting is: <emphasis>ldap://localhost:1389</emphasis>.
+ </para>
+ <para>
+ <emphasis role="bold">MSAD</emphasis>: Should use SSL connection (ldaps://xxx:636) if password update or entry creation is expected to work.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>adminDN</term>
+ <listitem>
+ <para>
+ The LDAP entry used to connect to the server.
+ </para>
+ <para>
+ Some possible values are:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis role="bold">RHDS or OpenDS</emphasis>: cn=Directory Manager
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">OpenLDAP</emphasis>: cn=Manager,dc=my-domain,dc=com
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">MSAD</emphasis>: TEST\Administrator
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>adminPassword</term>
+ <listitem>
+ <para>
+ The password associated with the <emphasis role="bold">adminDN</emphasis>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>customSystemProperties</term>
+ <listitem>
+ <para>
+ This option defines the values needed to use SSL encryption with LDAP.
+ </para>
+ <para>
+ To use it, ensure that it is is uncommented and that the path to the <filename>.truststore</filename> file and passward are correct.
+ </para>
+<remark>DOCS NOTE: I didn't include the <emphasis>keytool</emphasis> command or the code snippet here, as
+</remark>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </example>
+<!-- Source Metadata
+URL: http://anonsvn.jboss.org/repos/picketlink/idm/downloads/docs/1.0.0.GA/Ref...
+Author [w/email]: Bolesław Dawidowicz (bdawidow(a)redhat.com), Jeff Yu
+License: ??
+-->
+ <example id="exam-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-groupTypeMappings">
+ <title>groupTypeMappings</title>
<para>
- The LDAP server connection URL. Formatted as "ldap://localhost:<replaceable><PORT></replaceable>". The default setting is: <emphasis>ldap://localhost:1389</emphasis>.
+ The <parameter>groupTypeMappings</parameter> exposed in the <filename>idm-configuration.xml</filename> file correspond to <parameter>identity-object-type</parameter> values defined in the DS-specific configuration file referenced in <emphasis>Sub-step 3a</emphasis> of the DS-specific procedure.
</para>
<para>
- <emphasis role="bold">MSAD</emphasis>: Should use SSL connection (ldaps://xxx:636) if password update or entry creation is expected to work.
+ For RHDS, OpenDS and OpenLDAP the <filename>picketlink-idm-ldap-acme-config.xml</filename> and <filename>picketlink-idm-openldap-acme-config.xml</filename> files contain the following values:
</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>adminDN</term>
- <listitem>
+ <programlistingco>
+ <areaspec>
+ <areaset id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-opends" coords="">
+ <area coords="10 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-users-opends" />
+ <area coords="14 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-groups-opends" />
+ </areaset>
+ <area coords="17 40" id="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-readonly-opends" />
+ </areaspec>
+<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-opends.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <calloutlist>
+ <!--#1-->
+ <callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-opends">
+ <para>
+ The PicketLink IDM configuration file dictates that users and those two group types be stored in LDAP.
+ </para>
+ </callout>
+ <!--#2-->
+ <callout arearefs="area-Reference_Guide-LDAP-LDAP_in_Readonly_Mode-Examples-config-readonly-opends">
+ <para>
+ An additional option defines that nothing else (except password updates) should be written there.
+ </para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+
<para>
- The LDAP entry used to connect to the server.
+ All groups under <emphasis role="bold">/acme/roles</emphasis> will be stored in PicketLink IDM with the <emphasis role="bold">acme_roles_type</emphasis> group type name and groups under <emphasis role="bold">/acme/organization_units</emphasis> will be stored in PicketLink IDM with <emphasis role="bold">acme_ou_type group</emphasis> type name.
</para>
<para>
- Some possible values are:
+ For MSAD, the <parameter>identity-object-types</parameter> values in <filename>picketlink-idm-msad-readonly-config.xml</filename> change to:
</para>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis role="bold">RHDS or OpenDS</emphasis>: cn=Directory Manager
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis role="bold">OpenLDAP</emphasis>: cn=Manager,dc=my-domain,dc=com
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis role="bold">MSAD</emphasis>: TEST\Administrator
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>adminPassword</term>
- <listitem>
+<programlisting language="XML" role="XML"><xi:include href="../../extras/Authentication_Identity_LDAP/readonly-msad.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
- The password associated with the <emphasis role="bold">adminDN</emphasis>.
+ The difference is that this configuration maps only one group type and points to the same container in LDAP for both users and mapped groups.
</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>customSystemProperties</term>
- <listitem>
- <para>
- <emphasis role="bold">MSAD</emphasis>: option if SSL connection is configured.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-<!-- Source Metadata
-URL: http://anonsvn.jboss.org/repos/picketlink/idm/downloads/docs/1.0.0.GA/Ref...
-Author [w/email]: Bolesław Dawidowicz (bdawidow(a)redhat.com), Jeff Yu
-License: ??
--->
- <para>
- More information about configuration can be found in <xref linkend="sect-Reference_Guide-PicketLink_IDM_integration"/> and in the PicketLink project <ulink type="http" url="http://anonsvn.jboss.org/repos/picketlink/idm/downloads/docs/1.0.0.GA/Ref...">Reference Guide</ulink>.
- </para>
+ </example>
+ </section>
</section>
</section>
\ No newline at end of file
13 years, 9 months
gatein SVN: r6177 - components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-07 15:57:54 -0400 (Thu, 07 Apr 2011)
New Revision: 6177
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
Log:
- GTNPC-58: Fixed improper tests that were actually passing due to too lenient implementation of PortletContext.
Modified: components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-07 17:25:59 UTC (rev 6176)
+++ components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-07 19:57:54 UTC (rev 6177)
@@ -1099,10 +1099,8 @@
PortletContext portletContext = importedPortlet.getContext();
- //make sure the expected portlet context and the one we get back from the import are the same
-// assertEquals(originalPortletContext.getComponents().getApplicationName(), portletContext.getComponents().getApplicationName());
-// assertEquals(originalPortletContext.getComponents().getPortletName(), portletContext.getComponents().getPortletName());
- assertEquals(originalPortletContext, portletContext);
+ //check that the portlet info for the original and new imported portlet are the same (which is assumed to ensure that the contexts refer to the same portlet)
+ assertEquals(getPortlet(originalPortletContext).getInfo(), getPortlet(portletContext).getInfo());
if (originalPortletContext instanceof StatefulPortletContext)
{
13 years, 9 months
gatein SVN: r6176 - in components/pc/trunk: api/src/test/java/org/gatein/pc/api and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-07 13:25:59 -0400 (Thu, 07 Apr 2011)
New Revision: 6176
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
Log:
- GTNPC-58: Added support for consumer clones.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-07 15:45:49 UTC (rev 6175)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-07 17:25:59 UTC (rev 6176)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.api;
import org.gatein.common.util.ParameterValidation;
@@ -39,8 +39,14 @@
private static final char SEPARATOR = '.';
public static final String PRODUCER_CLONE_ID_PREFIX = "_";
+ public static final int PRODUCER_CLONE_PREFIX_LENGTH = PRODUCER_CLONE_ID_PREFIX.length();
+
+ public static final String CONSUMER_CLONE_ID_PREFIX = "@";
+ public static final int CONSUMER_CLONE_PREFIX_LENGTH = CONSUMER_CLONE_ID_PREFIX.length();
+
public static final String CONSUMER_CLONE_DUMMY_STATE_ID = "dumbvalue";
public static final String CONSUMER_CLONE_ID = PRODUCER_CLONE_ID_PREFIX + CONSUMER_CLONE_DUMMY_STATE_ID;
+
public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + SEPARATOR + CONSUMER_CLONE_ID);
protected final String id;
@@ -79,12 +85,12 @@
isSimpleAppPortlet = separator != -1 && appName.length() > 0 && portletName.length() > 0;
if (isSimpleAppPortlet)
{
- components = new PortletContextComponents(null, appName, portletName, false);
+ components = new PortletContextComponents(null, appName, portletName, null);
}
}
else
{
- if (!trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ if (!(trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX) || trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX)))
{
int invoker = trimmedId.indexOf(SEPARATOR);
int prefix = trimmedId.indexOf(PREFIX);
@@ -106,7 +112,7 @@
isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
if (isCompoundAppPortlet)
{
- components = new PortletContextComponents(invokerId, applicationName, portletName, false);
+ components = new PortletContextComponents(invokerId, applicationName, portletName, null);
}
}
}
@@ -123,15 +129,22 @@
if (portletNameOrStateId.length() > 0)
{
- if (portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ boolean isProducerClone = portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = portletNameOrStateId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
{
- isCloned = true;
- components = new PortletContextComponents(invokerId, null, portletNameOrStateId.substring(PRODUCER_CLONE_ID_PREFIX.length()).trim(), true);
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ portletNameOrStateId = portletNameOrStateId.substring(prefixLength).trim();
+ if (portletNameOrStateId.length() > 0)
+ {
+ isCloned = true;
+ components = new PortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
+ }
}
else
{
isOpaquePortlet = true;
- components = new PortletContextComponents(invokerId, null, portletNameOrStateId, false);
+ components = new PortletContextComponents(invokerId, null, portletNameOrStateId, null);
}
}
}
@@ -139,11 +152,17 @@
}
else
{
- String stateId = trimmedId.substring(PRODUCER_CLONE_ID_PREFIX.length()).trim();
- isCloned = stateId.length() > 0;
- if (isCloned)
+ boolean isProducerClone = trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
{
- components = new PortletContextComponents(null, null, stateId, true);
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ trimmedId = trimmedId.substring(prefixLength).trim();
+ if (trimmedId.length() > 0)
+ {
+ isCloned = true;
+ components = new PortletContextComponents(null, null, trimmedId, isProducerClone);
+ }
}
}
}
@@ -269,7 +288,7 @@
applicationName = applicationName.substring(1);
}
- return new PortletContext(new PortletContextComponents(null, applicationName, portletName, false));
+ return new PortletContext(new PortletContextComponents(null, applicationName, portletName, null));
}
public PortletContextComponents getComponents()
@@ -282,11 +301,13 @@
private final String applicationName;
private final String portletName;
private final String invokerName;
- private final boolean cloned;
+ private final Boolean producerCloned;
- public PortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, boolean cloned)
+ public PortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
{
- if (cloned && !ParameterValidation.isNullOrEmpty(applicationName))
+ this.producerCloned = producerCloned;
+
+ if (isCloned() && !ParameterValidation.isNullOrEmpty(applicationName))
{
throw new IllegalArgumentException("Cannot be a clone if applicationName is provided");
}
@@ -294,7 +315,6 @@
this.applicationName = applicationName;
this.portletName = portletNameOrStateId;
this.invokerName = invokerName;
- this.cloned = cloned;
}
public String getApplicationName()
@@ -314,9 +334,19 @@
public boolean isCloned()
{
- return cloned;
+ return producerCloned != null;
}
+ public boolean isProducerCloned()
+ {
+ return isCloned() && producerCloned;
+ }
+
+ public boolean isConsumerCloned()
+ {
+ return isCloned() && !producerCloned;
+ }
+
public String getStateId()
{
return isCloned() ? portletName : null;
@@ -326,7 +356,7 @@
{
return (invokerName == null ? "" : invokerName + SEPARATOR)
+ (applicationName == null ? "" : PREFIX + applicationName + SEPARATOR)
- + (portletName == null ? "" : (cloned ? PRODUCER_CLONE_ID_PREFIX : "") + portletName);
+ + (portletName == null ? "" : (producerCloned != null ? (producerCloned ? PRODUCER_CLONE_ID_PREFIX : CONSUMER_CLONE_ID_PREFIX) : "") + portletName);
}
}
}
Modified: components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-07 15:45:49 UTC (rev 6175)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-07 17:25:59 UTC (rev 6176)
@@ -1,24 +1,25 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.api;
@@ -185,30 +186,40 @@
assertEquals("foo", context.getId());
}
- public void testAcceptClones()
+ public void testAcceptProducerClones()
{
- PortletContext context = PortletContext.createPortletContext("_clone");
- assertEquals("_clone", context.getId());
- PortletContext.PortletContextComponents components = context.getComponents();
+ PortletContext context;
+ PortletContext.PortletContextComponents components;
+
+ checkClones(PortletContext.PRODUCER_CLONE_ID_PREFIX);
+
+ context = PortletContext.createPortletContext("foo." + PortletContext.CONSUMER_CLONE_ID);
+ assertEquals("foo." + PortletContext.CONSUMER_CLONE_ID, context.getId());
+ components = context.getComponents();
assertNotNull(components);
- assertNull(components.getInvokerName());
+ assertEquals("foo", components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
assertTrue(components.isCloned());
- assertEquals("clone", components.getStateId());
+ assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ }
- context = PortletContext.createPortletContext("foo._clone");
- assertEquals("foo._clone", context.getId());
+ private void checkClones(String clonePrefix)
+ {
+ PortletContext context;
+ PortletContext.PortletContextComponents components;
+ context = PortletContext.createPortletContext(clonePrefix + "clone");
+ assertEquals(clonePrefix + "clone", context.getId());
components = context.getComponents();
assertNotNull(components);
- assertEquals("foo", components.getInvokerName());
+ assertNull(components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
assertTrue(components.isCloned());
assertEquals("clone", components.getStateId());
- context = PortletContext.createPortletContext("foo \t \n. _ \t\nclone");
- assertEquals("foo._clone", context.getId());
+ context = PortletContext.createPortletContext("foo." + clonePrefix + "clone");
+ assertEquals("foo." + clonePrefix + "clone", context.getId());
components = context.getComponents();
assertNotNull(components);
assertEquals("foo", components.getInvokerName());
@@ -217,19 +228,24 @@
assertTrue(components.isCloned());
assertEquals("clone", components.getStateId());
- context = PortletContext.createPortletContext("foo." + PortletContext.CONSUMER_CLONE_ID);
- assertEquals("foo." + PortletContext.CONSUMER_CLONE_ID, context.getId());
+ context = PortletContext.createPortletContext("foo \t \n. " + clonePrefix + " \t\nclone");
+ assertEquals("foo." + clonePrefix + "clone", context.getId());
components = context.getComponents();
assertNotNull(components);
assertEquals("foo", components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
assertTrue(components.isCloned());
- assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ assertEquals("clone", components.getStateId());
}
- public void testAcceptConsumerClone()
+ public void testAcceptConsumerClones()
{
+ checkClones(PortletContext.CONSUMER_CLONE_ID_PREFIX);
+ }
+
+ public void testAcceptLocalConsumerClone()
+ {
PortletContext.PortletContextComponents components = PortletContext.LOCAL_CONSUMER_CLONE.getComponents();
assertNotNull(components);
assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, components.getInvokerName());
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-04-07 15:45:49 UTC (rev 6175)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-04-07 17:25:59 UTC (rev 6176)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.pc.portlet.state.consumer;
import org.gatein.common.NotYetImplemented;
@@ -55,9 +55,6 @@
{
/** . */
- private static final String CLONE_ID_PREFIX = "@";
-
- /** . */
private ConsumerPersistenceManager persistenceManager;
public PortletContext unwrapCCP(String wrappedCCP) throws InvalidPortletIdException
@@ -66,11 +63,11 @@
{
throw new IllegalArgumentException();
}
- if (!wrappedCCP.startsWith(CLONE_ID_PREFIX))
+ if (!wrappedCCP.startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
throw new InvalidPortletIdException(wrappedCCP);
}
- return PortletContext.createPortletContext(wrappedCCP.substring(CLONE_ID_PREFIX.length()));
+ return PortletContext.createPortletContext(wrappedCCP.substring(PortletContext.CONSUMER_CLONE_ID_PREFIX.length()));
}
public PortletContext unwrapPOP(String wrappedPOPId) throws InvalidPortletIdException
@@ -88,7 +85,7 @@
{
throw new IllegalArgumentException();
}
- return CLONE_ID_PREFIX + ccpCtx.getId();
+ return PortletContext.CONSUMER_CLONE_ID_PREFIX + ccpCtx.getId();
}
public String wrapPOP(PortletContext popCtx) throws InvalidPortletIdException
@@ -97,9 +94,9 @@
{
throw new IllegalArgumentException();
}
- if (popCtx.getId().startsWith(CLONE_ID_PREFIX))
+ if (popCtx.getId().startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
- throw new IllegalArgumentException("Must not start with " + CLONE_ID_PREFIX);
+ throw new IllegalArgumentException("Must not start with " + PortletContext.CONSUMER_CLONE_ID_PREFIX);
}
return popCtx.getId();
}
@@ -157,7 +154,7 @@
// Save the clone state
ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), stateType, state);
String stateId = persistenceManager.createState(consumerState);
- String clonedId = CLONE_ID_PREFIX + stateId;
+ String clonedId = PortletContext.CONSUMER_CLONE_ID_PREFIX + stateId;
StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedId), StateEvent.Type.PORTLET_CLONED_EVENT);
cictx.onStateEvent(event);
}
@@ -217,7 +214,7 @@
StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), statefulClonedContext.getType(), statefulClonedContext.getState());
String id = persistenceManager.createState(consumerState);
- return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ return PortletContext.createPortletContext(PortletContext.CONSUMER_CLONE_ID_PREFIX + id);
}
else
{
@@ -237,7 +234,7 @@
StatefulPortletContext statefulimportContext = (StatefulPortletContext)importContext;
ConsumerState consumerState = new ConsumerState<Serializable>(importContext.getId(), statefulimportContext.getType(), statefulimportContext.getState());
String id = persistenceManager.createState(consumerState);
- return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ return PortletContext.createPortletContext(PortletContext.CONSUMER_CLONE_ID_PREFIX + id);
}
else
{
@@ -413,9 +410,9 @@
String portletId = portletContext.getId();
//
- if (portletId.startsWith(CLONE_ID_PREFIX))
+ if (portletId.startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX))
{
- String stateId = portletId.substring(CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.CONSUMER_CLONE_ID_PREFIX.length());
try
{
ConsumerStateContext stateCtx = persistenceManager.loadState(stateId);
Modified: components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-07 15:45:49 UTC (rev 6175)
+++ components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2011-04-07 17:25:59 UTC (rev 6176)
@@ -1100,8 +1100,9 @@
PortletContext portletContext = importedPortlet.getContext();
//make sure the expected portlet context and the one we get back from the import are the same
- assertEquals(originalPortletContext.getComponents().getApplicationName(), portletContext.getComponents().getApplicationName());
- assertEquals(originalPortletContext.getComponents().getPortletName(), portletContext.getComponents().getPortletName());
+// assertEquals(originalPortletContext.getComponents().getApplicationName(), portletContext.getComponents().getApplicationName());
+// assertEquals(originalPortletContext.getComponents().getPortletName(), portletContext.getComponents().getPortletName());
+ assertEquals(originalPortletContext, portletContext);
if (originalPortletContext instanceof StatefulPortletContext)
{
Modified: components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-04-07 15:45:49 UTC (rev 6175)
+++ components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2011-04-07 17:25:59 UTC (rev 6176)
@@ -271,6 +271,6 @@
assertEquals(PortletStatus.MANAGED, producer.getStatus(ccp2Ctx));
// inexistent portlet
- assertNull(producer.getStatus(PortletContext.createPortletContext("foo")));
+ assertNull(producer.getStatus(PortletContext.createPortletContext("/foo.bar")));
}
}
13 years, 9 months
gatein SVN: r6175 - in components/pc/trunk: api/src/test/java/org/gatein/pc/api and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-07 11:45:49 -0400 (Thu, 07 Apr 2011)
New Revision: 6175
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
Log:
- GTNPC-58: Added support for clones. Moved cloning constants to PortletContext so that they can be used elsewhere.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-07 15:02:19 UTC (rev 6174)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-07 15:45:49 UTC (rev 6175)
@@ -38,10 +38,10 @@
private static final String PREFIX = "/";
private static final char SEPARATOR = '.';
- /* TODO: remove from ProducerPortletInvoker so that we can use these constants in GateIn
- public static final String CONSUMER_CLONE_ID = "_dumbvalue";
public static final String PRODUCER_CLONE_ID_PREFIX = "_";
- public final static PortletContext CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + SEPARATOR + CONSUMER_CLONE_ID);*/
+ public static final String CONSUMER_CLONE_DUMMY_STATE_ID = "dumbvalue";
+ public static final String CONSUMER_CLONE_ID = PRODUCER_CLONE_ID_PREFIX + CONSUMER_CLONE_DUMMY_STATE_ID;
+ public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + SEPARATOR + CONSUMER_CLONE_ID);
protected final String id;
private final PortletContextComponents components;
@@ -59,6 +59,7 @@
boolean isSimpleAppPortlet = false;
boolean isOpaquePortlet = false;
boolean isCompoundAppPortlet = false;
+ boolean isCloned = false;
// components
if (interpret)
@@ -78,46 +79,71 @@
isSimpleAppPortlet = separator != -1 && appName.length() > 0 && portletName.length() > 0;
if (isSimpleAppPortlet)
{
- components = new PortletContextComponents(null, appName, portletName);
+ components = new PortletContextComponents(null, appName, portletName, false);
}
}
else
{
- int invoker = trimmedId.indexOf(SEPARATOR);
- int prefix = trimmedId.indexOf(PREFIX);
+ if (!trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ {
+ int invoker = trimmedId.indexOf(SEPARATOR);
+ int prefix = trimmedId.indexOf(PREFIX);
- if (prefix != -1)
- {
- // check if we have the case: invokerId./something
- if (invoker > 0 && invoker < prefix)
+ if (prefix != -1)
{
+ // check if we have the case: invokerId./something
+ if (invoker > 0 && invoker < prefix)
+ {
+ String invokerId = trimmedId.substring(0, invoker).trim();
+
+ int separator = trimmedId.indexOf(SEPARATOR, prefix);
+ // check the case: invokerId./application.portlet
+ if (separator != -1)
+ {
+ String portletName = trimmedId.substring(separator + 1).trim();
+ trimmedId = trimmedId.substring(invoker + 1).trim();
+ String applicationName = trimmedId.substring(1, trimmedId.indexOf(SEPARATOR)).trim();
+ isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
+ if (isCompoundAppPortlet)
+ {
+ components = new PortletContextComponents(invokerId, applicationName, portletName, false);
+ }
+ }
+ }
+ }
+
+ // check if we have the case: invokerId.something
+ if (!isCompoundAppPortlet && invoker > 0)
+ {
String invokerId = trimmedId.substring(0, invoker).trim();
- int separator = trimmedId.indexOf(SEPARATOR, prefix);
- // check the case: invokerId./application.portlet
- if (separator != -1)
+ if (invokerId.length() > 0)
{
- String portletName = trimmedId.substring(separator + 1).trim();
- trimmedId = trimmedId.substring(invoker + 1).trim();
- String applicationName = trimmedId.substring(1, trimmedId.indexOf(SEPARATOR)).trim();
- isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
- if (isCompoundAppPortlet)
+ String portletNameOrStateId = trimmedId.substring(invoker + 1).trim();
+
+ if (portletNameOrStateId.length() > 0)
{
- components = new PortletContextComponents(invokerId, applicationName, portletName);
+ if (portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ {
+ isCloned = true;
+ components = new PortletContextComponents(invokerId, null, portletNameOrStateId.substring(PRODUCER_CLONE_ID_PREFIX.length()).trim(), true);
+ }
+ else
+ {
+ isOpaquePortlet = true;
+ components = new PortletContextComponents(invokerId, null, portletNameOrStateId, false);
+ }
}
}
}
}
-
- // check if we have the case: invokerId.portletId
- if (!isCompoundAppPortlet && invoker > 0)
+ else
{
- String invokerId = trimmedId.substring(0, invoker).trim();
- String portletName = trimmedId.substring(invoker + 1).trim();
- isOpaquePortlet = invokerId.length() > 0 && portletName.length() > 0;
- if (isOpaquePortlet)
+ String stateId = trimmedId.substring(PRODUCER_CLONE_ID_PREFIX.length()).trim();
+ isCloned = stateId.length() > 0;
+ if (isCloned)
{
- components = new PortletContextComponents(invokerId, null, portletName);
+ components = new PortletContextComponents(null, null, stateId, true);
}
}
}
@@ -128,7 +154,7 @@
}
}
- if (interpret && !(isSimpleAppPortlet || isCompoundAppPortlet || isOpaquePortlet))
+ if (interpret && !(isSimpleAppPortlet || isCompoundAppPortlet || isOpaquePortlet || isCloned))
{
throw new IllegalArgumentException("Couldn't interpret id '" + id + "'");
}
@@ -203,9 +229,14 @@
public static PortletContext createPortletContext(String portletId)
{
- return createPortletContext(portletId, null, true);
+ return createPortletContext(portletId, true);
}
+ public static PortletContext createPortletContext(String portletId, boolean interpret)
+ {
+ return createPortletContext(portletId, null, interpret);
+ }
+
public static PortletContext createPortletContext(String portletId, byte[] state, boolean interpret)
{
if (state != null && state.length > 0)
@@ -238,7 +269,7 @@
applicationName = applicationName.substring(1);
}
- return new PortletContext(new PortletContextComponents(null, applicationName, portletName));
+ return new PortletContext(new PortletContextComponents(null, applicationName, portletName, false));
}
public PortletContextComponents getComponents()
@@ -251,12 +282,19 @@
private final String applicationName;
private final String portletName;
private final String invokerName;
+ private final boolean cloned;
- public PortletContextComponents(String invokerName, String applicationName, String portletName)
+ public PortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, boolean cloned)
{
+ if (cloned && !ParameterValidation.isNullOrEmpty(applicationName))
+ {
+ throw new IllegalArgumentException("Cannot be a clone if applicationName is provided");
+ }
+
this.applicationName = applicationName;
- this.portletName = portletName;
+ this.portletName = portletNameOrStateId;
this.invokerName = invokerName;
+ this.cloned = cloned;
}
public String getApplicationName()
@@ -266,7 +304,7 @@
public String getPortletName()
{
- return portletName;
+ return isCloned() ? null : portletName;
}
public String getInvokerName()
@@ -274,11 +312,21 @@
return invokerName;
}
+ public boolean isCloned()
+ {
+ return cloned;
+ }
+
+ public String getStateId()
+ {
+ return isCloned() ? portletName : null;
+ }
+
public String getId()
{
return (invokerName == null ? "" : invokerName + SEPARATOR)
+ (applicationName == null ? "" : PREFIX + applicationName + SEPARATOR)
- + (portletName == null ? "" : portletName);
+ + (portletName == null ? "" : (cloned ? PRODUCER_CLONE_ID_PREFIX : "") + portletName);
}
}
}
Modified: components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-07 15:02:19 UTC (rev 6174)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-07 15:45:49 UTC (rev 6175)
@@ -39,6 +39,8 @@
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext("\t\t\n /applicationName.portletName \t");
assertEquals("/applicationName.portletName", context.getId());
@@ -47,6 +49,8 @@
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
try
{
@@ -65,6 +69,8 @@
assertEquals("applicationName", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext("/applicationName.portlet.Name");
assertEquals("/applicationName.portlet.Name", context.getId());
@@ -73,6 +79,8 @@
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portlet.Name", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
try
{
@@ -91,6 +99,8 @@
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portlet Name", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
}
public void testPortletContextWithInvokerId()
@@ -102,6 +112,8 @@
assertEquals("local", components.getInvokerName());
assertEquals("foo", components.getApplicationName());
assertEquals("bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext(" local\t . / foo \t. \t\n bar");
assertEquals("local./foo.bar", context.getId());
@@ -110,6 +122,8 @@
assertEquals("local", components.getInvokerName());
assertEquals("foo", components.getApplicationName());
assertEquals("bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext("local.foo.bar");
assertEquals("local.foo.bar", context.getId());
@@ -118,6 +132,8 @@
assertEquals("local", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("foo.bar", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
context = PortletContext.createPortletContext("local./foo");
assertEquals("local./foo", context.getId());
@@ -126,6 +142,8 @@
assertEquals("local", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("/foo", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
}
public void testCreateFromComponents()
@@ -140,6 +158,8 @@
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
assertEquals(context, fromId);
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
}
public void testShouldProperlyHandleApplicationNameStartingWithSlash()
@@ -153,9 +173,72 @@
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
+ assertFalse(components.isCloned());
+ assertNull(components.getStateId());
assertEquals(context, fromId);
}
+ public void testShouldWorkWithoutInterpretation()
+ {
+ PortletContext context = PortletContext.createPortletContext("foo", false);
+ assertNull(context.getComponents());
+ assertEquals("foo", context.getId());
+ }
+
+ public void testAcceptClones()
+ {
+ PortletContext context = PortletContext.createPortletContext("_clone");
+ assertEquals("_clone", context.getId());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertNull(components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+
+ context = PortletContext.createPortletContext("foo._clone");
+ assertEquals("foo._clone", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+
+ context = PortletContext.createPortletContext("foo \t \n. _ \t\nclone");
+ assertEquals("foo._clone", context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals("clone", components.getStateId());
+
+ context = PortletContext.createPortletContext("foo." + PortletContext.CONSUMER_CLONE_ID);
+ assertEquals("foo." + PortletContext.CONSUMER_CLONE_ID, context.getId());
+ components = context.getComponents();
+ assertNotNull(components);
+ assertEquals("foo", components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ }
+
+ public void testAcceptConsumerClone()
+ {
+ PortletContext.PortletContextComponents components = PortletContext.LOCAL_CONSUMER_CLONE.getComponents();
+ assertNotNull(components);
+ assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, components.getInvokerName());
+ assertNull(components.getApplicationName());
+ assertNull(components.getPortletName());
+ assertTrue(components.isCloned());
+ assertEquals(PortletContext.CONSUMER_CLONE_DUMMY_STATE_ID, components.getStateId());
+ }
+
public void testCreateFromNullOrEmpty()
{
try
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-04-07 15:02:19 UTC (rev 6174)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-04-07 15:45:49 UTC (rev 6175)
@@ -73,12 +73,6 @@
{
/** . */
- private static final String PRODUCER_CLONE_ID_PREFIX = "_";
-
- /** . */
- private static final String CONSUMER_CLONE_ID = "_dumbvalue";
-
- /** . */
private PortletStatePersistenceManager persistenceManager;
/** . */
@@ -160,7 +154,7 @@
String portletId = portletContext.getId();
//
- if (CONSUMER_CLONE_ID.equals(portletId))
+ if (PortletContext.CONSUMER_CLONE_ID.equals(portletId))
{
if (portletContext instanceof StatefulPortletContext)
{
@@ -184,11 +178,11 @@
throw new InvalidPortletIdException("", portletId);
}
}
- else if (portletId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ else if (portletId.startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
try
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
PortletStateContext stateContext = persistenceManager.loadState(stateId);
PortletState state = stateContext.getState();
Portlet delegate = super.getPortlet(PortletContext.createPortletContext(state.getPortletId()));
@@ -300,7 +294,7 @@
String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
@@ -333,7 +327,7 @@
String cloneStateId = persistenceManager.createState(context.getPortletId(), newPrefs);
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
@@ -418,8 +412,8 @@
{
try
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
- String cloneId = PRODUCER_CLONE_ID_PREFIX + persistenceManager.cloneState(stateId);
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + persistenceManager.cloneState(stateId);
return PortletContext.createPortletContext(cloneId);
}
catch (NoSuchStateException e)
@@ -443,7 +437,7 @@
if (persistLocally)
{
String cloneId = persistenceManager.createState(portletId, newState);
- return PortletContext.createPortletContext(PRODUCER_CLONE_ID_PREFIX + cloneId);
+ return PortletContext.createPortletContext(PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneId);
}
else
{
@@ -467,7 +461,7 @@
if (!(portletContext instanceof StatefulPortletContext))
{
String portletId = portletContext.getId();
- if (!portletId.startsWith(PRODUCER_CLONE_ID_PREFIX))
+ if (!portletId.startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
log.debug("Attempt to destroy a producer offered portlet " + portletId);
DestroyCloneFailure failure = new DestroyCloneFailure(portletId, "Cannot destroy POP");
@@ -477,7 +471,7 @@
{
try
{
- persistenceManager.destroyState(portletId.substring(PRODUCER_CLONE_ID_PREFIX.length()));
+ persistenceManager.destroyState(portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length()));
}
catch (NoSuchStateException e)
{
@@ -733,7 +727,7 @@
String cloneStateId = persistenceManager.createState(statefulPortletContext.getId(), portletState.getProperties());
// Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ String cloneId = PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneStateId;
return PortletContext.createPortletContext(cloneId);
}
else
@@ -758,7 +752,7 @@
{
PortletState sstate = new PortletState(portletId, props);
S marshalledState = stateConverter.marshall(stateType, sstate);
- return StatefulPortletContext.create(CONSUMER_CLONE_ID, stateType, marshalledState);
+ return StatefulPortletContext.create(PortletContext.CONSUMER_CLONE_ID, stateType, marshalledState);
}
catch (StateConversionException e)
{
@@ -816,9 +810,9 @@
if (!(portletContext instanceof StatefulPortletContext))
{
String portletId = portletContext.getId();
- if (portletContext.getId().startsWith(PRODUCER_CLONE_ID_PREFIX))
+ if (portletContext.getId().startsWith(PortletContext.PRODUCER_CLONE_ID_PREFIX))
{
- String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
+ String stateId = portletId.substring(PortletContext.PRODUCER_CLONE_ID_PREFIX.length());
try
{
PortletStateContext stateContext = persistenceManager.loadState(stateId);
13 years, 9 months