Commit 2dd7f376 authored by Nicolas Dolet's avatar Nicolas Dolet

Merge the annotated and ws examples.

parent d53c65a7
============================================================================
OW2 FraSCAti - Helloworld with SCA Java Annotations
OW2 FraSCAti - Helloworld with SCA Java Annotations + Web Service bindings
Copyright (C) 2009 INRIA, USTL
This library is free software; you can redistribute it and/or
......@@ -21,10 +21,12 @@ Contact: frascati@ow2.org
Author: Nicolas Dolet
============================================================================
Helloworld with SCA Java Annotations:
-------------------------------------
Helloworld with SCA Java Annotations / Web Service bindings:
------------------------------------------------------------
This example shows how to use annotations on the helloworld-pojo example.
It also includes another composite: helloworld-ws that shows the usage of
the Web Service binding.
Compilation and packaging:
......@@ -36,4 +38,5 @@ To compile and create the library of this example with Ant Ivy:
ant jar
Run the example:
frascati run helloworld-annotated -libpath helloworld-annotations-<version>.jar -s r -m run
frascati run <composite-name> -libpath helloworld-annotations-<version>.jar -s r -m run
with <composite-name> = helloworld-wired or helloworld-ws
......@@ -21,7 +21,8 @@
<property name="src.dir" value="src" />
<property name="build.dir" value="target" />
<property name="composite.file" value="${src.dir}/main/resources/helloworld-annotated.composite"/>
<property name="composite.annotations.file" value="${src.dir}/main/resources/helloworld-annotated.composite"/>
<property name="composite.ws.file" value="${src.dir}/main/resources/helloworld-ws.composite"/>
<!-- ================================= -->
<!-- target: clean -->
......@@ -50,7 +51,8 @@
<!-- target: jar -->
<!-- ================================= -->
<target name="jar" depends="compile" description="--> create the jar for the example">
<copy todir="${build.dir}" file="${composite.file}" />
<copy todir="${build.dir}" file="${composite.annotations.file}" />
<copy todir="${build.dir}" file="${composite.ws.file}" />
<jar jarfile="${build.dir}/helloworld-annotations-0.6-SNAPSHOT.jar" >
<fileset dir="${build.dir}" />
</jar>
......
......@@ -65,7 +65,7 @@
<src>src/main/java</src>
<src>src/main/resources</src>
</srcs>
<composite>helloworld-annotated.composite</composite>
<composite>helloworld-wired.composite</composite>
</configuration>
</plugin>
</plugins>
......
......@@ -21,7 +21,7 @@
<!-- Contributor(s): Christophe Demarey -->
<!-- Nicolas Dolet -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-annotated">
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-wired">
<service name="r" promote="client/Runnable"/>
<component name="client">
......
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples: HelloWorld with Web Service bindings -->
<!-- OW2 FraSCAti Examples: HelloWorld with annotations and Web Service bindings -->
<!-- Copyright (C) 2009 INRIA, USTL -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
......@@ -19,20 +19,20 @@
<!-- Author: Nicolas Dolet -->
<!-- -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-annotated">
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-ws">
<service name="r" promote="client/Runnable"/>
<component name="client">
<implementation.java class="org.ow2.frascati.examples.helloworld.ws.Client"/>
<implementation.java class="org.ow2.frascati.examples.helloworld.annotated.Client"/>
<reference name="s">
<binding.ws uri="http://localhost:8080/Service" />
<binding.ws uri="http://localhost:8080/PrintService" />
</reference>
</component>
<component name="server">
<implementation.java class="org.ow2.frascati.examples.helloworld.ws.Server"/>
<implementation.java class="org.ow2.frascati.examples.helloworld.annotated.Server"/>
<service name="PrintService">
<binding.ws uri="http://localhost:8080/Service" />
<binding.ws uri="http://localhost:8080/PrintService" />
</service>
</component>
......
============================================================================
OW2 FraSCAti - Helloworld with Web Service bindings
Copyright (C) 2009 INRIA, USTL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: frascati@ow2.org
Author: Nicolas Dolet
============================================================================
Helloworld with Web Service bindings:
-------------------------------------
This example shows how to use web service bindings with the helloworld example.
SCA Java annotations are also used in this example (cf. helloworld-annotated).
Compilation and packaging:
--------------------------
To compile and create the library of this example with Maven:
mvn
Run the example:
frascati run helloworld-ws -libpath helloworld-ws-<version>.jar -s r -m run
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld with Web Service bindings
*
* Copyright (c) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Nicolas Dolet
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-ws</artifactId>
<version>0.6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Helloworld Web Service</name>
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>${java.specification.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.ow2.frascati.factory</groupId>
<artifactId>frascati-factory-plugin</artifactId>
<version>0.6-SNAPSHOT</version>
<executions>
<execution>
<id>generate-factory</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<factory>GenerateFactory</factory>
<srcs>
<src>src/main/java</src>
<src>src/main/resources</src>
</srcs>
<composite>helloworld-ws.composite</composite>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>apache-incubating</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>1.2.1-incubating</version>
</dependency>
</dependencies>
</project>
/***
* OW2 FraSCAti Examples: HelloWorld with Web Service bindings
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicolas Dolet
*/
package org.ow2.frascati.examples.helloworld.ws;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
/** A print service client. */
@Service(Runnable.class)
public class Client
implements Runnable {
@Reference(required = true)
protected PrintService s;
/** Default constructor. */
public Client() {
System.out.println("CLIENT created.");
}
/** Run the client. */
public void run() {
s.print("Hello World!");
}
}
/***
* OW2 FraSCAti Examples: HelloWorld with Web Service bindings
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicolas Dolet
*/
package org.ow2.frascati.examples.helloworld.ws;
import org.osoa.sca.annotations.Service;
/**
* A basic service used to print messages.
*/
@Service
public interface PrintService {
void print(String msg);
}
/***
* OW2 FraSCAti Examples: HelloWorld with Web Service bindings
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicolas Dolet
*/
package org.ow2.frascati.examples.helloworld.ws;
import org.osoa.sca.annotations.Property;
/** The print service implementation. */
public class Server implements PrintService {
@Property
protected String header = "->";
private int count = 1;
/** Default constructor. */
public Server() {
System.out.println("SERVER created.");
}
/** PrintService implementation. */
public void print(final String msg) {
System.out.println("SERVER: begin printing...");
for (int i = 0; i < count; ++i) {
System.out.println(header + msg);
}
System.out.println("SERVER: print done.");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment