diff options
Diffstat (limited to 'sandbox/lresende/sca/samples')
14 files changed, 0 insertions, 972 deletions
diff --git a/sandbox/lresende/sca/samples/company-das/build.xml b/sandbox/lresende/sca/samples/company-das/build.xml deleted file mode 100644 index 704b698aac..0000000000 --- a/sandbox/lresende/sca/samples/company-das/build.xml +++ /dev/null @@ -1,116 +0,0 @@ -<?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 name="sample-company-das" default="compile"> - - <target name="compile"> - <mkdir dir="target/classes"/> - <javac destdir="target/classes" debug="on" source="1.5" target="1.5"> - <src path="src\main\java"/> - <classpath> - <fileset refid="tuscany.jars"/> - <fileset refid="3rdparty.jars"/> - </classpath> - </javac> - <copy todir="target/classes"> - <fileset dir="src\main\resources"/> - <fileset dir="."/> - </copy> - <jar destfile="target/sample-company-das.jar" basedir="target/classes"> - <manifest> - <attribute name="Main-Class" value="das.DASServiceClient"/> - </manifest> - </jar> - </target> - - <target name="run"> - <java classname="org.apache.tuscany.samples.das.service.client.DASServiceClient" fork="true"> - <classpath> - <pathelement location="target/sample-company-das.jar"/> - <fileset refid="tuscany.jars"/> - <fileset refid="3rdparty.jars"/> - </classpath> - </java> - </target> - - <target name="clean"> - <delete includeemptydirs="true"> - <fileset dir="target"/> - </delete> - </target> - - <fileset id="tuscany.jars" dir="../../modules"> - <include name="tuscany-interface-java-xml-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-implementation-java-runtime-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-implementation-java-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-node-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-binding-sca-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-assembly-xml-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-interface-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-contribution-java-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-implementation-java-xml-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-policy-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-binding-sca-xml-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-contribution-impl-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-definitions-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-core-spi-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-contribution-namespace-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-domain-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-contribution-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-node-api-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-interface-java-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-definitions-xml-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-sca-api-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-assembly-xsd-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-policy-logging-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-assembly-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-core-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-core-databinding-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-host-embedded-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-domain-api-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-databinding-1.0.1-incubating-SNAPSHOT.jar"/> - <include name="tuscany-policy-xml-1.0.1-incubating-SNAPSHOT.jar"/> - </fileset> - <fileset id="3rdparty.jars" dir="../../lib"> - <include name="stax-api-1.0.1.jar"/> - <include name="tuscany-das-rdb-1.0-incubating-beta2.jar"/> - <include name="xml-apis-1.3.03.jar"/> - <include name="wstx-asl-3.2.0.jar"/> - <include name="commons-logging-1.1.jar"/> - <include name="axiom-impl-1.2.5.jar"/> - <include name="xalan-2.7.0.jar"/> - <include name="log4j-1.2.14.jar"/> - <include name="tuscany-sdo-lib-1.0-incubating.jar"/> - <include name="tuscany-sdo-api-r2.1-1.0-incubating.jar"/> - <include name="ecore-xmi-2.2.3.jar"/> - <include name="neethi-2.0.2.jar"/> - <include name="geronimo-commonj_1.1_spec-1.0.jar"/> - <include name="jaxen-1.1-beta-9.jar"/> - <include name="ecore-2.2.3.jar"/> - <include name="common-2.2.3.jar"/> - <include name="axiom-api-1.2.5.jar"/> - <include name="xsd-2.2.3.jar"/> - <include name="xercesImpl-2.8.1.jar"/> - <include name="cglib-nodep-2.1_3.jar"/> - <include name="tuscany-sdo-impl-1.0-incubating.jar"/> - <include name="ecore-change-2.2.3.jar"/> - </fileset> - -</project> diff --git a/sandbox/lresende/sca/samples/company-das/company.sql b/sandbox/lresende/sca/samples/company-das/company.sql deleted file mode 100644 index 8fb5c2d4cd..0000000000 --- a/sandbox/lresende/sca/samples/company-das/company.sql +++ /dev/null @@ -1,40 +0,0 @@ -DROP TABLE EMPLOYEE;
-DROP TABLE DEPARTMENT;
-DROP TABLE COMPANY;
-
-CREATE TABLE COMPANY (
- ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,
- NAME VARCHAR(30));
-
-CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,
- NAME VARCHAR(30),
- LOCATION VARCHAR(30),
- DEPNUMBER VARCHAR(10),
- COMPANYID INT);
-
-CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,
- NAME VARCHAR(30),
- SN VARCHAR(10),
- MANAGER SMALLINT,
- DEPARTMENTID INT);
-
-
-INSERT INTO COMPANY (NAME) VALUES('ACME Publishing');
-INSERT INTO COMPANY (NAME) VALUES('Do-rite plumbing');
-INSERT INTO COMPANY (NAME) VALUES('MegaCorp');
-
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Advanced Technologies','NY','123', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 2','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 3','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 4','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 5','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 6','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 7','','', 1);
-INSERT INTO DEPARTMENT (NAME, LOCATION, DEPNUMBER, COMPANYID) VALUES('Default Name 8','','', 1);
-
-INSERT INTO EMPLOYEE (NAME, SN, MANAGER, DEPARTMENTID) VALUES('John Jones','E0001', 0, 1);
-INSERT INTO EMPLOYEE (NAME, SN, MANAGER, DEPARTMENTID) VALUES('Mary Smith','E0002', 1, null);
-INSERT INTO EMPLOYEE (NAME, SN, MANAGER, DEPARTMENTID) VALUES('Jane Doe','E0003', 0, 1);
-INSERT INTO EMPLOYEE (NAME, SN, MANAGER, DEPARTMENTID) VALUES('Al Smith','E0004', 1, 1);
-
-
diff --git a/sandbox/lresende/sca/samples/company-das/pom.xml b/sandbox/lresende/sca/samples/company-das/pom.xml deleted file mode 100644 index 2c0ba4da8b..0000000000 --- a/sandbox/lresende/sca/samples/company-das/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ -<?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.1-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>sample-company-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.2-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.2-incubating-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.2-incubating-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-impl</artifactId>
- <version>1.0-incubating-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <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.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.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>das.DASServiceClient</mainClass>
- </manifest>
- </archive>
- </configuration>
- </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/company_db;create=true</url>
- <autocommit>true</autocommit>
- <onError>continue</onError>
- <onConnectionError>skip</onConnectionError>
- <delimiter>;</delimiter>
- <srcFiles>
- <srcFile>${pom.basedir}/company.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/company_db;shutdown=true</url>
- <skipOnConnectionError>true</skipOnConnectionError>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/sandbox/lresende/sca/samples/company-das/readme.html b/sandbox/lresende/sca/samples/company-das/readme.html deleted file mode 100644 index ec6b492b72..0000000000 --- a/sandbox/lresende/sca/samples/company-das/readme.html +++ /dev/null @@ -1,110 +0,0 @@ -<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>Tuscany RDB DAS exposed as an SCA service</title>
-
-<style>
-.code {font-size: 11px; color: #006699}
-.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
-.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
-.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
-.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
-</style>
-
-</head>
-
-
-
-
-<body>
-
-<h1>Tuscany RDB DAS exposed as an SCA service</h1>
-
-
-<h3>Introduction</h3>
-
-<p>This is a sample SCA service that exposes DAS functionality.</p>
-<p>This service would allow you to utilize DAS in a language neutral fashion, consuming existent or adHoc commands.</p>
-
-
-<h3>Consuming the DAS service</h3>
-
-
-<p>You should add the dependency on your client project pom file</p>
-
-
-<p>
-<div class="codebox2">
-<pre>
-<!-- DAS Service -->
-<dependency>
- <groupId>org.apache.tuscany.das.samples</groupId>
- <artifactId>sample-das-service</artifactId>
- <version>${pom.version}</version>
-</dependency>
-</pre>
-</div>
-</p>
-
-<br>
-<p>In order to consume the service, you would have to create a SCDL that references it, see sample below:</p>
-
-<p>
-<div class="codebox2">
-<pre>
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="DASServiceComposite">
- <component name="DASServiceComponent">
- <implementation.composite name="DASServiceComposite" jarLocation="lib/sample-das-service-1.0-incubator-SNAPSHOT.jar"/>
- </component>
-</composite>
-</pre>
-</div>
-</p>
-
-
-<h3>Sample Architecture</h3>
-
-<p>This service utilizes the following Interface as its definition:</p>
-
-
-<p>
-<div class="codebox2">
-<pre>
-
-public interface DASService {
-
- public void configureService(InputStream configStream) throws DASServiceException;
-
- public DataObject executeCommand(String commandName, Vector commandArguments) throws DASServiceException;
-
- public DataObject execute(String adHocQuery, Vector commandArguments) throws DASServiceException;
-
- public void applyChanges(DataObject graphRoot) throws DASServiceException;
-
-}
-</pre>
-</div>
-</p>
-
-</body>
-
-</html>
diff --git a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASService.java b/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASService.java deleted file mode 100644 index 0387341b87..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASService.java +++ /dev/null @@ -1,61 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package das;
-
-import java.io.InputStream;
-import java.util.Vector;
-
-import commonj.sdo.DataObject;
-
-public interface DASService {
-
- /**
- * Set DAS configuration file to be used
- * @param configStream
- * @throws DASServiceException
- */
- public void configureService(InputStream configStream) throws DASServiceException;
-
- /**
- * Execute an existing command. The commands are defined in the DAS Configuration file being used by the service
- * @param commandName Command name as it appears on the DAS Configuration file
- * @param commandArguments Vector with arguments to be used by the command
- * @throws DASServiceException
- * @return
- */
- public DataObject executeCommand(String commandName, Vector commandArguments) throws DASServiceException;
-
- /**
- * Execute a new command, this can be any arbitrary valid query based on the backend implementation (e.g. SQL Query for DAS RDB)
- * @param adHocQuery A new command to be executed (e.g SQL Query)
- * @param commandArguments Vector with arguments to be used by the command
- * @throws DASServiceException
- * @return
- */
- public DataObject execute(String adHocQuery, Vector commandArguments) throws DASServiceException;
-
- /**
- * Apply all changes on the graph back to the persistent repository.
- * This would save the changes on the SDO ChangeSummary back to the database
- * Note: Your SDO ojects should have been created with ChangeSummary support
- * @param graphRoot SDO Object with changes to be commited to persistent repository
- * @throws DASServiceException
- */
- public void applyChanges(DataObject graphRoot) throws DASServiceException;
-}
diff --git a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceClient.java b/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceClient.java deleted file mode 100644 index b23731df21..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceClient.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package das; - -import java.util.List; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import commonj.sdo.DataObject; - -public class DASServiceClient { - - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("dasservice.composite"); - DASService dasService = scaDomain.getService(DASService.class, "DASServiceComponent"); - - - dasService.configureService(DASServiceClient.class.getClassLoader().getResourceAsStream("company.xml")); - - DataObject root = dasService.executeCommand("all companies", null); - List companyList = root.getList("COMPANY"); - - for(int i=0; i<companyList.size(); i++){ - System.out.println(" ID:"+(((DataObject)companyList.get(i)).getInt("ID"))+ - " NAME:"+(((DataObject)companyList.get(i)).getString("NAME"))); - } - - } - -} diff --git a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceException.java b/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceException.java deleted file mode 100644 index e62201a4de..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceException.java +++ /dev/null @@ -1,37 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package das;
-
-public class DASServiceException extends Exception {
-
- private static final long serialVersionUID = -7514653215235902874L;
-
- public DASServiceException() {
- super();
- }
-
- public DASServiceException(String msg) {
- super(msg);
- }
-
- public DASServiceException(String msg, Throwable ex) {
- super(msg, ex);
- }
-
-}
diff --git a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceImpl.java b/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceImpl.java deleted file mode 100644 index 5b9beb21cb..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/java/das/DASServiceImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package das;
-
-import java.io.InputStream;
-import java.util.Vector;
-
-import org.apache.tuscany.das.rdb.Command;
-import org.apache.tuscany.das.rdb.DAS;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Scope;
-
-import commonj.sdo.DataObject;
-
-@Scope("COMPOSITE")
-public class DASServiceImpl implements DASService {
-
- private DAS das = null;
-
- /**
- * Initialize DAS
- * @return
- * @throws DASServiceException
- */
- private void initDAS(InputStream config) throws DASServiceException {
- if(config == null){
- throw new DASServiceException("Missing configuration information");
- }
-
- if(this.das != null){
- this.das.releaseResources();
- this.das = null;
- }
-
- this.das = DAS.FACTORY.createDAS(config);
- }
-
- @Destroy
- protected void destroyDAS() {
- if(das != null) {
- das.releaseResources();
- }
- }
-
- /**
- * Get a DAS instance based on the configuration
- * @return
- * @throws DASServiceException
- */
- private DAS getDAS() throws DASServiceException {
- if(this.das == null){
- throw new DASServiceException("DAS not initialized. Please provide DAS configuration torugh das.SetConfig");
- }
-
- return this.das;
- }
-
- /**
- * Set DAS configuration file to be used
- * @param configStream
- * @throws DASServiceException
- */
- public void configureService(InputStream configStream) throws DASServiceException{
- this.initDAS(configStream);
- }
-
-
-
- /**
- * Execute an existing command. The commands are defined in the DAS Configuration file being used by the service
- * @param commandName Command name as it appears on the DAS Configuration file
- * @param commandArguments Vector with arguments to be used by the command
- * @throws DASServiceException
- * @return
- */
- public DataObject executeCommand(String commandName, Vector commandArguments) throws DASServiceException{
- Command command = this.getDAS().getCommand(commandName);
-
- if(command == null){
- throw new DASServiceException("Invalid command: " + commandName);
- }
-
- //check if arguments was passed
- if(commandArguments != null && commandArguments.size() > 0){
- //we need to set the arguments
- int pos=0;
- for(Object argument : commandArguments){
- pos++;
- command.setParameter(pos, argument);
- }
- }
-
- DataObject root = command.executeQuery();
-
- return root;
- }
-
- /**
- * Execute a new command, this can be any arbitrary valid query based on the backend implementation (e.g. SQL Query for DAS RDB)
- * @param newCommand A new command to be executed (e.g SQL Query)
- * @param commandArguments Vector with arguments to be used by the command
- * @throws DASServiceException
- * @return
- */
- public DataObject execute(String adHocQuery, Vector commandArguments) throws DASServiceException {
- Command command = this.getDAS().createCommand(adHocQuery);
-
- if(command == null){
- throw new DASServiceException("Invalid command: " + adHocQuery);
- }
-
- //check if arguments was passed
- if(commandArguments != null && commandArguments.size() > 0){
- //we need to set the arguments
- int pos=0;
- for(Object argument : commandArguments){
- pos++;
- command.setParameter(pos, argument);
- }
- }
- DataObject root = command.executeQuery();
-
- return root;
- }
-
- /**
- * Apply all changes on the graph back to the persistent repository.
- * This would save the changes on the SDO ChangeSummary back to the database
- * Note: Your SDO ojects should have been created with ChangeSummary support
- * @throws DASServiceException
- * @param graphRoot SDO Object with changes to be commited to persistent repository
- */
- public void applyChanges(DataObject graphRoot) throws DASServiceException{
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/sandbox/lresende/sca/samples/company-das/src/main/resources/company.xml b/sandbox/lresende/sca/samples/company-das/src/main/resources/company.xml deleted file mode 100644 index 39935fe025..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/resources/company.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?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. - --> -<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"> - - <ConnectionInfo> - <ConnectionProperties - driverClass="org.apache.derby.jdbc.EmbeddedDriver" - databaseURL="jdbc:derby:target/company_db;create=true" - loginTimeout="600000"/> - </ConnectionInfo> - - - <Command name="all companies" SQL="select * from COMPANY" kind="Select"/> - - <Command name="all companies and departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/> - - <Command name="all departments for company" SQL="select * from COMPANY inner join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/> - - <Command name="company by id with departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/> - - - <Table tableName="COMPANY"> - <Column columnName="ID" primaryKey="true" generated="true"/> - </Table> - - <Table tableName="DEPARTMENT"> - <Column columnName="ID" primaryKey="true" generated="true"/> - </Table> - - <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true"> - <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/> - </Relationship> - - -</Config> diff --git a/sandbox/lresende/sca/samples/company-das/src/main/resources/dasservice.composite b/sandbox/lresende/sca/samples/company-das/src/main/resources/dasservice.composite deleted file mode 100644 index 06063184c9..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/resources/dasservice.composite +++ /dev/null @@ -1,29 +0,0 @@ -<?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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://das-service"
- xmlns:das-service="http://das-service"
- name="DASService">
-
- <component name="DASServiceComponent">
- <implementation.java class="das.DASServiceImpl"/>
- </component>
-
-</composite>
diff --git a/sandbox/lresende/sca/samples/company-das/src/main/resources/log4j.properties b/sandbox/lresende/sca/samples/company-das/src/main/resources/log4j.properties deleted file mode 100644 index ab4ebbb785..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/main/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE
\ No newline at end of file diff --git a/sandbox/lresende/sca/samples/company-das/src/test/java/das/DASServiceTestCase.java b/sandbox/lresende/sca/samples/company-das/src/test/java/das/DASServiceTestCase.java deleted file mode 100644 index b866336db6..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/test/java/das/DASServiceTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package das;
-
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-import commonj.sdo.DataObject;
-
-public class DASServiceTestCase extends TestCase {
-
- private SCADomain scaDomain;
- private DASService dasService;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("dasservice.composite");
- dasService = scaDomain.getService(DASService.class, "DASServiceComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- public void testDAS() throws Exception{
- dasService.configureService(getClass().getResourceAsStream("/company.xml"));
- DataObject root = dasService.executeCommand("all companies", null);
- List companyList = root.getList("COMPANY");
-
- assertNotNull(companyList);
- assertEquals(3,companyList.size());
- }
-}
diff --git a/sandbox/lresende/sca/samples/company-das/src/test/resources/company.xml b/sandbox/lresende/sca/samples/company-das/src/test/resources/company.xml deleted file mode 100644 index 43da819521..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/test/resources/company.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?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.
- -->
-<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
-
- <ConnectionInfo>
- <ConnectionProperties
- driverClass="org.apache.derby.jdbc.EmbeddedDriver"
- databaseURL="jdbc:derby:target/company_db;create=true"
- loginTimeout="600000"/>
- </ConnectionInfo>
-
-
- <Command name="all companies" SQL="select * from COMPANY" kind="Select"/>
-
- <Command name="all companies and departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/>
-
- <Command name="all departments for company" SQL="select * from COMPANY inner join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
-
- <Command name="company by id with departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
-
-
- <Table tableName="COMPANY">
- <Column columnName="ID" primaryKey="true" generated="true"/>
- </Table>
-
- <Table tableName="DEPARTMENT">
- <Column columnName="ID" primaryKey="true" generated="true"/>
- </Table>
-
- <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
- <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
- </Relationship>
-
-
-</Config>
diff --git a/sandbox/lresende/sca/samples/company-das/src/test/resources/log4j.properties b/sandbox/lresende/sca/samples/company-das/src/test/resources/log4j.properties deleted file mode 100644 index ab4ebbb785..0000000000 --- a/sandbox/lresende/sca/samples/company-das/src/test/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE
\ No newline at end of file |