gatein SVN: r186 - in components/mop/trunk: api and 2 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-09-13 15:18:19 -0400 (Sun, 13 Sep 2009)
New Revision: 186
Modified:
components/mop/trunk/api/pom.xml
components/mop/trunk/core/pom.xml
components/mop/trunk/pom.xml
components/mop/trunk/spi/pom.xml
Log:
[maven-release-plugin] prepare release 1.0.0-Beta06
Modified: components/mop/trunk/api/pom.xml
===================================================================
--- components/mop/trunk/api/pom.xml 2009-09-13 19:12:42 UTC (rev 185)
+++ components/mop/trunk/api/pom.xml 2009-09-13 19:18:19 UTC (rev 186)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/core/pom.xml
===================================================================
--- components/mop/trunk/core/pom.xml 2009-09-13 19:12:42 UTC (rev 185)
+++ components/mop/trunk/core/pom.xml 2009-09-13 19:18:19 UTC (rev 186)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/pom.xml
===================================================================
--- components/mop/trunk/pom.xml 2009-09-13 19:12:42 UTC (rev 185)
+++ components/mop/trunk/pom.xml 2009-09-13 19:18:19 UTC (rev 186)
@@ -34,7 +34,7 @@
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
<packaging>pom</packaging>
<name>MOP</name>
@@ -54,9 +54,9 @@
</licenses>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/trunk/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/mop/trunk/</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/tags/1.0.0-B...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/tags/1.0.0-Beta06</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/mop/tags/1.0.0-Beta06</url>
</scm>
<!-- Required to download Parent -->
@@ -92,12 +92,12 @@
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-api</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
</dependency>
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-spi</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
</dependency>
<!-- External dependencies -->
<dependency>
Modified: components/mop/trunk/spi/pom.xml
===================================================================
--- components/mop/trunk/spi/pom.xml 2009-09-13 19:12:42 UTC (rev 185)
+++ components/mop/trunk/spi/pom.xml 2009-09-13 19:18:19 UTC (rev 186)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta06</version>
</parent>
<!-- ****************** -->
15 years, 3 months
gatein SVN: r185 - components/mop/trunk.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-09-13 15:12:42 -0400 (Sun, 13 Sep 2009)
New Revision: 185
Modified:
components/mop/trunk/pom.xml
Log:
remove javadoc generation in the release profile - too long & not really useful
Modified: components/mop/trunk/pom.xml
===================================================================
--- components/mop/trunk/pom.xml 2009-09-13 19:05:47 UTC (rev 184)
+++ components/mop/trunk/pom.xml 2009-09-13 19:12:42 UTC (rev 185)
@@ -367,18 +367,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.jvnet</groupId>
<artifactId>animal-sniffer</artifactId>
<version>1.2</version>
15 years, 3 months
gatein SVN: r184 - in components/mop/trunk: api/src/main/java/org/gatein/mop/api/workspace and 3 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-09-13 15:05:47 -0400 (Sun, 13 Sep 2009)
New Revision: 184
Added:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/QueryTestCase.java
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/Model.java
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/ObjectType.java
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Workspace.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceImpl.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/WorkspaceTestCase.java
Log:
added proper unit test for querying
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/Model.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/Model.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/Model.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -19,9 +19,13 @@
package org.gatein.mop.api;
import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+import org.gatein.mop.api.workspace.ObjectType;
+import java.util.Iterator;
+
/**
- * Provides access to the model.
+ * Provides access to the model.
*
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -35,4 +39,24 @@
*/
Workspace getWorkspace();
+ /**
+ * Returns a specified object or null if it cannot be found.
+ *
+ * @param type the object type
+ * @param id the object id
+ * @param <O> the object type parameter
+ * @return the object
+ */
+ <O extends WorkspaceObject> O findObjectById(ObjectType<O> type, String id);
+
+ <O extends WorkspaceObject> O findObjectByPath(ObjectType<? extends O> type, String path);
+
+ <O extends WorkspaceObject> Iterator<O> findObject(ObjectType<O> type, String statement);
+
+ String pathOf(WorkspaceObject o);
+
+ void save();
+
+ void close();
+
}
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/ObjectType.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/ObjectType.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/ObjectType.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -61,15 +61,6 @@
public static final ObjectType<Page> PAGE = new ObjectType<Page>(Page.class);
/** . */
- public static final ObjectType<Page> TEMPLATE = new ObjectType<Page>(Page.class, PAGE);
-
- /** . */
- public static final ObjectType<Page> CONFIGURATION = new ObjectType<Page>(Page.class, PAGE);
-
- /** . */
- public static final ObjectType<Page> CONTENT = new ObjectType<Page>(Page.class, PAGE);
-
- /** . */
public static final ObjectType<Navigation> NAVIGATION = new ObjectType<Navigation>(Navigation.class);
/** . */
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Workspace.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Workspace.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Workspace.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -68,13 +68,4 @@
*/
<S extends Site> S addSite(ObjectType<S> siteType, String name);
- /**
- * Returns a specified object or null if it cannot be found.
- *
- * @param type the object type
- * @param id the object id
- * @param <O> the object type parameter
- * @return the object
- */
- <O extends WorkspaceObject> O getObject(ObjectType<O> type, String id);
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -22,6 +22,20 @@
import org.gatein.mop.core.api.content.CustomizationContextProviderRegistry;
import org.gatein.mop.core.api.content.CustomizationContextResolver;
import org.gatein.mop.core.api.workspace.WorkspaceImpl;
+import org.gatein.mop.core.api.workspace.SiteImpl;
+import org.gatein.mop.core.api.workspace.PortalSite;
+import org.gatein.mop.core.api.workspace.GroupSite;
+import org.gatein.mop.core.api.workspace.UserSite;
+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.WorkspaceObjectImpl;
+import org.gatein.mop.core.api.workspace.SharedSite;
+import org.gatein.mop.core.api.workspace.UIComponentImpl;
+import org.gatein.mop.core.api.workspace.PageLinkImpl;
+import org.gatein.mop.core.api.workspace.URLLinkImpl;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
import org.gatein.mop.core.api.workspace.content.ContextSpecialization;
import org.gatein.mop.core.api.workspace.content.AbstractCustomization;
@@ -34,6 +48,8 @@
import org.chromattic.api.event.LifeCycleListener;
import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -42,6 +58,29 @@
public class ModelImpl implements Model {
/** . */
+ private static final Map<ObjectType<?>, Class<? extends WorkspaceObjectImpl>> typeToClassImpl;
+
+ static {
+ Map<ObjectType<?>, Class<? extends WorkspaceObjectImpl>> tmp = new HashMap<ObjectType<?>, Class<? extends WorkspaceObjectImpl>>();
+ tmp.put(ObjectType.ANY, WorkspaceObjectImpl.class);
+ tmp.put(ObjectType.WORKSPACE, WorkspaceImpl.class);
+ tmp.put(ObjectType.SITE, SiteImpl.class);
+ tmp.put(ObjectType.PORTAL_SITE, PortalSite.class);
+ tmp.put(ObjectType.GROUP_SITE, GroupSite.class);
+ tmp.put(ObjectType.USER_SITE, UserSite.class);
+ tmp.put(ObjectType.SHARED_SITE, SharedSite.class);
+ tmp.put(ObjectType.PAGE, PageImpl.class);
+ tmp.put(ObjectType.NAVIGATION, NavigationImpl.class);
+ tmp.put(ObjectType.COMPONENT, UIComponentImpl.class);
+ tmp.put(ObjectType.BODY, UIBodyImpl.class);
+ tmp.put(ObjectType.CONTAINER, UIContainerImpl.class);
+ tmp.put(ObjectType.WINDOW, UIWindowImpl.class);
+ tmp.put(ObjectType.PAGE_LINK, PageLinkImpl.class);
+ tmp.put(ObjectType.URL_LINK, URLLinkImpl.class);
+ typeToClassImpl = tmp;
+ }
+
+ /** . */
private final ChromatticSession session;
/** . */
@@ -57,7 +96,7 @@
private final CustomizationContextResolver customizationContextResolver = new CustomizationContextResolver() {
public CustomizationContext resolve(String contextType, String contextId) {
if (WorkspaceCustomizationContext.TYPE.equals(contextType)) {
- return getWorkspace().getObject(ObjectType.WINDOW, contextId);
+ return findObjectById(ObjectType.WINDOW, contextId);
} else {
return customizationContextResolvers.resolve(contextType, contextId);
}
@@ -112,14 +151,15 @@
};
public <O extends WorkspaceObject> Iterator<O> findObject(ObjectType<O> type, String statement) {
- return session.createQueryBuilder().from(type.getJavaType()).<O>where(statement).get().iterator();
+ Class<? extends WorkspaceObjectImpl> impl = typeToClassImpl.get(type);
+ return session.createQueryBuilder().from(impl).<O>where(statement).get().iterator();
}
- public String getPath(WorkspaceObject o) {
+ public String pathOf(WorkspaceObject o) {
return session.getPath(o);
}
- public <O extends WorkspaceObject> O getObject(ObjectType<? extends O> type, String path) {
+ public <O extends WorkspaceObject> O findObjectByPath(ObjectType<? extends O> type, String path) {
Class<? extends O> t = type.getJavaType();
return session.findByPath(t, path);
}
@@ -132,4 +172,14 @@
((ContextSpecialization)o).setCustomizationContextResolver(customizationContextResolver);
}
}
+
+ public <O extends WorkspaceObject> O findObjectById(ObjectType<O> type, String id) {
+ Class<? extends WorkspaceObjectImpl> impl = typeToClassImpl.get(type);
+ WorkspaceObjectImpl object = session.findById(impl, id);
+ if (object != null) {
+ return type.cast(object);
+ } else {
+ return null;
+ }
+ }
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceImpl.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceImpl.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -70,9 +70,6 @@
// CustomizationContextResolver implementation ***********************************************************************
@FindById
- public abstract WorkspaceObject getObject(String objectId);
-
- @FindById
public abstract CustomizationContext resolveContext(String contextId);
// WorkspaceCustomizationContext implementation **********************************************************************
@@ -137,15 +134,6 @@
return sites.addSite(name);
}
- public <O extends WorkspaceObject> O getObject(ObjectType<O> type, String id) {
- WorkspaceObject object = getObject(id);
- if (object != null) {
- return type.cast(object);
- } else {
- return null;
- }
- }
-
public Site getSharedSite() {
return getSite(ObjectType.SHARED_SITE, "default");
}
Added: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/QueryTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/QueryTestCase.java (rev 0)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/QueryTestCase.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.gatein.mop.core.api.workspace;
+
+import org.gatein.mop.core.api.AbstractPOMTestCase;
+import org.gatein.mop.core.api.ModelImpl;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class QueryTestCase extends AbstractPOMTestCase {
+
+ public void testFoo() {
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
+ Site site = workspace.addSite(ObjectType.PORTAL_SITE, "foo");
+ model.save();
+ Iterator<Site> sites = model.findObject(ObjectType.PORTAL_SITE, "jcr:path='" + model.pathOf(site) + "'");
+ assertTrue(sites.hasNext());
+ assertSame(site, sites.next());
+ assertFalse(sites.hasNext());
+ }
+}
Modified: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/WorkspaceTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/WorkspaceTestCase.java 2009-09-13 18:24:06 UTC (rev 183)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/WorkspaceTestCase.java 2009-09-13 19:05:47 UTC (rev 184)
@@ -40,19 +40,21 @@
public class WorkspaceTestCase extends AbstractPOMTestCase {
public void testGetSite() {
- Workspace workspace = pomService.getModel().getWorkspace();
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
Site site = workspace.addSite(ObjectType.GROUP_SITE, "site");
assertNotNull(site);
- Site s2 = workspace.getObject(ObjectType.SITE, site.getObjectId());
+ Site s2 = model.findObjectById(ObjectType.SITE, site.getObjectId());
assertEquals(site, s2);
assertEquals(workspace, site.getWorkspace());
}
public void testGetPortal() {
- Workspace workspace = pomService.getModel().getWorkspace();
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
assertNotNull(portal);
- Site s2 = workspace.getObject(ObjectType.SITE, portal.getObjectId());
+ Site s2 = model.findObjectById(ObjectType.SITE, portal.getObjectId());
assertEquals(portal, s2);
}
15 years, 3 months
gatein SVN: r183 - in components/mop/trunk: core/src/main/java/org/gatein/mop/core/api/workspace/content and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-09-13 14:24:06 -0400 (Sun, 13 Sep 2009)
New Revision: 183
Removed:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/customization/
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java
Log:
remove a bunch of features that should not be specified here but rather at the portal level (so reduce a bit the initial scope)
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java 2009-09-13 17:34:26 UTC (rev 182)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java 2009-09-13 18:24:06 UTC (rev 183)
@@ -18,8 +18,6 @@
*/
package org.gatein.mop.api.content;
-import org.gatein.mop.api.content.customization.CustomizationMode;
-
import java.util.Set;
import java.util.Collection;
@@ -85,7 +83,7 @@
* @param contexts the customization context
* @return the customization
*/
- Customization<S> customize(CustomizationMode mode, Collection<CustomizationContext> contexts);
+ Customization<S> customize(Collection<CustomizationContext> contexts);
/**
* Returns the customization cascaded state.
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-09-13 17:34:26 UTC (rev 182)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-09-13 18:24:06 UTC (rev 183)
@@ -21,7 +21,6 @@
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.ContentType;
-import org.gatein.mop.api.content.customization.CustomizationMode;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
import org.gatein.mop.core.api.content.CustomizationContextComparator;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
@@ -146,16 +145,10 @@
return get(contexts, false);
}
- public Customization<Object> customize(CustomizationMode mode, Collection<CustomizationContext> contexts) {
- if (mode == null) {
- throw new NullPointerException();
- }
+ public Customization<Object> customize(Collection<CustomizationContext> contexts) {
if (contexts == null) {
throw new NullPointerException();
}
- if (mode == CustomizationMode.CLONE) {
- throw new UnsupportedOperationException("todo : support cloning");
- }
return get(contexts, true);
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java 2009-09-13 17:34:26 UTC (rev 182)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java 2009-09-13 18:24:06 UTC (rev 183)
@@ -101,7 +101,7 @@
}
if (obj instanceof Preference) {
Preference that = (Preference)obj;
- return this.name.equals(that.name) && this.getValues().equals(that.getValues()) && this.readOnly == that.isReadOnly();
+ return this.name.equals(that.name) && this.getValues().equals(that.getValues());
}
return false;
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java 2009-09-13 17:34:26 UTC (rev 182)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java 2009-09-13 18:24:06 UTC (rev 183)
@@ -86,7 +86,7 @@
} else {
entry = new Preference(entry.getName(), value, entry.isReadOnly());
}
- entries.put(name, entry);
+ state.put(name, entry);
return this;
}
@@ -101,7 +101,7 @@
throw new IllegalStateException();
}
entry = new Preference(entry.getName(), entry.getValues(), readOnly);
- entries.put(name, entry);
+ state.put(name, entry);
return this;
}
@@ -110,7 +110,7 @@
}
public Preferences putPreference(Preference preference) {
- entries.put(preference.getName(), preference);
+ state.put(preference.getName(), preference);
return this;
}
15 years, 3 months
gatein SVN: r182 - components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-09-13 13:34:26 -0400 (Sun, 13 Sep 2009)
New Revision: 182
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
Log:
more virtual state
Modified: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2009-09-13 12:21:54 UTC (rev 181)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2009-09-13 17:34:26 UTC (rev 182)
@@ -50,14 +50,25 @@
/** . */
private final Preferences parisFarenheit = new PreferencesBuilder().add("city", "paris").add("temperature", "farenheit").build();
- public void testCustomizationBlending() {
+ public void testVirtualCustomization() {
Workspace workspace = pomService.getModel().getWorkspace();
Customization<Preferences> customization1 = workspace.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> customization2 = workspace.customize("paris", customization1);
+
+ //
customization2.setState(paris);
assertEquals(paris, customization2.getState());
assertEquals(parisCelsius, customization2.getVirtualState());
-// customization1.setState(customization1.getState().setReadOnly("temperature", true));
+
+ //
+ customization2.setState(parisFarenheit);
+ assertEquals(parisFarenheit, customization2.getState());
+ assertEquals(parisFarenheit, customization2.getVirtualState());
+
+ //
+ customization1.setState(customization1.getState().setReadOnly("temperature", true));
+ assertEquals(parisFarenheit, customization2.getState());
+ assertEquals(parisCelsius, customization2.getVirtualState());
}
public void testCustomizeWorkspace() {
15 years, 3 months
gatein SVN: r181 - in components/mop/trunk: core/src/main/java/org/gatein/mop/core/api and 5 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-09-13 08:21:54 -0400 (Sun, 13 Sep 2009)
New Revision: 181
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceClone.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceSpecialization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/portlet/PortletPreferencesState.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/impl/portlet/PortletContentProvider.java
Log:
start to support virtual customization state
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/Customization.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -88,6 +88,13 @@
Customization<S> customize(CustomizationMode mode, Collection<CustomizationContext> contexts);
/**
+ * Returns the customization cascaded state.
+ *
+ * @return the cascaded state
+ */
+ S getVirtualState();
+
+ /**
* Returns the customization state.
*
* @return the state
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -24,7 +24,7 @@
import org.gatein.mop.core.api.workspace.WorkspaceImpl;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
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.AbstractCustomization;
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.workspace.Workspace;
import org.gatein.mop.api.workspace.ObjectType;
@@ -125,10 +125,11 @@
}
private void inject(Object o, boolean persistent) {
+ if (o instanceof AbstractCustomization && persistent) {
+ ((AbstractCustomization)o).registry = contentManagers;
+ }
if (o instanceof ContextSpecialization) {
- ((ContextSpecialization)o).setCustomizationContextResolver(customizationContextResolver);
- } else if (o instanceof WorkspaceClone && persistent) {
- ((WorkspaceClone)o).registry = contentManagers;
+ ((ContextSpecialization)o).setCustomizationContextResolver(customizationContextResolver);
}
}
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -20,10 +20,13 @@
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.CustomizationContext;
+import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.customization.CustomizationMode;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
import org.gatein.mop.core.api.content.CustomizationContextComparator;
+import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.core.api.workspace.content.portlet.PortletPreferencesState;
+import org.gatein.mop.spi.content.ContentProvider;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.MappedBy;
import org.chromattic.api.annotations.Create;
@@ -34,6 +37,7 @@
import java.util.TreeSet;
import java.util.Map;
import java.util.LinkedHashSet;
+import java.util.Arrays;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -53,6 +57,9 @@
comparator = _comparator;
}
+ /** . */
+ public ContentManagerRegistry registry;
+
@OneToOne
@MappedBy("state")
public abstract CustomizationState getContentState();
@@ -76,21 +83,42 @@
public abstract AbstractCustomization getParentCustomization();
+ public Object getVirtualState() {
+ Object childPayload = null;
+ CustomizationState state = getContentState();
+ if (state != null) {
+ childPayload = state.getPayload();
+ }
+ //
+ Object parentPayload = null;
+ AbstractCustomization parent = getParentCustomization();
+ if (parent != null) {
+ parentPayload = parent.getVirtualState();
+ }
+
+ //
+ if (parentPayload != null) {
+ if (childPayload != null) {
+ ContentType contentType = getType();
+ String mimeType = contentType.getMimeType();
+ ContentProvider contentProvider = registry.providers.get(mimeType).getProvider();
+ return contentProvider.combine(Arrays.asList(parentPayload, childPayload));
+ } else {
+ return parentPayload;
+ }
+ } else {
+ return childPayload;
+ }
+ }
+
public Object getState() {
-
CustomizationState state = getContentState();
if (state != null) {
- return getContentState().getPayload();
+ return state.getPayload();
} else {
- AbstractCustomization parent = getParentCustomization();
- if (parent != null) {
- return parent.getState();
- } else {
- return null;
- }
+ return null;
}
-
}
public void setState(Object state) {
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceClone.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceClone.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceClone.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -27,7 +27,6 @@
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
-import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.core.api.content.ContentRegistration;
import java.util.Set;
@@ -42,8 +41,6 @@
@NodeMapping(name = "mop:workspaceclone")
public abstract class WorkspaceClone extends WorkspaceCustomization {
- public ContentManagerRegistry registry;
-
public Set<CustomizationContext> getContexts() {
return Collections.emptySet();
}
@@ -87,10 +84,8 @@
//
for (WorkspaceSpecialization specialization : specializations) {
- // Compute flat state
- Object state = specialization.getState();
-
- // Update with flat state
+ // Update the specialization with its virtual state
+ Object state = specialization.getVirtualState();
specialization.setState(state);
// Clear ref
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceSpecialization.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceSpecialization.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/WorkspaceSpecialization.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -37,6 +37,10 @@
public abstract void setCustomization(WorkspaceCustomization customization);
+ public void destroy() {
+ doDestroy();
+ }
+
public String getName() {
AbstractCustomization parent = getParentCustomization();
if (parent == null) {
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/portlet/PortletPreferencesState.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/portlet/PortletPreferencesState.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/portlet/PortletPreferencesState.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -52,7 +52,7 @@
Map<String, PortletPreferenceState> entries = getChildren();
entries.clear();
- for (Preference pref : payload.getEntries()) {
+ for (Preference pref : payload) {
PortletPreferenceState prefState = create();
entries.put(pref.getName(), prefState);
prefState.setValue(pref.getValues());
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preference.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -23,6 +23,8 @@
import java.util.ArrayList;
/**
+ * An immutable preference.
+ *
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
@@ -80,6 +82,10 @@
return name;
}
+ public String getValue() {
+ return values.get(0);
+ }
+
public List<String> getValues() {
return values;
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/content/portlet/Preferences.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -20,10 +20,11 @@
import org.gatein.mop.api.content.ContentType;
-import java.util.Collection;
import java.util.Map;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
+import java.util.Iterator;
/**
* A set of preferences.
@@ -31,7 +32,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public final class Preferences {
+public final class Preferences implements Iterable<Preference> {
/** . */
public static final ContentType<Preferences> CONTENT_TYPE = new ContentType<Preferences>("application/portlet", Preferences.class);
@@ -57,10 +58,66 @@
this.entries = Collections.unmodifiableMap(this.state);
}
- public Collection<Preference> getEntries() {
- return entries.values();
+ public List<String> getValues(String name) {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.getValues() : null;
}
+ public Preferences setValues(String name, List<String> values) {
+ Preference entry = entries.get(name);
+ if (entry == null) {
+ entry = new Preference(name, values, false);
+ } else {
+ entry = new Preference(entry.getName(), values, entry.isReadOnly());
+ }
+ entries.put(name, entry);
+ return this;
+ }
+
+ public String getValue(String name) {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.getValue() : null;
+ }
+
+ public Preferences setValue(String name, String value) {
+ Preference entry = entries.get(name);
+ if (entry == null) {
+ entry = new Preference(name, value, false);
+ } else {
+ entry = new Preference(entry.getName(), value, entry.isReadOnly());
+ }
+ entries.put(name, entry);
+ return this;
+ }
+
+ public Boolean isReadOnly(String name) {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.isReadOnly() : null;
+ }
+
+ public Preferences setReadOnly(String name, boolean readOnly) {
+ Preference entry = entries.get(name);
+ if (entry == null) {
+ throw new IllegalStateException();
+ }
+ entry = new Preference(entry.getName(), entry.getValues(), readOnly);
+ entries.put(name, entry);
+ return this;
+ }
+
+ public Preference getPreference(String name) {
+ return entries.get(name);
+ }
+
+ public Preferences putPreference(Preference preference) {
+ entries.put(preference.getName(), preference);
+ return this;
+ }
+
+ public Iterator<Preference> iterator() {
+ return entries.values().iterator();
+ }
+
@Override
public boolean equals(Object obj) {
if (obj == this) {
Modified: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -39,21 +39,34 @@
public class CustomizationTestCase extends AbstractPOMTestCase {
/** . */
- private final Preferences prefs1 = new PreferencesBuilder().add("foo", "foo1").add("bar", "bar1", true).build();
+ private final Preferences marseille = new PreferencesBuilder().add("city", "marseille").add("temperature", "celsius").build();
/** . */
- private final Preferences prefs2 = new PreferencesBuilder().add("foo", "foo2").add("bar", "bar2", true).build();
+ private final Preferences paris = new PreferencesBuilder().add("city", "paris").build();
/** . */
- private final Preferences prefs3 = new PreferencesBuilder().add("foo", "foo3").add("bar", "bar3").build();
+ private final Preferences parisCelsius = new PreferencesBuilder().add("city", "paris").add("temperature", "celsius").build();
- public void testCustmizeWorkspace() {
+ /** . */
+ private final Preferences parisFarenheit = new PreferencesBuilder().add("city", "paris").add("temperature", "farenheit").build();
+
+ public void testCustomizationBlending() {
Workspace workspace = pomService.getModel().getWorkspace();
+ Customization<Preferences> customization1 = workspace.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
+ Customization<Preferences> customization2 = workspace.customize("paris", customization1);
+ customization2.setState(paris);
+ assertEquals(paris, customization2.getState());
+ assertEquals(parisCelsius, customization2.getVirtualState());
+// customization1.setState(customization1.getState().setReadOnly("temperature", true));
+ }
+
+ public void testCustomizeWorkspace() {
+ Workspace workspace = pomService.getModel().getWorkspace();
assertNull(workspace.getCustomization("marseille"));
- Customization<Preferences> customization = workspace.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", prefs1);
+ Customization<Preferences> customization = workspace.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
assertNotNull(customization);
Preferences b = customization.getState();
- assertEquals(prefs1, b);
+ assertEquals(marseille, b);
assertEquals(0, customization.getContexts().size());
assertEquals("WeatherPortlet", customization.getContentId());
assertEquals(Preferences.CONTENT_TYPE, customization.getType());
@@ -65,10 +78,12 @@
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
UIContainer layout = portal.getRootPage().getRootComponent();
UIWindow window = layout.add(ObjectType.WINDOW, "window");
- Customization<Preferences> customization = window.customize(Preferences.CONTENT_TYPE, "WeatherPortlet", prefs1);
+
+ //
+ Customization<Preferences> customization = window.customize(Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
assertSame(customization, window.getCustomization());
assertEquals(null, customization.getName());
- assertEquals(prefs1, customization.getState());
+ assertEquals(marseille, customization.getState());
}
public void testCustomizeWindowByCloneWithNoState() {
@@ -76,6 +91,8 @@
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
UIContainer layout = portal.getRootPage().getRootComponent();
UIWindow window = layout.add(ObjectType.WINDOW, "window");
+
+ //
Customization<Preferences> customization = window.customize(Preferences.CONTENT_TYPE, "WeatherPortlet", null);
assertSame(customization, window.getCustomization());
assertEquals(null, customization.getName());
@@ -85,59 +102,69 @@
public void testCustomizeWindowBySpecialization() {
Workspace workspace = pomService.getModel().getWorkspace();
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
- Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", prefs1);
UIContainer layout = portal.getRootPage().getRootComponent();
UIWindow window = layout.add(ObjectType.WINDOW, "window");
+
+ //
+ Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization = window.customize(workspaceCustomization);
//
assertNotNull(windowCustomization);
- assertEquals(Arrays.asList(window, portal), new ArrayList<CustomizationContext>(windowCustomization.getContexts()));
+ assertEquals(Arrays.<CustomizationContext>asList(window, portal), new ArrayList<CustomizationContext>(windowCustomization.getContexts()));
assertSame(windowCustomization, window.getCustomization());
assertTrue(((Customization)windowCustomization) instanceof WorkspaceSpecialization);
assertEquals("marseille", windowCustomization.getName());
//
- assertPreferences(prefs1, windowCustomization.getState());
- assertPreferences(prefs1, workspaceCustomization.getState());
+ assertPreferences(null, windowCustomization.getState());
+ assertPreferences(marseille, windowCustomization.getVirtualState());
+ assertPreferences(marseille, workspaceCustomization.getState());
//
- workspaceCustomization.setState(prefs2);
- assertPreferences(prefs2, windowCustomization.getState());
- assertPreferences(prefs2, workspaceCustomization.getState());
+ workspaceCustomization.setState(paris);
+ assertPreferences(paris, windowCustomization.getVirtualState());
+ assertPreferences(null, windowCustomization.getState());
+ assertPreferences(paris, workspaceCustomization.getState());
//
- windowCustomization.setState(prefs3);
- assertPreferences(prefs3, windowCustomization.getState());
- assertPreferences(prefs2, workspaceCustomization.getState());
+ windowCustomization.setState(parisFarenheit);
+ assertPreferences(parisFarenheit, windowCustomization.getVirtualState());
+ assertPreferences(parisFarenheit, windowCustomization.getState());
+ assertPreferences(paris, workspaceCustomization.getState());
}
public void testDestroySpecializedCustomization() {
Workspace workspace = pomService.getModel().getWorkspace();
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
- Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", prefs1);
UIContainer layout = portal.getRootPage().getRootComponent();
UIWindow window = layout.add(ObjectType.WINDOW, "window");
+
+ //
+ Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization = window.customize(workspaceCustomization);
//
workspaceCustomization.destroy();
- assertEquals(prefs1, windowCustomization.getState());
+
+ //
+ assertEquals(marseille, windowCustomization.getVirtualState());
+ assertEquals(marseille, windowCustomization.getState());
}
-/*
- public void testDeleteSpecializedCustomization() {
+ public void testDestroySpecialization() {
Workspace workspace = pomService.getModel().getWorkspace();
Site portal = workspace.addSite(ObjectType.PORTAL_SITE, "portal");
- Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", prefs1);
- UIContainer layout = portal.getRootPage().getLayout();
- UIWindow window = layout.addComponent(ObjectType.WINDOW, "window");
+ UIContainer layout = portal.getRootPage().getRootComponent();
+ UIWindow window = layout.add(ObjectType.WINDOW, "window");
+
+ //
+ Customization<Preferences> workspaceCustomization = portal.customize("marseille", Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization = window.customize(workspaceCustomization);
//
- workspaceCustomization.destroy();
+ windowCustomization.destroy();
}
-*/
private void assertPreferences(Preferences expectedPrefs, Preferences prefs) {
assertEquals("Was expecting to have prefs " + prefs + " equals to " + expectedPrefs, expectedPrefs, prefs);
Modified: components/mop/trunk/core/src/test/java/org/gatein/mop/core/impl/portlet/PortletContentProvider.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/impl/portlet/PortletContentProvider.java 2009-09-11 22:06:22 UTC (rev 180)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/impl/portlet/PortletContentProvider.java 2009-09-13 12:21:54 UTC (rev 181)
@@ -58,10 +58,10 @@
//
for (Preferences preferences : states) {
- for (Preference entry : preferences.getEntries()) {
- Preference previous = entries.get(entry.getName());
+ for (Preference preference : preferences) {
+ Preference previous = entries.get(preference.getName());
if (previous == null || !previous.isReadOnly()) {
- entries.put(entry.getName(), entry);
+ entries.put(preference.getName(), preference);
}
}
}
15 years, 3 months
gatein SVN: r180 - in components/mop/trunk: core/src/main/java/org/gatein/mop/core/api and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-09-11 18:06:22 -0400 (Fri, 11 Sep 2009)
New Revision: 180
Removed:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/ContentManager.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/content/ContentManagerImpl.java
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/UIWindowImpl.java
Log:
remove useless ContentManager
Deleted: components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/ContentManager.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/ContentManager.java 2009-09-10 22:20:07 UTC (rev 179)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/content/ContentManager.java 2009-09-11 22:06:22 UTC (rev 180)
@@ -1,48 +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.gatein.mop.api.content;
-
-/**
- * Provides access to content as seen by the framework.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface ContentManager {
-
- /**
- * Returns the representation of a specified content or null if it cannot be found.
- *
- * @param contentType the content type
- * @param contentId the content id
- * @return the content
- * @param <S> the state type
- */
- <S> Content<S> getContent(ContentType<S> contentType, String contentId);
-
- /**
- * Returns the representation of a specified content or null if it cannot be found.
- *
- * @param mimeType the mime type
- * @param contentId the content id
- * @return the content
- */
- Content<?> getContent(String mimeType, String contentId);
-
-}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-10 22:20:07 UTC (rev 179)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-09-11 22:06:22 UTC (rev 180)
@@ -18,26 +18,19 @@
*/
package org.gatein.mop.core.api;
-import org.gatein.mop.core.api.content.ContentManagerImpl;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.core.api.content.CustomizationContextProviderRegistry;
import org.gatein.mop.core.api.content.CustomizationContextResolver;
import org.gatein.mop.core.api.workspace.WorkspaceImpl;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
-import org.gatein.mop.core.api.workspace.UIWindowImpl;
import org.gatein.mop.core.api.workspace.content.ContextSpecialization;
import org.gatein.mop.core.api.workspace.content.WorkspaceClone;
-import org.gatein.mop.api.content.ContentManager;
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.workspace.Workspace;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.WorkspaceObject;
import org.gatein.mop.api.Model;
import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.query.QueryLanguage;
-import org.chromattic.api.query.Query;
-import org.chromattic.api.query.ObjectQueryBuilder;
-import org.chromattic.api.query.ObjectQuery;
import org.chromattic.api.event.LifeCycleListener;
import java.util.Iterator;
@@ -58,9 +51,6 @@
private final CustomizationContextProviderRegistry customizationContextResolvers;
/** . */
- private final ContentManagerImpl contentManager;
-
- /** . */
private WorkspaceImpl workspace;
/** . */
@@ -80,7 +70,6 @@
this.session = session;
this.contentManagers = contentManagers;
this.customizationContextResolvers = customizationContextResolvers;
- this.contentManager = new ContentManagerImpl(contentManagers, customizationContextResolvers, session);
//
session.addEventListener(contextualizer);
@@ -100,10 +89,6 @@
return workspace;
}
- public ContentManager getContentManager() {
- return contentManager;
- }
-
public void save() {
session.save();
}
@@ -140,9 +125,7 @@
}
private void inject(Object o, boolean persistent) {
- if (o instanceof UIWindowImpl) {
- ((UIWindowImpl)o).setContentManager(contentManager);
- } else if (o instanceof ContextSpecialization) {
+ if (o instanceof ContextSpecialization) {
((ContextSpecialization)o).setCustomizationContextResolver(customizationContextResolver);
} else if (o instanceof WorkspaceClone && persistent) {
((WorkspaceClone)o).registry = contentManagers;
Deleted: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/content/ContentManagerImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/content/ContentManagerImpl.java 2009-09-10 22:20:07 UTC (rev 179)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/content/ContentManagerImpl.java 2009-09-11 22:06:22 UTC (rev 180)
@@ -1,59 +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.gatein.mop.core.api.content;
-
-import org.gatein.mop.api.content.ContentManager;
-import org.gatein.mop.api.content.Content;
-import org.gatein.mop.api.content.ContentType;
-import org.chromattic.api.ChromatticSession;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ContentManagerImpl implements ContentManager {
-
- /** . */
- final ContentManagerRegistry contentManagers;
-
- /** . */
- final CustomizationContextProviderRegistry customizationContextResolvers;
-
- /** . */
- private final ChromatticSession session;
-
- public ContentManagerImpl(
- ContentManagerRegistry contentManagers,
- CustomizationContextProviderRegistry customizationContextResolvers,
- ChromatticSession session) {
-
- //
- this.contentManagers = contentManagers;
- this.session = session;
- this.customizationContextResolvers = customizationContextResolvers;
- }
-
- public <S> Content<S> getContent(ContentType<S> contentType, String contentId) {
- throw new UnsupportedOperationException();
- }
-
- public Content<?> getContent(String mimeType, String contentId) {
- throw new UnsupportedOperationException();
- }
-}
\ No newline at end of file
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/UIWindowImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/UIWindowImpl.java 2009-09-10 22:20:07 UTC (rev 179)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/UIWindowImpl.java 2009-09-11 22:06:22 UTC (rev 180)
@@ -25,7 +25,6 @@
import org.gatein.mop.api.workspace.ui.UIWindow;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
-import org.gatein.mop.api.content.ContentManager;
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.ContentType;
@@ -40,17 +39,6 @@
@NodeMapping(name = "mop:uiwindow")
public abstract class UIWindowImpl extends UIComponentImpl implements UIWindow, CustomizationContext {
- /** The content manager. */
- private ContentManager contentManager;
-
- public ContentManager getContentManager() {
- return contentManager;
- }
-
- public void setContentManager(ContentManager contentManager) {
- this.contentManager = contentManager;
- }
-
public ObjectType<? extends UIWindow> getObjectType() {
return ObjectType.WINDOW;
}
15 years, 3 months
gatein SVN: r179 - in components/mop/trunk: api and 2 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-09-10 18:20:07 -0400 (Thu, 10 Sep 2009)
New Revision: 179
Modified:
components/mop/trunk/api/pom.xml
components/mop/trunk/core/pom.xml
components/mop/trunk/pom.xml
components/mop/trunk/spi/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: components/mop/trunk/api/pom.xml
===================================================================
--- components/mop/trunk/api/pom.xml 2009-09-10 22:19:52 UTC (rev 178)
+++ components/mop/trunk/api/pom.xml 2009-09-10 22:20:07 UTC (rev 179)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/core/pom.xml
===================================================================
--- components/mop/trunk/core/pom.xml 2009-09-10 22:19:52 UTC (rev 178)
+++ components/mop/trunk/core/pom.xml 2009-09-10 22:20:07 UTC (rev 179)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/pom.xml
===================================================================
--- components/mop/trunk/pom.xml 2009-09-10 22:19:52 UTC (rev 178)
+++ components/mop/trunk/pom.xml 2009-09-10 22:20:07 UTC (rev 179)
@@ -34,7 +34,7 @@
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MOP</name>
@@ -54,9 +54,9 @@
</licenses>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/tags/1.0.0-B...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/tags/1.0.0-Beta05</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/mop/tags/1.0.0-Beta05</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/trunk/</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/mop/trunk/</url>
</scm>
<!-- Required to download Parent -->
@@ -92,12 +92,12 @@
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-api</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-spi</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- External dependencies -->
<dependency>
Modified: components/mop/trunk/spi/pom.xml
===================================================================
--- components/mop/trunk/spi/pom.xml 2009-09-10 22:19:52 UTC (rev 178)
+++ components/mop/trunk/spi/pom.xml 2009-09-10 22:20:07 UTC (rev 179)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ****************** -->
15 years, 3 months
gatein SVN: r178 - components/mop/tags.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-09-10 18:19:52 -0400 (Thu, 10 Sep 2009)
New Revision: 178
Added:
components/mop/tags/1.0.0-Beta05/
Log:
[maven-scm] copy for tag 1.0.0-Beta05
Copied: components/mop/tags/1.0.0-Beta05 (from rev 177, components/mop/trunk)
15 years, 3 months
gatein SVN: r177 - in components/mop/trunk: api and 2 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2009-09-10 18:19:27 -0400 (Thu, 10 Sep 2009)
New Revision: 177
Modified:
components/mop/trunk/api/pom.xml
components/mop/trunk/core/pom.xml
components/mop/trunk/pom.xml
components/mop/trunk/spi/pom.xml
Log:
[maven-release-plugin] prepare release 1.0.0-Beta05
Modified: components/mop/trunk/api/pom.xml
===================================================================
--- components/mop/trunk/api/pom.xml 2009-09-10 22:13:19 UTC (rev 176)
+++ components/mop/trunk/api/pom.xml 2009-09-10 22:19:27 UTC (rev 177)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/core/pom.xml
===================================================================
--- components/mop/trunk/core/pom.xml 2009-09-10 22:13:19 UTC (rev 176)
+++ components/mop/trunk/core/pom.xml 2009-09-10 22:19:27 UTC (rev 177)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<!-- ****************** -->
Modified: components/mop/trunk/pom.xml
===================================================================
--- components/mop/trunk/pom.xml 2009-09-10 22:13:19 UTC (rev 176)
+++ components/mop/trunk/pom.xml 2009-09-10 22:19:27 UTC (rev 177)
@@ -34,7 +34,7 @@
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
<packaging>pom</packaging>
<name>MOP</name>
@@ -54,9 +54,9 @@
</licenses>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/trunk/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/mop/trunk/</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/tags/1.0.0-B...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/tags/1.0.0-Beta05</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/mop/tags/1.0.0-Beta05</url>
</scm>
<!-- Required to download Parent -->
@@ -92,12 +92,12 @@
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-api</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</dependency>
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-spi</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</dependency>
<!-- External dependencies -->
<dependency>
Modified: components/mop/trunk/spi/pom.xml
===================================================================
--- components/mop/trunk/spi/pom.xml 2009-09-10 22:13:19 UTC (rev 176)
+++ components/mop/trunk/spi/pom.xml 2009-09-10 22:19:27 UTC (rev 177)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<!-- ****************** -->
15 years, 3 months