Package javax.management

Examples of javax.management.MBeanAttributeInfo


   private MBeanAttributeInfo[] deepCopy(MBeanAttributeInfo[] attrs)
   {
      MBeanAttributeInfo[] copy = new MBeanAttributeInfo[attrs.length];
      for (int i = 0; i < attrs.length; i++)
      {
         MBeanAttributeInfo attr = attrs[i];
         copy[i] = new MBeanAttributeInfo(
               attr.getName(),
               attr.getType(),
               attr.getDescription(),
               attr.isReadable(),
               attr.isWritable(),
               attr.isIs());
      }
      return copy;
   }
View Full Code Here


            String attribute = getter.substring(3);
            String setter = "set" + attribute;

            Method setterMethod = (Method)writeAttr.remove(setter);
            attrs.add (new MBeanAttributeInfo (attribute, "", getterMethod, setterMethod));
         }

         // we  add the remaining WO attributes
         //
         Iterator writeKeys = writeAttr.keySet().iterator();
         while (writeKeys.hasNext())
         {
            String setter = (String)writeKeys.next();
            Method setterMethod = (Method)writeAttr.get( setter );
            String attribute = setter.substring(3);

            attrs.add (new MBeanAttributeInfo (attribute, "", null, setterMethod));
         }


         result = new MBeanInfo(this.name,
                           "Dynamic MBean Service around BSH script " + this.name,
View Full Code Here

         super(BrokenDynamicMBeanAttributeInfoTypeNotFound.class.getName(), "Broken", null, null, null, null);
      }

      public MBeanAttributeInfo[] getAttributes()
      {
         MBeanAttributeInfo[] result = { new MBeanAttributeInfo("Name", "TYPEDOESNOTEXIST", "Broken", true, true, false) };
         return result;
      }
View Full Code Here

      MBeanInfo info = server.getMBeanInfo(objName);
      MBeanAttributeInfo[] attributesInfo = info.getAttributes();
      AttributeList newAttributes = new AttributeList();
      for(int a = 0; a < attributesInfo.length; a ++)
      {
         MBeanAttributeInfo attrInfo = attributesInfo[a];
         String attrName = attrInfo.getName();
         if( attributes.containsKey(attrName) == false )
            continue;
         String value = (String) attributes.get(attrName);
         if (value.equals("null") && server.getAttribute(objName, attrName) == null) {
            log.trace("ignoring 'null' for " + attrName);
            continue;
         }
         String attrType = attrInfo.getType();
         Attribute attr = null;
         try
         {
            Object realValue = PropertyEditors.convertValue(value, attrType);
            attr = new Attribute(attrName, realValue);
View Full Code Here

      // Initialize the mbean using the configuration supplied defaults
      MBeanAttributeInfo[] attributes = info.getAttributes();
      HashMap<String, MBeanAttributeInfo> attributeMap = new HashMap<String, MBeanAttributeInfo>();
      for (int i = 0; i < attributes.length; i++)
      {
         MBeanAttributeInfo attr = attributes[i];
         attributeMap.put(attr.getName(), attr);
      }

      NodeList attrs = mbeanElement.getChildNodes();
      for (int j = 0; j < attrs.getLength(); j++)
      {
         // skip over non-element nodes
         if (attrs.item(j).getNodeType() != Node.ELEMENT_NODE)
         {
            continue;
         }

         Element element = (Element) attrs.item(j);

         boolean replace = true;

         // Set attributes
         if (element.getTagName().equals("attribute"))
         {
            String attributeName = element.getAttribute("name");
            boolean trim = true;
            String replaceAttr = element.getAttribute("replace");
            if (replaceAttr.length() > 0)
               replace = Boolean.valueOf(replaceAttr).booleanValue();
            String trimAttr = element.getAttribute("trim");
            if (trimAttr.length() > 0)
               trim = Boolean.valueOf(trimAttr).booleanValue();
            String serialDataType = element.getAttribute("serialDataType");

            // Get the MBeanAttributeInfo
            MBeanAttributeInfo attr = attributeMap.get(attributeName);
            if (attr == null)
               throw new DeploymentException("No Attribute found with name: " + attributeName);

            if (element.hasChildNodes())
            {
               Object value = null;
               // Unmarshall the attribute value based on the serialDataType
               if (serialDataType.equals("javaBean"))
                  value = parseJavaBeanSerialData(attr, cl, element, replace, trim);
               else if (serialDataType.equals("jbxb"))
                  value = parseJbxbSerialData(attr, cl, element, replace, trim);
               else
                  value = parseTextSerialData(attr, cl, element, replace, trim);
              
               log.debug(attributeName + " set to " + value + " in " + objectName);
               setAttribute(objectName, new Attribute(attributeName, value));
            }//if has children

         }
         //end of "attribute
         else if (element.getTagName().equals("depends"))
         {
            if (!element.hasChildNodes())
            {
               throw new DeploymentException("No ObjectName supplied for depends in  " + objectName);
            }

            String mbeanRefName = element.getAttribute("optional-attribute-name");
            if ("".equals(mbeanRefName))
               mbeanRefName = null;
            else
               mbeanRefName = StringPropertyReplacer.replaceProperties(mbeanRefName);

            String proxyType = element.getAttribute("proxy-type");
            if ("".equals(proxyType))
               proxyType = null;
            else
               proxyType = StringPropertyReplacer.replaceProperties(proxyType);

            // Get the mbeanRef value
            ObjectName dependsObjectName = processDependency(objectName, loaderName, element, mbeans, replace);
            log.debug("considering " + ((mbeanRefName == null) ? "<anonymous>" : mbeanRefName.toString()) + " with object name " + dependsObjectName);

            if (mbeanRefName != null)
            {
               Object attribute = dependsObjectName;
               if (proxyType != null)
               {
                  if (mbeanRefName == null)
                     throw new DeploymentException("You cannot use a proxy-type without an optional-attribute-name");
                  if (proxyType.equals("attribute"))
                  {
                     MBeanAttributeInfo attr = attributeMap.get(mbeanRefName);
                     if (attr == null)
                        throw new DeploymentException("No Attribute found with name: " + mbeanRefName);
                     proxyType = attr.getType();
                  }
                  Class proxyClass = cl.loadClass(proxyType);
                  attribute = MBeanProxyExt.create(proxyClass, dependsObjectName,
                     server, true);
               }
View Full Code Here

         super(BrokenDynamicMBeanNoAttributeInfoType.class.getName(), "Broken", null, null, null, null);
      }

      public MBeanAttributeInfo[] getAttributes()
      {
         MBeanAttributeInfo[] result = { new MBeanAttributeInfo("Name", null, "Broken", true, true, false) };
         return result;
      }
View Full Code Here

        System.out.println("loadConfiguration called:"+name);
       
        // test if MBean has been already loaded
        // it can also be tested asking directly to MBeanServer
        for (int i = 0; i < alAttributes.size(); i++) {
            MBeanAttributeInfo mai = (MBeanAttributeInfo) alAttributes.get(i);
            if (mai.getName().equalsIgnoreCase("configuration=" + name))
                return null; // shoud throw an exception??
        }
       
        return registerConfigurationMBean(name);
    }
View Full Code Here

            new ConfigurationDynamicMBean(configurationObjectName, name);
            server.registerMBean(configurationMBean, configurationObjectName);
           
            // tenemos un atributo nuevo
            alAttributes
            .add(new MBeanAttributeInfo(
            "configuration=" + name,
            "javax.management.ObjectName",
            "The " + name + " configuration.",
            true,
            true,
View Full Code Here

        "CategoryDynamicMBean(): Constructs a CategoryDynamicMBean instance",
        constructors[0]);

    // categoryName   
    alAttributes.add(
      new MBeanAttributeInfo(
        "name",
        "java.lang.String",
        "The name of this Category.",
        true,
        false,
        false));

    // now we have to crate one attribute per property found
    Configuration configuration =
      ConfigurationManager.getConfiguration(configurationName);
    Category category = configuration.getCategory(categoryName);
    Properties properties = category.getProperties();
    Enumeration propertiesEnum = properties.keys();

    while (propertiesEnum.hasMoreElements()) {

      String propertyName = (String) propertiesEnum.nextElement();

      alAttributes
        .add(new MBeanAttributeInfo(
          propertyName,
          "java.lang.String",
          "The name of this Property.",
          true,
          true,
View Full Code Here

        new MBeanConstructorInfo(
        "ConfigurationDynamicMBean(): Constructs a ConfigurationDynamicMBean instance",
        constructors[0]);
       
        alBasicAttributes.add(
        new MBeanAttributeInfo(
        "name",
        "java.lang.String",
        "The name of this Configuration.",
        true,
        false,
View Full Code Here

TOP

Related Classes of javax.management.MBeanAttributeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.