There are at least two sources of metadata: annotations and xml. Whatever approach we choose to represent them, we have to define which information is added (i.e. overriding metadata complements the original) during the merge and which one is completely redefined by the overriding metadata.
For example, in case of security, should the permissions from the XML (if present) replace the permissions defined with annotations completely or extend them?
I think, in general, the answer may depend on the type of metadata in question?
There maybe even a special annotation/xml element which would say how the merge should be done? Or maybe even result in a deployment error for something that must not be overriden? Anyway, let's define the defaults.
I've been writing some tests for every metadata type. But I am still not sure about some of them and would like to clarify.
In simple words for the following types what should be a complete replacement and what should be merged as "addAll()" overriding data with the same key (customizing). I added (addAll) where it seems to me it should be.
- InvokerBindingsMetaData (allAll)
- JBossEnvironmentRefsGroupMetaData (addAll?)
- MethodAttributesMetaData (addAll)
- IgnoreDependencyMetaData (addAll)
- PoolConfigMetaData (addAll)
- JndiRefsMetaData (addAll)
- List remoteBindings
- CMPFieldsMetaData (should it be ever overriden?)
- QueriesMetaData (only cutomization of the existing)
- CacheInvalidationConfigMetaData (customize existing)
- ActivationConfigMetaData (addAll)
The following should probably be changed to Maps defining the keys for the types to make it easier identify the same metadata piece?
private List messageProperties = null;
private List producers = null;
private List localProducers = null;
- RelationsMetaData (addAll)
- LoaderRepositoryMetaData (addAll)
- WebservicesMetaData (addAll)
- JBossEnterpriseBeansMetaData (addAll)
- ResourceManagersMetaData (addAll)
- InvokerProxyBindingsMetaData (addAll)
- ContainerConfigurationsMetaData (addAll)
- Map<String, RunAsIdentityMetaData> runAsIdentity
- MethodPermissionsMetaData (addAll)
- ContainerTransactionsMetaData (addAll)
In a number of types there are fields of primitive boolean types. It may make sense to switch to the wrapper to differentiate between the default and non-set value.