private Map createValueMap(MBeanElement element) { HashMap valueMap = new HashMap(); // We need to set versions here because we can't get the mbean entry // outside the server. if (element.getVersions() != null && !element.getVersions().isEmpty()) valueMap.put(VERSIONS, element.getVersions()); // The date would be used to make a presentationString for this mbean. valueMap.put(DATE, new Date(System.currentTimeMillis())); // Context class loader for the MBean. valueMap.put(ServerConstants.CLASSLOADER, ctxClassLoader); return valueMap; }
element = new MBeanElement(); element.setCode(attributeValue); element.setObject(attributeValue); element.setArchive(attributeValue); element.setCodebase(attributeValue); element.setName(attributeValue); element.setVersion(attributeValue); if (element.getCode() == null && element.getObject() == null) throw new ParseException("<" + buf.toString().replace('\n', ' ').replace('\r', ' ').replace('\t', ' ').trim() + "> is missing mandatory CODE | OBJECT attribute", 0); if (element.getArchives().size() == 0) throw new ParseException("<" + buf.toString().replace('\n', ' ').replace('\r', ' ').replace('\t', ' ').trim() + "> is missing mandatory ARCHIVE attribute", 0); element.addArg(type, value);
/** * Install a mbean with mbean metadata<p> * * @param element the data parsed from the Mlet file * * @return mbean instance */ public ObjectInstance installMBean(MBeanElement element) throws MBeanException, ReflectionException, InstanceNotFoundException, MalformedObjectNameException { log.debug("Installing MBean: " + element); ObjectInstance instance = null; ObjectName elementName = getElementName(element); if (element.getVersions().isEmpty() || !server.isRegistered(elementName)) { if (element.getCode() != null) instance = createMBean(element); else if (element.getObject() != null) instance = deserialize(element); else throw new MBeanException(new IllegalArgumentException("No code or object tag")); } else instance = updateMBean(element); return instance; }
String[] classes = element.getConstructorTypes(); String[] paramStrings = element.getConstructorValues(); Object[] params = new Object[paramStrings.length]; for (int i = 0; i < paramStrings.length; ++i) element.getCode(), loaderName, params,
MLetVersion newVersion = new MLetVersion(element.getVersions());