harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r387239 [6/21] - in /incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math: ./ Harmony/ doc/ doc/images/ make/ src/ src/common/ src/common/javasrc/ src/common/javasrc/java/ src/common/javasrc/java/applet/ src/common/javasrc/jav...
Date Mon, 20 Mar 2006 16:31:33 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipEvent.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipEvent.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,98 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.4.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.4.4.3 $
+ */
+
+public class BeanContextMembershipEvent extends BeanContextEvent {
+
+    /**
+     * 
+     */
+    protected Collection children;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
+        super(bc);
+        
+        if (changes == null) {
+            throw new NullPointerException("Changes are null");
+        }
+        
+        this.children = changes;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextMembershipEvent(BeanContext bc, Object[] changes) {
+        super(bc);
+        
+        if (changes == null) {
+            throw new NullPointerException("Changes are null");
+        }
+        
+        // Initialize collection
+        this.children = new Vector();
+        
+        // Add all elements to it
+        for(int i = 0; i < changes.length; i++) {
+            this.children.add(changes[i]);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean contains(Object child) {
+        return this.children.contains(child);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator iterator() {
+        return this.children.iterator();
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public int size() {
+        return this.children.size();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object[] toArray() {
+        return this.children.toArray();
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipListener.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextMembershipListener.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,41 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.EventListener;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+ 
+public interface BeanContextMembershipListener extends EventListener {
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void childrenAdded(BeanContextMembershipEvent bcme);
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void childrenRemoved(BeanContextMembershipEvent bcme);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextProxy.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextProxy.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextProxy.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextProxy.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextProxy {
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextChild getBeanContextProxy();
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceAvailableEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceAvailableEvent.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceAvailableEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceAvailableEvent.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,66 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.Iterator;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public class BeanContextServiceAvailableEvent extends BeanContextEvent {
+
+    /**
+     * @serial
+     */
+    protected Class serviceClass;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
+        super(bcs);
+        this.serviceClass = sc;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceSelectors() {
+        return ((BeanContextServices) super.source).
+            getCurrentServiceSelectors(serviceClass);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Class getServiceClass() {
+        return this.serviceClass;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServices getSourceAsBeanContextServices() {
+        return (BeanContextServices) super.source;
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProvider.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProvider.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProvider.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProvider.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,49 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.Iterator;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextServiceProvider {
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceSelectors(BeanContextServices bcs, 
+        Class serviceClass);
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object getService(BeanContextServices bcs, Object requestor, 
+        Class serviceClass, Object serviceSelector);
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void releaseService(BeanContextServices bcs, Object requestor, 
+        Object service);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.beans.BeanInfo;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextServiceProviderBeanInfo extends BeanInfo {
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanInfo[] getServicesBeanInfo();
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedEvent.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedEvent.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,78 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.3.4.3 $
+ */
+package java.beans.beancontext;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.3.4.3 $
+ */
+
+public class BeanContextServiceRevokedEvent extends BeanContextEvent {
+
+    /**
+     * @serial
+     */
+    protected Class serviceClass;
+    
+    /**
+     * @serial
+     */
+    private boolean invalidateRefs;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, 
+            boolean invalidate) {
+                
+        super(bcs);
+        this.serviceClass = sc;
+        this.invalidateRefs = invalidate;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Class getServiceClass() {
+        return this.serviceClass;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServices getSourceAsBeanContextServices() {
+        return (BeanContextServices) super.propagatedFrom;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean isCurrentServiceInvalidNow() {
+        return this.invalidateRefs;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean isServiceClass(Class service) {
+        return service.equals(this.serviceClass);
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedListener.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServiceRevokedListener.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.EventListener;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextServiceRevokedListener extends EventListener {
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void serviceRevoked(BeanContextServiceRevokedEvent bcsre);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServices.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServices.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServices.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServices.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,87 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.util.Iterator;
+import java.util.TooManyListenersException;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextServices 
+        extends BeanContext, BeanContextServicesListener {
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void addBeanContextServicesListener(
+            BeanContextServicesListener bcsl);
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean addService(Class serviceClass, 
+        BeanContextServiceProvider serviceProvider);
+        
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceClasses();
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceSelectors(Class serviceClass);
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object getService(BeanContextChild child, Object requestor, 
+        Class serviceClass, Object serviceSelector, 
+        BeanContextServiceRevokedListener bcsrl)
+            throws TooManyListenersException;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean hasService(Class serviceClass);
+        
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void releaseService(BeanContextChild child, Object requestor, 
+        Object service);
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void removeBeanContextServicesListener(
+            BeanContextServicesListener bcsl);
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void revokeService(Class serviceClass, 
+        BeanContextServiceProvider serviceProvider,
+        boolean revokeCurrentServicesNow);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesListener.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesListener.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+package java.beans.beancontext;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.2.4.3 $
+ */
+
+public interface BeanContextServicesListener 
+        extends BeanContextServiceRevokedListener {
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void serviceAvailable(BeanContextServiceAvailableEvent bcsae);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesSupport.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesSupport.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextServicesSupport.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,698 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.12.4.3 $
+ */
+package java.beans.beancontext;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.TooManyListenersException;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.12.4.3 $
+ */
+
+public class BeanContextServicesSupport extends BeanContextSupport 
+        implements BeanContextServices {
+    
+    /**
+     * Nested class
+     */
+    protected class BCSSChild extends BeanContextSupport.BCSChild {
+        
+        private static final long serialVersionUID = -3263851306889194873L;
+        
+        /**
+         * 
+         */
+        BCSSChild(Object child, Object peer) {
+            super(child, peer);
+        }
+    }
+    
+    /**
+     * Nested class
+     */
+    protected class BCSSProxyServiceProvider 
+            implements BeanContextServiceProvider, 
+            BeanContextServiceRevokedListener {
+           
+        /**
+         * The peer of this object
+         */
+        private BeanContextChild child;
+               
+        /**
+         * Initialize the peer
+         *
+         * @param child - The peer to initialize with
+         */
+        BCSSProxyServiceProvider(BeanContextChild child) {
+            this.child = child;
+        }
+             
+        /**
+         *
+         */
+        public Iterator getCurrentServiceSelectors(BeanContextServices bcs, 
+                Class serviceClass) {
+                    
+            return bcs.getCurrentServiceSelectors(serviceClass);
+        }
+        
+        /**
+         *
+         */
+        public Object getService(BeanContextServices bcs, Object requestor,
+                Class serviceClass, Object serviceSelector) {
+                            
+            try {
+                BeanContextServiceRevokedListener l = (BeanContextServiceRevokedListener) this;    
+                return bcs.getService(this.child, requestor, serviceClass, serviceSelector, l);
+            } catch(TooManyListenersException e) {
+                return null;
+            }
+        }
+        
+        /**
+         *
+         */
+        public void releaseService(BeanContextServices bcs, Object requestor, 
+                Object service) {
+         
+            bcs.releaseService(this.child, requestor, service);
+        }
+         
+        /**
+         *
+         */
+        public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
+            
+            if (this.child instanceof BeanContextServices) {
+                BeanContextServices ser = (BeanContextServices) this.child;                
+                ser.serviceRevoked(bcsre);
+            }
+        }
+    }
+    
+    /**
+     * Nested class
+     */
+    protected static class BCSSServiceProvider implements Serializable {
+        
+        /**
+         * @serial
+         */
+        protected BeanContextServiceProvider serviceProvider;
+        
+        /**
+         * Service class
+         */
+        private transient Class sc;
+        
+        /**
+         * Constructor for setting BeanContextServiceProvider in this class
+         *
+         * @param sc - service class
+         * @param serviceProvider - service provider
+         */
+        BCSSServiceProvider(Class sc, BeanContextServiceProvider serviceProvider) {
+            this.sc = sc;
+            this.serviceProvider = serviceProvider;
+        }
+        
+        /**
+         *
+         */
+        protected BeanContextServiceProvider getServiceProvider() {
+            return this.serviceProvider;
+        }
+        
+        Class getServiceClass() {
+            return this.sc;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected transient ArrayList bcsListeners;
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected transient BCSSProxyServiceProvider proxy;
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected transient int serializable;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected transient HashMap services;
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServicesSupport() {
+        super();
+        System.out.println("DRL implementation");
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServicesSupport(BeanContextServices peer) {
+        super(peer);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServicesSupport(BeanContextServices peer, Locale lcle) {
+        super(peer, lcle);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, 
+            boolean dtime) {
+                
+        super(peer, lcle, dtime);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, 
+            boolean dtime, boolean visible) {
+                
+        super(peer, lcle, dtime, visible);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void addBeanContextServicesListener(
+            BeanContextServicesListener bcsl) {
+                
+        if (bcsl == null) {
+            throw new NullPointerException("The listener is null");
+        }
+        
+        synchronized(this.bcsListeners) {
+            this.bcsListeners.add(bcsl);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean addService(Class serviceClass, 
+            BeanContextServiceProvider bcsp) {
+                
+        return addService(serviceClass, bcsp, true);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected boolean addService(Class serviceClass, 
+            BeanContextServiceProvider bcsp, boolean fireEvent) {
+                
+        if (bcsp == null) {
+            throw new NullPointerException("The provider is null");
+        }
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.services) {            
+                if (!this.services.containsKey(serviceClass)) {
+                    this.services.put(
+                        serviceClass, 
+                        createBCSSServiceProvider(serviceClass, bcsp));  
+                        
+                    if (getChildSerializable(bcsp) != null) {
+                        this.serializable++;
+                    }
+                }
+                else {
+                    fireEvent = false;
+                }
+            }
+                    
+            BeanContextServiceAvailableEvent ev = getEvent(serviceClass);
+            
+            if (fireEvent) {
+                fireServiceAdded(ev);
+            }
+            
+            for (Iterator it = iterator(); it.hasNext(); ) {
+                Object child = it.next();
+                
+                if(child instanceof BeanContextServices) {
+                    ((BeanContextServices) child).serviceAvailable(ev);
+                }
+            }
+                    
+            return fireEvent;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected synchronized void bcsPreDeserializationHook(ObjectInputStream ois) 
+            throws IOException, ClassNotFoundException {
+                
+        synchronized(this.services) {
+            for (int i = 0; i < this.serializable; i++) {
+                BCSSServiceProvider provider = (BCSSServiceProvider) ois.readObject();
+                this.services.put(provider.getClass(), provider);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected synchronized void bcsPreSerializationHook(ObjectOutputStream oos) 
+            throws IOException {
+                
+        synchronized(this.services) {
+            for (Iterator it = this.services.keySet().iterator(); it.hasNext(); ) {
+                Object key = it.next();
+                
+                if (this.getChildSerializable(key) != null) {
+                    oos.writeObject(this.services.get(key));
+                }
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void childJustRemovedHook(Object child, 
+            BeanContextSupport.BCSChild bcsc) {
+                
+        return;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected BeanContextSupport.BCSChild createBCSChild(Object targetChild, 
+            Object peer) {
+                
+        return new BCSSChild(targetChild, peer);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected BCSSServiceProvider createBCSSServiceProvider(Class sc, 
+            BeanContextServiceProvider bcsp) {
+                
+        return new BCSSServiceProvider(sc, bcsp);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireServiceAdded(
+            BeanContextServiceAvailableEvent bcssae) {
+                
+        for (Iterator it = this.bcsListeners.iterator(); it.hasNext(); ) {
+            BeanContextServicesListener l = 
+                (BeanContextServicesListener) it.next();
+                
+            l.serviceAvailable(bcssae);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireServiceAdded(Class serviceClass) {
+        fireServiceAdded(getEvent(serviceClass));
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireServiceRevoked(BeanContextServiceRevokedEvent bcsre) {
+        
+        for (Iterator it = this.bcsListeners.iterator(); it.hasNext(); ) {
+            BeanContextServicesListener l = 
+                (BeanContextServicesListener) it.next();
+                
+            l.serviceRevoked(bcsre);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireServiceRevoked(Class serviceClass, 
+            boolean revokeNow) {
+                
+        fireServiceRevoked(
+            new BeanContextServiceRevokedEvent(
+                getBeanContextServicesPeer(), serviceClass, revokeNow));
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextServices getBeanContextServicesPeer() {
+        return (BeanContextServices) getBeanContextPeer();
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final BeanContextServicesListener 
+            getChildBeanContextServicesListener(Object child) {
+                
+        if (child instanceof BeanContextServicesListener) {
+            return (BeanContextServicesListener) child;
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceClasses() {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.services) {
+                return this.services.keySet().iterator();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator getCurrentServiceSelectors(Class serviceClass) {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.services) {
+                BCSSServiceProvider bcsp = 
+                    (BCSSServiceProvider) this.services.get(serviceClass);
+                    
+                return bcsp.getServiceProvider().getCurrentServiceSelectors(
+                    getBeanContextServicesPeer(), serviceClass);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    private BeanContextServiceAvailableEvent getEvent(Class serviceClass) {
+        return new BeanContextServiceAvailableEvent(
+            getBeanContextServicesPeer(), serviceClass);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object getService(BeanContextChild child, Object requestor, 
+            Class serviceClass, Object serviceSelector, 
+            BeanContextServiceRevokedListener bcsrl) 
+            throws TooManyListenersException {
+                
+        if (child == null) {
+            throw new NullPointerException("The child is null");
+        }
+        
+        if (requestor == null) {
+            throw new NullPointerException("The requestor is null");
+        }
+        
+        if (serviceClass == null) {
+            throw new NullPointerException("The service class is null");
+        }
+        
+        if (serviceSelector == null) {
+            throw new NullPointerException("The service selector is null");
+        }
+        
+        if (bcsrl == null) {
+            throw new NullPointerException("The listener is null");
+        }
+                
+        synchronized(BeanContext.globalHierarchyLock) {
+            Object service = null;
+            
+            synchronized(this.services) {
+                BCSSServiceProvider bcsp = 
+                    (BCSSServiceProvider) this.services.get(serviceClass);
+                    
+                if (bcsp != null) {
+                    service = bcsp.getServiceProvider().getService(
+                        getBeanContextServicesPeer(), 
+                        requestor, 
+                        serviceClass, 
+                        serviceSelector);
+                }  
+                    
+                if ((service == null) && this.proxy != null) {
+                    service = this.proxy.getService(
+                        getBeanContextServicesPeer(), 
+                        requestor, 
+                        serviceClass, 
+                        serviceSelector);
+                }
+            }            
+             
+            return service;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized boolean hasService(Class serviceClass) {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.services) {
+                return this.services.containsKey(serviceClass);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void initialize() {
+        super.initialize();
+        
+        this.services = new HashMap();
+        this.bcsListeners = new ArrayList();
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected synchronized void initializeBeanContextResources() {        
+        super.initializeBeanContextResources();        
+        this.proxy = new BCSSProxyServiceProvider(getBeanContextServicesPeer());
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    private void readObject(ObjectInputStream ois) 
+            throws IOException, ClassNotFoundException {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            ois.defaultReadObject();            
+            initialize();
+            bcsPreDeserializationHook(ois);
+            this.serializable = ois.readInt();
+            
+            synchronized(this.services) {
+                for (int i = 0; i < this.serializable; i++) {
+                    BCSSServiceProvider prov = 
+                        (BCSSServiceProvider) ois.readObject();                    
+                    this.services.put(prov.getServiceClass(), prov);
+                }
+            }
+            
+            deserialize(ois, this.bcsListeners);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected synchronized void releaseBeanContextResources() {        
+        super.releaseBeanContextResources();        
+        this.proxy = null;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void releaseService(BeanContextChild child, Object requestor, 
+            Object service) {
+                
+        if (child == null) {
+            throw new NullPointerException("The child is null");
+        }
+        
+        if (requestor == null) {
+            throw new NullPointerException("The requestor is null");
+        }
+        
+        if (service == null) {
+            throw new NullPointerException("The service is null");
+        }
+                
+        synchronized(BeanContext.globalHierarchyLock) {
+            if (this.proxy != null) {
+                this.proxy.releaseService(
+                    getBeanContextServicesPeer(), 
+                    requestor, 
+                    service);
+            }  
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void removeBeanContextServicesListener(
+            BeanContextServicesListener bcsl) {
+        
+        if (bcsl != null) {
+            synchronized(this.bcsListeners) {
+                this.bcsListeners.remove(bcsl);
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void revokeService(Class serviceClass, 
+            BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
+                
+        if (serviceClass == null) {
+            throw new NullPointerException("The service class is null");
+        }
+        
+        if (bcsp == null) {
+            throw new NullPointerException("The provider is null");
+        }
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.services) {                     
+                Object removed = this.services.remove(serviceClass); 
+                
+                if (removed != null) {                        
+                    if (getChildSerializable(bcsp) != null) {
+                        this.serializable--;
+                    }
+                }
+            }
+            
+            BeanContextServiceRevokedEvent ev = 
+                new BeanContextServiceRevokedEvent(
+                    getBeanContextServicesPeer(), 
+                    serviceClass, 
+                    revokeCurrentServicesNow);
+                    
+            fireServiceRevoked(ev);
+            
+            for (Iterator it = iterator(); it.hasNext(); ) {
+                Object child = it.next();
+                
+                if(child instanceof BeanContextServices) {
+                    ((BeanContextServices) child).serviceRevoked(ev);
+                }
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void serviceAvailable(BeanContextServiceAvailableEvent bcssae) {
+        
+        for (Iterator it = this.bcsListeners.iterator(); it.hasNext(); ) {
+            BeanContextServicesListener l = 
+                (BeanContextServicesListener) it.next();
+                
+            l.serviceAvailable(bcssae);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) {
+        
+        for (Iterator it = this.bcsListeners.iterator(); it.hasNext(); ) {
+            BeanContextServicesListener l = 
+                (BeanContextServicesListener) it.next();
+                
+            l.serviceRevoked(bcssre);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    private void writeObject(ObjectOutputStream oos) throws IOException {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            oos.defaultWriteObject();
+            bcsPreSerializationHook(oos);            
+            oos.writeInt(this.serializable);
+            
+            synchronized(this.services) {
+                for (Iterator it = this.getCurrentServiceClasses(); it.hasNext(); ) {
+                    BCSSServiceProvider prov = (BCSSServiceProvider) it.next();
+                    
+                    if (prov.getServiceProvider() instanceof Serializable) {
+                        oos.writeObject(prov);
+                    }
+                }
+            }
+            
+            serialize(oos, this.bcsListeners);
+        }
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextSupport.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextSupport.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/src/common/javasrc/java/beans/beancontext/BeanContextSupport.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,1336 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.17.2.3 $
+ */
+package java.beans.beancontext;
+
+import java.beans.Beans;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.beans.Visibility;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import java.net.URL;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * @author Sergei A. Krivenko
+ * @version $Revision: 1.17.2.3 $
+ */
+
+public class BeanContextSupport extends BeanContextChildSupport 
+        implements BeanContext, Serializable, PropertyChangeListener, 
+        VetoableChangeListener {
+    
+    /**
+     * Nested class
+     */        
+    protected class BCSChild implements Serializable {
+        
+        private static final long serialVersionUID = -5815286101609939109L;
+        
+        /**
+         * @serial
+         */
+        private Object child;
+        
+        /**
+         * @serial
+         */
+        private Object proxyPeer;
+        
+        /**
+         * Construct an object not initially locked for editing 
+         * with child and its peer
+         *
+         * @param child - a child
+         * @param proxyPeer - a peer for this child
+         */
+        BCSChild(Object child, Object proxyPeer) {
+            this.child = child;
+            this.proxyPeer = proxyPeer;
+        }
+        
+        /**
+         * Return a child
+         *
+         * @return a child this object was created with
+         */
+        Object getChild() {
+            return this.child;
+        }
+    }
+    
+    /**
+     * Nested class
+     */
+    protected static final class BCSIterator implements Iterator {
+        
+        /**
+         *
+         */
+        private Iterator it;
+        
+        /**
+         * Construct an iterator
+         *
+         * @param set - a set to create iterator from
+         */
+        BCSIterator(HashMap map) {
+            this.it = map.values().iterator();
+        }
+        
+        /**
+         *
+         */
+        public boolean hasNext() {            
+            return it.hasNext();
+        }
+        
+        /**
+         *
+         */
+        public Object next() {
+            return it.next();
+        }
+        
+        /**
+         *
+         */
+        public void remove() {
+            it.remove();
+        }
+    }
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = -4879613978649577204L;
+    
+    /**
+     * 
+     */
+    protected transient ArrayList bcmListeners;
+
+    /**
+     * 
+     */
+    protected transient HashMap children;
+
+    /**
+     * @serial
+     */
+    protected boolean designTime;   
+
+    /**
+     * @serial
+     */
+    protected Locale locale;
+
+    /**
+     * @serial
+     */
+    protected boolean okToUseGui;
+    
+    /**
+     * @serial
+     */
+    private int serializable;
+    
+    /**
+     * A flag to show if this BeanContext is in a process of serializing
+     */
+    private transient boolean serializing;
+    
+    /**
+     * PropertyChangeListener of this BeanContext
+     */
+    private transient PropertyChangeListener pcl;
+    
+    /**
+     * VetoableChangeListener of this BeanContext
+     */
+    private transient VetoableChangeListener vcl;
+    
+    /**
+     * A flag to prevent the infinite roll backs 
+     * while adding and removing children
+     */
+    private boolean rollingBack = false;;
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextSupport() {
+        this(null, null, false, true);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextSupport(BeanContext peer) {
+        this(peer, null, false, true);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextSupport(BeanContext peer, Locale lcle) {
+        this(peer, lcle, false, true);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime) {
+        this(peer, lcle, dtime, true);
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime, 
+            boolean visible) {
+                
+        super(peer);
+        
+        // If locale is null, use default
+        this.locale = (lcle == null ? Locale.getDefault() : lcle);
+                       
+        this.designTime = dtime;
+        this.okToUseGui = visible;
+        
+        // Initialize some values necessary for this class to operate
+        initialize();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean add(Object targetChild) {
+        
+        // We must synchronize on BeanContext.globalHierarchyLock
+        synchronized(BeanContext.globalHierarchyLock) {
+            
+            // Validate some values and states to check if we can proceed
+            if (!addChecks(targetChild)) {
+                return false;
+            }
+            
+            try {
+                
+                // If child is an instance of BeanContextChild or 
+                // BeanContextProxy,
+                // invoke setBeanContext() method on this child
+                // and register BeanContext with its child
+                // on PropertyChangeListener and VetoableChangeListener.
+                BeanContextChild ch = getChildBeanContextChild(targetChild);
+                
+                if (ch != null) {                                     
+                    ch.setBeanContext(getBeanContextPeer());
+                    ch.addPropertyChangeListener(BEAN_CONTEXT, this.pcl);
+                    ch.addVetoableChangeListener(BEAN_CONTEXT, this.vcl);
+                }           
+            } catch(PropertyVetoException e) {
+                
+                // Throw IllegalStateException, if PropertyVetoException occurs
+                throw new IllegalStateException(
+                    "PropertyVetoException was thrown while adding a child: " + 
+                    targetChild + "; Original error message:" + e.getMessage());
+            } 
+            
+            // If child implements Visibility, 
+            // set an appropriate type of ability to render GUI
+            Visibility vis = getChildVisibility(targetChild);
+                
+            if (vis != null) {
+                if (this.okToUseGui) {
+                    vis.okToUseGui();
+                } else {
+                    vis.dontUseGui();
+                }
+            }
+            
+            // Check if this child implements Serializable and increase 
+            // the number of serializable children of the BeanContext
+            if (getChildSerializable(targetChild) != null) {
+                this.serializable++;
+            }
+            
+            // Finally add child to the collection
+            addChild(targetChild);
+        }
+        
+        return true;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean addAll(Collection c) {
+        
+        Collection col = new ArrayList();
+        
+        // Add children one by one
+        for (Iterator i = c.iterator(); i.hasNext(); ) {
+            try {
+                Object next = i.next();
+                
+                if (add(next)) {
+                    col.add(next);
+                }
+            } catch(Exception e) {
+                
+                // Roll back changes but first check if it's already rolling 
+                // back to avoid infinitive action
+                if (!this.rollingBack) {
+                    this.rollingBack = true;
+                    removeAll(col);
+                } else {
+                    this.rollingBack = false;
+                }
+                
+                return false;
+            }
+        }
+        
+        return true;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void addBeanContextMembershipListener(
+            BeanContextMembershipListener bcml) {
+                
+        // BeanContextMembershipListener canj not be null
+        if (bcml == null) {
+            throw new NullPointerException("Membership listener is null");
+        }
+                
+        synchronized (this.bcmListeners) {
+            this.bcmListeners.add(bcml);    
+        }
+    }
+    
+    /**
+     * Check if we can add this child to BeanContext
+     *
+     * @param targetChild - a child to check
+     *
+     * @return true if we may continue
+     */
+    private boolean addChecks(Object targetChild) {
+        
+        // Child can not be null
+        if (targetChild == null) {
+            throw new IllegalArgumentException("Target child can not be null");
+        }
+        
+        // Each child should appear only once in a given BeanContext
+        if (containsKey(targetChild)) {
+            return false;
+        }
+        
+        return validatePendingAdd(targetChild); 
+    }
+    
+    /**
+     * Add child to the collection
+     *
+     * @param targetChild - the child to be added to the BeanContext
+     * @param fire - true if BeanContextMembershipEvent should be fired
+     */
+    private void addChild(Object targetChild) {
+        
+        // Add a new child using targetChild as a key and 
+        // its BCSChild instance as an entry
+        synchronized(this.children) {        
+            BCSChild ch = createBCSChild(targetChild, getBeanContextPeer());
+            this.children.put(targetChild, ch);                
+            childJustAddedHook(targetChild, ch);
+        }
+        
+        // Fire memebership event
+        fireChildrenAdded(getBCME(new Object[] { targetChild }));
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean avoidingGui() {
+        
+        // Avoiding GUI means that
+        // GUI is needed but not allowed to use at this time
+        return (needsGui() && !this.okToUseGui);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected Iterator bcsChildren() {
+        
+        // Return Iterator containing children 
+        // that are instances of BCSChild class
+        synchronized(this.children) {
+            return new BCSIterator(this.children);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void bcsPreDeserializationHook(ObjectInputStream ois) 
+            throws IOException, ClassNotFoundException {
+                
+        // Leave it for subclasses to implement
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void bcsPreSerializationHook(ObjectOutputStream oos) 
+            throws IOException {
+                
+        // Leave it for subclasses to implement
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void childDeserializedHook(Object child, 
+            BeanContextSupport.BCSChild bcsc) {
+                
+        synchronized(this.children) {
+            this.children.put(child, bcsc);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void childJustAddedHook(Object child, 
+            BeanContextSupport.BCSChild bcsc) {
+        
+        // Leave it for subclasses to implement
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected void childJustRemovedHook(Object child, 
+            BeanContextSupport.BCSChild bcsc) {
+        
+        // Leave it for subclasses to implement
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final boolean classEquals(Class first, Class second) {
+        
+        // Either classes themselves or their names should be equal
+        return (first.equals(second) ? 
+                true : 
+                    (first.getName().equals(second.getName()) ? 
+                     true : 
+                     false));
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void clear() {
+        throw new UnsupportedOperationException();
+        
+        /*
+        synchronized(BeanContext.globalHierarchyLock) {        
+            Collection col = new ArrayList();
+            
+            // Remove all children from BeanContext that are in the collection
+            // one by one. This operation is successfull if all the
+            // removals succeded
+            for (Iterator i = iterator(); i.hasNext(); ) {
+                try {  
+                    Object next = i.next();
+                    
+                    if (remove(next)) {
+                        col.add(next);
+                    }
+                } catch(Exception e) {
+                    
+                    // Roll back changes
+                    this.rollingBack = true;
+                    addAll(col);
+                    return;
+                }
+            }
+        }*/
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean contains(Object o) {      
+                
+        // See if a given object can be found among 
+        // the children's collection values
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized (this.children) {            
+                return this.children.containsKey(o);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean containsAll(Collection c) {
+        
+        // Iterate through the collection provided and find matches 
+        // in the current BeanContext. If not found return false.
+        for (Iterator i = c.iterator(); i.hasNext();) {
+            Object next = i.next();
+            
+            if (!contains(next)) {
+                return false;
+            }
+        }
+        
+        // If we are here, all the elements of the collection are presented
+        // in this BeanContext
+        return true;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean containsKey(Object o) {
+        
+        // See if a given object can be found among 
+        // the children's collection keys
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized (this.children) {
+                return this.children.containsKey(o);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final Object[] copyChildren() {
+        
+        // Make a copy of all children
+        synchronized (this.children) {    
+            return this.children.entrySet().toArray();
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected BCSChild createBCSChild(Object targetChild, Object peer) {
+        
+        // Create a child object with a reference to its peer
+        return new BCSChild(targetChild, peer);
+    }
+   
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void deserialize(ObjectInputStream ois, Collection coll) 
+            throws IOException, ClassNotFoundException {
+        
+        // Read objects from output stream until "EOS" (the end of stream)
+        // mark is found. Place all the objects into collection provided
+        while (true) {
+            Object l = ois.readObject();
+            
+            if (l != null && l.equals("EOS")) {
+                coll.add(l);
+            } else {
+                break;
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized void dontUseGui() {
+        
+        // Command this BeanContext and its children not to use GUI
+        this.okToUseGui = false;
+        
+        for (Iterator it = iterator(); it.hasNext(); ) {
+            Object next = it.next();            
+            Visibility vis = getChildVisibility(next);
+            
+            if (vis != null) {
+                vis.dontUseGui();
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireChildrenAdded(BeanContextMembershipEvent bcme) {
+        
+        // Notify all registered listenes about the change made
+        for (Iterator i = bcmListeners.iterator(); i.hasNext(); ) {
+            BeanContextMembershipListener cur =
+                (BeanContextMembershipListener) i.next();
+                
+            cur.childrenAdded(bcme);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme) {
+        
+        // Notify all registered listenes about the change made
+        for (Iterator i = bcmListeners.iterator(); i.hasNext(); ) {
+            BeanContextMembershipListener cur =
+                (BeanContextMembershipListener) i.next();
+                
+            cur.childrenRemoved(bcme);
+        }
+    }
+    
+    /**
+     * Get BeanContextMembershipEvent class instance
+     *
+     * @param changes - an array of changes that has been made
+     *
+     * @return BeanContextMembershipEvent object
+     */
+    private BeanContextMembershipEvent getBCME(Object[] changes) {
+        return new BeanContextMembershipEvent(getBeanContextPeer(), changes);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public BeanContext getBeanContextPeer() {
+        return (BeanContext) getBeanContextChildPeer();
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final BeanContextChild getChildBeanContextChild(
+            Object child) {
+                
+        // There's nothing to do here if the child is null
+        if (child == null) {
+            return null;
+        }
+        
+        // See if the child implements BeanContextChild or BeanContextProxy. 
+        // Cast it to appropriate class or simply return null
+        if (child instanceof BeanContextChild) {
+            return (BeanContextChild) child;
+        } else if (child instanceof BeanContextProxy) {
+            return ((BeanContextProxy) child).getBeanContextProxy();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final BeanContextMembershipListener 
+            getChildBeanContextMembershipListener(Object child) {
+                
+        // See if child implements BeanContextMembershipListener. 
+        // Cast it to BeanContextMembershipListener if it does 
+        // or return null otherwise
+        if ((child != null) && child instanceof BeanContextMembershipListener) {
+            return (BeanContextMembershipListener) child;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final PropertyChangeListener 
+            getChildPropertyChangeListener(Object child) {
+                
+        // See if child implements PropertyChangeListener. 
+        // Cast it to PropertyChangeListener if it does
+        // or return null otherwise
+        if ((child != null) && child instanceof PropertyChangeListener) {
+            return (PropertyChangeListener) child;
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final Serializable getChildSerializable(Object child) {
+        
+        // See if child implements Serializable. 
+        // Cast it to Serializable if it does
+        // or return null otherwise
+        if ((child != null) && child instanceof Serializable) {
+            return (Serializable) child;
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final VetoableChangeListener 
+            getChildVetoableChangeListener(Object child) {
+                
+        // See if child implements VetoableChangeListener. 
+        // Cast it to VetoableChangeListener if it does
+        // or return null otherwise
+        if ((child != null) && child instanceof VetoableChangeListener) {
+            return (VetoableChangeListener) child;
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected static final Visibility getChildVisibility(Object child) {
+        
+        // See if child implements Visibility. 
+        // Cast it to Visibility if it does
+        // or return null otherwise
+        if ((child != null) && child instanceof Visibility) {
+            return (Visibility) child;
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized Locale getLocale() {
+        return this.locale;
+    }
+    
+    /**
+     * Construct PropertyChangeEvent object and return
+     *
+     * @param prop - property name
+     * @param o - the old value
+     * @param n - the new value
+     * 
+     * @return PropertyChangeEvent object
+     */
+    private PropertyChangeEvent getPCE(String prop, Object o, Object n) {
+        return new PropertyChangeEvent(getBeanContextPeer(), prop, o, n);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public URL getResource(String name, BeanContextChild bcc) {
+        
+        // The resource name should not be null
+        if(name == null) {
+            throw new IllegalArgumentException("Resource name can not be null");
+        }
+        
+        // Load resource using the same ClassLoader as BeanContextChild specified
+        // If NullPointerException occurs try to load it as system resource
+        try {
+            return bcc.getClass().getClassLoader().getResource(name);
+        } catch(NullPointerException e) {
+            try {
+                return ClassLoader.getSystemResource(name);
+            } catch(Exception ex) {
+                
+                // We tried our best but still failed
+                throw new IllegalArgumentException("Invalid resource");
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public InputStream getResourceAsStream(String name, BeanContextChild bcc) {
+        
+        // The resource name should not be null
+        if(name == null) {
+            throw new IllegalArgumentException("Resource name can not be null");
+        }
+        
+        // Load resource using the same ClassLoader as BeanContextChild specified
+        // If NullPointerException occurs try to load it as system resource
+        try {
+            return bcc.getClass().getClassLoader().getResourceAsStream(name);
+        } catch(NullPointerException e) {
+            try {
+                return ClassLoader.getSystemResourceAsStream(name);
+            } catch(Exception ex) {
+                
+                // No success at all
+                throw new IllegalArgumentException("Invalid resource");
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected synchronized void initialize() {
+        
+        // Initialize some fields
+        this.children = new HashMap();
+        this.bcmListeners = new ArrayList();
+        
+        this.serializable = 0;
+        this.serializing = false;
+        
+        // Initialize PropertyChangeListener
+        this.pcl = new PropertyChangeListener() {
+            
+            public void propertyChange(PropertyChangeEvent pce) {
+                BeanContextSupport.this.propertyChange(pce);
+            }
+        };
+        
+        // Initialize VetoableChangeListener
+        this.vcl = new VetoableChangeListener() {
+            
+            public void vetoableChange(PropertyChangeEvent pce) 
+                    throws PropertyVetoException {
+                       
+                BeanContextSupport.this.vetoableChange(pce);
+            }
+        };
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object instantiateChild(String beanName) 
+            throws IOException, ClassNotFoundException {
+                
+        // Use Beans convenience method to instantiate the bean
+        return Beans.instantiate(getBeanContextPeer().getClass().getClassLoader(), 
+                                 beanName, 
+                                 getBeanContextPeer());
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized boolean isDesignTime() {
+        return this.designTime;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean isEmpty() {
+        
+        // See if there are any children in this BeanContext
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                return this.children.isEmpty();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean isSerializing() {
+        return this.serializing;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Iterator iterator() {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                return this.children.keySet().iterator();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized boolean needsGui() {
+        
+        // BeanContext needs GUI if at least one its children needs it.
+        // We may check it by trying to cast each child to Visibility
+        // and see it needs GUI.
+        // A child definitely needs GUI if it implements Component
+        for (Iterator it = iterator(); it.hasNext(); ) {
+            Object next = it.next();            
+            Visibility vis = getChildVisibility(next);
+            
+            if (vis != null) {
+                if (vis.needsGui()) {
+                    return true;
+                }
+            } 
+            
+            if (next instanceof java.awt.Component) {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized void okToUseGui() {
+        
+        // Notify this BeanContext and its children that it's OK now to use GUI
+        this.okToUseGui = true;
+        
+        for (Iterator it = iterator(); it.hasNext(); ) {
+            Object next = it.next();            
+            Visibility vis = getChildVisibility(next);
+            
+            if (vis != null) {
+                vis.okToUseGui();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void propertyChange(PropertyChangeEvent pce) {
+        
+        if (!pce.getPropertyName().equals(BEAN_CONTEXT)) {
+            return;
+        }
+        
+        Object source = pce.getSource();
+        
+        if (source instanceof BCSChild) {
+            BCSChild ch = (BCSChild) source;
+            Object newValue = pce.getNewValue();            
+            
+            if (!newValue.equals(this.getBeanContextPeer())) {
+                remove(ch.getChild(), false);
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final void readChildren(ObjectInputStream ois) 
+            throws IOException, ClassNotFoundException {
+        
+        // Deserialize children
+        for (int i = 0; i < this.serializable; i++) {  
+            BCSChild bChild = (BCSChild) ois.readObject();
+            childDeserializedHook(bChild.getChild(), bChild);
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    private void readObject(ObjectInputStream ois) 
+            throws IOException, ClassNotFoundException {
+                
+        synchronized(BeanContext.globalHierarchyLock) {           
+            ois.defaultReadObject();             
+            initialize();             
+            bcsPreDeserializationHook(ois);
+            
+            // Deserialize children
+            if (!getBeanContextPeer().equals(this)) {
+                readChildren(ois);
+            }
+            
+            // Deserialize listeners
+            synchronized(this.bcmListeners) {
+                deserialize(ois, this.bcmListeners);
+            } 
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean remove(Object targetChild) {
+        return remove(targetChild, true);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected boolean remove(Object targetChild, boolean callChildSetBC) {
+        
+        synchronized(BeanContext.globalHierarchyLock) {
+            
+            // Make necessary checks
+            if (!validatePendingRemove(targetChild)) {
+                return false;
+            }
+            
+            Object removed = null;
+            
+            if (containsKey(targetChild)) {      
+                
+                // Remove the reference to the BeanContext from the child 
+                // if ordered to do so
+                if (callChildSetBC) {
+                    removeFromContext(targetChild);
+                }
+                
+                synchronized(this.children) {
+                    
+                    // Just before removing save a reference to it for later use
+                    // in childJustRemovedHook() method
+                    BCSChild ch = (BCSChild) this.children.get(targetChild);
+                    removed = this.children.remove(targetChild);
+                    childJustRemovedHook(targetChild, ch);
+                }
+                
+                // Fire the event
+                fireChildrenRemoved(getBCME(new Object[] { targetChild }));
+                
+                // Check if this child implements Serializable and decrease 
+                // the number of serializable children of BeanContext
+                if (getChildSerializable(targetChild) != null) {
+                    this.serializable--;
+                }
+            }
+            
+            return (removed != null);
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean removeAll(Collection c) {
+        throw new UnsupportedOperationException();
+        /*
+        synchronized(BeanContext.globalHierarchyLock) {        
+            Collection col = new ArrayList();
+            
+            // Remove all children from BeanContext that are in the collection
+            // one by one. This operation is successfull if all the
+            // removals succeded
+            for (Iterator i = c.iterator(); i.hasNext(); ) {
+                try {
+                    Object next = i.next();
+                    
+                    if (remove(next)) {
+                        col.add(next);
+                    }
+                } catch(Exception e) {
+                    
+                    // Roll back changes but first check if it's already rolling 
+                    // back to avoid infinitive action
+                    if (!this.rollingBack) {
+                        this.rollingBack = true;
+                        addAll(col);
+                    } else {
+                        this.rollingBack = false;
+                    }
+                    
+                    return false;
+                }
+            }
+        }
+        
+        return true;*/
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void removeBeanContextMembershipListener(
+            BeanContextMembershipListener bcml) {
+                
+        // BeanContextMembershipListener can not be null
+        if (bcml == null) {
+            throw new NullPointerException("Membership listener is null");
+        }
+        
+        synchronized(this.bcmListeners) {
+            this.bcmListeners.remove(bcml);
+        }
+    }
+    
+    /**
+     * Separate BeanContext and its child that had just been removed
+     * by removing all references to each other
+     *
+     * @param targetChild - a BeanContext child that was removed
+     */
+    private void removeFromContext(Object targetChild) {
+        try {
+                        
+            // If child is an instance of BeanContextChild or BeanContextProxy,
+            // invoke setBeanContext() method on this child
+            // with null parameter
+            BeanContextChild ch = getChildBeanContextChild(targetChild);
+                
+            if (ch != null) {                                     
+                ch.setBeanContext(null);               
+                ch.removePropertyChangeListener(BEAN_CONTEXT, this.pcl);
+                ch.removeVetoableChangeListener(BEAN_CONTEXT, this.vcl);
+            }   
+        } catch(PropertyVetoException e) {
+            
+            // Required by spec
+            throw new IllegalStateException(
+                "PropertyVetoException was thrown while removing " +
+                " a child: " + targetChild + "; " +
+                "Original error message:" + e.getMessage());
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public boolean retainAll(Collection c) {
+        throw new UnsupportedOperationException();
+        
+        /*
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                
+                Collection col = new ArrayList();
+                
+                // Remove all children from BeanContext that are not in the 
+                // collection
+                // This operation is successfull if all the removals succeded
+                for (Iterator i = iterator(); i.hasNext(); ) {   
+                    Object nextKey = i.next();
+                    Object nextValue = this.children.get(nextKey);
+                    
+                    if (!c.contains(nextKey) && !c.contains(nextValue)) {
+                        try {                            
+                            if (remove(nextKey)) {
+                                col.add(nextKey);
+                            }
+                        } catch(Exception e) {
+                            
+                            // Roll back changes
+                            this.rollingBack = true;
+                            addAll(col);
+                            return false;
+                        }
+                    }
+                }
+            }
+        }
+        
+        return true;*/
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected final void serialize(ObjectOutputStream oos, Collection coll) 
+            throws IOException {
+        
+        // Write the collection into ObjectOutputStream
+        for (Iterator it = coll.iterator(); it.hasNext(); ) {
+            Object l = it.next();
+            
+            if (this.getChildSerializable(l) != null) {
+                oos.writeObject(l);
+            }
+        }
+        
+        // Mark the end of stream
+        oos.writeObject("EOS");
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized void setDesignTime(boolean dTime) {
+        
+        boolean old = this.designTime;
+        this.designTime = dTime;
+        
+        // Notify BeanContext about this change
+        firePropertyChange("designTime", new Boolean(old), new Boolean(dTime));
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public synchronized void setLocale(Locale newLocale) 
+            throws PropertyVetoException {
+        
+        // Use default locale if a new value is null        
+        newLocale = (newLocale == null ? Locale.getDefault() : newLocale);   
+        
+        // Notify BeanContext about this change
+        Locale old = (Locale) this.locale.clone();
+        this.locale = newLocale;
+        firePropertyChange("locale", old, newLocale);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public int size() {
+        
+        // Return the number of children of this BeanContext
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                return this.children.size();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object[] toArray() {
+        
+        // Convert the collection of children to array
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                return this.children.keySet().toArray();
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public Object[] toArray(Object[] arry) {
+        
+        // Convert the collection of children to array
+        synchronized(BeanContext.globalHierarchyLock) {
+            synchronized(this.children) {
+                return this.children.keySet().toArray(arry);
+            }
+        }
+    }
+
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected boolean validatePendingAdd(Object targetChild) {
+        
+        
+        return true;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    protected boolean validatePendingRemove(Object targetChild) {
+        
+        if (targetChild == null) {
+            throw new IllegalArgumentException("Target child is null");
+        }
+        
+        return true;
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public void vetoableChange(PropertyChangeEvent pce) 
+            throws PropertyVetoException {
+                
+        
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    public final void writeChildren(ObjectOutputStream oos) throws IOException {
+        
+        // Write serializable children to ObjectOutputStream
+        synchronized(this.children) {
+            for (Iterator it = iterator(); it.hasNext(); ) {
+                Object next = it.next();
+                
+                if (getChildSerializable(next) != null) {
+                    oos.writeObject(this.children.get(next));
+                }
+            }
+        }
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref
+     */
+    private void writeObject(ObjectOutputStream oos)
+            throws IOException, ClassNotFoundException {
+                  
+        synchronized(BeanContext.globalHierarchyLock) {
+            this.serializing = true;            
+            oos.defaultWriteObject();     
+            
+            bcsPreSerializationHook(oos);          
+            
+            if (!this.getBeanContextPeer().equals(this)) {
+                writeChildren(oos);            
+            }
+            
+            synchronized(this.bcmListeners) {
+                serialize(oos, this.bcmListeners);
+            }
+            
+            this.serializing = false;
+        }
+    }                         
+}



Mime
View raw message