From 8eb5bf1de6c82c6d6e2932630be767aaa086a2b8 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 13 Jan 2010 01:41:11 +0000 Subject: Cleaning up sandbox git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@898602 13f79535-47bb-0310-9956-ffa450edef68 --- .../lresende/backup/company-das-webapp/build.xml | 55 ++++++ .../lresende/backup/company-das-webapp/company.sql | 40 +++++ sandbox/lresende/backup/company-das-webapp/pom.xml | 138 ++++++++++++++ .../lresende/backup/company-das-webapp/readme.html | 199 +++++++++++++++++++++ .../src/main/java/das/DASService.java | 61 +++++++ .../src/main/java/das/DASServiceException.java | 37 ++++ .../src/main/java/das/DASServiceImpl.java | 146 +++++++++++++++ .../src/main/resources/company.xml | 46 +++++ .../src/main/resources/dasservice.composite | 29 +++ .../src/main/resources/log4j.properties | 29 +++ .../company-das-webapp/src/main/webapp/Company.jsp | 97 ++++++++++ .../src/main/webapp/META-INF/context.xml | 25 +++ .../src/main/webapp/META-INF/sca-contribution.xml | 25 +++ .../src/main/webapp/WEB-INF/web.xml | 35 ++++ .../sca/samples/company-das-webapp/build.xml | 55 ------ .../sca/samples/company-das-webapp/company.sql | 40 ----- .../sca/samples/company-das-webapp/pom.xml | 138 -------------- .../sca/samples/company-das-webapp/readme.html | 199 --------------------- .../src/main/java/das/DASService.java | 61 ------- .../src/main/java/das/DASServiceException.java | 37 ---- .../src/main/java/das/DASServiceImpl.java | 146 --------------- .../src/main/resources/company.xml | 46 ----- .../src/main/resources/dasservice.composite | 29 --- .../src/main/resources/log4j.properties | 29 --- .../company-das-webapp/src/main/webapp/Company.jsp | 97 ---------- .../src/main/webapp/META-INF/context.xml | 25 --- .../src/main/webapp/META-INF/sca-contribution.xml | 25 --- .../src/main/webapp/WEB-INF/web.xml | 35 ---- 28 files changed, 962 insertions(+), 962 deletions(-) create mode 100644 sandbox/lresende/backup/company-das-webapp/build.xml create mode 100644 sandbox/lresende/backup/company-das-webapp/company.sql create mode 100644 sandbox/lresende/backup/company-das-webapp/pom.xml create mode 100644 sandbox/lresende/backup/company-das-webapp/readme.html create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASService.java create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceException.java create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceImpl.java create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/resources/company.xml create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/resources/dasservice.composite create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/resources/log4j.properties create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/webapp/Company.jsp create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/context.xml create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 sandbox/lresende/backup/company-das-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/build.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/company.sql delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/pom.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/readme.html delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASService.java delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASServiceException.java delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASServiceImpl.java delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/company.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/dasservice.composite delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/log4j.properties delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/Company.jsp delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/context.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/WEB-INF/web.xml (limited to 'sandbox/lresende') diff --git a/sandbox/lresende/backup/company-das-webapp/build.xml b/sandbox/lresende/backup/company-das-webapp/build.xml new file mode 100644 index 0000000000..feef76481b --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/build.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/company.sql b/sandbox/lresende/backup/company-das-webapp/company.sql new file mode 100644 index 0000000000..8fb5c2d4cd --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/company.sql @@ -0,0 +1,40 @@ +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/backup/company-das-webapp/pom.xml b/sandbox/lresende/backup/company-das-webapp/pom.xml new file mode 100644 index 0000000000..12838b6565 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.1-incubating-SNAPSHOT + ../pom.xml + + + sample-company-das-webapp + Apache Tuscany SCA Company Sample Web Client + war + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 1.2-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.2-incubating-SNAPSHOT + runtime + + + + + org.apache.tuscany.das + tuscany-das-rdb + 1.0-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubating-SNAPSHOT + compile + + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + src/main/java + + + src/main/java + + + src/main/resources + + + + + + org.codehaus.mojo + sql-maven-plugin + + 1.1-SNAPSHOT + + + + org.apache.derby + derby + 10.1.2.1 + + + + + + create-db + generate-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/company_db;create=true + true + continue + skip + ; + + ${pom.basedir}/company.sql + + + + + + + shutdown-database-sothat-test-can-run + process-test-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/company_db;shutdown=true + true + + + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/readme.html b/sandbox/lresende/backup/company-das-webapp/readme.html new file mode 100644 index 0000000000..65a50de320 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/readme.html @@ -0,0 +1,199 @@ + + + + + +Tuscany RDB DAS Service client + + + + + + + + + + +

Tuscany RDB DAS Service client

+ + +

Introduction

+ +

+This stand-alone sample application demonstrate how to consume the DAS Service exposed trough an SCA service.
+The application starts with a canned database of Companies and their related Departments.
+Through the web page interface, a user can consume the DAS Service to display the list of available companies.
+The sample runs on Tomcat 5.5 and employs a Derby database accessed via a DataSource. +

+ + + + + +

Running the sample

+ +

There are two options for running this sample:

+ +
    +
  1. Run from Tomcat configured by the build
  2. +
  3. Deploying the DASService.client WAR into a Tomcat you configure yourself
  4. +
+ + +

Running from Tomcat configured by the build

+ +

+This sample application is deployed (along with the canned test database) to an instance of Tomcat as part of our automated sample +testing.This means you can run the java/samples/testing/tomcat build (see java/das/samples/testing/tomcat/readme.htm ) and then access +the application by pointing your browser to http://localhost:8080/companyweb-service-client/ +

+ + + +

Deploying the DASService.client WAR into a Tomcat you configure yourself

+ +

+Alternatively, you can deploy the sample to your own configured Tomcat installation by following the instructions below. +These instructions assume that you have either 1) downloaded the Tuscany sample distribution or 2) Downloaded the Tuscany +source and run our maven build, see the following link to more details steps on how to build DAS Sample applications http://incubator.apache.org/tuscany/java_das_overview.html. +

+ +

Set Up:

+ + +
    +
  1. Download and install the most recent stable version of Tomcat 5.5. You can find it here: http://tomcat.apache.org/download-55.cgi
  2. +
  3. Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. + The only file you’ll need from this download is derby.jar
  4. +
  5. Stop Tomcat
  6. +
  7. Copy derby.jar (from the derby distribution) to {Tomcat_Home}/common/lib:
  8. +
  9. Add the sample war file to {Tomcat_Home}/webapps
  10. +
      +
    1. sample-das-service-client-xxx.war (e.g.sample-das-service-client-1.0-incubator-SNAPSHOT.war)
    2. +
    +
  11. Install the canned Derby database to Tomcat:
  12. +
      +
    1. First, create a new directory named “Databases” to hold the sample database. Create {Tomcat_Home}/Databases
    2. +
    3. Copy the dastest folder (and all its contents) from {build directory root OR + where samples where unzipped}/java/das/samples/DASService.client to {Tomcat_Home}/Databases.
      +
      + NOTE: If you are running this from a sample distribution, the canned database is available in the + distribution, inside the databases directory.
    4. +
    +
  13. Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
  14. +
      +
    1. Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it: +

      +

      +
      +         <!-- Global Datasource for Derby dastest database -->
      +         <Resource name="jdbc/dastest"
      +              type="javax.sql.DataSource"  auth="Container"
      +              description="Derby database for DAS Company sample"
      +              maxActive="100" maxIdle="30" maxWait="10000"
      +              username="" password=""
      +              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
      +              url="jdbc:derby:{absolute path}Databases/dastest"/>
      +      
      +
      +

      +

      Requirement:You must include the absolute path to the “Databases” directory in the above url attribute. Fore example:

      +

      	url="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"

      +
    2. +
    +
  15. Start tomcat and point your browser to: http://localhost:8080/sample-das-service-client-{version + tag}/. Example:

    +

    	http://localhost:8080/sample-das-service-client-1.0-incubator-SNAPSHOT/

    + +
  16. + +
+ + + + +

Sample Architecture

+ +

This is a simple, single-page, web application to consume DAS exposed as an SCA service.

+

The main components of this application are:

+ + + + +

The Company.jsp directly invoke the DAS Service to get a list of companies available and then iterate trough the SDO data graphs and manipulate SDO directly to display data

+ +

The canned Derby database comes preloaded with Companies and related Departments. The Derby database instance is a simple file folder.

+ +

The SCA DAS Service accepts directives (commands) and reads and writes to the derby database instance appropriately using DAS as the service implementation.

+ + + +

Consuming the DAS service

+ +

First, note that the application have dependencies on the DAS Service:

+ + +

+

+
+<!-- DAS Service -->
+<dependency>
+   <groupId>org.apache.tuscany.das.samples</groupId>
+   <artifactId>sample-das-service</artifactId>
+   <version>${pom.version}</version>
+</dependency>
+
+
+

+ +
+

And the SCDL references the service:

+ +

+

+
+<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>
+
+
+

+ + + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASService.java b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASService.java new file mode 100644 index 0000000000..0387341b87 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASService.java @@ -0,0 +1,61 @@ +/* + * 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/backup/company-das-webapp/src/main/java/das/DASServiceException.java b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceException.java new file mode 100644 index 0000000000..e62201a4de --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceException.java @@ -0,0 +1,37 @@ +/* + * 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/backup/company-das-webapp/src/main/java/das/DASServiceImpl.java b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceImpl.java new file mode 100644 index 0000000000..a0dd38601a --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/java/das/DASServiceImpl.java @@ -0,0 +1,146 @@ +/* + * 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.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); + } + + /** + * 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/backup/company-das-webapp/src/main/resources/company.xml b/sandbox/lresende/backup/company-das-webapp/src/main/resources/company.xml new file mode 100644 index 0000000000..9d0d8e944c --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/resources/company.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/resources/dasservice.composite b/sandbox/lresende/backup/company-das-webapp/src/main/resources/dasservice.composite new file mode 100644 index 0000000000..6530e68050 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/resources/dasservice.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/resources/log4j.properties b/sandbox/lresende/backup/company-das-webapp/src/main/resources/log4j.properties new file mode 100644 index 0000000000..c5c2868aaa --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/resources/log4j.properties @@ -0,0 +1,29 @@ +# 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, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.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/backup/company-das-webapp/src/main/webapp/Company.jsp b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/Company.jsp new file mode 100644 index 0000000000..67d7ead499 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/Company.jsp @@ -0,0 +1,97 @@ + + + +<%@ page import="java.util.*" %> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> + +<%@ page import="commonj.sdo.*" %> +<%@ page import="das.*" %> + + + +<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> +<% + + SCADomain domain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + if (domain == null) { + System.out.println("domain == NULL"); + } + + + DASService dasService = domain.getService(DASService.class, "DASServiceComponent"); + + if (dasService == null) { + System.out.println("DASService == NULL"); + } + + List companyList = null; + + try{ + dasService.configureService(this.getClass().getClassLoader().getResourceAsStream("company.xml")); + DataObject root = dasService.executeCommand("all companies", null); + companyList = root.getList("COMPANY"); + if(companyList == null) { + System.out.println("::NULL::"); + } + }catch(Exception e){ + //TODO: handle case where dasService can't be initiated properly + e.printStackTrace(); + } + +%> + + +DASService Client Test + + + +

Tuscany DAS Service WEB Client Application Example

+ + + + + + + + + + + + <% + java.util.Iterator i = companyList.iterator(); + while (i.hasNext()) { + DataObject company = (DataObject)i.next(); + %> + + + + + <% + } + %> + +
IDName
<%=company.getInt("ID")%><%=company.getString("NAME")%>
+ + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/context.xml b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..0e90eb0a83 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/context.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..25849fa6b9 --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/sandbox/lresende/backup/company-das-webapp/src/main/webapp/WEB-INF/web.xml b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..67a782269e --- /dev/null +++ b/sandbox/lresende/backup/company-das-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + + + Tuscany DAS Service Client Application + + + org.apache.tuscany.sca.host.webapp.TuscanyContextListener + + + + Company.jsp + + + diff --git a/sandbox/lresende/sca/samples/company-das-webapp/build.xml b/sandbox/lresende/sca/samples/company-das-webapp/build.xml deleted file mode 100644 index feef76481b..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/build.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/company.sql b/sandbox/lresende/sca/samples/company-das-webapp/company.sql deleted file mode 100644 index 8fb5c2d4cd..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/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-webapp/pom.xml b/sandbox/lresende/sca/samples/company-das-webapp/pom.xml deleted file mode 100644 index 12838b6565..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.1-incubating-SNAPSHOT - ../pom.xml - - - sample-company-das-webapp - Apache Tuscany SCA Company Sample Web Client - war - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 1.2-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.2-incubating-SNAPSHOT - runtime - - - - - org.apache.tuscany.das - tuscany-das-rdb - 1.0-incubating-SNAPSHOT - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.0-incubating-SNAPSHOT - compile - - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - src/main/java - - - src/main/java - - - src/main/resources - - - - - - org.codehaus.mojo - sql-maven-plugin - - 1.1-SNAPSHOT - - - - org.apache.derby - derby - 10.1.2.1 - - - - - - create-db - generate-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/company_db;create=true - true - continue - skip - ; - - ${pom.basedir}/company.sql - - - - - - - shutdown-database-sothat-test-can-run - process-test-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/company_db;shutdown=true - true - - - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/readme.html b/sandbox/lresende/sca/samples/company-das-webapp/readme.html deleted file mode 100644 index 65a50de320..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/readme.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - -Tuscany RDB DAS Service client - - - - - - - - - - -

Tuscany RDB DAS Service client

- - -

Introduction

- -

-This stand-alone sample application demonstrate how to consume the DAS Service exposed trough an SCA service.
-The application starts with a canned database of Companies and their related Departments.
-Through the web page interface, a user can consume the DAS Service to display the list of available companies.
-The sample runs on Tomcat 5.5 and employs a Derby database accessed via a DataSource. -

- - - - - -

Running the sample

- -

There are two options for running this sample:

- -
    -
  1. Run from Tomcat configured by the build
  2. -
  3. Deploying the DASService.client WAR into a Tomcat you configure yourself
  4. -
- - -

Running from Tomcat configured by the build

- -

-This sample application is deployed (along with the canned test database) to an instance of Tomcat as part of our automated sample -testing.This means you can run the java/samples/testing/tomcat build (see java/das/samples/testing/tomcat/readme.htm ) and then access -the application by pointing your browser to http://localhost:8080/companyweb-service-client/ -

- - - -

Deploying the DASService.client WAR into a Tomcat you configure yourself

- -

-Alternatively, you can deploy the sample to your own configured Tomcat installation by following the instructions below. -These instructions assume that you have either 1) downloaded the Tuscany sample distribution or 2) Downloaded the Tuscany -source and run our maven build, see the following link to more details steps on how to build DAS Sample applications http://incubator.apache.org/tuscany/java_das_overview.html. -

- -

Set Up:

- - -
    -
  1. Download and install the most recent stable version of Tomcat 5.5. You can find it here: http://tomcat.apache.org/download-55.cgi
  2. -
  3. Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. - The only file you’ll need from this download is derby.jar
  4. -
  5. Stop Tomcat
  6. -
  7. Copy derby.jar (from the derby distribution) to {Tomcat_Home}/common/lib:
  8. -
  9. Add the sample war file to {Tomcat_Home}/webapps
  10. -
      -
    1. sample-das-service-client-xxx.war (e.g.sample-das-service-client-1.0-incubator-SNAPSHOT.war)
    2. -
    -
  11. Install the canned Derby database to Tomcat:
  12. -
      -
    1. First, create a new directory named “Databases” to hold the sample database. Create {Tomcat_Home}/Databases
    2. -
    3. Copy the dastest folder (and all its contents) from {build directory root OR - where samples where unzipped}/java/das/samples/DASService.client to {Tomcat_Home}/Databases.
      -
      - NOTE: If you are running this from a sample distribution, the canned database is available in the - distribution, inside the databases directory.
    4. -
    -
  13. Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
  14. -
      -
    1. Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it: -

      -

      -
      -         <!-- Global Datasource for Derby dastest database -->
      -         <Resource name="jdbc/dastest"
      -              type="javax.sql.DataSource"  auth="Container"
      -              description="Derby database for DAS Company sample"
      -              maxActive="100" maxIdle="30" maxWait="10000"
      -              username="" password=""
      -              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
      -              url="jdbc:derby:{absolute path}Databases/dastest"/>
      -      
      -
      -

      -

      Requirement:You must include the absolute path to the “Databases” directory in the above url attribute. Fore example:

      -

      	url="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"

      -
    2. -
    -
  15. Start tomcat and point your browser to: http://localhost:8080/sample-das-service-client-{version - tag}/. Example:

    -

    	http://localhost:8080/sample-das-service-client-1.0-incubator-SNAPSHOT/

    - -
  16. - -
- - - - -

Sample Architecture

- -

This is a simple, single-page, web application to consume DAS exposed as an SCA service.

-

The main components of this application are:

- - - - -

The Company.jsp directly invoke the DAS Service to get a list of companies available and then iterate trough the SDO data graphs and manipulate SDO directly to display data

- -

The canned Derby database comes preloaded with Companies and related Departments. The Derby database instance is a simple file folder.

- -

The SCA DAS Service accepts directives (commands) and reads and writes to the derby database instance appropriately using DAS as the service implementation.

- - - -

Consuming the DAS service

- -

First, note that the application have dependencies on the DAS Service:

- - -

-

-
-<!-- DAS Service -->
-<dependency>
-   <groupId>org.apache.tuscany.das.samples</groupId>
-   <artifactId>sample-das-service</artifactId>
-   <version>${pom.version}</version>
-</dependency>
-
-
-

- -
-

And the SCDL references the service:

- -

-

-
-<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>
-
-
-

- - - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASService.java b/sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASService.java deleted file mode 100644 index 0387341b87..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/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-webapp/src/main/java/das/DASServiceException.java b/sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASServiceException.java deleted file mode 100644 index e62201a4de..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/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-webapp/src/main/java/das/DASServiceImpl.java b/sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASServiceImpl.java deleted file mode 100644 index a0dd38601a..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/java/das/DASServiceImpl.java +++ /dev/null @@ -1,146 +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.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); - } - - /** - * 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-webapp/src/main/resources/company.xml b/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/company.xml deleted file mode 100644 index 9d0d8e944c..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/company.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/dasservice.composite b/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/dasservice.composite deleted file mode 100644 index 6530e68050..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/dasservice.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/log4j.properties b/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/log4j.properties deleted file mode 100644 index c5c2868aaa..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/resources/log4j.properties +++ /dev/null @@ -1,29 +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, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.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-webapp/src/main/webapp/Company.jsp b/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/Company.jsp deleted file mode 100644 index 67d7ead499..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/Company.jsp +++ /dev/null @@ -1,97 +0,0 @@ - - - -<%@ page import="java.util.*" %> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> - -<%@ page import="commonj.sdo.*" %> -<%@ page import="das.*" %> - - - -<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> -<% - - SCADomain domain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - if (domain == null) { - System.out.println("domain == NULL"); - } - - - DASService dasService = domain.getService(DASService.class, "DASServiceComponent"); - - if (dasService == null) { - System.out.println("DASService == NULL"); - } - - List companyList = null; - - try{ - dasService.configureService(this.getClass().getClassLoader().getResourceAsStream("company.xml")); - DataObject root = dasService.executeCommand("all companies", null); - companyList = root.getList("COMPANY"); - if(companyList == null) { - System.out.println("::NULL::"); - } - }catch(Exception e){ - //TODO: handle case where dasService can't be initiated properly - e.printStackTrace(); - } - -%> - - -DASService Client Test - - - -

Tuscany DAS Service WEB Client Application Example

- - - - - - - - - - - - <% - java.util.Iterator i = companyList.iterator(); - while (i.hasNext()) { - DataObject company = (DataObject)i.next(); - %> - - - - - <% - } - %> - -
IDName
<%=company.getInt("ID")%><%=company.getString("NAME")%>
- - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/context.xml b/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 0e90eb0a83..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 25849fa6b9..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/WEB-INF/web.xml b/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 67a782269e..0000000000 --- a/sandbox/lresende/sca/samples/company-das-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - Tuscany DAS Service Client Application - - - org.apache.tuscany.sca.host.webapp.TuscanyContextListener - - - - Company.jsp - - - -- cgit v1.2.3