summaryrefslogtreecommitdiffstats
path: root/sandbox/lresende/sca
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/lresende/sca')
-rw-r--r--sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java36
1 files changed, 8 insertions, 28 deletions
diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java
index 96e9233f66..07c435d2bd 100644
--- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java
+++ b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java
@@ -19,44 +19,24 @@
package organization.das;
import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.DriverManager;
import org.apache.tuscany.das.rdb.Command;
import org.apache.tuscany.das.rdb.DAS;
import org.soa.types.SchemaInfoType;
+import util.ConnectionHelper;
+
import commonj.sdo.DataObject;
public class OrganizationDataServiceImpl implements OrganizationDataService {
-
- private java.sql.Connection getConnection(SchemaInfoType schemaInfo)
- {
- Connection conn = null;
-
- // schemaInfo should be your SID. Something like xe (for Oracle Personal Edition)
- String url = "jdbc:derby:target/dastest; create = true";
- String driver = "org.apache.derby.jdbc.EmbeddedDriver";
-
- try {
- Class.forName(driver);
- conn = DriverManager.getConnection(url, schemaInfo.getUSERNAME(), schemaInfo.getPASSWORD());
- conn.setAutoCommit(false);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- return conn;
- }
public DataObject findOrganizationBugTwo(String id, SchemaInfoType schemaInfo) {
DataObject root = null;
- InputStream in = getClass().getClassLoader().getResourceAsStream("dasConfiguration.xml");
+ InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml");
- java.sql.Connection conn = getConnection(schemaInfo);
+ java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo);
DAS das = DAS.FACTORY.createDAS(in, conn);
Command read = das.getCommand("getAccountByID");
@@ -71,9 +51,9 @@ public class OrganizationDataServiceImpl implements OrganizationDataService {
public DataObject findOrganizationBugOne(String id, SchemaInfoType schemaInfo) {
DataObject root = null;
- InputStream in = getClass().getClassLoader().getResourceAsStream("dasConfiguration.xml");
+ InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml");
- java.sql.Connection conn = getConnection(schemaInfo);
+ java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo);
DAS das = DAS.FACTORY.createDAS(in, conn);
Command read = das.getCommand("getAccountByID");
@@ -95,9 +75,9 @@ public class OrganizationDataServiceImpl implements OrganizationDataService {
}
public void updateOrganization(DataObject organization, SchemaInfoType schemaInfo) {
- InputStream in = getClass().getClassLoader().getResourceAsStream("dasConfiguration.xml");
+ InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml");
- java.sql.Connection conn = getConnection(schemaInfo);
+ java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo);
DAS das = DAS.FACTORY.createDAS(in, conn);