Author: julien_viet
Date: 2009-12-02 04:09:05 -0500 (Wed, 02 Dec 2009)
New Revision: 900
Modified:
components/mop/trunk/core/pom.xml
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/support/TestMOPService.java
Log:
- change how the mop obtain its chromattic session for better integration within the
portal
- use "compile" scope for the APT plugin
Modified: components/mop/trunk/core/pom.xml
===================================================================
--- components/mop/trunk/core/pom.xml 2009-12-02 08:37:09 UTC (rev 899)
+++ components/mop/trunk/core/pom.xml 2009-12-02 09:09:05 UTC (rev 900)
@@ -67,6 +67,7 @@
<dependency>
<groupId>org.chromattic</groupId>
<artifactId>chromattic.apt</artifactId>
+ <scope>compile</scope>
</dependency>
<!--
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java 2009-12-02
08:37:09 UTC (rev 899)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java 2009-12-02
09:09:05 UTC (rev 900)
@@ -21,28 +21,6 @@
import org.chromattic.api.ChromatticBuilder;
import org.chromattic.api.Chromattic;
import org.chromattic.api.ChromatticSession;
-import org.gatein.mop.core.api.workspace.WorkspaceImpl;
-import org.gatein.mop.core.api.workspace.UIContainerImpl;
-import org.gatein.mop.core.api.workspace.UIWindowImpl;
-import org.gatein.mop.core.api.workspace.UIBodyImpl;
-import org.gatein.mop.core.api.workspace.PageImpl;
-import org.gatein.mop.core.api.workspace.NavigationImpl;
-import org.gatein.mop.core.api.workspace.PageLinkImpl;
-import org.gatein.mop.core.api.workspace.URLLinkImpl;
-import org.gatein.mop.core.api.workspace.PortalSiteContainer;
-import org.gatein.mop.core.api.workspace.PortalSite;
-import org.gatein.mop.core.api.workspace.GroupSiteContainer;
-import org.gatein.mop.core.api.workspace.GroupSite;
-import org.gatein.mop.core.api.workspace.PageContainer;
-import org.gatein.mop.core.api.workspace.NavigationContainer;
-import org.gatein.mop.core.api.workspace.UserSiteContainer;
-import org.gatein.mop.core.api.workspace.UserSite;
-import org.gatein.mop.core.api.workspace.content.CustomizationContainer;
-import org.gatein.mop.core.api.workspace.content.ContextType;
-import org.gatein.mop.core.api.workspace.content.ContextTypeContainer;
-import org.gatein.mop.core.api.workspace.content.ContextSpecialization;
-import org.gatein.mop.core.api.workspace.content.WorkspaceClone;
-import org.gatein.mop.core.api.workspace.content.WorkspaceSpecialization;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.core.api.content.CustomizationContextProviderRegistry;
@@ -50,29 +28,34 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class MOPService
+public abstract class MOPService
{
/** . */
- private Chromattic chrome;
-
- /** . */
private ContentManagerRegistry contentManagerRegistry;
/** . */
private CustomizationContextProviderRegistry customizationContextResolvers;
- /** . */
- private final ChromatticBuilder builder;
-
public MOPService()
{
- ChromatticBuilder builder = ChromatticBuilder.create();
- builder.setOption(ChromatticBuilder.INSTRUMENTOR_CLASSNAME,
"org.chromattic.apt.InstrumentorImpl");
-// builder.setOption(ChromatticBuilder.OBJECT_FORMATTER_CLASSNAME,
MOPFormatter.class.getName());
+ this(ChromatticBuilder.create());
+ }
+ /**
+ * Build a mop service with a chromattic builder.
+ *
+ * @param builder the builder
+ * @throws NullPointerException if the builder is null
+ */
+ public MOPService(ChromatticBuilder builder) throws NullPointerException
+ {
+ if (builder == null)
+ {
+ throw new NullPointerException();
+ }
+
//
- this.builder = builder;
}
public CustomizationContextProviderRegistry getCustomizationContextResolvers()
@@ -90,50 +73,15 @@
//
}
- protected void configure(ChromatticBuilder builder)
- {
- //
- }
-
protected void configure(ContentManagerRegistry registry)
{
//
}
+ protected abstract Chromattic getChromattic();
+
public void start() throws Exception
{
- builder.add(WorkspaceImpl.class);
- builder.add(UIContainerImpl.class);
- builder.add(UIWindowImpl.class);
- builder.add(UIBodyImpl.class);
- builder.add(PageImpl.class);
- builder.add(PageContainer.class);
- builder.add(NavigationImpl.class);
- builder.add(NavigationContainer.class);
- builder.add(PageLinkImpl.class);
- builder.add(URLLinkImpl.class);
- builder.add(PortalSiteContainer.class);
- builder.add(PortalSite.class);
- builder.add(GroupSiteContainer.class);
- builder.add(GroupSite.class);
- builder.add(UserSiteContainer.class);
- builder.add(UserSite.class);
-
- //
- builder.add(CustomizationContainer.class);
- builder.add(ContextTypeContainer.class);
- builder.add(ContextType.class);
- builder.add(ContextSpecialization.class);
- builder.add(WorkspaceClone.class);
- builder.add(WorkspaceSpecialization.class);
-
- //
- configure(builder);
-
- //
- chrome = builder.build();
-
- //
CustomizationContextProviderRegistry customizationContextResolvers = new
CustomizationContextProviderRegistry();
//
@@ -146,14 +94,14 @@
configure(cmr);
//
- this.chrome = builder.build();
this.contentManagerRegistry = cmr;
this.customizationContextResolvers = customizationContextResolvers;
}
public ModelImpl getModel()
{
- ChromatticSession chromeSession = chrome.openSession();
+ Chromattic chromattic = getChromattic();
+ ChromatticSession chromeSession = chromattic.openSession();
return new ModelImpl(
chromeSession,
contentManagerRegistry,
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/support/TestMOPService.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/support/TestMOPService.java 2009-12-02
08:37:09 UTC (rev 899)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/support/TestMOPService.java 2009-12-02
09:09:05 UTC (rev 900)
@@ -18,9 +18,32 @@
*/
package org.gatein.mop.core.support;
+import org.chromattic.api.Chromattic;
import org.chromattic.api.ChromatticBuilder;
import org.gatein.mop.core.api.MOPService;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
+import org.gatein.mop.core.api.workspace.GroupSite;
+import org.gatein.mop.core.api.workspace.GroupSiteContainer;
+import org.gatein.mop.core.api.workspace.NavigationContainer;
+import org.gatein.mop.core.api.workspace.NavigationImpl;
+import org.gatein.mop.core.api.workspace.PageContainer;
+import org.gatein.mop.core.api.workspace.PageImpl;
+import org.gatein.mop.core.api.workspace.PageLinkImpl;
+import org.gatein.mop.core.api.workspace.PortalSite;
+import org.gatein.mop.core.api.workspace.PortalSiteContainer;
+import org.gatein.mop.core.api.workspace.UIBodyImpl;
+import org.gatein.mop.core.api.workspace.UIContainerImpl;
+import org.gatein.mop.core.api.workspace.UIWindowImpl;
+import org.gatein.mop.core.api.workspace.URLLinkImpl;
+import org.gatein.mop.core.api.workspace.UserSite;
+import org.gatein.mop.core.api.workspace.UserSiteContainer;
+import org.gatein.mop.core.api.workspace.WorkspaceImpl;
+import org.gatein.mop.core.api.workspace.content.ContextSpecialization;
+import org.gatein.mop.core.api.workspace.content.ContextType;
+import org.gatein.mop.core.api.workspace.content.ContextTypeContainer;
+import org.gatein.mop.core.api.workspace.content.CustomizationContainer;
+import org.gatein.mop.core.api.workspace.content.WorkspaceClone;
+import org.gatein.mop.core.api.workspace.content.WorkspaceSpecialization;
import org.gatein.mop.core.support.content.gadget.Gadget;
import org.gatein.mop.core.support.content.gadget.GadgetContentProvider;
import org.gatein.mop.core.support.content.gadget.GadgetState;
@@ -36,17 +59,60 @@
public class TestMOPService extends MOPService
{
- @Override
- protected void configure(ChromatticBuilder builder)
+ /** . */
+ private final Chromattic chromattic;
+
+ public TestMOPService() throws Exception
{
+ ChromatticBuilder builder = ChromatticBuilder.create();
+
+ //
+ builder.setOption(ChromatticBuilder.INSTRUMENTOR_CLASSNAME,
"org.chromattic.apt.InstrumentorImpl");
+
+ //
+ builder.add(WorkspaceImpl.class);
+ builder.add(UIContainerImpl.class);
+ builder.add(UIWindowImpl.class);
+ builder.add(UIBodyImpl.class);
+ builder.add(PageImpl.class);
+ builder.add(PageContainer.class);
+ builder.add(NavigationImpl.class);
+ builder.add(NavigationContainer.class);
+ builder.add(PageLinkImpl.class);
+ builder.add(URLLinkImpl.class);
+ builder.add(PortalSiteContainer.class);
+ builder.add(PortalSite.class);
+ builder.add(GroupSiteContainer.class);
+ builder.add(GroupSite.class);
+ builder.add(UserSiteContainer.class);
+ builder.add(UserSite.class);
+
+ //
+ builder.add(CustomizationContainer.class);
+ builder.add(ContextTypeContainer.class);
+ builder.add(ContextType.class);
+ builder.add(ContextSpecialization.class);
+ builder.add(WorkspaceClone.class);
+ builder.add(WorkspaceSpecialization.class);
+
+ //
builder.add(PortletPreferencesState.class);
builder.add(PortletPreferenceState.class);
//
builder.add(GadgetState.class);
+
+ //
+ this.chromattic = builder.build();
}
@Override
+ protected Chromattic getChromattic()
+ {
+ return chromattic;
+ }
+
+ @Override
protected void configure(ContentManagerRegistry registry)
{
registry.register(Preferences.CONTENT_TYPE, new PortletContentProvider());
Show replies by date