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 2007/06/20 04:44:17 UTC
svn commit: r548894 [1/2] - in
/incubator/tuscany/java/sca/modules/implementation-data: ./ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/
src/main/java/...
Author: lresende
Date: Tue Jun 19 19:44:12 2007
New Revision: 548894
URL: http://svn.apache.org/viewvc?view=rev&rev=548894
Log:
First cut of implementation.data - to expose rdb data as feeds
Added:
incubator/tuscany/java/sca/modules/implementation-data/
incubator/tuscany/java/sca/modules/implementation-data/.checkstyle
incubator/tuscany/java/sca/modules/implementation-data/.pmd
incubator/tuscany/java/sca/modules/implementation-data/README
incubator/tuscany/java/sca/modules/implementation-data/build.xml
incubator/tuscany/java/sca/modules/implementation-data/pom.xml
incubator/tuscany/java/sca/modules/implementation-data/src/
incubator/tuscany/java/sca/modules/implementation-data/src/main/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProvider.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProviderFactory.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAInvoker.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAModuleActivator.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionInfo.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionProperties.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngine.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngineManager.java
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/impl/
incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/module/
incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/
incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/
incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/
incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
incubator/tuscany/java/sca/modules/implementation-data/src/test/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATACompanyAtomFeedTestCase.java
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATAImplementationProcessorTestCase.java
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATATestCase.java
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/log.ctrl (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/log1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/logmirror.ctrl (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c10.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c101.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c111.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c121.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c130.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c141.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c150.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c161.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c171.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c180.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c191.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1a1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1b1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1c0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1d1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1e0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c1f1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c20.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c200.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c211.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c221.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c230.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c241.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c251.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c260.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c271.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c281.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c290.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2a1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2b1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2c1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2d0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2e1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c2f0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c300.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c31.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c311.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c320.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c331.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c340.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c351.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c360.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c371.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c380.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c391.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3a0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3b1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3c0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3d1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3e0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c3f1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c400.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c41.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c411.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c420.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c431.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c440.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c451.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c460.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c471.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c481.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c490.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c4a1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c51.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c60.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c71.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c81.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/c90.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/ca1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/cb1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/cc0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/cd1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/ce1.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/seg0/cf0.dat (with props)
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/service.properties
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/data-feed.composite
incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/data.composite
Added: incubator/tuscany/java/sca/modules/implementation-data/.checkstyle
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/.checkstyle?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/.checkstyle (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/.checkstyle Tue Jun 19 19:44:12 2007
@@ -0,0 +1,24 @@
+<?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.
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
Added: incubator/tuscany/java/sca/modules/implementation-data/.pmd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/.pmd?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/.pmd (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/.pmd Tue Jun 19 19:44:12 2007
@@ -0,0 +1,20 @@
+<?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.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
Added: incubator/tuscany/java/sca/modules/implementation-data/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/README?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/README (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/README Tue Jun 19 19:44:12 2007
@@ -0,0 +1,78 @@
+Implementation CRUD Sample
+==========================
+This sample demonstrates how new implementation types are constructed for
+Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the crud implementation type that this sample provides
+please see the implementation-crud-client sample that provides the necessary
+client code to bring up an application that uses this implementation-crud
+
+Sample Overview
+---------------
+This sample contains a CRUD implementation type as an example of how to create
+new implementation types. Components using this implementation type always
+expose the same Create, Retrieve, Update and Delete interface. This sample
+uses a singleton ResourceManager to perform the CRUD operations but of course
+a real component would provide a real implementation.
+
+implementation-crud/
+ src/
+ main/
+ java/
+ crud/ - implementation model interfaces
+ crud.backend/ - fake component implementation
+ crud.impl/ - implementations of the model interfaces
+ crud.module/ - gets the implementation-crud module registered
+ with the SCA runtime
+ crud.provider/ - runtime implementation
+ resources/
+ crud.composite - the SCA assembly used during unit testing
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-crud
+ant compile
+
+See the sample implementation-crud-client to run a sample that uses this
+binding.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-crud
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+update(0)
+retrieve(0)
+delete(0)
+retrieve(0)
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
Added: incubator/tuscany/java/sca/modules/implementation-data/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/build.xml?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/build.xml (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/build.xml Tue Jun 19 19:44:12 2007
@@ -0,0 +1,51 @@
+<!--
+ * 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 name="implementation-crud" default="compile">
+ <property name="test.jar" value="sample-implementation-crud.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
Added: incubator/tuscany/java/sca/modules/implementation-data/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/pom.xml?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/pom.xml (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/pom.xml Tue Jun 19 19:44:12 2007
@@ -0,0 +1,147 @@
+<?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-modules</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-data</artifactId>
+ <name>Apache Tuscany Data Feed Implementation</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-feed</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import commonj.sdo.DataObject;
+
+/**
+ * The service interface of a DAS service provided by DAS components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DATA {
+
+ /**
+ * Execute a DAS query to retrieve the specified table row
+ * @param id The PK that identifies the row
+ * @return The row represented by an SDO object
+ */
+ DataObject get(String id);
+
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,145 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionInfo;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * The model representing a sample DATA implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAImplementation implements Implementation {
+
+ private Service dataService;
+ private ConnectionInfo connectionInfo;
+ private String table;
+
+ /**
+ * Constructs a new DAS implementation.
+ */
+ public DATAImplementation(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+
+ // DATA implementation always provide a single service exposing
+ // the DATA interface, and have no references and properties
+ dataService = assemblyFactory.createService();
+ dataService.setName("DATA");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = introspector.introspect(DATA.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ dataService.setInterfaceContract(interfaceContract);
+ }
+
+ public ConnectionInfo getConnectionInfo() {
+ return this.connectionInfo;
+ }
+
+ public void setConnectionInfo(ConnectionInfo connectionInfo) {
+ this.connectionInfo = connectionInfo;
+ }
+
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String config) {
+ this.table = config;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample DATA implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample DATA implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample DATA implementation provides a single fixed CRUD service
+ return Collections.singletonList(dataService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample DATA implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample DATA implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample DATA implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample DATA implementation does not have a URI
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample DATA implementation does not support policy sets
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample DATA implementation does not support intents
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample DATA implementation does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // The sample DATA implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample DATA implementation is always resolved
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+
+
+/**
+ * A default factory for the DATA implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector introspector;
+
+ public DATAImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ public DATAImplementation createDASImplementation() {
+ return new DATAImplementation(assemblyFactory, javaFactory, introspector);
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,162 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionInfo;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionProperties;
+
+
+/**
+ * Implements a STAX artifact processor for DATA implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.data>
+ * elements in SCA assembly XML composite files and populating the DATA
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAImplementationProcessor implements StAXArtifactProcessor<DATAImplementation> {
+ protected static final QName IMPLEMENTATION_DATA = new QName(Constants.SCA10_NS, "implementation.data");
+
+ private static final QName CONNECTION_INFO = new QName(Constants.SCA10_NS, "connectionInfo");
+ private static final QName CONNECTION_PROPERTIES = new QName(Constants.SCA10_NS, "connectionProperties");
+
+
+ private DATAImplementationFactory dataFactory;
+
+ public DATAImplementationProcessor(DATAImplementationFactory dataFactory) {
+ this.dataFactory = dataFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_DATA;
+ }
+
+ public Class<DATAImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return DATAImplementation.class;
+ }
+
+ /*
+ * <component name="CompanyDataComponent">
+ * <implementation.data datacource="" table="company">
+ * <connectionInfo>
+ * <connectionProperties
+ * driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ * databaseURL="jdbc:derby:target/test-classes/dastest; create = true"
+ * loginTimeout="600000"/>
+ * </connectionInfo>
+ * </implementation.data>
+ * </component>
+ */
+ public DATAImplementation read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPLEMENTATION_DATA.equals(reader.getName());
+
+ // Read an <implementation.data> element
+ try {
+
+ // Create an initialize the DAS implementation model
+ DATAImplementation implementation = dataFactory.createDASImplementation();
+
+ //FIXME: validation sending info to monitor....
+ String table = reader.getAttributeValue(null, "table");
+ implementation.setTable(table); //required
+
+ while (true) {
+ int event = reader.next();
+ switch (event) {
+
+ case START_ELEMENT:
+ QName element = reader.getName();
+
+ if (CONNECTION_INFO.equals(element)) {
+ /*
+ * <connectionInfo dataSource="jdbc:derby:target/test-classes/dastest; create = true"/>
+ */
+ String dataSource = reader.getAttributeValue(null, "datasource"); //exclusive with connection properties
+ if (dataSource != null && dataSource.length() > 0) {
+ ConnectionInfo connectionInfo = new ConnectionInfo();
+ connectionInfo.setDataSource(dataSource);
+ implementation.setConnectionInfo(connectionInfo);
+ }
+
+ } else if (CONNECTION_PROPERTIES.equals(element)) {
+ /*
+ * <connectionProperties
+ * driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ * databaseURL="jdbc:derby:target/test-classes/dastest; create = true"
+ * username=""
+ * password=""
+ * loginTimeout="600000"/>
+ */
+ String driverClass = reader.getAttributeValue(null, "driverClass");
+ String databaseURL = reader.getAttributeValue(null, "databaseURL");
+ String username = reader.getAttributeValue(null, "username");
+ String password = reader.getAttributeValue(null, "password");
+ int loginTimeout = Integer.parseInt(reader.getAttributeValue(null, "loginTimeout"));
+
+ //FIXME: validation sending info to monitor....
+ ConnectionInfo connectionInfo = new ConnectionInfo();
+ ConnectionProperties connectionProperties = new ConnectionProperties();
+ connectionProperties.setDriverClass(driverClass);
+ connectionProperties.setDatabaseURL(databaseURL);
+ connectionProperties.setUsername(username);
+ connectionProperties.setPassword(password);
+ connectionProperties.setLoginTimeout(loginTimeout);
+
+ connectionInfo.setConnectionProperties(connectionProperties);
+ implementation.setConnectionInfo(connectionInfo);
+ }
+
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (IMPLEMENTATION_DATA.equals(reader.getName())) {
+ return implementation;
+ }
+ break;
+ }
+ }
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+
+ }
+
+ public void resolve(DATAImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(DATAImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProvider.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProvider.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProvider.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.sca.implementation.data.das.DataAccessEngine;
+import org.apache.tuscany.sca.implementation.data.das.DataAccessEngineManager;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * DATA Implementation provider
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAImplementationProvider implements ImplementationProvider {
+ private RuntimeComponent component;
+ private DATAImplementation implementation;
+ private final DataAccessEngineManager dataAccessEngineManager;
+
+ /**
+ * Constructs a new DATA implementation.
+ */
+ public DATAImplementationProvider(RuntimeComponent component, DATAImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ this.dataAccessEngineManager = new DataAccessEngineManager();
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ DAS das = null;
+ try {
+ das = dataAccessEngineManager.getDAS(implementation.getConnectionInfo());
+ } catch(Exception e) {
+ e.printStackTrace();
+ //what now ?
+ }
+ DATAInvoker invoker = new DATAInvoker(operation, implementation.getTable(), new DataAccessEngine(das) );
+ return invoker;
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ DAS das = null;
+ try {
+ das = dataAccessEngineManager.getDAS(implementation.getConnectionInfo());
+ } catch(Exception e) {
+ //what now ?
+ }
+
+ DATAInvoker invoker = new DATAInvoker(operation, implementation.getTable(), new DataAccessEngine(das) );
+ return invoker;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProviderFactory.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProviderFactory.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory for DATA Implementation Provider
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAImplementationProviderFactory implements ImplementationProviderFactory<DATAImplementation> {
+
+ /**
+ * Constructs a new DATA implementation.
+ */
+ public DATAImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, DATAImplementation implementation) {
+ return new DATAImplementationProvider(component, implementation);
+ }
+
+ public Class<DATAImplementation> getModelType() {
+ return DATAImplementation.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAInvoker.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAInvoker.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAInvoker.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.implementation.data.das.DataAccessEngine;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+
+/**
+ * Implements a target invoker for DAS component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. The current component implementation will
+ * dispatch calls to the DAS apis to retrieve the requested data from the backend store
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAInvoker implements Invoker {
+ private final Operation operation;
+ private final String table;
+ private final DataAccessEngine dataAccessEngine;
+
+ public DATAInvoker(Operation operation, String table, DataAccessEngine dataAccessEngine) {
+ this.operation = operation;
+ this.table = table;
+ this.dataAccessEngine = dataAccessEngine;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ if (operation.getName().equals("get")) {
+ String id = (String) args[0];
+
+ //simple execute command by name
+ return this.dataAccessEngine.executeGet(table, id);
+ } else {
+ return null;
+ }
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAModuleActivator.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAModuleActivator.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.implementation.data.DATAImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+
+/**
+ * Implements a module activator for the DAS implementation extension module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATAModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // This module extension does not contribute any new extension point
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the CRUD implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ DATAImplementationFactory crudFactory = new DATAImplementationFactory(assemblyFactory, javaFactory, introspector);
+
+ // Add the CRUD implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ DATAImplementationProcessor implementationArtifactProcessor = new DATAImplementationProcessor(crudFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the CRUD provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new DATAImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionInfo.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionInfo.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionInfo.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data.config;
+
+/**
+ * Database connection information to be used for implementation.data
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectionInfo {
+ private ConnectionProperties connectionProperties;
+
+ private String dataSource;
+
+ public String getDataSource() {
+ return this.dataSource;
+ }
+
+ public void setDataSource(String dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public ConnectionProperties getConnectionProperties() {
+ return this.connectionProperties;
+ }
+
+ public void setConnectionProperties(ConnectionProperties connectionProperties) {
+ this.connectionProperties = connectionProperties;
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionProperties.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionProperties.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionProperties.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/config/ConnectionProperties.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data.config;
+
+/**
+ * Database connection properties to be used for implementation.data
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectionProperties {
+
+ private String driverClass;
+
+ private String databaseURL;
+
+ private String userName;
+
+ private String password;
+
+ private int loginTimeOut;
+
+ public String getDriverClass() {
+ return this.driverClass;
+ }
+
+ public void setDriverClass(String driverClass) {
+ this.driverClass = driverClass;
+ }
+
+ public String getDatabaseURL() {
+ return this.databaseURL;
+ }
+
+ public void setDatabaseURL(String databaseURL) {
+ this.databaseURL = databaseURL;
+ }
+
+ public String getUsername() {
+ return this.userName;
+ }
+
+ public void setUsername(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return this.password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public int getLoginTimeout() {
+ return this.loginTimeOut;
+ }
+
+ public void setLoginTimeout(int loginTimeOut) {
+ this.loginTimeOut = loginTimeOut;
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngine.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngine.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngine.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngine.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data.das;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Facade to hide DAS implementation details of handling commands
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataAccessEngine {
+ private final DAS das;
+
+ public DataAccessEngine(DAS das) {
+ this.das = das;
+ }
+
+ public DataObject executeGet(String table, String id) {
+ try {
+ String sqlQuery = "select * from " + table.toUpperCase() + " where ID = " + id;
+ Command command = this.das.createCommand(sqlQuery);
+ return command.executeQuery();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngineManager.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngineManager.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngineManager.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/das/DataAccessEngineManager.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.apache.tuscany.sca.implementation.data.das;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionInfo;
+
+/**
+ * The DataAccessEngineManager acts like a registry and factory for DAS instances
+ * It holds DAS by it's config file name, reusing the same DAS for all components
+ * using the same config file.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataAccessEngineManager {
+ //private final Map<String, DAS> registry = new HashMap<String, DAS>();
+
+ public DataAccessEngineManager() {
+ super();
+ }
+
+
+ protected DAS initializeDAS(ConnectionInfo connectionInfo) {
+ //load the config file
+ System.out.println("Initializing DAS");
+
+ ConfigHelper configHelper = new ConfigHelper();
+
+ String dataSource = connectionInfo.getDataSource();
+ if(dataSource != null && dataSource.length() > 0) {
+ configHelper.addConnectionInfo(dataSource);
+ } else {
+ String driverClass = connectionInfo.getConnectionProperties().getDriverClass();
+ String connectionURL = connectionInfo.getConnectionProperties().getDatabaseURL();
+ String userName = connectionInfo.getConnectionProperties().getUsername();
+ String password = connectionInfo.getConnectionProperties().getPassword();
+ int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout();
+
+ configHelper.addConnectionInfo(driverClass, connectionURL, userName, password, loginTimeout);
+ }
+
+ DAS das = DAS.FACTORY.createDAS(configHelper.getConfig());
+
+ return das;
+ }
+
+ public DAS getDAS(ConnectionInfo connectionInfo) {
+ assert connectionInfo != null;
+
+ //FIXME: cache the das, we need to define the keys to use (datasource and databaseurl + hashed(username + password))
+
+ return initializeDAS(connectionInfo);
+ }
+
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Tue Jun 19 19:44:12 2007
@@ -0,0 +1,20 @@
+# 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.
+#
+# Implementation class for the ExtensionActivator
+#
+org.apache.tuscany.sca.implementation.data.DATAModuleActivator
Added: incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATACompanyAtomFeedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATACompanyAtomFeedTestCase.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATACompanyAtomFeedTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATACompanyAtomFeedTestCase.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.apache.tuscany.sca.implementation.das;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev: 543175 $ $Date: 2007-05-31 09:09:12 -0700 (Thu, 31 May 2007) $
+ */
+public class DATACompanyAtomFeedTestCase extends TestCase {
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ scaDomain = SCADomain.newInstance("data-feed.composite");
+ //System.in.read();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ scaDomain.close();
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATAImplementationProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATAImplementationProcessorTestCase.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATAImplementationProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATAImplementationProcessorTestCase.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,144 @@
+/*
+ * 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.apache.tuscany.sca.implementation.das;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.implementation.data.DATAImplementation;
+import org.apache.tuscany.sca.implementation.data.DATAImplementationFactory;
+import org.apache.tuscany.sca.implementation.data.DATAImplementationProcessor;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionInfo;
+import org.apache.tuscany.sca.implementation.data.config.ConnectionProperties;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+
+/**
+ * @version $Rev: 538445 $ $Date: 2007-05-15 23:20:37 -0700 (Tue, 15 May 2007) $
+ */
+public class DATAImplementationProcessorTestCase extends TestCase {
+
+ protected static final QName IMPLEMENTATION_DATA = new QName(Constants.SCA10_NS, "implementation.data");
+
+ private static final String COMPOSITE_USING_DATASOURCE =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">"
+ + " <component name=\"DataComponent\">"
+ + " <implementation.data table=\"tableName\">"
+ + " <connectionInfo datasource=\"dataSource\"/>"
+ + " </implementation.data>"
+ + "</component>";
+
+ private static final String COMPOSITE_USING_CONNECTION_PROPERTIES =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">"
+ + " <component name=\"DataComponent\">"
+ + " <implementation.data table=\"tableName\">"
+ + " <connectionInfo>"
+ + " <connectionProperties"
+ + " driverClass=\"driverClass\""
+ + " databaseURL=\"databaseURL\""
+ + " loginTimeout=\"1\"/>"
+ + " </connectionInfo>"
+ + " </implementation.data>"
+ + "</component>";
+
+ private XMLInputFactory xmlFactory;
+ private DATAImplementationFactory dataFactory;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+
+ dataFactory = new DATAImplementationFactory(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), introspector);
+
+ }
+
+ public void testLoadCompositeUsingDatasource() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE));
+
+ DATAImplementationProcessor dataProcessor =
+ new DATAImplementationProcessor(dataFactory);
+
+ while(true) {
+ int event = reader.next();
+ if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DATA.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ DATAImplementation implementation = dataProcessor.read(reader);
+
+ assertNotNull(implementation);
+ assertEquals("tableName", implementation.getTable());
+
+ ConnectionInfo connInfo = implementation.getConnectionInfo();
+ assertNotNull(connInfo);
+ assertEquals("dataSource", connInfo.getDataSource());
+
+ ConnectionProperties connProperties = connInfo.getConnectionProperties();
+ assertNull(connProperties);
+ }
+
+ public void testLoadCompositeUsingConnectionProperties() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES));
+
+ DATAImplementationProcessor dataProcessor =
+ new DATAImplementationProcessor(dataFactory);
+
+ while(true) {
+ int event = reader.next();
+ if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DATA.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ DATAImplementation implementation = dataProcessor.read(reader);
+
+ assertNotNull(implementation);
+ assertEquals("tableName", implementation.getTable());
+
+ ConnectionInfo connInfo = implementation.getConnectionInfo();
+ assertNotNull(connInfo);
+ assertNull("dataSource", connInfo.getDataSource());
+
+ ConnectionProperties connProperties = connInfo.getConnectionProperties();
+ assertNotNull(connProperties);
+ assertEquals("driverClass",connProperties.getDriverClass());
+ assertEquals("databaseURL",connProperties.getDatabaseURL());
+ assertEquals(1,connProperties.getLoginTimeout());
+ }
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATATestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATATestCase.java?view=auto&rev=548894
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATATestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/das/DATATestCase.java Tue Jun 19 19:44:12 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.apache.tuscany.sca.implementation.das;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.implementation.data.DATA;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Tests the DAS service
+ *
+ * @version $Rev$ $Date$
+ */
+public class DATATestCase extends TestCase {
+ private SCADomain scaDomain;
+ private DATA dataService;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("data.composite");
+ dataService = scaDomain.getService(DATA.class, "DataComponent");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+
+ public void testExecuteCommand() throws Exception {
+ Integer companyID = new Integer(51);
+
+ DataObject resultRoot= dataService.get(companyID.toString());
+ assertNotNull(resultRoot);
+
+ //verify we got back the right row
+ assertEquals(companyID, resultRoot.get("COMPANY[1]/ID"));
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/log.ctrl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/log.ctrl?view=auto&rev=548894
==============================================================================
Binary file - no diff available.
Propchange: incubator/tuscany/java/sca/modules/implementation-data/src/test/resources/dastest/log/log.ctrl
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org