Package org.apache.felix.dm

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


        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().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
        Component sc = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
        Component sa2 = m.createAspectService(ServiceInterface.class, null, 20, null).setImplementation(new ServiceAspect(e, 3));
        Component sa3 = m.createAspectService(ServiceInterface.class, null, 30, null).setImplementation(new ServiceAspect(e, 2));
        Component sa1 = m.createAspectService(ServiceInterface.class, null, 10, null).setImplementation(new ServiceAspect(e, 4));
        m.add(sc);
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 sp = m.createComponent().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
        Component sc = m.createComponent().setImplementation(new ServiceConsumerCallbacks(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(false).setCallbacks("add", "change", "remove", "swap"));
        Component asp = m.createAspectService(ServiceInterface.class, null, 1000, null).setImplementation(ServiceProviderAspect.class);
        m.add(sp);
        m.add(sc);
        m.add(asp);       
        m.remove(sc);
View Full Code Here

        .setImplementation(new ServiceProvider(e))
    );
       
        m.add(m.createComponent()
        .setImplementation(provider)
        .add(m.createServiceDependency()
          .setService(ResourceHandler.class)
          .setCallbacks("add", "remove")
      )
    );
       
View Full Code Here

        ResourceAdapter service = new ResourceAdapter(e);
        CallbackInstance callbackInstance = new CallbackInstance(e);
        Component component = m.createResourceAdapterService("(&(path=/path/to/*.txt)(host=localhost))", false, callbackInstance, "changed")
            .setImplementation(new ResourceAdapter(e))
            .setCallbacks(callbackInstance, "init", "start", "stop", "destroy")
            .add(m.createServiceDependency()
            .setService(ServiceInterface.class, "(id=1)")
            .setRequired(true)
            .setInstanceBound(true)
        );
        component.addStateListener(new ComponentStateListenerImpl(e));
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 s1 = m.createComponent().setImplementation(new ConfigurationConsumer(e)).setInterface(Runnable.class.getName(), null).add(m.createConfigurationDependency().setPid("test").setPropagate(true));
        Component s2 = m.createComponent().setImplementation(new ConfigurationCreator(e)).add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
        Component s3 = m.createComponent().setImplementation(new ConfiguredServiceConsumer(e)).add(m.createServiceDependency().setService(Runnable.class, ("(testkey=testvalue)")).setRequired(true));
        m.add(s1);
        m.add(s2);
        m.add(s3);
        e.waitForStep(4, 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 s1 = m.createComponent().setImplementation(new ConfigurationConsumer(e)).setInterface(Runnable.class.getName(), null).add(m.createConfigurationDependency().setPid("test").setPropagate(true));
        Component s2 = m.createComponent().setImplementation(new ConfigurationCreator(e)).add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
        Component s3 = m.createComponent().setImplementation(new ConfiguredServiceConsumer(e)).add(m.createServiceDependency().setService(Runnable.class, ("(testkey=testvalue)")).setRequired(true));
        m.add(s1);
        m.add(s2);
        m.add(s3);
        e.waitForStep(4, 15000);
        m.remove(s1);
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 s1 = m.createComponent()
            .setImplementation(new ConfigurationConsumer(e))
            .add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true))
            .add(m.createConfigurationDependency().setPid("test"));
        Component s2 = m.createComponent()
            .setImplementation(new ConfigurationCreator(e))
            .add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
        Component s3 = m.createComponent()
View Full Code Here

            .setImplementation(new ConfigurationConsumer(e))
            .add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true))
            .add(m.createConfigurationDependency().setPid("test"));
        Component s2 = m.createComponent()
            .setImplementation(new ConfigurationCreator(e))
            .add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
        Component s3 = m.createComponent()
            .setInterface(ServiceInterface.class.getName(), null)
            .setImplementation(DependentServiceProvider.class);
        m.add(s1);
        m.add(s2);
View Full Code Here

                .add(m.createConfigurationDependency()
                     .setPid("test")
                     .setPropagate(true));
        Component s2 = m.createComponent()
                .setImplementation(new S2(e))
                .add(m.createServiceDependency()
                     .setService(S1.class, ("(testkey=testvalue)"))
                     .setRequired(true)
                     .setCallbacks("add", "change", null));
        Component s3 = m.createComponent()
                .setImplementation(confCreator)
View Full Code Here

                     .setService(S1.class, ("(testkey=testvalue)"))
                     .setRequired(true)
                     .setCallbacks("add", "change", null));
        Component s3 = m.createComponent()
                .setImplementation(confCreator)
                .add(m.createServiceDependency()
                     .setService(ConfigurationAdmin.class)
                     .setRequired(true));

        m.add(s1);
        m.add(s2);
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.