//Create the new node controller
NodeAgent controller = new NodeAgent();
controller.setName(nodeAgentName);
ElementProperty rendezvousProperty = new ElementProperty();
rendezvousProperty.setName(RENDEZVOUS_PROPERTY_NAME);
rendezvousProperty.setValue(rendezvousOccurred.toString());
controller.addElementProperty(rendezvousProperty);
JmxConnector connector = new JmxConnector();
connector.setName(SYSTEM_CONNECTOR_NAME);
connector.setAddress(host);
connector.setPort(port);
connector.setProtocol(protocol);
Ssl ssl = new Ssl();
ssl.setCertNickname(KeystoreManager.CERTIFICATE_ALIAS);
connector.setSsl(ssl);
ElementProperty hostnameProperty = new ElementProperty();
hostnameProperty.setName(HOST_PROPERTY_NAME);
hostnameProperty.setValue(clientHostName);
connector.addElementProperty(hostnameProperty);
//ISSUE: Not sure how to set the realm name here??? The realm name in the jmx-connector
//element refers to a realm in the security-service which is associated with a configuration.
//Unfortunately, the node-agent does not reference a configuration!!!!!!
connector.setAuthRealmName("admin-realm");
controller.setJmxConnector(connector);
// TODO: need to reconcile authrealms ???
AuthRealm[] authRealms = new AuthRealm[1];
authRealms[0]=new AuthRealm();
authRealms[0].setName("admin-realm");
authRealms[0].setClassname("com.sun.enterprise.security.auth.realm.file.FileRealm");
ElementProperty fileProperty = new ElementProperty();
fileProperty.setName("file");
fileProperty.setValue("${com.sun.aas.instanceRoot}/config/admin-keyfile");
authRealms[0].addElementProperty(fileProperty);
ElementProperty jaasContextProperty = new ElementProperty();
jaasContextProperty.setName("jaas-context");
jaasContextProperty.setValue("fileRealm");
authRealms[0].addElementProperty(jaasContextProperty);
controller.setAuthRealm(authRealms[0]);
controller.setSystemJmxConnectorName(SYSTEM_CONNECTOR_NAME);