int port = getInt("port", 9999);
String host = get("host", "0.0.0.0");
String adaptorName = get("adaptorName", "HttpAdaptorMX4J");
MBeanServer server = global.getJmxWrapper().getMBeanServer();
HttpAdaptor adapter = new HttpAdaptor();
this.name = new ObjectName("Adaptor:name=" + adaptorName);
server.registerMBean(adapter, name);
adapter.setHost(host);
adapter.setPort(port);
this.authMethod = get("authenticationMethod", null);
log.info("Authentication Method is '" + this.authMethod + "'");
if (this.authMethod != null) {
this.authMethod = this.authMethod.trim();
if ("basic".equals(this.authMethod))
adapter.setAuthenticationMethod(this.authMethod);
else
log.warning("Authentication method '" + authMethod + "' not recognized, will switch to 'basic'");
log.info("Authentication Method is '" + this.authMethod + "'");
Map users = InfoHelper.getPropertiesStartingWith("replication.monitor.user.", this, null);
if (users != null && users.size() > 0) {
Iterator iter = users.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
String name = (String)entry.getKey();
String val = (String)entry.getValue();
log.fine("name='" + name + "' value='" + val + "'");
int pos = val.indexOf(':');
String pwd = null;
String roles = USER_ROLE;
if (pos > -1) {
pwd = val.substring(0, pos);
roles = val.substring(pos+1);
}
else
pwd = val;
log.fine("registering monitor user '" + name + "' having roles : " + roles + "'");
adapter.addAuthorization(name, pwd);
this.roles.put(name, roles);
}
}
else
log.info("No Users found for the monitor");
}
String xsltProcessor = get("xsltProcessor", null);
ObjectName processorName = null;
if (xsltProcessor != null) {
ContextNode contextNode = new ContextNode(ContextNode.CONTRIB_MARKER_TAG, "jmx" + ContextNode.SEP + xsltProcessor,
this.global.getContextNode());
processorName = new ObjectName(JmxWrapper.getObjectNameLiteral(this.global, contextNode));
// XSLTProcessor processor = new XSLTProcessor();
ContribXsltProcessor processor = new ContribXsltProcessor(this.roles, this.authMethod);
server.registerMBean(processor, processorName);