You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/05/09 21:35:46 UTC
svn commit: r536626 - in
/incubator/tuscany/java/sca/samples/implementation-crud: README build.xml
implementation-crud.png implementation-crud.svg
src/test/java/crud/CRUDClient.java
Author: slaws
Date: Wed May 9 12:35:45 2007
New Revision: 536626
URL: http://svn.apache.org/viewvc?view=rev&rev=536626
Log:
add ant build and test and readme material
Added:
incubator/tuscany/java/sca/samples/implementation-crud/README (with props)
incubator/tuscany/java/sca/samples/implementation-crud/build.xml (with props)
incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.png (with props)
incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg (with props)
incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java (with props)
Added: incubator/tuscany/java/sca/samples/implementation-crud/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/README?view=auto&rev=536626
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/README (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud/README Wed May 9 12:35:45 2007
@@ -0,0 +1,92 @@
+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.
+
+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 for this sample
+ test/
+ java/
+ crud/
+ CRUDClient.java - used when Ant is running the sample
+ implementation-crud.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+TBD - more detail required on how this sample adds a new implementation to SCA
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-crud
+ant
+
+You should see the following output from the run target.
+
+run:
+ [java] Starting CRUDServiceComponent
+ [java] create(ABC) in tmp
+ [java] retrieve(0)
+ [java] Result from create: ABC
+ [java] update(0)
+ [java] retrieve(0)
+ [java] Result from update: EFG
+ [java] delete(0)
+ [java] retrieve(0)
+ [java] Result from delete: null
+ [java] Stopping CRUDServiceComponent
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd implementation-crud
+mvn
+
+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.
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/README
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/README
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/tuscany/java/sca/samples/implementation-crud/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/build.xml?view=auto&rev=536626
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/build.xml (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud/build.xml Wed May 9 12:35:45 2007
@@ -0,0 +1,66 @@
+<!--
+ * 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-calculator" default="run">
+ <property environment="env"/>
+
+ <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>
+ <javac srcdir="src/test/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <exclude name="crud/CRUDTestCase.java"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ </target>
+
+ <target name="run" depends="compile">
+ <java classname="crud.CRUDClient"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.png
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.png?view=auto&rev=536626
==============================================================================
Binary file - no diff available.
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg?view=auto&rev=536626
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg Wed May 9 12:35:45 2007
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud"
+ sodipodi:docname="implementation-crud.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud\implementation-crud.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="528.85714"
+ inkscape:cy="406.01174"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1142"
+ inkscape:window-height="722"
+ inkscape:window-x="107"
+ inkscape:window-y="128" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.038749,0,0,1.009461,-29.25616,-1.807024)">
+ <rect
+ rx="8.7034655"
+ ry="12.692303"
+ y="192.00233"
+ x="375.89822"
+ height="299.99988"
+ width="281.85843"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95312572;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(104.5213,-10.61387)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">crud</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="450.63062"
+ y="302.8819"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.0398,96.94336)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">CRUDService</flowPara><flowPara
+ id="flowPara1894">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.4801,334.72889 L 466.81514,334.72889 L 472.87605,347.86087 L 465.80499,359.98271 L 433.4801,359.98271 L 441.05625,347.86087 L 433.4801,334.72889 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1904"
+ transform="translate(158.2681,129.761)"><flowRegion
+ id="flowRegion1906"><rect
+ id="rect1908"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1912"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">CRUD</flowPara></flowRoot> </g>
+</svg>
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/implementation-crud.svg
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java?view=auto&rev=536626
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java Wed May 9 12:35:45 2007
@@ -0,0 +1,52 @@
+/*
+ * 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 crud;
+
+import org.apache.tuscany.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CRUDClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("crud.composite");
+ CRUD crudService = domain.getService(CRUD.class, "CRUDServiceComponent");
+
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ System.out.println("Result from create: " + result);
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ System.out.println("Result from update: " + result);
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ if (result == null) {
+ System.out.println("Result from delete: null");
+ } else {
+ System.out.println("Result from delete: should be null but was " + result);
+ }
+
+ domain.close();
+
+ }
+
+}
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDClient.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org