Author: julien_viet
Date: 2009-11-23 15:13:58 -0500 (Mon, 23 Nov 2009)
New Revision: 774
Added:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java
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/workspace/GroupSite.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.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/ContextType.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java
Log:
- remove usage of global name encoder
- use the @FormattedBy Chromattic annotation to specify the name encoder for the various
model objects
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-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -69,7 +69,7 @@
{
ChromatticBuilder builder = ChromatticBuilder.create();
builder.setOption(ChromatticBuilder.INSTRUMENTOR_CLASSNAME,
"org.chromattic.apt.InstrumentorImpl");
- builder.setOption(ChromatticBuilder.OBJECT_FORMATTER_CLASSNAME,
MOPFormatter.class.getName());
+// builder.setOption(ChromatticBuilder.OBJECT_FORMATTER_CLASSNAME,
MOPFormatter.class.getName());
//
this.builder = builder;
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -19,7 +19,6 @@
package org.gatein.mop.core.api.workspace;
import org.chromattic.api.annotations.NodeMapping;
-import org.gatein.mop.core.api.workspace.SiteImpl;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -20,8 +20,6 @@
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.RelatedMappedBy;
-import org.gatein.mop.core.api.workspace.SiteContainer;
-import org.gatein.mop.core.api.workspace.WorkspaceImpl;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,11 +18,13 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.Create;
import org.chromattic.api.annotations.RelatedMappedBy;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -31,6 +33,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:pagecontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class PageContainer
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.Create;
import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Collection;
import java.util.Map;
@@ -30,6 +32,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class SiteContainer<T extends Site>
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,6 +18,7 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.ManyToOne;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.MappedBy;
@@ -29,12 +30,14 @@
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.api.workspace.content.CustomizationContainer;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class SiteImpl extends WorkspaceObjectImpl implements Site,
WorkspaceCustomizationContext
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.gatein.mop.api.workspace.WorkspaceObject;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.CustomizationContext;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.util.AbstractAttributes;
import org.chromattic.api.annotations.Id;
import org.chromattic.api.annotations.Name;
@@ -37,6 +39,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class WorkspaceObjectImpl implements WorkspaceObject
{
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-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
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.workspace.WorkspaceCustomizationContext;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.api.content.CustomizationContextComparator;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.spi.content.ContentProvider;
@@ -44,6 +46,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class AbstractCustomization implements Customization<Object>,
StateContainer
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.Name;
import org.chromattic.api.annotations.ManyToOne;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -30,6 +32,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:contexttype")
+(a)FormattedBy(MOPFormatter.class)
public abstract class ContextType
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,9 +18,11 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.ManyToOne;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -29,6 +31,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:contexttypecontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class ContextTypeContainer
{
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java 2009-11-23
19:33:52 UTC (rev 773)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -18,6 +18,7 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
@@ -26,6 +27,7 @@
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.RelatedMappedBy;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -34,6 +36,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:customizationcontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class CustomizationContainer
{
Added:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java
(rev 0)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java 2009-11-23
20:13:58 UTC (rev 774)
@@ -0,0 +1,46 @@
+/*
+ * 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.workspace;
+
+import org.chromattic.core.DomainSession;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.core.api.AbstractPOMTestCase;
+import org.gatein.mop.core.api.ModelImpl;
+
+import javax.jcr.Node;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class NameEncodingTestCase extends AbstractPOMTestCase
+{
+
+ public void testEncodeSite() throws Exception
+ {
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
+ Site site = workspace.addSite(ObjectType.GROUP_SITE, ":");
+ DomainSession session = (DomainSession)model.getSession();
+ Node siteNode = session.getNode(site);
+ assertEquals("%04", siteNode.getName());
+ }
+}