Package javax.management

Examples of javax.management.MBeanAttributeInfo


   public static Object type(MBeanInfo mbeanInfo, String attributeName, String valueAsString)
      throws Exception
   {
      MBeanAttributeInfo[] attrs = mbeanInfo.getAttributes();
      MBeanAttributeInfo attr = null;

      for(int i = 0; i < attrs.length; i++)
      {
         if (attrs[i].getName().equals(attributeName))
         {
            attr = attrs[i];
            break;
         }
      }

      if (attr == null)
      {
         throw new Exception("No such attribute: " + attributeName);
      }

      String type = attr.getType();

      if ("int".equals(type) || "java.lang.Integer".equals(type))
      {
         int i = Integer.parseInt(valueAsString);
         return new Integer(i);
View Full Code Here


   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

      out.println("Description: "+mbeanInfo.getDescription());
      out.println("+++ Attributes:");
      int length = attrInfo != null ? attrInfo.length : 0;
      for(int n = 0; n < length; n ++)
      {
         MBeanAttributeInfo info = attrInfo[n];
         out.print(" Name: ");
         out.println(info.getName());
         out.print(" Type: ");
         out.println(info.getType());
         String rw = "";
         if( info.isReadable() )
            rw = "r";
         else
            rw = "-";
         if( info.isWritable() )
            rw += "w";
         else
            rw += "-";
         out.print(" Access: ");
         out.println(rw);
      }

      out.println("+++ Operations:");
      length = opInfo != null ? opInfo.length : 0;
      for(int n = 0; n < length; n ++)
      {
         MBeanOperationInfo info = opInfo[n];
         out.print(' ');
         out.print(info.getReturnType());
         out.print(' ');
         out.print(info.getName());
         out.print('(');
         MBeanParameterInfo[] sig = info.getSignature();
         for(int s = 0; s < sig.length; s ++)
         {
            out.print(sig[s].getType());
            out.print(' ');
            out.print(sig[s].getName());
View Full Code Here

         attributeNames.clear();
         MBeanInfo info = server.getMBeanInfo(objectName);
         MBeanAttributeInfo[] attrInfos = info.getAttributes();
         for (int a = 0; a < attrInfos.length; a++)
         {
            MBeanAttributeInfo attrInfo = attrInfos[a];
            if (attrInfo.isReadable())
               attributeNames.add(attrInfo.getName());
         }
      }

      String[] names = new String[attributeNames.size()];
      attributeNames.toArray(names);
View Full Code Here

    MBeanInfo info = server.getMBeanInfo(objectName);
   
    MBeanAttributeInfo[] attrs = info.getAttributes();
   
    MBeanAttributeInfo attr=null;

    boolean found = false;
    for (int i=0;i < attrs.length ; i++ )
    {     
      if (attrs[i].getName().equals(theAttr) &&
        attrs[i].isWritable()) {
       
          found=true;
          attr= attrs[i];
          break;
        }
    }
   
    if (found == false)
    {
     
      throw new CommandException("No matching attribute found");
    }
    else
    {
      Object oVal = convert(theVal,attr.getType());
      Attribute at = new Attribute(theAttr,oVal);
      server.setAttribute(objectName,at);
     
      // read the attribute back from the server
      if (!context.isQuiet())
View Full Code Here

   @Override
   protected MBeanAttributeInfo[] getInternalAttributeInfo()
   {
      List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
      attributes.add(new MBeanAttributeInfo("RARName", String.class.getName(), "The ResourceAdapter deployment name.", true, false, false));
      attributes.add(new MBeanAttributeInfo("OldRarDeployment", javax.management.ObjectName.class.getName(), "The Connection Defintion class name.", true, true, false));
      attributes.add(new MBeanAttributeInfo("ConnectionDefinition", String.class.getName(), "The Connection Defintion class name.", true, false, false));
      attributes.add(new MBeanAttributeInfo("VendorName", String.class.getName(), "The Vendor Name.", true, false, false));
      attributes.add(new MBeanAttributeInfo("SpecVersion", String.class.getName(), "The Specification Version.", true, false, false));
      attributes.add(new MBeanAttributeInfo("EisType", String.class.getName(), "The Enterprise Information System type.", true, false, false));
      attributes.add(new MBeanAttributeInfo("Version", String.class.getName(), "The ResourceAdapter version.", true, false, false));
      attributes.add(new MBeanAttributeInfo("ManagedConnectionFactoryClass", String.class.getName(), "The ManagedConnectionFactory class", true, false, false));
      attributes.add(new MBeanAttributeInfo("ConnectionFactoryImpl", String.class.getName(), "The Connection Factory implementation", true, false, false));
      attributes.add(new MBeanAttributeInfo("ConnectionInterface", String.class.getName(), "The Connection Inteface", true, false, false));
      attributes.add(new MBeanAttributeInfo("ConnectionImplClass", String.class.getName(), "The Connection Implementation class", true, false, false));
      attributes.add(new MBeanAttributeInfo("TransactionSupport", String.class.getName(), "The Transaction Support", true, false, false));
      attributes.add(new MBeanAttributeInfo("AuthenticationMechanismType", String.class.getName(), "The Authentication Mechanism Type", true, false, false));
      attributes.add(new MBeanAttributeInfo("CredentialInterface", String.class.getName(), "The Credential Interface", true, false, false));
      attributes.add(new MBeanAttributeInfo("ReauthenticationSupport", Boolean.class.getName(), "The Reauthentication Support", true, false, true));
      attributes.add(new MBeanAttributeInfo("McfInstance", "javax.resource.spi.ManagedConnectionFactory", "The ManagedConnectionFactory instance", true, false, false));
      attributes.add(new MBeanAttributeInfo("XAResourceRecoveryRegistry", XAResourceRecoveryRegistry.class.getName(), "The XAResource Recovery Registry", true, false, false));
      attributes.add(new MBeanAttributeInfo("SubjectFactory", SubjectFactory.class.getName(), "The subject factory used for recovery", true, false, false));
      attributes.add(new MBeanAttributeInfo("ConnectionManager", String.class.getName(), "The connection manager object name", true, false, false));
     
//      ConnectionDefinitionMetaData cdmd = cmd.getConnectionDefinition(this.connectionDefinition);
     
//      Collection mcfProps = cdmd.getProperties();
//     
View Full Code Here

   protected MBeanAttributeInfo[] getInternalAttributeInfo()
   {
      Collection<ConfigPropertyMetaData> properties = cmd.getProperties();
      MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[13+properties.size()];
      attrs[0] = new MBeanAttributeInfo("MetaData", ConnectorMetaData.class.getName(), "The meta data", true, false, false);
      attrs[1] = new MBeanAttributeInfo("AuthenticationMechanism", String.class.getName(), "The authentication mechanism", true, false, false);
      attrs[2] = new MBeanAttributeInfo("EISType", String.class.getName(), "The EIS type", true, false, false);
      attrs[3] = new MBeanAttributeInfo("License", String.class.getName(), "The license", true, false, false);
      attrs[4] = new MBeanAttributeInfo("RAClass", String.class.getName(), "The resource adapter class", true, false, false);
      attrs[5] = new MBeanAttributeInfo("RAVersion", String.class.getName(), "The resource adapter version", true, false, false);
      attrs[6] = new MBeanAttributeInfo("TransactionSupport", String.class.getName(), "The transaction support", true, false, false);
      attrs[7] = new MBeanAttributeInfo("VendorName", String.class.getName(), "The vendor name", true, false, false);
      attrs[8] = new MBeanAttributeInfo("Version", String.class.getName(), "The spec version", true, false, false);
      attrs[9] = new MBeanAttributeInfo("ReauthenticationSupport", Boolean.TYPE.getName(), "Whether reauthentication support is supported", true, false, false);
      attrs[10] = new MBeanAttributeInfo("ResourceAdapter", ResourceAdapter.class.getName(), "The resource adapter instance", true, false, false);
      attrs[11] = new MBeanAttributeInfo("WorkManager", WorkManager.class.getName(), "The work manager", true, true, false);
      attrs[12] = new MBeanAttributeInfo("XATerminator", XATerminator.class.getName(), "The xa terminator", true, true, false);
      int n = 13;
      for (ConfigPropertyMetaData cpmd : properties)
      {
         attrs[n++] = new MBeanAttributeInfo(cpmd.getName(), cpmd.getType(), cpmd.getDescription().getDescription(), true, false, false);
      }
      return attrs;
   }
View Full Code Here

      // attributes
      if (attrs.length > 0)
      {
         for (int i = 0; i < attrs.length; i++)
         {
            MBeanAttributeInfo attrInfo = attrs[i];
           
            // determine access, rw by default
            String access = "read-write";
            access = attrInfo.isReadable() ? access : "write-only";
            access = attrInfo.isWritable() ? access : "read-only";
            String accessString = " access='" + access + "'";

            // determine get method, if any
            String getMethodString = "";
            if (attrInfo.isReadable())
            {
               getMethodString = " getMethod='" +
                  (attrInfo.isIs() ? "is" : "get") + attrInfo.getName() + "'"
            }
           
            // determine set method, if any
            String setMethodString = "";
            if (attrInfo.isWritable())
            {
               setMethodString = " setMethod='set" + attrInfo.getName() + "'";
              
            }
           
            out.println("   <attribute" + accessString + getMethodString + setMethodString + ">");
            out.println("      <description>" + attrInfo.getDescription() + "</description>");
            out.println("      <name>" + attrInfo.getName() + "</name>");
            out.println("      <type>" + attrInfo.getType() + "</type>");
            out.println("   </attribute>");
         }
         out.println();
      }
     
View Full Code Here

      String type;
      AttributeList attrs = new AttributeList(attributeNames.size());
      Attribute attr;
      String attr_name;
      Object attr_value, real_value;
      MBeanAttributeInfo attr_info;


      for (Iterator it = attributeNames.iterator(); it.hasNext();)
      {
         attr_name = (String) it.next();
         attr_value = it.next();

         attr_info = findAttribute(attr_name, attribute_info);
         if (attr_info == null)
            throw new CommandException("attribute " + attr_name + " not found");
         type = attr_info.getType();

         PropertyEditor editor = PropertyEditors.getEditor(type);
         editor.setAsText((String) attr_value);
         real_value = editor.getValue();
View Full Code Here

   private MBeanAttributeInfo findAttribute(String attr_name,
      MBeanAttributeInfo[] attribute_info)
   {
      for (int i = 0; i < attribute_info.length; i++)
      {
         MBeanAttributeInfo mBeanAttributeInfo = attribute_info[i];
         if (mBeanAttributeInfo.getName().equals(attr_name))
            return mBeanAttributeInfo;
      }
      return null;
   }
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.