gatein SVN: r539 - in portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin: portal/webui/component/view/UIDashboard and 2 other directories.
by do-not-reply@jboss.org
Author: thuy.nguyen
Date: 2009-11-10 03:19:20 -0500 (Tue, 10 Nov 2009)
New Revision: 539
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/UIPortalApplicationSkin.css
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/AddDashboard.gif
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/NavUser.gif
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/TabDashboard.gif
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UITabSystem/UITabs/Stylesheet.css
Log:
GTNPORTAL-89: Some improvements when add new tab in Dashboard page
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/UIPortalApplicationSkin.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/UIPortalApplicationSkin.css 2009-11-10 08:11:13 UTC (rev 538)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/UIPortalApplicationSkin.css 2009-11-10 08:19:20 UTC (rev 539)
@@ -80,7 +80,22 @@
.RightBlock {
float: right; /* orientation=lt */
float: left; /* orientation=rt */
-}
+}
+
+
+.ClearFix:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.ClearFix {
+ !display: inline-block;
+ !zoom: 1;
+ !display: block;
+}
.InlineContainer {
overflow: hidden;
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css 2009-11-10 08:11:13 UTC (rev 538)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css 2009-11-10 08:19:20 UTC (rev 539)
@@ -63,29 +63,26 @@
}
.UITabPaneDashboard .LtTabDashboard {
- background: url('background/NavUser.gif') no-repeat left top;
+ background: #ffcf01 url('background/NavUser.gif') no-repeat left top;
padding-left: 3px;
- height: 32px;
}
.UITabPaneDashboard .RtTabDashboard {
- background: url('background/NavUser.gif') no-repeat right top;
+ background: #ffcf01 url('background/NavUser.gif') no-repeat right top;
padding-right: 3px;
- height: 32px;
}
.UITabPaneDashboard .CtTabDashboard {
- height: 32px;
- background: url('background/NavUser.gif') repeat-x center bottom;
+ background: #ffcf01 url('background/NavUser.gif') repeat-x center -32px;
padding: 0px 6px;
}
.UITabPaneDashboard .UIHorizontalTabs {
- padding-top: 10px;
+ padding: 5px 0 8px;
}
.UITabPaneDashboard .UIHorizontalTabs .TabsContainer {
- height: 25px;
+ height: auto;
}
.UITabPaneDashboard .UIHorizontalTabs .GrayTabStyle .NormalTab .MiddleTab,
@@ -108,7 +105,8 @@
background: url('background/AddDashboard.gif') no-repeat bottom;
width: 34px; height: 22px;
float: left;
- cursor: pointer;
+ cursor: pointer;
+ margin-top: 4px;
}
.UITabPaneDashboard .UIHorizontalTabs .GrayTabStyle .NormalTab .LeftTab {
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/AddDashboard.gif
===================================================================
(Binary files differ)
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/NavUser.gif
===================================================================
(Binary files differ)
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/background/TabDashboard.gif
===================================================================
(Binary files differ)
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UITabSystem/UITabs/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UITabSystem/UITabs/Stylesheet.css 2009-11-10 08:11:13 UTC (rev 538)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UITabSystem/UITabs/Stylesheet.css 2009-11-10 08:19:20 UTC (rev 539)
@@ -308,8 +308,8 @@
/***************************** GrayTabStyle ************************/
.UIHorizontalTabs .GrayTabStyle {
- margin-right: 2px; /* orientation=lt */
- margin-left: 2px; /* orientation=rt */
+ margin: 4px 2px 0 0; /* orientation=lt */
+ margin: 4px 0 0 2px; /* orientation=rt */
}
.UIHorizontalTabs .GrayTabStyle .NormalTab .LeftTab {
15 years, 2 months
gatein SVN: r538 - in portal/trunk/component/portal/src: test/java/org/exoplatform/portal/config and 1 other directory.
by do-not-reply@jboss.org
Author: tam_nguyen
Date: 2009-11-10 03:11:13 -0500 (Tue, 10 Nov 2009)
New Revision: 538
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
Log:
GTNPORTAL-119 Problem when clone node
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-11-10 04:15:32 UTC (rev 537)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-11-10 08:11:13 UTC (rev 538)
@@ -151,6 +151,15 @@
org.gatein.mop.api.workspace.Page dstPage = dstPages.addChild(cloneName);
//
+
+ Attributes srcAttrs = srcPage.getAttributes();
+ Attributes dstAttrs = dstPage.getAttributes();
+ for (String key : srcAttrs.getKeys())
+ {
+ Object value = srcAttrs.getObject(key);
+ dstAttrs.setObject(key, value);
+ }
+
copy(srcPage, dstPage, srcPage.getRootComponent(), dstPage.getRootComponent());
//
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-10 04:15:32 UTC (rev 537)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-10 08:11:13 UTC (rev 538)
@@ -465,7 +465,7 @@
// Julien : see who added that and find out is test is relevant or not
-/*
+
public void testClonePage()
{
new UnitTest()
@@ -486,8 +486,8 @@
}
}.execute(null);
}
-*/
+
public void testUpdatePage()
{
15 years, 2 months
gatein SVN: r537 - portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2009-11-09 23:15:32 -0500 (Mon, 09 Nov 2009)
New Revision: 537
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/OrganizationUtils.java
Log:
GTNPORTAL-217: Bug on Logo portlet
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/OrganizationUtils.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/OrganizationUtils.java 2009-11-10 00:15:24 UTC (rev 536)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/OrganizationUtils.java 2009-11-10 04:15:32 UTC (rev 537)
@@ -33,6 +33,8 @@
public class OrganizationUtils
{
+ private static String cachedGroupLabel;
+
static public String getGroupLabel(String groupId) throws Exception
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
@@ -40,8 +42,12 @@
OrganizationService orgService =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
Group group = orgService.getGroupHandler().findGroupById(groupId);
+ if(group == null){
+ return cachedGroupLabel;
+ }
String label = group.getLabel();
- return (label != null && label.trim().length() > 0) ? label : group.getGroupName();
+ cachedGroupLabel = (label != null && label.trim().length() > 0 )? label : group.getGroupName();
+ return cachedGroupLabel;
}
}
15 years, 2 months
gatein SVN: r536 - portal/trunk.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-11-09 19:15:24 -0500 (Mon, 09 Nov 2009)
New Revision: 536
Modified:
portal/trunk/pom.xml
Log:
GTNPORTAL-111 : Add a controle to not forget to set ${exo.projects.directory.src}
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2009-11-10 00:14:10 UTC (rev 535)
+++ portal/trunk/pom.xml 2009-11-10 00:15:24 UTC (rev 536)
@@ -158,6 +158,33 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>check-environment-ready</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>exo.projects.directory.src</property>
+ <message>"You must define the property exo.projects.directory.src to give the path of the root of your working area"</message>
+ </requireProperty>
+ <requireFilesExist>
+ <files>
+ <file>${exo.projects.directory.src}/gatein/portal/trunk/web/portal/src/main/webapp</file>
+ </files>
+ <message>"The following directory doesn't exist : ${exo.projects.directory.src}/gatein/portal/trunk/web/portal/src/main/webapp"</message>
+ </requireFilesExist>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
15 years, 2 months
gatein SVN: r534 - in portal/trunk/component/portal/src: main/java/org/exoplatform/portal/pom/config and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-09 19:09:39 -0500 (Mon, 09 Nov 2009)
New Revision: 534
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/CloneApplicationState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/Injector.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
Log:
GTNPORTAL-216 : start to rewrite application registry
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/CloneApplicationState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/CloneApplicationState.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/CloneApplicationState.java 2009-11-10 00:09:39 UTC (rev 534)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class CloneApplicationState<S> extends ApplicationState<S>
+{
+
+ /** . */
+ private final String storageId;
+
+ public CloneApplicationState(String storageId)
+ {
+ this.storageId = storageId;
+ }
+
+ public String getStorageId()
+ {
+ return storageId;
+ }
+}
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/Injector.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/Injector.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/Injector.java 2009-11-10 00:09:39 UTC (rev 534)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config;
+
+import org.chromattic.api.event.LifeCycleListener;
+import org.exoplatform.portal.pom.registry.CategoryDefinition;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Injector implements LifeCycleListener
+{
+
+ /** . */
+ private final POMSession session;
+
+ public Injector(POMSession session)
+ {
+ this.session = session;
+ }
+
+ public void created(Object o)
+ {
+ }
+
+ public void loaded(String id, String path, String name, Object o)
+ {
+ if (o instanceof CategoryDefinition)
+ {
+ ((CategoryDefinition)o).session = session;
+ }
+ }
+
+ public void added(String id, String path, String name, Object o)
+ {
+ if (o instanceof CategoryDefinition)
+ {
+ ((CategoryDefinition)o).session = session;
+ }
+ }
+
+ public void removed(String id, String path, String name, Object o)
+ {
+ if (o instanceof CategoryDefinition)
+ {
+ ((CategoryDefinition)o).session = null;
+ }
+ }
+}
Added: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java (rev 0)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java 2009-11-10 00:09:39 UTC (rev 534)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.registry.CategoryDefinition;
+import org.exoplatform.portal.pom.registry.ContentDefinition;
+import org.exoplatform.portal.pom.registry.ContentRegistry;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.test.BasicTestCase;
+import org.gatein.mop.api.workspace.Workspace;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestContentRegistry extends BasicTestCase
+{
+
+ /** . */
+ private DataStorage storage;
+
+ /** . */
+ private POMSessionManager mgr;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ PortalContainer container = PortalContainer.getInstance();
+ storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ mgr.openSession();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ mgr.closeSession(false);
+ storage = null;
+ }
+
+ public void testGetContentRegistry()
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+ assertNotNull(registry);
+ }
+
+ public void testCreateCategory()
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+ CategoryDefinition category = registry.createCategory("foo");
+ assertNotNull(category);
+ assertSame(category, registry.getCategory("foo"));
+ }
+
+ public void testCreateContent()
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+ CategoryDefinition category = registry.createCategory("foo");
+ ContentDefinition content = category.createContent("bar", Preferences.CONTENT_TYPE, "myportlet");
+ assertNotNull(content);
+
+ // Test that we do have a customization shared at the workspace level
+ Workspace workspace = session.getWorkspace();
+ assertNotNull(workspace.getCustomization("bar"));
+ }
+
+}
15 years, 2 months
gatein SVN: r533 - in portal/trunk: component/application-registry/src/main/java/org/exoplatform/application/registry and 26 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-09 19:07:49 -0500 (Mon, 09 Nov 2009)
New Revision: 533
Added:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
portal/trunk/component/portal/src/main/java/conf/portal/portal-nodetypes.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/CategoryDefinition.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentDefinition.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentRegistry.java
Removed:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/DataMapper.java
portal/trunk/component/portal/src/main/java/conf/portal/content-nodetypes.xml
portal/trunk/component/portal/src/test/java/conf/portal/content-nodetypes.xml
portal/trunk/component/portal/src/test/java/conf/portal/model-nodetypes.xml
Modified:
portal/trunk/component/application-registry/src/main/java/conf/portal/configuration.xml
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/ApplicationRegistryServiceImpl.java
portal/trunk/component/application-registry/src/test/java/conf/portal/test-configuration.xml
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/PortalSessionLifeCycle.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java
portal/trunk/component/portal/src/test/java/conf/portal/jcr-configuration.xml
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScript.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScriptBuilder.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplate.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplateEngine.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateRuntimeException.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
Log:
GTNPORTAL-216 : start to rewrite the application registry
Modified: portal/trunk/component/application-registry/src/main/java/conf/portal/configuration.xml
===================================================================
--- portal/trunk/component/application-registry/src/main/java/conf/portal/configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/conf/portal/configuration.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -37,7 +37,7 @@
<component>
<key>org.exoplatform.application.registry.ApplicationRegistryService</key>
- <type>org.exoplatform.application.registry.jcr.ApplicationRegistryServiceImpl</type>
+ <type>org.exoplatform.application.registry.mop.MOPApplicationRegistryService</type>
</component>
Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -43,21 +43,52 @@
private ArrayList<String> accessPermissions;
- private String applicationGroup;
-
private String applicationName;
private String applicationType;
- private String uri;
+ /** . */
+ private String storageId;
- private int minWidthResolution;
+ /** . */
+ private String id;
+ /** . */
+ private String iconURL;
+
+ /** . */
+ private String contentId;
+
+ public String getContentId()
+ {
+ return contentId;
+ }
+
+ public void setContentId(String contentId)
+ {
+ this.contentId = contentId;
+ }
+
+ public String getStorageId()
+ {
+ return storageId;
+ }
+
+ public void setStorageId(String storageId)
+ {
+ this.storageId = storageId;
+ }
+
public String getId()
{
- return categoryName + "/" + applicationName;
+ return id;
}
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
public String getDisplayName()
{
return displayName;
@@ -121,16 +152,6 @@
return accessPermissions;
}
- public String getApplicationGroup()
- {
- return applicationGroup;
- }
-
- public void setApplicationGroup(String applicationGroup)
- {
- this.applicationGroup = applicationGroup;
- }
-
public String getApplicationName()
{
return applicationName;
@@ -151,23 +172,13 @@
this.applicationType = applicationType;
}
- public int getMinWidthResolution()
+ public String getIconURL()
{
- return minWidthResolution;
+ return iconURL;
}
- public void setMinWidthResolution(int minWidthResolution)
+ public void setIconURL(String iconURL)
{
- this.minWidthResolution = minWidthResolution;
+ this.iconURL = iconURL;
}
-
- public String getUri()
- {
- return uri;
- }
-
- public void setUri(String uri)
- {
- this.uri = uri;
- }
}
\ No newline at end of file
Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -41,9 +41,9 @@
private Date modifiedDate;
- private List<Application> applications;
+ private List<Application> applications = new ArrayList<Application>();
- private ArrayList<String> accessPermissions;
+ private List<String> accessPermissions = new ArrayList<String>();
public String getName()
{
@@ -105,15 +105,13 @@
this.applications = applications;
}
- public void setAccessPermissions(ArrayList<String> accessPerms)
+ public void setAccessPermissions(List<String> accessPerms)
{
accessPermissions = accessPerms;
}
- public ArrayList<String> getAccessPermissions()
+ public List<String> getAccessPermissions()
{
- if (accessPermissions == null)
- accessPermissions = new ArrayList<String>();
return accessPermissions;
}
Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -68,6 +68,4 @@
//TODO: dang.tung
public void importExoGadgets() throws Exception;
-
- public void clearAllRegistries() throws Exception;
}
\ No newline at end of file
Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/ApplicationRegistryServiceImpl.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/ApplicationRegistryServiceImpl.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/ApplicationRegistryServiceImpl.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -19,58 +19,16 @@
package org.exoplatform.application.registry.jcr;
-import org.exoplatform.application.gadget.Gadget;
-import org.exoplatform.application.gadget.GadgetRegistryService;
-import org.exoplatform.application.registry.Application;
-import org.exoplatform.application.registry.ApplicationCategoriesPlugins;
-import org.exoplatform.application.registry.ApplicationCategory;
-import org.exoplatform.application.registry.ApplicationRegistryService;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.component.ComponentPlugin;
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.services.jcr.ext.common.SessionProvider;
-import org.exoplatform.services.jcr.ext.registry.RegistryEntry;
-import org.exoplatform.services.jcr.ext.registry.RegistryService;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.organization.MembershipHandler;
-import org.exoplatform.services.organization.OrganizationService;
-import org.exoplatform.web.application.gadget.GadgetApplication;
-import org.gatein.common.i18n.LocalizedString;
-import org.gatein.common.util.Tools;
-import org.gatein.pc.api.Portlet;
-import org.gatein.pc.api.PortletInvoker;
-import org.gatein.pc.api.info.MetaInfo;
-import org.gatein.pc.api.info.PortletInfo;
-import org.picocontainer.Startable;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-
/**
* Created by The eXo Platform SARL
* Author : Tung Pham
* thanhtungty(a)gmail.com
* Nov 23, 2007
*/
-public class ApplicationRegistryServiceImpl implements ApplicationRegistryService, Startable
+public class ApplicationRegistryServiceImpl
{
+/*
static final private String APPLICATION_REGISTRY = "ApplicationRegistry";
static final private String CATEGORY_DATA = "CategoryData";
@@ -515,14 +473,6 @@
sessionProvider.close();
}
- public void clearAllRegistries() throws Exception
- {
- for (ApplicationCategory cate : getApplicationCategories())
- {
- remove(cate);
- }
- }
-
public void initListener(ComponentPlugin com) throws Exception
{
if (com instanceof ApplicationCategoriesPlugins)
@@ -648,5 +598,6 @@
return localizedString.getDefaultString();
}
}
+*/
}
Deleted: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/DataMapper.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/DataMapper.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/jcr/DataMapper.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -1,198 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.application.registry.jcr;
-
-import org.exoplatform.application.registry.Application;
-import org.exoplatform.application.registry.ApplicationCategory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Tung Pham
- * thanhtungty(a)gmail.com
- * Nov 23, 2007
- */
-public class DataMapper
-{
-
- final static String EXO_REGISTRYENTRY_NT = "exo:registryEntry";
-
- final static String PRIMARY_TYPE = "jcr:primaryType";
-
- static final String TYPE = "exo:type";
-
- static final String CATEGORY_NAME = "exo:name";
-
- static final String DESCRIPTION = "exo:description";
-
- static final String DISPLAY_NAME = "exo:displayName";
-
- static final String CREATED_DATE = "exo:createdDate";
-
- static final String MODIFIED_DATE = "exo:modifiedDate";
-
- static final String CATEGORY_ACCESS_PERMISSTION = "exo:categoryAccessPermissions";
-
- static final String APPLICATION_NAME = "exo:applicationName";
-
- static final String APPLICATION_TYPE = "exo:applicationType";
-
- static final String APPLICATION_GROUP = "exo:applicationGroup";
-
- static final String APPLICATION_CATEGORY_NAME = "exo:categoryName";
-
- static final String APPLICATION_MIN_WITH_RESOLUTION = "exo:minWidthResolution";
-
- static final String APPLICATION_ACCESS_PERMISSTION = "exo:accessPermissions";
-
- static final String APPLICATION_URI = "exo:uri";
-
- private DateFormat dateFormat = new SimpleDateFormat("yyyy MM dd'T'HH:mm:ss.SSS Z");
-
- public void map(Document doc, ApplicationCategory category) throws Exception
- {
- Element root = doc.getDocumentElement();
- prepareXmlNamespace(root);
- root.setAttribute(PRIMARY_TYPE, EXO_REGISTRYENTRY_NT);
- root.setAttribute(TYPE, category.getClass().getSimpleName());
- root.setAttribute(CATEGORY_NAME, category.getName());
- root.setAttribute(DISPLAY_NAME, category.getDisplayName());
- root.setAttribute(DESCRIPTION, category.getDescription());
- Date dateTime = category.getCreatedDate();
- if (dateTime == null)
- dateTime = new Date();
- root.setAttribute(CREATED_DATE, dateFormat.format(dateTime));
- dateTime = category.getModifiedDate();
- if (dateTime == null)
- dateTime = new Date();
- root.setAttribute(MODIFIED_DATE, dateFormat.format(dateTime));
- root.setAttribute(CATEGORY_ACCESS_PERMISSTION, toMultiValue(category.getAccessPermissions()));
- }
-
- public ApplicationCategory toApplicationCategory(Document doc) throws Exception
- {
- ApplicationCategory category = new ApplicationCategory();
- Element root = doc.getDocumentElement();
- category.setName(root.getAttribute(CATEGORY_NAME));
- category.setDisplayName(root.getAttribute(DISPLAY_NAME));
- category.setDescription(root.getAttribute(DESCRIPTION));
- category.setCreatedDate(parse(root.getAttribute(CREATED_DATE)));
- category.setModifiedDate(parse(root.getAttribute(MODIFIED_DATE)));
- category.setAccessPermissions(fromMultiValue(root.getAttribute(CATEGORY_ACCESS_PERMISSTION)));
- return category;
- }
-
- public void map(Document doc, Application application) throws Exception
- {
- Element root = doc.getDocumentElement();
- prepareXmlNamespace(root);
- root.setAttribute(PRIMARY_TYPE, EXO_REGISTRYENTRY_NT);
- root.setAttribute(TYPE, application.getClass().getSimpleName());
- root.setAttribute(APPLICATION_NAME, application.getApplicationName());
- root.setAttribute(APPLICATION_TYPE, application.getApplicationType());
- root.setAttribute(APPLICATION_GROUP, application.getApplicationGroup());
- root.setAttribute(APPLICATION_URI, application.getUri());
- root.setAttribute(DESCRIPTION, application.getDescription());
- root.setAttribute(DISPLAY_NAME, application.getDisplayName());
- root.setAttribute(APPLICATION_CATEGORY_NAME, application.getCategoryName());
- root.setAttribute(APPLICATION_MIN_WITH_RESOLUTION, String.valueOf(application.getMinWidthResolution()));
- Date dateTime = application.getCreatedDate();
- if (dateTime == null)
- dateTime = new Date();
- root.setAttribute(CREATED_DATE, dateFormat.format(dateTime));
- dateTime = application.getModifiedDate();
- if (dateTime == null)
- dateTime = new Date();
- root.setAttribute(MODIFIED_DATE, dateFormat.format(dateTime));
- root.setAttribute(APPLICATION_ACCESS_PERMISSTION, toMultiValue(application.getAccessPermissions()));
- }
-
- public Application toApplication(Document doc) throws Exception
- {
- Application application = new Application();
- Element root = doc.getDocumentElement();
- application.setApplicationName(root.getAttribute(APPLICATION_NAME));
- application.setApplicationType(root.getAttribute(APPLICATION_TYPE));
- application.setApplicationGroup(root.getAttribute(APPLICATION_GROUP));
- application.setUri(root.getAttribute(APPLICATION_URI));
- application.setDisplayName(root.getAttribute(DISPLAY_NAME));
- application.setDescription(root.getAttribute(DESCRIPTION));
- application.setCategoryName(root.getAttribute(APPLICATION_CATEGORY_NAME));
- application.setMinWidthResolution(Integer.parseInt(root.getAttribute(APPLICATION_MIN_WITH_RESOLUTION)));
- application.setCreatedDate(parse(root.getAttribute(CREATED_DATE)));
- application.setModifiedDate(parse(root.getAttribute(MODIFIED_DATE)));
- application.setAccessPermissions(fromMultiValue(root.getAttribute(APPLICATION_ACCESS_PERMISSTION)));
-
- return application;
- }
-
- private synchronized Date parse(String dateString) throws ParseException
- {
- return dateFormat.parse(dateString);
- }
-
- private String toMultiValue(List<String> list)
- {
- StringBuilder builder = new StringBuilder();
- int size = list.size();
- for (int i = 0; i < size; i++)
- {
- builder.append(list.get(i));
- if (i < (size - 1))
- builder.append(" ");
- }
- return builder.toString();
- }
-
- private ArrayList<String> fromMultiValue(String str)
- {
- ArrayList<String> list = new ArrayList<String>();
- String[] fragments = str.split(" ");
- for (String ele : fragments)
- {
- list.add(ele);
- }
- return list;
- }
-
- private void prepareXmlNamespace(Element element)
- {
- setXmlNameSpace(element, "xmlns:exo", "http://www.exoplatform.com/jcr/exo/1.0");
- setXmlNameSpace(element, "xmlns:jcr", "http://www.jcp.org/jcr/1.0");
- }
-
- private void setXmlNameSpace(Element element, String key, String value)
- {
- String xmlns = element.getAttribute(key);
- if (xmlns == null || xmlns.trim().length() < 1)
- {
- element.setAttribute(key, value);
- }
- }
-
-}
Added: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java (rev 0)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -0,0 +1,641 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.application.registry.mop;
+
+import org.exoplatform.application.gadget.Gadget;
+import org.exoplatform.application.gadget.GadgetRegistryService;
+import org.exoplatform.application.registry.Application;
+import org.exoplatform.application.registry.ApplicationCategoriesPlugins;
+import org.exoplatform.application.registry.ApplicationCategory;
+import org.exoplatform.application.registry.ApplicationRegistryService;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.registry.CategoryDefinition;
+import org.exoplatform.portal.pom.registry.ContentDefinition;
+import org.exoplatform.portal.pom.registry.ContentRegistry;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.wsrp.WSRP;
+import org.gatein.common.i18n.LocalizedString;
+import org.gatein.common.util.Tools;
+import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.pc.api.Portlet;
+import org.gatein.pc.api.PortletInvoker;
+import org.gatein.pc.api.info.MetaInfo;
+import org.gatein.pc.api.info.PortletInfo;
+import org.picocontainer.Startable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class MOPApplicationRegistryService implements ApplicationRegistryService, Startable
+{
+
+ /** . */
+ private static final String REMOTE_CATEGORY_NAME = "remote";
+
+ /** . */
+ private List<ApplicationCategoriesPlugins> plugins;
+
+ /** . */
+ private final POMSessionManager pomMGr;
+
+ public MOPApplicationRegistryService(POMSessionManager pomMGr)
+ {
+ this.pomMGr = pomMGr;
+ }
+
+ public void initListener(ComponentPlugin com) throws Exception
+ {
+ if (com instanceof ApplicationCategoriesPlugins)
+ {
+ if (plugins == null)
+ {
+ plugins = new ArrayList<ApplicationCategoriesPlugins>();
+ }
+ plugins.add((ApplicationCategoriesPlugins)com);
+ }
+ }
+
+ public List<ApplicationCategory> getApplicationCategories(
+ Comparator<ApplicationCategory> sortComparator,
+ String accessUser,
+ String... appTypes) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ List<ApplicationCategory> categories = new ArrayList<ApplicationCategory>();
+ for (CategoryDefinition categoryDef : registry.getCategoryList())
+ {
+ ApplicationCategory category = load(categoryDef, appTypes);
+ categories.add(category);
+ }
+
+ //
+ if (sortComparator != null)
+ {
+ Collections.sort(categories, sortComparator);
+ }
+
+ //
+ return categories;
+ }
+
+ public List<ApplicationCategory> getApplicationCategories(String accessUser, String... appTypes) throws Exception
+ {
+ return getApplicationCategories(null, accessUser, appTypes);
+ }
+
+ public List<ApplicationCategory> getApplicationCategories() throws Exception
+ {
+ return getApplicationCategories(null);
+ }
+
+ public List<ApplicationCategory> getApplicationCategories(Comparator<ApplicationCategory> sortComparator) throws Exception
+ {
+ return getApplicationCategories(sortComparator, null);
+ }
+
+ public ApplicationCategory getApplicationCategory(String name) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ CategoryDefinition categoryDef = registry.getCategory(name);
+ if (categoryDef != null)
+ {
+ return load(categoryDef);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void save(ApplicationCategory category) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ String categoryName = category.getName();
+
+ //
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ categoryDef = registry.createCategory(categoryName);
+ }
+
+ //
+ categoryDef.setDisplayName(category.getDisplayName());
+ categoryDef.setCreationDate(category.getCreatedDate());
+ categoryDef.setLastModificationDate(category.getModifiedDate());
+ categoryDef.setDescription(category.getDescription());
+ categoryDef.setAccessPermissions(category.getAccessPermissions());
+ }
+
+ public void remove(ApplicationCategory category) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ registry.getCategoryMap().remove(category.getName());
+ }
+
+ public List<Application> getApplications(ApplicationCategory category, String... appTypes) throws Exception
+ {
+ return getApplications(category, null, appTypes);
+ }
+
+ public List<Application> getApplications(
+ ApplicationCategory category,
+ Comparator<Application> sortComparator,
+ String... appTypes) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ CategoryDefinition categoryDef = registry.getCategory(category.getName());
+ List<Application> applications = load(categoryDef, appTypes).getApplications();
+
+ //
+ if (sortComparator != null)
+ {
+ Collections.sort(applications, sortComparator);
+ }
+
+ //
+ return applications;
+ }
+
+ public List<Application> getAllApplications() throws Exception
+ {
+ List<Application> applications = new ArrayList<Application>();
+ List<ApplicationCategory> categories = getApplicationCategories();
+ for (ApplicationCategory category : categories)
+ {
+ applications.addAll(getApplications(category));
+ }
+ return applications;
+ }
+
+ public Application getApplication(String id) throws Exception
+ {
+ String[] fragments = id.split("/");
+ if (fragments.length < 2)
+ {
+ throw new Exception("Invalid Application Id: [" + id + "]");
+ }
+ return getApplication(fragments[0], fragments[1]);
+ }
+
+ public Application getApplication(String category, String name) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ CategoryDefinition categoryDef = registry.getCategory(category);
+ if (categoryDef != null)
+ {
+ ContentDefinition contentDef = categoryDef.getContentMap().get(name);
+ if (contentDef != null)
+ {
+ return load(contentDef);
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public void save(ApplicationCategory category, Application application) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ String categoryName = category.getName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ categoryDef = registry.createCategory(categoryName);
+ save(category, categoryDef);
+ }
+
+ //
+ ContentDefinition contentDef = null;
+ CategoryDefinition applicationCategoryDef = registry.getCategory(application.getCategoryName());
+ String applicationName = application.getApplicationName();
+ if (applicationCategoryDef != null)
+ {
+ contentDef = applicationCategoryDef.getContentMap().get(applicationName);
+ }
+ if (contentDef == null)
+ {
+ String contentId = application.getContentId();
+ ContentType<?> contentType;
+ if ("portlet".equals(application.getApplicationType()))
+ {
+ contentType = Preferences.CONTENT_TYPE;
+ }
+ else if ("eXoGadget".equals(application.getApplicationType()))
+ {
+ contentType = org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE;
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Nnsupported type " + application.getApplicationType());
+ }
+ String definitionName = application.getDisplayName().replace(' ', '_');
+ contentDef = categoryDef.createContent(definitionName, contentType, contentId);
+ }
+ else
+ {
+ // A JCR move actually
+ categoryDef.getContentList().add(contentDef);
+ }
+
+ // Update state
+ save(application, contentDef);
+ }
+
+ public void update(Application application) throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ String categoryName = application.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ ContentDefinition contentDef = categoryDef.getContentMap().get(application.getApplicationName());
+ if (contentDef == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ // Update state
+ save(application, contentDef);
+ }
+
+ public void remove(Application app) throws Exception
+ {
+ if (app == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ String categoryName = app.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+
+ //
+ if (categoryDef != null)
+ {
+
+ String contentName = app.getApplicationName();
+ categoryDef.getContentMap().remove(contentName);
+ }
+ }
+
+ public void importExoGadgets() throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ GadgetRegistryService gadgetService = (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
+ List<Gadget> eXoGadgets = gadgetService.getAllGadgets();
+
+ //
+ if (eXoGadgets != null)
+ {
+ ArrayList<String> permissions = new ArrayList<String>();
+ permissions.add(UserACL.EVERYONE);
+ String categoryName = "Gadgets";
+
+ //
+ CategoryDefinition category = registry.getCategory(categoryName);
+ if (category == null)
+ {
+ category = registry.createCategory(categoryName);
+ category.setDisplayName(categoryName);
+ category.setDescription(categoryName);
+ category.setAccessPermissions(permissions);
+ }
+
+ //
+ for (Gadget ele : eXoGadgets)
+ {
+ ContentDefinition app = category.getContentMap().get(ele.getName());
+ if (app == null)
+ {
+ app = category.createContent(ele.getName(), org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE, ele.getName());
+ app.setDisplayName(ele.getTitle());
+ app.setDescription(ele.getDescription());
+ app.setAccessPermissions(permissions);
+ }
+ }
+ }
+ }
+
+ public void importAllPortlets() throws Exception
+ {
+ POMSession session = POMSessionManager.getSession();
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ PortletInvoker portletInvoker = (PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
+ Set<Portlet> portlets = portletInvoker.getPortlets();
+
+ //
+ for (Portlet portlet : portlets)
+ {
+ PortletInfo info = portlet.getInfo();
+ String portletApplicationName = info.getApplicationName();
+ String portletName = info.getName();
+
+ // Need to sanitize portlet and application names in case they contain characters that would
+ // cause an improper Application name
+ portletApplicationName = portletApplicationName.replace('/', '_');
+ portletName = portletName.replace('/', '_');
+
+ LocalizedString keywordsLS = info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
+
+ String[] categoryNames = null;
+ if (keywordsLS != null)
+ {
+ String keywords = keywordsLS.getDefaultString();
+ if (keywords != null && keywords.length() != 0)
+ {
+ categoryNames = keywords.split(",");
+ }
+ }
+
+ if (categoryNames == null || categoryNames.length == 0)
+ {
+ categoryNames = new String[]{portletApplicationName};
+ }
+
+ if (portlet.isRemote())
+ {
+ categoryNames = Tools.appendTo(categoryNames, REMOTE_CATEGORY_NAME);
+ }
+
+ //
+ for (String categoryName : categoryNames)
+ {
+ categoryName = categoryName.trim();
+
+ //
+ CategoryDefinition category = registry.getCategory(categoryName);
+
+ //
+ if (category == null)
+ {
+ category = registry.createCategory(categoryName);
+ category.setDisplayName(categoryName);
+ }
+
+ //
+ ContentDefinition app = category.getContentMap().get(portletName);
+ if (app == null)
+ {
+ LocalizedString descriptionLS = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ LocalizedString displayNameLS = portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+
+ // julien: ????
+ // getLocalizedStringValue(descriptionLS, portletName);
+
+ ContentType<?> contentType;
+ String contentId;
+ if (portlet.isRemote())
+ {
+ contentType = WSRP.CONTENT_TYPE;
+ contentId = portlet.getContext().getId();
+ }
+ else
+ {
+ contentType = Preferences.CONTENT_TYPE;
+ contentId = info.getApplicationName() + "/" + info.getName();
+ }
+
+
+ //
+ app = category.createContent(portletName, contentType, contentId);
+ app.setDisplayName(getLocalizedStringValue(displayNameLS, portletName));
+ app.setDescription(getLocalizedStringValue(descriptionLS, portletName));
+ }
+ }
+ }
+ }
+
+ private boolean isApplicationType(Application app, String... appTypes)
+ {
+ if (appTypes == null || appTypes.length == 0)
+ {
+ return true;
+ }
+ for (String appType : appTypes)
+ {
+ if (appType.equals(app.getApplicationType()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void save(ApplicationCategory category, CategoryDefinition categoryDef)
+ {
+ categoryDef.setDisplayName(category.getDisplayName());
+ categoryDef.setDescription(category.getDescription());
+ categoryDef.setAccessPermissions(category.getAccessPermissions());
+ categoryDef.setCreationDate(category.getCreatedDate());
+ categoryDef.setLastModificationDate(category.getModifiedDate());
+ }
+
+ private ApplicationCategory load(CategoryDefinition categoryDef, String... appTypes)
+ {
+ ApplicationCategory category = new ApplicationCategory();
+
+ //
+ category.setName(categoryDef.getName());
+ category.setDisplayName(categoryDef.getDisplayName());
+ category.setDescription(categoryDef.getDescription());
+ category.setAccessPermissions(new ArrayList<String>(categoryDef.getAccessPermissions()));
+ category.setCreatedDate(categoryDef.getCreationDate());
+ category.setModifiedDate(categoryDef.getLastModificationDate());
+
+ //
+ for (ContentDefinition contentDef : categoryDef.getContentList())
+ {
+ Application application = load(contentDef);
+ if (isApplicationType(application, appTypes))
+ {
+ category.getApplications().add(application);
+ }
+ }
+
+ //
+ return category;
+ }
+
+ private void save(Application application, ContentDefinition contentDef)
+ {
+ contentDef.setDisplayName(application.getDisplayName());
+ contentDef.setDescription(application.getDescription());
+ contentDef.setAccessPermissions(application.getAccessPermissions());
+ contentDef.setCreationDate(application.getCreatedDate());
+ contentDef.setLastModificationDate(application.getModifiedDate());
+ }
+
+ private Application load(ContentDefinition contentDef)
+ {
+ String applicationType;
+ ContentType<?> contentType = contentDef.getCustomization().getType();
+ if (contentType == org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE)
+ {
+ applicationType = org.exoplatform.web.application.Application.EXO_GADGET_TYPE;
+ }
+ else if (contentType == WSRP.CONTENT_TYPE)
+ {
+ applicationType = org.exoplatform.web.application.Application.WSRP_TYPE;
+ }
+ else if (contentType == Preferences.CONTENT_TYPE)
+ {
+ applicationType = org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+
+ //
+ Application application = new Application();
+ application.setId(contentDef.getCategory().getName() + "/" + contentDef.getName());
+ application.setCategoryName(contentDef.getCategory().getName());
+ application.setApplicationType(applicationType);
+ application.setApplicationName(contentDef.getName());
+ application.setIconURL(getApplicationIconURL(contentDef));
+ application.setDisplayName(contentDef.getDisplayName());
+ application.setDescription(contentDef.getDescription());
+ application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
+ application.setCreatedDate(contentDef.getCreationDate());
+ application.setModifiedDate(contentDef.getLastModificationDate());
+ application.setStorageId(contentDef.getCustomization().getId());
+ application.setContentId(contentDef.getCustomization().getContentId());
+ return application;
+ }
+
+ private String getLocalizedStringValue(LocalizedString localizedString, String portletName)
+ {
+ if (localizedString == null || localizedString.getDefaultString() == null)
+ {
+ return portletName;
+ }
+ else
+ {
+ return localizedString.getDefaultString();
+ }
+ }
+
+ private static String getApplicationIconURL(ContentDefinition contentDef)
+ {
+ Customization customization = contentDef.getCustomization();
+ if (customization != null)
+ {
+ ContentType type = customization.getType();
+ String contentId = customization.getContentId();
+ if (type == Preferences.CONTENT_TYPE)
+ {
+ String[] chunks = contentId.split("/");
+ if (chunks.length == 2)
+ {
+ return "/" + chunks[0] + "/skin/DefaultSkin/portletIcons/" + chunks[1] + ".png";
+ }
+ }
+ else if (type == org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE)
+ {
+ return "/" + "eXoGadgets" + "/skin/DefaultSkin/portletIcons/" + contentId + ".png";
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public void start()
+ {
+ if (plugins != null)
+ {
+ pomMGr.openSession();
+ boolean save = false;
+ try
+ {
+ for (ApplicationCategoriesPlugins plugin : plugins)
+ {
+ plugin.run();
+ }
+ save = true;
+ }
+ catch (Exception e)
+ {
+ // log.error(e);
+ e.printStackTrace();
+ }
+ finally
+ {
+ pomMGr.closeSession(save);
+ }
+ }
+ }
+
+ public void stop()
+ {
+ }
+}
Modified: portal/trunk/component/application-registry/src/test/java/conf/portal/test-configuration.xml
===================================================================
--- portal/trunk/component/application-registry/src/test/java/conf/portal/test-configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/test/java/conf/portal/test-configuration.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -30,7 +30,7 @@
</component>
<component>
<key>org.exoplatform.application.registry.ApplicationRegistryService</key>
- <type>org.exoplatform.application.registry.jcr.ApplicationRegistryServiceImpl</type>
+ <type>org.exoplatform.application.registry.mop.MOPApplicationRegistryService</type>
<component-plugins>
<component-plugin>
<name>new.portal.portlets.registry</name>
Modified: portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
===================================================================
--- portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -324,7 +324,7 @@
app.setApplicationName(appName);
app.setDisplayName(appName);
app.setApplicationType(appType);
- app.setApplicationGroup(appGroup);
+// app.setApplicationGroup(appGroup);
return app;
}
@@ -411,9 +411,4 @@
orgService.getUserProfileHandler().saveUserProfile(up, true);
return u;
}
-
- public void testClearAllRegistry() throws Exception
- {
- service_.clearAllRegistries();
- }
}
Deleted: portal/trunk/component/portal/src/main/java/conf/portal/content-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/portal/content-nodetypes.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/conf/portal/content-nodetypes.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -1,45 +0,0 @@
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="mop:wsrpState" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mop:customizationstate</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="portletId" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="cloned" requiredType="Boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
Added: portal/trunk/component/portal/src/main/java/conf/portal/portal-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/portal/portal-nodetypes.xml (rev 0)
+++ portal/trunk/component/portal/src/main/java/conf/portal/portal-nodetypes.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -0,0 +1,111 @@
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="mop:contentregistry" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="mop:contentcategory" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>mop:contentcategory</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="mop:contentcategory" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="displayname" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="lastmodificationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="accesspermissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="mop:content" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>mop:content</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="mop:content" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="displayname" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="lastmodificationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="accesspermissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="mop:wsrpstate" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>mop:customizationstate</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="portletid" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="cloned" requiredType="Boolean" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+</nodeTypes>
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -97,6 +98,8 @@
public void save(PortletPreferences portletPreferences) throws Exception;
+ public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception;
+
public <S> S load(ApplicationState<S> state) throws Exception;
public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -243,6 +244,11 @@
return find(q, null);
}
+ public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception
+ {
+ return delegate.getId(type, state);
+ }
+
public void save(PortletPreferences portletPreferences) throws Exception
{
delegate.save(portletPreferences);
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -29,6 +29,9 @@
{
/** The owner type. */
+ private String contentId;
+
+ /** The owner type. */
private String ownerType;
/** The owner id. */
@@ -62,6 +65,16 @@
this.uniqueId = null;
}
+ public String getContentId()
+ {
+ return contentId;
+ }
+
+ public void setContentId(String contentId)
+ {
+ this.contentId = contentId;
+ }
+
public S getContentState()
{
return contentState;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -122,6 +122,7 @@
}
state.setOwnerType(ownerType);
state.setOwnerId(ownerId);
+ state.setContentId(persistenceChunks[0] + "/" + persistenceChunks[1]);
app = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
app.setState(state);
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -26,9 +26,14 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.config.model.portlet.PortletId;
+import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.config.cache.DataCache;
import org.exoplatform.portal.pom.config.tasks.DashboardTask;
import org.exoplatform.portal.pom.data.DashboardData;
@@ -192,6 +197,48 @@
execute(new PortletPreferencesTask.Save(portletPreferences));
}
+ public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception
+ {
+ String contentId;
+ if (state instanceof TransientApplicationState)
+ {
+ throw new UnsupportedOperationException();
+ }
+ else if (state instanceof PersistentApplicationState)
+ {
+ PersistentApplicationState pstate = (PersistentApplicationState)state;
+ contentId = execute(new PreferencesTask.GetContentId<S>(pstate.getStorageId())).getContentId();
+ }
+ else if (state instanceof CloneApplicationState)
+ {
+ CloneApplicationState cstate = (CloneApplicationState)state;
+ contentId = execute(new PreferencesTask.GetContentId<S>(cstate.getStorageId())).getContentId();
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ if (type == ApplicationType.PORTLET)
+ {
+ String[] chunks = contentId.split("/");
+ return (I)new PortletId(chunks[0], chunks[1]);
+ }
+ else if (type == ApplicationType.GADGET)
+ {
+ return (I)new GadgetId(contentId);
+ }
+ else if (type == ApplicationType.WSRP_PORTLET)
+ {
+ return (I)new WSRPId(contentId);
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
public <S> S load(ApplicationState<S> state) throws Exception
{
if (state instanceof TransientApplicationState)
@@ -200,9 +247,15 @@
S prefs = transientState.getContentState();
return prefs != null ? prefs : null;
}
+ else if (state instanceof CloneApplicationState)
+ {
+ PreferencesTask.Load<S> load = new PreferencesTask.Load<S>(((CloneApplicationState<S>)state).getStorageId());
+ execute(load);
+ return load.getState();
+ }
else
{
- PreferencesTask.Load<S> load = new PreferencesTask.Load<S>((PersistentApplicationState<S>)state);
+ PreferencesTask.Load<S> load = new PreferencesTask.Load<S>(((PersistentApplicationState<S>)state).getStorageId());
execute(load);
return load.getState();
}
@@ -216,7 +269,7 @@
}
else
{
- PreferencesTask.Save<S> save = new PreferencesTask.Save<S>((PersistentApplicationState<S>)state, preferences);
+ PreferencesTask.Save<S> save = new PreferencesTask.Save<S>(((PersistentApplicationState<S>)state).getStorageId(), preferences);
execute(save);
return state;
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -23,6 +23,7 @@
import org.chromattic.api.UndeclaredRepositoryException;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.registry.ContentRegistry;
import org.gatein.mop.api.Model;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.ObjectType;
@@ -93,7 +94,7 @@
}
}
- private ChromatticSession getSession()
+ protected ChromatticSession getSession()
{
try
{
@@ -108,6 +109,28 @@
}
}
+ /**
+ * Returns the application registry.
+ *
+ * @return the application registry
+ */
+ public ContentRegistry getContentRegistry()
+ {
+ ChromatticSession session = getSession();
+
+ //
+ ContentRegistry registry = session.findByPath(ContentRegistry.class, "registry");
+
+ //
+ if (registry == null)
+ {
+ registry = session.insert(ContentRegistry.class, "registry");
+ }
+
+ //
+ return registry;
+ }
+
public Workspace getWorkspace()
{
return getModel().getWorkspace();
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -20,7 +20,11 @@
package org.exoplatform.portal.pom.config;
import org.chromattic.api.ChromatticBuilder;
+import org.chromattic.api.ChromatticSession;
import org.chromattic.apt.InstrumentorImpl;
+import org.exoplatform.portal.pom.registry.CategoryDefinition;
+import org.exoplatform.portal.pom.registry.ContentDefinition;
+import org.exoplatform.portal.pom.registry.ContentRegistry;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.gadget.GadgetContentProvider;
import org.exoplatform.portal.pom.spi.gadget.GadgetState;
@@ -188,9 +192,16 @@
builder.add(GadgetState.class);
builder.add(WSRPState.class);
- CustomizationContextProviderRegistry customizationContextResolvers = new CustomizationContextProviderRegistry();
+ //
+ builder.add(ContentRegistry.class);
+ builder.add(CategoryDefinition.class);
+ builder.add(ContentDefinition.class);
//
+ CustomizationContextProviderRegistry customizationContextResolvers =
+ new CustomizationContextProviderRegistry();
+
+ //
ContentManagerRegistry contentManagerRegistry = new ContentManagerRegistry();
contentManagerRegistry.register(Preferences.CONTENT_TYPE, new PortletContentProvider());
contentManagerRegistry.register(Gadget.CONTENT_TYPE, new GadgetContentProvider());
@@ -235,6 +246,11 @@
{
session = new POMSession(this);
current.set(session);
+
+ //
+ // A bit ugly but we will improve that later
+ ChromatticSession csession = session.getSession();
+ csession.addEventListener(new Injector(session));
}
else
{
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/PortalSessionLifeCycle.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/PortalSessionLifeCycle.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/PortalSessionLifeCycle.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.pom.config;
import org.chromattic.spi.jcr.SessionLifeCycle;
+import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
@@ -53,9 +54,11 @@
private Entry(POMSession session) throws RepositoryException
{
ManageableRepository repo;
+ POMSessionManager mgr = session.mgr;
try
{
- repo = session.mgr.repositoryService.getRepository(session.mgr.repositoryName);
+ RepositoryService repoService = mgr.repositoryService;
+ repo = repoService.getRepository(mgr.repositoryName);
}
catch (RepositoryConfigurationException e)
{
@@ -66,7 +69,7 @@
this.provider = SessionProvider.createSystemProvider();
this.count = 0;
this.repo = repo;
- this.workspaceName = session.mgr.workspaceName;
+ this.workspaceName = mgr.workspaceName;
}
Session openSession() throws RepositoryException
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -36,18 +35,44 @@
/** . */
private static final Object NULL_PREFS = new Object();
- public static class Load<S> extends PreferencesTask<S> implements CacheableDataTask<PersistentApplicationState<S>, Object>
+ public static class GetContentId<S> extends PreferencesTask<S>
{
/** . */
- private final PersistentApplicationState<S> state;
+ private final String storageId;
/** . */
+ private String contentId;
+
+ public GetContentId(String storageId)
+ {
+ this.storageId = storageId;
+ }
+
+ public void run(POMSession session) throws Exception
+ {
+ Customization<S> customization = (Customization<S>)session.findCustomizationById(storageId);
+ contentId = customization.getContentId();
+ }
+
+ public String getContentId()
+ {
+ return contentId;
+ }
+ }
+
+ public static class Load<S> extends PreferencesTask<S> implements CacheableDataTask<String, Object>
+ {
+
+ /** . */
+ private final String storageId;
+
+ /** . */
private S prefs;
- public Load(PersistentApplicationState<S> state)
+ public Load(String storageId)
{
- this.state = state;
+ this.storageId = storageId;
}
public DataAccessMode getAccessMode()
@@ -73,15 +98,14 @@
return prefs == null ? NULL_PREFS : prefs;
}
- public PersistentApplicationState<S> getKey()
+ public String getKey()
{
- return state;
+ return storageId;
}
public void run(POMSession session) throws Exception
{
- String id = state.getStorageId();
- Customization<S> customization = (Customization<S>)session.findCustomizationById(id);
+ Customization<S> customization = (Customization<S>)session.findCustomizationById(storageId);
prefs = customization.getVirtualState();
}
@@ -93,22 +117,22 @@
@Override
public String toString()
{
- return "PreferencesTask.Load[state=" + state.getStorageId() + "]";
+ return "PreferencesTask.Load[id=" + storageId + "]";
}
}
- public static class Save<S> extends PreferencesTask<S> implements CacheableDataTask<PersistentApplicationState<S>, Object>
+ public static class Save<S> extends PreferencesTask<S> implements CacheableDataTask<String, Object>
{
/** . */
- private final PersistentApplicationState<S> state;
+ private final String storageId;
/** . */
private final S prefs;
- public Save(PersistentApplicationState<S> state, S prefs)
+ public Save(String storageId, S prefs)
{
- this.state = state;
+ this.storageId = storageId;
this.prefs = prefs;
}
@@ -132,18 +156,16 @@
return prefs == null ? NULL_PREFS : prefs ;
}
- public PersistentApplicationState<S> getKey()
+ public String getKey()
{
- return state;
+ return storageId;
}
public void run(POMSession session) throws Exception
{
- String id = state.getStorageId();
+ Customization<S> customization = (Customization<S>)session.findCustomizationById(storageId);
- Customization<S> customization = (Customization<S>)session.findCustomizationById(id);
-
if (prefs != null)
{
customization.setState(prefs);
@@ -157,7 +179,7 @@
@Override
public String toString()
{
- return "PreferencesTask.Save[state=" + state.getStorageId() + "]";
+ return "PreferencesTask.Save[id=" + storageId + "]";
}
}
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -22,6 +22,7 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -974,6 +975,16 @@
dstCustomization.setState(state);
}
}
+ else if (instanceState instanceof CloneApplicationState)
+ {
+ CloneApplicationState cloneState = (CloneApplicationState)instanceState;
+
+ //
+ Customization<?> customization = session.findCustomizationById(cloneState.getStorageId());
+
+ //
+ dst.customize(customization);
+ }
}
public DashboardData loadDashboard(UIContainer container)
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -23,6 +23,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -91,6 +92,8 @@
public void save(PortletPreferences portletPreferences) throws Exception;
+ public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception;
+
public <S> S load(ApplicationState<S> state) throws Exception;
public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception;
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/CategoryDefinition.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/CategoryDefinition.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/CategoryDefinition.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.registry;
+
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.Name;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.OneToMany;
+import org.chromattic.api.annotations.Property;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "mop:contentcategory")
+public abstract class CategoryDefinition
+{
+
+ /** The injected workspace. */
+ public POMSession session;
+
+ @Name
+ public abstract String getName();
+
+ @Property(name = "displayname")
+ public abstract String getDisplayName();
+
+ public abstract void setDisplayName(String displayName);
+
+ @Property(name = "description")
+ public abstract String getDescription();
+
+ public abstract void setDescription(String description);
+
+ @Property(name = "creationdate")
+ public abstract Date getCreationDate();
+
+ public abstract void setCreationDate(Date date);
+
+ @Property(name = "lastmodificationdate")
+ public abstract Date getLastModificationDate();
+
+ public abstract void setLastModificationDate(Date date);
+
+ @Property(name = "accesspermissions")
+ public abstract List<String> getAccessPermissions();
+
+ public abstract void setAccessPermissions(List<String> accessPermissions);
+
+ @OneToMany
+ public abstract List<ContentDefinition> getContentList();
+
+ @OneToMany
+ public abstract Map<String, ContentDefinition> getContentMap();
+
+ @Create
+ public abstract ContentDefinition create();
+
+ /**
+ * Create a content definition for the target content.
+ *
+ * @param definitionName the definition name
+ * @param contentType the target content type
+ * @param contentId the target content id
+ * @return the content definion
+ */
+ public ContentDefinition createContent(
+ String definitionName,
+ ContentType<?> contentType,
+ String contentId)
+ {
+ if (definitionName == null)
+ {
+ throw new NullPointerException("No null definition name accepted");
+ }
+ if (contentType == null)
+ {
+ throw new NullPointerException("No null content type accepted");
+ }
+ if (contentId == null)
+ {
+ throw new NullPointerException("No null content id accepted");
+ }
+
+ //
+ Workspace workspace = session.getWorkspace();
+
+ //
+ Customization customization = workspace.getCustomization(definitionName);
+
+ //
+ if (customization == null)
+ {
+ workspace.customize(definitionName, contentType, contentId, null);
+ }
+ else if (customization.getContentId().equals(contentId))
+ {
+ // Do nothing here
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot create a content with a content id " + contentId +
+ " with an existing different content id " + customization.getContentId());
+ }
+
+ //
+ ContentDefinition content = create();
+
+ //
+ Map<String, ContentDefinition> contents = getContentMap();
+ contents.put(definitionName, content);
+
+ //
+ return content;
+ }
+}
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentDefinition.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentDefinition.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentDefinition.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.registry;
+
+import org.chromattic.api.annotations.Id;
+import org.chromattic.api.annotations.ManyToOne;
+import org.chromattic.api.annotations.Name;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.Property;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "mop:content")
+public abstract class ContentDefinition
+{
+
+ @Id
+ public abstract String getId();
+
+ @Name
+ public abstract String getName();
+
+ @Property(name = "displayname")
+ public abstract String getDisplayName();
+
+ public abstract void setDisplayName(String displayName);
+
+ @Property(name = "description")
+ public abstract String getDescription();
+
+ public abstract void setDescription(String description);
+
+ @Property(name = "creationdate")
+ public abstract Date getCreationDate();
+
+ public abstract void setCreationDate(Date date);
+
+ @Property(name = "lastmodificationdate")
+ public abstract Date getLastModificationDate();
+
+ public abstract void setLastModificationDate(Date date);
+
+ @Property(name = "accesspermissions")
+ public abstract List<String> getAccessPermissions();
+
+ public abstract void setAccessPermissions(List<String> accessPermissions);
+
+ @ManyToOne
+ public abstract CategoryDefinition getCategory();
+
+ public Customization getCustomization()
+ {
+ CategoryDefinition category = getCategory();
+ Workspace workspace = category.session.getWorkspace();
+ String name = getName();
+ return workspace.getCustomization(name);
+ }
+
+
+
+
+
+}
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentRegistry.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentRegistry.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/registry/ContentRegistry.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.registry;
+
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.OneToMany;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "mop:contentregistry")
+public abstract class ContentRegistry
+{
+
+ @OneToMany
+ public abstract List<CategoryDefinition> getCategoryList();
+
+ @OneToMany
+ public abstract Map<String, CategoryDefinition> getCategoryMap();
+
+ @Create
+ public abstract CategoryDefinition create();
+
+ public CategoryDefinition getCategory(String categoryName)
+ {
+ return getCategoryMap().get(categoryName);
+ }
+
+ public CategoryDefinition createCategory(String categoryName)
+ {
+ Map<String, CategoryDefinition> categories = getCategoryMap();
+ if (categories.containsKey(categoryName))
+ {
+ throw new IllegalArgumentException("Duplicate category " + categoryName);
+ }
+ CategoryDefinition category = create();
+ categories.put(categoryName, category);
+ return category;
+ }
+
+}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/wsrp/WSRPState.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -34,9 +34,9 @@
@NodeMapping(name = WSRPState.MOP_NODE_NAME)
public abstract class WSRPState
{
- static final String MOP_NODE_NAME = "mop:wsrpState";
+ static final String MOP_NODE_NAME = "mop:wsrpstate";
- @Property(name = "portletId")
+ @Property(name = "portletid")
public abstract String getPortletId();
public abstract void setPortletId(String portletHandle);
Deleted: portal/trunk/component/portal/src/test/java/conf/portal/content-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/content-nodetypes.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/test/java/conf/portal/content-nodetypes.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -1,45 +0,0 @@
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="mop:wsrpState" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mop:customizationstate</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="portletId" requiredType="String" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="cloned" requiredType="Boolean" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
Modified: portal/trunk/component/portal/src/test/java/conf/portal/jcr-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/jcr-configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/test/java/conf/portal/jcr-configuration.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -24,67 +24,66 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
- <component>
- <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR configuration file</description>
- <value>jar:/conf/portal/repository-configuration.xml</value>
- </value-param>
- <properties-param>
- <name>working-conf</name>
- <description>working-conf</description>
- <property name="persister-class-name"
- value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
- <property name="source-name" value="jdbcexo"/>
- <property name="dialect" value="hsqldb"/>
- </properties-param>
- </init-params>
- </component>
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>jar:/conf/portal/repository-configuration.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ <property name="source-name" value="jdbcexo"/>
+ <property name="dialect" value="hsqldb"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
+ <init-params>
+ <properties-param>
+ <name>locations</name>
+ <property name="repository" value="system"/>
+ </properties-param>
+ </init-params>
+ </component>
- <component>
- <key>org.exoplatform.services.jcr.RepositoryService</key>
- <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
- </component>
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/conf/standalone/nodetypes.xml</value>
+ <value>jar:/conf/portal/portal-nodetypes.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
- <component>
- <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
- <init-params>
- <properties-param>
- <name>locations</name>
- <property name="repository" value="system"/>
- </properties-param>
- </init-params>
- </component>
-
- <external-component-plugins>
- <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
- <component-plugin>
- <name>add.namespaces</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
- <init-params>
- <properties-param>
- <name>namespaces</name>
- <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>add.nodeType</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
- <init-params>
- <values-param>
- <name>autoCreatedInNewRepository</name>
- <description>Node types configuration file</description>
- <value>jar:/conf/standalone/nodetypes.xml</value>
- <value>jar:/conf/portal/content-nodetypes.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
-</configuration>
+</configuration>
\ No newline at end of file
Deleted: portal/trunk/component/portal/src/test/java/conf/portal/model-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/model-nodetypes.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/test/java/conf/portal/model-nodetypes.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -1,36 +0,0 @@
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
- xmlns:jcr="http://www.jcp.org/jcr/1.0">
-
- <nodeType name="exo:gadget" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:unstructured</supertype>
- </supertypes>
- <propertyDefinitions>
- <!--propertyDefinition name="data" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition-->
- </propertyDefinitions>
- </nodeType>
-
-</nodeTypes>
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -462,7 +462,10 @@
}
}.execute(null);
}
-
+
+
+ // Julien : see who added that and find out is test is relevant or not
+/*
public void testClonePage()
{
new UnitTest()
@@ -483,6 +486,7 @@
}
}.execute(null);
}
+*/
public void testUpdatePage()
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScript.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScript.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScript.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -34,6 +34,9 @@
{
/** . */
+ private final String templateId;
+
+ /** . */
private final String groovyText;
/** . */
@@ -42,13 +45,19 @@
/** . */
private final Map<Integer, TextItem> lineTable;
- public GroovyScript(String groovyText, Class<?> scriptClass, Map<Integer, TextItem> lineTable)
+ public GroovyScript(String templateId, String groovyText, Class<?> scriptClass, Map<Integer, TextItem> lineTable)
{
+ this.templateId = templateId;
this.groovyText = groovyText;
this.scriptClass = scriptClass;
this.lineTable = lineTable;
}
+ public String getTemplateId()
+ {
+ return templateId;
+ }
+
public String getGroovyText()
{
return groovyText;
@@ -148,6 +157,6 @@
t.setStackTrace(trace);
//
- return new TemplateRuntimeException(firstItem, t);
+ return new TemplateRuntimeException(templateId, firstItem, t);
}
}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScriptBuilder.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScriptBuilder.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyScriptBuilder.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -38,9 +38,12 @@
{
/** . */
- private final String name;
+ private final String templateId;
/** . */
+ private final String templateName;
+
+ /** . */
private final String templateText;
/** . */
@@ -52,9 +55,10 @@
/** . */
private Script script = new Script();
- public GroovyScriptBuilder(String name, String templateText)
+ public GroovyScriptBuilder(String templateId, String templateName, String templateText)
{
- this.name = name;
+ this.templateId = templateId;
+ this.templateName = templateName;
this.templateText = templateText;
}
@@ -195,7 +199,7 @@
//
InputStream in = new ByteArrayInputStream(bytes);
- GroovyCodeSource gcs = new GroovyCodeSource(in, name, "/groovy/shell");
+ GroovyCodeSource gcs = new GroovyCodeSource(in, templateName, "/groovy/shell");
GroovyClassLoader loader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config);
Class<?> scriptClass;
try
@@ -212,7 +216,10 @@
}
return new GroovyScript(
- script.toString(), scriptClass, Collections.unmodifiableMap(new HashMap<Integer, TextItem>(script.positionTable))
+ templateId,
+ script.toString(),
+ scriptClass,
+ Collections.unmodifiableMap(new HashMap<Integer, TextItem>(script.positionTable))
);
}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplate.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplate.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplate.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -42,18 +42,15 @@
return builder.toString();
}
- /** The name of the template. */
- private final String name;
-
/** The text of the template. */
private final String templateText;
/** The groovy script. */
private final GroovyScript script;
- public GroovyTemplate(String name, Reader scriptReader) throws IOException, TemplateCompilationException
+ public GroovyTemplate(String id, String name, Reader scriptReader) throws IOException, TemplateCompilationException
{
- this(name, read(scriptReader));
+ this(id, name, read(scriptReader));
}
public GroovyTemplate(Reader scriptReader) throws IOException, TemplateCompilationException
@@ -63,28 +60,27 @@
public GroovyTemplate(String templateText) throws TemplateCompilationException
{
- this(null, templateText);
+ this(null, null, templateText);
}
- public GroovyTemplate(String name, String templateText) throws TemplateCompilationException
+ public GroovyTemplate(String templateId, String templateName, String templateText) throws TemplateCompilationException
{
- if (name == null)
+ if (templateName == null)
{
- name = "fic";
+ templateName = "fic";
}
//
- GroovyScriptBuilder compiler = new GroovyScriptBuilder(name, templateText);
+ GroovyScriptBuilder compiler = new GroovyScriptBuilder(templateId, templateName, templateText);
//
- this.name = name;
this.script = compiler.build();
this.templateText = templateText;
}
- public String getName()
+ public String getId()
{
- return name;
+ return script.getTemplateId();
}
public String getClassName()
@@ -92,12 +88,12 @@
return script.getScriptClass().getName();
}
- public String getTemplateText()
+ public String getText()
{
return templateText;
}
- public String getGroovyText()
+ public String getGroovy()
{
return script.getGroovyText();
}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplateEngine.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplateEngine.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyTemplateEngine.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -22,8 +22,8 @@
*/
public class GroovyTemplateEngine
{
- public GroovyTemplate createTemplate(String text) throws TemplateCompilationException
+ public GroovyTemplate createTemplate(String id, String name, String text) throws TemplateCompilationException
{
- return new GroovyTemplate(text);
+ return new GroovyTemplate(id, name, text);
}
}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateRuntimeException.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateRuntimeException.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateRuntimeException.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -26,21 +26,26 @@
{
/** . */
+ private final String templateId;
+
+ /** . */
private final TextItem textItem;
- public TemplateRuntimeException(TextItem textItem, String message, Throwable cause)
+ public TemplateRuntimeException(String templateId, TextItem textItem, String message, Throwable cause)
{
super(message, cause);
//
+ this.templateId = templateId;
this.textItem = textItem;
}
- public TemplateRuntimeException(TextItem textItem, Throwable cause)
+ public TemplateRuntimeException(String templateId, TextItem textItem, Throwable cause)
{
super(cause);
//
+ this.templateId = templateId;
this.textItem = textItem;
}
@@ -62,6 +67,15 @@
@Override
public String getMessage()
{
- return textItem != null ? ("Groovy template exception at " + textItem) : "Groovy template exception";
+ StringBuilder sb = new StringBuilder("Groovy template exception");
+ if (textItem != null)
+ {
+ sb.append(" at ").append(textItem);
+ }
+ if (templateId != null)
+ {
+ sb.append(" for template ").append(templateId);
+ }
+ return sb.toString();
}
}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -119,8 +119,16 @@
bytes = IOUtil.getStreamContentAsBytes(is);
is.close();
+ // The template class name
+ int pos = url.lastIndexOf('/');
+ if (pos == -1)
+ {
+ pos = 0;
+ }
+ String name = url.substring(pos);
+
String text = new String(bytes);
- template = engine_.createTemplate(text);
+ template = engine_.createTemplate(url, name, text);
if (cacheable)
{
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -161,10 +161,11 @@
{
Application app = new Application();
app.setApplicationName(gadget.getName());
- app.setApplicationGroup(GadgetApplication.EXO_GADGET_GROUP);
+// app.setApplicationGroup(GadgetApplication.EXO_GADGET_GROUP);
app.setApplicationType(org.exoplatform.web.application.Application.EXO_GADGET_TYPE);
app.setDisplayName(gadget.getTitle());
- app.setUri(gadget.getUrl());
+// app.setUri(gadget.getUrl());
+ app.setContentId(gadget.getUrl());
String description =
(gadget.getDescription() == null || gadget.getDescription().length() < 1) ? gadget.getName() : gadget
.getDescription();
@@ -196,17 +197,24 @@
String portletName = info.getName();
Application app = new Application();
app.setApplicationName(portletName);
- app.setApplicationGroup(info.getApplicationName());
- String appType = org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
+// app.setApplicationGroup(info.getApplicationName());
+ String appType;
+ String contentId;
if (remote)
{
appType = org.exoplatform.web.application.Application.WSRP_TYPE;
+ contentId = portlet.getContext().getId();
}
+ else
+ {
+ appType = org.exoplatform.web.application.Application.EXO_PORTLET_TYPE;
+ contentId = info.getApplicationName() + "/" + info.getName();
+ }
app.setApplicationType(appType);
app.setDisplayName(Util.getLocalizedStringValue(displayNameLS, portletName));
app.setDescription(Util.getLocalizedStringValue(descriptionLS, portletName));
app.setAccessPermissions(new ArrayList<String>());
- app.setUri(portlet.getContext().getId());
+ app.setContentId(contentId);
applications.add(app);
}
@@ -283,10 +291,9 @@
newApp.setApplicationName(app.getApplicationName());
newApp.setDisplayName(app.getDisplayName());
newApp.setApplicationType(app.getApplicationType());
- newApp.setApplicationGroup(app.getApplicationGroup());
newApp.setDescription(app.getDescription());
newApp.setAccessPermissions(app.getAccessPermissions());
- newApp.setUri(app.getUri());
+ newApp.setContentId(app.getContentId());
return newApp;
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -43,6 +43,7 @@
import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
/** Created by The eXo Platform SARL Author : Hoa Nguyen hoa.nguyen(a)exoplatform.com Jul 4, 2006 */
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@@ -102,7 +103,7 @@
uiSetting.getUIStringInput(FIELD_NAME).setEditable(false).setValue(category_.getName());
uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).setValue(category_.getDisplayName());
uiSetting.getUIStringInput(FIELD_DESCRIPTION).setValue(category_.getDescription());
- ArrayList<String> accessPermissions = category_.getAccessPermissions();
+ List<String> accessPermissions = category_.getAccessPermissions();
String[] per = new String[accessPermissions.size()];
if (accessPermissions != null && accessPermissions.size() > 0)
{
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl 2009-11-10 00:07:49 UTC (rev 533)
@@ -2,7 +2,7 @@
def application = uicomponent.getApplication();
def category = uicomponent.getApplicationCategory();
String name = application.getApplicationName();
-String srcBG = "/" + application.getApplicationGroup() + "/skin/DefaultSkin/portletIcons/" + name + ".png";
+String srcBG = application.getIconURL();
String srcBGError = "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
%>
<div class="$uicomponent.id" id="$uicomponent.id">
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -24,107 +24,106 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
- <component>
- <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR configuration file</description>
- <value>war:/conf/jcr/repository-configuration.xml</value>
- </value-param>
- <properties-param>
- <name>working-conf</name>
- <description>working-conf</description>
- <property name="persister-class-name"
- value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
- <property name="source-name" value="jdbcexo${container.name.suffix}"/>
- <property name="dialect" value="${dialect}"/>
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.RepositoryService</key>
- <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
- </component>
-
- <component>
- <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
- <init-params>
- <properties-param>
- <name>locations</name>
- <property name="repository" value="portal-system"/>
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
- <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</key>
- <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
- <init-params>
-
- <value-param>
- <name>auto-mix-lockable</name>
- <value>false</value>
- </value-param>
-
- <value-param>
- <name>def-folder-node-type</name>
- <value>nt:folder</value>
- </value-param>
-
- <value-param>
- <name>def-file-node-type</name>
- <value>nt:file</value>
- </value-param>
-
- <value-param>
- <name>def-file-mimetype</name>
- <value>text/plain</value>
- </value-param>
-
- <value-param>
- <name>update-policy</name>
- <value>create-version</value>
- </value-param>
- </init-params>
- </component>
-
- <external-component-plugins>
- <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
- <component-plugin>
- <name>add.namespaces</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
- <init-params>
- <properties-param>
- <name>namespaces</name>
- <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
- <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>add.nodeType</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
- <init-params>
- <values-param>
- <name>autoCreatedInNewRepository</name>
- <description>Node types configuration file</description>
- <value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
- <value>jar:/conf/standalone/nodetypes.xml</value>
- <value>jar:/conf/portal/content-nodetypes.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>war:/conf/jcr/repository-configuration.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ <property name="source-name" value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="${dialect}"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
+ <init-params>
+ <properties-param>
+ <name>locations</name>
+ <property name="repository" value="portal-system"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
+ <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</key>
+ <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
+ <init-params>
+
+ <value-param>
+ <name>auto-mix-lockable</name>
+ <value>false</value>
+ </value-param>
+
+ <value-param>
+ <name>def-folder-node-type</name>
+ <value>nt:folder</value>
+ </value-param>
+
+ <value-param>
+ <name>def-file-node-type</name>
+ <value>nt:file</value>
+ </value-param>
+
+ <value-param>
+ <name>def-file-mimetype</name>
+ <value>text/plain</value>
+ </value-param>
+
+ <value-param>
+ <name>update-policy</name>
+ <value>create-version</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/conf/ext-nodetypes-config.xml</value>
+ <value>jar:/conf/organization-nodetypes.xml</value>
+ <value>jar:/conf/standalone/nodetypes.xml</value>
+ <value>jar:/conf/portal/portal-nodetypes.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -24,106 +24,105 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
- <component>
- <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR configuration file</description>
- <value>war:/conf/jcr/repository-configuration.xml</value>
- </value-param>
- <properties-param>
- <name>working-conf</name>
- <description>working-conf</description>
- <property name="persister-class-name"
- value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
- <property name="source-name" value="jdbcexo${container.name.suffix}"/>
- <property name="dialect" value="hsqldb"/>
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.RepositoryService</key>
- <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
- </component>
-
- <component>
- <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
- <init-params>
- <properties-param>
- <name>locations</name>
- <property name="repository" value="portal-system"/>
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
- <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
- </component>
-
- <component>
- <key>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</key>
- <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
- <init-params>
-
- <value-param>
- <name>auto-mix-lockable</name>
- <value>false</value>
- </value-param>
-
- <value-param>
- <name>def-folder-node-type</name>
- <value>nt:folder</value>
- </value-param>
-
- <value-param>
- <name>def-file-node-type</name>
- <value>nt:file</value>
- </value-param>
-
- <value-param>
- <name>def-file-mimetype</name>
- <value>text/plain</value>
- </value-param>
-
- <value-param>
- <name>update-policy</name>
- <value>create-version</value>
- </value-param>
- </init-params>
- </component>
-
- <external-component-plugins>
- <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
- <component-plugin>
- <name>add.namespaces</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
- <init-params>
- <properties-param>
- <name>namespaces</name>
- <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
- <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>add.nodeType</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
- <init-params>
- <values-param>
- <name>autoCreatedInNewRepository</name>
- <description>Node types configuration file</description>
- <value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
- <value>jar:/conf/standalone/nodetypes.xml</value>
- <value>jar:/conf/portal/content-nodetypes.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>war:/conf/jcr/repository-configuration.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ <property name="source-name" value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="hsqldb"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.ext.registry.RegistryService</type>
+ <init-params>
+ <properties-param>
+ <name>locations</name>
+ <property name="repository" value="portal-system"/>
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
+ <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</key>
+ <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
+ <init-params>
+
+ <value-param>
+ <name>auto-mix-lockable</name>
+ <value>false</value>
+ </value-param>
+
+ <value-param>
+ <name>def-folder-node-type</name>
+ <value>nt:folder</value>
+ </value-param>
+
+ <value-param>
+ <name>def-file-node-type</name>
+ <value>nt:file</value>
+ </value-param>
+
+ <value-param>
+ <name>def-file-mimetype</name>
+ <value>text/plain</value>
+ </value-param>
+
+ <value-param>
+ <name>update-policy</name>
+ <value>create-version</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/conf/ext-nodetypes-config.xml</value>
+ <value>jar:/conf/organization-nodetypes.xml</value>
+ <value>jar:/conf/standalone/nodetypes.xml</value>
+ <value>jar:/conf/portal/portal-nodetypes.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-10 00:07:49 UTC (rev 533)
@@ -73,7 +73,7 @@
<component>
<key>org.exoplatform.application.registry.ApplicationRegistryService</key>
- <type>org.exoplatform.application.registry.jcr.ApplicationRegistryServiceImpl</type>
+ <type>org.exoplatform.application.registry.mop.MOPApplicationRegistryService</type>
<component-plugins>
<component-plugin>
<name>new.portal.portlets.registry</name>
@@ -123,8 +123,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>exoadmin</string>
+ <field name="contentId">
+ <string>exoadmin/ApplicationRegistryPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -155,8 +155,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>exoadmin</string>
+ <field name="contentId">
+ <string>exoadmin/OrganizationPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -187,8 +187,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>exoadmin</string>
+ <field name="contentId">
+ <string>exoadmin/AccountPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -246,8 +246,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>web</string>
+ <field name="contentId">
+ <string>web/IFramePortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -275,8 +275,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>web</string>
+ <field name="contentId">
+ <string>web/SiteMapPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -331,8 +331,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>dashboard</string>
+ <field name="contentId">
+ <string>dashboard/DashboardPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -360,8 +360,8 @@
<field name="applicationType">
<string>portlet</string>
</field>
- <field name="applicationGroup">
- <string>dashboard</string>
+ <field name="contentId">
+ <string>dashboard/GadgetPortlet</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -416,8 +416,8 @@
<field name="applicationType">
<string>eXoGadget</string>
</field>
- <field name="applicationGroup">
- <string>eXoGadgets</string>
+ <field name="contentId">
+ <string>Todo</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -447,8 +447,8 @@
<field name="applicationType">
<string>eXoGadget</string>
</field>
- <field name="applicationGroup">
- <string>eXoGadgets</string>
+ <field name="contentId">
+ <string>Calendar</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -478,8 +478,8 @@
<field name="applicationType">
<string>eXoGadget</string>
</field>
- <field name="applicationGroup">
- <string>eXoGadgets</string>
+ <field name="contentId">
+ <string>Calculator</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
@@ -507,8 +507,8 @@
<field name="applicationType">
<string>eXoGadget</string>
</field>
- <field name="applicationGroup">
- <string>eXoGadgets</string>
+ <field name="contentId">
+ <string>rssAggregator</string>
</field>
<field name="accessPermissions">
<collection type="java.util.ArrayList" item-type="java.lang.String">
Modified: portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2009-11-10 00:07:49 UTC (rev 533)
@@ -37,7 +37,7 @@
for(application in category.getApplications()) {
String applicationLabel = application.getDisplayName();
if(applicationLabel.length() > 30) applicationLabel = applicationLabel.substring(0, 27) + "...";
- String srcBG = "/" + application.getApplicationGroup() + "/skin/DefaultSkin/portletIcons/" + application.getApplicationName() + ".png";
+ String srcBG = application.getIconURL();
String srcBGError = "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
%>
<div class="UIVTab VTabStyle3" id="<%=application.getId();%>" onmousedown="eXo.portal.PortalDragDrop.init.call(this, event);">
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
@@ -35,6 +36,7 @@
import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
+import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.PortalDataMapper;
@@ -177,7 +179,7 @@
Application application = event.getSource().getApplication(applicationId);
String appType = application.getApplicationType();
String portletName = application.getApplicationName();
- String appGroup = application.getApplicationGroup();
+// String appGroup = application.getApplicationGroup();
// TODO review windowId for eXoWidget and eXoApplication
UIComponent component = null;
@@ -202,25 +204,19 @@
UIPortlet uiPortlet = uiPage.createUIComponent(UIPortlet.class, null, null);
- TransientApplicationState appState;
+ CloneApplicationState appState;
Object appId;
if (!remote)
{
- appState = new TransientApplicationState<Preferences>();
- appId = new PortletId(appGroup, portletName);
+ appState = new CloneApplicationState<Preferences>(application.getId());
}
else
{
- appState = new TransientApplicationState<WSRP>();
- appId = new WSRPId(application.getUri());
+ appState = new CloneApplicationState<WSRPState>(application.getId());
}
- // set URI to identify the content associated with the state
- appState.setOwnerId(uiPage.getOwnerId());
- appState.setOwnerType(uiPage.getOwnerType());
-
ApplicationType applicationType = remote ? ApplicationType.WSRP_PORTLET : ApplicationType.PORTLET;
- PortletState portletState = new PortletState(appState, applicationType, appId);
+ PortletState portletState = new PortletState(appState, applicationType, null);
uiPortlet.setState(portletState);
uiPortlet.setPortletInPortal(false);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -26,7 +26,6 @@
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.config.annotation.ParamConfig;
-import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.model.SelectItemCategory;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-09 23:42:25 UTC (rev 532)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-10 00:07:49 UTC (rev 533)
@@ -20,9 +20,12 @@
package org.exoplatform.portal.webui.portal;
import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetId;
@@ -50,6 +53,7 @@
import org.exoplatform.services.organization.User;
import org.exoplatform.web.application.Application;
import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UITabPane;
@@ -246,22 +250,24 @@
app = appList.getApplication(sourceId);
String appType = app.getApplicationType();
- ApplicationType<?, ?> applicationType;
+ ApplicationType applicationType;
org.exoplatform.application.registry.Application temp = null;
if (appType.equals(Application.EXO_GADGET_TYPE))
{
- temp = app;
- app = appList.getApplication("dashboard/GadgetPortlet");
- applicationType = ApplicationType.PORTLET;
+ applicationType = ApplicationType.GADGET;
}
else if (appType.equals(Application.EXO_PORTLET_TYPE))
{
applicationType = ApplicationType.PORTLET;
}
- else
+ else if (appType.equals(Application.WSRP_TYPE))
{
applicationType = ApplicationType.WSRP_PORTLET;
}
+ else
+ {
+ throw new AssertionError("Wrong type " + appType);
+ }
//
@@ -288,47 +294,15 @@
UIPage uiPage = uiTarget.getAncestorOfType(UIPage.class);
//
- Object applicationid;
- if (applicationType == ApplicationType.PORTLET)
- {
- applicationid = new PortletId(app.getApplicationGroup(), app.getApplicationName());
- }
- else if (applicationType == ApplicationType.WSRP_PORTLET)
- {
- applicationid = new WSRPId(app.getUri());
- }
- else
- {
- throw new AssertionError();
- }
+ CloneApplicationState state = new CloneApplicationState<Object>(app.getStorageId());
//
- TransientApplicationState<?> applicationState;
- if (applicationType.equals(ApplicationType.PORTLET) && temp != null)
- {
- UIGadget uiGadget = uiApp.createUIComponent(pcontext, UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(temp.getApplicationName()));
- Preferences pref = new Preferences();
- pref.setValue("url", uiGadget.getUrl());
- applicationState = new TransientApplicationState(pref);
- }
- else
- {
- applicationState = new TransientApplicationState();
- }
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ ExoContainer container = context.getApplication().getApplicationServiceContainer();
+ DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ Object id = dataStorage.getId(applicationType, state);
+ PortletState portletState = new PortletState(state, applicationType, id);
- if (uiPage != null)
- {
- applicationState.setOwnerType(uiPage.getOwnerType());
- }
- else
- {
- applicationState.setOwnerType(Util.getUIPortal().getOwnerType());
- }
- applicationState.setOwnerId(Util.getUIPortal().getOwner());
-
- PortletState portletState = new PortletState(applicationState, applicationType, applicationid);
-
uiPortlet.setState(portletState);
uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
15 years, 2 months
gatein SVN: r532 - in portal/trunk: component/portal/src/test/java/conf/portal and 1 other directory.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-11-09 18:42:25 -0500 (Mon, 09 Nov 2009)
New Revision: 532
Modified:
portal/trunk/component/portal/src/test/java/conf/portal/test-configuration.xml
portal/trunk/pom.xml
Log:
GTNPORTAL-111 : revert some settings were usefull (hardcoded paths for tests :-( )
Modified: portal/trunk/component/portal/src/test/java/conf/portal/test-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-11-09 22:39:31 UTC (rev 531)
+++ portal/trunk/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-11-09 23:42:25 UTC (rev 532)
@@ -304,9 +304,6 @@
<import>jar:/conf/portal/common-configuration.xml</import>
<import>jar:/conf/portal/database-configuration.xml</import>
<import>jar:/conf/portal/jcr-configuration.xml</import>
- <import>jar:/conf/portal/idm-configuration.xml</import>
-
- <import>jar:/conf/portal/organization-configuration.xml</import>
-
-
+ <import>jar:/conf/portal/idm-configuration.xml</import>
+ <import>jar:/conf/portal/organization-configuration.xml</import>
</configuration>
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2009-11-09 22:39:31 UTC (rev 531)
+++ portal/trunk/pom.xml 2009-11-09 23:42:25 UTC (rev 532)
@@ -121,6 +121,38 @@
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>mock.portal.dir</name>
+ <value>${exo.projects.directory.src}/gatein/portal/trunk/web/portal/src/main/webapp</value>
+ </property>
+ <property>
+ <name>org.apache.commons.logging.Log</name>
+ <value>org.apache.commons.logging.impl.SimpleLog</value>
+ </property>
+ <property>
+ <name>org.apache.commons.logging.simplelog.defaultlog</name>
+ <value>info</value>
+ </property>
+ <property>
+ <name>org.apache.commons.logging.simplelog.log.[eXo]</name>
+ <value>debug</value>
+ </property>
+ <property>
+ <name>org.apache.commons.logging.simplelog.log.net.hibernate</name>
+ <value>warn</value>
+ </property>
+ <property>
+ <name>java.naming.factory.initial</name>
+ <value>org.exoplatform.services.naming.SimpleContextFactory</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
15 years, 2 months
gatein SVN: r531 - in portal/trunk: component/identity and 1 other directory.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-11-09 17:39:31 -0500 (Mon, 09 Nov 2009)
New Revision: 531
Modified:
portal/trunk/component/identity/pom.xml
portal/trunk/pom.xml
Log:
GTNPORTAL-111 : remove specific surefire settings
Modified: portal/trunk/component/identity/pom.xml
===================================================================
--- portal/trunk/component/identity/pom.xml 2009-11-09 19:58:03 UTC (rev 530)
+++ portal/trunk/component/identity/pom.xml 2009-11-09 22:39:31 UTC (rev 531)
@@ -31,20 +31,6 @@
<packaging>jar</packaging>
<name>GateIn Portal Component JBoss IDM integration</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/TestOrganizationService.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<dependencies>
<dependency>
<groupId>org.exoplatform.core</groupId>
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2009-11-09 19:58:03 UTC (rev 530)
+++ portal/trunk/pom.xml 2009-11-09 22:39:31 UTC (rev 531)
@@ -60,7 +60,7 @@
<jdk.min.version>1.6</jdk.min.version>
<!-- maven-release-plugin -->
- <arguments>-Prelease,pkg-tomcat,pkg-jbossas -Dexo.test.skip=true</arguments>
+ <arguments>-Prelease,pkg-tomcat,pkg-jbossas -Dmaven.test.skip=true</arguments>
</properties>
@@ -121,47 +121,6 @@
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>once</forkMode>
- <!--once , pertest -->
- <includes>
- <include>**/${exo.test.includes}.java</include>
- </includes>
- <systemProperties>
- <property>
- <name>maven.exoplatform.dir</name>
- <value>${exo.directory.base}/projects/exo-platform</value>
- </property>
- <property>
- <name>mock.portal.dir</name>
- <value>${exo.projects.directory.src}/gatein/portal/trunk/web/portal/src/main/webapp</value>
- </property>
- <property>
- <name>org.apache.commons.logging.Log</name>
- <value>org.apache.commons.logging.impl.SimpleLog</value>
- </property>
- <property>
- <name>org.apache.commons.logging.simplelog.defaultlog</name>
- <value>info</value>
- </property>
- <property>
- <name>org.apache.commons.logging.simplelog.log.[eXo]</name>
- <value>debug</value>
- </property>
- <property>
- <name>org.apache.commons.logging.simplelog.log.net.hibernate</name>
- <value>warn</value>
- </property>
- <property>
- <name>java.naming.factory.initial</name>
- <value>org.exoplatform.services.naming.SimpleContextFactory</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -191,29 +150,6 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>bypass-failing-tests</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Remove temporarly tests which are failing -->
- <excludes>
- <!-- /component/resources/ -->
- <!--<exclude>org/exoplatform/services/resources/test/TestResourceBundleService.java</exclude>-->
- <!-- /component/portal/ -->
- <exclude>org/exoplatform/portal/config/security/TestUserPageACL.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
<!-- To be removed and replaced by settings in user config -->
<repositories>
<repository>
15 years, 2 months
gatein SVN: r530 - in components/wsrp/trunk/common: src and 8 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-09 14:58:03 -0500 (Mon, 09 Nov 2009)
New Revision: 530
Added:
components/wsrp/trunk/common/src/test/
components/wsrp/trunk/common/src/test/java/
components/wsrp/trunk/common/src/test/java/org/
components/wsrp/trunk/common/src/test/java/org/gatein/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/UserContextConverterTestCase.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
Modified:
components/wsrp/trunk/common/pom.xml
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
Log:
- Better handling of extra parameters in WSRP URLs.
- Started migrrating tests.
Modified: components/wsrp/trunk/common/pom.xml
===================================================================
--- components/wsrp/trunk/common/pom.xml 2009-11-09 11:58:06 UTC (rev 529)
+++ components/wsrp/trunk/common/pom.xml 2009-11-09 19:58:03 UTC (rev 530)
@@ -20,7 +20,8 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
@@ -57,8 +58,15 @@
<artifactId>jbossxb</artifactId>
</dependency>
<dependency>
- <groupId>javax.xml.soap</groupId>
- <artifactId>saaj-api</artifactId>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
</dependency>
+
+ <!-- tests -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2009-11-09 11:58:06 UTC (rev 529)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -23,17 +23,17 @@
package org.gatein.wsrp;
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
import org.gatein.common.NotYetImplemented;
import org.gatein.common.text.FastURLDecoder;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.ActionURL;
+import org.gatein.pc.api.Mode;
import org.gatein.pc.api.ParametersStateString;
import org.gatein.pc.api.PortletURL;
import org.gatein.pc.api.RenderURL;
import org.gatein.pc.api.ResourceURL;
import org.gatein.pc.api.StateString;
+import org.gatein.pc.api.WindowState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +44,7 @@
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 13120 $
+ * @version $Revision: 13470 $
* @since 2.4 (Apr 28, 2006)
*/
public abstract class WSRPPortletURL implements PortletURL
@@ -66,9 +66,11 @@
private WindowState windowState;
/** Are we using strict rewriting parameters validation mode? */
- private static boolean strict = true;
+ protected static boolean strict = true;
/** Holds extra parameters if we are in relaxed validation mode */
private Map<String, String> extraParams;
+ /** Holds extra data after URL in relaxed mode */
+ protected String extra;
/** Remember position of extra parameters wrt end token */
private boolean extraParamsAfterEndToken = false;
@@ -116,6 +118,7 @@
{
WSRPPortletURL other = (WSRPPortletURL)portletURL;
url.setParams(other.extraParams, other.toString());
+ url.setExtra(other.extra);
}
return url;
@@ -132,6 +135,7 @@
String originalURL = encodedURL;
boolean extraAfterEnd = false;
+ String extra = null;
// URL needs to start wsrp_rewrite? and end with /wsrp_rewrite in strict validation mode
if (!encodedURL.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
@@ -140,25 +144,44 @@
}
if (!encodedURL.endsWith(WSRPRewritingConstants.END_WSRP_REWRITE))
{
- if (strict)
+ // first remove prefix only (as suffix is not at the end of the string)
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
+
+ // end token should be marked by the first / in the URL and extract it
+ int endTokenIndex = encodedURL.indexOf('/');
+ if (endTokenIndex < 0)
{
- throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
}
+
+ encodedURL = encodedURL.substring(0, endTokenIndex)
+ + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+
+ /*
+ we need to deal with the case when a WSRP URL is concatenated to a context path using something similar to:
+ renderResponse.encodeURL(renderRequest.getContextPath()) in which case, there should be a slash still present.
+ How to process further depends on whether we're in strict mode or not...
+ */
+ int concatenationIndex = encodedURL.indexOf('/');
+
+ if (strict && concatenationIndex != endTokenIndex)
+ {
+ // in strict mode, the only character available after the end token is the concatenating slash
+ throw new IllegalArgumentException(encodedURL + " does not end with "
+ + WSRPRewritingConstants.END_WSRP_REWRITE + " or does not appear to be a valid concatenation of URLs.");
+ }
else
{
- // first remove prefix only (as suffix is not at the end of the string)
- encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
-
- // find end token and extract it
- int endTokenIndex = encodedURL.indexOf('/');
- if (endTokenIndex < 0)
+ // deal with extra characters: this should only happen when the URL is concatenated to form a longer one
+ // hence, it should be possible to have param-value pairs followed by a slash '/' then characters.
+ // Anything after the slash will be kept as is, uninterpreted.
+ if (concatenationIndex != -1)
{
- throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ String tmp = encodedURL;
+ encodedURL = encodedURL.substring(0, concatenationIndex);
+ extra = tmp.substring(concatenationIndex);
}
- encodedURL = encodedURL.substring(0, endTokenIndex)
- + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
-
// remember that we should position the extra params after the end token
extraAfterEnd = true;
}
@@ -229,6 +252,7 @@
url.setParams(params, originalURL);
url.setExtraParamsAfterEndToken(extraAfterEnd);
+ url.setExtra(extra);
return url;
}
@@ -379,16 +403,17 @@
if (extraParams != null && !extraParams.isEmpty())
{
StringBuffer extras = new StringBuffer();
- for (Map.Entry<String, String> entry : extraParams.entrySet())
- {
- createURLParameter(extras, entry.getKey(), entry.getValue());
- }
+ appendExtraParams(extras);
// if we had extra params, we need to figure out where thwy should be positioned wrt end token
if (extraParamsAfterEndToken)
{
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
sb.append(extras);
+ if (extra != null)
+ {
+ sb.append(extra);
+ }
}
else
{
@@ -404,6 +429,17 @@
return sb.toString();
}
+ protected void appendExtraParams(StringBuffer buffer)
+ {
+ if (extraParams != null)
+ {
+ for (Map.Entry<String, String> entry : extraParams.entrySet())
+ {
+ createURLParameter(buffer, entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
protected abstract void appendEnd(StringBuffer sb);
protected final void createURLParameter(StringBuffer sb, String name, String value)
@@ -523,4 +559,9 @@
{
this.extraParamsAfterEndToken = extraParamsAfterEndToken;
}
+
+ public void setExtra(String extra)
+ {
+ this.extra = extra;
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2009-11-09 11:58:06 UTC (rev 529)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -1,49 +1,47 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2009, 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 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp;
+import org.gatein.common.net.URLTools;
+import org.gatein.common.net.media.MediaType;
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.common.net.URLTools;
-import org.gatein.common.net.media.MediaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.jboss.logging.Logger;
-import javax.activation.MimeTypeParseException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 11404 $
+ * @version $Revision: 13470 $
* @since 2.4
*/
public class WSRPResourceURL extends WSRPPortletURL
{
- private final static Logger log = LoggerFactory.getLogger(WSRPResourceURL.class);
+ private final static Logger log = Logger.getLogger(WSRPResourceURL.class);
private URL resourceURL;
private boolean requiresRewrite = false;
@@ -102,6 +100,7 @@
if (paramValue != null)
{
requiresRewrite = Boolean.valueOf(paramValue);
+ params.remove(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE);
}
else
{
@@ -126,11 +125,13 @@
String file = resourceURL.getFile();
MediaType mediaType = SUPPORTED_RESOURCE_TYPES.get(file);
- if(mediaType == null)
+ if (mediaType == null)
{
log.debug("Couldn't determine (based on extension) MIME type of file: " + file
+ "\nRetrieving the associated resource will probably fail.");
}
+
+ params.remove(WSRPRewritingConstants.RESOURCE_URL);
}
catch (MalformedURLException e)
{
@@ -146,6 +147,16 @@
public String toString()
{
- return resourceURL.toExternalForm();
+ StringBuffer result = new StringBuffer(resourceURL.toExternalForm());
+
+ appendExtraParams(result);
+
+ // append extra characters if we have some
+ if (extra != null)
+ {
+ result.append(extra);
+ }
+
+ return result.toString();
}
}
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.wsrp.handler;
+
+import org.jboss.util.xml.DOMUtils;
+import org.w3c.dom.Element;
+
+import javax.xml.soap.SOAPBody;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MockSOAPBody implements InvocationHandler
+{
+ Element body;
+
+ public MockSOAPBody(Element body)
+ {
+ this.body = body;
+ }
+
+ public static SOAPBody newInstance(String body) throws IOException
+ {
+ return (SOAPBody)Proxy.newProxyInstance(MockSOAPBody.class.getClassLoader(), new Class[]{SOAPBody.class},
+ new MockSOAPBody(DOMUtils.parse(body)));
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return method.invoke(body, args);
+ }
+}
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,158 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.handler;
+
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessage">Chris
+ * Laprun</a>
+ * @version $Revision: 12277 $
+ * @since 2.4
+ */
+public class MockSOAPMessage extends SOAPMessage
+{
+ MimeHeaders headers;
+ String messageBody;
+
+ public MockSOAPMessage()
+ {
+ headers = new MimeHeaders();
+ }
+
+ public MockSOAPMessage(MimeHeaders headers)
+ {
+ this.headers = headers;
+ }
+
+ public void setMessageBody(String messageBody)
+ {
+ this.messageBody = messageBody;
+ }
+
+ @Override
+ public SOAPBody getSOAPBody() throws SOAPException
+ {
+ try
+ {
+ return MockSOAPBody.newInstance(messageBody);
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ return headers;
+ }
+
+ public void setMimeHeaders(MimeHeaders mimeHeaders)
+ {
+ this.headers = mimeHeaders;
+ }
+
+ public void addAttachmentPart(AttachmentPart attachmentPart)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public AttachmentPart createAttachmentPart()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getContentDescription()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setContentDescription(String string)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPPart getSOAPPart()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAllAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int countAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * For JDK 1.6
+ */
+ public AttachmentPart getAttachment(SOAPElement element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttachments(MimeHeaders mimeHeaders)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void saveChanges() throws SOAPException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean saveRequired()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void writeTo(OutputStream outputStream) throws SOAPException, IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAttachments(MimeHeaders mimeHeaders)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.handler;
+
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessageContext">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.4
+ */
+public class MockSOAPMessageContext implements InvocationHandler
+{
+ MockSOAPMessage message;
+
+
+ public MockSOAPMessageContext(MockSOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public MockSOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(MockSOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+
+ if ("getMessage".equals(methodName))
+ {
+ return getMessage();
+ }
+ else if ("getProperty".equals(methodName))
+ {
+ return "http://jboss.com"; // should only be called to get the endpoint address
+ }
+ else if ("toString".equals(methodName))
+ {
+ return this.toString();
+ }
+
+ throw new UnsupportedOperationException("MockSOAPMessageContext does not support " + methodName + " method");
+ }
+
+ public static SOAPMessageContext createMessageContext(MockSOAPMessage message, ClassLoader classLoader)
+ {
+ return (SOAPMessageContext)Proxy.newProxyInstance(classLoader, new Class[]{SOAPMessageContext.class},
+ new MockSOAPMessageContext(message));
+ }
+}
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,228 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.wsrp.handler;
+
+import junit.framework.TestCase;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPExtensionHandlerTestCase extends TestCase
+{
+ private WSRPExtensionHandler handler;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ handler = new WSRPExtensionHandler();
+ }
+
+ public void testRemoveExtensions() throws SOAPException
+ {
+ MockSOAPMessage message = new MockSOAPMessage();
+ message.setMessageBody("<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'\n" +
+ "\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'\n" +
+ "\txmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+ "\txmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n" +
+ "\t<env:Body>\n" +
+ "\t\t<ns0:getMarkup xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t<ns0:registrationContext\n" +
+ "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t<ns0:registrationHandle\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t17\n" +
+ "\t\t\t\t</ns0:registrationHandle>\n" +
+ "\t\t\t\t<ns0:registrationState\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+ "\t\t\t</ns0:registrationContext>\n" +
+ "\t\t\t<ns0:portletContext\n" +
+ "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t<ns0:portletHandle\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t_18\n" +
+ "\t\t\t\t</ns0:portletHandle>\n" +
+ "\t\t\t\t<ns0:portletState\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+ "\t\t\t</ns0:portletContext>\n" +
+ "\t\t\t<ns0:runtimeContext\n" +
+ "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t<ns0:userAuthentication xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\twsrp:none\n" +
+ "\t\t\t\t</ns0:userAuthentication>\n" +
+ "\t\t\t\t<ns0:portletInstanceKey\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t949994222\n" +
+ "\t\t\t\t</ns0:portletInstanceKey>\n" +
+ "\t\t\t\t<ns0:namespacePrefix\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t__ns949994222_\n" +
+ "\t\t\t\t</ns0:namespacePrefix>\n" +
+ "\t\t\t</ns0:runtimeContext>\n" +
+ "\t\t\t<ns0:userContext\n" +
+ "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t<ns0:userContextKey\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\twsrp:minimal\n" +
+ "\t\t\t\t</ns0:userContextKey>\n" +
+ "\t\t\t\t<ns0:profile\n" +
+ "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+ "\t\t\t</ns0:userContext>\n" +
+ "\t\t\t<ns0:markupParams\n" +
+ "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t<ns0:secureClientCommunication xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\tfalse\n" +
+ "\t\t\t\t\t</ns0:secureClientCommunication>\n" +
+ "\t\t\t\t\t<ns0:locales\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\ten-US\n" +
+ "\t\t\t\t\t</ns0:locales>\n" +
+ "\t\t\t\t\t<ns0:mimeTypes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\ttext/html\n" +
+ "\t\t\t\t\t</ns0:mimeTypes>\n" +
+ "\t\t\t\t\t<ns0:mimeTypes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\ttext/xml\n" +
+ "\t\t\t\t\t</ns0:mimeTypes>\n" +
+ "\t\t\t\t\t<ns0:mimeTypes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\ttext/vnd.oracle.mobilexml\n" +
+ "\t\t\t\t\t</ns0:mimeTypes>\n" +
+ "\t\t\t\t\t<ns0:mimeTypes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t*\n" +
+ "\t\t\t\t\t</ns0:mimeTypes>\n" +
+ "\t\t\t\t\t<ns0:mode\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:view\n" +
+ "\t\t\t\t\t</ns0:mode>\n" +
+ "\t\t\t\t\t<ns0:windowState\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:normal\n" +
+ "\t\t\t\t\t</ns0:windowState>\n" +
+ "\t\t\t\t\t<ns0:clientData\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t<ns0:userAgent\n" +
+ "\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\tMozilla/5.0 (Windows; U; Windows NT 5.1;\n" +
+ "\t\t\t\t\t\t\ten-US; rv:1.9.0.3) Gecko/2008092417\n" +
+ "\t\t\t\t\t\t\tFirefox/3.0.3\n" +
+ "\t\t\t\t\t\t</ns0:userAgent>\n" +
+ "\t\t\t\t\t\t<ns0:extensions\n" +
+ "\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t<ns1:GenericExtension\n" +
+ "\t\t\t\t\t\t\t\txmlns:ns1='http://xmlns.oracle.com/portal/wsrp/v1'>\n" +
+ "\t\t\t\t\t\t\t\t<ns0:NamedString name='CONNECTION'\n" +
+ "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t<ns0:value\n" +
+ "\t\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t\tkeep-alive\n" +
+ "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+ "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+ "\t\t\t\t\t\t\t\t<ns0:NamedString name='ACCEPT-ENCODING'\n" +
+ "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t\tgzip,deflate\n" +
+ "\t\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+ "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+ "\t\t\t\t\t\t\t\t<ns0:NamedString name='KEEP-ALIVE'\n" +
+ "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t\t300\n" +
+ "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+ "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+ "\t\t\t\t\t\t\t\t<ns0:NamedString name='HOST'\n" +
+ "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\t\t\t\t\t127.0.0.1:8988\n" +
+ "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+ "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+ "\t\t\t\t\t\t\t</ns1:GenericExtension>\n" +
+ "\t\t\t\t\t\t</ns0:extensions>\n" +
+ "\t\t\t\t\t</ns0:clientData>\n" +
+ "\t\t\t\t\t<ns0:markupCharacterSets\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\tUTF-8\n" +
+ "\t\t\t\t\t</ns0:markupCharacterSets>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:view\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\turn:javax:portlet:mode:custo m:edit_defaults\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:edit\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:help\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\turn:javax:portlet:mode:custo m:about\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\turn:javax:portlet:mode:custo m:print\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewModes\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\turn:javax:portlet:mode:custo m:config\n" +
+ "\t\t\t\t\t</ns0:validNewModes>\n" +
+ "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:normal\n" +
+ "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+ "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:maximized\n" +
+ "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+ "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+ "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+ "\t\t\t\t\t\twsrp:minimized\n" +
+ "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+ "\t\t\t</ns0:markupParams>\n" +
+ "\t\t</ns0:getMarkup>\n" +
+ "\t</env:Body>\n" +
+ "</env:Envelope>");
+
+
+ SOAPMessageContext msgContext = MockSOAPMessageContext.createMessageContext(message, getClass().getClassLoader());
+
+ handler.handleMessage(msgContext);
+
+ SOAPBody body = msgContext.getMessage().getSOAPBody();
+ String asString = body.toString();
+ assertFalse(asString.contains("ns0:extensions"));
+ assertFalse(asString.contains("ns1:GenericExtensions"));
+ assertFalse(asString.contains("ACCEPT-ENCODING"));
+ }
+}
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/UserContextConverterTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/UserContextConverterTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/UserContextConverterTestCase.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.other;
+
+import junit.framework.TestCase;
+import org.jboss.xb.binding.SimpleTypeBindings;
+
+import java.util.Calendar;
+
+/**
+ * Needs more complete tests!!
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.4
+ */
+public class UserContextConverterTestCase extends TestCase
+{
+ public void testDateFormat()
+ {
+ String dateAsString = "1983-12-11T00:00:00.000+01:00";
+ Calendar bdate = SimpleTypeBindings.unmarshalDateTime(dateAsString);
+ String result = SimpleTypeBindings.marshalDateTime(bdate);
+ assertEquals(dateAsString, result);
+ }
+}
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/UserContextConverterTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2009-11-09 19:58:03 UTC (rev 530)
@@ -0,0 +1,277 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.other;
+
+import junit.framework.TestCase;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.WSRPActionURL;
+import org.gatein.wsrp.WSRPPortletURL;
+import org.gatein.wsrp.WSRPRenderURL;
+import org.gatein.wsrp.WSRPRewritingConstants;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13470 $
+ * @since 2.4 (Apr 28, 2006)
+ */
+public class WSRPPortletURLTestCase extends TestCase
+{
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ WSRPPortletURL.setStrict(true);
+ }
+
+ public void testResource()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
+ "&wsrp-requiresRewrite=true/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertEquals("http://test.com/images/test.gif", url.toString());
+ }
+
+ /** Declare a secure interaction back to the Portlet */
+ public void testSecureInteraction()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-secureURL=true" +
+ "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPActionURL);
+ WSRPActionURL actionURL = (WSRPActionURL)url;
+ assertTrue(url.isSecure());
+ assertEquals("a8h4K5JD9", actionURL.getNavigationalState().getStringValue());
+ assertEquals("fg4h923mdk", actionURL.getInteractionState().getStringValue());
+ }
+
+ /** Request the Consumer render the Portlet in a different mode and window state */
+ public void testDifferentModeAndWindowState()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=render&wsrp-mode=wsrp:help&wsrp-windowState=wsrp:maximized/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPRenderURL);
+ assertEquals(Mode.HELP, url.getMode());
+ assertEquals(WindowState.MAXIMIZED, url.getWindowState());
+ }
+
+ public void testMinimal()
+ {
+ String minimalURLType = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(minimalURLType);
+
+ assertTrue(url instanceof WSRPRenderURL);
+ }
+
+ public void testInvalidParameterName()
+ {
+ String message = "Should have detected invalid parameter: ";
+
+ String invalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ checkInvalidURL(invalid, message, "foo");
+ }
+
+ public void testDoublyEncodedAmpersand()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=wsrp:help&amp;wsrp-windowState=wsrp:maximized/wsrp_rewrite";
+ try
+ {
+ WSRPPortletURL.create(expected);
+ fail("Should have thrown an exception on doubly encoded &!");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+ }
+
+ /** Relax validation and test that we now accept normally invalid URLs. */
+ public void testExtraParametersRelaxedValidation()
+ {
+ WSRPPortletURL.setStrict(false);
+
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+
+ WSRPPortletURL url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().contains("foo=bar"));
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().endsWith("foo=bar"));
+
+ String stillInvalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar";
+ checkInvalidURL(stillInvalid, "Should have detected missing end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ public void testExtraRelaxedValidation()
+ {
+ String valid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite/helloworld.jar";
+ WSRPPortletURL url = WSRPPortletURL.create(valid);
+ assertEquals("http://localhost:8080/helloworld/helloworld.jar", url.toString());
+
+ String invalid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
+ checkInvalidURL(invalid, "Should have detected improper position of end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+
+ WSRPPortletURL.setStrict(false);
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
+ url = WSRPPortletURL.create(validInRelaxedMode);
+ assertEquals("http://localhost:8080/helloworld&foo=bar/helloworld.jar", url.toString());
+ }
+
+ public void testExtraParameters()
+ {
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ checkInvalidURL(validInRelaxedMode, "Should have detected invalid parameter: ", "foo");
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ checkInvalidURL(validInRelaxedMode, "Should have detected URL doesn't end with end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ public void testInvalidMode()
+ {
+ String message = "Should have detected invalid mode: ";
+
+ String invalid = "wsrp_rewrite?wsrp-urlType=render&wsrp-mode=foo/wsrp_rewrite";
+ checkInvalidURL(invalid, message, "foo");
+ }
+
+ public void testCustomModeAndWindowState()
+ {
+ Set<String> modes = new HashSet<String>();
+ modes.add("urn:foo");
+
+ Set<String> windowStates = new HashSet<String>();
+ windowStates.add("urn:bar");
+
+ String urlString = "wsrp_rewrite?wsrp-urlType=render&wsrp-mode=urn%3Afoo&wsrp-windowState=urn%3Abar/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(urlString, modes, windowStates);
+ assertEquals("urn:foo", url.getMode().toString());
+ assertEquals("urn:bar", url.getWindowState().toString());
+ }
+
+ public void testEncodedMode()
+ {
+ String encoded = "wsrp_rewrite?wsrp-urlType=render&wsrp-mode=wsrp%3Aview/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(encoded);
+ assertEquals(Mode.VIEW, url.getMode());
+
+ encoded = "wsrp_rewrite?wsrp-urlType=render&wsrp-mode=wsrp%3aedit/wsrp_rewrite";
+ url = WSRPPortletURL.create(encoded);
+ assertEquals(Mode.EDIT, url.getMode());
+ }
+
+ public void testEncodedWindowState()
+ {
+ String encoded = "wsrp_rewrite?wsrp-urlType=render&wsrp-windowState=wsrp%3Amaximized/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(encoded);
+ assertEquals(WindowState.MAXIMIZED, url.getWindowState());
+
+ encoded = "wsrp_rewrite?wsrp-urlType=render&wsrp-windowState=wsrp%3aminimized/wsrp_rewrite";
+ url = WSRPPortletURL.create(encoded);
+ assertEquals(WindowState.MINIMIZED, url.getWindowState());
+ }
+
+ public void testInvalidResourceURLV1()
+ {
+ String message = "Should have detected missing parameter: ";
+
+ String invalid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%2F/wsrp_rewrite";
+ checkInvalidURL(invalid, message, WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE);
+
+ invalid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-requiresRewrite=true/wsrp_rewrite";
+ checkInvalidURL(invalid, message, WSRPRewritingConstants.RESOURCE_URL);
+
+ invalid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=invalidURL&wsrp-requiresRewrite=true/wsrp_rewrite";
+ checkInvalidURL(invalid, "Should have detected invalid URL: ", "invalidURL");
+ }
+
+ public void testNullURL()
+ {
+ try
+ {
+ WSRPPortletURL.create(null);
+ fail("Should have detected null URL");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testInvalidURLType()
+ {
+ String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&wsrp-mode=help/wsrp_rewrite";
+
+ try
+ {
+ WSRPPortletURL.create(wrongURLType);
+ fail("Should have detected wrong URL type");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testProperEndTokenInRelaxedMode()
+ {
+ WSRPPortletURL.setStrict(false);
+
+ WSRPPortletURL url = new WSRPPortletURL()
+ {
+ @Override
+ protected String getURLType()
+ {
+ return WSRPRewritingConstants.URL_TYPE_BLOCKING_ACTION;
+ }
+
+ @Override
+ protected void appendEnd(StringBuffer sb)
+ {
+ }
+ };
+ assertTrue(url.toString().contains(WSRPRewritingConstants.END_WSRP_REWRITE));
+ }
+
+ private void checkInvalidURL(String invalid, String message, String mustBeInException)
+ {
+ try
+ {
+ WSRPPortletURL.create(invalid);
+ fail(message + mustBeInException);
+ }
+ catch (IllegalArgumentException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains(mustBeInException));
+ }
+ }
+}
\ No newline at end of file
Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
15 years, 2 months