Howard M. Lewis Ship updated HIVEMIND-24:
Assignee: (was: Howard M. Lewis Ship)
> Add DataSource Factory to hivemind.lib
> --------------------------------------
>
> Key: HIVEMIND-24
> URL:
https://issues.apache.org/jira/browse/HIVEMIND-24> Project: HiveMind
> Issue Type: New Feature
> Components: library
> Affects Versions: 1.0
> Environment: All
> Reporter: Kurt R. Hoehn
> Priority: Minor
>
> I was wondering if I could contribute a DataSource builder factory to the Hivemind Library. Here is the hivemodule.sdl that shows its configuration.
> I believe that this would be a nice to have when implementing data drivin services.
> module (id=hivemind.lib version="1.0.0")
> {
> "Datasource module"
>
> configuration-point( id=DataSourceProperties )
> {
> schema
> {
> element( name=datasource-property )
> {
> attribute( name=property required=true )
> {
> "DataSource property to set"
> }
>
> attribute( name=value required=true translator=smart)
> {
> "Value for the DataSource property"
> }
>
> conversion( class=org.apache.hivemind.lib.datasource.impl.DataSourceProperty )
> {
> map( attribute=property property=property )
> map( attribute=value property=value )
> }
> }
> }
> }
>
> service-point( id=DataSourceBuilderFactory interface=org.apache.hivemind.ServiceImplementationFactory )
> {
> parameters-schema
> {
> element( name=configuration )
> {
> attribute( name=datasource-class required=true )
> {
> "Fully qualified name of the class implementing the javax.sql.DataSource"
> }
>
> attribute( name=datasource-properties required=true translator=configuration )
> {
> "Properties that are set to initialize the DataSource implementation"
> }
>
> conversion( class=org.apache.hivemind.lib.datasource.impl.DataSourceConfiguration )
> {
> map( attribute=datasource-class property=className )
> map( attribute=datasource-properties property=properties )
> }
> }
> }
> invoke-factory( service-id=hivemind.BuilderFactory )
> {
> construct (class=org.apache.hivemind.lib.datasource.impl.DataSourceBuilderFactory service-id-property=pointId )
> }
> }
>
> // Example of implementation below
> service-point( id=DefaultDataSource interface=javax.sql.DataSource )
> {
> invoke-factory( service-id=DataSourceBuilderFactory )
> {
> configuration( datasource-class=org.apache.commons.dbcp.BasicDataSource datasource-properties=DataSourceProperties )
> }
> }
>
> contribution( configuration-id=DataSourceProperties )
> {
> datasource-property( name=driverClassName value=org.firebirdsql.jdbc.FBDriver )
> datasource-property( name=url value="jdbc:firebirdsql:localhost/3050:C:/firebird/data/xxxxxx.fdb" )
> datasource-property( name=username value=SYSDBA )
> datasource-property( name=password value=masterkey )
> }
> }
> Thank You,
> -kurt h