The issue is a little bit more complex. While Matthias indeed could use
bind keys he would still need an internal mapping.
I.e the browser sends the required page name (simple string). The
backend function that handle this call has now to lookup the binding key
and retrieve the required page object.
The interface was not created taken such issues into account.
We only had a single method to retrieve components (which is already
does type conversion) which was sufficient.
I do not know if adding a: Object getComponent(String key) method will
introduce more confusions.
On 27.02.2017 16:18, Zieris, Franz wrote:
Hi Matthias,
I’m not sure what your actual question really is (subject line and
content tell two different stories :) )
> The patch used the ISarosContext that isn't present anymore. The
> context that was injected as dependency. Please correct me if I am
> wrong: I figured that there where some refactorings, and I think the
> functionality that I'm looking for is no moved to 'ContainerContext'.
The context was not “injected as dependency”.
The context was (and is) the collection of all dependencies that could
be injected into other components.
(And yes, the new name is IContainerContext.)
> I want to add a method that can return a component by its name
> (a String key). Currently you can only get a component via the class.
There should be no need for adding a new method.
We patched the picocontainer many years ago, so it can handle more
things as keys than just classes (that’s the purpose of [1]).
What you are looking for is the concept of BindKeys, which allow
fine-grained keys for a key-value store (which a PicoContainer
basically is).
We already define four of those [2]:
-IBBstreamService and Socks5StreamService are two marker interfaces
that are used to handle two different instances of the IStreamService
interface [3].
-SarosVersion and PlatformVersion are two marker interfaces that are
used to handle two different Strings in the same container [4].
See the VersionManager’s ctor for an example of how the marker
interface is used to tell the PicoContainer which String instance
should be put in there [5].
> My question is how do I get the pico container that include the
> HTMLUIcontext
There is no HTMLUIContext, and there is no (single) PicoContainer.
But there is the SarosContext (now ContainerContext), and the
sessionContainer (a field within the SarosSession class).
The job of the context factories is to build up the context
(=key-value mapping) at runtime:
The ContainerContext is built up once, the sessionContainer is built
for every new session.
The HTMLUIContextFactory is called by the respective plugin lifecycles
if said plugin is to be started with the HTML GUI [6,7].
That’s all there is to do in order to get the HTMLUI dependencies into
“the PicoContainer”.
So much for the technical and historical background.
I haven’t thought about your actual design problem for a minute now.
I might be (!), that all of the above is highly irrelevant for your
case, because the whole approach is not a good idea.
I’ve forgotten all of the details of your patch, but I remember, I was
thinking hard about this back then.
Could you go through the discussion first (e.g. here [8,9]) and
summarize the design problems and proposed ideas?
Cheers,
Franz
[1]
https://github.com/saros-project/saros/tree/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp.core/patches/org/picocontainer/parameters
[2]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/context/IContextKeyBindings.java
[3]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/context/CoreContextFactory.java#L92
[4]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/SarosEclipseContextFactory.java#L140
[5]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/versioning/VersionManager.java#L131
[6]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/EclipsePluginLifecycle.java#L65
[7]
https://github.com/saros-project/saros/blob/master@%7B2017-02-27%7D/de.fu_berlin.inf.dpp.intellij/src/de/fu_berlin/inf/dpp/intellij/IntellijProjectLifecycle.java#L56
[8]
http://saros-build.imp.fu-berlin.de/gerrit/#/c/3125/1/de.fu_berlin.inf.dpp.ui/src/de/fu_berlin/inf/dpp/ui/browser_functions/ManageDialog.java@45
[9]
http://saros-build.imp.fu-berlin.de/gerrit/#/c/3125/1/de.fu_berlin.inf.dpp.ui/src/de/fu_berlin/inf/dpp/ui/browser_functions/ManageDialog.java@68
*From:*Matthias Bohnstedt [mailto:matthias.bohnst...@gmail.com]
*Sent:* Monday, February 27, 2017 3:25 PM
*To:* dpp-devel@lists.sourceforge.net
*Subject:* [DPP-Devel] What happend to ISarosContext?
Hi all,
I am currently try to finish a long untouched patch[1]. Feel free to
have a look at the commit message for more infos.
The patch used the ISarosContext that isn't present anymore. The
context that was injected as dependency.
Please correct me if I am wrong: I figured that there where some
refactorings, and I think the functionality that I'm looking for is no
moved to 'ContainerContext'[3]. I want to add a method that can return
a component by its name (a String key). Currently you can only get a
component via the class[4].
My question is how do I get the pico container that include the
HTMLUIcontext[5]?
To clarify, I want to get a specific page instances from the context
(aka pico container), depending on the key value given by the browser
function call:
public void manageDialog(String dialogID){
IBrowserPagepage =(IBrowserPage)sarosContext.getComponent(dialogID);
// do something with this page
}
[1]http://saros-build.imp.fu-berlin.de/gerrit/#/c/3125/
[2]http://www.saros-project.org/html-gui#providing-functionality-the-java-part
[3]https://github.com/saros-project/saros/blob/master/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/context/ContainerContext.java
[4]https://github.com/saros-project/saros/blob/master/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/context/IContainerContext.java#L48
[5]https://github.com/saros-project/saros/blob/master/de.fu_berlin.inf.dpp.ui/src/de/fu_berlin/inf/dpp/HTMLUIContextFactory.java#L45
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel