001:/*
002: * The contents of this file are subject to the Sapient Public License
003: * Version 1.0 (the "License"); you may not use this file except in compliance
004: * with the License. You may obtain a copy of the License at
005: * http://carbon.sf.net/License.html.
006: *
007: * Software distributed under the License is distributed on an "AS IS" basis,
008: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009: * the specific language governing rights and limitations under the License.
010: *
011: * The Original Code is The Carbon Component Framework.
012: *
013: * The Initial Developer of the Original Code is Sapient Corporation
014: *
015: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
016: */
017:
018:package org.sape.carbon.core.component.lifecycle;
019:
020:import java.io.ObjectStreamException;
021:import java.io.Serializable;
022:
023:import org.sape.carbon.core.util.enum.BaseEnum;
024:import org.sape.carbon.core.util.enum.EnumNotFoundException;
025:
026:/**
027: * LifecycleStateEnum defines the Enumeration of states that a Component can
028: * have at any point in the Lifecycle. The states ending in "ing" are considered
029: * to be transitional states and should be taken as an indication that the
030: * component is undergoing a current state transition.
031: *
032: * Copyright 2002 Sapient
033: * @since carbon 1.0
034: * @author Chris Herron, January 2002
035: * @version $Revision: 1.13 $($Author: dvoet $ / $Date: 2003/05/05 21:21:13 $)
036: */
037:public class LifecycleStateEnum extends BaseEnum implements Serializable {
038:
039: /** Ordinal number for CREATING */
040: public static final int CREATING_ORDINAL = 0;
041:
042: /** CREATING */
043: public static final LifecycleStateEnum CREATING =
044: new LifecycleStateEnum("CREATING", CREATING_ORDINAL);
045:
046: /** Ordinal number for INITIALIZING */
047: public static final int INITIALIZING_ORDINAL = 1;
048:
049: /** INITIALIZING */
050: public static final LifecycleStateEnum INITIALIZING =
051: new LifecycleStateEnum("INITIALIZING", INITIALIZING_ORDINAL);
052:
053: /** Ordinal number for STARTING */
054: public static final int STARTING_ORDINAL = 2;
055:
056: /** STARTING */
057: public static final LifecycleStateEnum STARTING =
058: new LifecycleStateEnum("STARTING", STARTING_ORDINAL);
059:
060: /** Ordinal number for RUNNING */
061: public static final int RUNNING_ORDINAL = 3;
062:
063: /** RUNNING */
064: public static final LifecycleStateEnum RUNNING =
065: new LifecycleStateEnum("RUNNING", RUNNING_ORDINAL);
066:
067: /** Ordinal number for STOPPING */
068: public static final int STOPPING_ORDINAL = 4;
069:
070: /** STOPPING */
071: public static final LifecycleStateEnum STOPPING =
072: new LifecycleStateEnum("STOPPING", STOPPING_ORDINAL);
073:
074: /** Ordinal number for STOPPED */
075: public static final int STOPPED_ORDINAL = 5;
076:
077: /** STOPPED */
078: public static final LifecycleStateEnum STOPPED =
079: new LifecycleStateEnum("STOPPED", STOPPED_ORDINAL);
080:
081: /** Ordinal number for SUSPENDING */
082: public static final int SUSPENDING_ORDINAL = 6;
083:
084: /** SUSPENDING */
085: public static final LifecycleStateEnum SUSPENDING =
086: new LifecycleStateEnum("SUSPENDING", SUSPENDING_ORDINAL);
087:
088: /** Ordinal number for SUSPENDED */
089: public static final int SUSPENDED_ORDINAL = 7;
090:
091: /** SUSPENDED */
092: public static final LifecycleStateEnum SUSPENDED =
093: new LifecycleStateEnum("SUSPENDED", SUSPENDED_ORDINAL);
094:
095: /** Ordinal number for RESUMING */
096: public static final int RESUMING_ORDINAL = 8;
097:
098: /** RESUMING */
099: public static final LifecycleStateEnum RESUMING =
100: new LifecycleStateEnum("RESUMING", RESUMING_ORDINAL);
101:
102: /** Ordinal number for CONFIGURING */
103: public static final int CONFIGURING_ORDINAL = 9;
104:
105: /** CONFIGURING */
106: public static final LifecycleStateEnum CONFIGURING =
107: new LifecycleStateEnum("CONFIGURING", CONFIGURING_ORDINAL);
108:
109: /** Ordinal number for DESTROYING */
110: public static final int DESTROYING_ORDINAL = 10;
111:
112: /** DESTROYING */
113: public static final LifecycleStateEnum DESTROYING =
114: new LifecycleStateEnum("DESTROYING", DESTROYING_ORDINAL);
115:
116: /** Ordinal number for DESTROYED */
117: public static final int DESTROYED_ORDINAL = 11;
118:
119: /** DESTROYED */
120: public static final LifecycleStateEnum DESTROYED =
121: new LifecycleStateEnum("DESTROYED", DESTROYED_ORDINAL);
122:
123:
124: /**
125: * @see BaseEnum#BaseEnum
126: */
127: private LifecycleStateEnum(String name, int ordinal) {
128: super (LifecycleStateEnum.class, name, ordinal);
129: }
130:
131: /**
132: * @see BaseEnum#getByName
133: */
134: public static final LifecycleStateEnum getByName(String name)
135: throws LifecycleStateEnumNotFoundException {
136:
137: return (LifecycleStateEnum)
138: BaseEnum.getByName(name, LifecycleStateEnum.class);
139: }
140:
141: /**
142: * @see BaseEnum#getByOrdinal
143: */
144: public static final LifecycleStateEnum getByOrdinal(int ordinal)
145: throws LifecycleStateEnumNotFoundException {
146: return (LifecycleStateEnum) BaseEnum.getByOrdinal(ordinal,
147: LifecycleStateEnum.class);
148: }
149:
150: /**
151: * @see BaseEnum#getByOrdinal
152: */
153: final Object readResolve() throws ObjectStreamException {
154: return super .getByOrdinal(this .ordinal, this .getClass());
155: }
156:
157:
158: /**
159: * @see EnumNotFoundException
160: */
161: public class LifecycleStateEnumNotFoundException
162: extends EnumNotFoundException {
163:
164: /**
165: * @see EnumNotFoundException#EnumNotFoundException
166: */
167: public LifecycleStateEnumNotFoundException(
168: Class sourceClass,
169: String name) {
170: super(sourceClass, name);
171: }
172:
173: }
174:
175:
176:}
|