KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > management > j2ee > StateManageable


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.management.j2ee;
23
24 /**
25  * Indicates that this Managed Object supports all the
26  * operations and attributes to support state management.
27  * An Managed Object implementing this interface is
28  * termed as State Manageable Object (SMO).
29  * An SMO generates events when its state changes.
30  * <br><br>
31  * <b>Attention</b>: This interface is not indented to be used by the client
32  * but it is morely a desription of what the client will get when he/she
33  * receives attributes from the JSR-77 server or what method can be
34  * invoked.
35  * <br><br>
36  * All attributes (getXXX) can be received by
37  * <br>
38  * {@link javax.management.j2ee.Management#getAttribute Management.getAttribute()}
39  * <br>
40  * or in bulk by:
41  * <br>
42  * {@link javax.management.j2ee.Management#getAttributes Management.getAttributes()}
43  * <br>
44  * Methods (all except getXXX()) can be invoked by:
45  * <br>
46  * {@link javax.management.j2ee.Management#invoke Management.invoke()}
47  * <br>
48  *
49  * @author <a HREF="mailto:marc@jboss.org">Marc Fleury</a>
50  * @author Andreas Schaefer
51  * @version $Revision: 40550 $
52  */

53 public interface StateManageable extends EventProvider
54 {
55    // Constants -----------------------------------------------------
56

57    public static final int STARTING = 0;
58    public static final int RUNNING = 1;
59    public static final int STOPPING = 2;
60    public static final int STOPPED = 3;
61    public static final int FAILED = 4;
62    public static final int CREATED = 5;
63    public static final int DESTROYED = 6;
64    public static final int REGISTERED = 7;
65    public static final int UNREGISTERED = 8;
66    
67    // Public --------------------------------------------------------
68

69    /**
70     * @return The Time (in milliseconds since 1/1/1970 00:00:00) that this
71     * managed object was started
72     */

73    public long getStartTime();
74
75    /**
76     * @return Current State of the SMO which could be either {@link #STARTING
77     * starting}, {@link #RUNNING running}, {@link #STOPPING stopping},
78     * {@link #STOPPED stopped} or {@link FAILED failed}
79     */

80    public int getState();
81
82    /**
83     * @return Current State string from amont {@link #STARTING
84     * STARTING}, {@link #RUNNING RUNNING}, {@link #STOPPING STOPPING},
85     * {@link #STOPPED STOPPED} or {@link FAILED FAILED}
86     */

87    public String JavaDoc getStateString();
88
89    /**
90     * Starts this SMO which can only be invoked when the SMO is in the State
91     * {@link #STOPPED stopped}. The SMO will go into the State {@link @STARTING
92     * started} and after it completes successfully the SMO will go to the State
93     * {@link #RUNNING running}.
94     * The children of the SMO will not be started by this method call.
95     * <p/>
96     * <b>Attention</b>: According to the specification this is named <i>start()</i>
97     * but in order to avoid name conflicts this is renamed to
98     * <i>mejbStart()</i>. The MEJB interface will make the conversion
99     * from <i>start</i> to <i>mejbStart</i> to make it transparent
100     * to the client.
101     */

102    public void mejbStart();
103
104    /**
105     * Starts this SMO like {@link @start start()}. After the SMO is started all
106     * its children in the State of {@link @STOPPED stopped} theirs startRecursive()
107     * are started too.
108     * <p/>
109     * <b>Attention</b>: According to the specification this is named <i>startRecursive()</i>
110     * but in order to avoid name conflicts this is renamed to
111     * <i>mejbStartRecursive()</i>. The MEJB interface will make the conversion
112     * from <i>startRecursive</i> to <i>mejbStartRecursive</i> to make it transparent
113     * to the client.
114     */

115    public void mejbStartRecursive();
116
117    /**
118     * Stops this SMO which can only be into the {@link #RUNNING running} or
119     * {@link #STARTING starting}. The State will change to {@link #STOPPING
120     * stoping} and after it completes successfully it will go into the
121     * State {@link #STOPPED stopped}. Afterwards all its children stop()
122     * method is called.
123     * <p/>
124     * <b>Attention</b>: According to the specification this is named <i>stop()</i>
125     * but in order to avoid name conflicts this is renamed to
126     * <i>mejbStop()</i>. The MEJB interface will make the conversion
127     * from <i>stop</i> to <i>mejbStop</i> to make it transparent
128     * to the client.
129     */

130    public void mejbStop();
131
132 }
133
Popular Tags