Author: chris.laprun(a)jboss.com
Date: 2011-07-13 11:50:50 -0400 (Wed, 13 Jul 2011)
New Revision: 6869
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
Log:
- Extracted getPortalDataFor method.
- Removed now unneeded POMSessionManager.
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-13
15:11:17 UTC (rev 6868)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-13
15:50:50 UTC (rev 6869)
@@ -30,12 +30,12 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
import org.gatein.api.GateIn;
import org.gatein.api.IterableResult;
+import org.gatein.api.ParameterValidation;
import org.gatein.api.content.Application;
import org.gatein.api.content.Content;
import org.gatein.api.content.Gadget;
@@ -61,7 +61,6 @@
private ExoContainer container;
private ModelDataStorage dataStorage;
private NavigationService navigationService;
- private POMSessionManager pomSessionManager;
public GateInImpl(ExoContainerContext context, InitParams params, ConfigurationManager
configurationManager)
{
@@ -89,20 +88,8 @@
public Portal getPortal(Id<Portal> portalId)
{
- try
- {
- RequestLifeCycle.begin(container);
- PortalData portalData =
dataStorage.getPortalConfig(PortalKey.create(portalId.toString()));
- return new PortalImpl(portalData, this);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- RequestLifeCycle.end();
- }
+ PortalData portalData = getPortalDataFor(portalId);
+ return new PortalImpl(portalData, this);
}
public Portal getDefaultPortal()
@@ -194,12 +181,11 @@
{
dataStorage =
(ModelDataStorage)container.getComponentInstanceOfType(ModelDataStorage.class);
navigationService =
(NavigationService)container.getComponentInstanceOfType(NavigationService.class);
- pomSessionManager =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
}
public void stop()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // nothing to do
}
ModelDataStorage getDataStorage()
@@ -212,6 +198,25 @@
return navigationService;
}
+ private PortalData getPortalDataFor(Id<Portal> portalId)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portalId, "Portal
Id");
+ try
+ {
+ RequestLifeCycle.begin(container);
+
+ return dataStorage.getPortalConfig(PortalKey.create(portalId.toString()));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ RequestLifeCycle.end();
+ }
+ }
+
private static class PortalIterator implements Iterator<Portal>
{
private int current;
@@ -259,20 +264,7 @@
public boolean contains(Id<Portal> id)
{
- try
- {
- RequestLifeCycle.begin(container);
-
- return id != null &&
dataStorage.getPortalConfig(PortalKey.create(id.toString())) != null;
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- RequestLifeCycle.end();
- }
+ return getPortalDataFor(id) != null;
}
public Iterator<Portal> iterator()