HashMap<String, Annotation> moAnnotations = new HashMap<String, Annotation>();
moAnnotations.put(ManagementObject.class.getName(), managementObject);
ManagementDeployment mnagementDeployment = getAnnotation(ManagementDeployment.class, classInfo, metaData);
if(mnagementDeployment != null)
moAnnotations.put(ManagementDeployment.class.getName(), mnagementDeployment);
ManagementObjectID moID = getAnnotation(ManagementObjectID.class, classInfo, metaData);
if (moID != null)
moAnnotations.put(ManagementObjectID.class.getName(), moID);
// Process the ManagementObject fields
boolean isRuntime = managementObject.isRuntime();
boolean hasDefaultName = true;
String name = classInfo.getName();
String nameType = null;
String attachmentName = classInfo.getName();
Class<? extends Fields> moFieldsFactory = null;
ConstraintsPopulatorFactory moCPF = null;
Class<? extends ManagedPropertyConstraintsPopulatorFactory> moConstraintsFactory = null;
Class<? extends ManagedProperty> moPropertyFactory = null;
if (managementObject != null)
{
name = managementObject.name();
hasDefaultName = false;
if (name.length() == 0 || name.equals(ManagementConstants.GENERATED))
{
name = classInfo.getName();
hasDefaultName = true;
}
nameType = managementObject.type();
if (nameType.length() == 0)
nameType = null;
attachmentName = managementObject.attachmentName();
if (attachmentName.length() == 0)
attachmentName = classInfo.getName();
// Check for a component specification
ManagementComponent mc = null;
if (metaData != null )
mc = metaData.getAnnotation(ManagementComponent.class);
if (mc == null)
mc = managementObject.componentType();
// Work around JBMDR-51 by checking type/subtype
// if (mc.equals(AnnotationDefaults.COMP_TYPE) == false)
if (mc.type().length() > 0 || mc.subtype().length() > 0)
{
log.debug("ManagedObject("+name+") is ManagedComponent type: "+mc);
moAnnotations.put(ManagementComponent.class.getName(), mc);
}
// ManagementObject level default factory classes
FieldsFactory ff = getAnnotation(FieldsFactory.class, classInfo, metaData);
if(ff != null)
moFieldsFactory = ff.value();
moCPF = getAnnotation(ConstraintsPopulatorFactory.class, classInfo, metaData);
if(moCPF != null)
moConstraintsFactory = moCPF.value();
ManagementPropertyFactory mpf = getAnnotation(ManagementPropertyFactory.class, classInfo, metaData);
if(mpf != null)
moPropertyFactory = mpf.value();
}
if (trace)
{
log.trace("Building MangedObject(name="+name+",nameType="+nameType
+",attachmentName="+attachmentName+",isRuntime="+isRuntime+")");
}
ManagementProperties propertyType = ManagementProperties.ALL;
Set<String> classProperties = null;
if (managementObject != null)
{
propertyType = managementObject.properties();
if(propertyType == ManagementProperties.CLASS || propertyType == ManagementProperties.CLASS_AND_EXPLICIT)
{
classProperties = new HashSet<String>();
for(ManagementProperty mp : managementObject.classProperties())
{
if(mp.name().length() > 0)
classProperties.add(mp.name());
if(mp.mappedName().length() > 0)
classProperties.add(mp.mappedName());
}
}
}
// Build the ManagedProperties
Set<ManagedProperty> properties = new HashSet<ManagedProperty>();
Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
if (propertyInfos != null && propertyInfos.isEmpty() == false)
{
for (PropertyInfo propertyInfo : propertyInfos)
{
// Ignore the "class" property
if ("class".equals(propertyInfo.getName()))
continue;
ManagementProperty managementProperty = getAnnotation(ManagementProperty.class, propertyInfo, metaData);
ManagementObjectID id = getAnnotation(ManagementObjectID.class, propertyInfo, metaData);
ManagementObjectRef ref = getAnnotation(ManagementObjectRef.class, propertyInfo, metaData);
ManagementRuntimeRef runtimeRef = getAnnotation(ManagementRuntimeRef.class, propertyInfo, metaData);
RunStateProperty rsp = getAnnotation(RunStateProperty.class, propertyInfo, metaData);
Masked masked = getAnnotation(Masked.class, propertyInfo, metaData);
DefaultValueBuilderFactory defaultsFactory = getAnnotation(DefaultValueBuilderFactory.class, propertyInfo, metaData);
HashMap<String, Annotation> propAnnotations = new HashMap<String, Annotation>();
if (managementProperty != null)
propAnnotations.put(ManagementProperty.class.getName(), managementProperty);
if (id != null)
{
propAnnotations.put(ManagementObjectID.class.getName(), id);
// This overrides the MO nameType
nameType = id.type();
}
if (ref != null)
propAnnotations.put(ManagementObjectRef.class.getName(), ref);
if (runtimeRef != null)
propAnnotations.put(ManagementRuntimeRef.class.getName(), runtimeRef);