Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContext


     *            and the property that has changed.
     */
    public void propertyChange(PropertyChangeEvent evt) {
        // monitor "beanContext" property
        if ("beanContext".equals(evt.getPropertyName()) && contains(evt.getSource())) {
            BeanContext bc = (BeanContext) getPeer();
            if (bc.equals(evt.getOldValue()) && !bc.equals(evt.getNewValue())) {
                internalRemove(evt.getSource(), false);
            }
        }
    }
View Full Code Here


        if (sp != null && !sp.isRevoked()) {
            return true;
        }

        // if service not found locally check in nested context
        BeanContext bc = getBeanContext();
        if (bc instanceof BeanContextServices) {
            return ((BeanContextServices) bc).hasService(serviceClass);
        }
        return false;
        // end synchronized
View Full Code Here

        if (!contains(child)) {
            throw new IllegalArgumentException(child + "is not a child of this context!");
        }

        Object service;
        BeanContext bc = getBeanContext();

        // todo: for multithreaded usage this block needs to be synchronized
        // check to see if this is a known service
        ServiceProvider sp = _serviceProviders.get(serviceClass);
        if (sp != null) {
View Full Code Here

        //
        // The parent BeanContext is responsible for providing requested services.  If
        // no parent context is available or it is does not manage services, then no service.
        //
        BeanContext bc = getBeanContext();
        if (bc == null || !(bc instanceof BeanContextServices))
            return null;

        //
        // Call getService on the parent context, using this bean as the requestor and the
View Full Code Here

        // Initially set to the local beans relative ID
        String id = _bean.getLocalID();

        // If there is a parent context, prepend its ID and the ID separator
        BeanContext bc = getBeanContext();
        if (bc != null && bc instanceof ControlBeanContext)
        {
            String parentID = ((ControlBeanContext)bc).getControlID();
            if (parentID != null)
            {
View Full Code Here

            Iterator iter = bcs.getCurrentServiceClasses();
            while (iter.hasNext())
                classSet.add(iter.next());

            // Go up to the parent, if it is a service provider as well
            BeanContext bc = getBeanContext();
            if (bc instanceof BeanContextServices && bcs != bc)
                bcs = (BeanContextServices)bc;
            else
                bcs = null;
        }
View Full Code Here

    public Iterator getCurrentServiceSelectors(Class serviceClass)
    {
        if (hasService(serviceClass))
            return _beanContextServicesDelegate.getCurrentServiceSelectors(serviceClass);

        BeanContext bc = getBeanContext();
        if (bc instanceof BeanContextServices)
            return ((BeanContextServices)bc).getCurrentServiceSelectors(serviceClass);

        return null;
    }
View Full Code Here

        //
        // Get the associated context object, then use it to locate the (parent) bean context.
        // Services are always provided by the parent context.
        //
        ControlBeanContext cbc = getControlBeanContext();
        BeanContext bc = cbc.getBeanContext();
        if (bc == null || !(bc instanceof BeanContextServices))
            throw new ControlException("Can't locate service context: " + bc);

        //
        // Call getService on the parent context, using this bean as the requestor and the
View Full Code Here

     */
    public void testInstantiateClassLoaderStringBeanContext_Class()
            throws Exception {

        ClassLoader loader = new BinClassLoader();
        BeanContext context = new BeanContextSupport();
        Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context);

        assertEquals("as_class", (String) bean.getClass().getMethod(
                "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
        assertSame(loader, bean.getClass().getClassLoader());
        assertTrue(context.contains(bean));
    }
View Full Code Here

    }

    public void testInstantiateClassLoaderStringBeanContext_Ser()
            throws Exception {
        ClassLoader loader = new SerClassLoader();
        BeanContext context = new BeanContextSupport();
        Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context);

        assertEquals("as_object", (String) bean.getClass().getMethod(
                "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
        assertSame(loader, bean.getClass().getClassLoader());
        assertTrue(context.contains(bean));
    }
View Full Code Here

TOP

Related Classes of java.beans.beancontext.BeanContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.