Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.Factory


    @Before
    public void setUp() {
        Properties p = new Properties();
        p.put("instance.name", "importer");
        Factory compFact = ipojoHelper.getFactory("composite.requires.5");
        try {
            import1 = compFact.createComponentInstance(p);
        } catch (Exception e) {
            fail("Cannot instantiate the component : " + e.getMessage());
        }
        import1.stop();
View Full Code Here


        }

        foo1.stop();
        foo2.stop();

        Factory factory = ipojoHelper.getFactory("composite.export.4");
        Properties props = new Properties();
        props.put("instance.name", "export");
        try {
            export3 = factory.createComponentInstance(props);
        } catch (Exception e) {
            fail("Fail to instantiate exporter " + e.getMessage());
        }
    }
View Full Code Here

        }

        foo1.stop();
        foo2.stop();

        Factory factory = ipojoHelper.getFactory("composite.export.2");
        Properties props = new Properties();
        props.put("instance.name", "export");
        try {
            export2 = factory.createComponentInstance(props);
        } catch (Exception e) {
            fail("Fail to instantiate exporter " + e.getMessage());
        }
    }
View Full Code Here

        }

        foo1.stop();
        foo2.stop();

        Factory factory = ipojoHelper.getFactory("composite.export.1");
        Properties props = new Properties();
        props.put("instance.name", "export");
        try {
            export1 = factory.createComponentInstance(props);
        } catch (Exception e) {
            fail("Fail to instantiate exporter " + e.getMessage());
        }
    }
View Full Code Here

        }

        foo1.stop();
        foo2.stop();

        Factory factory = ipojoHelper.getFactory("composite.export.5");
        Properties props = new Properties();
        props.put("instance.name", "export");
        try {
            export1 = factory.createComponentInstance(props);
        } catch (Exception e) {
            fail("Fail to instantiate exporter " + e.getMessage());
        }
    }
View Full Code Here

        }

        foo1.stop();
        foo2.stop();

        Factory factory = ipojoHelper.getFactory("composite.export.3");
        Properties props = new Properties();
        props.put("instance.name", "export");
        try {
            export3 = factory.createComponentInstance(props);
        } catch (Exception e) {
            fail("Fail to instantiate exporter " + e.getMessage());
        }
    }
View Full Code Here

                    String key = (String) keys.nextElement();
                    if (!containsProperty(key, props)) { return false; }
                    conf.put(key, m_configuration.get(key));
                }

                Factory factory = (Factory) getService(fact);
                return factory.isAcceptable(conf);
            }
        }
        return false;
    }
View Full Code Here

     * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference)
     */
    public void onServiceArrival(ServiceReference ref) {
        // The given factory matches.
        try {
            Factory fact = (Factory) getService(ref);
            if (m_factories.get(ref) == null) {
                ComponentInstance instance = createInstance(fact);
                m_factories.put(ref, instance);
            } else {
                m_handler
                        .info("An arriving factory is already used, ignore the creation : "
                                + fact.getName());
            }
           
        } catch (UnacceptableConfiguration e) {
            m_handler.error("A matching factory refuses the actual configuration : " + e.getMessage());
            m_handler.getCompositeManager().stop();
View Full Code Here

            if (handler == null) {
                // Look for the ServiceDependencyHandler factory
                HandlerManager handlerManager = null;
                try {
                    ServiceReference[] refs = m_context.getServiceReferences(Factory.class.getName(), "(&(handler.name=subservice)(handler.namespace=" + HandlerFactory.IPOJO_NAMESPACE + ")(handler.type=composite))");
                    Factory factory = (Factory) m_context.getService(refs[0]);
                    handlerManager = (HandlerManager) factory.createComponentInstance(null, getCompositeManager().getServiceContext());
                } catch (InvalidSyntaxException e) {
                    // Should not happen
                } catch (UnacceptableConfiguration e) {
                    // Should not happen
                } catch (MissingHandlerException e) {
View Full Code Here

*/
public class TestInstances extends Common {

    @Test
    public void testNoInstances() {
        Factory factory = ipojoHelper.getFactory("NoInstances");
        assertNotNull(factory);

        assertNotNull(factory.getInstancesNames());
        assertNotNull(factory.getInstances());

        assertEquals(0, factory.getInstancesNames().size());
        assertEquals(0, factory.getInstances().size());
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.Factory

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.