Source Code Cross Referenced for State.java in  » JMX » jfoxmx » org » huihoo » jfox » service » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » jfoxmx » org.huihoo.jfox.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.com
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package org.huihoo.jfox.service;
009:
010:        /**
011:         * 
012:         * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
013:         */
014:
015:        public final class State {
016:
017:            public final static State ORIGINAL = new State(0, "Original");
018:
019:            /**
020:             * INITIALIZING, service is in initializing, doCreate()
021:             */
022:            public final static State INITIALIZING = new State(1,
023:                    "Initializing");
024:
025:            /**
026:             * INITIALIZED, service is initialized
027:             */
028:            public final static State INITIALIZED = new State(2, "Initialized");
029:
030:            /**
031:             * STOPPING, service is in starting
032:             */
033:            public final static State STARTING = new State(3, "Starting");
034:
035:            /**
036:             * STARTED, service has started
037:             */
038:            public final static State STARTED = new State(4, "Started");
039:
040:            /**
041:             * STOPPING, service is in stopping
042:             */
043:            public final static State STOPPING = new State(5, "Stopping");
044:
045:            /**
046:             * STOPPED, service stopped by user
047:             */
048:            public final static State STOPPED = new State(6, "Stopped");
049:
050:            /**
051:             * DESTROYING, service is in destroying
052:             */
053:            public final static State DESTROYING = new State(7, "Destroying");
054:
055:            /**
056:             * DESTROYED, service stopped and it's resource destoryed, example: it's connection closed
057:             */
058:            public final static State DESTROYED = new State(8, "Destroyed");
059:
060:            /**
061:             * INTERRUPPTED, service interrupted because of some error or exception
062:             */
063:            public final static State INTERRUPTED = new State(9, "Interrupted");
064:
065:            public int id = 0;
066:            public String name = "";
067:
068:            public State(int id, String name) {
069:                this .id = id;
070:                this .name = name;
071:            }
072:
073:            public int getId() {
074:                return id;
075:            }
076:
077:            public String getName() {
078:                return name;
079:            }
080:
081:            public int hashCode() {
082:                return (id + "").hashCode() + name.hashCode();
083:            }
084:
085:            public String toString() {
086:                return id + " [" + name + "]";
087:            }
088:
089:            public boolean equals(Object obj) {
090:                if (obj instanceof  State) {
091:                    State state = (State) obj;
092:                    return state.id == id && state.name.equals(name);
093:                }
094:                return false;
095:
096:            }
097:
098:            public static boolean canInit(State state) {
099:                if (state == State.ORIGINAL || state == State.DESTROYED) {
100:                    return true;
101:                }
102:                return false;
103:            }
104:
105:            public static boolean canStart(State state) {
106:                if (state == State.STOPPED || state == State.INITIALIZED) {
107:                    return true;
108:                }
109:                return false;
110:            }
111:
112:            public static boolean canStop(State state) {
113:                if (state == State.STARTED) {
114:                    return true;
115:                }
116:                return false;
117:            }
118:
119:            public static boolean canDestroy(State state) {
120:                if (state == State.INITIALIZED || state == State.STOPPED
121:                        || state == State.INTERRUPTED) {
122:                    return true;
123:                }
124:                return false;
125:            }
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.