Author: chris.laprun(a)jboss.com
Date: 2011-07-28 15:54:56 -0400 (Thu, 28 Jul 2011)
New Revision: 6945
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
Log:
- Added property management.
- Reworked how Lifecycle is handled based on API changes.
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-28
19:52:33 UTC (rev 6944)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-28
19:54:56 UTC (rev 6945)
@@ -61,7 +61,6 @@
import org.gatein.api.util.IterableIdentifiableCollection;
import org.gatein.api.util.Type;
import org.gatein.common.util.ParameterValidation;
-import org.gatein.portal.api.impl.lifecycle.NoOpLifecycleManager;
import org.gatein.portal.api.impl.portal.DashboardSiteImpl;
import org.gatein.portal.api.impl.portal.GroupSiteImpl;
import org.gatein.portal.api.impl.portal.PageImpl;
@@ -73,7 +72,9 @@
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.regex.Pattern;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
@@ -110,18 +111,38 @@
private ApplicationRegistryService registryService;
private GadgetRegistryService gadgetService;
private SourceStorage sourceStorage;
- private LifecycleManager lcManager = new NoOpLifecycleManager();
+ private Map<Type, Object> properties = new HashMap<Type, Object>(7);
+ private LifecycleManager lcManager = GateIn.NO_OP_MANAGER;
public GateInImpl(ExoContainerContext context, InitParams params, ConfigurationManager
configurationManager)
{
container = context.getContainer();
}
- public void setLifecycleManager(LifecycleManager lcManager)
+ public <T> T getProperty(Type<T, GateIn> property)
{
- this.lcManager = lcManager;
+ if (property == null)
+ {
+ return null;
+ }
+
+ Class<T> type = property.getValueType();
+ Object o = properties.get(property);
+ return type.cast(o);
}
+ public <T> void setProperty(Type<T, GateIn> property, T value)
+ {
+ if (property != null)
+ {
+ if (GateIn.LIFECYCLE_MANAGER.equals(property))
+ {
+ lcManager = GateIn.LIFECYCLE_MANAGER.getValueType().cast(value);
+ }
+ properties.put(property, value);
+ }
+ }
+
public IterableIdentifiableCollection<Portal> getPortals()
{
try
Show replies by date