Sorry, just getting the hang of this system.
Here is the actual diff for patching the dbControl for those who want
it. It's everything between the vvv and the ^^^.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Index: samples/controls-db/src/dbControl/DatabaseControlImpl.jcs
===================================================================
--- samples/controls-db/src/dbControl/DatabaseControlImpl.jcs
(revision 124193)
+++ samples/controls-db/src/dbControl/DatabaseControlImpl.jcs
(working copy)
@@ -60,13 +60,20 @@
if (ds == null)
throw new
ControlException("no @" + ConnectionDataSource.class.getName() + "\'
property found.");
- //TODO: Need to change this code to
use data source.
- try {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- this.connection =
DriverManager.getConnection(ds.jndiName());
- } catch (Exception e) {
- throw new ControlException(ERROR_GET_DATABASE_CONTROL,
e);
+ String jndiName = ds.jndiName();
+ if (jndiName != null && jndiName.length() > 0)
+ {
+ //TODO: Need to change this code to use data source.
}
+ else
+ {
+ try {
+ Class.forName(ds.driverName());
+ this.connection =
DriverManager.getConnection(ds.connectionURL());
+ } catch (Exception e) {
+ throw new
ControlException(ERROR_GET_DATABASE_CONTROL, e);
+ }
+ }
}
return this.connection;
}
Index: samples/controls-db/src/dbControl/DatabaseControl.java
===================================================================
--- samples/controls-db/src/dbControl/DatabaseControl.java
(revision 124193)
+++ samples/controls-db/src/dbControl/DatabaseControl.java (working
copy)
@@ -39,7 +39,13 @@
@Target({ElementType.TYPE, ElementType.FIELD})
public @interface ConnectionDataSource
{
- String jndiName(); // no default ... value is required
+ // either a Jndi name or a driver/connection url pair is
required.
+ @AnnotationMemberTypes.Optional
+ String jndiName() default "";
+ @AnnotationMemberTypes.Optional
+ String driverName() default
"org.apache.derby.jdbc.EmbeddedDriver";
+ @AnnotationMemberTypes.Optional
+ String connectionURL() default "";
}
@PropertySet
Index:
samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBContr
ol.jcx
===================================================================
---
samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBContr
ol.jcx (revision 124193)
+++
samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBContr
ol.jcx (working copy)
@@ -29,7 +29,7 @@
import dbControl.DatabaseControl.SQL;
@ControlExtension
[EMAIL PROTECTED](jndiName="jdbc:derby:build/databaseControlTestDB;
create=true")
[EMAIL PROTECTED](connectionURL="jdbc:derby:build/databaseControlTe
stDB;create=true")
public interface EmployeeDBControl extends DatabaseControl
{
@SQL(statement="CREATE TABLE EMPLOYEE ( id INT PRIMARY KEY NOT
NULL, " +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^
Greg McCarty
Senior Technical Advisor / ManTech IST
ph: 410-480-9000 x2804 or 703-674-2804 fx: 410-480-0916