Author: julien_viet
Date: 2011-06-15 15:26:36 -0400 (Wed, 15 Jun 2011)
New Revision: 6661
Added:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterRegistration.java
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterLifeCycle.java
Removed:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterFactoryRegistration.java
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterFactory
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterFactory.java
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/Adaptable.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/WorkspaceObjectImpl.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/AdapterTestCase.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Bar.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Foo.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Juu.java
components/mop/trunk/pom.xml
Log:
GTNMOP-42 : Upgrade to Chromattic 1.1.0-beta6
GTNMOP-41 : Support for adapter removal
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/Adaptable.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/Adaptable.java 2011-06-15
12:46:31 UTC (rev 6660)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/Adaptable.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -29,11 +29,11 @@
{
/**
- * Returns an adaptee for the specified type.
+ * Returns an adapter for the specified type.
*
* @param adapterType the adapter type class
* @param <A> the adapter type
- * @return the adaptee or null
+ * @return the adapter or null
*/
<A> A adapt(Class<A> adapterType);
@@ -43,6 +43,14 @@
* @param adapterType the adapter type
* @return the adaptability of the current object
*/
- boolean isAdapted(Class<?> adapterType);
+ <A> boolean isAdapted(Class<A> adapterType);
+ /**
+ * Removes the adapter from this adaptable object.
+ *
+ * @param adapterType the adapter type class
+ * @param <A> the adapter generic type
+ */
+ <A> void removeAdapter(Class<A> adapterType);
+
}
Deleted:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterFactoryRegistration.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterFactoryRegistration.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterFactoryRegistration.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -1,72 +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;
-
-import org.gatein.mop.core.util.Tools;
-import org.gatein.mop.spi.AdapterFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ServiceLoader;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class AdapterFactoryRegistration<T, A>
-{
-
- /** . */
- private static final Map<Class<?>, AdapterFactoryRegistration<?, ?>>
instances;
-
- static
- {
- ServiceLoader<AdapterFactory> loader =
ServiceLoader.load(AdapterFactory.class);
- Map<Class<?>, AdapterFactoryRegistration<?, ?>> map = new
HashMap<Class<?>, AdapterFactoryRegistration<?, ?>>();
- for (AdapterFactory factory : loader)
- {
- AdapterFactoryRegistration registration = new
AdapterFactoryRegistration(factory);
- map.put(registration.adapterType, registration);
- }
-
- //
- instances = map;
- }
-
- static <A> AdapterFactoryRegistration<Object, A>
getInstance(Class<A> type)
- {
- return (AdapterFactoryRegistration<Object, A>)instances.get(type);
- }
-
- /** . */
- final AdapterFactory<T, A> factory;
-
- /** . */
- final Class<T> adapteeType;
-
- /** . */
- final Class<A> adapterType;
-
- AdapterFactoryRegistration(AdapterFactory<T, A> factory)
- {
- this.factory = factory;
- this.adapteeType = (Class<T>)Tools.resolve(factory.getClass(),
AdapterFactory.class, 0);
- this.adapterType = (Class<A>)Tools.resolve(factory.getClass(),
AdapterFactory.class, 1);
- }
-}
Copied:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterRegistration.java
(from rev 6646,
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterFactoryRegistration.java)
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterRegistration.java
(rev 0)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/AdapterRegistration.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -0,0 +1,72 @@
+/**
+ * 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;
+
+import org.gatein.mop.core.util.Tools;
+import org.gatein.mop.spi.AdapterLifeCycle;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class AdapterRegistration<T, A>
+{
+
+ /** . */
+ private static final Map<Class<?>, AdapterRegistration<?, ?>>
instances;
+
+ static
+ {
+ ServiceLoader<AdapterLifeCycle> loader =
ServiceLoader.load(AdapterLifeCycle.class);
+ Map<Class<?>, AdapterRegistration<?, ?>> map = new
HashMap<Class<?>, AdapterRegistration<?, ?>>();
+ for (AdapterLifeCycle factory : loader)
+ {
+ AdapterRegistration registration = new AdapterRegistration(factory);
+ map.put(registration.adapterType, registration);
+ }
+
+ //
+ instances = map;
+ }
+
+ static <A> AdapterRegistration<Object, A> getInstance(Class<A>
type)
+ {
+ return (AdapterRegistration<Object, A>)instances.get(type);
+ }
+
+ /** . */
+ final AdapterLifeCycle<T, A> factory;
+
+ /** . */
+ final Class<T> adapteeType;
+
+ /** . */
+ final Class<A> adapterType;
+
+ AdapterRegistration(AdapterLifeCycle<T, A> factory)
+ {
+ this.factory = factory;
+ this.adapteeType = (Class<T>)Tools.resolve(factory.getClass(),
AdapterLifeCycle.class, 0);
+ this.adapterType = (Class<A>)Tools.resolve(factory.getClass(),
AdapterLifeCycle.class, 1);
+ }
+}
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 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -44,6 +44,7 @@
import org.gatein.mop.api.Model;
import org.chromattic.api.ChromatticSession;
import org.chromattic.api.event.LifeCycleListener;
+import org.gatein.mop.spi.AdapterLifeCycle;
import java.util.Iterator;
import java.util.Map;
@@ -123,16 +124,16 @@
return getWorkspaceImpl();
}
- public <A> A getAdapter(Object o, Class<A> adapterType)
+ public <A> AdapterLifeCycle<Object, A> getAdapter(Object o, Class<A>
adapterType)
{
- AdapterFactoryRegistration<Object, A> registration =
AdapterFactoryRegistration.getInstance(adapterType);
+ AdapterRegistration<Object, A> registration =
AdapterRegistration.getInstance(adapterType);
//
if (registration != null)
{
if (registration.adapteeType.isInstance(o))
{
- return registration.factory.getAdapter(o, adapterType);
+ return registration.factory;
}
else
{
@@ -147,7 +148,7 @@
public <A> boolean isAdaptable(Class<A> adapterType)
{
- return AdapterFactoryRegistration.getInstance(adapterType) != null;
+ return AdapterRegistration.getInstance(adapterType) != null;
}
private WorkspaceImpl getWorkspaceImpl()
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 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -26,6 +26,7 @@
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.core.api.AttributesImpl;
import org.gatein.mop.core.api.ModelImpl;
+import org.gatein.mop.spi.AdapterLifeCycle;
import java.util.HashMap;
import java.util.Map;
@@ -44,7 +45,7 @@
public ModelImpl model;
/** . */
- private Map adapters;
+ private Map<Class<?>, Object> adapters;
@Name
public abstract String getNodeName();
@@ -75,15 +76,20 @@
A adapter;
if (model.isAdaptable(adapterType))
{
- adapter = model.getAdapter(this, adapterType);
- if (adapter != null)
+ AdapterLifeCycle<Object, A> lifeCycle = model.getAdapter(this,
adapterType);
+ if (lifeCycle != null)
{
if (adapters == null)
{
- adapters = new HashMap();
+ adapters = new HashMap<Class<?>, Object>();
}
+ adapter = lifeCycle.create(this, adapterType);
adapters.put(adapterType, adapter);
}
+ else
+ {
+ adapter = null;
+ }
}
else
{
@@ -94,7 +100,7 @@
return adapter;
}
- public final boolean isAdapted(Class<?> adapterType)
+ public final <A> boolean isAdapted(Class<A> adapterType)
{
if (adapters != null)
{
@@ -115,11 +121,31 @@
}
}
- private <A> A getMixin(Class<A> type, boolean adapt)
+ public <A> void removeAdapter(Class<A> adapterType)
{
+ if (model.isAdaptable(adapterType))
+ {
+ if (adapters != null)
+ {
+ A adapter = (A)adapters.remove(adapterType);
+ if (adapter != null)
+ {
+ AdapterLifeCycle<Object, A> lifeCycle = model.getAdapter(this,
adapterType);
+ lifeCycle.destroy(adapter, this, adapterType);
+ }
+ }
+ }
+ else
+ {
+ removeMixin(adapterType);
+ }
+ }
+
+ private <A> A getMixin(Class<A> type, boolean create)
+ {
ChromatticSession session = model.getSession();
A a = session.getEmbedded(this, type);
- if (a == null && adapt)
+ if (a == null && create)
{
a = session.create(type);
session.setEmbedded(this, type, a);
@@ -127,6 +153,12 @@
return a;
}
+ private <A> void removeMixin(Class<A> type)
+ {
+ ChromatticSession session = model.getSession();
+ session.setEmbedded(this, type, null);
+ }
+
public String getName()
{
return getNodeName();
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/AdapterTestCase.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/AdapterTestCase.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/AdapterTestCase.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -35,12 +35,42 @@
public class AdapterTestCase extends AbstractPOMTestCase
{
- public void testSecured() throws Exception
+ public void testLifeCycle() throws Exception
{
ModelImpl model = pomService.getModel();
Workspace workspace = model.getWorkspace();
+ Site site = workspace.addSite(ObjectType.PORTAL_SITE, "adaptable_foo");
+
+ //
+ assertFalse(site.isAdapted(Foo.class));
+
+ //
+ Foo foo = site.adapt(Foo.class);
+ assertNotNull(foo);
+ assertSame(foo, site.adapt(Foo.class));
+ assertSame(site, foo.adapteeCreated);
+ assertSame(Foo.class, foo.typeCreated);
+ assertNull(foo.adapteeRemoved);
+ assertNull(foo.typeRemoved);
+ assertTrue(site.isAdapted(Foo.class));
+
+ //
+ site.removeAdapter(Foo.class);
+ assertSame(site, foo.adapteeRemoved);
+ assertSame(Foo.class, foo.typeRemoved);
+ assertFalse(site.isAdapted(Foo.class));
+ }
+
+ public void testMixinLifeCycle() throws Exception
+ {
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
Site site = workspace.addSite(ObjectType.PORTAL_SITE,
"adaptable_secured");
+
+ //
assertFalse(site.isAdapted(Secured.class));
+
+ //
Secured secured = site.adapt(Secured.class);
assertNotNull(secured);
assertTrue(site.isAdapted(Secured.class));
@@ -49,6 +79,10 @@
assertTrue(permissions.isEmpty());
permissions.add("FOO");
model.save();
+
+ //
+ site.removeAdapter(Secured.class);
+ assertFalse(site.isAdapted(Secured.class));
}
public void testWorkspaceObjectType() throws Exception
@@ -60,8 +94,8 @@
Foo foo = site.adapt(Foo.class);
assertNotNull(foo);
assertSame(foo, site.adapt(Foo.class));
- assertSame(site, foo.adaptee);
- assertSame(Foo.class, foo.adapterType);
+ assertSame(site, foo.adapteeCreated);
+ assertSame(Foo.class, foo.typeCreated);
assertTrue(site.isAdapted(Foo.class));
}
@@ -84,7 +118,6 @@
ModelImpl model = pomService.getModel();
Workspace workspace = model.getWorkspace();
assertNull(workspace.adapt(Juu.class));
-
Site site = workspace.addSite(ObjectType.PORTAL_SITE, "adaptable_juu");
assertFalse(site.isAdapted(Juu.class));
Juu juu = site.adapt(Juu.class);
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Bar.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Bar.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Bar.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -18,7 +18,7 @@
*/
package org.gatein.mop.core.api.workspace;
-import org.gatein.mop.spi.AdapterFactory;
+import org.gatein.mop.spi.AdapterLifeCycle;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -39,11 +39,16 @@
this.adapterType = adapterType;
}
- public static class Factory extends AdapterFactory<WorkspaceObjectImpl, Bar>
+ public static class Factory extends AdapterLifeCycle<WorkspaceObjectImpl, Bar>
{
- public Bar getAdapter(WorkspaceObjectImpl adaptee, Class<Bar> adapterType)
+ public Bar create(WorkspaceObjectImpl adaptee, Class<Bar> adapterType)
{
return new Bar(adaptee, adapterType);
}
+
+ @Override
+ public void destroy(Bar adapter, WorkspaceObjectImpl adaptee, Class<Bar>
adapterType)
+ {
+ }
}
}
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Foo.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Foo.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Foo.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -19,7 +19,7 @@
package org.gatein.mop.core.api.workspace;
import org.gatein.mop.api.workspace.WorkspaceObject;
-import org.gatein.mop.spi.AdapterFactory;
+import org.gatein.mop.spi.AdapterLifeCycle;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -29,23 +29,36 @@
{
/** . */
- final WorkspaceObject adaptee;
+ final WorkspaceObject adapteeCreated;
/** . */
- final Class<Foo> adapterType;
+ final Class<Foo> typeCreated;
+ /** . */
+ WorkspaceObject adapteeRemoved;
+
+ /** . */
+ Class<Foo> typeRemoved;
+
public Foo(WorkspaceObject adaptee, Class<Foo> adapterType)
{
- this.adaptee = adaptee;
- this.adapterType = adapterType;
+ this.adapteeCreated = adaptee;
+ this.typeCreated = adapterType;
}
- public static class Factory extends AdapterFactory<WorkspaceObject, Foo>
+ public static class Factory extends AdapterLifeCycle<WorkspaceObject, Foo>
{
@Override
- public Foo getAdapter(WorkspaceObject adaptee, Class<Foo> adapterType)
+ public Foo create(WorkspaceObject adaptee, Class<Foo> adapterType)
{
return new Foo(adaptee, adapterType);
}
+
+ @Override
+ public void destroy(Foo adapter, WorkspaceObject adaptee, Class<Foo>
adapterType)
+ {
+ adapter.adapteeRemoved = adaptee;
+ adapter.typeRemoved = adapterType;
+ }
}
}
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Juu.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Juu.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/Juu.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -19,7 +19,7 @@
package org.gatein.mop.core.api.workspace;
import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.spi.AdapterFactory;
+import org.gatein.mop.spi.AdapterLifeCycle;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -40,12 +40,17 @@
this.adapterType = adapterType;
}
- public static class Factory extends AdapterFactory<Site, Juu>
+ public static class Factory extends AdapterLifeCycle<Site, Juu>
{
@Override
- public Juu getAdapter(Site adaptee, Class<Juu> adapterType)
+ public Juu create(Site adaptee, Class<Juu> adapterType)
{
return new Juu(adaptee, adapterType);
}
+
+ @Override
+ public void destroy(Juu adapter, Site adaptee, Class<Juu> adapterType)
+ {
+ }
}
}
Deleted:
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterFactory
===================================================================
---
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterFactory 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterFactory 2011-06-15
19:26:36 UTC (rev 6661)
@@ -1,3 +0,0 @@
-org.gatein.mop.core.api.workspace.Foo$Factory
-org.gatein.mop.core.api.workspace.Bar$Factory
-org.gatein.mop.core.api.workspace.Juu$Factory
Copied:
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
(from rev 6646,
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterFactory)
===================================================================
---
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
(rev 0)
+++
components/mop/trunk/core/src/test/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle 2011-06-15
19:26:36 UTC (rev 6661)
@@ -0,0 +1,3 @@
+org.gatein.mop.core.api.workspace.Foo$Factory
+org.gatein.mop.core.api.workspace.Bar$Factory
+org.gatein.mop.core.api.workspace.Juu$Factory
Modified: components/mop/trunk/pom.xml
===================================================================
--- components/mop/trunk/pom.xml 2011-06-15 12:46:31 UTC (rev 6660)
+++ components/mop/trunk/pom.xml 2011-06-15 19:26:36 UTC (rev 6661)
@@ -124,7 +124,7 @@
<!-- Build settings -->
<!-- ************** -->
- <org.chromattic.version>1.1.0-beta5</org.chromattic.version>
+ <org.chromattic.version>1.1.0-beta6</org.chromattic.version>
<!--
Current testuite doesn't work with surefire 2.7 defined in parent pom
Deleted: components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterFactory.java
===================================================================
---
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterFactory.java 2011-06-15
12:46:31 UTC (rev 6660)
+++
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterFactory.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2010 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.spi;
-
-/**
- * The adapter factory.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public abstract class AdapterFactory<T, A>
-{
-
- public abstract A getAdapter(T adaptee, Class<A> adapterType);
-
-}
Copied: components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterLifeCycle.java
(from rev 6646,
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterFactory.java)
===================================================================
--- components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterLifeCycle.java
(rev 0)
+++
components/mop/trunk/spi/src/main/java/org/gatein/mop/spi/AdapterLifeCycle.java 2011-06-15
19:26:36 UTC (rev 6661)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 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.spi;
+
+/**
+ * The adapter factory.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public abstract class AdapterLifeCycle<T, A>
+{
+
+ public abstract A create(T adaptee, Class<A> adapterType);
+
+ public abstract void destroy(A adapter, T adaptee, Class<A> adapterType);
+
+}