admin@glassfish.java.net

how can AMX access _at_Configured classes?

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 14 Mar 2008 16:42:06 -0700

Jerome et al,

Suppose I define a new module "chicken-farm" that uses configuration
like this:

// internal interface describing the injected configuration
@AMXConfigInfo( amxInterface=com.farming.AMXChickenFarmConfig.class )
@Configured
public interface ChickenFarm extends ConfigBeanProxy, Injectable {
     @Attribute // why do I have to annotate this anyway?
     public String getEggsToLayPerDay();
     public void setEggsToLayPerDay( String num );

     @Attribute // why do I have to annotate this anyway?
     public String getTurkeySlaughterDate();
     public void setTurkeySlaughterDate( String d );
}

// interface for use by AMX clients
public interface AMXChickenFarmConfig extends AMXConfig {
     public String getEggsToLayPerDay();
     public void setEggsToLayPerDay( String num );

     public String getTurkeySlaughterDate();
     public void setTurkeySlaughterDate( String d );
}

COMMENTS/QUESTIONS

1. COMMENT: Notice the undesirable duplication. Perhaps a base
interface could be used to factor it out, or AMXChickenFarmConfig
could extend ChickenFarm (But AMX doesn't need or want the
@Configured, @Element, or @Attribute annotations that HK2 uses, nor do
AMX clients want them, or want to have dependencies on HK2!). So
maybe this is just life. Or maybe it is AMX that should be defining
these annotations, and AMX should be a standalone jar used by HK2.

2. PROBLEM? Now the ConfigBean for 'ChickenFarm' is registered in the
Habitat. Soon, AMX comes along and wants to register an MBean
supporting AMXChickenFarmConfig corresponding to that ConfigBean.

Since the amx-impl module doesn't depend on this new module, won't the
classloader just throw a ClassNotFoundException for these classes?


Lloyd
---
Lloyd L Chambers
lloyd.chambers_at_sun.com
Sun Microsystems, Inc