Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into add-named-inject-su…
Browse files Browse the repository at this point in the history
…pport
  • Loading branch information
sbang committed Jun 20, 2015
2 parents 747d427 + 6f9713c commit 4b61998
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.org
Expand Up @@ -135,10 +135,12 @@ If javax.inject has been embedded in either the service-providing bundles or the
return null;
}
#+END_SRC

** Why is the Jsr330Activator a bundle if it's meant to be embedded

Since this is an OSGi project it seemed wrong /not/ to make the Jsr330Activator a bundle.

** Javadocs
- [[http://www.javadoc.io/doc/no.steria.osgi.jsr330activator/jsr330activator.implementation][Released version javadocs]]
* License

The Jsr330Activator is under the Eclipse public license v. 1.0. See the LICENSE file for the full license text.
Expand Down Expand Up @@ -253,6 +255,7 @@ I see two ways of doing it:
Alternative 2. would seem to be the most complete solution (because it lets the injection point determine which services are injected. It can also be used to require a particular implementation of a service and let the rest be optional), but alternative 1. is the simplest one to implement (it doesn't require an extra annotation and reflection code looking for two extra annotations).

/Note/: Alternative 1 i.e. injection into a collection is now on master.
/Note2/: I have discovered a need for @Optional in [[https://github.com/steinarb/modelstore][my project using the Jsr330Activator]]: I need logging and the logservice @Inject should probably be optional, so I will probably end up pulling all of the branches below in on master and making a release. I will make tags on the branch points so that it will be possible to make slimmer versions (won't be made by me, though...).

The behaviour is like this:
- Add a List<Service> field to the provider class
Expand Down
Expand Up @@ -204,7 +204,7 @@ public void testActivatorStartStop() throws Exception {
HelloService helloService = (HelloService) bundleContext.getService(helloAfterActivation);
assertEquals("Hello world!", helloService.getMessage());

// Unregister the service and verify that there will be noe service with that name
// Unregister the service and verify that there is no service of that type present
activator.stop(bundleContext);
ServiceReference<?> helloAfterDeactivation = bundleContext.getServiceReference(HelloService.class.getCanonicalName());
assertNull(helloAfterDeactivation);
Expand Down
9 changes: 7 additions & 2 deletions jsr330activator.mocks/README.org
Expand Up @@ -33,7 +33,7 @@ Then in the test, create a MockBundleContext and give it as an argument where a
BundleContext = new MockBundleContext();
MyActivator activator = new MyActivator();

// Check that the service can't be found befor activator start
// Check that the service can't be found before activator start
ServiceReference<?> helloBeforeActivation = bundleContext.getServiceReference(HelloService.class.getCanonicalName());
assertNull(helloBeforeActivation);

Expand All @@ -48,10 +48,15 @@ Then in the test, create a MockBundleContext and give it as an argument where a
HelloService helloService = (HelloService) bundleContext.getService(helloAfterActivation);
assertEquals("Hello world!", helloService.getMessage());

// Unregister the service and verify that there will be noe service with that name
// Unregister the service and verify that there is no service of the type present
activator.stop(bundleContext);
ServiceReference<?> helloAfterDeactivation = bundleContext.getServiceReference(HelloService.class.getCanonicalName());
assertNull(helloAfterDeactivation);
}
}
#+END_SRC

* Is there documentation?

There are javadocs:
- [[http://www.javadoc.io/doc/no.steria.osgi.jsr330activator/jsr330activator.mocks][Release javadocs]]

0 comments on commit 4b61998

Please sign in to comment.