THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Here are some examples:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
PrimitiveComponentType prov = createAProvider(); // Create a primitive type PrimitiveComponentType cons = createAConsumer(); // Create another primitive type CompositeComponentType type = new CompositeComponentType() .setBundleContext(context) .setComponentTypeName("comp1") .addInstance(new Instance(prov.getFactory().getName())) // Create an instance in the composite .addInstance(new Instance(cons.getFactory().getName())); ComponentInstance ci = type.createInstance(); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
CompositeComponentType type = new CompositeComponentType() .setBundleContext(context) .setComponentTypeName("comp3") .addSubService(new InstantiatedService() // Importation .setSpecification(Foo.class.getName()) .setOptional(true)); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
CompositeComponentType type = new CompositeComponentType() .setBundleContext(context) .setComponentTypeName("comp2") .addSubService(new InstantiatedService() // Instantiated service .setSpecification(Foo.class.getName())) .addInstance(new Instance(cons.getFactory().getName())); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
CompositeComponentType type = new CompositeComponentType() .setBundleContext(context) .setComponentTypeName("compExport") .addSubService(new InstantiatedService().setSpecification(Foo.class.getName())) .addService(new ExportedService() .setSpecification(Foo.class.getName())); // Exports a service |
...