gatein SVN: r661 - portal/trunk/portlet/exoadmin/src/main/webapp/skin/navigation/webui/component/background.
by do-not-reply@jboss.org
Author: thanh.do
Date: 2009-11-18 21:55:39 -0500 (Wed, 18 Nov 2009)
New Revision: 661
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/skin/navigation/webui/component/background/MiniIcon.gif
Log:
GTNPORTAL-259:Error displaying in UISiteManagement when change some languages
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/skin/navigation/webui/component/background/MiniIcon.gif
===================================================================
(Binary files differ)
15 years, 1 month
gatein SVN: r660 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-18 19:07:18 -0500 (Wed, 18 Nov 2009)
New Revision: 660
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java
Log:
more correct statistic retrieval
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java 2009-11-19 00:04:16 UTC (rev 659)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java 2009-11-19 00:07:18 UTC (rev 660)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.application;
-import org.exoplatform.application.registry.Application;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
@@ -30,12 +29,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -154,21 +148,27 @@
private String[] getApplicationsSortedByAverageTime(boolean desc)
{
- TreeMap<Double, String> map = new TreeMap<Double, String>();
+ List<ApplicationStatistic> list = new ArrayList<ApplicationStatistic>();
for (ApplicationStatistic app : apps.values())
{
if (app.getAverageTime() > 0)
{
- map.put(app.getAverageTime(), app.getAppId());
+ list.add(app);
}
}
- List<String> list = new ArrayList<String>(map.values());
+ Collections.sort(list, new Comparator<ApplicationStatistic>()
+ {
+ public int compare(ApplicationStatistic o1, ApplicationStatistic o2)
+ {
+ return (int)Math.signum(o1.getAverageTime() - o2.getAverageTime());
+ }
+ });
if (desc)
{
Collections.reverse(list);
}
- List<String> sub = list.subList(0, Math.min(map.size(), 10));
- return sub.toArray(new String[sub.size()]);
+ List<ApplicationStatistic> sub = list.subList(0, Math.min(list.size(), 10));
+ return asIds(sub);
}
/*
@@ -178,20 +178,36 @@
@ManagedDescription("The list of the 10 most executed applications")
public String[] getMostExecutedApplications()
{
- TreeMap<Long, String> map = new TreeMap<Long, String>();
+ ArrayList<ApplicationStatistic> list = new ArrayList<ApplicationStatistic>();
for (ApplicationStatistic app : apps.values())
{
if (app.executionCount() > 0)
{
- map.put(app.executionCount(), app.getAppId());
+ list.add(app);
}
}
- List<String> list = new ArrayList<String>(map.values());
- Collections.reverse(list);
- List<String> sub = list.subList(0, Math.min(map.size(), 10));
- return sub.toArray(new String[sub.size()]);
+ Collections.sort(list, new Comparator<ApplicationStatistic>()
+ {
+ public int compare(ApplicationStatistic o1, ApplicationStatistic o2)
+ {
+ long diff = o1.executionCount() - o2.executionCount();
+ return diff == 0 ? 0 : diff > 0 ? -1 : 1;
+ }
+ });
+ List<ApplicationStatistic> sub = list.subList(0, Math.min(list.size(), 10));
+ return asIds(sub);
}
+ private String[] asIds(List<ApplicationStatistic> list)
+ {
+ String[] array = new String[list.size()];
+ for (int i = 0;i < list.size();i++)
+ {
+ array[i] = list.get(i).getAppId();
+ }
+ return array;
+ }
+
private double toSeconds(double value)
{
return value == -1 ? -1 : value / 1000D;
15 years, 1 month
gatein SVN: r658 - tools/packager/tags.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2009-11-18 19:04:09 -0500 (Wed, 18 Nov 2009)
New Revision: 658
Added:
tools/packager/tags/1.0.0-Beta02/
Log:
[maven-scm] copy for tag 1.0.0-Beta02
Copied: tools/packager/tags/1.0.0-Beta02 (from rev 657, tools/packager/tags/1.0.0-Beta01)
15 years, 1 month
gatein SVN: r656 - tools/packager/trunk.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2009-11-18 18:52:50 -0500 (Wed, 18 Nov 2009)
New Revision: 656
Modified:
tools/packager/trunk/
tools/packager/trunk/pom.xml
Log:
1.0.0-Beta01 release (prepare Beta02)
Property changes on: tools/packager/trunk
___________________________________________________________________
Name: svn:ignore
+ target
Modified: tools/packager/trunk/pom.xml
===================================================================
--- tools/packager/trunk/pom.xml 2009-11-18 23:39:15 UTC (rev 655)
+++ tools/packager/trunk/pom.xml 2009-11-18 23:52:50 UTC (rev 656)
@@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.tools</groupId>
<artifactId>packager</artifactId>
- <version>1.0.0-Beta01</version>
+ <version>1.0.0-Beta02-SNAPSHOT</version>
<name>GateIn Packager</name>
<packaging>pom</packaging>
<scm>
15 years, 1 month
gatein SVN: r655 - in portal/trunk: webui/portal/src/main/java/org/exoplatform/portal/application and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-18 18:39:15 -0500 (Wed, 18 Nov 2009)
New Revision: 655
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatistic.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java
Log:
improve the application statistic service making it not rely on the application registry
Modified: 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 2009-11-18 23:03:17 UTC (rev 654)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-18 23:39:15 UTC (rev 655)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.registry.CategoryDefinition;
import org.exoplatform.portal.pom.registry.ContentDefinition;
import org.exoplatform.portal.pom.registry.ContentRegistry;
@@ -48,8 +49,13 @@
import java.util.Comparator;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
/**
+ * The fundamental reason that motives to use tasks is because of the JMX access that does not
+ * setup a context and therefore the task either reuse the existing context setup by the portal
+ * or create a temporary context when accessed by JMX.
+ *
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
@@ -83,27 +89,34 @@
}
public List<ApplicationCategory> getApplicationCategories(
- Comparator<ApplicationCategory> sortComparator,
+ final Comparator<ApplicationCategory> sortComparator,
String accessUser,
- ApplicationType<?>... appTypes) throws Exception
+ final ApplicationType<?>... appTypes) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ final List<ApplicationCategory> categories = new ArrayList<ApplicationCategory>();
//
- List<ApplicationCategory> categories = new ArrayList<ApplicationCategory>();
- for (CategoryDefinition categoryDef : registry.getCategoryList())
+ pomMGr.execute(new POMTask()
{
- ApplicationCategory category = load(categoryDef, appTypes);
- categories.add(category);
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- if (sortComparator != null)
- {
- Collections.sort(categories, sortComparator);
- }
+ //
+ for (CategoryDefinition categoryDef : registry.getCategoryList())
+ {
+ ApplicationCategory category = load(categoryDef, appTypes);
+ categories.add(category);
+ }
+ //
+ if (sortComparator != null)
+ {
+ Collections.sort(categories, sortComparator);
+ }
+ }
+ });
+
//
return categories;
}
@@ -123,53 +136,69 @@
return getApplicationCategories(sortComparator, null);
}
- public ApplicationCategory getApplicationCategory(String name) throws Exception
+ public ApplicationCategory getApplicationCategory(final String name) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ final AtomicReference<ApplicationCategory> a = new AtomicReference<ApplicationCategory>();
//
- CategoryDefinition categoryDef = registry.getCategory(name);
- if (categoryDef != null)
+ pomMGr.execute(new POMTask()
{
- return load(categoryDef);
- }
- else
- {
- return null;
- }
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- public void save(ApplicationCategory category) throws Exception
- {
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ //
+ CategoryDefinition categoryDef = registry.getCategory(name);
+ if (categoryDef != null)
+ {
+ ApplicationCategory applicationCategory = load(categoryDef);
+ a.set(applicationCategory);
+ }
+ }
+ });
//
- String categoryName = category.getName();
+ return a.get();
+ }
- //
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
+ public void save(final ApplicationCategory category) throws Exception
+ {
+ pomMGr.execute(new POMTask()
{
- categoryDef = registry.createCategory(categoryName);
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- categoryDef.setDisplayName(category.getDisplayName());
- categoryDef.setCreationDate(category.getCreatedDate());
- categoryDef.setLastModificationDate(category.getModifiedDate());
- categoryDef.setDescription(category.getDescription());
- categoryDef.setAccessPermissions(category.getAccessPermissions());
+ //
+ 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
+ public void remove(final ApplicationCategory category) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
-
- //
- registry.getCategoryMap().remove(category.getName());
+ pomMGr.execute(new POMTask()
+ {
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
+ registry.getCategoryMap().remove(category.getName());
+ }
+ });
}
public List<Application> getApplications(ApplicationCategory category, ApplicationType<?>... appTypes) throws Exception
@@ -178,25 +207,36 @@
}
public List<Application> getApplications(
- ApplicationCategory category,
- Comparator<Application> sortComparator,
- ApplicationType<?>... appTypes) throws Exception
+ final ApplicationCategory category,
+ final Comparator<Application> sortComparator,
+ final ApplicationType<?>... appTypes) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ final AtomicReference<List<Application>> ref = new AtomicReference<List<Application>>();
//
- CategoryDefinition categoryDef = registry.getCategory(category.getName());
- List<Application> applications = load(categoryDef, appTypes).getApplications();
-
- //
- if (sortComparator != null)
+ pomMGr.execute(new POMTask()
{
- Collections.sort(applications, sortComparator);
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
+ //
+ CategoryDefinition categoryDef = registry.getCategory(category.getName());
+ List<Application> applications = load(categoryDef, appTypes).getApplications();
+
+ //
+ if (sortComparator != null)
+ {
+ Collections.sort(applications, sortComparator);
+ }
+
+ //
+ ref.set(applications);
+ }
+ });
+
//
- return applications;
+ return ref.get();
}
public List<Application> getAllApplications() throws Exception
@@ -220,90 +260,108 @@
return getApplication(fragments[0], fragments[1]);
}
- public Application getApplication(String category, String name) throws Exception
+ public Application getApplication(final String category, final String name) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ final AtomicReference<Application> ref = new AtomicReference<Application>();
//
- CategoryDefinition categoryDef = registry.getCategory(category);
- if (categoryDef != null)
+ pomMGr.execute(new POMTask()
{
- ContentDefinition contentDef = categoryDef.getContentMap().get(name);
- if (contentDef != null)
+ public void run(POMSession session) throws Exception
{
- return load(contentDef);
+ ContentRegistry registry = session.getContentRegistry();
+
+ //
+ CategoryDefinition categoryDef = registry.getCategory(category);
+ if (categoryDef != null)
+ {
+ ContentDefinition contentDef = categoryDef.getContentMap().get(name);
+ if (contentDef != null)
+ {
+ ref.set(load(contentDef));
+ }
+ }
}
- }
+ });
//
- return null;
+ return ref.get();
}
- public void save(ApplicationCategory category, Application application) throws Exception
+ public void save(final ApplicationCategory category, final Application application) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
-
- //
- String categoryName = category.getName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
+ pomMGr.execute(new POMTask()
{
- categoryDef = registry.createCategory(categoryName);
- save(category, categoryDef);
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- 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 = application.getType().getContentType();
- String definitionName = application.getDisplayName().replace(' ', '_');
- contentDef = categoryDef.createContent(definitionName, contentType, contentId);
- }
- else
- {
- // A JCR move actually
- categoryDef.getContentList().add(contentDef);
- }
+ //
+ String categoryName = category.getName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ categoryDef = registry.createCategory(categoryName);
+ save(category, categoryDef);
+ }
- // Update state
- save(application, contentDef);
+ //
+ 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 = application.getType().getContentType();
+ 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
+ public void update(final Application application) throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
-
- //
- String categoryName = application.getCategoryName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
+ pomMGr.execute(new POMTask()
{
- throw new IllegalStateException();
- }
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- ContentDefinition contentDef = categoryDef.getContentMap().get(application.getApplicationName());
- if (contentDef == null)
- {
- throw new IllegalStateException();
- }
+ //
+ String categoryName = application.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ throw new IllegalStateException();
+ }
- // Update state
- save(application, contentDef);
+ //
+ 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
+ public void remove(final Application app) throws Exception
{
if (app == null)
{
@@ -311,154 +369,169 @@
}
//
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ pomMGr.execute(new POMTask()
+ {
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- String categoryName = app.getCategoryName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ //
+ String categoryName = app.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
- //
- if (categoryDef != null)
- {
+ //
+ if (categoryDef != null)
+ {
- String contentName = app.getApplicationName();
- categoryDef.getContentMap().remove(contentName);
- }
+ String contentName = app.getApplicationName();
+ categoryDef.getContentMap().remove(contentName);
+ }
+ }
+ });
}
public void importExoGadgets() throws Exception
{
- POMSession session = POMSessionManager.getSession();
- ContentRegistry registry = session.getContentRegistry();
+ pomMGr.execute(new POMTask()
+ {
+ public void run(POMSession session) throws Exception
+ {
+ ContentRegistry registry = session.getContentRegistry();
- //
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- GadgetRegistryService gadgetService = (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
- List<Gadget> eXoGadgets = gadgetService.getAllGadgets();
+ //
+ 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";
+ //
+ 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);
- }
+ //
+ 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);
+ //
+ 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<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();
-
- //
- for (org.gatein.pc.api.Portlet portlet : portlets)
+ pomMGr.execute(new POMTask()
{
- 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)
+ public void run(POMSession session) throws Exception
{
- String keywords = keywordsLS.getDefaultString();
- if (keywords != null && keywords.length() != 0)
- {
- categoryNames = keywords.split(",");
- }
- }
+ ContentRegistry registry = session.getContentRegistry();
- 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);
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ PortletInvoker portletInvoker = (PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
+ Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();
//
- if (category == null)
+ for (org.gatein.pc.api.Portlet portlet : portlets)
{
- category = registry.createCategory(categoryName);
- category.setDisplayName(categoryName);
- }
+ PortletInfo info = portlet.getInfo();
+ String portletApplicationName = info.getApplicationName();
+ String portletName = info.getName();
- //
- 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);
+ // 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('/', '_');
- // julien: ????
- // getLocalizedStringValue(descriptionLS, portletName);
+ LocalizedString keywordsLS = info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
- ContentType<?> contentType;
- String contentId;
- if (portlet.isRemote())
+ String[] categoryNames = null;
+ if (keywordsLS != null)
{
- contentType = WSRP.CONTENT_TYPE;
- contentId = portlet.getContext().getId();
+ String keywords = keywordsLS.getDefaultString();
+ if (keywords != null && keywords.length() != 0)
+ {
+ categoryNames = keywords.split(",");
+ }
}
- else
+
+ if (categoryNames == null || categoryNames.length == 0)
{
- contentType = Portlet.CONTENT_TYPE;
- contentId = info.getApplicationName() + "/" + info.getName();
+ categoryNames = new String[]{portletApplicationName};
}
+ if (portlet.isRemote())
+ {
+ categoryNames = Tools.appendTo(categoryNames, REMOTE_CATEGORY_NAME);
+ }
//
- app = category.createContent(portletName, contentType, contentId);
- app.setDisplayName(getLocalizedStringValue(displayNameLS, portletName));
- app.setDescription(getLocalizedStringValue(descriptionLS, portletName));
+ 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 = Portlet.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, ApplicationType<?>... appTypes)
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatistic.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatistic.java 2009-11-18 23:03:17 UTC (rev 654)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatistic.java 2009-11-18 23:39:15 UTC (rev 655)
@@ -51,6 +51,11 @@
this.appId = appId;
}
+ public String getAppId()
+ {
+ return appId;
+ }
+
/**
* Log the time.
*
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java 2009-11-18 23:03:17 UTC (rev 654)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ApplicationStatisticService.java 2009-11-18 23:39:15 UTC (rev 655)
@@ -20,7 +20,6 @@
package org.exoplatform.portal.application;
import org.exoplatform.application.registry.Application;
-import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
@@ -36,6 +35,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -50,17 +50,11 @@
public class ApplicationStatisticService implements Startable
{
- private ApplicationRegistryService appRegistryService;
+ /** . */
+ private final ConcurrentMap<String, ApplicationStatistic> apps = new ConcurrentHashMap<String, ApplicationStatistic>();
- private ConcurrentMap<String, ApplicationStatistic> apps = new ConcurrentHashMap<String, ApplicationStatistic>();
-
- private final String ASC = "ASC";
-
- private final String DESC = "DESC";
-
- public ApplicationStatisticService(ApplicationRegistryService appRegistryService)
+ public ApplicationStatisticService()
{
- this.appRegistryService = appRegistryService;
}
/*
@@ -70,22 +64,9 @@
@ManagedDescription("The list of application identifiers sorted alphabetically")
public String[] getApplicationList()
{
- List<Application> list = null;
- try
- {
- list = appRegistryService.getAllApplications();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- List<String> appIds = new ArrayList<String>();
- for (Application app : list)
- {
- appIds.add(app.getId());
- }
- Collections.sort(appIds);
- return appIds.toArray(new String[appIds.size()]);
+ List<String> list = new ArrayList<String>(apps.keySet());
+ Collections.sort(list);
+ return list.toArray(new String[list.size()]);
}
/*
@@ -158,28 +139,7 @@
@ManagedDescription("The list of the 10 slowest applications")
public String[] getSlowestApplications()
{
- List<Application> list = null;
- Map application = new HashMap();
- try
- {
- list = appRegistryService.getAllApplications();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- for (Application app : list)
- {
- ApplicationStatistic appSta = getApplicationStatistic(app.getId());
- // remove application haven't loaded
- if (appSta.getAverageTime() != 0)
- {
- application.put(app.getId(), appSta.getAverageTime());
- }
- }
-
- return sort(application, DESC);
+ return getApplicationsSortedByAverageTime(true);
}
/*
@@ -189,28 +149,26 @@
@ManagedDescription("The list of the 10 fastest applications")
public String[] getFastestApplications()
{
- List<Application> list = null;
- Map application = new HashMap();
- try
- {
- list = appRegistryService.getAllApplications();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ return getApplicationsSortedByAverageTime(false);
+ }
- for (Application app : list)
+ private String[] getApplicationsSortedByAverageTime(boolean desc)
+ {
+ TreeMap<Double, String> map = new TreeMap<Double, String>();
+ for (ApplicationStatistic app : apps.values())
{
- ApplicationStatistic appSta = getApplicationStatistic(app.getId());
- // remove application haven't loaded
- if (appSta.getAverageTime() != 0)
+ if (app.getAverageTime() > 0)
{
- application.put(app.getId(), appSta.getAverageTime());
+ map.put(app.getAverageTime(), app.getAppId());
}
}
-
- return sort(application, ASC);
+ List<String> list = new ArrayList<String>(map.values());
+ if (desc)
+ {
+ Collections.reverse(list);
+ }
+ List<String> sub = list.subList(0, Math.min(map.size(), 10));
+ return sub.toArray(new String[sub.size()]);
}
/*
@@ -220,99 +178,20 @@
@ManagedDescription("The list of the 10 most executed applications")
public String[] getMostExecutedApplications()
{
- List<Application> list = null;
- Map application = new HashMap();
- try
+ TreeMap<Long, String> map = new TreeMap<Long, String>();
+ for (ApplicationStatistic app : apps.values())
{
- list = appRegistryService.getAllApplications();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- for (Application app : list)
- {
- ApplicationStatistic appSta = getApplicationStatistic(app.getId());
- // remove application haven't loaded
- if (appSta.executionCount() != 0)
+ if (app.executionCount() > 0)
{
- application.put(app.getId(), appSta.executionCount());
+ map.put(app.executionCount(), app.getAppId());
}
}
-
- return sort(application, DESC);
+ List<String> list = new ArrayList<String>(map.values());
+ Collections.reverse(list);
+ List<String> sub = list.subList(0, Math.min(map.size(), 10));
+ return sub.toArray(new String[sub.size()]);
}
- /*
- * sort map by value asc or desc
- */
- private String[] sort(Map source, String order)
- {
- String[] app = new String[10];
- List<Object> list = new LinkedList<Object>(source.entrySet());
- if (order.equals(ASC))
- {
- Collections.sort(list, new Comparator<Object>()
- {
- public int compare(Object o1, Object o2)
- {
- double value1 = Double.parseDouble(((Map.Entry)(o1)).getValue().toString());
- double value2 = Double.parseDouble(((Map.Entry)(o2)).getValue().toString());
- if (value1 > value2)
- {
- return 1;
- }
- else if (value1 < value2)
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- });
- }
- else if (order.equals(DESC))
- {
- Collections.sort(list, new Comparator<Object>()
- {
- public int compare(Object o1, Object o2)
- {
- double value1 = Double.parseDouble(((Map.Entry)(o1)).getValue().toString());
- double value2 = Double.parseDouble(((Map.Entry)(o2)).getValue().toString());
- if (value2 > value1)
- {
- return 1;
- }
- else if (value2 < value1)
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- });
- }
-
- int index = 0;
- for (Iterator it = list.iterator(); it.hasNext();)
- {
- Map.Entry entry = (Map.Entry)it.next();
- app[index] = (String)entry.getKey();
- index++;
- if (index >= app.length)
- {
- break;
- }
- }
- return app;
-
- }
-
private double toSeconds(double value)
{
return value == -1 ? -1 : value / 1000D;
15 years, 1 month
gatein SVN: r654 - in portal/branches/wsrp-integration: component/wsrp and 10 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-18 18:03:17 -0500 (Wed, 18 Nov 2009)
New Revision: 654
Added:
portal/branches/wsrp-integration/component/wsrp/src/test/
portal/branches/wsrp-integration/component/wsrp/src/test/java/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/consumer/
portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistryTestCase.java
Modified:
portal/branches/wsrp-integration/component/wsrp/pom.xml
portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistry.java
portal/branches/wsrp-integration/pom.xml
Log:
- Use SNAPSHOT versions of common and WSRP modules.
- Updated ConsumerRegistry code.
- Added ConsumerRegistryTestCase based on the class of the same name in WSRP consumer tests. Ideally, I would be able to share that code, not
sure how to do it cleanly... :( Note also that the test currently doesn't pass as it needs proper chromattic and jcr setup.
Modified: portal/branches/wsrp-integration/component/wsrp/pom.xml
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/pom.xml 2009-11-18 18:52:08 UTC (rev 653)
+++ portal/branches/wsrp-integration/component/wsrp/pom.xml 2009-11-18 23:03:17 UTC (rev 654)
@@ -95,7 +95,20 @@
<groupId>org.chromattic</groupId>
<artifactId>chromattic.api</artifactId>
<version>${version.chromattic}</version>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.chromattic</groupId>
+ <artifactId>chromattic.core</artifactId>
+ <version>${version.chromattic}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.chromattic</groupId>
+ <artifactId>chromattic.exo</artifactId>
+ <version>${version.chromattic}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
Modified: portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistry.java
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistry.java 2009-11-18 18:52:08 UTC (rev 653)
+++ portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistry.java 2009-11-18 23:03:17 UTC (rev 654)
@@ -52,9 +52,8 @@
private static final String WSRP_SERVICES_PATH = RegistryService.EXO_SERVICES + "/wsrp/";
private static final String PRODUCER_INFOS_PATH = WSRP_SERVICES_PATH + "producerinfos";
- public ConsumerRegistry(InitParams params, RegistryService jcrRegistry) throws Exception
+ public ConsumerRegistry() throws Exception
{
-
ChromatticBuilder builder = ChromatticBuilder.create();
builder.setOption(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");
@@ -68,6 +67,11 @@
chrome = builder.build();
}
+ public ConsumerRegistry(InitParams params, RegistryService jcrRegistry) throws Exception
+ {
+ this();
+ }
+
@Override
protected void save(ProducerInfo info, String messageOnError)
{
@@ -98,7 +102,7 @@
}
@Override
- protected Iterator getAllProducerInfos()
+ protected Iterator<ProducerInfo> getProducerInfosFromStorage()
{
ChromatticSession session = chrome.openSession();
ProducerInfosMapping producerInfosMapping = session.findByPath(ProducerInfosMapping.class, PRODUCER_INFOS_PATH);
@@ -124,7 +128,7 @@
}
session.persist(infos); // todo: is that sufficient?
- producerInfos = new ConsumerToProducerInfoIterator(consumers.iterator());
+ producerInfos = new ProducerInfoIterator(consumers.iterator());
}
else
{
@@ -162,35 +166,6 @@
return null; // todo: implement
}
- private static class ConsumerToProducerInfoIterator implements Iterator<ProducerInfo>
- {
-
- private final Iterator<WSRPConsumer> consumers;
-
- public ConsumerToProducerInfoIterator(Iterator<WSRPConsumer> consumers)
- {
- this.consumers = consumers;
- }
-
- @Override
- public boolean hasNext()
- {
- return consumers.hasNext();
- }
-
- @Override
- public ProducerInfo next()
- {
- return consumers.next().getProducerInfo();
- }
-
- @Override
- public void remove()
- {
- throw new UnsupportedOperationException("Remove not supported!");
- }
- }
-
private static class MappingToProducerInfoIterator implements Iterator<ProducerInfo>
{
private Iterator<ProducerInfoMapping> mappings;
Added: portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistryTestCase.java
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistryTestCase.java (rev 0)
+++ portal/branches/wsrp-integration/component/wsrp/src/test/java/org/gatein/portal/wsrp/state/consumer/ConsumerRegistryTestCase.java 2009-11-18 23:03:17 UTC (rev 654)
@@ -0,0 +1,150 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.portal.wsrp.state.consumer;
+
+import junit.framework.TestCase;
+import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
+import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.consumer.ConsumerException;
+import org.gatein.wsrp.consumer.EndpointConfigurationInfo;
+import org.gatein.wsrp.consumer.ProducerInfo;
+import org.gatein.wsrp.consumer.RegistrationInfo;
+
+import java.util.Collection;
+
+/**
+ * This is essentially the same class as org.gatein.wsrp.state.consumer.ConsumerRegistryTestCase in WSRP consumer module
+ * tests.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ConsumerRegistryTestCase extends TestCase
+{
+ private ConsumerRegistry registry;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ registry = new ConsumerRegistry();
+ registry.setFederatingPortletInvoker(new FederatingPortletInvokerService());
+ }
+
+ public void testCreateAndGet()
+ {
+ String id = "test";
+ WSRPConsumer consumer = registry.createConsumer(id, null);
+ assertNotNull(consumer);
+ assertEquals(id, consumer.getProducerId());
+ ProducerInfo info = consumer.getProducerInfo();
+ assertNotNull(info);
+ assertEquals(consumer.getProducerId(), info.getId());
+ EndpointConfigurationInfo endpoint = info.getEndpointConfigurationInfo();
+ assertNotNull(endpoint);
+ RegistrationInfo regInfo = info.getRegistrationInfo();
+ assertTrue(regInfo.isUndetermined());
+
+ WSRPConsumer fromRegistry = registry.getConsumer(id);
+ assertNotNull(fromRegistry);
+ assertEquals(consumer.getProducerId(), fromRegistry.getProducerId());
+ ProducerInfo fromRegistryInfo = fromRegistry.getProducerInfo();
+ assertNotNull(fromRegistryInfo);
+ assertEquals(fromRegistry.getProducerId(), fromRegistryInfo.getId());
+ assertNotNull(fromRegistryInfo.getEndpointConfigurationInfo());
+ assertTrue(fromRegistryInfo.getRegistrationInfo().isUndetermined());
+
+ assertEquals(info.getId(), fromRegistryInfo.getId());
+ assertEquals(info.getEndpointConfigurationInfo(), fromRegistryInfo.getEndpointConfigurationInfo());
+ assertEquals(info.getRegistrationInfo(), fromRegistryInfo.getRegistrationInfo());
+
+ Collection consumers = registry.getConfiguredConsumers();
+ assertNotNull(consumers);
+ assertEquals(1, consumers.size());
+ assertTrue(consumers.contains(consumer));
+ }
+
+ public void testGetConsumer()
+ {
+ assertNull(registry.getConsumer("inexistent"));
+ }
+
+ public void testGetProducerInfoByKey()
+ {
+ WSRPConsumer consumer = registry.createConsumer("id", null);
+ ProducerInfo info = consumer.getProducerInfo();
+
+ String key = info.getKey();
+ assertNotNull(key);
+
+ assertEquals(info, registry.getProducerInfoByKey(key));
+ }
+
+ public void testDoubleRegistrationOfConsumerWithSameId()
+ {
+ String id = "foo";
+
+ registry.createConsumer(id, null);
+
+ try
+ {
+ registry.createConsumer(id, null);
+ fail("Shouldn't be possible to create a consumer with an existing id");
+ }
+ catch (ConsumerException expected)
+ {
+ }
+ }
+
+ public void testDelete()
+ {
+ String id = "id";
+
+ WSRPConsumer consumer = registry.createConsumer(id, null);
+ assertEquals(consumer, registry.getConsumer(id));
+
+ String key = consumer.getProducerInfo().getKey();
+
+ registry.destroyConsumer(id);
+
+ assertNull(registry.getConsumer(id));
+ assertNull(registry.getProducerInfoByKey(key));
+ }
+
+ public void testUpdateProducerInfo()
+ {
+ // create a foo consumer
+ String id = "foo";
+ WSRPConsumer consumer = registry.createConsumer(id, null);
+ ProducerInfo info = consumer.getProducerInfo();
+ String key = info.getKey();
+
+ // change the id on the consumer's producer info and save it
+ info.setId("bar");
+ registry.updateProducerInfo(info);
+
+ assertNull(registry.getConsumer(id));
+ assertEquals(info, consumer.getProducerInfo());
+ assertEquals(info, registry.getProducerInfoByKey(key));
+ assertEquals(consumer, registry.getConsumer("bar"));
+ }
+}
Modified: portal/branches/wsrp-integration/pom.xml
===================================================================
--- portal/branches/wsrp-integration/pom.xml 2009-11-18 18:52:08 UTC (rev 653)
+++ portal/branches/wsrp-integration/pom.xml 2009-11-18 23:03:17 UTC (rev 654)
@@ -19,7 +19,8 @@
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -43,27 +44,27 @@
<org.exoplatform.jcr.version>1.12.0-Beta02</org.exoplatform.jcr.version>
<org.jibx.version>1.2.1</org.jibx.version>
<org.shindig.version>SNAPSHOT-r790473</org.shindig.version>
- <org.gatein.common.version>2.0.0-Beta03</org.gatein.common.version>
+ <org.gatein.common.version>2.0.0-CR1-SNAPSHOT</org.gatein.common.version>
<org.gatein.wci.version>2.0.0-Beta02</org.gatein.wci.version>
<org.gatein.pc.version>2.1.0-Beta02</org.gatein.pc.version>
<org.jboss.identity.idm>1.0.0.Beta3</org.jboss.identity.idm>
- <org.gatein.wsrp.version>1.0.0-Beta01</org.gatein.wsrp.version>
+ <org.gatein.wsrp.version>1.0.0-Beta02-SNAPSHOT</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.0-Beta09</org.gatein.mop.version>
<version.chromattic>1.0.0-beta6</version.chromattic>
<version.reflect>1.0.0-beta3</version.reflect>
-
+
<!-- ************** -->
<!-- Build settings -->
<!-- ************** -->
-
+
<!-- maven-enforcer-plugin -->
<jdk.min.version>1.6</jdk.min.version>
<!-- maven-release-plugin -->
- <arguments>-Prelease,pkg-tomcat,pkg-jbossas -Dmaven.test.skip=true</arguments>
-
- </properties>
-
+ <arguments>-Prelease,pkg-tomcat,pkg-jbossas -Dmaven.test.skip=true</arguments>
+
+ </properties>
+
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/portal/trunk</connection>
<developerConnection>scm:svn:http://svn.jboss.org/repos/gatein/portal/trunk</developerConnection>
@@ -90,7 +91,7 @@
<scope>test</scope>
</dependency>
</dependencies>
-
+
<build>
<resources>
<resource>
@@ -117,9 +118,9 @@
<pluginManagement>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.1.1</version>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -169,13 +170,17 @@
<rules>
<requireProperty>
<property>gatein.checkout.dir</property>
- <message>"You must define the property gatein.checkout.dir to give the path of the root of your working area"</message>
+ <message>"You must define the property gatein.checkout.dir to give the path of the root of
+ your working area"
+ </message>
</requireProperty>
<requireFilesExist>
<files>
<file>${gatein.checkout.dir}/web/portal/src/main/webapp</file>
</files>
- <message>"The following directory doesn't exist : ${gatein.checkout.dir}/web/portal/src/main/webapp"</message>
+ <message>"The following directory doesn't exist :
+ ${gatein.checkout.dir}/web/portal/src/main/webapp"
+ </message>
</requireFilesExist>
</rules>
<fail>true</fail>
@@ -192,11 +197,12 @@
<phase>compile</phase>
<configuration>
<tasks>
- <copy failonerror="false" todir="${project.build.directory}/${project.build.finalName}/WEB-INF/classes">
+ <copy failonerror="false"
+ todir="${project.build.directory}/${project.build.finalName}/WEB-INF/classes">
<fileset dir="${basedir}/src/main/webapp/WEB-INF/classes">
- <include name="**/*_en.properties" />
+ <include name="**/*_en.properties"/>
</fileset>
- <globmapper from="*_en.properties" to="*.properties" />
+ <globmapper from="*_en.properties" to="*.properties"/>
</copy>
</tasks>
</configuration>
15 years, 1 month
gatein SVN: r653 - in components/wsrp/trunk: producer/src/main/java/org/gatein/wsrp/producer and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-18 13:52:08 -0500 (Wed, 18 Nov 2009)
New Revision: 653
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
Log:
- Somehow missed a couple of use of WSRPUtils.existsAndIsNotEmpty methods...
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-11-18 18:35:56 UTC (rev 652)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-11-18 18:52:08 UTC (rev 653)
@@ -787,27 +787,27 @@
serviceDescription.setRegistrationPropertyDescription(registrationPropertyDescription.value);
serviceDescription.setRequiresInitCookie(initCookie.value);
serviceDescription.setResourceList(resourceList.value);
- if (WSRPUtils.existsAndIsNotEmpty(modeDescriptions.value))
+ if (ParameterValidation.existsAndIsNotEmpty(modeDescriptions.value))
{
serviceDescription.getCustomModeDescriptions().addAll(modeDescriptions.value);
}
- if (WSRPUtils.existsAndIsNotEmpty(userProfileItemDescriptions.value))
+ if (ParameterValidation.existsAndIsNotEmpty(userProfileItemDescriptions.value))
{
serviceDescription.getCustomUserProfileItemDescriptions().addAll(userProfileItemDescriptions.value);
}
- if (WSRPUtils.existsAndIsNotEmpty(windowStateDescriptions.value))
+ if (ParameterValidation.existsAndIsNotEmpty(windowStateDescriptions.value))
{
serviceDescription.getCustomWindowStateDescriptions().addAll(windowStateDescriptions.value);
}
- if (WSRPUtils.existsAndIsNotEmpty(locales.value))
+ if (ParameterValidation.existsAndIsNotEmpty(locales.value))
{
serviceDescription.getLocales().addAll(locales.value);
}
- if (WSRPUtils.existsAndIsNotEmpty(offeredPortlets.value))
+ if (ParameterValidation.existsAndIsNotEmpty(offeredPortlets.value))
{
serviceDescription.getOfferedPortlets().addAll(offeredPortlets.value);
}
- if (WSRPUtils.existsAndIsNotEmpty(userCategoryDescriptions.value))
+ if (ParameterValidation.existsAndIsNotEmpty(userCategoryDescriptions.value))
{
serviceDescription.getUserCategoryDescriptions().addAll(userCategoryDescriptions.value);
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2009-11-18 18:35:56 UTC (rev 652)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2009-11-18 18:52:08 UTC (rev 653)
@@ -25,6 +25,7 @@
import org.gatein.common.net.media.MediaType;
import org.gatein.common.util.MarkupInfo;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvokerException;
@@ -405,7 +406,7 @@
public Set<WindowState> getWindowStates()
{
List<String> validNewWindowStates = params.getValidNewWindowStates();
- if (WSRPUtils.existsAndIsNotEmpty(validNewWindowStates))
+ if (ParameterValidation.existsAndIsNotEmpty(validNewWindowStates))
{
Set<WindowState> states = new HashSet<WindowState>(validNewWindowStates.size());
for (String state : validNewWindowStates)
@@ -420,7 +421,7 @@
public Set<Mode> getModes()
{
List<String> validNewModes = params.getValidNewModes();
- if (WSRPUtils.existsAndIsNotEmpty(validNewModes))
+ if (ParameterValidation.existsAndIsNotEmpty(validNewModes))
{
Set<Mode> modes = new HashSet<Mode>(validNewModes.size());
for (String mode : validNewModes)
@@ -455,6 +456,7 @@
}
// fix-me: check that the correct semantics is used.
+
private SecurityContext createSecurityContext(final MarkupParams params, final RuntimeContext runtimeContext,
final org.oasis.wsrp.v1.UserContext wsrpUserContext)
{
15 years, 1 month
gatein SVN: r652 - in components/wsrp/trunk: admin-gui/src/main/java/org/gatein/wsrp/admin/ui and 5 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-18 13:35:56 -0500 (Wed, 18 Nov 2009)
New Revision: 652
Added:
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpSession.java
Removed:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpSession.java
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
components/wsrp/trunk/pom.xml
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
Log:
- Upgraded to using common 2.0.0-CR1-SNAPSHOT for now until a new version is released.
- Made WSRPProducerImpl.getInstance return WSRPProducerImpl and added access to "WS" interfaces for tests.
- Replaced WSRPUtils.existsAndIsNotEmpty methods by ParameterValidation versions.
- Moved MockHttp* classes to test framework so that they can be used by producer tests.
- Updated ConsumerBean so that it compiles with the removal of individual endpoint URLs, though logic
and facelets files haven't been updated.
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -52,10 +52,6 @@
private boolean modified;
private boolean registrationLocallyModified;
- private String serviceDescription;
- private String markup;
- private String portletManagement;
- private String registration;
private String wsdl;
private transient RegistrationInfo expectedRegistrationInfo;
@@ -92,12 +88,7 @@
public boolean isUseWSDL()
{
- if (useWSDL != null)
- {
- return useWSDL.booleanValue();
- }
-
- return getProducerInfo().getEndpointConfigurationInfo().usesWSDL();
+ return true;
}
public void setUseWSDL(boolean useWSDL)
@@ -146,12 +137,7 @@
if (consumer != null)
{
EndpointConfigurationInfo endpoint = getProducerInfo().getEndpointConfigurationInfo();
- serviceDescription = endpoint.getServiceDescriptionURL();
- markup = endpoint.getMarkupURL();
- portletManagement = endpoint.getPortletManagementURL();
- registration = endpoint.getRegistrationURL();
wsdl = endpoint.getWsdlDefinitionURL();
- useWSDL = endpoint.usesWSDL();
}
else
{
@@ -170,46 +156,6 @@
getProducerInfo().setExpirationCacheSeconds((Integer)modifyIfNeeded(getCache(), cache, "cache", false));
}
- public String getServiceDescription()
- {
- return serviceDescription;
- }
-
- public void setServiceDescription(String sdURL)
- {
- serviceDescription = (String)modifyIfNeeded(serviceDescription, sdURL, "sd", true);
- }
-
- public String getMarkup()
- {
- return markup;
- }
-
- public void setMarkup(String markupURL)
- {
- markup = (String)modifyIfNeeded(markup, markupURL, "m", true);
- }
-
- public String getPortletManagement()
- {
- return portletManagement;
- }
-
- public void setPortletManagement(String pmURL)
- {
- portletManagement = (String)modifyIfNeeded(portletManagement, pmURL, "pm", true);
- }
-
- public String getRegistration()
- {
- return registration;
- }
-
- public void setRegistration(String rURL)
- {
- registration = (String)modifyIfNeeded(registration, rURL, "r", true);
- }
-
public String getWsdl()
{
return wsdl;
@@ -375,14 +321,7 @@
// update values
ProducerInfo prodInfo = getProducerInfo();
EndpointConfigurationInfo endpointInfo = prodInfo.getEndpointConfigurationInfo();
- endpointInfo.setMarkupURL(markup);
- endpointInfo.setServiceDescriptionURL(serviceDescription);
- endpointInfo.setPortletManagementURL(portletManagement);
- endpointInfo.setRegistrationURL(registration);
- if (isUseWSDL())
- {
- internalSetWsdl(wsdl);
- }
+ internalSetWsdl(wsdl);
saveToRegistry(prodInfo);
}
@@ -554,6 +493,7 @@
}
// todo: valueChangeListener not needed anymore when events on RegistrationProperties work
+
public void regPropListener(ValueChangeEvent event)
{
if (!registrationLocallyModified)
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/UserContextConverter.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -24,7 +24,7 @@
package org.gatein.wsrp;
import org.gatein.common.NotYetImplemented;
-import static org.gatein.common.p3p.P3PConstants.*;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.spi.UserContext;
import org.oasis.wsrp.v1.Contact;
import org.oasis.wsrp.v1.EmployerInfo;
@@ -45,6 +45,8 @@
import java.util.Locale;
import java.util.Map;
+import static org.gatein.common.p3p.P3PConstants.*;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 11352 $
@@ -68,7 +70,7 @@
{
org.oasis.wsrp.v1.UserContext wsrpUserContext = WSRPTypeFactory.createUserContext(userContextKey);
wsrpUserContext.setProfile(createUserProfileFrom(userContext));
- if (WSRPUtils.existsAndIsNotEmpty(userCategories))
+ if (ParameterValidation.existsAndIsNotEmpty(userCategories))
{
wsrpUserContext.getUserCategories().addAll(userCategories);
}
@@ -79,7 +81,7 @@
{
Map<String, String> userInfos = userContext.getInformations();
- if (!WSRPUtils.existsAndIsNotEmpty(userInfos))
+ if (!ParameterValidation.existsAndIsNotEmpty(userInfos))
{
return null;
}
@@ -304,7 +306,7 @@
{
List<Locale> locales = Collections.emptyList();
- if (WSRPUtils.existsAndIsNotEmpty(desiredLocales))
+ if (ParameterValidation.existsAndIsNotEmpty(desiredLocales))
{
locales = new ArrayList<Locale>(desiredLocales.size());
for (String desiredLocale : desiredLocales)
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -365,11 +365,11 @@
markupParams.setSecureClientCommunication(secureClientCommunication);
markupParams.setMode(mode);
markupParams.setWindowState(windowState);
- if (WSRPUtils.existsAndIsNotEmpty(locales))
+ if (ParameterValidation.existsAndIsNotEmpty(locales))
{
markupParams.getLocales().addAll(locales);
}
- if (WSRPUtils.existsAndIsNotEmpty(mimeTypes))
+ if (ParameterValidation.existsAndIsNotEmpty(mimeTypes))
{
markupParams.getMimeTypes().addAll(mimeTypes);
}
@@ -782,7 +782,7 @@
public static ModelDescription createModelDescription(List<PropertyDescription> propertyDescriptions)
{
ModelDescription description = new ModelDescription();
- if (WSRPUtils.existsAndIsNotEmpty(propertyDescriptions))
+ if (ParameterValidation.existsAndIsNotEmpty(propertyDescriptions))
{
description.getPropertyDescriptions().addAll(propertyDescriptions);
}
@@ -880,7 +880,7 @@
description.setRegistrationContext(registrationContext);
description.setPortletContext(portletContext);
description.setUserContext(userContext);
- if (WSRPUtils.existsAndIsNotEmpty(desiredLocales))
+ if (ParameterValidation.existsAndIsNotEmpty(desiredLocales))
{
description.getDesiredLocales().addAll(desiredLocales);
}
@@ -929,7 +929,7 @@
public static DestroyPortletsResponse createDestroyPortletsResponse(List<DestroyFailed> destroyFailed)
{
DestroyPortletsResponse destroyPortletsResponse = new DestroyPortletsResponse();
- if (WSRPUtils.existsAndIsNotEmpty(destroyFailed))
+ if (ParameterValidation.existsAndIsNotEmpty(destroyFailed))
{
destroyPortletsResponse.getDestroyFailed().addAll(destroyFailed);
}
@@ -1004,7 +1004,7 @@
DestroyPortlets destroyPortlets = new DestroyPortlets();
destroyPortlets.setRegistrationContext(registrationContext);
- if (WSRPUtils.existsAndIsNotEmpty(portletHandles))
+ if (ParameterValidation.existsAndIsNotEmpty(portletHandles))
{
destroyPortlets.getPortletHandles().addAll(portletHandles);
}
@@ -1054,7 +1054,7 @@
ReleaseSessions sessions = new ReleaseSessions();
sessions.setRegistrationContext(registrationContext);
- if (WSRPUtils.existsAndIsNotEmpty(sessionIDs))
+ if (ParameterValidation.existsAndIsNotEmpty(sessionIDs))
{
sessions.getSessionIDs().addAll(sessionIDs);
}
@@ -1105,15 +1105,15 @@
MarkupType markupType = new MarkupType();
markupType.setMimeType(mimeType);
- if (WSRPUtils.existsAndIsNotEmpty(modeNames))
+ if (ParameterValidation.existsAndIsNotEmpty(modeNames))
{
markupType.getModes().addAll(modeNames);
}
- if (WSRPUtils.existsAndIsNotEmpty(windowStateNames))
+ if (ParameterValidation.existsAndIsNotEmpty(windowStateNames))
{
markupType.getWindowStates().addAll(windowStateNames);
}
- if (WSRPUtils.existsAndIsNotEmpty(localeNames))
+ if (ParameterValidation.existsAndIsNotEmpty(localeNames))
{
markupType.getLocales().addAll(localeNames);
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -47,7 +47,6 @@
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -453,24 +452,4 @@
localizedString.setResourceName(wsrpLocalizedString.getResourceName());
return localizedString;
}
-
- /**
- * @param collection
- * @return
- * @deprecated use ParameterValidation.existsAndIsNotEmpty instead
- */
- public static boolean existsAndIsNotEmpty(Collection collection)
- {
- return collection != null && !collection.isEmpty();
- }
-
- /**
- * @param map
- * @return
- * @deprecated use ParameterValidation.existsAndIsNotEmpty instead
- */
- public static boolean existsAndIsNotEmpty(Map map)
- {
- return map != null && !map.isEmpty();
- }
}
Deleted: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -1,130 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-
-package org.gatein.wsrp.test.support;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpServletRequest">Chris
- * Laprun</a>
- * @version $Revision: 11416 $
- * @since 2.4
- */
-public class MockHttpServletRequest implements InvocationHandler, Serializable
-{
- private HttpSession session;
-
- private Map attrs;
- public static String scheme = "http";
- public static String serverName = "test";
- public static Integer serverPort = 1234;
-
- private MockHttpServletRequest(HttpSession session)
- {
- this.session = session;
- this.attrs = new HashMap();
- }
-
- /**
- * @param session if <code>null</code>, a new MockHttpSession will be created and used instead
- * @return
- */
- public static HttpServletRequest createMockRequest(HttpSession session)
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- if (session == null)
- {
- session = MockHttpSession.createMockSession();
- }
-
- return (HttpServletRequest)Proxy.newProxyInstance(loader, new Class[]{HttpServletRequest.class},
- new MockHttpServletRequest(session));
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- String methodName = method.getName();
- if ("getSession".equals(methodName))
- {
- return session;
- }
- if ("getHeader".equals(methodName))
- {
- if ("User-Agent".equals(args[0]))
- {
- return "Mock Client User Agent";
- }
- return null;
- }
- if ("toString".equals(methodName))
- {
- return "MockHttpServletResponse";
- }
- if ("getAttribute".equals(methodName))
- {
- return attrs.get(args[0]);
- }
- if ("setAttribute".equals(methodName))
- {
- String name = (String)args[0];
- Object value = args[1];
- if (value != null)
- {
- attrs.put(name, value);
- }
- else
- {
- attrs.remove(value);
- }
- return null;
- }
- if ("removeAttribute".equals(methodName))
- {
- String name = (String)args[0];
- attrs.remove(name);
- return null;
- }
- if ("getScheme".equals(methodName))
- {
- return scheme;
- }
- if ("getServerName".equals(methodName))
- {
- return serverName;
- }
- if ("getServerPort".equals(methodName))
- {
- return serverPort;
- }
- throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
- }
-}
Deleted: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-
-package org.gatein.wsrp.test.support;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpServletResponse">Chris
- * Laprun</a>
- * @version $Revision: 8784 $
- * @since 2.4
- */
-public class MockHttpServletResponse implements InvocationHandler, Serializable
-{
- Object cookie;
-
- private MockHttpServletResponse()
- {
- }
-
- public static HttpServletResponse createMockResponse()
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- return (HttpServletResponse)Proxy.newProxyInstance(loader, new Class[]{HttpServletResponse.class}, new MockHttpServletResponse());
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- String methodName = method.getName();
- if ("addCookie".equals(methodName))
- {
- cookie = args[0];
- return null;
- }
- else if ("reset".equals(methodName))
- {
- cookie = null;
- return null;
- }
- else if ("toString".equals(methodName))
- {
- return "MockHttpServletResponse";
- }
- throw new UnsupportedOperationException("MockHttpServletResponse does not support: " + method);
- }
-}
Deleted: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpSession.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpSession.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpSession.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -1,90 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-
-package org.gatein.wsrp.test.support;
-
-import org.gatein.common.util.Tools;
-
-import javax.servlet.http.HttpSession;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpSession">Chris
- * Laprun</a>
- * @version $Revision: 8784 $
- * @since 2.4
- */
-public class MockHttpSession implements InvocationHandler, Serializable
-{
- private final Map map = new HashMap();
-
- private MockHttpSession()
- {
- }
-
- public static HttpSession createMockSession()
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- return (HttpSession)Proxy.newProxyInstance(loader, new Class[]{HttpSession.class}, new MockHttpSession());
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- String methodName = method.getName();
- if ("setAttribute".equals(methodName))
- {
- map.put(args[0], args[1]);
- return null;
- }
- else if ("removeAttribute".equals(methodName))
- {
- map.remove(args[0]);
- return null;
- }
- else if ("getAttribute".equals(methodName))
- {
- return map.get(args[0]);
- }
- else if ("getAttributeNames".equals(methodName))
- {
- return Tools.toEnumeration(map.keySet().iterator());
- }
- else if ("toString".equals(methodName))
- {
- return "MockHttpSession";
- }
- else if ("getId".equals(methodName))
- {
- return "SESSION_ID";
- }
- else
- {
- throw new UnsupportedOperationException("MockHttpSession does not support: " + method);
- }
- }
-}
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/pom.xml 2009-11-18 18:35:56 UTC (rev 652)
@@ -49,7 +49,7 @@
<properties>
<version.gatein.pc>2.1.0-Beta02</version.gatein.pc>
- <version.gatein.common>2.0.0-Beta03</version.gatein.common>
+ <version.gatein.common>2.0.0-CR1-SNAPSHOT</version.gatein.common>
<version.gatein.wci>2.0.0-Beta02</version.gatein.wci>
<version.jsf>1.2_12</version.jsf>
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2009-11-18 17:34:29 UTC (rev 651)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -120,12 +120,13 @@
private boolean started = false;
// On-demand class holder Singleton pattern (multi-thread safe)
+
private static final class InstanceHolder
{
public static final WSRPProducerImpl producer = new WSRPProducerImpl();
}
- static WSRPProducer getInstance()
+ static WSRPProducerImpl getInstance()
{
return InstanceHolder.producer;
}
@@ -473,4 +474,26 @@
{
WSRPValidator.setStrict(strictMode);
}
+
+ // access to handlers for tests
+
+ MarkupInterface getMarkupInterface()
+ {
+ return markupHandler;
+ }
+
+ ServiceDescriptionInterface getServiceDescriptionInterface()
+ {
+ return serviceDescriptionHandler;
+ }
+
+ RegistrationInterface getRegistrationInterface()
+ {
+ return registrationHandler;
+ }
+
+ PortletManagementInterface getPortletManagementInterface()
+ {
+ return portletManagementHandler;
+ }
}
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java (from rev 642, components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -0,0 +1,130 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.test.support;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpServletRequest">Chris
+ * Laprun</a>
+ * @version $Revision: 11416 $
+ * @since 2.4
+ */
+public class MockHttpServletRequest implements InvocationHandler, Serializable
+{
+ private HttpSession session;
+
+ private Map attrs;
+ public static String scheme = "http";
+ public static String serverName = "test";
+ public static Integer serverPort = 1234;
+
+ private MockHttpServletRequest(HttpSession session)
+ {
+ this.session = session;
+ this.attrs = new HashMap();
+ }
+
+ /**
+ * @param session if <code>null</code>, a new MockHttpSession will be created and used instead
+ * @return
+ */
+ public static HttpServletRequest createMockRequest(HttpSession session)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ if (session == null)
+ {
+ session = MockHttpSession.createMockSession();
+ }
+
+ return (HttpServletRequest)Proxy.newProxyInstance(loader, new Class[]{HttpServletRequest.class},
+ new MockHttpServletRequest(session));
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+ if ("getSession".equals(methodName))
+ {
+ return session;
+ }
+ if ("getHeader".equals(methodName))
+ {
+ if ("User-Agent".equals(args[0]))
+ {
+ return "Mock Client User Agent";
+ }
+ return null;
+ }
+ if ("toString".equals(methodName))
+ {
+ return "MockHttpServletResponse";
+ }
+ if ("getAttribute".equals(methodName))
+ {
+ return attrs.get(args[0]);
+ }
+ if ("setAttribute".equals(methodName))
+ {
+ String name = (String)args[0];
+ Object value = args[1];
+ if (value != null)
+ {
+ attrs.put(name, value);
+ }
+ else
+ {
+ attrs.remove(value);
+ }
+ return null;
+ }
+ if ("removeAttribute".equals(methodName))
+ {
+ String name = (String)args[0];
+ attrs.remove(name);
+ return null;
+ }
+ if ("getScheme".equals(methodName))
+ {
+ return scheme;
+ }
+ if ("getServerName".equals(methodName))
+ {
+ return serverName;
+ }
+ if ("getServerPort".equals(methodName))
+ {
+ return serverPort;
+ }
+ throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java (from rev 642, components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.test.support;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpServletResponse">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.4
+ */
+public class MockHttpServletResponse implements InvocationHandler, Serializable
+{
+ Object cookie;
+
+ private MockHttpServletResponse()
+ {
+ }
+
+ public static HttpServletResponse createMockResponse()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return (HttpServletResponse)Proxy.newProxyInstance(loader, new Class[]{HttpServletResponse.class}, new MockHttpServletResponse());
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+ if ("addCookie".equals(methodName))
+ {
+ cookie = args[0];
+ return null;
+ }
+ else if ("reset".equals(methodName))
+ {
+ cookie = null;
+ return null;
+ }
+ else if ("toString".equals(methodName))
+ {
+ return "MockHttpServletResponse";
+ }
+ throw new UnsupportedOperationException("MockHttpServletResponse does not support: " + method);
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletResponse.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpSession.java (from rev 642, components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockHttpSession.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpSession.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpSession.java 2009-11-18 18:35:56 UTC (rev 652)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.gatein.wsrp.test.support;
+
+import org.gatein.common.util.Tools;
+
+import javax.servlet.http.HttpSession;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.support.MockHttpSession">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.4
+ */
+public class MockHttpSession implements InvocationHandler, Serializable
+{
+ private final Map map = new HashMap();
+
+ private MockHttpSession()
+ {
+ }
+
+ public static HttpSession createMockSession()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return (HttpSession)Proxy.newProxyInstance(loader, new Class[]{HttpSession.class}, new MockHttpSession());
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+ if ("setAttribute".equals(methodName))
+ {
+ map.put(args[0], args[1]);
+ return null;
+ }
+ else if ("removeAttribute".equals(methodName))
+ {
+ map.remove(args[0]);
+ return null;
+ }
+ else if ("getAttribute".equals(methodName))
+ {
+ return map.get(args[0]);
+ }
+ else if ("getAttributeNames".equals(methodName))
+ {
+ return Tools.toEnumeration(map.keySet().iterator());
+ }
+ else if ("toString".equals(methodName))
+ {
+ return "MockHttpSession";
+ }
+ else if ("getId".equals(methodName))
+ {
+ return "SESSION_ID";
+ }
+ else
+ {
+ throw new UnsupportedOperationException("MockHttpSession does not support: " + method);
+ }
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpSession.java
___________________________________________________________________
Name: svn:executable
+ *
15 years, 1 month