Author: julien_viet
Date: 2009-12-16 23:39:43 -0500 (Wed, 16 Dec 2009)
New Revision: 1032
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationListener.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationStatus.java
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/MOPSessionLifeCycle.java
Modified:
portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetDeployer.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/AbstractContext.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticManager.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SessionContext.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/Synchronization.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/chromattic/ChromatticIntegrationTestCase.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestOrganization.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestWSRP.java
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractGateInTest.java
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java
portal/trunk/component/test/organization/src/test/java/org/exoplatform/component/test/organization/BootstrapTestCase.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/WebAppController.java
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java
portal/trunk/pom.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/organization-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
Log:
GTNPORTAL-396 : Improve request life cycle management
GTNPORTAL-395 : Update to Chromattic 1.0.0-beta11
GTNPORTAL-394 : Update to JCR 1.12.0-Beta05
Modified:
portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml
===================================================================
---
portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml 2009-12-17
04:39:43 UTC (rev 1032)
@@ -81,7 +81,7 @@
</propertyDefinition>
</propertyDefinitions>
<childNodeDefinitions>
- <childNodeDefinition name="resources"
defaultPrimaryType="nt:folder" autoCreated="true"
mandatory="true"
+ <childNodeDefinition name="resources"
defaultPrimaryType="nt:folder" autoCreated="false"
mandatory="true"
onParentVersion="COPY" protected="false"
sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:folder</requiredPrimaryType>
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetDeployer.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetDeployer.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/GadgetDeployer.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -154,7 +154,7 @@
}
finally
{
- lifeCycle.closeContext(context, true);
+ lifeCycle.closeContext(true);
}
}
}
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -24,6 +24,7 @@
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.Property;
+import org.chromattic.ntdef.NTFolder;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -68,6 +69,9 @@
@Create
protected abstract RemoteGadgetData createRemoteData();
+ @Create
+ protected abstract NTFolder createFolder();
+
public boolean isLocal()
{
GadgetData data = getData();
@@ -83,6 +87,8 @@
{
LocalGadgetData localData = createLocalData();
setData(localData);
+ NTFolder resources = createFolder();
+ localData.setResources(resources);
}
}
else
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -57,6 +57,8 @@
@MappedBy("resources")
public abstract NTFolder getResources();
+ protected abstract void setResources(NTFolder resources);
+
private NTFile getGadgetContent() {
String fileName = getFileName();
NTFolder resources = getResources();
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -30,6 +30,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -49,7 +50,6 @@
import java.util.Comparator;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
/**
* The fundamental reason that motives to use tasks is because of the JMX access that
does not
@@ -119,31 +119,21 @@
final List<ApplicationCategory> categories = new
ArrayList<ApplicationCategory>();
//
-/*
- pomMGr.execute(new POMTask()
+ ContentRegistry registry = getContentRegistry();
+
+ //
+ for (CategoryDefinition categoryDef : registry.getCategoryList())
{
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ ApplicationCategory category = load(categoryDef, appTypes);
+ categories.add(category);
+ }
- //
- for (CategoryDefinition categoryDef : registry.getCategoryList())
- {
- ApplicationCategory category = load(categoryDef, appTypes);
- categories.add(category);
- }
+ //
+ if (sortComparator != null)
+ {
+ Collections.sort(categories, sortComparator);
+ }
- //
- if (sortComparator != null)
- {
- Collections.sort(categories, sortComparator);
- }
-/*
- }
- });
-*/
-
//
return categories;
}
@@ -165,79 +155,46 @@
public ApplicationCategory getApplicationCategory(final String name) throws Exception
{
- final AtomicReference<ApplicationCategory> a = new
AtomicReference<ApplicationCategory>();
+ ContentRegistry registry = getContentRegistry();
//
-/*
- pomMGr.execute(new POMTask()
+ CategoryDefinition categoryDef = registry.getCategory(name);
+ if (categoryDef != null)
{
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ ApplicationCategory applicationCategory = load(categoryDef);
+ return applicationCategory;
+ }
- //
- CategoryDefinition categoryDef = registry.getCategory(name);
- if (categoryDef != null)
- {
- ApplicationCategory applicationCategory = load(categoryDef);
- a.set(applicationCategory);
- }
-/*
- }
- });
-*/
-
//
- return a.get();
+ return null;
}
public void save(final ApplicationCategory category) throws Exception
{
-/*
- pomMGr.execute(new POMTask()
- {
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ ContentRegistry registry = getContentRegistry();
- //
- String categoryName = category.getName();
+ //
+ String categoryName = category.getName();
- //
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
- {
- categoryDef = registry.createCategory(categoryName);
- }
+ //
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
+ {
+ categoryDef = registry.createCategory(categoryName);
+ }
- //
- categoryDef.setDisplayName(category.getDisplayName());
- categoryDef.setCreationDate(category.getCreatedDate());
- categoryDef.setLastModificationDate(category.getModifiedDate());
- categoryDef.setDescription(category.getDescription());
- categoryDef.setAccessPermissions(category.getAccessPermissions());
- }
-/*
- });
+ //
+ categoryDef.setDisplayName(category.getDisplayName());
+ categoryDef.setCreationDate(category.getCreatedDate());
+ categoryDef.setLastModificationDate(category.getModifiedDate());
+ categoryDef.setDescription(category.getDescription());
+ categoryDef.setAccessPermissions(category.getAccessPermissions());
}
-*/
public void remove(final ApplicationCategory category) throws Exception
{
-/*
- pomMGr.execute(new POMTask()
- {
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
- registry.getCategoryMap().remove(category.getName());
-/*
- }
- });
-*/
+ ContentRegistry registry = getContentRegistry();
+ registry.getCategoryMap().remove(category.getName());
}
public List<Application> getApplications(ApplicationCategory category,
ApplicationType<?>... appTypes) throws Exception
@@ -250,36 +207,20 @@
final Comparator<Application> sortComparator,
final ApplicationType<?>... appTypes) throws Exception
{
- final AtomicReference<List<Application>> ref = new
AtomicReference<List<Application>>();
+ ContentRegistry registry = getContentRegistry();
//
-/*
- pomMGr.execute(new POMTask()
+ CategoryDefinition categoryDef = registry.getCategory(category.getName());
+ List<Application> applications = load(categoryDef,
appTypes).getApplications();
+
+ //
+ if (sortComparator != null)
{
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ Collections.sort(applications, sortComparator);
+ }
- //
- CategoryDefinition categoryDef = registry.getCategory(category.getName());
- List<Application> applications = load(categoryDef,
appTypes).getApplications();
-
- //
- if (sortComparator != null)
- {
- Collections.sort(applications, sortComparator);
- }
-
- //
- ref.set(applications);
-/*
- }
- });
-*/
-
//
- return ref.get();
+ return applications;
}
public List<Application> getAllApplications() throws Exception
@@ -305,115 +246,82 @@
public Application getApplication(final String category, final String name) throws
Exception
{
- final AtomicReference<Application> ref = new
AtomicReference<Application>();
+ ContentRegistry registry = getContentRegistry();
//
-/*
- pomMGr.execute(new POMTask()
+ CategoryDefinition categoryDef = registry.getCategory(category);
+ if (categoryDef != null)
{
- public void run(POMSession session) throws Exception
+ ContentDefinition contentDef = categoryDef.getContentMap().get(name);
+ if (contentDef != null)
{
-*/
- ContentRegistry registry = getContentRegistry();
-
- //
- CategoryDefinition categoryDef = registry.getCategory(category);
- if (categoryDef != null)
- {
- ContentDefinition contentDef = categoryDef.getContentMap().get(name);
- if (contentDef != null)
- {
- ref.set(load(contentDef));
- }
- }
-/*
+ return load(contentDef);
}
- });
-*/
+ }
//
- return ref.get();
+ return null;
}
public void save(final ApplicationCategory category, final Application application)
throws Exception
{
-/*
- pomMGr.execute(new POMTask()
+ ContentRegistry registry = getContentRegistry();
+
+ //
+ String categoryName = category.getName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
{
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ categoryDef = registry.createCategory(categoryName);
+ save(category, categoryDef);
+ }
- //
- String categoryName = category.getName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
- {
- categoryDef = registry.createCategory(categoryName);
- save(category, categoryDef);
- }
+ //
+ ContentDefinition contentDef = null;
+ CategoryDefinition applicationCategoryDef =
registry.getCategory(application.getCategoryName());
+ String applicationName = application.getApplicationName();
+ if (applicationCategoryDef != null)
+ {
+ contentDef = applicationCategoryDef.getContentMap().get(applicationName);
+ }
+ if (contentDef == null)
+ {
+ String contentId = application.getContentId();
+ ContentType<?> contentType = application.getType().getContentType();
+ String definitionName = application.getApplicationName();
+ contentDef = categoryDef.createContent(definitionName, contentType, contentId);
+ }
+ else
+ {
+ // A JCR move actually
+ categoryDef.getContentList().add(contentDef);
+ }
- //
- ContentDefinition contentDef = null;
- CategoryDefinition applicationCategoryDef =
registry.getCategory(application.getCategoryName());
- String applicationName = application.getApplicationName();
- if (applicationCategoryDef != null)
- {
- contentDef = applicationCategoryDef.getContentMap().get(applicationName);
- }
- if (contentDef == null)
- {
- String contentId = application.getContentId();
- ContentType<?> contentType =
application.getType().getContentType();
- String definitionName = application.getApplicationName();
- contentDef = categoryDef.createContent(definitionName, contentType,
contentId);
- }
- else
- {
- // A JCR move actually
- categoryDef.getContentList().add(contentDef);
- }
-
- // Update state
- save(application, contentDef);
-/*
- }
- });
-*/
+ // Update state
+ save(application, contentDef);
}
public void update(final Application application) throws Exception
{
-/*
- pomMGr.execute(new POMTask()
+ ContentRegistry registry = getContentRegistry();
+
+ //
+ String categoryName = application.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ if (categoryDef == null)
{
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ throw new IllegalStateException();
+ }
- //
- String categoryName = application.getCategoryName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
- if (categoryDef == null)
- {
- throw new IllegalStateException();
- }
+ //
+ ContentDefinition contentDef =
categoryDef.getContentMap().get(application.getApplicationName());
+ if (contentDef == null)
+ {
+ throw new IllegalStateException();
+ }
- //
- ContentDefinition contentDef =
categoryDef.getContentMap().get(application.getApplicationName());
- if (contentDef == null)
- {
- throw new IllegalStateException();
- }
-
- // Update state
- save(application, contentDef);
-/*
- }
- });
-*/
+ // Update state
+ save(application, contentDef);
}
public void remove(final Application app) throws Exception
@@ -424,181 +332,151 @@
}
//
-/*
- pomMGr.execute(new POMTask()
- {
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ ContentRegistry registry = getContentRegistry();
- //
- String categoryName = app.getCategoryName();
- CategoryDefinition categoryDef = registry.getCategory(categoryName);
+ //
+ String categoryName = app.getCategoryName();
+ CategoryDefinition categoryDef = registry.getCategory(categoryName);
- //
- if (categoryDef != null)
- {
+ //
+ if (categoryDef != null)
+ {
- String contentName = app.getApplicationName();
- categoryDef.getContentMap().remove(contentName);
- }
-/*
- }
- });
-*/
+ String contentName = app.getApplicationName();
+ categoryDef.getContentMap().remove(contentName);
+ }
}
public void importExoGadgets() throws Exception
{
-/*
- pomMGr.execute(new POMTask()
- {
- public void run(POMSession session) throws Exception
- {
-*/
- ContentRegistry registry = getContentRegistry();
+ ContentRegistry registry = getContentRegistry();
- //
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- GadgetRegistryService gadgetService =
(GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
- List<Gadget> eXoGadgets = gadgetService.getAllGadgets();
+ //
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ GadgetRegistryService gadgetService =
(GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
+ List<Gadget> eXoGadgets = gadgetService.getAllGadgets();
- //
- if (eXoGadgets != null)
- {
- ArrayList<String> permissions = new ArrayList<String>();
- permissions.add(UserACL.EVERYONE);
- String categoryName = "Gadgets";
+ //
+ if (eXoGadgets != null)
+ {
+ ArrayList<String> permissions = new ArrayList<String>();
+ permissions.add(UserACL.EVERYONE);
+ String categoryName = "Gadgets";
- //
- CategoryDefinition category = registry.getCategory(categoryName);
- if (category == null)
- {
- category = registry.createCategory(categoryName);
- category.setDisplayName(categoryName);
- category.setDescription(categoryName);
- category.setAccessPermissions(permissions);
- }
+ //
+ CategoryDefinition category = registry.getCategory(categoryName);
+ if (category == null)
+ {
+ category = registry.createCategory(categoryName);
+ category.setDisplayName(categoryName);
+ category.setDescription(categoryName);
+ category.setAccessPermissions(permissions);
+ }
- //
- for (Gadget ele : eXoGadgets)
- {
- ContentDefinition app = category.getContentMap().get(ele.getName());
- if (app == null)
- {
- app = category.createContent(ele.getName(),
org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE, ele.getName());
- app.setDisplayName(ele.getTitle());
- app.setDescription(ele.getDescription());
- app.setAccessPermissions(permissions);
- }
- }
+ //
+ for (Gadget ele : eXoGadgets)
+ {
+ ContentDefinition app = category.getContentMap().get(ele.getName());
+ if (app == null)
+ {
+ app = category.createContent(ele.getName(),
org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE, ele.getName());
+ app.setDisplayName(ele.getTitle());
+ app.setDescription(ele.getDescription());
+ app.setAccessPermissions(permissions);
}
-/*
}
- });
-*/
+ }
}
public void importAllPortlets() throws Exception
{
-/*
- pomMGr.execute(new POMTask()
+ ContentRegistry registry = getContentRegistry();
+
+ //
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ PortletInvoker portletInvoker =
(PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
+ Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();
+
+ //
+ for (org.gatein.pc.api.Portlet portlet : portlets)
{
- public void run(POMSession session) throws Exception
+ PortletInfo info = portlet.getInfo();
+ String portletApplicationName = info.getApplicationName();
+ String portletName = info.getName();
+
+ // Need to sanitize portlet and application names in case they contain
characters that would
+ // cause an improper Application name
+ portletApplicationName = portletApplicationName.replace('/',
'_');
+ portletName = portletName.replace('/', '_');
+
+ LocalizedString keywordsLS = info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
+
+ String[] categoryNames = null;
+ if (keywordsLS != null)
{
-*/
- ContentRegistry registry = getContentRegistry();
+ String keywords = keywordsLS.getDefaultString();
+ if (keywords != null && keywords.length() != 0)
+ {
+ categoryNames = keywords.split(",");
+ }
+ }
+ if (categoryNames == null || categoryNames.length == 0)
+ {
+ categoryNames = new String[]{portletApplicationName};
+ }
+
+ if (portlet.isRemote())
+ {
+ categoryNames = Tools.appendTo(categoryNames, REMOTE_CATEGORY_NAME);
+ }
+
+ //
+ for (String categoryName : categoryNames)
+ {
+ categoryName = categoryName.trim();
+
//
- ExoContainer manager = ExoContainerContext.getCurrentContainer();
- PortletInvoker portletInvoker =
(PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
- Set<org.gatein.pc.api.Portlet> portlets =
portletInvoker.getPortlets();
+ CategoryDefinition category = registry.getCategory(categoryName);
//
- for (org.gatein.pc.api.Portlet portlet : portlets)
+ if (category == null)
{
- PortletInfo info = portlet.getInfo();
- String portletApplicationName = info.getApplicationName();
- String portletName = info.getName();
+ category = registry.createCategory(categoryName);
+ category.setDisplayName(categoryName);
+ }
- // Need to sanitize portlet and application names in case they contain
characters that would
- // cause an improper Application name
- portletApplicationName = portletApplicationName.replace('/',
'_');
- portletName = portletName.replace('/', '_');
+ //
+ ContentDefinition app = category.getContentMap().get(portletName);
+ if (app == null)
+ {
+ LocalizedString descriptionLS =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ LocalizedString displayNameLS =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- LocalizedString keywordsLS =
info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
+ // julien: ????
+ // getLocalizedStringValue(descriptionLS, portletName);
- String[] categoryNames = null;
- if (keywordsLS != null)
+ ContentType<?> contentType;
+ String contentId;
+ if (portlet.isRemote())
{
- String keywords = keywordsLS.getDefaultString();
- if (keywords != null && keywords.length() != 0)
- {
- categoryNames = keywords.split(",");
- }
+ contentType = WSRP.CONTENT_TYPE;
+ contentId = portlet.getContext().getId();
}
-
- if (categoryNames == null || categoryNames.length == 0)
+ else
{
- categoryNames = new String[]{portletApplicationName};
+ contentType = Portlet.CONTENT_TYPE;
+ contentId = info.getApplicationName() + "/" +
info.getName();
}
- if (portlet.isRemote())
- {
- categoryNames = Tools.appendTo(categoryNames, REMOTE_CATEGORY_NAME);
- }
//
- for (String categoryName : categoryNames)
- {
- categoryName = categoryName.trim();
-
- //
- CategoryDefinition category = registry.getCategory(categoryName);
-
- //
- if (category == null)
- {
- category = registry.createCategory(categoryName);
- category.setDisplayName(categoryName);
- }
-
- //
- ContentDefinition app = category.getContentMap().get(portletName);
- if (app == null)
- {
- LocalizedString descriptionLS =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- LocalizedString displayNameLS =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
-
- // julien: ????
- // getLocalizedStringValue(descriptionLS, portletName);
-
- ContentType<?> contentType;
- String contentId;
- if (portlet.isRemote())
- {
- contentType = WSRP.CONTENT_TYPE;
- contentId = portlet.getContext().getId();
- }
- else
- {
- contentType = Portlet.CONTENT_TYPE;
- contentId = info.getApplicationName() + "/" +
info.getName();
- }
-
-
- //
- app = category.createContent(portletName, contentType, contentId);
- app.setDisplayName(getLocalizedStringValue(displayNameLS,
portletName));
- app.setDescription(getLocalizedStringValue(descriptionLS,
portletName));
- }
- }
+ app = category.createContent(portletName, contentType, contentId);
+ app.setDisplayName(getLocalizedStringValue(displayNameLS, portletName));
+ app.setDescription(getLocalizedStringValue(descriptionLS, portletName));
}
-/*
}
- });
-*/
+ }
}
private boolean isApplicationType(Application app, ApplicationType<?>...
appTypes)
@@ -724,9 +602,7 @@
{
if (plugins != null)
{
-// POMSession session = pomMGr.openSession();
-// SessionContext context = lifeCycle.openContext();
- manager.beginRequest();
+ RequestLifeCycle.begin(manager);
boolean save = false;
try
{
@@ -744,7 +620,8 @@
finally
{
// lifeCycle.closeContext(context, true);
- manager.endRequest(true);
+ manager.getSynchronization().setSave(save);
+ RequestLifeCycle.end();
}
}
}
Modified:
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java
===================================================================
---
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/registry/TestApplicationRegistryService.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -77,15 +77,16 @@
{
PortalContainer portalContainer = PortalContainer.getInstance();
chromatticManager =
(ChromatticManager)portalContainer.getComponentInstanceOfType(ChromatticManager.class);
- chromatticManager.beginRequest();
service_ =
(ApplicationRegistryService)portalContainer.getComponentInstanceOfType(ApplicationRegistryService.class);
orgService =
(OrganizationService)portalContainer.getComponentInstanceOfType(OrganizationService.class);
+ begin();
}
@Override
protected void tearDown() throws Exception
{
- chromatticManager.endRequest(false);
+ chromatticManager.getSynchronization().setSave(false);
+ end();
}
public void testApplicationCategory() throws Exception
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/AbstractContext.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/AbstractContext.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/AbstractContext.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -21,10 +21,12 @@
import org.chromattic.api.ChromatticSession;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
/**
- * An abstract implementation of the {@link
org.exoplatform.commons.chromattic.SessionContext} interface.
+ * An abstract implementation of the {@link
org.exoplatform.commons.chromattic.SessionContext} interface. The context
+ * owns the chromattic session.
*
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
@@ -38,20 +40,24 @@
/** . */
private Map<String, Object> attributes;
- /** The related configurator. */
- private final ChromatticLifeCycle configurator;
+ /** The related life cycle. */
+ private final ChromatticLifeCycle lifeCycle;
- public AbstractContext(ChromatticLifeCycle configurator)
+ /** . */
+ private HashSet<SynchronizationListener> listeners;
+
+ AbstractContext(ChromatticLifeCycle lifeCycle)
{
- this.configurator = configurator;
+ this.lifeCycle = lifeCycle;
this.session = null;
+ this.listeners = null;
}
public final ChromatticSession getSession()
{
if (session == null)
{
- session = configurator.realChromattic.openSession();
+ session = lifeCycle.realChromattic.openSession();
}
return session;
}
@@ -83,6 +89,22 @@
public void close(boolean save)
{
+ if (listeners != null)
+ {
+ for (SynchronizationListener listener : listeners)
+ {
+ try
+ {
+ listener.beforeSynchronization();
+ }
+ catch (Exception e)
+ {
+ // to log
+ }
+ }
+ }
+
+ //
if (session != null)
{
if (save)
@@ -95,9 +117,39 @@
}
//
- configurator.currentContext.set(null);
+ if (listeners != null)
+ {
+ SynchronizationStatus status = save ? SynchronizationStatus.SAVED :
SynchronizationStatus.DISCARDED;
+ for (SynchronizationListener listener : listeners)
+ {
+ try
+ {
+ listener.afterSynchronization(status);
+ }
+ catch (Exception e)
+ {
+ // to log
+ }
+ }
+ }
//
- configurator.onCloseSession(this);
+ lifeCycle.currentContext.set(null);
+
+ //
+ lifeCycle.onCloseSession(this);
}
+
+ public final void addSynchronizationListener(SynchronizationListener listener)
+ {
+ if (listener == null)
+ {
+ throw new NullPointerException();
+ }
+ if (listeners == null)
+ {
+ listeners = new HashSet<SynchronizationListener>();
+ }
+ listeners.add(listener);
+ }
}
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -24,7 +24,6 @@
import org.exoplatform.container.xml.InitParams;
import java.util.List;
-import java.util.concurrent.Callable;
/**
* <p>The chromattic life cycle objets is a plugin that allow to bootstrap a
chromattic builder and make
@@ -166,7 +165,7 @@
throw new IllegalStateException("A session is already opened.");
}
- //
+ // Attempt to get the synchronization
Synchronization sync = manager.getSynchronization();
//
@@ -215,12 +214,18 @@
return context;
}
- public final void closeContext(SessionContext context, boolean save)
+ public final void closeContext(boolean save)
{
- AbstractContext abstractContext = (AbstractContext)context;
+ AbstractContext context = (AbstractContext)getContext(true);
//
- ((AbstractContext)context).close(save);
+ if (context == null)
+ {
+ throw new IllegalStateException("No current context existing");
+ }
+
+ //
+ context.close(save);
}
protected void onOpenSession(SessionContext context)
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticManager.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticManager.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticManager.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -18,7 +18,9 @@
*/
package org.exoplatform.commons.chromattic;
+import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
import org.exoplatform.services.jcr.RepositoryService;
import java.util.HashMap;
@@ -28,7 +30,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class ChromatticManager
+public class ChromatticManager implements ComponentRequestLifecycle
{
/** . */
@@ -41,22 +43,19 @@
Map<String, ChromatticLifeCycle> lifeCycles = new HashMap<String,
ChromatticLifeCycle>();
/** . */
- private static final ThreadLocal<Synchronization> currentSynchronization = new
ThreadLocal<Synchronization>();
+ private final ThreadLocal<Synchronization> currentSynchronization = new
ThreadLocal<Synchronization>();
public ChromatticManager(RepositoryService repositoryService) throws Exception {
this.repositoryService = repositoryService;
this.lifeCycleToWorkspaceMap = new HashMap<String, String>();
}
- static Synchronization getCurrentSynchronization() {
- return currentSynchronization.get();
- }
-
public ChromatticLifeCycle getLifeCycle(String lifeCycleName)
{
return lifeCycles.get(lifeCycleName);
}
+ // Called by kernel
public void addLifeCycle(ComponentPlugin plugin)
{
ChromatticLifeCycle lifeCycle = (ChromatticLifeCycle)plugin;
@@ -100,7 +99,7 @@
/**
* Ends the demarcation of a request.
*
- * @param save if state must be saved
+ * @param save to save the state
* @throws IllegalStateException if no request was started previously
*/
public void endRequest(boolean save) throws IllegalStateException
@@ -122,4 +121,16 @@
//
currentSynchronization.set(null);
}
+
+ public void startRequest(ExoContainer container)
+ {
+ beginRequest();
+ }
+
+ public void endRequest(ExoContainer container)
+ {
+ Synchronization sync = currentSynchronization.get();
+ boolean save = sync.isSave();
+ endRequest(save);
+ }
}
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -46,7 +46,7 @@
}
finally
{
- lifeCycle.closeContext(context, true);
+ lifeCycle.closeContext(true);
}
}
else
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SessionContext.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SessionContext.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SessionContext.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -52,4 +52,11 @@
* @param payload the attachment payload
*/
void setAttachment(String name, Object payload);
+
+ /**
+ * Registers a synchronization listener.
+ *
+ * @param listener the listener
+ */
+ void addSynchronizationListener(SynchronizationListener listener);
}
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/Synchronization.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/Synchronization.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/Synchronization.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -28,7 +28,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-class Synchronization implements LoginContext
+public class Synchronization implements LoginContext
{
/** The sessions mapped by workspace name. */
@@ -37,6 +37,9 @@
/** . */
private final Map<String, GlobalContext> contexts = new HashMap<String,
GlobalContext>();
+ /** . */
+ private boolean save = true;
+
/**
* Returns a specified global context by its name.
*
@@ -84,8 +87,8 @@
public void close(boolean save)
{
- // First close all sessions
- for (AbstractContext context : contexts.values())
+ // First save all global contexts (sessions)
+ for (GlobalContext context : contexts.values())
{
context.close(save);
}
@@ -96,4 +99,14 @@
session.logout();
}
}
+
+ public boolean isSave()
+ {
+ return save;
+ }
+
+ public void setSave(boolean save)
+ {
+ this.save = save;
+ }
}
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationListener.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationListener.java
(rev 0)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationListener.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.commons.chromattic;
+
+/**
+ * <p>Useful for being aware of the synchronization.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public interface SynchronizationListener
+{
+
+ /**
+ * Before synchronization occurs.
+ */
+ void beforeSynchronization();
+
+ /**
+ * Once synchronization occured.
+ *
+ * @param status the status of the synchronization
+ */
+ void afterSynchronization(SynchronizationStatus status);
+
+}
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationStatus.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationStatus.java
(rev 0)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/SynchronizationStatus.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.commons.chromattic;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public enum SynchronizationStatus
+{
+
+ DISCARDED, SAVED
+
+}
Modified:
portal/trunk/component/common/src/test/java/org/exoplatform/commons/chromattic/ChromatticIntegrationTestCase.java
===================================================================
---
portal/trunk/component/common/src/test/java/org/exoplatform/commons/chromattic/ChromatticIntegrationTestCase.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/common/src/test/java/org/exoplatform/commons/chromattic/ChromatticIntegrationTestCase.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -46,6 +46,10 @@
/** . */
private ChromatticManager chromatticManager;
+ public ChromatticIntegrationTestCase()
+ {
+ }
+
@Override
protected void setUp() throws Exception
{
@@ -54,12 +58,6 @@
testLF = chromatticManager.getLifeCycle("test");
}
- @Override
- protected void tearDown() throws Exception
- {
-
- }
-
public void testConfiguratorInitialized() throws Exception
{
assertNotNull(testLF);
@@ -132,7 +130,7 @@
}
finally
{
- testLF.closeContext(context, false);
+ testLF.closeContext(false);
}
// Assert JCR session was properly closed
@@ -142,7 +140,7 @@
public void testLocalRequestNoSessionAccess()
{
SessionContext context = testLF.openContext();
- testLF.closeContext(context, false);
+ testLF.closeContext(false);
}
public void testGlobalSession() throws Exception
@@ -150,6 +148,9 @@
Session jcrSession;
//
+ SynchronizationEventQueue queue = new SynchronizationEventQueue();
+
+ //
chromatticManager.beginRequest();
try
{
@@ -162,8 +163,12 @@
ChromatticSession session = chromattic.openSession();
// Now we should have a context
- assertNotNull(testLF.getContext(true));
+ SessionContext context = testLF.getContext(true);
+ assertNotNull(context);
+ // Register synchronzation with event queue
+ context.addSynchronizationListener(queue);
+
// Check how chromattic see the session
FooEntity foo = session.create(FooEntity.class);
assertEquals("portal-test", foo.getWorkspace());
@@ -177,12 +182,19 @@
// Closing chromattic session should not close the underlying JCR session
session.close();
assertTrue(jcrSession.isLive());
+
+ // Queue should be empty up to here
+ queue.assertEmpty();
}
finally
{
chromatticManager.endRequest(false);
}
+ //
+ queue.assertEvent(SynchronizationEvent.BEFORE);
+ queue.assertEvent(SynchronizationEvent.DISCARDED);
+
// Assert JCR session was properly closed
assertFalse(jcrSession.isLive());
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -21,6 +21,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.services.cache.CacheService;
@@ -114,15 +115,23 @@
try
{
// Wrap within transaction so all initializers can work
- idmService_.getIdentitySession().beginTransaction();
+// idmService_.getIdentitySession().beginTransaction();
+
+ RequestLifeCycle.begin(this);
+
super.start();
- idmService_.getIdentitySession().getTransaction().commit();
+// idmService_.getIdentitySession().getTransaction().commit();
+
}
catch (Exception e)
{
e.printStackTrace(); //To change body of catch statement use File | Settings |
File Templates.
}
+ finally
+ {
+ RequestLifeCycle.end();
+ }
}
@@ -132,10 +141,13 @@
//toto
}
- /**
+/*
+ */
+/**
* Used to allow nested requests (as done by the authenticator during unit tests) and
avoid
* to commit two times the same transaction.
- */
+ *//*
+
private ThreadLocal<AtomicInteger> currentRequestCount = new
ThreadLocal<AtomicInteger>()
{
@Override
@@ -144,37 +156,30 @@
return new AtomicInteger();
}
};
+*/
public void startRequest(ExoContainer container)
{
- AtomicInteger count = currentRequestCount.get();
- if (count.getAndIncrement() == 0)
+ try
{
- try
- {
- idmService_.getIdentitySession().beginTransaction();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ idmService_.getIdentitySession().beginTransaction();
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
public void endRequest(ExoContainer container)
{
- AtomicInteger count = currentRequestCount.get();
- if (count.decrementAndGet() == 0)
+ try
{
- try
- {
- idmService_.getIdentitySession().getTransaction().commit();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ idmService_.getIdentitySession().getTransaction().commit();
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
public String getGtnGroupType()
Modified:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.test.BasicTestCase;
import java.util.ArrayList;
@@ -92,7 +93,8 @@
mtHandler_ = service_.getMembershipTypeHandler();
membershipHandler_ = service_.getMembershipHandler();
- ((ComponentRequestLifecycle)service_).startRequest(manager);
+// ((ComponentRequestLifecycle)service_).startRequest(manager);
+ RequestLifeCycle.begin((ComponentRequestLifecycle)service_);
}
@@ -110,8 +112,8 @@
userHandler_.removeUser(userName, true);
}
- ((ComponentRequestLifecycle)service_).endRequest(manager);
-
+// ((ComponentRequestLifecycle)service_).endRequest(manager);
+ RequestLifeCycle.end();
}
public void testSimle() throws Exception
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -29,7 +29,6 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.config.ModelDemarcation;
import org.exoplatform.portal.pom.data.DashboardData;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
@@ -48,7 +47,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class DataStorageImpl implements DataStorage, ModelDemarcation
+public class DataStorageImpl implements DataStorage
{
/** . */
@@ -275,20 +274,4 @@
{
delegate.saveDashboard(dashboard.build());
}
-
- public void begin()
- {
- if (delegate instanceof ModelDemarcation)
- {
- ((ModelDemarcation)delegate).begin();
- }
- }
-
- public void end(boolean save)
- {
- if (delegate instanceof ModelDemarcation)
- {
- ((ModelDemarcation)delegate).end(save);
- }
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -40,111 +40,131 @@
public class GroupPortalConfigListener extends GroupEventListener
{
+ /** . */
+ private final UserPortalConfigService portalConfigService;
+
+ /** . */
+ private final DataStorage dataStorage;
+
+ /** . */
+ private final OrganizationService orgService;
+
+ public GroupPortalConfigListener(
+ UserPortalConfigService portalConfigService,
+ DataStorage dataStorage,
+ OrganizationService orgService)
+ {
+ this.portalConfigService = portalConfigService;
+ this.dataStorage = dataStorage;
+ this.orgService = orgService;
+ }
+
public void preDelete(Group group) throws Exception
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- UserPortalConfigService portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- String groupId = group.getId().trim();
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
+ {
+ String groupId = group.getId().trim();
- // Remove all descendant navigations
- removeGroupNavigation(group, portalConfigService);
-
- portalConfigService.removeUserPortalConfig(PortalConfig.GROUP_TYPE, groupId);
+ // Remove all descendant navigations
+ removeGroupNavigation(group, portalConfigService);
+
+ portalConfigService.removeUserPortalConfig(PortalConfig.GROUP_TYPE, groupId);
+ }
+ finally
+ {
+ RequestLifeCycle.end();
+ }
}
@Override
public void preSave(Group group, boolean isNew) throws Exception
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- /*
- * TODO Call start method on RegistryService to allow ecm, ultimate can
- * run with JDK6. This is uncommon behavior. We need find other way to fix
- * it I hope that this issues will be fixed when we use the lastest
- * version of PicoContainer Comment by Hoa Pham.
- */
- // RegistryService registryService =
(RegistryService)container.getComponentInstanceOfType(RegistryService.class);
- // registryService.start();
- UserPortalConfigService portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- String groupId = group.getId();
+ RequestLifeCycle.begin(PortalContainer.getInstance());
- // Bug in hibernate org service implementation
- if (groupId == null)
+ try
{
- groupId = "/" + group.getGroupName();
- }
- // Bug in JCR org service implementation
- if ("/administrators".equals(groupId))
- {
- groupId = "/platform/administrators";
- }
- else if ("/users".equals(groupId))
- {
- groupId = "/platform/users";
- }
- else if ("/guests".equals(groupId))
- {
- groupId = "/platform/guests";
- }
- else if ("/management".equals(groupId))
- {
- groupId = "/organization/management";
- }
- else if ("/executive-board".equals(groupId))
- {
- groupId = "/organization/management/executive-board";
- }
- else if ("/human-resources".equals(groupId))
- {
- groupId = "/organization/management/human-resources";
- }
- else if ("/communication".equals(groupId))
- {
- groupId = "/organization/communication";
- }
- else if ("/marketing".equals(groupId))
- {
- groupId = "/organization/communication/marketing";
- }
- else if ("/press-and-media".equals(groupId))
- {
- groupId = "/organization/communication/press-and-media";
- }
- else if ("/operations".equals(groupId))
- {
- groupId = "/organization/operations";
- }
- else if ("/sales".equals(groupId))
- {
- groupId = "/organization/operations/sales";
- }
- else if ("/finances".equals(groupId))
- {
- groupId = "/organization/operations/finances";
- }
+ String groupId = group.getId();
- // Create the portal from the template
- portalConfigService.createUserPortalConfig(PortalConfig.GROUP_TYPE, groupId,
"group");
+ // Bug in hibernate org service implementation
+ if (groupId == null)
+ {
+ groupId = "/" + group.getGroupName();
+ }
- // Need to insert the corresponding group site
- PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE, groupId);
- if (cfg == null)
+ // Bug in JCR org service implementation
+ if ("/administrators".equals(groupId))
+ {
+ groupId = "/platform/administrators";
+ }
+ else if ("/users".equals(groupId))
+ {
+ groupId = "/platform/users";
+ }
+ else if ("/guests".equals(groupId))
+ {
+ groupId = "/platform/guests";
+ }
+ else if ("/management".equals(groupId))
+ {
+ groupId = "/organization/management";
+ }
+ else if ("/executive-board".equals(groupId))
+ {
+ groupId = "/organization/management/executive-board";
+ }
+ else if ("/human-resources".equals(groupId))
+ {
+ groupId = "/organization/management/human-resources";
+ }
+ else if ("/communication".equals(groupId))
+ {
+ groupId = "/organization/communication";
+ }
+ else if ("/marketing".equals(groupId))
+ {
+ groupId = "/organization/communication/marketing";
+ }
+ else if ("/press-and-media".equals(groupId))
+ {
+ groupId = "/organization/communication/press-and-media";
+ }
+ else if ("/operations".equals(groupId))
+ {
+ groupId = "/organization/operations";
+ }
+ else if ("/sales".equals(groupId))
+ {
+ groupId = "/organization/operations/sales";
+ }
+ else if ("/finances".equals(groupId))
+ {
+ groupId = "/organization/operations/finances";
+ }
+
+ // Create the portal from the template
+ portalConfigService.createUserPortalConfig(PortalConfig.GROUP_TYPE, groupId,
"group");
+
+ // Need to insert the corresponding group site
+ PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE,
groupId);
+ if (cfg == null)
+ {
+ cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
+ cfg.setPortalLayout(new Container());
+ cfg.setName(groupId);
+ dataStorage.create(cfg);
+ }
+
+ }
+ finally
{
- cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
- cfg.setPortalLayout(new Container());
- cfg.setName(groupId);
- dataStorage.create(cfg);
+ RequestLifeCycle.end();
}
}
private void removeGroupNavigation(Group group, UserPortalConfigService
portalConfigService) throws Exception
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- OrganizationService orgService =
-
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
GroupHandler groupHandler = orgService.getGroupHandler();
Collection<String> descendantGroups = getDescendantGroups(group,
groupHandler);
PageNavigation navigation = null;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -36,54 +36,69 @@
public class UserPortalConfigListener extends UserEventListener
{
+ /** . */
+ private final UserPortalConfigService portalConfigService;
+
+ /** . */
+ private final DataStorage dataStorage;
+
+ public UserPortalConfigListener(
+ UserPortalConfigService portalConfigService,
+ DataStorage dataStorage)
+ {
+ this.portalConfigService = portalConfigService;
+ this.dataStorage = dataStorage;
+ }
+
public void preDelete(User user) throws Exception
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- UserPortalConfigService portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- String userName = user.getUserName();
- portalConfigService.removeUserPortalConfig("user", userName);
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
+ {
+ String userName = user.getUserName();
+ portalConfigService.removeUserPortalConfig("user", userName);
+ }
+ finally
+ {
+ RequestLifeCycle.end();
+ }
}
public void preSave(User user, boolean isNew) throws Exception
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- /*
- * TODO Call start method on RegistryService to allow ecm, ultimate can run
- * with JDK6. This is uncommon behavior. We need find other way to fix it I
- * hope that this issues will be fixed when we use the lastest version of
- * PicoContainer Comment by Hoa Pham.
- */
- // RegistryService registryService =
(RegistryService)container.getComponentInstanceOfType(RegistryService.class);
- // registryService.start();
- UserPortalConfigService portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- String userName = user.getUserName();
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
+ {
+ String userName = user.getUserName();
- // Create the portal from the template
- portalConfigService.createUserPortalConfig(PortalConfig.USER_TYPE, userName,
"user");
+ // Create the portal from the template
+ portalConfigService.createUserPortalConfig(PortalConfig.USER_TYPE, userName,
"user");
- // Need to insert the corresponding user site if needed
- PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.USER_TYPE, userName);
- if (cfg == null)
- {
- cfg = new PortalConfig(PortalConfig.USER_TYPE);
- cfg.setPortalLayout(new Container());
- cfg.setName(userName);
- dataStorage.create(cfg);
+ // Need to insert the corresponding user site if needed
+ PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.USER_TYPE,
userName);
+ if (cfg == null)
+ {
+ cfg = new PortalConfig(PortalConfig.USER_TYPE);
+ cfg.setPortalLayout(new Container());
+ cfg.setName(userName);
+ dataStorage.create(cfg);
+ }
+
+ // Create a blank navigation if needed
+ PageNavigation navigation =
dataStorage.getPageNavigation(PortalConfig.USER_TYPE, userName);
+ if (navigation == null)
+ {
+ PageNavigation pageNav = new PageNavigation();
+ pageNav.setOwnerType(PortalConfig.USER_TYPE);
+ pageNav.setOwnerId(userName);
+ pageNav.setPriority(5);
+ pageNav.setNodes(new ArrayList<PageNode>());
+ portalConfigService.create(pageNav);
+ }
}
-
- // Create a blank navigation if needed
- PageNavigation navigation = dataStorage.getPageNavigation(PortalConfig.USER_TYPE,
userName);
- if (navigation == null)
+ finally
{
- PageNavigation pageNav = new PageNavigation();
- pageNav.setOwnerType(PortalConfig.USER_TYPE);
- pageNav.setOwnerId(userName);
- pageNav.setPriority(5);
- pageNav.setNodes(new ArrayList<PageNode>());
- portalConfigService.create(pageNav);
+ RequestLifeCycle.end();
}
}
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -19,8 +19,11 @@
package org.exoplatform.portal.config;
+import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.pom.data.ModelChange;
@@ -30,7 +33,6 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.config.ModelDemarcation;
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -77,13 +79,17 @@
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- public UserPortalConfigService(UserACL userACL, DataStorage storage,
- OrganizationService orgService, ListenerService listenerService) throws Exception
+ private ChromatticManager manager;
+
+ public UserPortalConfigService(
+ UserACL userACL, DataStorage storage,
+ OrganizationService orgService, ListenerService listenerService, ChromatticManager
manager) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
this.listenerService = listenerService;
this.userACL_ = userACL;
+ this.manager = manager;
}
/**
@@ -636,29 +642,19 @@
return;
//
- if (storage_ instanceof ModelDemarcation)
- {
- ((ModelDemarcation)storage_).begin();
- }
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ //
newPortalConfigListener_.run();
}
catch (Exception e)
{
log.error("Could not import initial data", e);
- //
- if (storage_ instanceof ModelDemarcation)
- {
- ((ModelDemarcation)storage_).end(false);
- }
}
finally
{
- if (storage_ instanceof ModelDemarcation)
- {
- ((ModelDemarcation)storage_).end(true);
- }
+ RequestLifeCycle.end();
}
}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -1,32 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.portal.pom.config;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public interface ModelDemarcation
-{
-
- void begin();
-
- void end(boolean save);
-
-}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -63,7 +63,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class POMDataStorage implements ModelDataStorage, ModelDemarcation
+public class POMDataStorage implements ModelDataStorage
{
/** . */
@@ -314,14 +314,4 @@
generateStorageName(container);
return container;
}
-
- public void begin()
- {
- manager.beginRequest();
- }
-
- public void end(boolean save)
- {
- manager.endRequest(true);
- }
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -22,6 +22,8 @@
import org.chromattic.api.ChromatticSession;
import org.chromattic.api.UndeclaredRepositoryException;
import org.exoplatform.commons.chromattic.SessionContext;
+import org.exoplatform.commons.chromattic.SynchronizationListener;
+import org.exoplatform.commons.chromattic.SynchronizationStatus;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.pom.data.Mapper;
import org.gatein.mop.api.Model;
@@ -54,6 +56,15 @@
{
/** . */
+ private static final Map<ObjectType<?>, Class> mapping = new
HashMap<ObjectType<?>, Class>();
+
+ static
+ {
+ mapping.put(ObjectType.PAGE, PageImpl.class);
+ mapping.put(ObjectType.NAVIGATION, NavigationImpl.class);
+ }
+
+ /** . */
final POMSessionManager mgr;
/** . */
@@ -82,6 +93,10 @@
public POMSession(POMSessionManager mgr, MOPChromatticLifeCycle configurator,
SessionContext context)
{
+ // Register for cache eviction
+ context.addSynchronizationListener(listener);
+
+ //
this.mgr = mgr;
this.isInTask = false;
this.markedForRollback = false;
@@ -326,13 +341,22 @@
return session.createQueryBuilder().from(mappedClass).<O>
where(statement).get().objects();
}
- private static final Map<ObjectType<?>, Class> mapping = new
HashMap<ObjectType<?>, Class>();
-
- static
+ private final SynchronizationListener listener = new SynchronizationListener()
{
- mapping.put(ObjectType.PAGE, PageImpl.class);
- mapping.put(ObjectType.NAVIGATION, NavigationImpl.class);
- }
+ public void beforeSynchronization()
+ {
+ }
+ public void afterSynchronization(SynchronizationStatus status)
+ {
+ if (status == SynchronizationStatus.SAVED && staleKeys != null)
+ {
+ for (Serializable key : staleKeys)
+ {
+ mgr.cache.remove(key);
+ }
+ }
+ }
+ };
public void execute(POMTask task) throws Exception
{
@@ -394,21 +418,13 @@
save();
}
+ // Close model
if (model != null)
{
model.close();
}
//
- configurator.closeContext(context, save & markedForRollback);
-
- //
- if (staleKeys != null)
- {
- for (Serializable key : staleKeys)
- {
- mgr.cache.remove(key);
- }
- }
+ configurator.closeContext(save & markedForRollback);
}
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -42,12 +42,6 @@
private MOPService pomService;
/** . */
- final String repositoryName = "repository";
-
- /** . */
- final String workspaceName = "portal-system";
-
- /** . */
final ExoCache<Serializable, Object> cache;
/** . */
@@ -132,8 +126,7 @@
}
/**
- * <p>Execute the task with a session. The method attempts first to get a
current session and if no such session
- * is found then a session will be created for the scope of the method.</p>
+ * <p>Execute the task with a session.</p>
*
* @param task the task to execute
* @throws Exception any exception thrown by the task
@@ -141,24 +134,11 @@
public <T extends POMTask> T execute(T task) throws Exception
{
POMSession session = getSession();
- if (session == null)
- {
- session = openSession();
- try
- {
- executor.execute(session, task);
- }
- finally
- {
- session.close(true);
- }
- }
- else
- {
- executor.execute(session, task);
- }
//
+ executor.execute(session, task);
+
+ //
return task;
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -18,10 +18,12 @@
*/
package org.exoplatform.portal.config;
+import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.component.test.AbstractGateInTest;
import org.exoplatform.component.test.ConfigurationUnit;
import org.exoplatform.component.test.ConfiguredBy;
import org.exoplatform.component.test.ContainerScope;
+import org.exoplatform.container.PortalContainer;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -44,4 +46,29 @@
{
super(name);
}
+
+ @Override
+ protected void end()
+ {
+ end(false);
+ }
+
+ protected void end(boolean save)
+ {
+ PortalContainer container = getContainer();
+ ChromatticManager manager =
(ChromatticManager)container.getComponentInstanceOfType(ChromatticManager.class);
+ manager.getSynchronization().setSave(save);
+ super.end();
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ //
+ }
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -45,26 +45,21 @@
public void setUp() throws Exception
{
super.setUp();
- if (storage_ != null)
- return;
- PortalContainer container = PortalContainer.getInstance();
+ PortalContainer container = getContainer();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- session = mgr.openSession();
}
- protected void tearDown() throws Exception
+ public void testDirtyWrite() throws Exception
{
- session.close();
- }
+ begin();
+ session = mgr.openSession();
- public void testDirtyWrite() throws Exception
- {
// Read
Page page = storage_.getPage("portal::test::test4");
assertEquals(null, page.getTitle());
- // Update
+ // Update and save
page.setTitle("foo");
storage_.save(page);
@@ -81,9 +76,11 @@
{
try
{
+ begin();
mgr.openSession();
storage_.getPage("portal::test::test4");
session.close();
+ end();
}
catch (Exception e)
{
@@ -102,12 +99,19 @@
Thread.sleep(1);
}
+ // Save the cache should be invalidated
+ session.close();
+ end(true);
+
// Reopen session with no modifications that use the cache
- session.close(true);
+ begin();
mgr.openSession();
//
page = storage_.getPage("portal::test::test4");
assertEquals("foo", page.getTitle());
+
+ //
+ end();
}
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -42,8 +42,7 @@
public void setUp() throws Exception
{
super.setUp();
-
- //
+ begin();
PortalContainer container = PortalContainer.getInstance();
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
@@ -53,8 +52,8 @@
protected void tearDown() throws Exception
{
session.close(false);
- session = null;
- storage = null;
+ end();
+ super.tearDown();
}
public void testFoo()
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -52,14 +52,19 @@
public class TestDataStorage extends AbstractPortalTest
{
+ /** . */
private final String testPortal = "testPortal";
+ /** . */
private final String testPage = "portal::classic::testPage";
+ /** . */
private final String testPortletPreferences =
"portal#classic:/web/BannerPortlet/testPortletPreferences";
- DataStorage storage_;
+ /** . */
+ private DataStorage storage_;
+ /** . */
private POMSessionManager mgr;
/** . */
@@ -73,8 +78,7 @@
public void setUp() throws Exception
{
super.setUp();
- if (storage_ != null)
- return;
+ begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
@@ -84,6 +88,8 @@
protected void tearDown() throws Exception
{
session.close();
+ end();
+ super.tearDown();
}
public void testCreatePortal() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -46,9 +46,8 @@
public void setUp() throws Exception
{
super.setUp();
- if (storage_ != null)
- return;
- PortalContainer container = PortalContainer.getInstance();
+ begin();
+ PortalContainer container = getContainer();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
@@ -57,6 +56,8 @@
protected void tearDown() throws Exception
{
session.close();
+ end();
+ super.tearDown();
}
public void testBilto() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -66,11 +66,9 @@
public void setUp() throws Exception
{
super.setUp();
-
- //
- PortalContainer container = PortalContainer.getInstance();
- portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
+ begin();
+ PortalContainer container = getContainer();
+ portalConfigService =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
@@ -78,9 +76,9 @@
protected void tearDown() throws Exception
{
- session.close(false);
- session = null;
- storage = null;
+ session.close();
+ end();
+ super.tearDown();
}
public void testLegacyGroupWithNormalizedName() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestOrganization.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestOrganization.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestOrganization.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -21,12 +21,10 @@
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.component.ComponentRequestLifecycle;
import org.exoplatform.services.organization.GroupHandler;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserHandler;
-import org.exoplatform.test.BasicTestCase;
import java.util.Collection;
import java.util.List;
@@ -43,17 +41,17 @@
@Override
protected void setUp() throws Exception
{
- PortalContainer container = PortalContainer.getInstance();
+ super.setUp();
+ begin();
+ PortalContainer container = getContainer();
organizationService =
(OrganizationService)container.getComponentInstance(OrganizationService.class);
- ((ComponentRequestLifecycle)organizationService).startRequest(container);
}
@Override
protected void tearDown() throws Exception
{
- PortalContainer container = PortalContainer.getInstance();
- organizationService =
(OrganizationService)container.getComponentInstance(OrganizationService.class);
- ((ComponentRequestLifecycle)organizationService).endRequest(container);
+ end();
+ super.tearDown();
}
public void testFindGroups() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -21,6 +21,7 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -53,21 +54,19 @@
public void setUp() throws Exception
{
super.setUp();
-
+ begin();
PortalContainer container = PortalContainer.getInstance();
org =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
- ((ComponentRequestLifecycle)org).startRequest(container);
}
protected void tearDown() throws Exception
{
session.close();
- storage = null;
- PortalContainer container = PortalContainer.getInstance();
- ((ComponentRequestLifecycle)org).endRequest(container);
+ end();
+ super.tearDown();
}
public void testSiteLayout() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -53,9 +53,8 @@
public void setUp() throws Exception
{
super.setUp();
- if (storage_ != null)
- return;
- PortalContainer container = PortalContainer.getInstance();
+ begin();
+ PortalContainer container = getContainer();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
@@ -63,8 +62,9 @@
protected void tearDown() throws Exception
{
- session.close(false);
- session = null;
+ session.close();
+ end();
+ super.tearDown();
}
public void testSiteScopedPreferences() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -66,11 +66,9 @@
public void setUp() throws Exception
{
super.setUp();
-
- //
- PortalContainer container = PortalContainer.getInstance();
- portalConfigService =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
+ begin();
+ PortalContainer container = getContainer();
+ portalConfigService =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
@@ -79,7 +77,8 @@
protected void tearDown() throws Exception
{
session.close();
- storage = null;
+ end();
+ super.tearDown();
}
public void testNavigation() throws Exception
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -54,6 +54,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.CountDownLatch;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -111,9 +112,8 @@
}
};
- PortalContainer container = PortalContainer.getInstance();
- userPortalConfigSer_ =
-
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
+ PortalContainer container = getContainer();
+ userPortalConfigSer_ =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
orgService_ =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
authenticator =
(Authenticator)container.getComponentInstanceOfType(Authenticator.class);
@@ -165,7 +165,7 @@
assertEquals("classic", portalCfg.getName());
assertNotNull(userPortalCfg.getNavigations());
Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals(5, navigations.size());
+ assertEquals("expected to have 5 navigations instead of " +
navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
@@ -189,7 +189,7 @@
assertEquals("classic", portalCfg.getName());
assertNotNull(userPortalCfg.getNavigations());
Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals(5, navigations.size());
+ assertEquals("expected to have 5 navigations instead of " +
navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
@@ -249,7 +249,7 @@
{
UserPortalConfig userPortalCfg =
userPortalConfigSer_.getUserPortalConfig("classic", "root");
List<PageNavigation> navigations = userPortalCfg.getNavigations();
- assertEquals(5, navigations.size());
+ assertEquals("expected to have 5 navigations instead of " +
navigations, 5, navigations.size());
assertEquals("classic", navigations.get(0).getOwnerId()); // 1
assertEquals("/platform/administrators",
navigations.get(1).getOwnerId()); // 2
assertEquals("root", navigations.get(2).getOwnerId()); // 3
@@ -274,7 +274,7 @@
assertEquals("jazz", portalCfg.getName());
assertNotNull(userPortalCfg.getNavigations());
Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals(5, navigations.size());
+ assertEquals("expected to have 5 navigations instead of " +
navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::jazz"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
@@ -565,6 +565,7 @@
}.execute(null);
}
+/*
public void testCreateMultipleNavigations(){
for(int i =0; i < 10; i++){
createNavigation(null, "group", "/platform/administrators" +
i);
@@ -622,6 +623,7 @@
}
}.execute(user);
}
+*/
public void testUpdateNavigation()
{
@@ -833,6 +835,9 @@
Throwable failure = null;
//
+ begin();
+
+ //
ConversationState conversationState = null;
if (userId != null)
{
@@ -849,10 +854,6 @@
//
if (failure == null)
{
- // Clear cache
-// mgr.clearCache();
-
- //
mopSession = mgr.openSession();
if (failure == null)
{
@@ -870,8 +871,8 @@
finally
{
ConversationState.setCurrent(null);
- mopSession.close();
- mopSession = null;
+ mopSession.close(false);
+ end();
}
}
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestWSRP.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestWSRP.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestWSRP.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -47,11 +47,8 @@
public void setUp() throws Exception
{
super.setUp();
- if (storage_ != null)
- {
- return;
- }
- PortalContainer container = PortalContainer.getInstance();
+ begin();
+ PortalContainer container = getContainer();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
@@ -59,8 +56,9 @@
protected void tearDown() throws Exception
{
- session.close(false);
- session = null;
+ session.close();
+ end();
+ super.tearDown();
}
public void testBilto() throws Exception
Modified:
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractGateInTest.java
===================================================================
---
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractGateInTest.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractGateInTest.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -18,16 +18,12 @@
*/
package org.exoplatform.component.test;
-import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.EnumMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
/**
@@ -40,8 +36,12 @@
public abstract class AbstractGateInTest extends TestCase
{
+ /** . */
+ private PortalContainer container;
+
protected AbstractGateInTest()
{
+ super();
}
protected AbstractGateInTest(String name)
@@ -49,6 +49,21 @@
super(name);
}
+ public PortalContainer getContainer()
+ {
+ return container;
+ }
+
+ protected void begin()
+ {
+ RequestLifeCycle.begin(container);
+ }
+
+ protected void end()
+ {
+ RequestLifeCycle.end();
+ }
+
@Override
public void runBare() throws Throwable
{
@@ -78,9 +93,7 @@
}
//
- PortalContainer container = null;
- List<ComponentRequestLifecycle> componentRLFs = Collections.emptyList();
- List<Throwable> failures = new ArrayList<Throwable>();
+// List<Throwable> failures = new ArrayList<Throwable>();
//
try
@@ -91,40 +104,19 @@
// Boot the container
container = PortalContainer.getInstance();
- // Honours the request life cycle
- componentRLFs =
(List<ComponentRequestLifecycle>)container.getComponentInstancesOfType(ComponentRequestLifecycle.class);
-
- //
- for (ComponentRequestLifecycle componentRLF : componentRLFs)
- {
- componentRLF.startRequest(container);
- }
-
// Execute test
super.runBare();
}
finally
{
- if (container != null)
- {
- for (ComponentRequestLifecycle componentRLF : componentRLFs)
- {
- try
- {
- componentRLF.endRequest(container);
- }
- catch (Throwable e)
- {
- failures.add(e);
- }
- }
- }
+ container = null;
//
Thread.currentThread().setContextClassLoader(realClassLoader);
}
//
+/*
if (failures.size() > 0)
{
Throwable failure = failures.get(0);
@@ -132,5 +124,6 @@
afe.initCause(failure);
throw afe;
}
+*/
}
}
Modified:
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java
===================================================================
---
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -40,8 +40,12 @@
{
PortalContainer container = PortalContainer.getInstance();
CustomService testService =
(CustomService)container.getComponentInstanceOfType(CustomService.class);
+ assertNull(testService.currentContainer);
+ begin();
+ assertNotNull(testService);
assertSame(container, testService.currentContainer);
- assertNotNull(testService);
+ end();
+ assertNull(testService.currentContainer);
}
public void testDataSource() throws Exception
Modified:
portal/trunk/component/test/organization/src/test/java/org/exoplatform/component/test/organization/BootstrapTestCase.java
===================================================================
---
portal/trunk/component/test/organization/src/test/java/org/exoplatform/component/test/organization/BootstrapTestCase.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/test/organization/src/test/java/org/exoplatform/component/test/organization/BootstrapTestCase.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -52,6 +52,7 @@
OrganizationService organization =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
assertNotNull(organization);
+ begin();
User test = new UserImpl("testUser");
organization.getUserHandler().createUser(test, false);
@@ -59,6 +60,7 @@
assertNull(test);
test = organization.getUserHandler().findUserByName("testUser");
assertNotNull(test);
+ end();
}
}
\ No newline at end of file
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -22,6 +22,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.Application;
@@ -136,29 +137,14 @@
if (handler != null)
{
ExoContainer portalContainer = ExoContainerContext.getCurrentContainer();
- List<ComponentRequestLifecycle> components =
-
portalContainer.getComponentInstancesOfType(ComponentRequestLifecycle.class);
+ RequestLifeCycle.begin(portalContainer);
try
{
- for (ComponentRequestLifecycle component : components)
- {
- component.startRequest(portalContainer);
- }
handler.execute(this, req, res);
}
finally
{
- for (ComponentRequestLifecycle component : components)
- {
- try
- {
- component.endRequest(portalContainer);
- }
- catch (Exception e)
- {
- log.warn("An error occured while calling the endRequest
method", e);
- }
- }
+ RequestLifeCycle.end();
}
}
}
Modified:
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java
===================================================================
---
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -57,7 +57,8 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class ExoContainerConfig extends JsonContainerConfig
+public class
+ ExoContainerConfig extends JsonContainerConfig
{
/** . */
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2009-12-17 03:28:36 UTC (rev 1031)
+++ portal/trunk/pom.xml 2009-12-17 04:39:43 UTC (rev 1032)
@@ -37,10 +37,10 @@
<name>GateIn - Portal</name>
<properties>
-
<org.exoplatform.kernel.version>2.2.0-Beta04</org.exoplatform.kernel.version>
-
<org.exoplatform.core.version>2.3.0-Beta04</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.1.0-Beta04</org.exoplatform.ws.version>
-
<org.exoplatform.jcr.version>1.12.0-Beta04</org.exoplatform.jcr.version>
+
<org.exoplatform.kernel.version>2.2.0-Beta05</org.exoplatform.kernel.version>
+
<org.exoplatform.core.version>2.3.0-Beta05</org.exoplatform.core.version>
+ <org.exoplatform.ws.version>2.1.0-Beta05</org.exoplatform.ws.version>
+
<org.exoplatform.jcr.version>1.12.0-Beta05</org.exoplatform.jcr.version>
<org.jibx.version>1.2.1</org.jibx.version>
<org.shindig.version>SNAPSHOT-r790473</org.shindig.version>
<org.gatein.common.version>2.0.0-CR02</org.gatein.common.version>
@@ -53,7 +53,7 @@
<rhino.version>1.6R5</rhino.version>
<org.codehaus.groovy.version>1.6.5</org.codehaus.groovy.version>
<javax.servlet.version>2.5</javax.servlet.version>
- <version.chromattic>1.0.0-beta10</version.chromattic>
+ <version.chromattic>1.0.0-beta11</version.chromattic>
<version.reflect>1.0.0-beta4</version.reflect>
<!-- ************** -->
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/organization-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/organization-configuration.xml 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/organization-configuration.xml 2009-12-17
04:39:43 UTC (rev 1032)
@@ -311,6 +311,7 @@
<type>org.exoplatform.portal.config.GroupPortalConfigListener</type>
</component-plugin>
+<!--
<component-plugin>
<name>ecm.new.user.event.listener</name>
<set-method>addListenerPlugin</set-method>
@@ -359,5 +360,6 @@
</object-param>
</init-params>
</component-plugin>
+-->
</external-component-plugins>
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2009-12-17
03:28:36 UTC (rev 1031)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2009-12-17
04:39:43 UTC (rev 1032)
@@ -32,7 +32,6 @@
<state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>
<application-lifecycle-listeners>
-
<listener>org.exoplatform.portal.application.MOPSessionLifeCycle</listener>
<listener>org.exoplatform.portal.application.PortalStatisticLifecycle</listener>
<listener>org.exoplatform.portal.application.PortalApplicationLifecycle</listener>
<listener>org.exoplatform.webui.application.MonitorApplicationLifecycle</listener>
Deleted:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/MOPSessionLifeCycle.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/MOPSessionLifeCycle.java 2009-12-17
03:28:36 UTC (rev 1031)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/MOPSessionLifeCycle.java 2009-12-17
04:39:43 UTC (rev 1032)
@@ -1,62 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.portal.application;
-
-import org.exoplatform.commons.chromattic.ChromatticManager;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.web.application.Application;
-import org.exoplatform.web.application.ApplicationLifecycle;
-import org.exoplatform.webui.application.WebuiRequestContext;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class MOPSessionLifeCycle implements
ApplicationLifecycle<WebuiRequestContext>
-{
-
- /** . */
- private final ThreadLocal<ChromatticManager> currentMgr = new
ThreadLocal<ChromatticManager>();
-
- public void onInit(Application app) throws Exception
- {
- }
-
- public void onStartRequest(Application app, WebuiRequestContext context) throws
Exception
- {
- ExoContainer container =
context.getApplication().getApplicationServiceContainer();
- ChromatticManager mgr =
(ChromatticManager)container.getComponentInstanceOfType(ChromatticManager.class);
- mgr.beginRequest();
- currentMgr.set(mgr);
- }
-
- public void onEndRequest(Application app, WebuiRequestContext context) throws
Exception
- {
- ChromatticManager mgr = currentMgr.get();
- currentMgr.remove();
-
- // Need to see if saving untouched session has an impact or not on performances
- mgr.endRequest(true);
- }
-
- public void onDestroy(Application app) throws Exception
- {
- }
-}