01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso;
05:
06: import org.eclipse.jdt.core.IJavaProject;
07:
08: import com.tc.util.Assert;
09:
10: /**
11: * When an L2 is started, one of these is associated with the resulting IProcess via the m_servers map.
12: */
13:
14: public class ServerInfo {
15: private IJavaProject m_javaProject;
16: private int m_jmxPort;
17: private String m_name;
18: private int m_status;
19:
20: public static final int STARTING = 0;
21: public static final int STARTED = 1;
22: public static final int TERMINATED = 2;
23:
24: public ServerInfo(IJavaProject javaProject, String name, int jmxPort) {
25: m_javaProject = javaProject;
26: m_name = name;
27: m_jmxPort = jmxPort;
28: m_status = STARTING;
29: }
30:
31: public IJavaProject getJavaProject() {
32: return m_javaProject;
33: }
34:
35: public String getName() {
36: return m_name;
37: }
38:
39: public int getJmxPort() {
40: return m_jmxPort;
41: }
42:
43: public int getStatus() {
44: return m_status;
45: }
46:
47: public void setStatus(int status) {
48: Assert.assertTrue("Invalid status", status == STARTING
49: || status == STARTED || status == TERMINATED);
50: m_status = status;
51: }
52:
53: public boolean isStarting() {
54: return getStatus() == STARTING;
55: }
56:
57: public boolean isStarted() {
58: return getStatus() == STARTED;
59: }
60:
61: public boolean isTerminated() {
62: return getStatus() == TERMINATED;
63: }
64:
65: public String toString() {
66: return m_name + ":" + m_jmxPort;
67: }
68: }
|