I have added reflective setting of the MBeanServer and MBeanInfo for ModelMBean 
resources that support the corresponding setters:


  |    public void setResource(Object resource)
  |    {
  |       this.resource = resource;
  |       /* Pass on the MBeanInfo and MBeanServer to pojo resources if they
  |       support setMBeanServer(MBeanServer) and setMBeanInfo(MBeanInfo) methods
  |       */
  |       Class resClass = resource.getClass();
  |       // Check setMBeanServer(MBeanServer)
  |       try
  |       {
  |          Class[] sig = {MBeanServer.class};
  |          Object[] args = {server};
  |          Method setMBeanServer = resClass.getDeclaredMethod("setMBeanServer", sig);
  |          setMBeanServer.invoke(resource, args);
  |       }
  |       catch(NoSuchMethodException ignore)
  |       {
  |       }
  |       catch(Exception e)
  |       {
  |          log.trace("Failed to invoke setMBeanServer", e);
  |       }
  |       // Check setMBeanInfo(MBeanInfo)
  |       try
  |       {
  |          Class[] sig = {MBeanInfo.class};
  |          Object[] args = {info};
  |          Method setMBeanInfo = resClass.getDeclaredMethod("setMBeanInfo", sig);
  |          setMBeanInfo.invoke(resource, args);
  |       }
  |       catch(NoSuchMethodException ignore)
  |       {
  |       }
  |       catch(Exception e)
  |       {
  |          log.trace("Failed to invoke setMBeanInfo", e);
  |       }
  |    }
  | 

In general going forward with a pojo microkernel, what are we thinking about in terms 
of mapping from a particular containers (JMX, EJB, WebService, ...) metadata and 
service interfaces onto a pojo that can be used in multiple containers?


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3831105#3831105

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3831105


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to