1 /*------------------------------------------------------------------------------
2 Name: XmlBlasterAccessMBean.java
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 See: http://java.sun.com/products/JavaManagement/best-practices.html
6 ------------------------------------------------------------------------------*/
7 package org.xmlBlaster.client;
8
9 import org.xmlBlaster.util.XmlBlasterException;
10
11 /**
12 * Export methods for JMX to monitor and control the java client connection.
13 */
14 public interface XmlBlasterAccessMBean {
15 /**
16 * A unique name for this client, for logging only
17 * @return e.g. "/node/heron/client/joe/3"
18 */
19 String getId();
20
21 /**
22 * Get the login name.
23 * @return For example "joe"
24 */
25 public String getLoginName();
26
27 /**
28 * Check if a callback was configured, if client has passed a callback address on connect.
29 * @return true if a callback is configured
30 */
31 public boolean isCallbackConfigured();
32
33 /**
34 * Get the connection state.
35 * @return "UNDEF", "ALIVE", "POLLING", "DEAD"
36 */
37 public String getConnectionState();
38
39 /**
40 * Get the sessions public session id.
41 * @return For example -1
42 */
43 public long getPublicSessionId();
44
45 /**
46 * Access the unique id of my client side queue.
47 * @return For example "connection:SUB17692784598"
48 */
49 public String getConnectionQueueId();
50
51 /**
52 * Get date when client logged in.
53 * @return For example "2005-07-25 12:34:16.79"
54 */
55 public String getLoginDate();
56
57 /**
58 * Send an event to xmlBlaster to refresh the login session life time.
59 * @see <a href="http://www.xmlblaster.org/xmlBlaster/doc/requirements/engine.qos.login.session.html">session requirement</a>
60 * @throws XmlBlasterException like ErrorCode.USER_NOT_CONNECTED and others
61 */
62 public void refreshSession() throws XmlBlasterException;
63
64 /** Uptime in seconds */
65 public long getUptime();
66
67 /** How many messages where send by this clients login session */
68 public long getNumPublish();
69 /** How many subscribe requests where send by this clients login session */
70 public long getNumSubscribe();
71 /** How many unsubscribe requests where send by this clients login session */
72 public long getNumUnSubscribe();
73 /** How many get requests where send by this clients login session */
74 public long getNumGet();
75 /** How many subscribe requests where send by this clients login session */
76 public long getNumErase();
77 /** How many oneway messages where received by this clients login session */
78 public long getNumUpdateOneway();
79 /** How many messages where received by this clients login session */
80 public long getNumUpdate();
81
82 /** How many messages are in this client side queue */
83 public long getConnectionQueueNumMsgs();
84
85 /** How many messages are max. allowed in this client side queue */
86 public long getConnectionQueueMaxMsgs();
87
88 /**
89 * Measures the round trip for the last ping() invocation in milli seconds.
90 * @return Returns the pingRoundTripDelay.
91 */
92 public long getPingRoundTripDelay();
93
94 /**
95 * Measures the round trip for the last remote method invocation in milli seconds.
96 * For example <code>update(), publish(), subscribe()</code>
97 * @return Returns the roundTripDelay.
98 */
99 public long getRoundTripDelay();
100
101 /**
102 * Publish a message.
103 * @param key The publish key (e.g. <key oid="Hello"><South/></key>)
104 * @param qos The qos XML string (e.g. "" or "<qos><persistent/></qos>")
105 * @return The status string
106 */
107 public String invokePublish(String key, String content, String qos) throws Exception;
108
109 /**
110 * Invoke operation to unSubscribe one/many topics.
111 * @param url The topic oid/xpath to unSubscribe (e.g. "Hello" or "xpath://key")
112 * @param qos The qos XML string (e.g. "" or "<qos/>")
113 * @return The status string
114 */
115 public String[] invokeUnSubscribe(String url, String qos) throws Exception;
116
117 /**
118 * Invoke operation to subscribe the topic, given by its oid
119 * @param url The topic oid/xpath to subscribe (e.g. "Hello" or "xpath://key")
120 * @param qos The qos XML string (e.g. "" or "<qos><persistent/></qos>")
121 * @return The status string
122 */
123 public String invokeSubscribe(String url, String qos) throws Exception;
124
125 /**
126 * Invoke operation to get() one/many topics.
127 * @param url The topic oid/xpath to retrieve (e.g. "Hello" or "xpath://key")
128 * @param qos The qos XML string (e.g. "" or "<qos/>")
129 * @return The status string
130 */
131 public String[] invokeGet(String url, String qos) throws Exception;
132
133 /**
134 * Invoke operation to erase() one/many topics.
135 * @param url The topic oid/xpath to erase (e.g. "Hello" or "xpath://key")
136 * @param qos The qos XML string (e.g. "" or "<qos/>")
137 * @return The status string
138 */
139 public String[] invokeErase(String url, String qos) throws Exception;
140
141 /**
142 * Activates/inhibits the dispatch of messages to this client.
143 */
144 public void setDispatcherActive(boolean dispatcherActive);
145
146 /**
147 * Access the dispatcher state.
148 * @return true if the dispatcher is currently able to dispatch asyncronously
149 */
150 public boolean getDispatcherActive();
151
152 /**
153 * The cluster node id (name) to which we want to connect.
154 * <p />
155 * Needed only for nicer logging when running in a cluster.<br />
156 * Is configurable with "-server.node.id golan"
157 * @return e.g. "golan", defaults to "xmlBlaster"
158 */
159 String getServerNodeId();
160
161 /**
162 * Peek messages from client queue, they are not removed
163 * @param numOfEntries The number of messages to peek, taken from the front
164 * @return The dump of the messages
165 */
166 public String[] peekClientMessages(int numOfEntries) throws Exception;
167
168 /**
169 * Peek messages from client queue and dump them to a file, they are not removed.
170 * @param numOfEntries The number of messages to peek, taken from the front
171 * @param path The path to dump the messages to, it is automatically created if missing.
172 * @return The absolute file names dumped
173 */
174 public String[] peekClientMessagesToFile(int numOfEntries, String path) throws Exception;
175
176 /**
177 * Get the xmlBlaster client library version number.
178 * @return For example "1.0.4"
179 */
180 public String getVersion();
181 /**
182 * Returns the xmlBlaster client library SVN version control revision number.
183 * @return The subversion revision number of the monitored instance,
184 * for example "13593"
185 */
186 public String getRevisionNumber();
187 /**
188 * Returns the date when xmlBlaster client library was compiled.
189 * @return For example "07/28/2005 03:47 PM"
190 */
191 public String getBuildTimestamp();
192 /**
193 * The java vendor of the compiler.
194 * @return For example "Sun Microsystems Inc."
195 */
196 public String getBuildJavaVendor();
197 /**
198 * The compiler java version.
199 * @return For example "1.5.0"
200 */
201 public String getBuildJavaVersion();
202
203 public String leaveServer();
204
205 public String disconnect(String disconnectQos);
206 }
syntax highlighted by Code2HTML, v. 0.9.1