environment.put(JMXConnector.CREDENTIALS, credentials);
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl);
// get the AdminCommandsServiceMBean
ObjectName objectName = ManagementContext.getSystemObjectName(ManagementContext.DEFAULT_DOMAIN, JBIContainer.DEFAULT_NAME, AdminCommandsServiceMBean.class);
AdminCommandsServiceMBean adminCommandsServiceMBean = (AdminCommandsServiceMBean) MBeanServerInvocationHandler.newProxyInstance(jmxConnector.getMBeanServerConnection(), objectName, AdminCommandsServiceMBean.class, true);
// list components deployed into the SMX instance
System.out.println("Components available: ");
System.out.println(adminCommandsServiceMBean.listComponents(false, false, false, null, null, null));
// list service assemblies into the SMX instance
System.out.println("Service Assemblies available: ");
System.out.println(adminCommandsServiceMBean.listServiceAssemblies(null, null, null));
// close the JMX connection.
jmxConnector.close();
}