You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2008/08/10 00:58:08 UTC

svn commit: r684376 - in /tuscany/sandbox/lresende/sca/samples: ./ organization-das/ organization-das/src/ organization-das/src/main/ organization-das/src/main/java/ organization-das/src/main/java/org/ organization-das/src/main/java/org/osoa/ organizat...

Author: lresende
Date: Sat Aug  9 15:58:07 2008
New Revision: 684376

URL: http://svn.apache.org/viewvc?rev=684376&view=rev
Log:
TUSCANY-2525 - Investigating data access integration issues - Initial scenario based on user application

Added:
    tuscany/sandbox/lresende/sca/samples/organization-das/
    tuscany/sandbox/lresende/sca/samples/organization-das/organization.sql
    tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/test/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/
    tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java   (with props)
    tuscany/sandbox/lresende/sca/samples/organization-das/src/test/resources/
Modified:
    tuscany/sandbox/lresende/sca/samples/pom.xml

Added: tuscany/sandbox/lresende/sca/samples/organization-das/organization.sql
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/organization.sql?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/organization.sql (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/organization.sql Sat Aug  9 15:58:07 2008
@@ -0,0 +1,33 @@
+DROP TABLE ACCOUNT;
+DROP TABLE ORGANIZATIONTYPELIST;
+
+CREATE TABLE ACCOUNT (
+   ACCOUNT_ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, 
+   ACCOUNTTYPE_CD VARCHAR(30),
+   ACCOUNT_NAME VARCHAR(30),
+   WEB_SITE_ADDRESS VARCHAR(30),
+   STREET_ADDRESS_1 VARCHAR(30),
+   STREET_ADDRESS_2 VARCHAR(30),
+   STREET_ADDRESS_3 VARCHAR(30),
+   CITY VARCHAR(10),
+   STATE_CD VARCHAR(2),
+   POSTAL_CD VARCHAR(5),
+   COUNTRY_CD VARCHAR(3),
+   PHONE_NUMBER VARCHAR(15),
+   FAX_NUMBER VARCHAR(15), 
+   NOTE VARCHAR(50));
+
+CREATE TABLE ORGANIZATIONTYPELIST (
+   ORGANIZATIONTYPEID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, 
+   CODE VARCHAR(10),
+   DISPLAYVALUE VARCHAR(30), 
+   DESCRIPTION VARCHAR(30),
+   ISEDITABLE INT);
+
+
+INSERT INTO ACCOUNT (ACCOUNTTYPE_CD, ACCOUNT_NAME, WEB_SITE_ADDRESS, STREET_ADDRESS_1, STREET_ADDRESS_2, STREET_ADDRESS_3, CITY,    STATE_CD, POSTAL_CD, COUNTRY_CD, PHONE_NUMBER, FAX_NUMBER, NOTE) VALUES ('ACC_TYPE_01', 'NAME_001', 'http://name_001.com', '1234 Street 1', '', '', 'San Jose', 'CA', '95134', 'USA', '', '', 'NAME 001 NOTES');
+
+
+INSERT INTO ORGANIZATIONTYPELIST (CODE, DISPLAYVALUE, DESCRIPTION, ISEDITABLE) VALUES('ACME', 'ACME Organization', 'ACME Description', 0 );
+INSERT INTO ORGANIZATIONTYPELIST (CODE, DISPLAYVALUE, DESCRIPTION, ISEDITABLE) VALUES('DO-RITE', 'DO-RITE Plumbing', 'DO-RITE Plumbing Description', 0 );
+INSERT INTO ORGANIZATIONTYPELIST (CODE, DISPLAYVALUE, DESCRIPTION, ISEDITABLE) VALUES('MEGACORP', 'MEGACORP Organization', 'MEGACORP Description', 0 );

Added: tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml Sat Aug  9 15:58:07 2008
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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. 
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <artifactId>sample-organization-das</artifactId>
+    <name>Apache Tuscany SCA Company Data Access Service Sample</name>
+    <packaging>jar</packaging>
+
+
+	<dependencies>
+		<dependency>
+		    <groupId>org.apache.tuscany.sca</groupId>
+		    <artifactId>tuscany-sca-api</artifactId>
+		    <version>1.4-SNAPSHOT</version>
+		</dependency>        
+
+		<dependency>
+		    <groupId>org.apache.tuscany.sca</groupId>
+		    <artifactId>tuscany-host-embedded</artifactId>
+		    <version>1.4-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+		    <groupId>org.apache.tuscany.sca</groupId>
+		    <artifactId>tuscany-implementation-java-runtime</artifactId>
+		    <version>1.4-SNAPSHOT</version>
+		    <scope>runtime</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sdo</groupId>
+			<artifactId>tuscany-sdo-impl</artifactId>
+			<version>1.1.1</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.das</groupId>
+			<artifactId>tuscany-das-rdb</artifactId>
+			<version>1.0-SNAPSHOT</version>
+			<scope>compile</scope>
+		</dependency>
+
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>10.1.2.1</version>
+            <scope>test</scope>
+        </dependency>  
+        		
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>		
+
+	</dependencies>
+
+	<build>
+		<plugins>
+           <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/sdo-source</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+			
+            <plugin>
+				<groupId>org.apache.tuscany.sdo</groupId>
+				<artifactId>tuscany-sdo-plugin</artifactId>
+				<version>1.1.1</version>
+				<executions>
+				    <execution>
+					<id>config</id>
+					<configuration>
+					    <schemaFile>${basedir}/src/main/resources/sdo-types.xsd</schemaFile>
+					    <noNotification>true</noNotification>
+					    <noUnsettable>true</noUnsettable>
+					</configuration>
+					<goals>
+					    <goal>generate</goal>
+					</goals>
+				    </execution>
+				</executions>
+			</plugin>			
+            
+			<plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>sql-maven-plugin</artifactId>
+                <!-- 1.1 due to MOJO-619 -->
+                <version>1.1-SNAPSHOT</version> 
+
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.derby</groupId>
+                        <artifactId>derby</artifactId>
+                        <version>10.1.2.1</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <execution>
+                        <id>create-db</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                            <url>jdbc:derby:${pom.basedir}/target/organization_db;create=true</url>
+                            <autocommit>true</autocommit>
+                            <onError>continue</onError>
+                            <onConnectionError>skip</onConnectionError>
+                            <delimiter>;</delimiter>
+                            <srcFiles>
+                                <srcFile>${pom.basedir}/organization.sql</srcFile>
+                            </srcFiles>
+                        </configuration>
+                    </execution>
+                    
+                    <!-- Shutdown DB in order to be able to run unit tests -->
+                    <execution>
+                    	<id>shutdown-database-sothat-test-can-run</id>
+                    	<phase>process-test-resources</phase>
+                    	<goals>
+                    		<goal>execute</goal>
+                    	</goals>
+                    	<configuration>
+                    	    <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                    		<url>jdbc:derby:${pom.basedir}/target/organization_db;shutdown=true</url>
+                    		<skipOnConnectionError>true</skipOnConnectionError>
+                    	</configuration>
+                    </execution>
+                </executions>
+            </plugin>			
+		</plugins>
+	</build>
+</project>

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java Sat Aug  9 15:58:07 2008
@@ -0,0 +1,31 @@
+/*
+ * 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 org.osoa.services;
+
+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);
+}

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java Sat Aug  9 15:58:07 2008
@@ -0,0 +1,106 @@
+/*
+ * 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 org.osoa.services;
+
+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 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");
+		
+		java.sql.Connection conn = 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("dasConfiguration.xml");
+		
+		java.sql.Connection conn = 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("dasConfiguration.xml");
+		
+		java.sql.Connection conn = getConnection(schemaInfo);
+		
+		DAS das = DAS.FACTORY.createDAS(in, conn);
+		
+		das.applyChanges(organization);
+	}
+}

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/org/osoa/services/OrganizationDataServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java Sat Aug  9 15:58:07 2008
@@ -0,0 +1,28 @@
+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;
+	}
+}

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/java/util/ConnectionHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite Sat Aug  9 15:58:07 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://org.soa.services"
+	xmlns:soa="http://org.soa.services"
+	name="Organization-Service-Composite">
+    
+    <component name="OrganizationServiceComponent">
+    	<implementation.spring location="Organization-spring-context.xml"/>
+    	<service name="OrganizationService"/>
+  	</component>
+  	
+  	<service name="OrganizationService" promote="OrganizationServiceComponent/OrganizationService">
+    	<binding.ws/>
+  	</service>
+  
+  	<component name="OrganizationDataServiceComponent">
+    	<implementation.spring location="Organization-spring-context.xml"/>
+  	</component>
+    
+
+</composite>

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organization.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml Sat Aug  9 15:58:07 2008
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ASCII"?>
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
+	
+	<!--ConnectionInfo>
+		<ConnectionProperties
+			driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+			databaseURL="jdbc:derby:target/organization_db; create = true"
+			loginTimeout="600000"/>
+	</ConnectionInfo-->
+	
+	
+	<Command name="getAllOrganizations" SQL="select * from ORGANIZATIONTYPELIST" kind="Select">
+		<ResultDescriptor columnName="ORGANIZATIONTYPEID" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.IntObject"/>
+		<ResultDescriptor columnName="CODE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="DISPLAYVALUE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="DESCRIPTION" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="ISEDITABLE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.Type"/>
+	</Command>
+	
+	<Command name="findOrganization" SQL="select * from ORGANIZATIONTYPELIST where ORGANIZATIONTYPEID = ? " kind="Select">
+		<ResultDescriptor columnName="ORGANIZATIONTYPEID" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.IntObject"/>
+		<ResultDescriptor columnName="CODE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="DISPLAYVALUE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="DESCRIPTION" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="ISEDITABLE" tableName="ORGANIZATIONTYPELIST" columnType="commonj.sdo.Integer"/>
+	</Command>
+	
+	<Command name="getAllAccounts" SQL="select * from ACCOUNT" kind="Select">
+		<ResultDescriptor columnName="ACCOUNT_ID" tableName="ACCOUNT" columnType="commonj.sdo.IntObject"/>
+		<ResultDescriptor columnName="ACCOUNTTYPE_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="ACCOUNT_NAME" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="WEB_SITE_ADDRESS" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_1" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_2" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_3" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="CITY" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STATE_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="POSTAL_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="COUNTRY_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="PHONE_NUMBER" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="FAX_NUMBER" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="NOTE" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+	</Command>
+	
+	<Command name="getAccountByID" SQL="select * from ACCOUNT where ACCOUNT_ID = ?" kind="Select">
+		<ResultDescriptor columnName="ACCOUNT_ID" tableName="ACCOUNT" columnType="commonj.sdo.IntObject"/>
+		<ResultDescriptor columnName="ACCOUNTTYPE_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="ACCOUNT_NAME" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="WEB_SITE_ADDRESS" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_1" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_2" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STREET_ADDRESS_3" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="CITY" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="STATE_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="POSTAL_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="COUNTRY_CD" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="PHONE_NUMBER" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="FAX_NUMBER" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+		<ResultDescriptor columnName="NOTE" tableName="ACCOUNT" columnType="commonj.sdo.String"/>
+	</Command>
+	
+	<Table tableName="ORGANIZATIONTYPELIST">
+		<Column columnName="ORGANIZATIONTYPEID" primaryKey="true" generated="true"/>
+		<Column columnName="CODE" />
+		<Column columnName="DISPLAYVALUE" />
+		<Column columnName="DESCRIPTION" />
+		<Column columnName="ISEDITABLE" />
+	</Table>
+	
+	<Table tableName="ACCOUNT">
+		<Column columnName="ACCOUNT_ID" primaryKey="true" generated="true"/>
+		<Column columnName="ACCOUNTTYPE_CD" />
+		<Column columnName="ACCOUNT_NAME" />
+		<Column columnName="WEB_SITE_ADDRESS" />
+		<Column columnName="STREET_ADDRESS_1" />
+		<Column columnName="STREET_ADDRESS_2" />
+		<Column columnName="STREET_ADDRESS_3" />
+		<Column columnName="CITY" />
+		<Column columnName="STATE_CD" />
+		<Column columnName="POSTAL_CD" />
+		<Column columnName="COUNTRY_CD" />
+		<Column columnName="PHONE_NUMBER" />
+		<Column columnName="FAX_NUMBER" />
+		<Column columnName="NOTE" />
+	</Table>
+	
+</Config>
\ No newline at end of file

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/organizationConfiguration.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd Sat Aug  9 15:58:07 2008
@@ -0,0 +1,66 @@
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://org/soa/types"
+    xmlns:tns="http://org/soa/types"
+    elementFormDefault="qualified">
+    
+    <xsd:element name="Organization" type="OrganizationType"/>
+    
+    <xsd:complexType name="OrganizationType">
+        <xsd:sequence>
+        	<xsd:element name="ORGANIZATIONTYPEID" type="xsd:int" />
+            <xsd:element name="CODE" type="xsd:string" />
+            <xsd:element name="DISPLAYVALUE" type="xsd:string" />
+            <xsd:element name="DESCRIPTION" type="xsd:string" />
+            <xsd:element name="ISEDITABLE" type="xsd:int" />
+        </xsd:sequence>
+    </xsd:complexType>
+    
+    <xsd:element name="Address" type="AddressType"/>
+    
+    <xsd:complexType name="AddressType">
+        <xsd:sequence>
+        	<xsd:element name="ADDRESS_ID" type="xsd:int" />
+            <xsd:element name="ADDRESSTYPE_CD" type="xsd:string" />
+            <xsd:element name="STREET_ADDRESS_1" type="xsd:string" />
+            <xsd:element name="STREET_ADDRESS_2" type="xsd:string" />
+            <xsd:element name="STREET_ADDRESS_3" type="xsd:string" />
+            <xsd:element name="CITY" type="xsd:string" />
+            <xsd:element name="STATE_CD" type="xsd:string" />
+            <xsd:element name="POSTAL_CD" type="xsd:string" />
+            <xsd:element name="COUNTRY_CD" type="xsd:string" />
+        </xsd:sequence>
+    </xsd:complexType>
+    
+    <xsd:element name="SchemaInfo" type="SchemaInfoType"/>
+    
+    <xsd:complexType name="SchemaInfoType">
+        <xsd:sequence>
+        	<xsd:element name="USERNAME" type="xsd:string" />
+            <xsd:element name="PASSWORD" type="xsd:string" />
+            <xsd:element name="SCHEMA" type="xsd:string" />
+        </xsd:sequence>
+    </xsd:complexType>
+    
+    <xsd:element name="Account" type="AccountType"/>
+    
+    <xsd:complexType name="AccountType">
+        <xsd:sequence>
+        	<xsd:element name="ACCOUNT_ID" type="xsd:string"/>
+			<xsd:element name="ACCOUNTTYPE_CD" type="xsd:string"/>
+			<xsd:element name="ACCOUNT_NAME" type="xsd:string"/>
+			<xsd:element name="WEB_SITE_ADDRESS" type="xsd:string"/>
+			<xsd:element name="STREET_ADDRESS_1" type="xsd:string"/>
+			<xsd:element name="STREET_ADDRESS_2" type="xsd:string"/>
+			<xsd:element name="STREET_ADDRESS_3" type="xsd:string"/>
+			<xsd:element name="CITY" type="xsd:string"/>
+			<xsd:element name="STATE_CD" type="xsd:string"/>
+			<xsd:element name="POSTAL_CD" type="xsd:string"/>
+			<xsd:element name="COUNTRY_CD" type="xsd:string"/>
+			<xsd:element name="PHONE_NUMBER" type="xsd:string"/>
+			<xsd:element name="FAX_NUMBER" type="xsd:string"/>
+			<xsd:element name="NOTE" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    
+</xsd:schema>
\ No newline at end of file

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/main/resources/sdo-types.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java?rev=684376&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java (added)
+++ tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java Sat Aug  9 15:58:07 2008
@@ -0,0 +1,116 @@
+/*
+ * 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;
+
+import java.io.InputStream;
+import java.util.Random;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.Test;
+import org.soa.types.SchemaInfoType;
+import org.soa.types.TypesFactory;
+
+import util.ConnectionHelper;
+
+import commonj.sdo.DataObject;
+
+public class OrganizationTestCase {
+
+	private static final String id = "1";
+	
+	/**
+	 * This represents BUG_ONE from TUSCANY-2525
+	 */
+	@Test
+	public void testRetrieveOrganizationDAS() {
+		DataObject root = null;
+		InputStream in = getClass().getClassLoader().getResourceAsStream("organizationConfiguration.xml");
+		
+		 //  Need to put in valid values for your DB
+        SchemaInfoType schemaInfo = TypesFactory.INSTANCE.createSchemaInfoType();
+        schemaInfo.setPASSWORD("");
+        schemaInfo.setSCHEMA("");
+        schemaInfo.setUSERNAME("");
+        
+		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
+		
+		Random generator = new Random();
+		String accountName = "ACCOUNT_" + Integer.toString(generator.nextInt());
+		
+		DataObject account = root.getDataObject("ACCOUNT[1]");
+		account.set("ACCOUNT_NAME", accountName);
+		System.out.println("findOrganization data graph -> " + root.getDataGraph());
+        System.out.println("findOrganization data graph root -> " + root.getDataGraph().getRootObject());
+		
+        das.applyChanges(root);
+        
+        root = read.executeQuery();
+        
+        DataObject updatedAccount =  root.getDataObject("ACCOUNT[1]");
+        org.junit.Assert.assertEquals(accountName, updatedAccount.get("ACCOUNT_NAME"));
+       	
+	}
+	
+		
+	@Test
+	public void testRetrieveOrganizationSCA() {
+		
+		/*
+		System.out.println("\n1. Organization-Service-Composite OrganizationClientRunner ");
+
+        SCADomain scaDomain = 
+        	SCADomain.newInstance("Organization-Service-Composite.composite");
+        
+        OrganizationService organizationService = 
+        	scaDomain.getService(OrganizationService.class, "OrganizationServiceComponent");
+
+        //  Need to put in valid values for your DB
+        SchemaInfoType schemaInfo = org.soa.types.TypeFactory.INSTANCE.createSchemaInfoType();
+        schemaInfo.setPASSWORD("");
+        schemaInfo.setSCHEMA("");
+        schemaInfo.setUSERNAME("");
+        
+        // This doesn't work.  Just retreive account, make a change, then apply changes
+        //commonj.sdo.DataObject root = organizationService.findOrganizationBugOne("16", schemaInfo);
+        
+        // This doesn't work either.  The root datagraph is null
+        // If you call das.applyChanges for a dataObject that has null as the dataGraph,
+        // it hurls.
+        //commonj.sdo.DataObject rootOne = organizationService.findOrganizationBugTwo(id, schemaInfo);
+        //System.out.println("rootOne dataGraph -> " + rootOne.getDataGraph());
+        //organizationService.updateOrganization(rootOne, schemaInfo);
+        
+        scaDomain.close();
+
+		 */
+	}
+}

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca/samples/organization-das/src/test/java/organization/OrganizationTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sandbox/lresende/sca/samples/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca/samples/pom.xml?rev=684376&r1=684375&r2=684376&view=diff
==============================================================================
--- tuscany/sandbox/lresende/sca/samples/pom.xml (original)
+++ tuscany/sandbox/lresende/sca/samples/pom.xml Sat Aug  9 15:58:07 2008
@@ -39,6 +39,7 @@
                 <module>calculator-jsf-webapp</module>
                 <module>company-das</module>
                 <module>company-das-webapp</module>
+                <module>organization-das</module>
                 <module>store-jsf</module>
                 <!--module>room-scheduler</module-->
             </modules>