Methods Summary |
---|
public void | addConnectionNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
connectionNotifier.addNotificationListener(listener, filter, handback);
|
private void | assertState(int legalState, java.lang.String message)
synchronized(stateLock) {
if (state != legalState) {
throw new IllegalStateException(message);
}
}
|
private void | assertStateNot(int illegalState, java.lang.String message)
synchronized(stateLock) {
if (state == illegalState) {
throw new IllegalStateException(message);
}
}
|
private void | changeState(int toState)
/* Since states are not directly changeable by the end-user, it needs
to be asserted if there is any program error */
assert (toState == CREATED || toState == CONNECTED || toState == CLOSED):
("This is illegal state transition, to: " + toState);
synchronized(stateLock) {
state = toState;
}
|
public void | close()Closes the connector and underlying connection to the server, if any.
final String message = "UrlConnector.close: Requires that connector is CONNECTED";
try {
assertState(CONNECTED, message);
//physicalConnection.close();
/* should be actually closed, when I can take care of persistent connections etc.
as of now, it is a no-op. */
ClientNotificationManager notifMgr =
((RemoteMBeanServerConnection)mbsc).getNotificationManager();
if (notifMgr != null)
notifMgr.close();
}
catch(Exception e) {
throw new IOException(e.getMessage());
}
|
public void | connect()Connects to the remote server. Since there are no defaults, this method
as of now throws an UnsupportedException.
final String msg = "Environment has to be provided";
throw new UnsupportedOperationException(msg);
|
public void | connect(java.util.Map env)Attempts to connect to the remote server and creates the MBeanServerConnection instance that
is used by clients. Returns immediately (does nothing), if connector is already in CONNECTED state.
Sun ONE implementation requires that provided Map contains documented values.
final String message = "UrlConnector.connect: Requires that connector is not CLOSED";
assertStateNot(CLOSED, message);
if (connected()) {
return;
}
try {
mbsc = MBeanServerConnectionFactory.getRemoteMBeanServerConnection(environment, serviceUrl);
changeState(CONNECTED);
}
catch (Exception e) {
e.printStackTrace();
throw new IOException(e.getMessage());
}
|
private boolean | connected()
synchronized(stateLock) {
return ( state == CONNECTED );
}
|
public java.lang.String | getConnectionId()Retunrs the connection-id of the connection.
return "TODO";
//return (physicalConnection.getConnectionId());
|
public javax.management.MBeanServerConnection | getMBeanServerConnection()
final String message = "Connector should be in CONNECTED state";
assertState(CONNECTED, message);
return ( mbsc );
|
public javax.management.MBeanServerConnection | getMBeanServerConnection(javax.security.auth.Subject delegationSubject)
return ( null );
|
private java.lang.String | getTransport(java.lang.String proprietoryProtocolString)
return proprietoryProtocolString.substring(PROTOCOL_PREFIX.length());
|
private void | logMap(java.util.Map env)
final Iterator iter = env.keySet().iterator();
while (iter.hasNext()) {
final String key = (String) iter.next();
final String str = (env.get(key) == null)?null:env.get(key).toString();
logger.fine(str);
}
|
public void | removeConnectionNotificationListener(javax.management.NotificationListener listener)
|
public void | removeConnectionNotificationListener(javax.management.NotificationListener l, javax.management.NotificationFilter f, java.lang.Object handback)
|
protected java.net.URL | serviceUrl2Url(javax.management.remote.JMXServiceURL serviceUrl)Utility method. If the passed serviceUrl is valid, it should always
create a valid URL.
try {
final String transportProtocol = getTransport(serviceUrl.getProtocol());
final String host = serviceUrl.getHost();
final int port = serviceUrl.getPort();
/* BEGIN -- S1WS_MOD */
String remainder = serviceUrl.getURLPath();
if (remainder == null || remainder.trim().length() == 0)
remainder = DefaultConfiguration.DEFAULT_SERVLET_CONTEXT_ROOT;
/* END -- S1WS_MOD */
return ( new URL(transportProtocol, host, port, remainder) );
}
catch (MalformedURLException mu) {
throw new RuntimeException(mu.getMessage());
}
|
protected void | validateEnvironment()
final boolean userPresent = environment.containsKey(DefaultConfiguration.ADMIN_USER_ENV_PROPERTY_NAME);
final boolean pwdPresent = environment.containsKey(DefaultConfiguration.ADMIN_PASSWORD_ENV_PROPERTY_NAME);
logger.fine("USERPRESENT: " + userPresent);
logger.fine("PWDPRESENT: " + pwdPresent);
if (! (userPresent && pwdPresent) ) {
throw new IllegalArgumentException("User and Password has to be there in the map");
}
final String adminUser = (String)
environment.get(DefaultConfiguration.ADMIN_USER_ENV_PROPERTY_NAME);
final String adminPassword = (String)
environment.get(DefaultConfiguration.ADMIN_PASSWORD_ENV_PROPERTY_NAME);
//validateString(adminUser);
//validateString(adminPassword);
|
protected abstract void | validateJmxServiceUrl()
|
private void | validateString(java.lang.String str)
//This may not be required -- username/password could be empty strings.
if (str == null || str.length() == 0) {
throw new RuntimeException(NULL_STR_MESSAGE);
}
|