/*
 * JBoss, Home of Professional Open Source
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package org.jboss.test.xml.mbeanserver;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

/**
 * An encapsulation of the mbean deployment data
 * 
 * @author Scott.Stark@jboss.org
 * @version $Revision: 1.2 $
 */
public class MBeanData
{
   /** mbean/@name */
   private String name;
   /** mbean/@code */
   private String code;
   /** mbean/attribute == ArrayList<javax.management.Attribute> */
   private ArrayList attributes = new ArrayList();
   /** mbean/depends == ArrayList<javax.management.ObjectName> */
   private ArrayList depends = new ArrayList();

   public String getName()
   {
      
      return name;
   }

   public void setName(String name)
   {
      this.name = name;
   }

   public String getCode()
   {
      return code;
   }

   public void setCode(String code)
   {
      this.code = code;
   }

   public List getAttributes()
   {
      return attributes;
   }

   public void setAttributes(List attributes)
   {
      this.attributes.clear();
      this.attributes.addAll(attributes);
   }

   public List getDepends()
   {
      return depends;
   }
   public void setDepends(List depends)
   {
      this.depends.clear();
      this.depends.addAll(depends);
   }

   public Map getAttributeMap()
   {
      HashMap map = new HashMap();
      for(int n = 0; n < attributes.size(); n ++)
      {
         MBeanAttribute attr = (MBeanAttribute) attributes.get(n);
         map.put(attr.getName(), attr);
      }
      return map;
   }
}
