Cargo

Create support for multiple Resources like DataSources

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.9
  • Fix Version/s: None
  • Component/s: Ant, Core, Tomcat, Weblogic
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    2

Description

You can only define one cargo.datasource.datasource per container. If you use more datasources you are out of luck. Please create new Resource type that allows resources like multiple datasources to be defined.

Activity

Hide
Alexander added a comment -

I added the ability to add more resources to a local container. Only tomcat actually does anything with the added resources though.

I also updated the maven2 extensions, so you can now add a resources statement in your pom:
<configuration>
<resources>
<resource>
<name>someDataSource</name>
<type>javax.sql.DataSource</type>
<parameters>
<url>jdbc...</url>
<maxWait>500</maxWait>
...
</parameters>
</resource>
</resources>
</configuration>

Its all unit tested for your pleasure

Show
Alexander added a comment - I added the ability to add more resources to a local container. Only tomcat actually does anything with the added resources though. I also updated the maven2 extensions, so you can now add a resources statement in your pom: <configuration> <resources> <resource> <name>someDataSource</name> <type>javax.sql.DataSource</type> <parameters> <url>jdbc...</url> <maxWait>500</maxWait> ... </parameters> </resource> </resources> </configuration> Its all unit tested for your pleasure
Hide
Matt Wringe added a comment -

You seem to be missing org.codehaus.cargo.container.resource.Resource from your patch.

Show
Matt Wringe added a comment - You seem to be missing org.codehaus.cargo.container.resource.Resource from your patch.
Hide
Alexander added a comment -

Updated cargo-core patch with missing Resource class.

Show
Alexander added a comment - Updated cargo-core patch with missing Resource class.
Hide
Matt Wringe added a comment -

Ok, the new patch works (after fixing a bunch of checkstyle violations), its been submitted into svn. All patches should be submitted without checkstyle violations.

This issue should not be closed until the ant extension has been updated with this feature.

Show
Matt Wringe added a comment - Ok, the new patch works (after fixing a bunch of checkstyle violations), its been submitted into svn. All patches should be submitted without checkstyle violations. This issue should not be closed until the ant extension has been updated with this feature.
Hide
Adrian Cole added a comment -

ant extensions depend on other work like setting up the generic api.

Show
Adrian Cole added a comment - ant extensions depend on other work like setting up the generic api.
Hide
Adrian Cole added a comment -

First amount of effort is complete in that a Proof of Concept works in Tomcat through the Maven plugin. The following work will finish this task, including example Resource implementations which configure multiple DataSources to Tomcat and WebLogic Containers.

1. create ResourceType, and add ContainerCapability.supportsResourceType()
2. change Resource to an interface and create base implementation: o.c.c.container.spi.resource.AbstractResource
3. refactor DataSource to extend from AbstractResource and add ResourceType.DATASOURCE, ResourceType.XADATASOURCE
4. implement generic spi including new interface o.c.c.g.resource.ResourceFactory and class DefaultResourceFactory
5. register tomcat and weblogic ContainerCapability supporting of DataSource and XADataSource (if supported on tomcat)
6. implement samples integration test for multiple datasources based on CARGO-640 and adjust Capability implementations to fit support
– the following could be completed as soon as step 4,5 is done
7. implement ant support including new class o.c.c.a.ResourceElement and update of ConfigurationElement to use it

Show
Adrian Cole added a comment - First amount of effort is complete in that a Proof of Concept works in Tomcat through the Maven plugin. The following work will finish this task, including example Resource implementations which configure multiple DataSources to Tomcat and WebLogic Containers. 1. create ResourceType, and add ContainerCapability.supportsResourceType() 2. change Resource to an interface and create base implementation: o.c.c.container.spi.resource.AbstractResource 3. refactor DataSource to extend from AbstractResource and add ResourceType.DATASOURCE, ResourceType.XADATASOURCE 4. implement generic spi including new interface o.c.c.g.resource.ResourceFactory and class DefaultResourceFactory 5. register tomcat and weblogic ContainerCapability supporting of DataSource and XADataSource (if supported on tomcat) 6. implement samples integration test for multiple datasources based on CARGO-640 and adjust Capability implementations to fit support – the following could be completed as soon as step 4,5 is done 7. implement ant support including new class o.c.c.a.ResourceElement and update of ConfigurationElement to use it
Hide
Adrian Cole added a comment -

Properties set that start with the following will be added to the configuration:

cargo.resource.resource
cargo.datasource.datasource

you must nest properties, delimited by pipe in order to populate the corresponding objects.

alternatively, if you are using the API, use addResource() or addDataSource()

when Configuration.configure(container) is called, it will call verify()

verify() will throw a CargoException if one of the Resources or DataSources setup is not compatible with the Configuration type.

Note that typed configuration for Maven or Ant are not supported across both DataSources and Resources at the moment. If you are not using the API, use properties to configure your DataSource or Resources.

Show
Adrian Cole added a comment - Properties set that start with the following will be added to the configuration: cargo.resource.resource cargo.datasource.datasource you must nest properties, delimited by pipe in order to populate the corresponding objects. alternatively, if you are using the API, use addResource() or addDataSource() when Configuration.configure(container) is called, it will call verify() verify() will throw a CargoException if one of the Resources or DataSources setup is not compatible with the Configuration type. Note that typed configuration for Maven or Ant are not supported across both DataSources and Resources at the moment. If you are not using the API, use properties to configure your DataSource or Resources.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
9w 1d 2h
Original Estimate - 9 weeks, 1 day, 2 hours
Remaining:
6w 5d 22h
Time Spent - 2 weeks, 2 days, 4 hours Remaining Estimate - 6 weeks, 5 days, 22 hours
Logged:
2w 2d 4h
Time Spent - 2 weeks, 2 days, 4 hours Remaining Estimate - 6 weeks, 5 days, 22 hours