Examples of createServiceDependency()


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

            .setImplementation(new ServiceProvider())
            .setInterface(OriginalService.class.getName(), null);

        Component consumer = m.createComponent()
            .setImplementation(new ServiceConsumer(e))
            .add(m.createServiceDependency()
                .setService(AdaptedService.class)
                .setCallbacks("add", null, "remove", "swap")
            );
        Component adapter = m.createAdapterService(OriginalService.class, null, "add", null, "remove", "swap")
            .setInterface(AdaptedService.class.getName(), null)
View Full Code Here

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

            .setInterface(OriginalService.class.getName(), null)
            .setImplementation(new ServiceProvider(e));

        Component consumer = m.createComponent()
            .setImplementation(new ServiceConsumer(e))
            .add(m.createServiceDependency()
                .setService(AdaptedService.class)
                .setRequired(true)
            );

        Component adapter = m.createAdapterService(OriginalService.class, null)
View Full Code Here

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

        // 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(ServiceInterface2.class.getName(), null);
        Component consumer = m.createComponent().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
        Component aspect = m.createAspectService(ServiceInterface.class, null, 1, null).setImplementation(new ServiceAspect(e));
       
        m.add(consumer);
        m.add(provider);
        // the consumer should invoke the provider here, and when done, arrive at step 3
View Full Code Here

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

        // helper class that ensures certain steps get executed in sequence
        Ensure e = new Ensure();
        // create a resource provider
        ResourceProvider provider = new ResourceProvider(e);
        // activate it
        m.add(m.createComponent().setImplementation(provider).add(m.createServiceDependency().setService(ResourceHandler.class).setCallbacks("add", "remove")));
        // create a resource adapter for our single resource
        // note that we can provide an actual implementation instance here because there will be only one
        // adapter, normally you'd want to specify a Class here
        m.add(m.createResourceAdapterService("(&(path=/path/to/*.txt)(host=localhost))", false, null, "changed")
              .setImplementation(new ResourceAdapter(e)));
View Full Code Here

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();
        Component c1 = m.createComponent()
                      .setImplementation(new C1(e))
                      .add(m.createServiceDependency().setService(C2.class).setRequired(true).setCallbacks("bind", null));

        Component c2 = m.createComponent()
                      .setInterface(C2.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
                      .setImplementation(new C2())
                      .add(m.createServiceDependency().setService(C3.class).setRequired(true).setPropagate(true));
View Full Code Here

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

                      .add(m.createServiceDependency().setService(C2.class).setRequired(true).setCallbacks("bind", null));

        Component c2 = m.createComponent()
                      .setInterface(C2.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
                      .setImplementation(new C2())
                      .add(m.createServiceDependency().setService(C3.class).setRequired(true).setPropagate(true));

        Component c3 = m.createComponent()
                      .setInterface(C3.class.getName(), new Hashtable() {{ put("foo2", "bar2"); }})
                      .setImplementation(new C3());
       
View Full Code Here

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

    // create a service with dependency which will be invoked on a callback instance
    CallbackInstance instance = new CallbackInstance();
    m.add(m.createComponent()
        .setImplementation(new SimpleService() {})
        .add(m.createServiceDependency()
        .setService(Service.class)
        .setCallbacks(instance, "added", "removed")
        .setRequired(true)
      )
    );
View Full Code Here

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

              .setImplementation(new ServiceProvider("" + i, e))
              .setInterface(OriginalService.class.getName(), props);
         
          Component consumer = m.createComponent()
              .setImplementation(new ServiceConsumer(e, "" + i))
              .add(m.createServiceDependency()
                  .setService(AdaptedService.class, "(number=" + i + ")")
                  .setCallbacks("add", null, "remove", "swap")
                  .setRequired(true)
              );
         
View Full Code Here

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 sc2 = m.createComponent().setImplementation(new ServiceConsumerCallbacks(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(false).setCallbacks("add", "remove"));
        m.add(sp);
        m.add(sc);
        m.remove(sc);
        m.add(sc2);
View Full Code Here

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

        // 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 sc2 = m.createComponent().setImplementation(new ServiceConsumerCallbacks(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(false).setCallbacks("add", "remove"));
        m.add(sp);
        m.add(sc);
        m.remove(sc);
        m.add(sc2);
        m.remove(sp);
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.