Do websphere enables other APIs to discover the applications ports?
Thanks,
Yoel
I'm not sure what you mean with discover your application ports. But if you are already running inside WebSphere you could use;
AdminService adminService = AdminServiceFactory.getAdminService();
to get an AdminService object for your local JVM. You can then do the same thing as you can with the AdminClient object, but only within your local JVM. The AdminClient object is used when you want to access remote MBeans.
Please explain some more if this is not what you mean.
Br,
Jimmy
Look at some sample code of how to get the http/s ports from the configuration:
//create a session
Session session = new Session();
//get a ConfigService object
ConfigService cfgService = ConfigServiceFactory.getConfigService();
//resolve your application server from the configuration
ObjectName[] appServers = cfgService.resolve(session, "Node=someNodeName:Server=someAppServerName");
//create a pattern to find the HTTPTransport configuration for you application server
ObjectName pattern = ConfigServiceHelper.createObjectName(null, "HTTPTransport");
//query the configuration to get the http transport values
ObjectName[] httpTransports = cfgService.queryConfigObjects(session, appServers[0], pattern, null);
//loop the result to get the configuration of your ports
for (int i = 0; i < httpTransports.length; i++) {
AttributeList address = (AttributeList) cfgService.getAttribute(session, httpTransports[i], "address");
Object port = ConfigServiceHelper.getAttributeValue(address, "port");
Object isSSL = cfgService.getAttribute(session, httpTransports[i], "sslEnabled");
System.out.println("Port is " + port + ". Is secure = " + isSSL);
}
//cleanup session
cfgService.discard(session);