Commit 4271c594 authored by Lionel Seinturier's avatar Lionel Seinturier

Remove support for the @EagerDestroy annotations. Wasn't such a good idea. To...

Remove support for the @EagerDestroy annotations. Wasn't such a good idea. To be replaced by @Start and @Stop.
parent 11e64229
......@@ -3,12 +3,13 @@ Tinfi 1.3
* fix for services and references with generic types (reported by Philippe)
* support inherited non public field injection point in component
implementations (requested by Philippe)
* remove @EagerDestroy
Tinfi 1.2.1
-----------
* support property re-injection (requested by Christophe)
* new @EagerDestroy method for performing actions when a composite-scoped
* new @EagerDestroy annotation for triggering actions when a composite-scoped
component is stopped (requested by Philippe)
Released on January 15, 2010
......
......@@ -25,7 +25,6 @@ package org.ow2.frascati.tinfi;
import org.osoa.sca.annotations.EagerInit;
import org.osoa.sca.annotations.Scope;
import org.ow2.frascati.tinfi.annotations.EagerDestroy;
/**
* Component implementation for testing request-scope components.
......@@ -37,17 +36,8 @@ import org.ow2.frascati.tinfi.annotations.EagerDestroy;
public class ScopeCompositeImpl extends ScopeImpl {
static boolean eagerinit = false;
static boolean eagerdestroy = false;
public ScopeCompositeImpl() {
eagerinit = true;
}
/**
* @since 1.2.1
*/
@EagerDestroy
public void whenStopped() {
eagerdestroy = true;
}
}
}
......@@ -62,7 +62,6 @@ public class ScopeTestCase {
public void testScopeCompositeEager() throws Exception {
ScopeCompositeImpl.eagerinit = false;
ScopeCompositeImpl.eagerdestroy = false;
String adl = getClass().getPackage().getName()+".ScopeComposite";
Component c = TinfiDomain.getComponent(adl);
......@@ -71,15 +70,6 @@ public class ScopeTestCase {
Assert.assertTrue(
"Content instance should have been eagerly initialized",
ScopeCompositeImpl.eagerinit);
Assert.assertFalse(
"Content instance should not have been eagerly destroyed before stopping the component",
ScopeCompositeImpl.eagerdestroy);
Fractal.getLifeCycleController(c).stopFc();
Assert.assertTrue(
"Content instance should have been eagerly destroyed",
ScopeCompositeImpl.eagerdestroy);
}
@Test
......
......@@ -62,26 +62,6 @@ public abstract class LifeCycleEagerMixin implements LifeCycleCoordinator {
return _super_setFcStarted();
}
/**
* @since 1.2.1
*/
public boolean setFcStopped() throws IllegalLifeCycleException {
/*
* Notify the SCA content controller that the component has been
* stopped. This gives the opportunity to eager destory the component
* if the @EagerDestroy annotation has been set.
*/
try {
_this_weaveableSCACC.eagerDestroy();
}
catch( ContentInstantiationException ie ) {
throw new ChainedIllegalLifeCycleException(ie,null,"");
}
return _super_setFcStopped();
}
// -------------------------------------------------------------------------
// Fields and methods required by the mixin class in the base class
......
......@@ -335,44 +335,6 @@ implements Controller, SCAContentController {
sm.getFcContent();
}
/**
* Eager destroy the content instance associated with this component.
* Relevant only for composite-scoped components.
*
* @throws ContentInstantiationException
* if the content can not be destroyed or if the component is not
* composite-scoped
* @since 1.2.1
*/
public void eagerDestroy() throws ContentInstantiationException {
if( ccmd.eagerDestroyMethod == null ) {
return;
}
if( !(sm instanceof CompositeScopeManager) ) {
String msg =
"Eager destruction is meaningless in scopes other than "+
"COMPOSITE (scope is: "+ccmd.scope.value()+")";
throw new ContentInstantiationException(msg);
}
/*
* Retrieve the content instance and invoke the @EagerDestroy annotated
* method.
*/
Object content = sm.getFcContent();
try {
ccmd.eagerDestroyMethod.invoke(content);
}
catch (IllegalAccessException e) {
throw new ContentInstantiationException(e);
}
catch (InvocationTargetException e) {
throw new ContentInstantiationException(e);
}
}
/**
* Return <code>true</code> if the specified property is declared by the
* content class managed by this controller.
......
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2010 INRIA, USTL
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Lionel Seinturier
*/
package org.ow2.frascati.tinfi.annotations;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Annotation used to indicate that a component instance should be destroyed
* when its enclosing composite component is stopped.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.2.1
*/
@Target(METHOD)
@Retention(RUNTIME)
public @interface EagerDestroy {
// Indeed nothing
}
......@@ -43,7 +43,6 @@ import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.ow2.frascati.tinfi.annotations.EagerDestroy;
import org.ow2.frascati.tinfi.reflect.AnnotatedElementFilter;
import org.ow2.frascati.tinfi.reflect.Filter;
import org.ow2.frascati.tinfi.reflect.Filters;
......@@ -129,9 +128,6 @@ public class ContentClassMetaData {
/** The method annotated with @{@link Destroy}, if any. */
public Method destroyMethod;
/** The method annotated with @{@link EagerDestroy}, if any. */
public Method eagerDestroyMethod;
/** The field or setter method annotated with @{@link Context}, if any. */
public InjectionPoint<Context> contextAnnotatedElement;
......@@ -233,15 +229,6 @@ public class ContentClassMetaData {
destroyMethod =
checkFcUniqueAnnotatedVoidMethod(destroys,Destroy.class);
/*
* Retrieve the setter or field annotated with @EagerDestroy, if any.
* Check that only one such method exists.
*/
filter = new AnnotatedElementFilter(EagerDestroy.class);
Method[] eagerDestroys = Filters.filter(methods,filter);
eagerDestroyMethod =
checkFcUniqueAnnotatedVoidMethod(eagerDestroys,EagerDestroy.class);
/*
* Retrieve the setter or field annotated with @Context, if any.
* Check that only one such element exists.
......
......@@ -117,17 +117,6 @@ public interface SCAContentController {
*/
public void eagerInit() throws ContentInstantiationException;
/**
* Eager destroy the content instance associated with this component.
* Relevant only for composite-scoped components.
*
* @throws ContentInstantiationException
* if the content can not be destroyed or if the component is not
* composite-scoped
* @since 1.2.1
*/
public void eagerDestroy() throws ContentInstantiationException;
/**
* Return <code>true</code> if the specified property is declared by the
* content class managed by this controller.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment