This is a sort of “thinking aloud” and request for feedback all in one—
Background
- In V3 arbitrary modules can be loaded, including ones designed and
compiled after the product ships
- AMX supports configuration MBeans for such modules automagically
with a simple annotation on the @Configured interface supplied by the
module
In V2, AMX supported creation of sub-elements with createAbc() methods
that included a parameter list with explicit parameters for required
values and optional parameters provided in a Map<String,String>.
Here are a few examples from DomainConfig:
createStandaloneServerConfig(String name, String nodeAgentName, String
configName, Map<String,String> optional);
createConfigConfig( String name, Map<String,String> optional );
createLoadBalancerConfig(String name, String lbConfigName, boolean
autoApplyEnabled, Map<String,String> optional);
createJNDIResourceConfig( String jndiName, String jndiLookupName,
String resType, String factoryClass, Map<String,String> optional);
createJDBCConnectionPoolConfig( String name,
String connectionValidationMethod,
String datasourceClassname,
boolean failAllConnections,
int idleTimeoutSeconds,
boolean connectionValidationRequired,
boolean isolationLevelGuaranteed,
String transactionIsolationLevel,
int maxPoolSize,
int maxWaitTimeMillis,
int poolResizeQuantity,
String resType,
int steadyPoolSize,
String databaseName,
String databaseUserName,
String databasePassword,
Map<String,String> reservedForFutureUse );
Question: In Glassfish V3, should AMX preserve methods like the ones
shown above?
(and allow/support such methods in new/unknown AMX interfaces supplied
by arbitrary modules)
I think the answer is “yes”, so long as the backend can implement this
support generically: AMX needs to be able to turn the parameter list
into a generic form (eg a Map) which can be generically set on a
ConfigBean. AMX can supply the “glue” code to transform the explicit
and optional parameters into a form which can be used to set values on
a ConfigBean eg:
public MyConfig createContainee( final String j2eeType, final
Map<String,String> values );
implemented by:
final ConfigBean configBean =
instantiateConfigBeanForJ2EEType( j2eeType );
for( final String fieldName : values.keySet() ) {
configBean.attribute( amxNameToXmlName( fieldName ),
values.get( fieldName ) );
}
Fortunately, the j2eeType value is found in the @AMXConfigInfo, so
this all ought to work OK.
Lloyd