KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > kernel > DowngradeMethod


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.kernel;
10
11 import org.jboss.portal.server.kernel.state.State;
12
13 /**
14  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
15  * @version $Revision: 1.1.1.1 $
16  */

17 public abstract class DowngradeMethod extends LifeCycleMethod
18 {
19
20    protected DowngradeMethod(Kernel kernel)
21    {
22       super(kernel);
23    }
24
25    public State invoke(Entry entry) throws TransitionNotPossibleException, ServiceFailureException
26    {
27       // Ensure we can do it
28
checkState(entry);
29
30       try
31       {
32          // Dependants recursively if possible
33
invokeOnDependsOnMe(entry);
34
35          // Try to invoke the service
36
invokeMethod(entry);
37
38          //
39
return entry.getState();
40       }
41       catch (Exception JavaDoc e)
42       {
43          // todo julien : on fail, should not we fail all the dependant services recursively ?
44
entry.machine.fail(false);
45          throw new ServiceFailureException(e);
46       }
47    }
48 }
49
Popular Tags