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);