Hello Istvan,
First of all the problem you describe is not actually related to
configuration points and contributions in HiveMind.
I think one easy way to do what you want is to do something like that:
<service-point id="DataSource1" interface="javax.sql.DataSource">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="org.apache.commons.dbcp.BasicDataSource">
...
</construct>
</invoke-factory>
</service-point>
<service-point id="DataSource2" interface="javax.sql.DataSource">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="org.apache.commons.dbcp.BasicDataSource">
...
</construct>
</invoke-factory>
</service-point>
And then for any service that need access to DataSource1:
<service-point id="MyDAO" interface="com.acme.MyDAO">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="com.acme.MyDAOImpl">
<set-service property="dataSource"
service-id="DataSource1">
</construct>
</invoke-factory>
</service-point>
What is important here (it seems you missed that) is not to exclusively use
<set> when you use BuilderFactory, but use the more appropriate
<set-service>.
If you have a service that needs both DataSource 1 & 2, just do:
<service-point id="MyComplexDAO" interface="com.acme.MyComplexDAO">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="com.acme.MyDAOComplexImpl">
<set-service property="dataSource1"
service-id="DataSource1">
<set-service property="dataSource2"
service-id="DataSource2">
</construct>
</invoke-factory>
</service-point>
Hope this helps
-----Original Message-----
From: Istvan Orban [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 17, 2004 3:13 PM
To: [email protected]
Subject: Configuration ?
Hi,
I come across with an other problem. it seems the configuration and
contribution part is not fully clear for in Hivemind.
I have some services which needs Database access,
I have got 2 services accessing the same db, and an other which requests
data from a second db.
I do not want to create 2 servicse for accessing the the 2 db, although
I like this example as how easy to configure DB access with Hivemind
<service-point id="DefaultDataSource" interface="javax.sql.DataSource">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="org.apache.commons.dbcp.BasicDataSource">
<set property="driverClassName"
value="org.firebirdsql.jdbc.FBDriver"/>
<set property="url"
value="jdbc:firebirdsql:localhost/3050:D:/Firebird/data/etstore.gdb"/>
<set property="username" value="SYSDBA"/>
<set property="password" value="masterkey"/>
</construct>
</invoke-factory>
</service-point>
My services has a property called Datasource and I would like to feed
them somehow using the configuratoin power of Hivemind.
But I'm little stuck how could I have 2 configurations where I have 2
pooled DataSource with all the config values set
and when defining the 3 servies I would just bind the needed Datasource
to the service.
Could someone give me some useful advices, or directions what should I
use, or how could I achive this the best way.
Thanks a lot!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]