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 public boolean forcePollingForTesting();
102
103 /**
104 * Publish a message.
105 * @param key The publish key (e.g. <key oid="Hello"><South/></key>)
106 * @param qos The qos XML string (e.g. "" or "<qos><persistent/></qos>")
107 * @return The status string
108 */
109 public String invokePublish(String key, String content, String qos) throws Exception;
110
111 /**
112 * Invoke operation to unSubscribe one/many topics.
113 * @param url The topic oid/xpath to unSubscribe (e.g. "Hello" or "xpath://key")
114 * @param qos The qos XML string (e.g. "" or "<qos/>")
115 * @return The status string
116 */
117 public String[] invokeUnSubscribe(String url, String qos) throws Exception;
118
119 /**
120 * Invoke operation to subscribe the topic, given by its oid
121 * @param url The topic oid/xpath to subscribe (e.g. "Hello" or "xpath://key")
122 * @param qos The qos XML string (e.g. "" or "<qos><persistent/></qos>")
123 * @return The status string
124 */
125 public String invokeSubscribe(String url, String qos) throws Exception;
126
127 /**
128 * Invoke operation to get() one/many topics.
129 * @param url The topic oid/xpath to retrieve (e.g. "Hello" or "xpath://key")
130 * @param qos The qos XML string (e.g. "" or "<qos/>")
131 * @return The status string
132 */
133 public String[] invokeGet(String url, String qos) throws Exception;
134
135 /**
136 * Invoke operation to erase() one/many topics.
137 * @param url The topic oid/xpath to erase (e.g. "Hello" or "xpath://key")
138 * @param qos The qos XML string (e.g. "" or "<qos/>")
139 * @return The status string
140 */
141 public String[] invokeErase(String url, String qos) throws Exception;
142
143 /**
144 * Activates/inhibits the dispatch of messages to this client.
145 */
146 public void setDispatcherActive(boolean dispatcherActive);
147
148 /**
149 * Access the dispatcher state.
150 * @return true if the dispatcher is currently able to dispatch asyncronously
151 */
152 public boolean getDispatcherActive();
153
154 /**
155 * The cluster node id (name) to which we want to connect.
156 * <p />
157 * Needed only for nicer logging when running in a cluster.<br />
158 * Is configurable with "-server.node.id golan"
159 * @return e.g. "golan", defaults to "xmlBlaster"
160 */
161 String getServerNodeId();
162
163 /**
164 * Peek messages from client queue, they are not removed
165 * @param numOfEntries The number of messages to peek, taken from the front
166 * @return The dump of the messages
167 */
168 public String[] peekClientMessages(int numOfEntries) throws Exception;
169
170 /**
171 * Peek messages from client queue and dump them to a file, they are not removed.
172 * @param numOfEntries The number of messages to peek, taken from the front
173 * @param path The path to dump the messages to, it is automatically created if missing.
174 * @return The absolute file names dumped
175 */
176 public String[] peekClientMessagesToFile(int numOfEntries, String path) throws Exception;
177
178 /**
179 * Get the xmlBlaster client library version number.
180 * @return For example "1.0.4"
181 */
182 public String getVersion();
183 /**
184 * Returns the xmlBlaster client library SVN version control revision number.
185 * @return The subversion revision number of the monitored instance,
186 * for example "13593"
187 */
188 public String getRevisionNumber();
189 /**
190 * Returns the date when xmlBlaster client library was compiled.
191 * @return For example "07/28/2005 03:47 PM"
192 */
193 public String getBuildTimestamp();
194 /**
195 * The java vendor of the compiler.
196 * @return For example "Sun Microsystems Inc."
197 */
198 public String getBuildJavaVendor();
199 /**
200 * The compiler java version.
201 * @return For example "1.5.0"
202 */
203 public String getBuildJavaVersion();
204
205 public String leaveServer();
206
207 public String disconnect(String disconnectQos);
208 }
syntax highlighted by Code2HTML, v. 0.9.1