Author: julien(a)jboss.com
Date: 2008-01-07 14:56:29 -0500 (Mon, 07 Jan 2008)
New Revision: 9448
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java
Modified:
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletCloneFailedException.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParameters.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateEvent.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateString.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/TransportGuarantee.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/Utils.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/metadata/PortletApplicationMetaData.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractInstanceContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/consumer/ConsumerPersistenceManagerService.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CacheInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CapabilitiesInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/MetaInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ModeInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PreferencesInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SecurityInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SessionInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/WindowStateInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortalContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/RequestContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/SecurityContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/PropertyContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestInstanceContext.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestPortletInvoker.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/deployment/PortletApplicationMetaDataFactory.java
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
Log:
generifiying the portlet module
Modified:
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
===================================================================
---
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -58,7 +58,7 @@
*
* @return a collection that contains the portlet invokers
*/
- Collection getFederatedInvokers();
+ Collection<FederatedPortletInvoker> getFederatedInvokers();
/**
* Unregisters the invoker associated with the specified identifier.
Modified:
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -40,7 +40,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -84,12 +83,11 @@
return federatingPortletInvoker;
}
- public Set getPortlets() throws PortletInvokerException
+ public Set<Portlet> getPortlets() throws PortletInvokerException
{
- Set federatedPortlets = new LinkedHashSet();
- for (Iterator i = portletInvoker.getPortlets().iterator(); i.hasNext();)
+ Set<Portlet> federatedPortlets = new LinkedHashSet<Portlet>();
+ for (Portlet portlet : portletInvoker.getPortlets())
{
- Portlet portlet = (Portlet)i.next();
Portlet federatedPortlet = new FederatedPortlet(this,
reference(portlet.getContext()), portlet);
federatedPortlets.add(federatedPortlet);
}
@@ -160,7 +158,7 @@
return reference(cloneContext);
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
if (portletContexts == null)
{
@@ -168,23 +166,23 @@
}
if (portletContexts.size() == 0)
{
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
//
- List dereferencedList = new ArrayList(portletContexts);
+ List<PortletContext> dereferencedList = new
ArrayList<PortletContext>(portletContexts);
for (int i = 0; i < dereferencedList.size(); i++)
{
- PortletContext compoundPortletContext =
(PortletContext)dereferencedList.get(i);
+ PortletContext compoundPortletContext = dereferencedList.get(i);
PortletContext portletContext = dereference(compoundPortletContext);
dereferencedList.set(i, portletContext);
}
//
- List failures = portletInvoker.destroyClones(dereferencedList);
+ List<DestroyCloneFailure> failures =
portletInvoker.destroyClones(dereferencedList);
for (int i = 0; i < failures.size(); i++)
{
- DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(i);
+ DestroyCloneFailure failure = failures.get(i);
String cloneId = failure.getPortletId();
failure = new DestroyCloneFailure(reference(cloneId));
failures.set(i, failure);
@@ -200,7 +198,7 @@
return portletInvoker.getProperties(portletId);
}
- public PropertyMap getProperties(PortletContext compoundPortletContext, Set keys)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ public PropertyMap getProperties(PortletContext compoundPortletContext,
Set<String> keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
PortletContext portletId = dereference(compoundPortletContext);
return portletInvoker.getProperties(portletId, keys);
Modified:
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
===================================================================
---
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/federation/src/main/java/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -34,12 +34,12 @@
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.state.DestroyCloneFailure;
import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -61,7 +61,7 @@
static final String SEPARATOR = ".";
/** The registred FederatedPortletInvokers. */
- private volatile Map registry = new HashMap();
+ private volatile Map<String, FederatedPortletInvoker> registry = new
HashMap<String, FederatedPortletInvoker>();
public synchronized FederatedPortletInvoker registerInvoker(String federatedId,
PortletInvoker federatedInvoker)
{
@@ -77,7 +77,7 @@
{
throw new IllegalArgumentException("Attempting dual registration of "
+ federatedId);
}
- Map copy = new HashMap(registry);
+ Map<String, FederatedPortletInvoker> copy = new HashMap<String,
FederatedPortletInvoker>(registry);
FederatedPortletInvokerService invoker = new FederatedPortletInvokerService(this,
federatedId, federatedInvoker);
copy.put(federatedId, invoker);
registry = copy;
@@ -94,7 +94,7 @@
{
throw new IllegalArgumentException("Attempting to unregister unknown
invoker " + federatedId);
}
- Map copy = new HashMap(registry);
+ Map<String, FederatedPortletInvoker> copy = new HashMap<String,
FederatedPortletInvoker>(registry);
copy.remove(federatedId);
registry = copy;
}
@@ -105,25 +105,24 @@
{
throw new IllegalArgumentException("No null id provided");
}
- return (FederatedPortletInvoker)registry.get(federatedId);
+ return registry.get(federatedId);
}
- public Collection getFederatedInvokers()
+ public Collection<FederatedPortletInvoker> getFederatedInvokers()
{
return registry.values();
}
// PortletInvoker implementation
************************************************************************************
- public Set getPortlets() throws PortletInvokerException
+ public Set<Portlet> getPortlets() throws PortletInvokerException
{
- LinkedHashSet portlets = new LinkedHashSet();
- for (Iterator iterator = registry.values().iterator(); iterator.hasNext();)
+ LinkedHashSet<Portlet> portlets = new LinkedHashSet<Portlet>();
+ for (FederatedPortletInvoker federated : registry.values())
{
- FederatedPortletInvoker federated = (FederatedPortletInvoker)iterator.next();
try
{
- Set offeredPortlets = federated.getPortlets();
+ Set<Portlet> offeredPortlets = federated.getPortlets();
portlets.addAll(offeredPortlets);
}
catch (InvokerUnavailableException e)
@@ -156,7 +155,7 @@
return federated.createClone(compoundPortletContext);
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
if (portletContexts == null)
{
@@ -164,20 +163,19 @@
}
if (portletContexts.size() == 0)
{
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
// Get the invoker and check that we address only one invoker (for now)
FederatedPortletInvoker invoker = null;
- for (int i = 0; i < portletContexts.size(); i++)
+ for (PortletContext compoundPortletContext : portletContexts)
{
- PortletContext compoundPortletId = (PortletContext)portletContexts.get(i);
- FederatedPortletInvoker federated =
getFederatedPortletInvokerFor(compoundPortletId);
+ FederatedPortletInvoker federated =
getFederatedPortletInvokerFor(compoundPortletContext);
if (invoker == null)
{
invoker = federated;
}
- else if (invoker.equals(federated) == false)
+ else if (!invoker.equals(federated))
{
throw new PortletInvokerException("Cannot destroy portlet lists that
requires more than one federated invoker");
}
@@ -187,7 +185,7 @@
return invoker.destroyClones(portletContexts);
}
- public PropertyMap getProperties(PortletContext compoundPortletContext, Set keys)
throws PortletInvokerException
+ public PropertyMap getProperties(PortletContext compoundPortletContext,
Set<String> keys) throws PortletInvokerException
{
FederatedPortletInvoker federated =
getFederatedPortletInvokerFor(compoundPortletContext);
return federated.getProperties(compoundPortletContext, keys);
@@ -213,6 +211,7 @@
* @param compoundPortletContext the portlet context for which the invoker is to be
retrieved
* @return the portlet invoker associated with the specified compound portlet id
* @throws IllegalArgumentException if the compound portlet id is not well formed or
null
+ * @throws NoSuchPortletException if not such portlet exist
*/
private FederatedPortletInvoker getFederatedPortletInvokerFor(PortletContext
compoundPortletContext) throws IllegalArgumentException, NoSuchPortletException
{
@@ -233,7 +232,7 @@
//
String invokerId = compoundPortletId.substring(0, pos);
- FederatedPortletInvoker federated =
(FederatedPortletInvoker)registry.get(invokerId);
+ FederatedPortletInvoker federated = registry.get(invokerId);
if (federated == null)
{
throw new NoSuchPortletException(compoundPortletId);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletCloneFailedException.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletCloneFailedException.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletCloneFailedException.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -29,6 +29,7 @@
public class PortletCloneFailedException extends PortletInvokerException
{
+ /** . */
private String portletId;
public PortletCloneFailedException(String portletId)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -51,14 +51,12 @@
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (o instanceof PortletContext)
{
- return false;
+ PortletContext that = (PortletContext)o;
+ return id.equals(that.id);
}
-
- PortletContext that = (PortletContext)o;
-
- return id.equals(that.id);
+ return false;
}
public int hashCode()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -26,6 +26,7 @@
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.state.DestroyCloneFailure;
import java.util.List;
import java.util.Set;
@@ -40,8 +41,9 @@
* Return the set of portlet exposed.
*
* @return the set of exposed portlets
+ * @throws PortletInvokerException a portlet invoker exception
*/
- Set getPortlets() throws PortletInvokerException;
+ Set<Portlet> getPortlets() throws PortletInvokerException;
/**
* Get information about a specific portlet.
@@ -49,6 +51,7 @@
* @param portletContext the portlet context in the scope of this invoker
* @return the <code>PortletInfo</code> for the specified portlet
* @throws IllegalArgumentException if the portlet context is null
+ * @throws PortletInvokerException a portlet invoker exception
*/
Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException;
@@ -58,15 +61,18 @@
* @param invocation the portlet invocation
* @return the invocation response
* @throws IllegalArgumentException if the invocation is null
+ * @throws PortletInvokerException a portlet invoker exception
*/
PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException;
/**
* Clone a portlet.
*
+ * @param portletContext the portlet context to clone
* @return the clone id
* @throws IllegalArgumentException if the portletId is null
* @throws UnsupportedOperationException if the invoker does not support this
operation
+ * @throws PortletInvokerException a portlet invoker exception
*/
PortletContext createClone(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
@@ -78,8 +84,9 @@
* destroyed
* @throws IllegalArgumentException if the portletContext is null
* @throws UnsupportedOperationException if the invoker does not support this
operation
+ * @throws PortletInvokerException a portlet invoker exception
*/
- List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException;
+ List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException;
/**
* Return a subset of the properties of the specified portlet.
@@ -89,8 +96,9 @@
* @return the properties
* @throws IllegalArgumentException if the portletContext or the keys arguments
are null
* @throws UnsupportedOperationException if the invoker does not support this
operation
+ * @throws PortletInvokerException a portlet invoker exception
*/
- PropertyMap getProperties(PortletContext portletContext, Set keys) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
+ PropertyMap getProperties(PortletContext portletContext, Set<String> keys)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
/**
* Return all the properties of the specified portlet.
@@ -99,6 +107,7 @@
* @return the properties
* @throws IllegalArgumentException if the portletContext is null
* @throws UnsupportedOperationException if the invoker does not support this
operation
+ * @throws PortletInvokerException a portlet invoker exception
*/
PropertyMap getProperties(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
@@ -107,8 +116,10 @@
*
* @param portletContext the portlet context
* @param changes the changes
+ * @return the new portlet context
* @throws IllegalArgumentException if the portletContext or the properties is
null
* @throws UnsupportedOperationException if the invoker does not support this
operation
+ * @throws PortletInvokerException a portlet invoker exception
*/
PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParameters.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParameters.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParameters.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -50,7 +50,7 @@
/**
* Copy the parameter map to initialize the object state.
*
- * @throws IllegalArgumentException if the parameter map is null or not valid
+ * @param parameterMap the parameter map
* @throws NullPointerException if the map contains a null key or a null value
* @throws IllegalArgumentException if the map is null or it contains a value with a
zero length array or a null
* element in the array
@@ -130,6 +130,9 @@
/**
* Safely wrap the map as a portlet parameters object. If the map is already a portlet
parameter object, just return
* that object otherwise return a wrapper around the map.
+ *
+ * @param map the map
+ * @return the portlet parameters
*/
public static PortletParameters wrap(Map<String, String[]> map)
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -31,7 +31,6 @@
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -56,6 +55,9 @@
/**
* Factory method that will create the most appropriate form.
+ *
+ * @param opaqueValue the opaque value
+ * @return a new state string
*/
public static StateString create(String opaqueValue)
{
@@ -73,7 +75,7 @@
}
}
- public static PortletParametersStateString create(Map parameterMap)
+ public static PortletParametersStateString create(Map<String, String[]>
parameterMap)
{
PortletParameters params = PortletParameters.wrap(parameterMap);
return new PortletParametersStateString(params);
@@ -97,9 +99,10 @@
byte[] bytes = Base64.decode(opaqueValue, true);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);
- Map params = new HashMap();
+ Map<String, String[]> params = new HashMap<String, String[]>();
- String[] values = null;
+ //
+ String[] values;
// read the first String which should be a param name
String current = ois.readUTF();
@@ -146,6 +149,7 @@
/**
* Copy the parameter map to initialize the object state.
*
+ * @param parameterMap the parameter map to clone
* @throws IllegalArgumentException if the parameter map is null or not valid
*/
public PortletParametersStateString(PortletParameters parameterMap)
@@ -186,9 +190,10 @@
/**
* Replace all the parameters.
*
+ * @param map the map to replace
* @throws IllegalArgumentException if the map is not valid
*/
- public void replace(Map map)
+ public void replace(Map<String, String[]> map)
{
this.parameters.replace(map);
}
@@ -198,8 +203,7 @@
*
* @param name the parameter name
* @param value the parameter value
- * @throws IllegalArgumentException if the name is null
- * @throws IllegalArgumentException if the value is null
+ * @throws IllegalArgumentException if the name or the value is null
*/
public void setValue(String name, String value)
{
@@ -221,6 +225,7 @@
/**
* Remove a parameter.
*
+ * @param name the parameter name
* @throws IllegalArgumentException if the name is null
*/
public void remove(String name)
@@ -228,7 +233,11 @@
parameters.remove(name);
}
- /** Return the size. */
+ /**
+ * Return the size.
+ *
+ * @return the size
+ */
public int getSize()
{
return parameters.size();
@@ -257,17 +266,16 @@
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
- for (Iterator entries = parameters.entrySet().iterator();
entries.hasNext();)
+ for (Map.Entry entry : parameters.entrySet())
{
- Map.Entry entry = (Map.Entry)entries.next();
String name = (String)entry.getKey();
oos.writeUTF(name);
String[] values = (String[])entry.getValue();
int length = values.length;
oos.writeInt(length);
- for (int i = 0; i < values.length; i++)
+ for (String value : values)
{
- oos.writeUTF(values[i]);
+ oos.writeUTF(value);
}
}
oos.writeUTF(EOF);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -38,7 +38,7 @@
public class Properties
{
- private Map content;
+ private Map<String, ArrayList<String>> content;
public Properties()
{
@@ -61,25 +61,19 @@
}
if (content == null)
{
- content = new HashMap();
+ content = new HashMap<String, ArrayList<String>>();
}
- Object o = content.get(name);
- if (o == null)
+
+ //
+ ArrayList<String> values = content.get(name);
+ if (values == null)
{
- content.put(name, value);
- }
- else if (o instanceof String)
- {
- ArrayList values = new ArrayList();
- values.add(o);
- values.add(value);
+ values = new ArrayList<String>();
content.put(name, values);
}
- else
- {
- ArrayList values = (ArrayList)o;
- values.add(value);
- }
+
+ //
+ values.add(value);
}
/**
@@ -99,9 +93,23 @@
}
if (content == null)
{
- content = new HashMap();
+ content = new HashMap<String, ArrayList<String>>();
}
- content.put(name, value);
+
+ //
+ ArrayList<String> values = content.get(name);
+ if (values == null)
+ {
+ values = new ArrayList<String>();
+ content.put(name, values);
+ }
+ else
+ {
+ values.clear();
+ }
+
+ //
+ values.add(value);
}
/** Clear the properties. */
@@ -123,18 +131,16 @@
{
return null;
}
- Object o = content.get(name);
- if (o == null)
+
+ //
+ ArrayList<String> values = content.get(name);
+ if (values == null)
{
return null;
}
- else if (o instanceof String)
- {
- return (String)o;
- }
else
{
- return (String)((ArrayList)o).get(0);
+ return values.get(0);
}
}
@@ -143,7 +149,7 @@
* @return the list of properties for the specified name or null if it does not exist
* @throws IllegalArgumentException if name is null
*/
- public List getProperties(String name)
+ public List<String> getProperties(String name)
{
if (name == null)
{
@@ -153,26 +159,14 @@
{
return null;
}
- Object o = content.get(name);
- if (o == null)
- {
- return null;
- }
- if (o instanceof String)
- {
- return Collections.singletonList(o);
- }
- else
- {
- return (List)o;
- }
+ return content.get(name);
}
- public Set getPropertyNames()
+ public Set<String> getPropertyNames()
{
if (content == null)
{
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
return content.keySet();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateEvent.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateEvent.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateEvent.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -34,15 +34,19 @@
*/
public class StateEvent
{
+
+ /** . */
private final PortletContext context;
- private final StateEventType type;
- public static final StateEventType PORTLET_CLONED_EVENT = new
StateEventType("Portlet Cloned Event");
- public static final StateEventType PORTLET_MODIFIED_EVENT = new
StateEventType("Portlet Modified Event");
- public StateEvent(PortletContext context, StateEventType type)
+ /** . */
+ private final Type type;
+
+ public StateEvent(PortletContext context, Type type)
{
ParameterValidation.throwIllegalArgExceptionIfNull(context, "Portlet
context");
ParameterValidation.throwIllegalArgExceptionIfNull(type, "StateEvent
type");
+
+ //
this.context = context;
this.type = type;
}
@@ -52,23 +56,27 @@
return context;
}
- public StateEventType getType()
+ public Type getType()
{
return type;
}
- public static final class StateEventType
+ public enum Type
{
- private String name;
- private StateEventType(String name)
+ PORTLET_CLONED_EVENT("Portlet Cloned Event"),
PORTLET_MODIFIED_EVENT("Portlet Modified Event");
+
+ /** . */
+ private final String description;
+
+ private Type(String description)
{
- this.name = name;
+ this.description = description;
}
public String toString()
{
- return name;
+ return description;
}
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateString.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateString.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/StateString.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -32,7 +32,11 @@
*/
public abstract class StateString implements Serializable
{
- /** Return the value of the navigational state of the portlet. */
+ /**
+ * Return the value of the navigational state of the portlet.
+ *
+ * @return the string value
+ */
public abstract String getStringValue();
public static StateString createFrom(String opaqueValue)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/TransportGuarantee.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/TransportGuarantee.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/TransportGuarantee.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -28,92 +28,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
-public class TransportGuarantee
+public enum TransportGuarantee
{
- /**
- *
- */
- public static final TransportGuarantee NONE = new TransportGuarantee(0);
-
- /**
- *
- */
- public static final TransportGuarantee INTEGRAL = new TransportGuarantee(1);
-
- /**
- *
- */
- public static final TransportGuarantee CONFIDENTIAL = new TransportGuarantee(2);
-
- /**
- *
- */
- private static final TransportGuarantee[] ALL = {NONE, INTEGRAL, CONFIDENTIAL};
-
- /**
- *
- */
-// private static final boolean[][] IMPLIES =
-// {
-// { true, false, false },
-// { true, true, true },
-// { true, true, true }
-// };
-
- /**
- *
- */
- private static final String[] NAMES = {"NONE", "INTEGRAL",
"CONFIDENTIAL"};
-
- public static TransportGuarantee decode(String name)
- {
- for (int i = 0; i < NAMES.length; i++)
- {
- if (NAMES[i].equals(name))
- {
- return ALL[i];
- }
- }
- throw new IllegalArgumentException();
- }
-
- private int ordinal;
-
- private TransportGuarantee(int ordinal)
- {
- this.ordinal = ordinal;
- }
-
- public String getName()
- {
- return NAMES[ordinal];
- }
-
-// public boolean implies(TransportGuarantee that)
-// {
-// if (that == null)
-// {
-// throw new IllegalArgumentException();
-// }
-// return IMPLIES[this.ordinal][that.ordinal];
-// }
-
- public int hashCode()
- {
- return ordinal;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof TransportGuarantee)
- {
- TransportGuarantee that = (TransportGuarantee)obj;
- return this.ordinal == that.ordinal;
- }
- return false;
- }
+ NONE, INTEGRAL, CONFIDENTIAL
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -36,7 +36,7 @@
{
/** . */
- private static final ThreadLocal local = new ThreadLocal();
+ private static final ThreadLocal<Boolean> local = new
ThreadLocal<Boolean>();
public static boolean isLocal()
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -31,6 +31,7 @@
import org.jboss.portal.portlet.container.PortletContainerInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.Mode;
import java.util.HashSet;
import java.util.Iterator;
@@ -63,7 +64,7 @@
}
/** Compute the supported modes for this invocation. */
- protected Set getModes(PortletInvocation invocation)
+ protected Set<Mode> getModes(PortletInvocation invocation)
{
// Get content type
ContentInfo si = invocation.getPortletContext().getMarkupInfo();
@@ -75,15 +76,14 @@
CapabilitiesInfo capabilities = containerInfo.getCapabilities();
// Add all the modes
- Set modes = new HashSet();
- for (Iterator i = capabilities.getModes(contentType).iterator(); i.hasNext();)
+ Set<Mode> modes = new HashSet<Mode>();
+ for (ModeInfo modeInfo : capabilities.getModes(contentType))
{
- ModeInfo modeInfo = (ModeInfo)i.next();
modes.add(modeInfo.getMode());
}
// Restrict with what the portal can provide
- Set portalModes = invocation.getPortalContext().getModes();
+ Set<Mode> portalModes = invocation.getPortalContext().getModes();
modes.retainAll(portalModes);
// If user is not logged in then remove the edit mode
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.WindowState;
import java.util.HashSet;
import java.util.Set;
@@ -55,9 +56,14 @@
return invocation.invokeNext();
}
- /** Compute the supported window states for this invocation. */
- protected Set getWindowStates(PortletInvocation invocation) throws
InvocationException
+ /**
+ * Compute the supported window states for this invocation.
+ *
+ * @param invocation the invocation
+ * @return the set of window states
+ */
+ protected Set<WindowState> getWindowStates(PortletInvocation invocation)
{
- return new HashSet(invocation.getPortalContext().getWindowStates());
+ return new
HashSet<WindowState>(invocation.getPortalContext().getWindowStates());
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -32,16 +32,32 @@
*/
public interface PortletApplication
{
- /** Return the web app id. */
+ /**
+ * Return the web app id.
+ *
+ * @return the id
+ */
String getId();
- /** Return the set of components part of this web application. */
- Set getPortletContainers();
+ /**
+ * Return the set of components part of this web application.
+ *
+ * @return the set of portlet containers
+ */
+ Set<PortletContainer> getPortletContainers();
- /** Return a specific component. */
+ /**
+ * Return a specific portlet container.
+ *
+ * @return a portlet container
+ */
PortletContainer getPortletContainer(String id);
- /** Return the porlet application context. */
+ /**
+ * Return the porlet application context.
+ *
+ * @return the context
+ */
PortletApplicationContext getContext();
void addContainer(PortletContainer container);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -48,7 +48,7 @@
void unregisterPortletApplication(PortletApplication portletApplication) throws
IllegalArgumentException;
/** Return an immutable list all the known portlet application in the registry. */
- Collection getPortletApplications();
+ Collection<PortletApplication> getPortletApplications();
/** Return a portlet app using its id or null if it does not exist. */
PortletApplication getPortletApplication(String id);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -40,10 +40,10 @@
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -67,7 +67,7 @@
private InterceptorStackFactory stackFactory;
/** . */
- private Map portlets;
+ private Map<String, Portlet> portlets;
/** . */
private InvocationHandler handler = new InvocationHandler()
@@ -114,7 +114,7 @@
public synchronized void portletContainerRegistered(PortletContainer
portletContainer)
{
- Map portlets = new HashMap(this.portlets);
+ Map<String, Portlet> portlets = new HashMap<String,
Portlet>(this.portlets);
PortletImpl portlet = new PortletImpl(portletContainer);
portlets.put(portlet.getContext().getId(), portlet);
@@ -124,7 +124,7 @@
public synchronized void portletContainerUnregistered(PortletContainer
portletContainer)
{
- Map portlets = new HashMap(this.portlets);
+ Map<String, Portlet> portlets = new HashMap<String,
Portlet>(this.portlets);
PortletImpl portlet = new PortletImpl(portletContainer);
portlets.remove(portlet.getContext().getId());
@@ -134,13 +134,11 @@
public synchronized void start() throws Exception
{
- Map portlets = new HashMap();
- for (Iterator i = registry.getPortletApplications().iterator(); i.hasNext();)
+ Map<String, Portlet> portlets = new HashMap<String, Portlet>();
+ for (PortletApplication portletApplication : registry.getPortletApplications())
{
- PortletApplication portletApplication = (PortletApplication)i.next();
- for (Iterator j = portletApplication.getPortletContainers().iterator();
j.hasNext();)
+ for (PortletContainer portletContainer :
portletApplication.getPortletContainers())
{
- PortletContainer portletContainer = (PortletContainer)j.next();
PortletImpl portlet = new PortletImpl(portletContainer);
portlets.put(portlet.getContext().getId(), portlet);
}
@@ -158,12 +156,12 @@
registry.removeListener(this);
//
- portlets = new HashMap();
+ portlets = new HashMap<String, Portlet>();
}
- public Set getPortlets()
+ public Set<Portlet> getPortlets()
{
- return new HashSet(portlets.values());
+ return new HashSet<Portlet>(portlets.values());
}
public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
@@ -219,7 +217,7 @@
}
}
- public PropertyMap getProperties(PortletContext portletContext, Set keys) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ public PropertyMap getProperties(PortletContext portletContext, Set<String>
keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
PortletImpl portlet = (PortletImpl)portlets.get(portletContext.getId());
if (portlet == null)
@@ -229,9 +227,8 @@
ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
PropertyMap result = new SimplePropertyMap();
- for (Iterator i = keys.iterator();i.hasNext();)
+ for (String key : keys)
{
- String key = (String)i.next();
ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
if (pref != null)
{
@@ -251,9 +248,8 @@
ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
PropertyMap result = new SimplePropertyMap();
- for (Iterator i = prefs.getKeys().iterator();i.hasNext();)
+ for (String key : prefs.getKeys())
{
- String key = (String)i.next();
ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
if (pref != null)
{
@@ -268,7 +264,7 @@
throw new UnsupportedOperationException();
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -1,30 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.impl;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RequestPropertiesAttributeResolver
-{
-}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -36,7 +36,6 @@
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import javax.servlet.ServletContext;
-import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -111,11 +110,8 @@
registrationContext = registry.registerPortletApplication(portletApp);
//
- for (Iterator i = portletAppMD.getPortlets().iterator(); i.hasNext();)
+ for (PortletMetaData portletMD : portletAppMD.getPortlets())
{
- PortletMetaData portletMD = (PortletMetaData)i.next();
-
- //
JBossPortletMetaData jBossPortletMD = null;
if (jbossAppMD != null)
{
@@ -147,9 +143,8 @@
// if the portlet application wasn't properly started, we shouldn't be
trying to stop it
if (portletApp != null)
{
- for (Iterator i = portletApp.getPortletContainers().iterator(); i.hasNext();)
+ for (PortletContainer container : portletApp.getPortletContainers())
{
- PortletContainerImpl container = (PortletContainerImpl)i.next();
try
{
registrationContext.unregisterPortlet(container);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -32,7 +32,6 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -45,13 +44,13 @@
{
/** . */
- private Map portletApplications = new HashMap();
+ private Map<String, PortletApplication> portletApplications = new
HashMap<String, PortletApplication>();
/** . */
- private Map portletContainers = new HashMap();
+ private Map<ContainerKey, PortletContainer> portletContainers = new
HashMap<ContainerKey, PortletContainer>();
/** . */
- private List listeners = new ArrayList();
+ private List<PortletApplicationRegistryListener> listeners = new
ArrayList<PortletApplicationRegistryListener>();
public PortletApplicationRegistrationContext
registerPortletApplication(PortletApplication portletApplication)
{
@@ -67,7 +66,7 @@
throw new IllegalArgumentException("This portlet app is already
registered: " + key);
}
PortletApplicationRegistrationContext ctx = new
PortletApplicationRegistrationContextImpl(portletApplication);
- Map webAppsCopy = new HashMap(portletApplications);
+ Map<String, PortletApplication> webAppsCopy = new HashMap<String,
PortletApplication>(portletApplications);
webAppsCopy.put(key, portletApplication);
portletApplications = webAppsCopy;
return ctx;
@@ -87,20 +86,20 @@
{
throw new IllegalArgumentException("This portlet app does not exist
here: " + key);
}
- Map webAppsCopy = new HashMap(portletApplications);
+ Map<String, PortletApplication> webAppsCopy = new HashMap<String,
PortletApplication>(portletApplications);
webAppsCopy.remove(key);
portletApplications = webAppsCopy;
}
}
- public Collection getPortletApplications()
+ public Collection<PortletApplication> getPortletApplications()
{
return Collections.unmodifiableCollection(portletApplications.values());
}
public PortletApplication getPortletApplication(String id)
{
- return (PortletApplication)portletApplications.get(id);
+ return portletApplications.get(id);
}
public void addListener(PortletApplicationRegistryListener listener)
@@ -133,22 +132,18 @@
}
}
- private void raiseRegisterPortletContainerEvent(PortletContainer portlet)
+ private void fireRegisterPortletContainerEvent(PortletContainer portlet)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
+ for (PortletApplicationRegistryListener listener : listeners)
{
- PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
listener.portletContainerRegistered(portlet);
}
}
- private void raiseUnregisterPortletContainerEvent(PortletContainer portlet)
+ private void fireUnregisterPortletContainerEvent(PortletContainer portlet)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
+ for (PortletApplicationRegistryListener listener : listeners)
{
- PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
listener.portletContainerUnregistered(portlet);
}
}
@@ -218,12 +213,12 @@
}
synchronized (this)
{
- Map componentsCopy = new HashMap(portletContainers);
+ Map<ContainerKey, PortletContainer> componentsCopy = new
HashMap<ContainerKey, PortletContainer>(portletContainers);
componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
portletContainers = componentsCopy;
//
- raiseRegisterPortletContainerEvent(portletContainer);
+ fireRegisterPortletContainerEvent(portletContainer);
}
}
@@ -243,13 +238,12 @@
}
synchronized (this)
{
- Map componentsCopy = new HashMap(portletContainers);
- componentsCopy.remove(portletContainer);
+ Map<ContainerKey, PortletContainer> componentsCopy = new
HashMap<ContainerKey, PortletContainer>(portletContainers);
+ ContainerKey key = new ContainerKey(portletContainer);
+ componentsCopy.remove(key);
portletContainers = componentsCopy;
- raiseUnregisterPortletContainerEvent(portletContainer);
+ fireUnregisterPortletContainerEvent(portletContainer);
}
}
-
}
-
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -60,7 +60,7 @@
protected final PortletInfoFactory portletInfoFactory;
/** . */
- protected LinkedHashMap portlets;
+ protected LinkedHashMap<String, PortletContainer> portlets;
/** . */
protected PortletContext portletContext;
@@ -85,7 +85,7 @@
this.jbossMetaData = jbossMetaData;
this.portletAPIFactory = portletAPIFactory;
this.portletInfoFactory = portletInfoFactory;
- this.portlets = new LinkedHashMap();
+ this.portlets = new LinkedHashMap<String, PortletContainer>();
this.context = context;
}
@@ -164,14 +164,14 @@
// WebApp implementation
********************************************************************************************
- public Set getPortletContainers()
+ public Set<PortletContainer> getPortletContainers()
{
- return new HashSet(portlets.values());
+ return new HashSet<PortletContainer>(portlets.values());
}
public PortletContainer getPortletContainer(String name)
{
- return (PortletContainer)portlets.get(name);
+ return portlets.get(name);
}
public PortletApplicationContext getContext()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -25,11 +25,12 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import java.util.Locale;
@@ -40,18 +41,21 @@
*/
public class ContainerCapabilities implements CapabilitiesInfo
{
- private static Set WINDOW_STATES = new HashSet(3);
+ /** . */
+ private static Set<WindowStateInfo> WINDOW_STATES;
+
static
{
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MAXIMIZED));
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MINIMIZED));
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.NORMAL));
- WINDOW_STATES = Collections.unmodifiableSet(WINDOW_STATES);
+ Set<WindowStateInfo> tmp = new HashSet<WindowStateInfo>();
+ tmp.add(new ContainerWindowStateInfo(WindowState.MAXIMIZED));
+ tmp.add(new ContainerWindowStateInfo(WindowState.MINIMIZED));
+ tmp.add(new ContainerWindowStateInfo(WindowState.NORMAL));
+ WINDOW_STATES = Collections.unmodifiableSet(tmp);
}
/** . */
- private Set supportedLocales;
+ private Set<Locale> supportedLocales;
/** . */
private ContentTypes contentTypes;
@@ -64,7 +68,7 @@
// Add Locale.ENGLISH to supported locales if no locales was provided
// todo: should we always include it (i.e. even when other locales are present)?
- HashSet supportedLocales = new
HashSet(portletMD.getLanguages().getSupportedLocales());
+ HashSet<Locale> supportedLocales = new
HashSet<Locale>(portletMD.getLanguages().getSupportedLocales());
if (supportedLocales.isEmpty())
{
supportedLocales.add(Locale.ENGLISH);
@@ -75,51 +79,51 @@
this.contentTypes = contentTypes;
}
- public Set getMimeTypes()
+ public Set<String> getMimeTypes()
{
- return new HashSet(contentTypes.getAllContentTypes());
+ return new HashSet<String>(contentTypes.getAllContentTypes());
}
- public Set getAllModes()
+ public Set<ModeInfo> getAllModes()
{
- Set infos = new HashSet();
- for (Iterator i = contentTypes.getAllModes().iterator(); i.hasNext();)
+ Set<ModeInfo> infos = new HashSet<ModeInfo>();
+ for (Mode mode : contentTypes.getAllModes())
{
- infos.add(new ContainerModeInfo((Mode)i.next()));
+ infos.add(new ContainerModeInfo(mode));
}
return infos;
}
- public Set getModes(String mimeType)
+ public Set<ModeInfo> getModes(String mimeType)
{
- Set infos = new HashSet();
- for (Iterator i = contentTypes.getSupportedModes(mimeType).iterator();
i.hasNext();)
+ Set<ModeInfo> infos = new HashSet<ModeInfo>();
+ for (Mode mode : contentTypes.getSupportedModes(mimeType))
{
- infos.add(new ContainerModeInfo((Mode)i.next()));
+ infos.add(new ContainerModeInfo(mode));
}
return infos;
}
- public Set getAllWindowStates()
+ public Set<WindowStateInfo> getAllWindowStates()
{
return WINDOW_STATES;
}
- public Set getWindowStates(String mimeType)
+ public Set<WindowStateInfo> getWindowStates(String mimeType)
{
if (contentTypes.isContentTypeSupported(mimeType))
{
return getAllWindowStates();
}
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- public Set getAllLocales()
+ public Set<Locale> getAllLocales()
{
return supportedLocales;
}
- public Set getLocales(String mimeType)
+ public Set<Locale> getLocales(String mimeType)
{
return getAllLocales();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -28,7 +28,6 @@
import org.jboss.portal.portlet.info.MetaInfo;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -43,14 +42,14 @@
public class ContainerMetaInfo implements MetaInfo
{
- private Map values;
+ private Map<String, LocalizedString> values;
private static final String JAVAX_PORTLET = "javax.portlet.";
private static final String[] KEYS = {TITLE, SHORT_TITLE, KEYWORDS};
private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + TITLE, JAVAX_PORTLET +
SHORT_TITLE, JAVAX_PORTLET + KEYWORDS};
public ContainerMetaInfo(PortletMetaData metadata, ResourceBundleManager rb)
{
- this.values = new HashMap();
+ this.values = new HashMap<String, LocalizedString>();
// Construct info from resource bundle manager
if (rb != null)
@@ -58,15 +57,14 @@
for (int i = 0; i < KEYS.length; i++)
{
String key = KEYS[i];
- Map tmp = new HashMap();
- List locales = metadata.getLanguages().getSupportedLocales();
+ Map<Locale, String> tmp = new HashMap<Locale, String>();
+ List<Locale> locales =
(List<Locale>)metadata.getLanguages().getSupportedLocales();
// Add english locale
locales.add(Locale.ENGLISH);
- for (Iterator j = locales.iterator(); j.hasNext();)
+ for (Locale locale : locales)
{
- Locale locale = (Locale)j.next();
ResourceBundle bundle = rb.getResourceBundle(locale);
try
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -65,15 +65,13 @@
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (o instanceof ContainerModeInfo)
{
- return false;
+ ContainerModeInfo that = (ContainerModeInfo)o;
+ return mode.equals(that.mode);
}
+ return false;
- final ContainerModeInfo modeInfo = (ContainerModeInfo)o;
-
- return mode.equals(modeInfo.mode);
-
}
public int hashCode()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -46,17 +46,16 @@
{
/** The cached container preference info. */
- private Map content;
+ private final Map<String, PreferenceInfo> content;
public ContainerPreferencesInfo()
{
- content = new HashMap();
+ content = Collections.emptyMap();
}
public ContainerPreferencesInfo(PortletMetaData portletMD, ResourceBundleManager
bundleMgr)
{
- content = new HashMap();
-
+ Map<String, PreferenceInfo> content = new HashMap<String,
PreferenceInfo>();
for (Iterator i = portletMD.getPreferences().iterator(); i.hasNext();)
{
PreferenceMetaData prefMD = (PreferenceMetaData)i.next();
@@ -66,6 +65,9 @@
ContainerPreferenceInfo pref = new ContainerPreferenceInfo(prefMD.getName(),
displayName, description, prefMD.isReadOnly(), value);
content.put(pref.getKey(), pref);
}
+
+ //
+ this.content = Collections.unmodifiableMap(content);
}
public ContainerPreferenceInfo getContainerPreference(String key)
@@ -77,9 +79,9 @@
return (ContainerPreferenceInfo)content.get(key);
}
- public Set getKeys()
+ public Set<String> getKeys()
{
- return Collections.unmodifiableSet(content.keySet());
+ return content.keySet();
}
public PreferenceInfo getPreference(String key)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -40,11 +40,11 @@
{
/** . */
- private Set tgs;
+ private Set<TransportGuarantee> tgs;
public ContainerSecurityInfo(PortletMetaData portletMD)
{
- tgs = new HashSet();
+ tgs = new HashSet<TransportGuarantee>();
tgs.add(TransportGuarantee.NONE);
//
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -65,15 +65,12 @@
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (o instanceof ContainerWindowStateInfo)
{
- return false;
+ ContainerWindowStateInfo that = (ContainerWindowStateInfo)o;
+ return windowState.equals(that.windowState);
}
-
- final ContainerWindowStateInfo that = (ContainerWindowStateInfo)o;
-
- return windowState.equals(that.windowState);
-
+ return false;
}
public int hashCode()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -46,11 +46,12 @@
public class ContentTypes
{
/** Maps MIME Type (String) -> Modes (Set), excluding multiple MIME Types
("*", "* / *", "type / *"). */
- protected final Map singleTypeToPortletModes;
+ protected final Map<String, Set<Mode>> singleTypeToPortletModes;
+
/** Maps MIME Type (String) -> Modes (Set), including multiple MIME Types
("*", "* / *", "type / *"). */
- protected final Map allTypeToPortletModes;
+ protected final Map<String, Set<Mode>> allTypeToPortletModes;
- protected final Set allModes;
+ protected final Set<Mode> allModes;
protected ContentTypesMetaData metadata;
protected boolean isStarted = false;
@@ -66,9 +67,9 @@
public ContentTypes()
{
- singleTypeToPortletModes = new HashMap();
- allTypeToPortletModes = new HashMap(); // Including *
- allModes = new HashSet();
+ singleTypeToPortletModes = new HashMap<String, Set<Mode>>();
+ allTypeToPortletModes = new HashMap<String, Set<Mode>>(); // Including
*
+ allModes = new HashSet<Mode>();
metadata = null;
}
@@ -92,7 +93,7 @@
/**
* Process all the supported content types.
*
- * @param metadata
+ * @param metadata the meta data
*/
private void initFromMetadata(ContentTypesMetaData metadata)
{
@@ -121,10 +122,9 @@
add(contentType, Mode.VIEW);
// Then process each mode
- Set modes = contentTypeMD.getModes();
- for (Iterator j = modes.iterator(); j.hasNext();)
+ Set<Mode> modes = contentTypeMD.getModes();
+ for (Mode mode : modes)
{
- Mode mode = (Mode)j.next();
add(contentType, mode);
}
}
@@ -176,25 +176,33 @@
allModes.add(mode);
}
- private void addMode(Map map, String key, Mode mode)
+ private void addMode(Map<String, Set<Mode>> map, String key, Mode mode)
{
- Set modes = (Set)map.get(key);
+ Set<Mode> modes = map.get(key);
if (modes == null)
{
- modes = new HashSet();
+ modes = new HashSet<Mode>();
map.put(key, modes);
}
modes.add(mode);
}
- /** Return all modes. */
- public Collection getAllModes()
+ /**
+ * Return all modes.
+ *
+ * @return all modes
+ */
+ public Collection<Mode> getAllModes()
{
return Collections.unmodifiableCollection(allModes);
}
- /** Return all content types. */
- public Collection getAllContentTypes()
+ /**
+ * Return all content types.
+ *
+ * @return all content types
+ */
+ public Collection<String> getAllContentTypes()
{
return Collections.unmodifiableCollection(allTypeToPortletModes.keySet());
}
@@ -202,6 +210,8 @@
/**
* Return true if the mode is supported
*
+ * @param mode the mode to check
+ * @return true if the mode is supported
* @throws IllegalArgumentException if the mode is null
*/
public boolean isModeSupported(Mode mode)
@@ -216,9 +226,11 @@
/**
* Return all the supported modes for this content type.
*
+ * @param contentType the content type to check
* @throws IllegalArgumentException if the content type is null
+ * @return the set of modes matching the content types support
*/
- public Set getSupportedModes(String contentType)
+ public Set<Mode> getSupportedModes(String contentType)
{
if (contentType == null)
{
@@ -229,27 +241,27 @@
if (index == -1)
{
// Not valid content type so return empty set
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
//
- Set set = new HashSet();
+ Set<Mode> set = new HashSet<Mode>();
//
- Set contentTypeModes =
(Set)singleTypeToPortletModes.get(contentType.toLowerCase());
+ Set<Mode> contentTypeModes =
singleTypeToPortletModes.get(contentType.toLowerCase());
if (contentTypeModes != null)
{
set.addAll(contentTypeModes);
}
//
- Set typeModes = (Set)allTypeToPortletModes.get(contentType.substring(0,
index).toLowerCase());
+ Set<Mode> typeModes = allTypeToPortletModes.get(contentType.substring(0,
index).toLowerCase());
if (typeModes != null)
{
set.addAll(typeModes);
}
- Set wildcardModes = (Set)allTypeToPortletModes.get(ALL);
+ Set<Mode> wildcardModes = allTypeToPortletModes.get(ALL);
if (wildcardModes != null)
{
set.addAll(wildcardModes);
@@ -261,6 +273,8 @@
/**
* Return true if the content type is supported.
*
+ * @param contentType the content type
+ * @return true is it is supported
* @throws IllegalArgumentException if the content type is null
*/
public boolean isContentTypeSupported(String contentType)
@@ -295,6 +309,9 @@
/**
* Return true if the given content type is supported for the given mode.
*
+ * @param mode the mode to check
+ * @param contentType the content type to check
+ * @return true if is it supported
* @throws IllegalArgumentException if the content type or the mode is null
*/
public boolean isSupported(Mode mode, String contentType)
@@ -316,14 +333,14 @@
}
// Try full name matching
- Set contentTypeModes = (Set)singleTypeToPortletModes.get(contentType);
+ Set<Mode> contentTypeModes = singleTypeToPortletModes.get(contentType);
if (contentTypeModes != null && contentTypeModes.contains(mode))
{
return true;
}
// Try full name lowercase matching
- Set lowercaseContentTypeModes =
(Set)singleTypeToPortletModes.get(contentType.toLowerCase());
+ Set<Mode> lowercaseContentTypeModes =
singleTypeToPortletModes.get(contentType.toLowerCase());
if (lowercaseContentTypeModes != null &&
lowercaseContentTypeModes.contains(mode))
{
return true;
@@ -331,21 +348,21 @@
// Try type matching
String type = contentType.substring(0, index);
- Set typeMode = (Set)allTypeToPortletModes.get(type);
+ Set<Mode> typeMode = allTypeToPortletModes.get(type);
if (typeMode != null && typeMode.contains(mode))
{
return true;
}
// Try type matching
- Set lowercaseTypeMode = (Set)allTypeToPortletModes.get(type.toLowerCase());
+ Set<Mode> lowercaseTypeMode = allTypeToPortletModes.get(type.toLowerCase());
if (lowercaseTypeMode != null && lowercaseTypeMode.contains(mode))
{
return true;
}
// Try wildcard matching
- Set wildcardMode = (Set)allTypeToPortletModes.get(ALL);
+ Set<Mode> wildcardMode = allTypeToPortletModes.get(ALL);
return wildcardMode != null && wildcardMode.contains(mode);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -50,7 +50,7 @@
log.debug("Creates the parent bundle");
//
- List list = new ArrayList(3);
+ List<Object> list = new ArrayList<Object>(3);
//
String title = metaData.getTitle();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/Utils.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/Utils.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/info/Utils.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -37,11 +37,14 @@
public class Utils
{
+ /** . */
private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
public static LocalizedString getLocalizedDescription(LocalizedStringMetaData
describable)
{
- Map m = new HashMap();
+ Map<Locale, String> m = new HashMap<Locale, String>();
+
+ //
for (int i = 0; i < describable.getValues().size(); i++)
{
LocalizedValueMetaData descriptionMD =
(LocalizedValueMetaData)describable.getValues().get(i);
@@ -52,6 +55,8 @@
}
m.put(locale, descriptionMD.getValue());
}
+
+ //
return new LocalizedString(m, DEFAULT_LOCALE);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/metadata/PortletApplicationMetaData.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/metadata/PortletApplicationMetaData.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/metadata/PortletApplicationMetaData.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -49,14 +49,14 @@
private Map userAttributes;
/** . */
- private Map portlets;
+ private Map<String, PortletMetaData> portlets;
public PortletApplicationMetaData()
{
this.portletModes = new LinkedHashMap();
this.windowStates = new LinkedHashMap();
this.userAttributes = new LinkedHashMap();
- this.portlets = new LinkedHashMap();
+ this.portlets = new LinkedHashMap<String, PortletMetaData>();
}
public String getId()
@@ -101,10 +101,10 @@
public PortletMetaData getPortlet(String id)
{
- return (PortletMetaData)portlets.get(id);
+ return portlets.get(id);
}
- public Collection getPortlets()
+ public Collection<PortletMetaData> getPortlets()
{
return portlets.values();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractInstanceContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractInstanceContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractInstanceContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -79,15 +79,15 @@
public void onStateEvent(StateEvent event)
{
- StateEvent.StateEventType type = event.getType();
- if (StateEvent.PORTLET_CLONED_EVENT.equals(type))
+ switch (event.getType())
{
- clonedContext = event.getPortletContext();
+ case PORTLET_CLONED_EVENT:
+ clonedContext = event.getPortletContext();
+ break;
+ case PORTLET_MODIFIED_EVENT:
+ modifiedContext = event.getPortletContext();
+ break;
}
- else if (StateEvent.PORTLET_MODIFIED_EVENT.equals(type))
- {
- modifiedContext = event.getPortletContext();
- }
}
public PortletContext getClonedContext()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -39,21 +39,24 @@
{
/** . */
- private static final Set ALL_WINDOW_STATES =
Collections.unmodifiableSet(Tools.toSet(WindowState.MAXIMIZED, WindowState.MINIMIZED,
WindowState.NORMAL));
+ private static final Map<String, String> EMPTY_STRING_TO_STRING_MAP =
Collections.emptyMap();
/** . */
- private static final Set ALL_MODES =
Collections.unmodifiableSet(Tools.toSet(Mode.EDIT, Mode.HELP, Mode.VIEW));
+ private static final Set<WindowState> ALL_WINDOW_STATES =
Collections.unmodifiableSet(Tools.toSet(WindowState.MAXIMIZED, WindowState.MINIMIZED,
WindowState.NORMAL));
/** . */
- private final Set windowStates;
+ private static final Set<Mode> ALL_MODES =
Collections.unmodifiableSet(Tools.toSet(Mode.EDIT, Mode.HELP, Mode.VIEW));
/** . */
- private final Set modes;
+ private final Set<WindowState> windowStates;
/** . */
- private final Map props;
+ private final Set<Mode> modes;
- public AbstractPortalContext(Set windowStates, Set modes, Map props)
+ /** . */
+ private final Map<String, String> props;
+
+ public AbstractPortalContext(Set<WindowState> windowStates, Set<Mode>
modes, Map<String, String> props)
{
if (windowStates == null)
{
@@ -74,7 +77,7 @@
public AbstractPortalContext()
{
- this(ALL_WINDOW_STATES, ALL_MODES, Collections.EMPTY_MAP);
+ this(ALL_WINDOW_STATES, ALL_MODES, EMPTY_STRING_TO_STRING_MAP);
}
public String getInfo()
@@ -82,17 +85,17 @@
return "JBossPortal/1.0";
}
- public Set getWindowStates()
+ public Set<WindowState> getWindowStates()
{
return windowStates;
}
- public Set getModes()
+ public Set<Mode> getModes()
{
return modes;
}
- public Map getProperties()
+ public Map<String, String> getProperties()
{
return props;
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -23,11 +23,9 @@
package org.jboss.portal.portlet.impl.spi;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
-import org.jboss.portal.common.net.URLTools;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -26,7 +26,6 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.MarkupInfo;
/**
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -30,6 +30,7 @@
import java.util.Collections;
import java.util.Locale;
import java.util.List;
+import java.util.Enumeration;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -39,6 +40,12 @@
{
/** . */
+ private static final Map<String, String> EMPTY_STRING_TO_STRING_MAP =
Collections.emptyMap();
+
+ /** . */
+ private static final List<Locale> EMPTY_LOCALE_LIST = Collections.emptyList();
+
+ /** . */
private final String id;
/** . */
@@ -81,9 +88,9 @@
/**
* Returns an immutable empty map.
*/
- public Map getInformations()
+ public Map<String, String> getInformations()
{
- return Collections.EMPTY_MAP;
+ return EMPTY_STRING_TO_STRING_MAP;
}
/**
@@ -97,8 +104,15 @@
/**
* Returns the client request locales or an empty list if no request was provided.
*/
- public List getLocales()
+ public List<Locale> getLocales()
{
- return clientRequest != null ? Tools.toList(clientRequest.getLocales()) :
Collections.EMPTY_LIST;
+ if (clientRequest == null)
+ {
+ return EMPTY_LOCALE_LIST;
+ }
+ else
+ {
+ return Tools.toList((Enumeration<Locale>)clientRequest.getLocales());
+ }
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/consumer/ConsumerPersistenceManagerService.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/consumer/ConsumerPersistenceManagerService.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/consumer/ConsumerPersistenceManagerService.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -35,11 +35,11 @@
{
/** . */
- private Map store = new HashMap();
+ private Map<String, ConsumerStateContext> store = new HashMap<String,
ConsumerStateContext>();
protected ConsumerStateContext get(String stateId)
{
- return (ConsumerStateContext)store.get(stateId);
+ return store.get(stateId);
}
protected void put(String stateId, ConsumerStateContext state)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -43,7 +43,7 @@
{
/** . */
- private Map store = new HashMap();
+ private Map<String, PortletStateContext> store = new HashMap<String,
PortletStateContext>();
/** . */
private int counter = 0;
@@ -62,7 +62,7 @@
{
throw new InvalidStateIdException(e, stateId);
}
- PortletStateContext context = (PortletStateContext)store.get(stateId);
+ PortletStateContext context = store.get(stateId);
if (context == null)
{
throw new NoSuchStateException(stateId);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CacheInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CacheInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CacheInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -29,6 +29,10 @@
public interface CacheInfo
{
- /** The expiration in seconds. */
+ /**
+ * The expiration in seconds.
+ *
+ * @return the expiration in seconds
+ */
int getExpirationSecs();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CapabilitiesInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CapabilitiesInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/CapabilitiesInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.info;
import java.util.Set;
+import java.util.Locale;
/**
* Gathers capability information (portlet modes, window states, supported MIME types and
locales) regarding a portlet.
@@ -38,47 +39,50 @@
*
* @return a Set of String representation of supported MIME types
*/
- Set getMimeTypes();
+ Set<String> getMimeTypes();
/**
* Retrieves all the portlet modes supported by the associated Portlet.
*
* @return a Set of {@link ModeInfo} reprensenting the supported portlet modes
*/
- Set getAllModes();
+ Set<ModeInfo> getAllModes();
/**
* Retrieves the portlet modes supported by the associated Portlet for the specified
MIME type.
*
+ * @param mimeType the mime type
* @return a Set of {@link ModeInfo} reprensenting the supported portlet modes for the
specified MIME type
*/
- Set getModes(String mimeType);
+ Set<ModeInfo> getModes(String mimeType);
/**
* Retrieves all the window states supported by the associated Portlet.
*
* @return a Set of {@link WindowStateInfo} reprensenting the supported window states
*/
- Set getAllWindowStates();
+ Set<WindowStateInfo> getAllWindowStates();
/**
* Retrieves the window states supported by the associated Portlet for the specified
MIME type.
*
+ * @param mimeType the mime type
* @return a Set of {@link ModeInfo} reprensenting the supported window states for the
specified MIME type
*/
- Set getWindowStates(String mimeType);
+ Set<WindowStateInfo> getWindowStates(String mimeType);
/**
* Retrieves all the locales supported by the associated Portlet.
*
* @return the Set of supported {@link java.util.Locale}s
*/
- Set getAllLocales();
+ Set<Locale> getAllLocales();
/**
* Retrieves the locales supported by the associated Portlet for the specified MIME
type.
*
+ * @param mimeType the mime type
* @return a Set of supported {@link java.util.Locale}s for the specified MIME type
*/
- Set getLocales(String mimeType);
+ Set<Locale> getLocales(String mimeType);
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/MetaInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/MetaInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/MetaInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -52,6 +52,7 @@
/**
* Return the meta value of the portlet for a specific key.
*
+ * @param key the key
* @return an internationalized value
*/
LocalizedString getMetaValue(String key);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ModeInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ModeInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ModeInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -32,10 +32,18 @@
*/
public interface ModeInfo
{
- /** The mode description. */
+ /**
+ * The mode description.
+ *
+ * @return the description
+ */
LocalizedString getDescription();
- /** The mode value. */
+ /**
+ * The mode value.
+ *
+ * @return the mode
+ */
Mode getMode();
/**
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PreferencesInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PreferencesInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PreferencesInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -31,12 +31,17 @@
*/
public interface PreferencesInfo
{
- /** Return the immutable set of keys. */
- Set getKeys();
+ /**
+ * Return the immutable set of keys.
+ *
+ * @return the keys
+ */
+ Set<String> getKeys();
/**
* A preference specified by its key.
*
+ * @param key the key
* @return the preference info or null if it does not exist
* @throws IllegalArgumentException if the key is null
*/
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SecurityInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SecurityInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SecurityInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -33,12 +33,13 @@
public interface SecurityInfo
{
/**
- *
+ * @param transportGuarantee the transport guarantee
+ * @return true if the transport guarantee is contained
*/
boolean containsTransportGuarantee(TransportGuarantee transportGuarantee);
/**
- *
+ * @return the set of transport guarantees
*/
- Set getTransportGuarantees();
+ Set<TransportGuarantee> getTransportGuarantees();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SessionInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SessionInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/SessionInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -29,7 +29,7 @@
public interface SessionInfo
{
/**
- *
+ * @return true if the session should be distributed
*/
Boolean getDistributed();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/WindowStateInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/WindowStateInfo.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/WindowStateInfo.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -32,10 +32,18 @@
*/
public interface WindowStateInfo
{
- /** The window state description. */
+ /**
+ * The window state description.
+ *
+ * @return the window state description
+ */
LocalizedString getDescription();
- /** The window state value. */
+ /**
+ * The window state value.
+ *
+ * @return the window state value
+ */
WindowState getWindowState();
/**
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortalContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortalContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortalContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.spi;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
import java.util.Map;
import java.util.Set;
@@ -40,12 +43,24 @@
*/
String getInfo();
- /** Return the window states accepted by this portal context. */
- Set getWindowStates();
+ /**
+ * Return the window states accepted by this portal context.
+ *
+ * @return the window states
+ */
+ Set<WindowState> getWindowStates();
- /** Return the modes accepted by this portal context. */
- Set getModes();
+ /**
+ * Return the modes accepted by this portal context.
+ *
+ * @return the modes
+ */
+ Set<Mode> getModes();
- /** Return the set of properties of this portal context. */
- Map getProperties();
+ /**
+ * Return the set of properties of this portal context.
+ *
+ * @return the properties
+ */
+ Map<String, String> getProperties();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -82,9 +82,9 @@
/**
* @param portletURL the portlet url
- * @param wantSecure
- * @param wantAuthenticated
- * @param relative
+ * @param wantSecure if the url should be secure
+ * @param wantAuthenticated if the url should be authenticated
+ * @param relative if the url should be relative
* @return the url
*/
String renderURL(
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/RequestContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/RequestContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/RequestContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -38,16 +38,22 @@
{
/**
* Return the scheme value.
+ *
+ * @return the scheme
*/
String getScheme();
/**
* Return the server name value.
+ *
+ * @return the server name
*/
String getServerName();
/**
* Return the server port value.
+ *
+ * @return the server port
*/
int getServerPort();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/SecurityContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/SecurityContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/SecurityContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -31,32 +31,33 @@
public interface SecurityContext
{
/**
- *
+ * @return true if is secured
*/
boolean isSecure();
/**
- *
+ * @return true if it is authenticated
*/
boolean isAuthenticated();
/**
- *
+ * @return the auth type
*/
String getAuthType();
/**
- *
+ * @return the remote user
*/
String getRemoteUser();
/**
- *
+ * @return the user principal
*/
Principal getUserPrincipal();
/**
- *
+ * @param roleName the role name
+ * @return true if the user is in role
*/
boolean isUserInRole(String roleName);
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -48,7 +48,7 @@
* @return a map containing user profile informaton
* @see org.jboss.portal.common.p3p.P3PConstants
*/
- Map getInformations();
+ Map<String, String> getInformations();
/**
* Return the user locale.
@@ -62,5 +62,5 @@
*
* @return the locales ordered according to user preference (preferred first).
*/
- List getLocales();
+ List<Locale> getLocales();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/PropertyContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/PropertyContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/PropertyContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -42,7 +42,7 @@
*
* @return the set of keys
*/
- Set getKeys();
+ Set<String> getKeys();
/**
* Return for a specified key its value or null if the value does not exist.
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -164,12 +164,12 @@
ConsumerState consumerState = new ConsumerState(clonedContext.getId(),
state);
String stateId = persistenceManager.createState(consumerState);
String clonedId = CLONE_ID_PREFIX + stateId;
- StateEvent event = new
StateEvent(PortletContext.createPortletContext(clonedId),
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new
StateEvent(PortletContext.createPortletContext(clonedId),
StateEvent.Type.PORTLET_CLONED_EVENT);
cictx.onStateEvent(event);
}
else
{
- StateEvent event = new
StateEvent(PortletContext.createPortletContext(clonedContext.getId()),
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new
StateEvent(PortletContext.createPortletContext(clonedContext.getId()),
StateEvent.Type.PORTLET_CLONED_EVENT);
cictx.onStateEvent(event);
}
}
@@ -354,15 +354,15 @@
public void onStateEvent(StateEvent event)
{
- StateEvent.StateEventType type = event.getType();
- if (StateEvent.PORTLET_CLONED_EVENT.equals(type))
+ switch (event.getType())
{
- clonedContext = event.getPortletContext();
+ case PORTLET_CLONED_EVENT:
+ clonedContext = event.getPortletContext();
+ break;
+ case PORTLET_MODIFIED_EVENT:
+ modifiedContext = event.getPortletContext();
+ break;
}
- else if (StateEvent.PORTLET_MODIFIED_EVENT.equals(type))
- {
- modifiedContext = event.getPortletContext();
- }
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -268,7 +268,7 @@
// Return the clone context
String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx =
PortletContext.createPortletContext(cloneId);
- StateEvent event = new StateEvent(clonedCtx,
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new StateEvent(clonedCtx,
StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
catch (NoSuchStateException e)
@@ -283,7 +283,7 @@
else
{
PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(clonedCtx,
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new StateEvent(clonedCtx,
StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
}
@@ -301,13 +301,13 @@
// Return the clone context
String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx =
PortletContext.createPortletContext(cloneId);
- StateEvent event = new StateEvent(clonedCtx,
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new StateEvent(clonedCtx,
StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
else
{
PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(clonedCtx,
StateEvent.PORTLET_CLONED_EVENT);
+ StateEvent event = new StateEvent(clonedCtx,
StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
}
@@ -336,7 +336,7 @@
else
{
PortletContext modifiedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(modifiedCtx,
StateEvent.PORTLET_MODIFIED_EVENT);
+ StateEvent event = new StateEvent(modifiedCtx,
StateEvent.Type.PORTLET_MODIFIED_EVENT);
instanceCtx.onStateEvent(event);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -23,6 +23,8 @@
package org.jboss.portal.portlet.support.info;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
+import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
@@ -39,83 +41,83 @@
{
/** . */
- private Set mimeTypes;
+ private Set<String> mimeTypes;
/** . */
- private Set modes;
+ private Set<ModeInfo> modes;
/** . */
- private Set windowStates;
+ private Set<WindowStateInfo> windowStates;
/** . */
- private Set locales;
+ private Set<Locale> locales;
public CapabilitiesInfoSupport()
{
- mimeTypes = new HashSet();
+ mimeTypes = new HashSet<String>();
mimeTypes.add("text/html");
//
- modes = new HashSet();
+ this.modes = new HashSet<ModeInfo>();
modes.add(new ModeInfoSupport(Mode.VIEW));
modes.add(new ModeInfoSupport(Mode.EDIT));
modes.add(new ModeInfoSupport(Mode.HELP));
//
- windowStates = new HashSet();
+ this.windowStates = new HashSet<WindowStateInfo>();
windowStates.add(new WindowStateInfoSupport(WindowState.NORMAL));
windowStates.add(new WindowStateInfoSupport(WindowState.MAXIMIZED));
windowStates.add(new WindowStateInfoSupport(WindowState.MINIMIZED));
//
- locales = new HashSet();
+ locales = new HashSet<Locale>();
locales.add(Locale.ENGLISH);
}
- public Set getMimeTypes()
+ public Set<String> getMimeTypes()
{
return mimeTypes;
}
- public Set getAllModes()
+ public Set<ModeInfo> getAllModes()
{
return modes;
}
- public Set getModes(String mimeType)
+ public Set<ModeInfo> getModes(String mimeType)
{
if (mimeTypes.contains(mimeType))
{
return modes;
}
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- public Set getAllWindowStates()
+ public Set<WindowStateInfo> getAllWindowStates()
{
return windowStates;
}
- public Set getWindowStates(String mimeType)
+ public Set<WindowStateInfo> getWindowStates(String mimeType)
{
if (mimeTypes.contains(mimeType))
{
return windowStates;
}
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- public Set getAllLocales()
+ public Set<Locale> getAllLocales()
{
return locales;
}
- public Set getLocales(String mimeType)
+ public Set<Locale> getLocales(String mimeType)
{
if (mimeTypes.contains(mimeType))
{
return locales;
}
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -36,9 +36,9 @@
{
/** . */
- private final Set transportGuarantees;
+ private final Set<TransportGuarantee> transportGuarantees;
- public SecurityInfoSupport(Set transportGuarantees)
+ public SecurityInfoSupport(Set<TransportGuarantee> transportGuarantees)
{
this.transportGuarantees = transportGuarantees;
}
@@ -53,7 +53,7 @@
return transportGuarantees.contains(transportGuarantee);
}
- public Set getTransportGuarantees()
+ public Set<TransportGuarantee> getTransportGuarantees()
{
return transportGuarantees;
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -41,7 +41,7 @@
throw new UnsupportedOperationException();
}
- public Map getInformations()
+ public Map<String, String> getInformations()
{
throw new UnsupportedOperationException();
}
@@ -51,7 +51,7 @@
throw new UnsupportedOperationException();
}
- public List getLocales()
+ public List<Locale> getLocales()
{
throw new UnsupportedOperationException();
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -35,6 +35,7 @@
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import org.jboss.portal.common.value.Value;
import java.util.HashMap;
@@ -52,11 +53,11 @@
{
/** . */
- private Map portlets;
+ private Map<String, Portlet> portlets;
public PortletInvokerSupport()
{
- this.portlets = new HashMap();
+ this.portlets = new HashMap<String, Portlet>();
}
public void setValid(String portletId, boolean valid)
@@ -110,9 +111,9 @@
return portlet;
}
- public Set getPortlets()
+ public Set<Portlet> getPortlets()
{
- return new HashSet(portlets.values());
+ return new HashSet<Portlet>(portlets.values());
}
public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
@@ -159,7 +160,7 @@
private boolean valid;
/** . */
- private Map state;
+ private Map<String, Value> state;
public InternalPortlet(String portletId, PortletSupport support)
{
@@ -174,7 +175,7 @@
this.portletContext = PortletContext.createPortletContext(portletId);
this.support = support;
this.valid = true;
- this.state = new HashMap();
+ this.state = new HashMap<String, Value>();
}
public void addPreference(String key, Value value)
@@ -210,14 +211,13 @@
}
}
- public PropertyMap getProperties(PortletContext portletContext, Set keys) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ public PropertyMap getProperties(PortletContext portletContext, Set<String>
keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
InternalPortlet internalPortlet = internalGetPortlet(portletContext);
PropertyMap props = new SimplePropertyMap();
- for (Iterator i = keys.iterator();i.hasNext();)
+ for (String key : keys)
{
- String key = (String)i.next();
- Value value = (Value)internalPortlet.state.get(key);
+ Value value = internalPortlet.state.get(key);
if (value != null)
{
props.put(key, value.clone());
@@ -230,10 +230,9 @@
{
InternalPortlet internalPortlet = internalGetPortlet(portletContext);
PropertyMap props = new SimplePropertyMap();
- for (Iterator i = internalPortlet.state.keySet().iterator();i.hasNext();)
+ for (String key: internalPortlet.state.keySet())
{
- String key = (String)i.next();
- Value value = (Value)internalPortlet.state.get(key);
+ Value value = internalPortlet.state.get(key);
if (value != null)
{
props.put(key, value.clone());
@@ -247,7 +246,7 @@
throw new UnsupportedOperationException();
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -34,6 +34,7 @@
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.state.DestroyCloneFailure;
import java.util.List;
import java.util.Set;
@@ -91,7 +92,7 @@
this.producer = producer;
}
- public Set getPortlets() throws PortletInvokerException
+ public Set<Portlet> getPortlets() throws PortletInvokerException
{
return producer.getPortlets();
}
@@ -135,12 +136,12 @@
throw new UnsupportedOperationException();
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
- public PropertyMap getProperties(PortletContext portletContext, Set keys) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ public PropertyMap getProperties(PortletContext portletContext, Set<String>
keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
Modified:
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestInstanceContext.java
===================================================================
---
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestInstanceContext.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestInstanceContext.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -91,13 +91,7 @@
public void onStateEvent(StateEvent event)
{
- StateEvent.StateEventType type = event.getType();
-
- //
- if (StateEvent.PORTLET_CLONED_EVENT.equals(type) ||
StateEvent.PORTLET_MODIFIED_EVENT.equals(type))
- {
- target = event.getPortletContext();
- req.getSession().setAttribute("clone." + id, target);
- }
+ target = event.getPortletContext();
+ req.getSession().setAttribute("clone." + id, target);
}
}
Modified:
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestPortletInvoker.java
===================================================================
---
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestPortletInvoker.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/TestPortletInvoker.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -28,6 +28,7 @@
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
@@ -91,7 +92,7 @@
this.producer = producer;
}
- public Set getPortlets() throws PortletInvokerException
+ public Set<Portlet> getPortlets() throws PortletInvokerException
{
return producer.getPortlets();
}
@@ -135,7 +136,7 @@
throw new UnsupportedOperationException();
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
Modified:
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/deployment/PortletApplicationMetaDataFactory.java
===================================================================
---
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/deployment/PortletApplicationMetaDataFactory.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/deployment/PortletApplicationMetaDataFactory.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -398,7 +398,7 @@
}
if ("transport-guarantee".equals(localName))
{
- security.setTransportGuarantee(TransportGuarantee.decode(value));
+ security.setTransportGuarantee(TransportGuarantee.valueOf(value));
}
}
}
Modified:
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2008-01-07
14:38:54 UTC (rev 9447)
+++
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/GeneralMetaDataTestCase.java 2008-01-07
19:56:29 UTC (rev 9448)
@@ -102,7 +102,7 @@
ListenerMetaData listener1 = md.getListeners().get(0);
assertNotNull(listener1);
assertEquals("org.jboss.portal.portlet.test.listener.MyListener",
listener1.getListenerClass());
- assertEquals("Mein Zuhörer Eins",
listener1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals("Mein Zuh\u00f6rer Eins",
listener1.getDisplayName().getString(new Locale("de"), false));
assertEquals("Beschreibung", listener1.getDescription().getString(new
Locale("de"), false));
assertNotNull(md.getListeners().get(1));