Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContext


    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Ser()
            throws Exception {

        ClassLoader loader = new SerClassLoader();
        BeanContext context = new BeanContextSupport();
        AppletInitializer appInit = new MockAppletInitializer();
        Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
                appInit);

        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


    }

    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_LoaderNull()
            throws Exception {
        String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
        BeanContext context = new BeanContextSupport();
        AppletInitializer appInit = new MockAppletInitializer();

        Object bean = Beans.instantiate(null, beanName, context, appInit);

        assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
                .getClassLoader());
        assertEquals(beanName, bean.getClass().getName());
        assertTrue(context.contains(bean));
    }
View Full Code Here

    }

    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_BeanNull()
            throws Exception {
        ClassLoader loader = createSpecificClassLoader();
        BeanContext context = new BeanContextSupport();
        AppletInitializer appInit = new MockAppletInitializer();

        try {
            Beans.instantiate(loader, null, context, appInit);
            fail("Should throw NullPointerException.");
View Full Code Here

    public void testInstantiateClassLoaderStringBeanContextAppletInitializer_InitializerNull()
            throws Exception {
        ClassLoader loader = createSpecificClassLoader();
        String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
        BeanContext context = new BeanContextSupport();
        Object bean = Beans.instantiate(loader, beanName, context, null);

        assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
                .getClassLoader());
        assertEquals(beanName, bean.getClass().getName());
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

        //
        // 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

                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 super.getCurrentServiceSelectors(serviceClass);
       
        BeanContext bc = getBeanContext();
        if (bc instanceof BeanContextServices)
            return ((BeanContextServices)bc).getCurrentServiceSelectors(serviceClass);

        return null;
    }
View Full Code Here

    }
   
    public static void destroyControl( Object controlInstance )
    {
        assert controlInstance instanceof ControlBean : controlInstance.getClass().getName();
        BeanContext beanContext = ( ( ControlBean ) controlInstance ).getBeanContext();
        if ( beanContext != null ) beanContext.remove( controlInstance );
    }
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.