dev@glassfish.java.net

using AMX and *not* hard-coding ObjectNames

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Mon, 29 Jun 2009 14:31:09 -0700

If you're writing or using AMX MBeans, be sure to not hard-code
ObjectNames.

Obviously, code outside glassfish v3 cannot avoid this issue, but for
code in the V3 source base, use th constants in common/glassfish-api
org.glassfish.api.amx.AMXLoader can be used to avoid some problems.
Namely the JMX domain is defined.

I'll look into an even simpler solution so that one can just inject
things.

Lloyd


@Contract
public interface AMXLoader
{
     public static final String AMX_JMX_DOMAIN = "v3";

     public static final String AMX3_SUPPORT_DOMAIN = AMX_JMX_DOMAIN +
"-support";
     public static String LOADER_PREFIX = AMX3_SUPPORT_DOMAIN +
":type=amx-loader,name=";

     /** ObjectName prefix for the loader MBean itself */
     public static String LOADER_OLD_PREFIX = "amx-support:type=amx-
loader,name=";

     /**
         Loader a hierarchy of AMX MBeans, returning the ObjectName of
the root
         of the hierarchy.
      */
     public ObjectName loadAMXMBeans();

     /**
         Unload (unregister) AMX MBeans.
      */
     public void unloadAMXMBeans();
}




Lloyd Chambers
lloyd.chambers_at_sun.com
GlassFish Team