Package javax.management

Examples of javax.management.Attribute


   protected void setUp() throws Exception
   {
      super.setUp();
      ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
      Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.TRUE);
      getServer().setAttribute(aspectManager, enableTransformer);
      try
      {
         redeploy(jar);
      }
      catch(Exception e)
      {
         // Reset the EnableTransformer to false
         try
         {
            enableTransformer = new Attribute("EnableTransformer", Boolean.FALSE);
            getServer().setAttribute(aspectManager, enableTransformer);
         }
         catch(Exception ex)
         {
            getLog().error("Failed to set EnableTransformer to false", ex);
View Full Code Here


      catch(Exception e)
      {
         undeployException = e;
      }
      ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
      Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.FALSE);
      getServer().setAttribute(aspectManager, enableTransformer);
      if( undeployException != null )
         throw undeployException;
      super.tearDown();
   }
View Full Code Here

           
   }
  
   private void setStatisticsFormatter(String formatter) throws Exception{
     
      getServer().setAttribute(POOL_NAME, new Attribute(ATTRIBUTE_NAME, formatter));
     
   }
View Full Code Here

      doc.appendChild(root);
     
      // iterate over the AttributeList
      for (int i = 0; i < attrs.size(); i++) {
        
         Attribute attr = (Attribute)attrs.get(i);
      
         String name  = attr.getName();
         Object value = attr.getValue();
        
         // create the Element and decide how to fill it in
         Element element = doc.createElement(AL_ATTRIBUTE_ELEMENT);
         element.setAttribute(AL_NAME_ATTRIBUTE, name);
        
View Full Code Here

                // Process the attribute depending on how the attributes are set
               
                if (element.getAttribute(AL_NULL_ATTRIBUTE).toLowerCase().equals(AL_TRUE_VALUE)) {
                    
                   //  (a) null value - just add it to the AttributeList
                   attrs.add(new Attribute(name, null));
                }
                else if (element.getAttribute(AL_SERIALIZED_ATTRIBUTE).toLowerCase().equals(AL_TRUE_VALUE)) {
                  
                   // (b) serialized value - decode the HexString
                   String hexStr = getElementContent(element);
                   Serializable obj = decodeFromHexString(hexStr);
                  
                   if (obj == null) {
                      throw new Exception("Failed to deserialize attribute '" + name + "'");
                   }
                   else {
                      attrs.add(new Attribute(name, obj));
                   }
                }
                else {
                   String type = element.getAttribute(AL_TYPE_ATTRIBUTE);
                  
                   // type must be specified
                   if (!(type.length() > 0)) {
                      throw new Exception("Attribute '" + AL_TYPE_ATTRIBUTE +
                                          "' must be specified for name='" + name + "'");
                   }
                  
                   if (type.equals("org.w3c.dom.Element")) {

                      // (c) org.w3c.dom.Element - deep copy first Element child node found
                     
                       NodeList nlist = element.getChildNodes();
                       Element el = null;
                      
                       for (int j = 0; j < nlist.getLength(); j++) {
                         
                          Node n = nlist.item(j);
                          if (n.getNodeType() == Node.ELEMENT_NODE)
                          {
                             el = (Element)n;
                             break;
                          }
                       }
                      
                       if (el != null) {
                          attrs.add(new Attribute(name, el.cloneNode(true)));
                       }
                       else {
                          attrs.add(new Attribute(name, null));
                       }
                   }
                   else {
                      // Get the classloader for loading attribute classes.
                      ClassLoader cl = Thread.currentThread().getContextClassLoader();
                      Class clazz = null;
                     
                       try {
                          clazz = cl.loadClass(type);
                       }
                       catch (ClassNotFoundException e) {
                          throw new Exception("Class not found for attribute '" + name +
                                              "' of type '" + type + "'");
                       }

                       PropertyEditor peditor = PropertyEditorManager.findEditor(clazz);

                      if (peditor != null) {
                      
                         // (d) use a PropertyEditor - extract the value
                        
                         String value = getElementContent(element);
                         peditor.setAsText(value);
                        
                         attrs.add(new Attribute(name, peditor.getValue()));
                      }
                      else {
                         throw new Exception("Cannot find a way to load attribute '" + name +
                                             "' of type '" + type + "'");
                      }
View Full Code Here

      this.assertCorrectAttribute(namedAttributes, "passivationMinIdleTime", Long.valueOf(ClusteringDefaultsDeployer.IGNORED));
   }
  
   private void assertCorrectAttribute(Map<String, Attribute> namedAttributes, String name, Object value)
   {
      Attribute attribute = namedAttributes.get(name);
      Assert.assertNotNull("Attribute " + name + " found", attribute);
      Assert.assertEquals(name, attribute.getName());
      Assert.assertEquals(name, value, attribute.getValue());
   }
View Full Code Here

      return mbeanServer.getAttribute(objectName, getAttributeName(name));
   }
  
   public void set(String name, Object value) throws Throwable
   {
      Attribute attribute = new Attribute(getAttributeName(name), value);
      mbeanServer.setAttribute(objectName, attribute);
   }
View Full Code Here

       
        // build the result attribute list
        for (int i = 0; i < attributeNames.length; i++) {
            try {
                Object value = getAttribute((String) attributeNames[i]);
                resultList.add(new Attribute(attributeNames[i], value));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return (resultList);
View Full Code Here

        if (attributes.isEmpty())
            return resultList;
       
        // for each attribute, try to set it and add to the result list if successfull
        for (Iterator i = attributes.iterator(); i.hasNext();) {
            Attribute attr = (Attribute) i.next();
            try {
                setAttribute(attr);
                String name = attr.getName();
                Object value = getAttribute(name);
                resultList.add(new Attribute(name, value));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return (resultList);
View Full Code Here

    protected void doProcess(HttpServletRequest request) throws Exception
    {
      String maxMsg = request.getParameter(Parameters.MAX_SAVED_MESSAGES);
      if (maxMsg != null)
      {
        getConnection().setAttribute(_objectName, new Attribute("maxMessages", Integer.parseInt(maxMsg)));
      }
    }
View Full Code Here

TOP

Related Classes of javax.management.Attribute

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.