If so, I thought about an "exclude service" option in the Context? Something like: Include all SingletonService, but if you include them, make sure that they are of type ImageJService or SCIFIOService or something like that? Or: The user can provide a "ServiceFilter" Implementation where he can exclude/Include certain services? I don't know if this makes sense at all, just a naive thinking I guess.
Hi Mark,
I figured out my problem and I have no clue how to solve it in a nice way :-)
We restrict our the context we create to very limited amount of services. We only want to load the services we really need.
Since now, I told my Context to load all SingletonService.class. I needed to load all SingletonServices, such that the method isMultipleChoiceObject (line 382) returns "true" for e.g. the "CalculatorOp" and KNIME can generate the dialog for e.g. the ImageCalculator. This only worked if the CalculatorService.class is available in the context.
The important part actually is: If I request to load _any_ SingletonService, of course also the SingletonServices from SCIFIO etc are also loaded, which I actually don't need here. On the other hand, I don't want to manually add SingletonServices from ImageJ2 I need (this is what I do now with CalculatorSerice, ThresholdService, etc... see line 128/129 at https://github.com/knime-ip/knip-imagej2/blob/master/org.knime.knip.imagej2.core/src/org/knime/knip/imagej2/core/IJGateway.java).
Does this make sense?
If so, I thought about an "exclude service" option in the Context? Something like: Include all SingletonService, but if you include them, make sure that they are of type ImageJService or SCIFIOService or something like that? Or: The user can provide a "ServiceFilter" Implementation where he can exclude/Include certain services? I don't know if this makes sense at all, just a naive thinking I guess.
Thanks for your support again,
Christian
Am 10.01.2014 19:57, schrieb Mark Hiner:
MarkTake careOK, so I'm questioning how the IJAdapterProvider assembles the list of services..
It seems like it's trying to manually assemble a list of services to construct the context with. Is that right? When constructing the context and providing a list of services, you basically can give it just the superclass services, and all children will be discovered. We did that so you can make a context with say SCIFOService and SciJavaService and then plugins that add more SCIFIOServices will automatically be included.
Does that make sense?
So I would possibly refactor this to make a context with ImageJServices, SCIFIOServices, and SciJavaServices.. because those are the relevant components you're using, right?
Also, yes whenever you try to get objects from an ObjectIndex, ALL pending initializations occur. This just defers the initialization until it's required.
All SingletonServices add each of their singleton instances to the ObjectIndex lazily during their initialize() method. So that's why these translators are being loaded. And they fail because SCIFIOServices aren't included.
So, context creation is part of the problem.. but I think the classpath/class loader is still incorrect, because you have OME-Formats stuff in it.
I will try to update the Context so that when that error comes up, it prints out the services that WERE used to create the context, and maybe the classpath of the current class loader. Because that error is extremely cryptic and unhelpful.
Then maybe we can discuss more tomorrow!
* If I want to use a global "Context" in my complete "KNIME Application", why is there the possibility to create several contexts?
* How can I use the class "Scifio" in a global way, s.t. this context also knows all other services? The "Scifio" Context class itself suggests to create one context for ImageJ2, one for SCIFIO, etc.?!
Hi Mark,
maybe a very stupid questions, but I got two more very general ones:
* If I want to use a global "Context" in my complete "KNIME Application", why is there the possibility to create several contexts?
* How can I use the class "Scifio" in a global way, s.t. this context also knows all other services? The "Scifio" Context class itself suggests to create one context for ImageJ2, one for SCIFIO, etc.?!
Don't misunderstand me, I really want to use the context the way you guys think its best, but I understand too little since now I guess :)
Have a nice day!
Christian
--
You received this message because you are subscribed to the Google Groups "scijava" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scijava+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.