Skip to content

Rich plugin usage #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Rich plugin usage #110

wants to merge 7 commits into from

Conversation

ctrueden
Copy link
Member

@ctrueden ctrueden commented Aug 1, 2014

MERGE ONLY IN CONCERT WITH THE OTHER 3.0.0 BRANCHES.

This makes all RichPlugin types implement the interfaces necessary for tracking their usage, and in particular tracks all uses of "handler" and "wrapper" plugin types.

Unfortunately, to do this, a method had to be removed from the Gateway interface, which breaks backwards compatibility. So this PR will be part of SJC3.

Obviously, this is a breaking API change. The reason this method is
being removed is that we would like RichPlugin to implement
BasicDetails, which has its own get(String) method with an incompatible
return type. So the Gateway method ultimately has to go.

Upon consideration, the Gateway#get(String) method was not very useful
anyway: what would you do with the (weakly typed) Service once you got
it back? You'd have to cast it to make any calls to its service API
specifically, which would necessitate a compile-time dependency on the
service's artifact, which would obviate the need to call
Gateway#get(String) in the first place -- in that case, you could just
call Gateway#get(Class) instead.

I suppose there is a _rare_ case where you'd want to check for a service
at runtime only, without an explicit compile-time dependency, and then
invoke one or more of its methods via reflection. But this is certainly
not an encouraged practice, so let's not have the Gateway make it easy.
It is still easy enough to do anyway:

    Service s = myGateway.context().service("MyService");
Now, all rich plugins are Identifiable, Locatable, Versioned, and know
their own BasicDetails (which comes from their linked PluginInfo).

This makes it easier to enable tracking of usage statistics relating to
a particular kind of plugin.
This method makes it easy for subclasses to register usage of their
plugins in whatever way they see fit.
It is very straightforward when a Handler or Wrapper plugin is being
"used": the service returns the appropriate and specifically requested
Handler or Wrapper instance for the task at hand. So let's count it in
our usage statistics when that happens!
All RichPlugins are now versioned.
It now more closely resembles AbstractUIDetails. However, we may want to
factor this sort of logic into a shared method somewhere, since it
currently is not very DRY.
@ctrueden
Copy link
Member Author

This branch will need more scrutiny. The UsageService is no longer part of SJC. Probably we will want to invent a new type of event published by the EventService, which a new scijava-usage component (migrated upstream from the old imagej-usage) can consume.

@ctrueden ctrueden closed this Jul 27, 2016
@ctrueden ctrueden deleted the rich-plugin-usage branch July 27, 2016 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant