[gatein-commits] gatein SVN: r4260 - in components/wsrp/trunk/consumer/src: main/java/org/gatein/wsrp/consumer/migration and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Sep 20 14:35:00 EDT 2010


Author: chris.laprun at jboss.com
Date: 2010-09-20 14:34:59 -0400 (Mon, 20 Sep 2010)
New Revision: 4260

Added:
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/InMemoryMigrationService.java
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
Removed:
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
Modified:
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
Log:
- GTNWSRP-61: Made MigrationService an interface so that we can have a JCR backend in GateIn integration code.
- Minor error reporting improvement.

Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java	2010-09-20 18:13:41 UTC (rev 4259)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java	2010-09-20 18:34:59 UTC (rev 4260)
@@ -52,6 +52,7 @@
 import org.gatein.wsrp.consumer.handlers.SessionHandler;
 import org.gatein.wsrp.consumer.migration.ExportInfo;
 import org.gatein.wsrp.consumer.migration.ImportInfo;
+import org.gatein.wsrp.consumer.migration.InMemoryMigrationService;
 import org.gatein.wsrp.consumer.migration.MigrationService;
 import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
 import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
@@ -140,7 +141,7 @@
 
    public WSRPConsumerImpl()
    {
-      this(new ProducerInfo(), new MigrationService());
+      this(new ProducerInfo(), new InMemoryMigrationService());
    }
 
    public WSRPConsumerImpl(ProducerInfo info, MigrationService migrationService)
@@ -880,7 +881,7 @@
          }*/
          catch (Exception e)
          {
-            throw new PortletInvokerException(e);
+            throw new PortletInvokerException(e.getLocalizedMessage(), e);
          }
       }
       else
@@ -985,7 +986,7 @@
          }*/
          catch (Exception e)
          {
-            throw new PortletInvokerException(e);
+            throw new PortletInvokerException(e.getLocalizedMessage(), e);
          }
       }
       else

Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/InMemoryMigrationService.java (from rev 4238, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/InMemoryMigrationService.java	                        (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/InMemoryMigrationService.java	2010-09-20 18:34:59 UTC (rev 4260)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.consumer.migration;
+
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.wsrp.api.PortalStructureProvider;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InMemoryMigrationService implements MigrationService
+{
+   private SortedMap<Long, ExportInfo> exportInfos;
+   private PortalStructureProvider structureProvider;
+
+   public PortalStructureProvider getStructureProvider()
+   {
+      return structureProvider;
+   }
+
+   public void setStructureProvider(PortalStructureProvider structureProvider)
+   {
+      this.structureProvider = structureProvider;
+   }
+
+   public List<ExportInfo> getAvailableExportInfos()
+   {
+      return new ArrayList<ExportInfo>(getExportInfos().values());
+   }
+
+   public ExportInfo getExportInfo(long exportTime)
+   {
+      return exportInfos.get(exportTime);
+   }
+
+   public void add(ExportInfo info)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(info, "ExportInfo");
+
+      getExportInfos().put(info.getExportTime(), info);
+   }
+
+   public ExportInfo remove(ExportInfo info)
+   {
+      return info == null ? null : getExportInfos().remove(info.getExportTime());
+   }
+
+   private SortedMap<Long, ExportInfo> getExportInfos()
+   {
+      if (exportInfos == null)
+      {
+         exportInfos = new TreeMap<Long, ExportInfo>();
+      }
+      return exportInfos;
+   }
+
+   public boolean isAvailableExportInfosEmpty()
+   {
+      return exportInfos == null || exportInfos.isEmpty();
+   }
+}

Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java	2010-09-20 18:13:41 UTC (rev 4259)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java	2010-09-20 18:34:59 UTC (rev 4260)
@@ -1,125 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.consumer.migration;
-
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.PortletContext;
-import org.gatein.wsrp.api.PortalStructureProvider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MigrationService
-{
-   private SortedMap<Long, ExportInfo> exportInfos;
-   // todo: fix me
-   private PortalStructureProvider structureProvider = new PortalStructureProvider()
-   {
-      private Map<String, List<String>> pagesToWindows = new HashMap<String, List<String>>(7);
-
-      {
-         List<String> windows = new ArrayList<String>(3);
-         windows.add("p1w1");
-         windows.add("p1w2");
-         windows.add("p1w3");
-
-         pagesToWindows.put("p1", windows);
-
-         windows = new ArrayList<String>(2);
-         windows.add("p2w1");
-         windows.add("p2w2");
-
-         pagesToWindows.put("p2", windows);
-      }
-
-      public List<String> getPageIdentifiers()
-      {
-         return new ArrayList<String>(pagesToWindows.keySet());
-      }
-
-      public List<String> getWindowIdentifiersFor(String pageId)
-      {
-         return pagesToWindows.get(pageId);
-      }
-
-      public void assignPortletToWindow(PortletContext portletContext, String windowId, String pageId)
-      {
-         System.out.println("Assigned portlet " + portletContext + " to window " + windowId + " on page " + pageId);
-      }
-   };
-
-   public PortalStructureProvider getStructureProvider()
-   {
-      return structureProvider;
-   }
-
-   public void setStructureProvider(PortalStructureProvider structureProvider)
-   {
-      this.structureProvider = structureProvider;
-   }
-
-   public List<ExportInfo> getAvailableExportInfos()
-   {
-      return new ArrayList<ExportInfo>(getExportInfos().values());
-   }
-
-   public ExportInfo getExportInfo(long exportTime)
-   {
-      return exportInfos.get(exportTime);
-   }
-
-   public void add(ExportInfo info)
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(info, "ExportInfo");
-
-      getExportInfos().put(info.getExportTime(), info);
-   }
-
-   public ExportInfo remove(ExportInfo info)
-   {
-      return info == null ? null : getExportInfos().remove(info.getExportTime());
-   }
-
-   private SortedMap<Long, ExportInfo> getExportInfos()
-   {
-      if (exportInfos == null)
-      {
-         exportInfos = new TreeMap<Long, ExportInfo>();
-      }
-      return exportInfos;
-   }
-
-   public boolean isAvailableExportInfosEmpty()
-   {
-      return exportInfos == null || exportInfos.isEmpty();
-   }
-}

Added: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java	                        (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java	2010-09-20 18:34:59 UTC (rev 4260)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.consumer.migration;
+
+import org.gatein.wsrp.api.PortalStructureProvider;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface MigrationService
+{
+   PortalStructureProvider getStructureProvider();
+
+   void setStructureProvider(PortalStructureProvider structureProvider);
+
+   List<ExportInfo> getAvailableExportInfos();
+
+   ExportInfo getExportInfo(long exportTime);
+
+   void add(ExportInfo info);
+
+   ExportInfo remove(ExportInfo info);
+
+   boolean isAvailableExportInfosEmpty();
+}

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java	2010-09-20 18:13:41 UTC (rev 4259)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java	2010-09-20 18:34:59 UTC (rev 4260)
@@ -39,7 +39,7 @@
    @Override
    protected void setUp() throws Exception
    {
-      service = new MigrationService();
+      service = new InMemoryMigrationService();
    }
 
    public void testIsAvailableExportInfosEmpty()



More information about the gatein-commits mailing list