diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 04:46:18 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 04:46:18 +0000 |
commit | afc043b922b8b568d6bb0022e5129d4f74909c2b (patch) | |
tree | 70c5f154b94a9bcdd3f30826b4e6b8f4c2a90791 /sandbox/lresende/sca/samples/organization-das | |
parent | 9fe9a0d09adb6c32391580e66f36c528ae10abe0 (diff) |
Updating das configuration file name in sample application
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684630 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/lresende/sca/samples/organization-das')
-rw-r--r-- | sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java | 36 |
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); |