You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by hi...@jakarta.apache.org on 2004/10/20 18:50:56 UTC
[jira] Created: (HIVEMIND-72) BuilderFactory extension
Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/HIVEMIND-72
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HIVEMIND-72
Summary: BuilderFactory extension
Type: Improvement
Status: Unassigned
Priority: Minor
Project: HiveMind
Components:
framework
Assignee:
Reporter: Istvan Orban
Created: Wed, 20 Oct 2004 9:48 AM
Updated: Wed, 20 Oct 2004 9:48 AM
Description:
Hi,
I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
If you have a service (B) which can only be instanciated by an other
factory service (A). you have to write your own factory class which
implements the
ServiceImplementationFactory. I have seen some example of doing it.
I think this is a general problem that. the BuilderFactory should not
instance the class by calling it's contructor but to call an other
service's method.
would extending the BuilderFactory be a good idea on the following way.
<invoke-factory service-id="hiveMind:BuilderFactory">
<construct class="MyServiceB"
contructor-service-id="MySerciceA" constructor-method="createServiceB">
.....
<event-listener
service-id="hivemind.ShutdownCoordinator"/>
</construct>
</invoke-factory>
with these extra tags one could specify which method of the MyServiceA
returns an instance of the MyServiceB
so I can use all the power of the Configuration and Autowite provided
already by the the BuilderFactory etc.
I'm asking this because I have seen examples (providing hivernate
session and transaction stuff) where they just implemented the
'ServiceImplementationFactory' but then you have to write again all the
cool function which does the autowite and all other cool stuff for you....
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-72) BuilderFactory extension
Posted by "Stefano Turri (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_58056 ]
Stefano Turri commented on HIVEMIND-72:
---------------------------------------
I've written an ObjectProvider implementation with some of the features (including a simple factory-method guessing algorithm) mentioned in:
http://article.gmane.org/gmane.comp.jakarta.hivemind.user/327
Such an ObjectProvider, in my opinion, is useful to wire together services and/or objects provided by static factory methods, enabling/simplifying the use of legacy code in hivemind configuration.
I'm attacching the implementation and test class (loosely based on ObjectProviders and TestObjectProviders classes). I'm sorry but the test class uses DynaMocks instead of Easymocks, if you find it useful i've no problem changing it to use easymocks.
Best Regards
Stefano
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
> Attachments: FactoryObjectProvider.java, FactoryObjectProviderTest.java
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-72) BuilderFactory extension
Posted by "Steve Gibson (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_54814 ]
Steve Gibson commented on HIVEMIND-72:
--------------------------------------
Looking at what you mailed, I can't see anything different.
I am not sure of the nuances of the method I used, but I would be surprised if you can't tie in event handlers, etc.
Maybe someone wants to test it?
(I need to subscribe to hivemind-user!)
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-72) BuilderFactory extension
Posted by "Knut Wannheden (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_12425732 ]
Knut Wannheden commented on HIVEMIND-72:
----------------------------------------
Now (HiveMind version 1.2) that there are assembly instructions (i.e. <assembly> elements) this issue can almost be closed I believe. The only thing missing is probably a versatile service implementation factory. Besides retrieving the core service implementation using a method of another service (as you propose) it could be useful to retrieve it from an object provider. E.g.
<invoke-factory service-id="hivemind.library.ObjectProviderFactory">
<instance object="service-property:MyServiceA:serviceB"/>
<assembly>
<listener service-id="hivemind.ShutdownCoordinator"/>
</assembly>
</invoke-factory>
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Issue Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
> Attachments: FactoryObjectProvider.java, FactoryObjectProviderTest.java
>
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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-72) BuilderFactory extension
Posted by "Istvan Orban (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_54827 ]
Istvan Orban commented on HIVEMIND-72:
--------------------------------------
I'm not sure I'm right as I'm totally new to Hivemind,
but after having look at the hivemodule.xml in the library.jar I think it lacks all the fancy stuff from BuilderFactory.
(also having taken a look of the source code, it's not calling the BuilderFactoryLogic functions either)
Istvano
<service-point id="ServicePropertyFactory" interface="org.apache.hivemind.ServiceImplementationFactory">
Creates a service that dynamically (i.e., on each service method invocation) obtains a property
from another service and forwards the invocation to the property. The property must be
the same type (or assignable to) the constructed service's interface. Typically,
the targeted service uses a threaded (or similar) service model, thus requiring dynamic,
rather than static, access.
<invoke-factory>
<construct class="org.apache.hivemind.lib.impl.ServicePropertyFactory">
<set-service property="classFactory" service-id="hivemind.ClassFactory"/>
</construct>
</invoke-factory>
<parameters-schema>
<element name="construct">
<attribute name="service-id" required="true" translator="service">
The service which contains the property.
</attribute>
<attribute name="property" required="true">
The name of the property of the target service to expose.
</attribute>
<conversion class="org.apache.hivemind.lib.impl.ServicePropertyFactoryParameter">
<map attribute="service-id" property="service"/>
<map attribute="property" property="propertyName"/>
</conversion>
</element>
</parameters-schema>
</service-point>
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-72) BuilderFactory extension
Posted by "Istvan Orban (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_54813 ]
Istvan Orban commented on HIVEMIND-72:
--------------------------------------
Hi,
Well, I think this fullfills what I thought of having for my needs.
Although It might be usefull if you could read the Mailing list item I submitted as
Howard Lewis Ship had a comment on it. and the reason why I submitted this to the JIRA was to avoid this issue being forgotten..
Thanks a lot!
here is the item:
18 Oct 20:08 Istvan Orban BuilderFactory extension
http://article.gmane.org/gmane.comp.jakarta.hivemind.user/326
and his answer:
http://article.gmane.org/gmane.comp.jakarta.hivemind.user/327
Istvano
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Updated: (HIVEMIND-72) BuilderFactory extension
Posted by "Stefano Turri (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=history ]
Stefano Turri updated HIVEMIND-72:
----------------------------------
Attachment: FactoryObjectProvider.java
FactoryObjectProviderTest.java
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
> Attachments: FactoryObjectProvider.java, FactoryObjectProviderTest.java
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-72) BuilderFactory extension
Posted by "Steve Gibson (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_54811 ]
Steve Gibson commented on HIVEMIND-72:
--------------------------------------
You can already do this:
<service-point id="SessionFactory" interface="net.sf.hibernate.Session">
<invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
<construct service-id="DatabaseService" property="session"/>
</invoke-factory>
<interceptor service-id="SessionInterceptorFactory"/>
</service-point>
Or is this not what you mean?
> BuilderFactory extension
> ------------------------
>
> Key: HIVEMIND-72
> URL: http://issues.apache.org/jira/browse/HIVEMIND-72
> Project: HiveMind
> Type: Improvement
> Components: framework
> Reporter: Istvan Orban
> Priority: Minor
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here.
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
> <invoke-factory service-id="hiveMind:BuilderFactory">
> <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
> .....
> <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
> </construct>
> </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you....
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org