Package org.apache.felix.dm

Examples of org.apache.felix.dm.DependencyManager.createComponent()


       DependencyManager m = new DependencyManager(context);
       // helper class that ensures certain steps get executed in sequence
       Ensure e = new Ensure();
       // create a service provider and consumer
       Component provider = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
       Component providerWithHighRank = m.createComponent().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface.class.getName(), new Properties() {{ put(Constants.SERVICE_RANKING, Integer.valueOf(5)); }});
       Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
       m.add(provider);
       m.add(providerWithHighRank);
       m.add(consumer);
       e.waitForStep(3, 15000);
View Full Code Here


       // helper class that ensures certain steps get executed in sequence
       Ensure e = new Ensure();
       // create a service provider and consumer
       Component provider = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
       Component providerWithHighRank = m.createComponent().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface.class.getName(), new Properties() {{ put(Constants.SERVICE_RANKING, Integer.valueOf(5)); }});
       Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
       m.add(provider);
       m.add(providerWithHighRank);
       m.add(consumer);
       e.waitForStep(3, 15000);
       m.remove(providerWithHighRank);
View Full Code Here

   public void testReplacementAutoConfig() {
       DependencyManager m = new DependencyManager(context);
       // helper class that ensures certain steps get executed in sequence
       Ensure e = new Ensure();
       // create a service provider and consumer
       Component provider = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
       Component provider2 = m.createComponent().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface.class.getName(), null);
       Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
       m.add(provider2);
       m.add(consumer);
       e.waitForStep(3, 15000);
View Full Code Here

       DependencyManager m = new DependencyManager(context);
       // helper class that ensures certain steps get executed in sequence
       Ensure e = new Ensure();
       // create a service provider and consumer
       Component provider = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
       Component provider2 = m.createComponent().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface.class.getName(), null);
       Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
       m.add(provider2);
       m.add(consumer);
       e.waitForStep(3, 15000);
       m.add(provider);
View Full Code Here

       // helper class that ensures certain steps get executed in sequence
       Ensure e = new Ensure();
       // create a service provider and consumer
       Component provider = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
       Component provider2 = m.createComponent().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface.class.getName(), null);
       Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
       m.add(provider2);
       m.add(consumer);
       e.waitForStep(3, 15000);
       m.add(provider);
       m.remove(provider2);
View Full Code Here

    public void testMultipleExtraDependencies()
    {
        DependencyManager m = new DependencyManager(context);
        Ensure e = new Ensure();
       
        Component sp2 = m.createComponent()
              .setImplementation(ServiceProvider2.class).setInterface(ServiceProvider2.class.getName(), null)
              .add(m.createServiceDependency()
                   .setService(Runnable.class, "(foo=bar)")
                   .setRequired(false)
                   .setAutoConfig("m_runnable"))
View Full Code Here

                   .setRequired(true)
                   .setCallbacks("bind", null))
              .setCallbacks(null, "start", "stop", null)
              .setComposition("getComposition");
       
        Component sp = m.createComponent()
              .setImplementation(ServiceProvider.class)
              .setInterface(ServiceInterface.class.getName(),
                            new Hashtable() {{ put("foo", "bar"); }})
              .add(m.createServiceDependency()
                   .setService(Sequencer.class)
View Full Code Here

                   .setService(ServiceProvider2.class)
                   .setRequired(true)
                   .setCallbacks("bind", "unbind"))
              .setCallbacks(null, "start", "stop", null);
       
        Component sc = m.createComponent()
              .setImplementation(ServiceConsumer.class)
              .add(m.createServiceDependency()
                   .setService(Sequencer.class)
                   .setRequired(true)
                   .setAutoConfig("m_sequencer"))
View Full Code Here

                   .setAutoConfig("m_service"))
              .setCallbacks(null, "start", "stop", null);
       
        // Provide the Sequencer service to the MultipleAnnotationsTest class.
        Component sequencer =
            m.createComponent().setImplementation(new SequencerImpl(e))
                             .setInterface(Sequencer.class.getName(), null);
        m.add(sp2);
        m.add(sp);
        m.add(sc);
        m.add(sequencer);
View Full Code Here

    public void testInstanceBoundDependency() {
        DependencyManager m = new DependencyManager(context);
        // helper class that ensures certain steps get executed in sequence
        Ensure e = new Ensure();
        // create a service provider and consumer
        Component sp = m.createComponent()
            .setInterface(ServiceInterface.class.getName(), null)
            .setImplementation(new ServiceProvider(e));
        Component sp2 = m.createComponent()
        .setInterface(ServiceInterface2.class.getName(), null)
            .setImplementation(new ServiceProvider2(e));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.