|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (HIVEMIND-179) Provide access to the RegistryProvide access to the Registry
------------------------------ Key: HIVEMIND-179 URL: http://issues.apache.org/jira/browse/HIVEMIND-179 Project: HiveMind Issue Type: New Feature Components: framework Reporter: Martin Strand There is currently no way for a service to access its own Registry. This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: public class MyService() { private Registry registry; public MyService() { registry = getRegistry(); // <-- Need this OutsideHivemind.registerListener(this); } public void invokeListener() { registry.setupThread(); // Use some Hivemind services... registry.cleanupThread(); } } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry [ http://issues.apache.org/jira/browse/HIVEMIND-179?page=comments#action_12428449 ]
Henrik Vendelbo commented on HIVEMIND-179: ------------------------------------------ Or you could support an interface like Spring's ApplicationContextAware. I don't like making objects depend on the container, but by definition of the problem you make it dependent anyway. > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: http://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry [ http://issues.apache.org/jira/browse/HIVEMIND-179?page=comments#action_12428450 ]
James Carman commented on HIVEMIND-179: --------------------------------------- I recommend creating a new class called InvocationContext or something which would allow you to access stuff like this. Maybe one of the methods could be getRegistry() or getModule(). Anyway, it would give you information about the current method invocation. It'd look like this... InvocationContext.getInstance(); This would use a ThreadLocal variable or something. The "outer proxy" could set the reference prior to any method invocation and clear it upon completion. > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: http://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596852#action_12596852 ] Jochen Zimmermann commented on HIVEMIND-179: -------------------------------------------- But the natural "Hivemind-like" approach would be to define a property with the getters/setters and have the framework (auto)wire this, just like in the original example .... public class MyService() { private Registry registry; public Registry getRegistry() { .... } public void setRegistry(Registry r) { ... } } But without looking in the code I suppose this is not possible, because we have a chicken-egg problem here?!? > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596881#action_12596881 ] James Carman commented on HIVEMIND-179: --------------------------------------- I believe it would be available. The service implementation factory can get a handle on the registry when the service is asked for. Remember, HiveMind doesn't like to create what it doesn't have to, so the actual implementation isn't created until absolutely necessary (i.e. a method is invoked upon it). This would probably even work for primitive service models. > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597733#action_12597733 ] Jochen Zimmermann commented on HIVEMIND-179: -------------------------------------------- I tried to figure this one out and spend the whole afternoon until now to find out how the construction of a service really works ... Correct me if I'm wrong (I'm learning ;-) At startup of the registry Hivemind does not construct any service at all (beside the services that are needed for Hivemind itself), but just read in all the service-points, configurations and so on. If registry.getService() is called a service model is created and this service model is asked for the service instantiation. This service model creates a proxy, but in the end the service model constructs the final service and creates service models for services "deeper" in the chain, which create proxies, which create service instances if asked and so on .... I tried to follow the code, but for both solution proposals I could not find a way to get a reference to the registry in this whole process of constructing a service, unless there is some "hivemind magic" I don't know of :-) Only the RegistryInfrastructure is available at one or two places (of course this is somewhat the same, but in the end we want the registry itself) ... Of course it is a complex prcess, so most likely I'd missed the correct place to hook in? Thanks for your help! > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597734#action_12597734 ] James Carman commented on HIVEMIND-179: --------------------------------------- Do you need the Registry or can you get by with just the Module? > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jochen Zimmermann updated HIVEMIND-179: --------------------------------------- Attachment: HIVEMIND-179.txt > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > Attachments: HIVEMIND-179.txt > > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597796#action_12597796 ] Jochen Zimmermann commented on HIVEMIND-179: -------------------------------------------- I finally found a way. Perhaps it is to naiv and it is for sure a little hack (I explain), but it works and perhaps is not too bad for a first shot :-) I defined the registry as a service in the hivemind.xml of the framework like this: <service-point id="Registry" interface="Registry"> <invoke-factory service-id="RegistryFactory"/> </service-point> I wrote the registry factory, which just returns an instance of RegistryImpl. That's the hack, because I had to get the RegistryInfrastructure from the static ServiceSerializationHelper and had to cast it. public class RegistryFactory implements ServiceImplementationFactory { public Object createCoreServiceImplementation( ServiceImplementationFactoryParameters factoryParameters) { RegistryInfrastructure r = (RegistryInfrastructure) ServiceSerializationHelper.getServiceSerializationSupport(); return new RegistryImpl(r); } } Finally I changed the RegistryBuilder to not instantiate the Registry itself but obtain it from the RegistryInfrastructure. infrastructure.startup(); return (Registry) infrastructure.getService(Registry.class, null); This way the registry is a service itself ... If we could implement the RegistryFactory "clean" someway, what do you think, would this make any sense? > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > Attachments: HIVEMIND-179.txt > > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597798#action_12597798 ] James Carman commented on HIVEMIND-179: --------------------------------------- My point was that the Module can probably get you what you need. You can lookup services/configurations via the Module itself. So, you don't need the registry at all. > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > Attachments: HIVEMIND-179.txt > > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (HIVEMIND-179) Provide access to the Registry[ https://issues.apache.org/jira/browse/HIVEMIND-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597798#action_12597798 ] jwcarman edited comment on HIVEMIND-179 at 5/18/08 4:30 AM: ---------------------------------------------------------------- My point was that the Module can probably get you what you need. You can lookup services/configurations via the Module itself. So, you don't need the registry at all. And, I vote -1 to adding the Registry as a service inside itself. That just seems way too hacky (as you pointed out) to me. was (Author: jwcarman): My point was that the Module can probably get you what you need. You can lookup services/configurations via the Module itself. So, you don't need the registry at all. > Provide access to the Registry > ------------------------------ > > Key: HIVEMIND-179 > URL: https://issues.apache.org/jira/browse/HIVEMIND-179 > Project: HiveMind > Issue Type: New Feature > Components: framework > Reporter: Martin Strand > Attachments: HIVEMIND-179.txt > > > There is currently no way for a service to access its own Registry. > This would be useful sometimes, for example if you've got a listener that is invoked from a non-Hivemind thread: > public class MyService() > { > private Registry registry; > public MyService() > { > registry = getRegistry(); // <-- Need this > OutsideHivemind.registerListener(this); > } > public void invokeListener() > { > registry.setupThread(); > // Use some Hivemind services... > registry.cleanupThread(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
| Free Forum Powered by Nabble | Forum Help |