Date: 2004-07-20T17:22:32 Editor: GiannyDamour <[EMAIL PROTECTED]> Wiki: Apache Geronimo Wiki Page: GBeans URL: http://wiki.apache.org/geronimo/GBeans
no comment Change Log: ------------------------------------------------------------------------------ @@ -89,6 +89,32 @@ == What does the GBeanInfo class represent? == == Can I configure my GBean using a flat file? == == How do I manage the attributes of my GBean remotely? == +GBeans are exposed as MBeans via the JMX kernel. Hence, it is possible to control/query them as we would have control “standard” MBeans. + +For instance, to manage a given MBean remotely, it is possible to leverage the Java Management Extensions Remote API(JSR 160), which is supported by Geronimo. + +More accurately, two services need to be up and running in order to enable the RMI Connector defined by JSR 160 on the server-side: + + * ''org.apache.geronimo.system.RMIRegistryService'': starts a RMI registry on the specified port. This service is part of the "system" plan, in other words it is always started; and + * ''org.apache.geronimo.jmxremoting.JMXConnector'': it creates a RMI Connector server and exports it to the RMI registry embedded in its URL (see JSR 160 for more details about the format of the URL). You can have a look to the ''j2ee-server'' plan for more details on its GBean definition. + + +If the two above services are running, then the following snippet will get you an ''MBeanServerConnection'': +{{{ + Map environment = new HashMap(); + String[] credentials = new String[]{<username>, <password>}; + environment.put(JMXConnector.CREDENTIALS, credentials); + + JMXServiceURL address = new JMXServiceURL(<URI defined by the JMXConnector service>); + JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment); + MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection(); +}}} + +Note: ''username'' and ''password'' must be defined by the ''org.apache.geronimo.security.jaas.ConfigurationEntry'' having the name defined by the ''applicationConfigName'' attribute of the ''org.apache.geronimo.jmxremoting.JMXConnector'' service. + +Having said that, if you do not want to write code, you can also use a JMX console supporting JSR 160. + + there are more to come :)