Author: julien_viet
Date: 2010-02-17 08:52:56 -0500 (Wed, 17 Feb 2010)
New Revision: 1770
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
Log:
GTNPORTAL-677 : Filter application registry import
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2010-02-17
09:19:22 UTC (rev 1769)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2010-02-17
13:52:56 UTC (rev 1770)
@@ -37,7 +37,8 @@
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.gatein.common.i18n.LocalizedString;
-import org.gatein.common.util.Tools;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
import org.gatein.pc.api.PortletInvoker;
@@ -45,11 +46,7 @@
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;
+import java.util.*;
/**
* The fundamental reason that motives to use tasks is because of the JMX access that
does not
@@ -63,6 +60,9 @@
{
/** . */
+ private static final String INTERNAL_PORTLET_TAG = "gatein_internal";
+
+ /** . */
private static final String REMOTE_CATEGORY_NAME = "remote";
/** . */
@@ -75,6 +75,9 @@
private final ChromatticLifeCycle lifeCycle;
/** . */
+ private final Logger log =
LoggerFactory.getLogger(ApplicationRegistryServiceImpl.class);
+
+ /** . */
final POMSessionManager mopManager;
public ApplicationRegistryServiceImpl(ChromatticManager manager, POMSessionManager
mopManager)
@@ -393,11 +396,15 @@
ContentRegistry registry = getContentRegistry();
//
+ log.info("About to import portlets in application registry");
+
+ //
ExoContainer manager = ExoContainerContext.getCurrentContainer();
PortletInvoker portletInvoker =
(PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();
//
+ portlet:
for (org.gatein.pc.api.Portlet portlet : portlets)
{
PortletInfo info = portlet.getInfo();
@@ -411,32 +418,46 @@
LocalizedString keywordsLS = info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
- String[] categoryNames = null;
+ //
+ Set<String> categoryNames = new HashSet<String>();
+
+ // Process keywords
if (keywordsLS != null)
{
String keywords = keywordsLS.getDefaultString();
if (keywords != null && keywords.length() != 0)
{
- categoryNames = keywords.split(",");
+ for (String categoryName : keywords.split(",")) {
+ // Trim name
+ categoryName = categoryName.trim();
+ if (INTERNAL_PORTLET_TAG.equalsIgnoreCase(categoryName)) {
+ log.debug("Skipping portlet (" + portletApplicationName +
"," + portletName + ") + tagged as internal");
+ continue portlet;
+ } else {
+ categoryNames.add(categoryName);
+ }
+ }
}
}
- if (categoryNames == null || categoryNames.length == 0)
+ // If no keywords, use the portlet application name
+ if (categoryNames.isEmpty())
{
- categoryNames = new String[]{portletApplicationName};
+ categoryNames.add(portletApplicationName.trim());
}
+ // Additionally categorise the portlet as remote
if (portlet.isRemote())
{
- categoryNames = Tools.appendTo(categoryNames, REMOTE_CATEGORY_NAME);
+ categoryNames.add(REMOTE_CATEGORY_NAME);
}
//
+ log.info("Importing portlet (" + portletApplicationName +
"," + portletName + ") in categories " + categoryNames);
+
+ // Process categoriy names
for (String categoryName : categoryNames)
{
- categoryName = categoryName.trim();
-
- //
CategoryDefinition category = registry.getCategory(categoryName);
//
@@ -452,10 +473,6 @@
{
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())
@@ -469,7 +486,6 @@
contentId = info.getApplicationName() + "/" +
info.getName();
}
-
//
app = category.createContent(portletName, contentType, contentId);
app.setDisplayName(getLocalizedStringValue(displayNameLS, portletName));
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2010-02-17 09:19:22
UTC (rev 1769)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2010-02-17 13:52:56
UTC (rev 1770)
@@ -240,7 +240,7 @@
<portlet-info>
<title>Administration Toolbar Portlet</title>
<short-title>Administration Toolbar</short-title>
- <keywords>System</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
</portlet>
@@ -265,7 +265,7 @@
<portlet-info>
<title>User Info Portlet</title>
<short-title>UserInfo</short-title>
- <keywords>System, UserInfo</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
<security-role-ref>
@@ -295,7 +295,7 @@
<portlet-info>
<title>User Toolbar Site Portlet</title>
<short-title>UserToolbarSite</short-title>
- <keywords>System</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
<security-role-ref>
@@ -325,7 +325,7 @@
<portlet-info>
<title>User Toolbar Dashboard Portlet</title>
<short-title>UserToolbarDashboard</short-title>
- <keywords>System</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
<security-role-ref>
@@ -355,7 +355,7 @@
<portlet-info>
<title>User Toolbar Group Portlet</title>
<short-title>UserToolbarGroup</short-title>
- <keywords>System</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
<security-role-ref>
@@ -384,7 +384,7 @@
<portlet-info>
<title>Star Toolbar Portlet</title>
<short-title>Star Toolbar</short-title>
- <keywords>System</keywords>
+ <keywords>gatein_internal</keywords>
</portlet-info>
</portlet>
Show replies by date