home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / beans / beancontext / BeanContextSupport.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  12.9 KB  |  803 lines

  1. package java.beans.beancontext;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.beans.Beans;
  6. import java.beans.PropertyChangeEvent;
  7. import java.beans.PropertyChangeListener;
  8. import java.beans.PropertyVetoException;
  9. import java.beans.VetoableChangeListener;
  10. import java.beans.Visibility;
  11. import java.io.IOException;
  12. import java.io.InputStream;
  13. import java.io.ObjectInputStream;
  14. import java.io.ObjectOutputStream;
  15. import java.io.Serializable;
  16. import java.net.URL;
  17. import java.util.ArrayList;
  18. import java.util.Collection;
  19. import java.util.EventObject;
  20. import java.util.HashMap;
  21. import java.util.Iterator;
  22. import java.util.Locale;
  23. import java.util.Map;
  24.  
  25. public class BeanContextSupport extends BeanContextChildSupport implements BeanContext, Serializable, PropertyChangeListener, VetoableChangeListener {
  26.    static final long serialVersionUID = -4879613978649577204L;
  27.    protected transient HashMap children;
  28.    private int serializable;
  29.    protected transient ArrayList bcmListeners;
  30.    protected Locale locale;
  31.    protected boolean okToUseGui;
  32.    protected boolean designTime;
  33.    private transient PropertyChangeListener childPCL;
  34.    private transient VetoableChangeListener childVCL;
  35.    private transient boolean serializing;
  36.  
  37.    public BeanContextSupport(BeanContext var1, Locale var2, boolean var3, boolean var4) {
  38.       super(var1);
  39.       this.serializable = 0;
  40.       this.locale = var2 != null ? var2 : Locale.getDefault();
  41.       this.designTime = var3;
  42.       this.okToUseGui = var4;
  43.       this.initialize();
  44.    }
  45.  
  46.    public BeanContextSupport(BeanContext var1, Locale var2, boolean var3) {
  47.       this(var1, var2, var3, true);
  48.    }
  49.  
  50.    public BeanContextSupport(BeanContext var1, Locale var2) {
  51.       this(var1, var2, false, true);
  52.    }
  53.  
  54.    public BeanContextSupport(BeanContext var1) {
  55.       this(var1, (Locale)null, false, true);
  56.    }
  57.  
  58.    public BeanContextSupport() {
  59.       this((BeanContext)null, (Locale)null, false, true);
  60.    }
  61.  
  62.    public BeanContext getBeanContextPeer() {
  63.       return (BeanContext)((BeanContextChildSupport)this).getBeanContextChildPeer();
  64.    }
  65.  
  66.    public Object instantiateChild(String var1) throws IOException, ClassNotFoundException {
  67.       BeanContext var2 = this.getBeanContextPeer();
  68.       return Beans.instantiate(var2.getClass().getClassLoader(), var1, var2);
  69.    }
  70.  
  71.    public int size() {
  72.       HashMap var1 = this.children;
  73.       synchronized(var1) {
  74.          int var2 = this.children.size();
  75.          return var2;
  76.       }
  77.    }
  78.  
  79.    public boolean isEmpty() {
  80.       HashMap var1 = this.children;
  81.       synchronized(var1) {
  82.          boolean var2 = this.children.isEmpty();
  83.          return var2;
  84.       }
  85.    }
  86.  
  87.    public boolean contains(Object var1) {
  88.       HashMap var2 = this.children;
  89.       synchronized(var2) {
  90.          boolean var3 = this.children.containsKey(var1);
  91.          return var3;
  92.       }
  93.    }
  94.  
  95.    public boolean containsKey(Object var1) {
  96.       HashMap var2 = this.children;
  97.       synchronized(var2) {
  98.          boolean var3 = this.children.containsKey(var1);
  99.          return var3;
  100.       }
  101.    }
  102.  
  103.    public Iterator iterator() {
  104.       HashMap var1 = this.children;
  105.       synchronized(var1) {
  106.          BCSIterator var2 = new BCSIterator(this.children.keySet().iterator());
  107.          return var2;
  108.       }
  109.    }
  110.  
  111.    public Object[] toArray() {
  112.       HashMap var1 = this.children;
  113.       synchronized(var1) {
  114.          Object[] var2 = this.children.keySet().toArray();
  115.          return var2;
  116.       }
  117.    }
  118.  
  119.    public Object[] toArray(Object[] var1) {
  120.       HashMap var2 = this.children;
  121.       synchronized(var2) {
  122.          Object[] var3 = this.children.keySet().toArray(var1);
  123.          return var3;
  124.       }
  125.    }
  126.  
  127.    protected BCSChild createBCSChild(Object var1, Object var2) {
  128.       return new BCSChild(this, var1, var2);
  129.    }
  130.  
  131.    public boolean add(Object var1) {
  132.       if (var1 == null) {
  133.          throw new IllegalArgumentException();
  134.       } else if (this.children.containsKey(var1)) {
  135.          return false;
  136.       } else {
  137.          Object var2 = BeanContext.globalHierarchyLock;
  138.          synchronized(var2) {
  139.             if (this.children.containsKey(var1)) {
  140.                boolean var3 = false;
  141.                return var3;
  142.             } else if (!this.validatePendingAdd(var1)) {
  143.                throw new IllegalStateException();
  144.             } else {
  145.                BeanContextChild var4 = getChildBeanContextChild(var1);
  146.                BeanContextChild var5 = null;
  147.                synchronized(var1) {
  148.                   if (var1 instanceof BeanContextProxy) {
  149.                      var5 = ((BeanContextProxy)var1).getBeanContextProxy();
  150.                      if (var5 == null) {
  151.                         throw new NullPointerException("BeanContextPeer.getBeanContextProxy()");
  152.                      }
  153.                   }
  154.  
  155.                   BCSChild var7 = this.createBCSChild(var1, var5);
  156.                   BCSChild var8 = null;
  157.                   HashMap var9 = this.children;
  158.                   synchronized(var9) {
  159.                      this.children.put(var1, var7);
  160.                      if (var5 != null) {
  161.                         this.children.put(var5, var8 = this.createBCSChild(var5, var1));
  162.                      }
  163.                   }
  164.  
  165.                   if (var4 != null) {
  166.                      synchronized(var4) {
  167.                         try {
  168.                            var4.setBeanContext(this.getBeanContextPeer());
  169.                         } catch (PropertyVetoException var18) {
  170.                            HashMap var12 = this.children;
  171.                            synchronized(var12) {
  172.                               this.children.remove(var1);
  173.                               if (var5 != null) {
  174.                                  this.children.remove(var5);
  175.                               }
  176.                            }
  177.  
  178.                            throw new IllegalStateException();
  179.                         }
  180.  
  181.                         var4.addPropertyChangeListener("beanContext", this.childPCL);
  182.                         var4.addVetoableChangeListener("beanContext", this.childVCL);
  183.                      }
  184.                   }
  185.  
  186.                   Visibility var11 = getChildVisibility(var1);
  187.                   if (var11 != null) {
  188.                      if (this.okToUseGui) {
  189.                         var11.okToUseGui();
  190.                      } else {
  191.                         var11.dontUseGui();
  192.                      }
  193.                   }
  194.  
  195.                   if (getChildSerializable(var1) != null) {
  196.                      ++this.serializable;
  197.                   }
  198.  
  199.                   this.childJustAddedHook(var1, var7);
  200.                   if (var5 != null) {
  201.                      var11 = getChildVisibility(var5);
  202.                      if (var11 != null) {
  203.                         if (this.okToUseGui) {
  204.                            var11.okToUseGui();
  205.                         } else {
  206.                            var11.dontUseGui();
  207.                         }
  208.                      }
  209.  
  210.                      if (getChildSerializable(var5) != null) {
  211.                         ++this.serializable;
  212.                      }
  213.  
  214.                      this.childJustAddedHook(var5, var8);
  215.                   }
  216.                }
  217.  
  218.                this.fireChildrenAdded(new BeanContextMembershipEvent(this.getBeanContextPeer(), var5 == null ? new Object[]{var1} : new Object[]{var1, var5}));
  219.                return true;
  220.             }
  221.          }
  222.       }
  223.    }
  224.  
  225.    public boolean remove(Object var1) {
  226.       return this.remove(var1, true);
  227.    }
  228.  
  229.    protected boolean remove(Object var1, boolean var2) {
  230.       if (var1 == null) {
  231.          throw new IllegalArgumentException();
  232.       } else {
  233.          Object var3 = BeanContext.globalHierarchyLock;
  234.          synchronized(var3) {
  235.             if (!this.containsKey(var1)) {
  236.                boolean var4 = false;
  237.                return var4;
  238.             } else if (!this.validatePendingRemove(var1)) {
  239.                throw new IllegalStateException();
  240.             } else {
  241.                BCSChild var5 = (BCSChild)this.children.get(var1);
  242.                BCSChild var6 = null;
  243.                Object var7 = null;
  244.                synchronized(var1) {
  245.                   if (var2) {
  246.                      BeanContextChild var9 = getChildBeanContextChild(var1);
  247.                      if (var9 != null) {
  248.                         synchronized(var9) {
  249.                            var9.removePropertyChangeListener("beanContext", this.childPCL);
  250.                            var9.removeVetoableChangeListener("beanContext", this.childVCL);
  251.  
  252.                            try {
  253.                               var9.setBeanContext((BeanContext)null);
  254.                            } catch (PropertyVetoException var16) {
  255.                               var9.addPropertyChangeListener("beanContext", this.childPCL);
  256.                               var9.addVetoableChangeListener("beanContext", this.childVCL);
  257.                               throw new IllegalStateException();
  258.                            }
  259.                         }
  260.                      }
  261.                   }
  262.  
  263.                   HashMap var21 = this.children;
  264.                   synchronized(var21) {
  265.                      this.children.remove(var1);
  266.                      if (var5.isProxyPeer()) {
  267.                         var6 = (BCSChild)this.children.get(var7 = var5.getProxyPeer());
  268.                         this.children.remove(var7);
  269.                      }
  270.                   }
  271.  
  272.                   if (getChildSerializable(var1) != null) {
  273.                      --this.serializable;
  274.                   }
  275.  
  276.                   this.childJustRemovedHook(var1, var5);
  277.                   if (var7 != null) {
  278.                      if (getChildSerializable(var7) != null) {
  279.                         --this.serializable;
  280.                      }
  281.  
  282.                      this.childJustRemovedHook(var7, var6);
  283.                   }
  284.                }
  285.  
  286.                this.fireChildrenRemoved(new BeanContextMembershipEvent(this.getBeanContextPeer(), var7 == null ? new Object[]{var1} : new Object[]{var1, var7}));
  287.                return true;
  288.             }
  289.          }
  290.       }
  291.    }
  292.  
  293.    public boolean containsAll(Collection var1) {
  294.       HashMap var2 = this.children;
  295.       synchronized(var2) {
  296.          Iterator var3 = var1.iterator();
  297.  
  298.          while(var3.hasNext()) {
  299.             if (!this.contains(var3.next())) {
  300.                boolean var4 = false;
  301.                return var4;
  302.             }
  303.          }
  304.  
  305.          boolean var5 = true;
  306.          return var5;
  307.       }
  308.    }
  309.  
  310.    public boolean addAll(Collection var1) {
  311.       throw new UnsupportedOperationException();
  312.    }
  313.  
  314.    public boolean removeAll(Collection var1) {
  315.       throw new UnsupportedOperationException();
  316.    }
  317.  
  318.    public boolean retainAll(Collection var1) {
  319.       throw new UnsupportedOperationException();
  320.    }
  321.  
  322.    public void clear() {
  323.       throw new UnsupportedOperationException();
  324.    }
  325.  
  326.    public void addBeanContextMembershipListener(BeanContextMembershipListener var1) {
  327.       if (var1 == null) {
  328.          throw new NullPointerException("listener");
  329.       } else {
  330.          ArrayList var2 = this.bcmListeners;
  331.          synchronized(var2) {
  332.             if (!this.bcmListeners.contains(var1)) {
  333.                this.bcmListeners.add(var1);
  334.             }
  335.          }
  336.       }
  337.    }
  338.  
  339.    public void removeBeanContextMembershipListener(BeanContextMembershipListener var1) {
  340.       if (var1 == null) {
  341.          throw new NullPointerException("listener");
  342.       } else {
  343.          ArrayList var2 = this.bcmListeners;
  344.          synchronized(var2) {
  345.             if (this.bcmListeners.contains(var1)) {
  346.                this.bcmListeners.remove(var1);
  347.             }
  348.          }
  349.       }
  350.    }
  351.  
  352.    public InputStream getResourceAsStream(String var1, BeanContextChild var2) {
  353.       if (var1 == null) {
  354.          throw new NullPointerException("name");
  355.       } else if (var2 == null) {
  356.          throw new NullPointerException("bcc");
  357.       } else {
  358.          HashMap var4 = this.children;
  359.          boolean var3;
  360.          synchronized(var4) {
  361.             var3 = this.children.containsValue(var2);
  362.          }
  363.  
  364.          if (var3) {
  365.             ClassLoader var5 = var2.getClass().getClassLoader();
  366.             return var5 != null ? var5.getResourceAsStream(var1) : ClassLoader.getSystemResourceAsStream(var1);
  367.          } else {
  368.             throw new IllegalArgumentException("Not a valid child");
  369.          }
  370.       }
  371.    }
  372.  
  373.    public URL getResource(String var1, BeanContextChild var2) {
  374.       if (var1 == null) {
  375.          throw new NullPointerException("name");
  376.       } else if (var2 == null) {
  377.          throw new NullPointerException("bcc");
  378.       } else {
  379.          HashMap var4 = this.children;
  380.          boolean var3;
  381.          synchronized(var4) {
  382.             var3 = this.children.containsValue(var2);
  383.          }
  384.  
  385.          if (var3) {
  386.             ClassLoader var5 = var2.getClass().getClassLoader();
  387.             return var5 != null ? var5.getResource(var1) : ClassLoader.getSystemResource(var1);
  388.          } else {
  389.             throw new IllegalArgumentException("Not a valid child");
  390.          }
  391.       }
  392.    }
  393.  
  394.    public synchronized void setDesignTime(boolean var1) {
  395.       if (this.designTime != var1) {
  396.          this.designTime = var1;
  397.          ((BeanContextChildSupport)this).firePropertyChange("designMode", new Boolean(!var1), new Boolean(var1));
  398.       }
  399.  
  400.    }
  401.  
  402.    public synchronized boolean isDesignTime() {
  403.       return this.designTime;
  404.    }
  405.  
  406.    public synchronized void setLocale(Locale var1) throws PropertyVetoException {
  407.       if (this.locale != null && !this.locale.equals(var1) || var1 != null) {
  408.          Locale var2 = this.locale;
  409.          ((BeanContextChildSupport)this).fireVetoableChange("locale", var2, var1);
  410.          this.locale = var1;
  411.          ((BeanContextChildSupport)this).firePropertyChange("locale", var2, var1);
  412.       }
  413.  
  414.    }
  415.  
  416.    public synchronized Locale getLocale() {
  417.       return this.locale;
  418.    }
  419.  
  420.    public synchronized boolean needsGui() {
  421.       BeanContext var1 = this.getBeanContextPeer();
  422.       if (var1 != this) {
  423.          if (var1 instanceof Visibility) {
  424.             return var1.needsGui();
  425.          }
  426.  
  427.          if (var1 instanceof Container || var1 instanceof Component) {
  428.             return true;
  429.          }
  430.       }
  431.  
  432.       HashMap var2 = this.children;
  433.       synchronized(var2) {
  434.          for(Object var4 : this.children.keySet()) {
  435.             try {
  436.                boolean var9 = ((Visibility)var4).needsGui();
  437.                return var9;
  438.             } catch (ClassCastException var7) {
  439.                if (var4 instanceof Container || var4 instanceof Component) {
  440.                   boolean var5 = true;
  441.                   return var5;
  442.                }
  443.             }
  444.          }
  445.  
  446.          return false;
  447.       }
  448.    }
  449.  
  450.    public synchronized void dontUseGui() {
  451.       if (this.okToUseGui) {
  452.          this.okToUseGui = false;
  453.          HashMap var1 = this.children;
  454.          synchronized(var1) {
  455.             Iterator var2 = this.children.keySet().iterator();
  456.  
  457.             while(var2.hasNext()) {
  458.                Visibility var3 = getChildVisibility(var2.next());
  459.                if (var3 != null) {
  460.                   var3.dontUseGui();
  461.                }
  462.             }
  463.          }
  464.       }
  465.  
  466.    }
  467.  
  468.    public synchronized void okToUseGui() {
  469.       if (!this.okToUseGui) {
  470.          this.okToUseGui = true;
  471.          HashMap var1 = this.children;
  472.          synchronized(var1) {
  473.             Iterator var2 = this.children.keySet().iterator();
  474.  
  475.             while(var2.hasNext()) {
  476.                Visibility var3 = getChildVisibility(var2.next());
  477.                if (var3 != null) {
  478.                   var3.okToUseGui();
  479.                }
  480.             }
  481.          }
  482.       }
  483.  
  484.    }
  485.  
  486.    public boolean avoidingGui() {
  487.       return !this.okToUseGui && this.needsGui();
  488.    }
  489.  
  490.    public boolean isSerializing() {
  491.       return this.serializing;
  492.    }
  493.  
  494.    protected Iterator bcsChildren() {
  495.       HashMap var1 = this.children;
  496.       synchronized(var1) {
  497.          Iterator var2 = this.children.values().iterator();
  498.          return var2;
  499.       }
  500.    }
  501.  
  502.    protected void bcsPreSerializationHook(ObjectOutputStream var1) throws IOException {
  503.    }
  504.  
  505.    protected void bcsPreDeserializationHook(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  506.    }
  507.  
  508.    protected void childDeserializedHook(Object var1, BCSChild var2) {
  509.       HashMap var3 = this.children;
  510.       synchronized(var3) {
  511.          this.children.put(var1, var2);
  512.       }
  513.    }
  514.  
  515.    protected final void serialize(ObjectOutputStream var1, Collection var2) throws IOException {
  516.       int var3 = 0;
  517.       Object[] var4 = var2.toArray();
  518.  
  519.       for(int var5 = 0; var5 < var4.length; ++var5) {
  520.          if (var4[var5] instanceof Serializable) {
  521.             ++var3;
  522.          } else {
  523.             var4[var5] = null;
  524.          }
  525.       }
  526.  
  527.       var1.writeInt(var3);
  528.  
  529.       for(int var6 = 0; var3 > 0; ++var6) {
  530.          Object var7 = var4[var6];
  531.          if (var7 != null) {
  532.             var1.writeObject(var7);
  533.             --var3;
  534.          }
  535.       }
  536.  
  537.    }
  538.  
  539.    protected final void deserialize(ObjectInputStream var1, Collection var2) throws IOException, ClassNotFoundException {
  540.       int var3 = 0;
  541.       var3 = var1.readInt();
  542.  
  543.       while(var3-- > 0) {
  544.          var2.add(var1.readObject());
  545.       }
  546.  
  547.    }
  548.  
  549.    public final void writeChildren(ObjectOutputStream var1) throws IOException {
  550.       if (this.serializable > 0) {
  551.          boolean var2 = this.serializing;
  552.          this.serializing = true;
  553.          int var3 = 0;
  554.          HashMap var4 = this.children;
  555.          synchronized(var4) {
  556.             Iterator var5 = this.children.entrySet().iterator();
  557.  
  558.             while(var5.hasNext() && var3 < this.serializable) {
  559.                Map.Entry var6 = (Map.Entry)var5.next();
  560.                if (var6.getKey() instanceof Serializable) {
  561.                   try {
  562.                      var1.writeObject(var6.getKey());
  563.                      var1.writeObject(var6.getValue());
  564.                   } catch (IOException var9) {
  565.                      this.serializing = var2;
  566.                      throw var9;
  567.                   }
  568.  
  569.                   ++var3;
  570.                }
  571.             }
  572.          }
  573.  
  574.          this.serializing = var2;
  575.          if (var3 != this.serializable) {
  576.             throw new IOException("wrote different number of children than expected");
  577.          }
  578.       }
  579.    }
  580.  
  581.    private synchronized void writeObject(ObjectOutputStream var1) throws IOException, ClassNotFoundException {
  582.       this.serializing = true;
  583.       Object var2 = BeanContext.globalHierarchyLock;
  584.       synchronized(var2) {
  585.          try {
  586.             var1.defaultWriteObject();
  587.             this.bcsPreSerializationHook(var1);
  588.             if (this.serializable > 0 && this.equals(this.getBeanContextPeer())) {
  589.                this.writeChildren(var1);
  590.             }
  591.  
  592.             this.serialize(var1, this.bcmListeners);
  593.          } finally {
  594.             this.serializing = false;
  595.          }
  596.  
  597.       }
  598.    }
  599.  
  600.    public final void readChildren(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  601.       int var2 = this.serializable;
  602.  
  603.       while(var2-- > 0) {
  604.          Object var3 = null;
  605.          Object var4 = null;
  606.  
  607.          try {
  608.             var3 = var1.readObject();
  609.             var15 = (BCSChild)var1.readObject();
  610.          } catch (IOException var12) {
  611.             continue;
  612.          } catch (ClassNotFoundException var13) {
  613.             continue;
  614.          }
  615.  
  616.          synchronized(var3) {
  617.             BeanContextChild var6 = null;
  618.  
  619.             try {
  620.                var6 = (BeanContextChild)var3;
  621.             } catch (ClassCastException var9) {
  622.             }
  623.  
  624.             if (var6 != null) {
  625.                try {
  626.                   var6.setBeanContext(this.getBeanContextPeer());
  627.                   var6.addPropertyChangeListener("beanContext", this.childPCL);
  628.                   var6.addVetoableChangeListener("beanContext", this.childVCL);
  629.                } catch (PropertyVetoException var10) {
  630.                   continue;
  631.                }
  632.             }
  633.  
  634.             this.childDeserializedHook(var3, var15);
  635.          }
  636.       }
  637.  
  638.    }
  639.  
  640.    private synchronized void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  641.       Object var2 = BeanContext.globalHierarchyLock;
  642.       synchronized(var2) {
  643.          var1.defaultReadObject();
  644.          this.initialize();
  645.          this.bcsPreDeserializationHook(var1);
  646.          if (this.serializable > 0 && this.equals(this.getBeanContextPeer())) {
  647.             this.readChildren(var1);
  648.          }
  649.  
  650.          this.deserialize(var1, this.bcmListeners = new ArrayList(1));
  651.       }
  652.    }
  653.  
  654.    public void vetoableChange(PropertyChangeEvent var1) throws PropertyVetoException {
  655.       String var2 = var1.getPropertyName();
  656.       Object var3 = ((EventObject)var1).getSource();
  657.       HashMap var4 = this.children;
  658.       synchronized(var4) {
  659.          if ("beanContext".equals(var2) && this.containsKey(var3) && !this.getBeanContextPeer().equals(var1.getNewValue())) {
  660.             if (!this.validatePendingRemove(var3)) {
  661.                throw new PropertyVetoException("current BeanContext vetoes setBeanContext()", var1);
  662.             }
  663.  
  664.             ((BCSChild)this.children.get(var3)).setRemovePending(true);
  665.          }
  666.  
  667.       }
  668.    }
  669.  
  670.    public void propertyChange(PropertyChangeEvent var1) {
  671.       String var2 = var1.getPropertyName();
  672.       Object var3 = ((EventObject)var1).getSource();
  673.       HashMap var4 = this.children;
  674.       synchronized(var4) {
  675.          if ("beanContext".equals(var2) && this.containsKey(var3) && ((BCSChild)this.children.get(var3)).isRemovePending()) {
  676.             BeanContext var5 = this.getBeanContextPeer();
  677.             if (var5.equals(var1.getOldValue()) && !var5.equals(var1.getNewValue())) {
  678.                this.remove(var3, false);
  679.             } else {
  680.                ((BCSChild)this.children.get(var3)).setRemovePending(false);
  681.             }
  682.          }
  683.  
  684.       }
  685.    }
  686.  
  687.    protected boolean validatePendingAdd(Object var1) {
  688.       return true;
  689.    }
  690.  
  691.    protected boolean validatePendingRemove(Object var1) {
  692.       return true;
  693.    }
  694.  
  695.    protected void childJustAddedHook(Object var1, BCSChild var2) {
  696.    }
  697.  
  698.    protected void childJustRemovedHook(Object var1, BCSChild var2) {
  699.    }
  700.  
  701.    protected static final Visibility getChildVisibility(Object var0) {
  702.       try {
  703.          return (Visibility)var0;
  704.       } catch (ClassCastException var2) {
  705.          return null;
  706.       }
  707.    }
  708.  
  709.    protected static final Serializable getChildSerializable(Object var0) {
  710.       try {
  711.          return (Serializable)var0;
  712.       } catch (ClassCastException var2) {
  713.          return null;
  714.       }
  715.    }
  716.  
  717.    protected static final PropertyChangeListener getChildPropertyChangeListener(Object var0) {
  718.       try {
  719.          return (PropertyChangeListener)var0;
  720.       } catch (ClassCastException var2) {
  721.          return null;
  722.       }
  723.    }
  724.  
  725.    protected static final VetoableChangeListener getChildVetoableChangeListener(Object var0) {
  726.       try {
  727.          return (VetoableChangeListener)var0;
  728.       } catch (ClassCastException var2) {
  729.          return null;
  730.       }
  731.    }
  732.  
  733.    protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object var0) {
  734.       try {
  735.          return (BeanContextMembershipListener)var0;
  736.       } catch (ClassCastException var2) {
  737.          return null;
  738.       }
  739.    }
  740.  
  741.    protected static final BeanContextChild getChildBeanContextChild(Object var0) {
  742.       try {
  743.          BeanContextChild var1 = (BeanContextChild)var0;
  744.          if (var0 instanceof BeanContextChild && var0 instanceof BeanContextProxy) {
  745.             throw new IllegalArgumentException("child cannot implement both BeanContextChild and BeanContextProxy");
  746.          } else {
  747.             return var1;
  748.          }
  749.       } catch (ClassCastException var4) {
  750.          try {
  751.             return ((BeanContextProxy)var0).getBeanContextProxy();
  752.          } catch (ClassCastException var3) {
  753.             return null;
  754.          }
  755.       }
  756.    }
  757.  
  758.    protected final void fireChildrenAdded(BeanContextMembershipEvent var1) {
  759.       ArrayList var3 = this.bcmListeners;
  760.       Object[] var2;
  761.       synchronized(var3) {
  762.          var2 = this.bcmListeners.toArray();
  763.       }
  764.  
  765.       for(int var4 = 0; var4 < var2.length; ++var4) {
  766.          ((BeanContextMembershipListener)var2[var4]).childrenAdded(var1);
  767.       }
  768.  
  769.    }
  770.  
  771.    protected final void fireChildrenRemoved(BeanContextMembershipEvent var1) {
  772.       ArrayList var3 = this.bcmListeners;
  773.       Object[] var2;
  774.       synchronized(var3) {
  775.          var2 = this.bcmListeners.toArray();
  776.       }
  777.  
  778.       for(int var4 = 0; var4 < var2.length; ++var4) {
  779.          ((BeanContextMembershipListener)var2[var4]).childrenRemoved(var1);
  780.       }
  781.  
  782.    }
  783.  
  784.    protected synchronized void initialize() {
  785.       this.children = new HashMap(this.serializable + 1);
  786.       this.bcmListeners = new ArrayList(1);
  787.       this.childPCL = new 1(this);
  788.       this.childVCL = new 2(this);
  789.    }
  790.  
  791.    protected final Object[] copyChildren() {
  792.       HashMap var1 = this.children;
  793.       synchronized(var1) {
  794.          Object[] var2 = this.children.keySet().toArray();
  795.          return var2;
  796.       }
  797.    }
  798.  
  799.    protected static final boolean classEquals(Class var0, Class var1) {
  800.       return var0.equals(var1) || var0.getName().equals(var1.getName());
  801.    }
  802. }
  803.