diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-13 01:41:50 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-13 01:41:50 +0000 |
commit | aca1633212fe261c04861cd48ab53b5081089fd2 (patch) | |
tree | 41f9e8fa66e1b78204ae15071fd611d7205877a1 /sandbox/lresende/sca/samples/organization-das/src/main/java | |
parent | 8eb5bf1de6c82c6d6e2932630be767aaa086a2b8 (diff) |
Cleaning up sandbox
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@898604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/lresende/sca/samples/organization-das/src/main/java')
5 files changed, 0 insertions, 234 deletions
diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java deleted file mode 100644 index af71558b14..0000000000 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package organization.das; - -import org.soa.types.SchemaInfoType; - -public interface OrganizationDataService { - - public commonj.sdo.DataObject findOrganizationBugTwo(java.lang.String id, SchemaInfoType schemaInfo); - - public commonj.sdo.DataObject findOrganizationBugOne(java.lang.String id, SchemaInfoType schemaInfo); - - public void updateOrganization(commonj.sdo.DataObject organization, SchemaInfoType schemaInfo); -} 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 deleted file mode 100644 index 2f99dc84f5..0000000000 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/das/OrganizationDataServiceImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package organization.das; - -import java.io.InputStream; - -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 { - - - public DataObject findOrganizationBugTwo(String id, SchemaInfoType schemaInfo) { - DataObject root = null; - InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml"); - - java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo); - - DAS das = DAS.FACTORY.createDAS(in, conn); - Command read = das.getCommand("getAccountByID"); - read.setParameter(1, Integer.valueOf(id)); - - root = read.executeQuery(); - - // Testing the root datagraph after returning to test runner. - - return root; - } - - public DataObject findOrganizationBugOne(String id, SchemaInfoType schemaInfo) { - DataObject root = null; - InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml"); - - java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo); - - DAS das = DAS.FACTORY.createDAS(in, conn); - Command read = das.getCommand("getAccountByID"); - read.setParameter(1, Integer.valueOf(id)); - - root = read.executeQuery(); - - // This is just testing to see if the call to das.applyChanges works - // This doesn't work - - DataObject account = root.getDataObject("ACCOUNT[1]"); - account.set("ACCOUNT_NAME", "TestNode2"); - System.out.println("findOrganization data graph -> " + root.getDataGraph()); - System.out.println("findOrganization data graph root -> " + root.getDataGraph().getRootObject()); - - das.applyChanges(root); - - return root; - } - - public void updateOrganization(DataObject organization, SchemaInfoType schemaInfo) { - InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml"); - - java.sql.Connection conn = ConnectionHelper.getConnection(schemaInfo); - - DAS das = DAS.FACTORY.createDAS(in, conn); - try { - das.applyChanges(organization); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java deleted file mode 100644 index d821da47e5..0000000000 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package organization.services; - -import org.soa.types.SchemaInfoType; - -import commonj.sdo.DataObject; - -public interface OrganizationService { - - public DataObject findOrganizationBugTwo(String id, SchemaInfoType schemaInfo); - - public DataObject findOrganizationBugOne(String id, SchemaInfoType schemaInfo); - - public void updateOrganization(DataObject organization, SchemaInfoType schemaInfo); -} diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationServiceImpl.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationServiceImpl.java deleted file mode 100644 index fe977aff55..0000000000 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/organization/services/OrganizationServiceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package organization.services; - -import org.osoa.sca.annotations.Service; -import org.soa.types.SchemaInfoType; - -import organization.das.OrganizationDataService; - -import commonj.sdo.DataObject; - -@Service(OrganizationService.class) -public class OrganizationServiceImpl implements OrganizationService { - - private OrganizationDataService organizationDataService; - - public OrganizationDataService getOrganizationDataService() { - return organizationDataService; - } - - public void setOrganizationDataService(OrganizationDataService organizationDataService) { - this.organizationDataService = organizationDataService; - } - - public DataObject findOrganizationBugTwo(String id, SchemaInfoType schemaInfo) { - return organizationDataService.findOrganizationBugTwo(id, schemaInfo); - } - - public DataObject findOrganizationBugOne(String id, SchemaInfoType schemaInfo) { - return organizationDataService.findOrganizationBugOne(id, schemaInfo); - } - - public void updateOrganization(DataObject organization, SchemaInfoType schemaInfo) { - organizationDataService.updateOrganization(organization, schemaInfo); - } -} diff --git a/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java b/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java deleted file mode 100644 index 43903b3a11..0000000000 --- a/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java +++ /dev/null @@ -1,28 +0,0 @@ -package util; - -import java.sql.Connection; -import java.sql.DriverManager; - -import org.soa.types.SchemaInfoType; - -public class ConnectionHelper { - public static 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/organization_db; 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; - } -} |