admin@glassfish.java.net

AMX interfaces vs internal config interfaces

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Thu, 21 Feb 2008 17:59:28 -0800

Here's an issue I have not yet resolved for V3--

For V3 domain.xml elements, we represent them with interfaces under
admin/config-api; these are the internal interfaces used by the HK2/V3
framework to represent configuration and an object implementing those
interfaces (a ConfigBean) is injected into the appropriate place.

An example of this is
com.sun.enterprise.config.serverbeans.HttpListener;:

@AMXObjectNameInfo
(j2eeType
=
com
.sun.appserv.management.base.XTypes.HTTP_LISTENER_CONFIG,nameHint="id")
@AMXConfigInfo
@Configured
public interface HttpListener extends ConfigBeanProxy, Injectable {
...
}

Now along comes AMX. AMX wants to expose everything in HttpListener
and more. So AMX does this by offering its
com.sun.appserv.management.config.HTTPListenerConfig interface; this
interface eventually results in MBeanInfo in an AMX MBean:

public interface HTTPListenerConfig extends PropertiesAccess,
NamedConfigElement, SSLConfigContainer, Enabled {...}

ISSUE — how to have AMX “inherit” the internal config interfaces

How do we avoid duplicating and/or syncing the attributes found in
HttpListener with those found in HTTPListenerConfig? In essence
HTTPListenerConfig is a superset of HttpListener (some Attribute names
might need to be reconciled). But saying "HTTPListenerConfig extends
HttpListener" won't work as a public API, because HttpListener is an
internal server detail.

To date, we exposed the AMX interfaces as a public API, dependent on
nothing else. So they can't very well extend interfaces found in
internal jar files. Or maybe they can, but we need some hard thinking
about how to arrange things. Ideally, we would write
HTTPListenerConfig as follows:

public interface HTTPListenerConfig
     extends com.sun.enterprise.config.serverbeans.HttpListener,
         PropertiesAccess, NamedConfigElement, SSLConfigContainer,
Enabled {...}

(Of course, the com.sun.enterprise.config.serverbeans package name is
out of sync with org.glassfish as well).

Complicating issues are the nice factoring that AMX does eg Enabled,
which provides get/setEnabled() for all config elements that have an
'enabled' attribute; the serverbeans interfaces don't factor anything
out like this.

TEMPORARY APPROACH

For now AMX will simply keep its interfaces as-is, which is a
duplication and maintenance issue.

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