FileDocCategorySizeDatePackage
AbstractJBossConfigBean.javaAPI DocJBoss 4.2.15675Fri Jul 13 20:52:32 BST 2007org.jboss.deployment.spi.beans

AbstractJBossConfigBean

public abstract class AbstractJBossConfigBean extends Object implements javax.enterprise.deploy.spi.DConfigBean
author
Rob Stryker
version
$Revision: 57190 $

Fields Summary
protected javax.enterprise.deploy.model.DDBean
myBean
protected ArrayList
myPropertyListeners
protected HashMap
xpaths
protected javax.enterprise.deploy.spi.DConfigBeanRoot
myRoot
protected ConfigBeanXPaths
myPath
protected ArrayList
children
Constructors Summary
public AbstractJBossConfigBean(javax.enterprise.deploy.model.DDBean bean, javax.enterprise.deploy.spi.DConfigBeanRoot root, ConfigBeanXPaths path)

      myBean = bean;
      myRoot = root;
      myPropertyListeners = new ArrayList();
      xpaths = new HashMap();
      myPath = path;
      children = new ArrayList();
		
      /*
       * 		 fill our map
       * 		 this map is to more easily parse through xpaths via map.get(string)
       * 		 rather than iterate through an arraylist until name matches
       */
		
      ConfigBeanXPaths xpathList = buildXPathList();
      Iterator i = xpathList.getChildren().iterator();
      while (i.hasNext())
      {
         ConfigBeanXPaths x = (ConfigBeanXPaths) i.next();
         xpaths.put(x.getPath(), x);
      }

   
Methods Summary
public voidaddPropertyChangeListener(java.beans.PropertyChangeListener pcl)

      myPropertyListeners.add(pcl);
   
protected abstract ConfigBeanXPathsbuildXPathList()

protected voiddeath()

      Iterator i = children.iterator();
      while (i.hasNext())
      {
         AbstractJBossConfigBean b = (AbstractJBossConfigBean) i.next();
         try
         {
            removeDConfigBean(b);
         }
         catch (BeanNotFoundException e)
         {
         }
      }
      xpaths.clear();
   
public javax.enterprise.deploy.spi.DConfigBeangetDConfigBean(javax.enterprise.deploy.model.DDBean bean)

      // get a child bean
      String path = bean.getXpath();
      ConfigBeanXPaths cPath = (ConfigBeanXPaths) xpaths.get(path);
      if (cPath == null)
      {
         return null;
      }

      AbstractJBossConfigBean retBean = new JBossNullConfigBean(bean, this.myRoot, cPath);
      children.add(retBean);
      return retBean;
   
public javax.enterprise.deploy.model.DDBeangetDDBean()

      return myBean;
   
public java.lang.StringgetPath()

      return myPath.getPath();
   
public java.lang.String[]getXpaths()


      Object[] paths = this.xpaths.values().toArray();
      String[] retval = new String[paths.length];
      for (int i = 0; i < paths.length; i++)
      {
         retval[i] = ((ConfigBeanXPaths) paths[i]).getPath();
      }
      return retval;

   
public voidnotifyDDChange(javax.enterprise.deploy.model.XpathEvent arg0)


   
public voidremoveDConfigBean(javax.enterprise.deploy.spi.DConfigBean bean)
Removes the xpath of a given configbean from the list of this bean's xpaths (children so to speak). Then calls death.

      //childList.remove(bean);
      AbstractJBossConfigBean b = ((AbstractJBossConfigBean) bean);
      Object o = xpaths.get(b.getPath());

      if (o == null)
      {
         throw new BeanNotFoundException("Not Found");
      }
      children.remove(bean);
      xpaths.remove(b.getPath());
      b.death();
   
public voidremovePropertyChangeListener(java.beans.PropertyChangeListener pcl)

      myPropertyListeners.remove(pcl);
   
public voidsave(java.util.jar.JarOutputStream stream, org.jboss.deployment.spi.DeploymentMetaData metaData)