[portal-commits] JBoss Portal SVN: r5817 - in trunk: core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/state portlet/src/main/org/jboss/portal/portlet/support portlet/src/main/org/jboss/portal/portlet/support/info portlet/src/main/org/jboss/portal/portlet/test/support portlet/src/main/org/jboss/portal/test/portlet/state

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Wed Dec 13 05:21:10 EST 2006


Author: julien at jboss.com
Date: 2006-12-13 05:20:54 -0500 (Wed, 13 Dec 2006)
New Revision: 5817

Added:
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java
Removed:
   trunk/portlet/src/main/org/jboss/portal/portlet/test/support/info/
Modified:
   trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
   trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
Log:
- moved portlet info support to package org.jboss.portlet.support.info

Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -55,6 +55,7 @@
 import org.jboss.portal.portlet.PortletContext;
 import org.jboss.portal.portlet.PortletInvoker;
 import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
 import org.jboss.portal.portlet.info.MetaInfo;
 import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -69,7 +70,6 @@
 import org.jboss.portal.portlet.test.ValueMapAssert;
 import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
 import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PreferencesInfoSupport;
 import org.jboss.portal.test.framework.TestRuntimeContext;
 import org.jboss.portal.test.framework.embedded.DataSourceSupport;
 import org.jboss.portal.test.framework.embedded.HibernateSupport;

Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -43,6 +43,7 @@
 import org.jboss.portal.portlet.NoSuchPortletException;
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
 import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -60,7 +61,6 @@
 import org.jboss.portal.portlet.test.ValueMapAssert;
 import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
 import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PreferencesInfoSupport;
 import org.jboss.portal.test.framework.TestRuntimeContext;
 import org.jboss.portal.test.framework.embedded.DataSourceSupport;
 import org.jboss.portal.test.framework.embedded.HibernateSupport;

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.container.info.ContainerCacheInfo;
+import org.jboss.portal.portlet.info.CacheInfo;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CacheInfoSupport implements CacheInfo
+{
+
+   /** . */
+   private int expirationTimeMillis;
+
+   /** . */
+   private int referenceType;
+
+   public CacheInfoSupport(int expirationTimeMillis, int referenceType)
+   {
+      this.expirationTimeMillis = expirationTimeMillis;
+      this.referenceType = referenceType;
+   }
+
+   public CacheInfoSupport()
+   {
+      this(0, ContainerCacheInfo.REF_STRONG);
+   }
+
+   public int getExpirationSecs()
+   {
+      return expirationTimeMillis;
+   }
+
+   public void setExpirationTimeMillis(int expirationTimeMillis)
+   {
+      this.expirationTimeMillis = expirationTimeMillis;
+   }
+
+   public int getReferenceType()
+   {
+      return referenceType;
+   }
+
+   public void setReferenceType(int referenceType)
+   {
+      this.referenceType = referenceType;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CapabilitiesInfoSupport implements CapabilitiesInfo
+{
+
+   /** . */
+   private Set mimeTypes;
+
+   /** . */
+   private Set modes;
+
+   /** . */
+   private Set windowStates;
+
+   /** . */
+   private Set locales;
+
+   public CapabilitiesInfoSupport()
+   {
+      mimeTypes = new HashSet();
+      mimeTypes.add("text/html");
+
+      //
+      modes = new HashSet();
+      modes.add(new ModeInfoSupport(Mode.VIEW));
+      modes.add(new ModeInfoSupport(Mode.EDIT));
+      modes.add(new ModeInfoSupport(Mode.HELP));
+
+      //
+      windowStates = new HashSet();
+      windowStates.add(new WindowStateInfoSupport(WindowState.NORMAL));
+      windowStates.add(new WindowStateInfoSupport(WindowState.MAXIMIZED));
+      windowStates.add(new WindowStateInfoSupport(WindowState.MINIMIZED));
+
+      //
+      locales = new HashSet();
+      locales.add(Locale.ENGLISH);
+   }
+
+   public Set getMimeTypes()
+   {
+      return mimeTypes;
+   }
+
+   public Set getAllModes()
+   {
+      return modes;
+   }
+
+   public Set getModes(String mimeType)
+   {
+      if (mimeTypes.contains(mimeType))
+      {
+         return modes;
+      }
+      return Collections.EMPTY_SET;
+   }
+
+   public Set getAllWindowStates()
+   {
+      return windowStates;
+   }
+
+   public Set getWindowStates(String mimeType)
+   {
+      if (mimeTypes.contains(mimeType))
+      {
+         return windowStates;
+      }
+      return Collections.EMPTY_SET;
+   }
+
+   public Set getAllLocales()
+   {
+      return locales;
+   }
+
+   public Set getLocales(String mimeType)
+   {
+      if (mimeTypes.contains(mimeType))
+      {
+         return locales;
+      }
+      return Collections.EMPTY_SET;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.MetaInfo;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MetaInfoSupport implements MetaInfo
+{
+
+   /** . */
+   private Map values = new HashMap();
+
+   public LocalizedString getMetaValue(String key)
+   {
+      if (key == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      return (LocalizedString)values.get(key);
+   }
+
+   public void addValue(String key, Locale locale, String value)
+   {
+      if (key == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      LocalizedString string = new LocalizedString(value, locale);
+      if (values.put(key, string) != null)
+      {
+         throw new IllegalStateException("Already existing");
+      }
+   }
+
+   public void setTitle(String name)
+   {
+      addValue(MetaInfo.TITLE, Locale.ENGLISH, name);
+   }
+
+   public void setShortTitle(String name)
+   {
+      addValue(MetaInfo.SHORT_TITLE, Locale.ENGLISH, name);
+   }
+
+   public void setKeywords(String name)
+   {
+      addValue(MetaInfo.KEYWORDS, Locale.ENGLISH, name);
+   }
+
+   public void setDisplayName(String name)
+   {
+      addValue(MetaInfo.DISPLAY_NAME, Locale.ENGLISH, name);
+   }
+
+   public void setDescription(String name)
+   {
+      addValue(MetaInfo.DESCRIPTION, Locale.ENGLISH, name);
+   }
+
+   public String getDisplayName()
+   {
+      LocalizedString string = getMetaValue(MetaInfo.DISPLAY_NAME);
+      if (string == null)
+      {
+         throw new IllegalStateException();
+      }
+      return string.getString(Locale.ENGLISH, true);
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.ModeInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ModeInfoSupport implements ModeInfo
+{
+
+   /** . */
+   private final LocalizedString description;
+
+   /** . */
+   private final Mode mode;
+
+   public ModeInfoSupport(Mode mode)
+   {
+      this.description = new LocalizedString(mode + " mode", Locale.ENGLISH);
+      this.mode = mode;
+   }
+
+   public LocalizedString getDescription()
+   {
+      return description;
+   }
+
+   public Mode getMode()
+   {
+      return mode;
+   }
+
+   public String getModeName()
+   {
+      return mode.toString();
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.SecurityInfo;
+import org.jboss.portal.portlet.info.SessionInfo;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletInfoSupport implements PortletInfo
+{
+
+   private Boolean remotable;
+   private PreferencesInfoSupport preferencesSupport = new PreferencesInfoSupport();
+   private SecurityInfoSupport securitySupport = new SecurityInfoSupport();
+   private CacheInfoSupport cacheSupport = new CacheInfoSupport();
+   private SessionInfoSupport sessionSupport = new SessionInfoSupport();
+   private MetaInfoSupport metaSupport = new MetaInfoSupport();
+
+   public CapabilitiesInfo getCapabilities()
+   {
+      throw new UnsupportedOperationException("Implement me");
+   }
+
+   public PreferencesInfo getPreferences()
+   {
+      return preferencesSupport;
+   }
+
+   public PreferencesInfoSupport getPreferencesSupport()
+   {
+      return preferencesSupport;
+   }
+
+   public MetaInfo getMeta()
+   {
+      return metaSupport;
+   }
+
+   public MetaInfoSupport getMetaSupport()
+   {
+      return metaSupport;
+   }
+
+   public SecurityInfo getSecurity()
+   {
+      return securitySupport;
+   }
+
+   public SecurityInfoSupport getSecuritySupport()
+   {
+      return securitySupport;
+   }
+
+   public CacheInfo getCache()
+   {
+      return cacheSupport;
+   }
+
+   public CacheInfoSupport getCacheSupport()
+   {
+      return cacheSupport;
+   }
+
+   public SessionInfo getSession()
+   {
+      return sessionSupport;
+   }
+
+   public SessionInfoSupport getSessionSupport()
+   {
+      return sessionSupport;
+   }
+
+   public Boolean isRemotable()
+   {
+      return remotable;
+   }
+
+   public void setRemotable(Boolean remotable)
+   {
+      this.remotable = remotable;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,124 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferenceInfoSupport implements PreferenceInfo
+{
+
+   /** . */
+   private final String key;
+
+   /** . */
+   private LocalizedString displayName;
+
+   /** . */
+   private LocalizedString description;
+
+   /** . */
+   private Boolean readOnly;
+
+   /** . */
+   private Value defaultValue;
+
+   public PreferenceInfoSupport(String key)
+   {
+      this.key = key;
+      this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+      this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+      this.readOnly = null;
+      this.defaultValue = null;
+   }
+
+   public PreferenceInfoSupport(String key, Value defaultValue)
+   {
+      this.key = key;
+      this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+      this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+      this.readOnly = Boolean.FALSE;
+      this.defaultValue = defaultValue;
+   }
+
+   public PreferenceInfoSupport(String key, Value defaultValue, Boolean readOnly)
+   {
+      this.key = key;
+      this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+      this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+      this.readOnly = readOnly;
+      this.defaultValue = defaultValue;
+   }
+
+   public String getKey()
+   {
+      return key;
+   }
+
+   public LocalizedString getDisplayName()
+   {
+      return displayName;
+   }
+
+   public LocalizedString getDescription()
+   {
+      return description;
+   }
+
+   public Boolean isReadOnly()
+   {
+      return readOnly;
+   }
+
+   public void setReadOnly(Boolean readOnly)
+   {
+      this.readOnly = readOnly;
+   }
+
+   public Value getDefaultValue()
+   {
+      return defaultValue;
+   }
+
+   public void setDefaultValue(Value defaultValue)
+   {
+      this.defaultValue = defaultValue;
+   }
+
+   public void setDisplayName(LocalizedString displayName)
+   {
+      this.displayName = displayName;
+   }
+
+   public void setDescription(LocalizedString description)
+   {
+      this.description = description;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferencesInfoSupport implements PreferencesInfo
+{
+
+   private final Map preferences;
+
+   public PreferencesInfoSupport(Map preferences)
+   {
+      this.preferences = preferences;
+   }
+
+   public PreferencesInfoSupport()
+   {
+      this(new HashMap());
+   }
+
+   public Set getKeys()
+   {
+      return preferences.keySet();
+   }
+
+   public PreferenceInfo getPreference(String key) throws IllegalArgumentException
+   {
+      return (PreferenceInfo)preferences.get(key);
+   }
+
+   public void addPreference(PreferenceInfoSupport preference)
+   {
+      preferences.put(preference.getKey(), preference);
+   }
+
+   public void addPreference(String key)
+   {
+      preferences.put(key, new PreferenceInfoSupport(key));
+   }
+
+   public void addPreference(String key, Value value)
+   {
+      preferences.put(key, new PreferenceInfoSupport(key, value));
+   }
+
+   public void addPreference(String key, Value value, Boolean readOnly)
+   {
+      preferences.put(key, new PreferenceInfoSupport(key, value, readOnly));
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.info.SecurityInfo;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SecurityInfoSupport implements SecurityInfo
+{
+
+   /** . */
+   private final Set transportGuarantees;
+
+   public SecurityInfoSupport(Set transportGuarantees)
+   {
+      this.transportGuarantees = transportGuarantees;
+   }
+
+   public SecurityInfoSupport()
+   {
+      this(new CollectionBuilder().add(TransportGuarantee.NONE).toHashSet());
+   }
+
+   public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
+   {
+      return transportGuarantees.contains(transportGuarantee);
+   }
+
+   public Set getTransportGuarantees()
+   {
+      return transportGuarantees;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.SessionInfo;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SessionInfoSupport implements SessionInfo
+{
+
+   /** . */
+   private Boolean distributed;
+
+   public SessionInfoSupport(Boolean distributed)
+   {
+      this.distributed = distributed;
+   }
+
+   public SessionInfoSupport()
+   {
+      this(null);
+   }
+
+   public Boolean getDistributed()
+   {
+      return distributed;
+   }
+
+   public void setDistributed(Boolean distributed)
+   {
+      this.distributed = distributed;
+   }
+}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class WindowStateInfoSupport implements WindowStateInfo
+{
+
+   /** . */
+   private final LocalizedString description;
+
+   /** . */
+   private final WindowState windowState;
+
+   public WindowStateInfoSupport(WindowState mode)
+   {
+      this.description = new LocalizedString(mode + " window state", Locale.ENGLISH);
+      this.windowState = mode;
+   }
+
+   public LocalizedString getDescription()
+   {
+      return description;
+   }
+
+   public WindowState getWindowState()
+   {
+      return windowState;
+   }
+
+   public String getWindowStateName()
+   {
+      return windowState.toString();
+   }
+}

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -29,12 +29,12 @@
 import org.jboss.portal.portlet.PortletContext;
 import org.jboss.portal.portlet.PortletInvoker;
 import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
 import org.jboss.portal.portlet.info.PortletInfo;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
 import org.jboss.portal.portlet.state.PropertyChange;
 import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
 
 import java.util.HashMap;
 import java.util.HashSet;

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -23,10 +23,10 @@
 package org.jboss.portal.portlet.test.support;
 
 import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
 import org.jboss.portal.portlet.info.PortletInfo;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -30,6 +30,7 @@
 import org.jboss.portal.portlet.NoSuchPortletException;
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
 import org.jboss.portal.portlet.info.MetaInfo;
 import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -42,7 +43,6 @@
 import org.jboss.portal.portlet.state.SimplePropertyMap;
 import org.jboss.portal.portlet.test.ValueMapAssert;
 import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
 
 import java.util.Collections;
 import java.util.HashSet;

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -25,6 +25,7 @@
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletContext;
 import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
 import org.jboss.portal.portlet.impl.state.StateConverterService;
 import org.jboss.portal.portlet.impl.state.StateManagementPolicyService;
 import org.jboss.portal.portlet.impl.state.consumer.ConsumerPersistenceManagerService;
@@ -40,7 +41,6 @@
 import org.jboss.portal.portlet.test.InstanceContextImpl;
 import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
 import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
 
 import java.util.Collections;
 import java.util.List;

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java	2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java	2006-12-13 10:20:54 UTC (rev 5817)
@@ -38,7 +38,7 @@
 import org.jboss.portal.portlet.test.InstanceContextImpl;
 import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
 import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
 
 import java.util.Collections;
 import java.util.List;




More information about the portal-commits mailing list