Package org.apache.geronimo.gbean

Examples of org.apache.geronimo.gbean.ReferenceCollection


    private URI[] parentIdArray = new URI[] {URI.create("test/foo")};
    private List parentId = Arrays.asList(parentIdArray);

    public void testJavaBeanXmlAttribute() throws Exception {
        ReferenceCollection referenceCollection = new MockReferenceCollection();
        JavaBeanXmlAttributeBuilder javaBeanXmlAttributeBuilder = new JavaBeanXmlAttributeBuilder();
        //this is kind of cheating, we rely on the builder to iterate through existing members of the collection.
        referenceCollection.add(javaBeanXmlAttributeBuilder);
        new ServiceConfigBuilder(parentIdArray, null, referenceCollection, null, null);
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final URL plan1 = cl.getResource("services/plan1.xml");
        ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1);
        ConfigurationType plan = doc.getConfiguration();
View Full Code Here


                }
            }
        }

        //Add the hosts
        ReferenceCollection refs = (ReferenceCollection)hosts;
        refs.addReferenceCollectionListener(new ReferenceCollectionListener() {

            public void memberAdded(ReferenceCollectionEvent event) {
                Object o = event.getMember();
                ObjectRetriever objectRetriever = (ObjectRetriever) o;
                String hostName = ((Host)objectRetriever.getInternalObject()).getName();
                if (!hostName.equals(defaultHostName))
                    addHost(objectRetriever);
            }

            public void memberRemoved(ReferenceCollectionEvent event) {
                Object o = event.getMember();
                ObjectRetriever objectRetriever = (ObjectRetriever) o;
                String hostName = ((Host)objectRetriever.getInternalObject()).getName();
                if (!hostName.equals(defaultHostName))
                    removeHost(objectRetriever);
            }
        });
       
        Iterator iterator = refs.iterator();
        while (iterator.hasNext()){
            ObjectRetriever objRetriever = (ObjectRetriever)iterator.next();
            String hostName = ((Host)objRetriever.getInternalObject()).getName();
            if (!hostName.equals(defaultHostName))
                addHost(objRetriever);
View Full Code Here

        if (persistenceUnitGBeans == null) {
            return;
        }

        if (persistenceUnitGBeans instanceof ReferenceCollection) {
            ReferenceCollection referenceCollection = (ReferenceCollection) persistenceUnitGBeans;
            referenceCollection.addReferenceCollectionListener(new ReferenceCollectionListener() {
                public void memberAdded(ReferenceCollectionEvent event) {
                    addPersistenceUnitGBean((PersistenceUnitGBean) event.getMember());
                }

                public void memberRemoved(ReferenceCollectionEvent event) {
View Full Code Here

        if (resourceAdapterWrappers == null) {
            return;
        }

        if (resourceAdapterWrappers instanceof ReferenceCollection) {
            ReferenceCollection referenceCollection = (ReferenceCollection) resourceAdapterWrappers;
            referenceCollection.addReferenceCollectionListener(new ReferenceCollectionListener() {
                public void memberAdded(ReferenceCollectionEvent event) {
                    addResourceAdapter((ResourceAdapterWrapper) event.getMember());
                }

                public void memberRemoved(ReferenceCollectionEvent event) {
View Full Code Here

                                      @ParamAttribute(name="useAllConfigurations") boolean useAllConfigurations) {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) sm.checkPermission(SecurityServiceImpl.CONFIGURE);

        if (configurations instanceof ReferenceCollection) {
            ReferenceCollection ref = (ReferenceCollection) configurations;
            ref.addReferenceCollectionListener(this);
        }

        this.configurations = configurations;
        this.useAllConfigurations = useAllConfigurations;
View Full Code Here

        assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
        jar.close();
    }

    public void testJavaBeanXmlAttribute() throws Exception {
        ReferenceCollection referenceCollection = new MockReferenceCollection();
        JavaBeanXmlAttributeBuilder javaBeanXmlAttributeBuilder = new JavaBeanXmlAttributeBuilder();
        //this is kind of cheating, we rely on the builder to iterate through existing members of the collection.
        referenceCollection.add(javaBeanXmlAttributeBuilder);
        Naming naming = new Jsr77Naming();
        NamespaceDrivenBuilder gbeanBuilder = new GBeanBuilder(referenceCollection, null);
//        ConfigurationBuilder serviceBuilder = new ServiceConfigBuilder(parentEnvironment, null, Collections.singleton(gbeanBuilder), naming);
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final URL plan1 = cl.getResource("services/plan1.xml");
View Full Code Here

    public void setConfigurations(Collection<ConfigurationEntryFactory> configurations) {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) sm.checkPermission(SecurityServiceImpl.CONFIGURE);

        if (configurations instanceof ReferenceCollection) {
            ReferenceCollection ref = (ReferenceCollection) configurations;
            ref.addReferenceCollectionListener(this);
        }

        this.configurations = configurations;

        for (ConfigurationEntryFactory configuration : configurations) {
View Full Code Here

        assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
        jar.close();
    }

    public void testJavaBeanXmlAttribute() throws Exception {
        ReferenceCollection referenceCollection = new MockReferenceCollection();
        JavaBeanXmlAttributeBuilder javaBeanXmlAttributeBuilder = new JavaBeanXmlAttributeBuilder();
        //this is kind of cheating, we rely on the builder to iterate through existing members of the collection.
        referenceCollection.add(javaBeanXmlAttributeBuilder);
        Naming naming = new Jsr77Naming();
        NamespaceDrivenBuilder gbeanBuilder = new GBeanBuilder(referenceCollection, null);
//        ConfigurationBuilder serviceBuilder = new ServiceConfigBuilder(parentEnvironment, null, Collections.singleton(gbeanBuilder), naming);
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final URL plan1 = cl.getResource("services/plan1.xml");
View Full Code Here

            Registry.setServer(mbeanServerReference.getMBeanServer());
        }
       
        //Add the hosts
        if (hosts instanceof ReferenceCollection) {
            ReferenceCollection refs = (ReferenceCollection)hosts;
            refs.addReferenceCollectionListener(new ReferenceCollectionListener() {

                public void memberAdded(ReferenceCollectionEvent event) {
                    ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(EngineGBean.this.getClass().getClassLoader());
                        Object o = event.getMember();
                        ObjectRetriever objectRetriever = (ObjectRetriever) o;
                        String hostName = ((Host) objectRetriever.getInternalObject()).getName();
                        if (!hostName.equals(defaultHostName))
                            addHost(objectRetriever);
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldClassLoader);
                    }
                }

                public void memberRemoved(ReferenceCollectionEvent event) {
                    Object o = event.getMember();
                    ObjectRetriever objectRetriever = (ObjectRetriever) o;
                    String hostName = ((Host)objectRetriever.getInternalObject()).getName();
                    if (!hostName.equals(defaultHostName))
                        removeHost(objectRetriever);
                }
            });
            Iterator iterator = refs.iterator();
            while (iterator.hasNext()){
                ObjectRetriever objRetriever = (ObjectRetriever)iterator.next();
                String hostName = ((Host)objRetriever.getInternalObject()).getName();
                if (!hostName.equals(defaultHostName))
                    addHost(objRetriever);
View Full Code Here

        if (persistenceUnitGBeans == null) {
            return;
        }

        if (persistenceUnitGBeans instanceof ReferenceCollection) {
            ReferenceCollection referenceCollection = (ReferenceCollection) persistenceUnitGBeans;
            referenceCollection.addReferenceCollectionListener(new ReferenceCollectionListener() {
                public void memberAdded(ReferenceCollectionEvent event) {
                    addPersistenceUnitGBean((PersistenceUnitGBean) event.getMember());
                }

                public void memberRemoved(ReferenceCollectionEvent event) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.ReferenceCollection

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.