Commit a6aac014 authored by Nicolas Dolet's avatar Nicolas Dolet
Browse files

Update examples:

 - unify Maven artifacts
 - update/add READMEs
 - simplify composite sources
 - add Java APIs for components
 - use the generic launcher from factory-tools
 - typos
parent 96d0092d
============================================================================
OW2 FraSCAti Examples: Dictionary
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
============================================================================
Dictionary Web Service Client:
------------------------------
This example shows how to build an SCA client using a dictionary web service
already available over the Internet.
Compilation with Maven:
-----------------------
mvn install
Execution with Maven:
---------------------
mvn -Prun
Compilation and execution with the FraSCAti scripts:
----------------------------------------------------
frascati wsdl2java -f src/main/wsdl/DictService.wsdl -o src/main/java
frascati compile src dictionary
frascati run dictionary -libpath dictionary.jar -s Dictionary -m definition -p computer
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
* Contact: frascati@ow2.org * Contact: frascati@ow2.org
* *
* Author: Nicolas Dolet * Author: Nicolas Dolet
*
* Contributor(s): Philippe Merle
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...@@ -32,7 +35,7 @@ ...@@ -32,7 +35,7 @@
<version>0.6-SNAPSHOT</version> <version>0.6-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Dictionary</name> <name>OW2 FraSCAti Examples: Dictionary</name>
<parent> <parent>
<groupId>org.ow2.frascati.examples</groupId> <groupId>org.ow2.frascati.examples</groupId>
...@@ -42,6 +45,10 @@ ...@@ -42,6 +45,10 @@
<properties> <properties>
<wsdl.file>DictService.wsdl</wsdl.file> <wsdl.file>DictService.wsdl</wsdl.file>
<composite.file>dictionary</composite.file>
<service.name>Dictionary</service.name>
<method.name>definition</method.name>
<method.params>computer</method.params>
</properties> </properties>
<build> <build>
...@@ -54,4 +61,12 @@ ...@@ -54,4 +61,12 @@
</plugins> </plugins>
</build> </build>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.factory</groupId>
<artifactId>frascati-factory-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project> </project>
/***
* OW2 FraSCAti Examples: Dictionary
* 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
*
* Contributor(s): Philippe Merle
*/
package org.ow2.frascati.examples.dictionary.api;
import org.osoa.sca.annotations.Service;
/**
* Interface for a dictionary service.
*/
@Service
public interface Dictionary {
public String definition(String word);
}
/*** /***
* OW2 FraSCAti Assembly Factory Examples: Dictionary * OW2 FraSCAti Examples: Dictionary
* Copyright (C) 2009 INRIA, USTL * Copyright (C) 2009 INRIA, USTL
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -16,17 +16,20 @@ ...@@ -16,17 +16,20 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Contact: frascati@ow2.org
*
* Author: Nicolas Dolet * Author: Nicolas Dolet
*
* Contributor(s): Philippe Merle
*/ */
package org.ow2.frascati.examples.dictionary; package org.ow2.frascati.examples.dictionary.lib;
import java.io.BufferedReader; import java.io.StringWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator; import java.util.Iterator;
import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Reference;
import org.ow2.frascati.examples.dictionary.api.Dictionary;
import com.aonaware.services.webservices.Definition; import com.aonaware.services.webservices.Definition;
import com.aonaware.services.webservices.DictServiceSoap; import com.aonaware.services.webservices.DictServiceSoap;
...@@ -34,28 +37,26 @@ import com.aonaware.services.webservices.DictServiceSoap; ...@@ -34,28 +37,26 @@ import com.aonaware.services.webservices.DictServiceSoap;
/** /**
* SCA Java Component implementation using a dictionary web service * SCA Java Component implementation using a dictionary web service
*/ */
public class Client
public class Client implements Runnable { implements Dictionary {
@Reference @Reference
protected DictServiceSoap dict; protected DictServiceSoap dict;
public void run() { // --------------------------------------------------------------------------
BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); // Implementation of the Dictionary interface
System.out.print("Enter a word: "); // --------------------------------------------------------------------------
try { public String definition(String word) {
String word = input.readLine(); Iterator<Definition> it = dict.define(word).getDefinitions()
Iterator<Definition> it = dict.define(word).getDefinitions().getDefinition().iterator(); .getDefinition().iterator();
int count = 1; int count = 1;
while(it.hasNext()) { StringWriter writer = new StringWriter();
while (it.hasNext()) {
Definition def = it.next(); Definition def = it.next();
System.out.println("Definition " + count + ":"); writer.write("Definition " + count + ":");
System.out.println(def.getWordDefinition()); writer.write(def.getWordDefinition());
count++; count++;
} }
} catch (IOException e) { return writer.toString();
System.err.println("Can't read input data!");
e.printStackTrace();
}
} }
} }
<?xml version="1.0" encoding="ISO-8859-15"?> <?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples: Dictionary --> <!-- OW2 FraSCAti Examples: Dictionary -->
<!-- Copyright (C) 2009 INRIA, USTL --> <!-- Copyright (C) 2009 INRIA, USTL -->
<!-- --> <!-- -->
...@@ -17,25 +16,22 @@ ...@@ -17,25 +16,22 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Nicolas Dolet --> <!-- Author: Nicolas Dolet -->
<!-- -->
<!-- Contributor(s): Philippe Merle -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="dictionary" <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="dictionary"
targetNamespace="http://frascati.ow2.org/dictionary"> targetNamespace="http://frascati.ow2.org/dictionary">
<service name="r" promote="client/r"> <service name="Dictionary" promote="client/Dictionary"/>
<interface.java interface="java.lang.Runnable" />
</service>
<component name="client"> <component name="client">
<implementation.java class="org.ow2.frascati.examples.dictionary.Client" /> <implementation.java class="org.ow2.frascati.examples.dictionary.lib.Client" />
<service name="r">
<interface.java interface="java.lang.Runnable" />
</service>
<reference name="dict"> <reference name="dict">
<interface.java interface="com.aonaware.services.webservices.DictServiceSoap" />
<binding.ws wsdlElement="http://services.aonaware.com/DictService#wsdl.port(DictService/DictServiceSoap)" /> <binding.ws wsdlElement="http://services.aonaware.com/DictService#wsdl.port(DictService/DictServiceSoap)" />
</reference> </reference>
......
...@@ -29,14 +29,17 @@ It also includes another composite: helloworld-ws that shows the usage of ...@@ -29,14 +29,17 @@ It also includes another composite: helloworld-ws that shows the usage of
the Web Service binding. the Web Service binding.
Compilation and packaging: Compilation with Maven:
-------------------------- -----------------------
To compile and create the library of this example with Maven: mvn install
mvn compile jar:jar
Execution with Maven:
To compile and create the library of this example with Ant Ivy: ---------------------
ant jar mvn -Prun
edit the pom.xml descriptor to change the composite name
Run the example:
frascati run <composite-name> -libpath helloworld-annotations-<version>.jar -s r -m run Compilation and execution with the FraSCAti scripts:
----------------------------------------------------
frascati compile src helloworld-annotations
frascati run <composite-name> -libpath helloworld-annotations.jar -s r -m run
with <composite-name> = helloworld-wired or helloworld-ws with <composite-name> = helloworld-wired or helloworld-ws
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Nicolas Dolet --> <!-- Author: Nicolas Dolet -->
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="helloworld-annotated" default="jar"> <project xmlns:ivy="antlib:org.apache.ivy.ant" name="helloworld-annotated" default="jar">
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Nicolas Dolet --> <!-- Author: Nicolas Dolet -->
<ivy-module version="2.0"> <ivy-module version="2.0">
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* Contact: frascati@ow2.org * Contact: frascati@ow2.org
* *
* Author: Nicolas Dolet * Author: Nicolas Dolet
*
* Contributor(s): Philippe Merle
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
<version>0.6-SNAPSHOT</version> <version>0.6-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Helloworld annotated</name> <name>OW2 FraSCAti Examples: Helloworld annotated</name>
<parent> <parent>
<groupId>org.ow2.frascati.examples</groupId> <groupId>org.ow2.frascati.examples</groupId>
...@@ -40,4 +42,19 @@ ...@@ -40,4 +42,19 @@
<version>0.6-SNAPSHOT</version> <version>0.6-SNAPSHOT</version>
</parent> </parent>
<properties>
<composite.file>helloworld-wired</composite.file>
<service.name>r</service.name>
<method.name>run</method.name>
<method.params>' '</method.params>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.factory</groupId>
<artifactId>frascati-factory-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project> </project>
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Damien Fournier --> <!-- Author: Damien Fournier -->
<!-- --> <!-- -->
<!-- Contributor(s): Christophe Demarey --> <!-- Contributor(s): Christophe Demarey -->
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Nicolas Dolet --> <!-- Author: Nicolas Dolet -->
<!-- --> <!-- -->
......
============================================================================
OW2 FraSCAti Examples: HelloWorld POJO
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 POJO example:
------------------------
This example shows how to build an SCA application with two POJOs: a client POJO
and a server POJO. The client is bound to the server and running the client lead
to call the PrintService SCA service offered by the server.
Compilation with Maven:
-----------------------
mvn install
Execution with Maven:
---------------------
mvn -Prun
Compilation and execution with the FraSCAti scripts:
----------------------------------------------------
frascati compile src helloworld-pojo
frascati run helloworld-pojo -libpath helloworld-pojo.jar -s r -m run
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Christophe Demarey --> <!-- Author: Christophe Demarey -->
<!-- -->
<!-- Contributor(s): Nicolas Dolet -->
<project name="helloworld-pojo" default="dist" basedir="."> <project name="helloworld-pojo" default="dist" basedir=".">
<description> <description>
......
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld POJO
*
* 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
*
* Contributor(s):
-->
<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-pojo</artifactId>
<version>0.6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>OW2 FraSCAti Examples: Helloworld POJO</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>parent</artifactId>
<version>0.6-SNAPSHOT</version>
</parent>
<properties>
<composite.file>helloworld-pojo</composite.file>
<service.name>r</service.name>
<method.name>run</method.name>
<method.params>' '</method.params>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.factory</groupId>
<artifactId>frascati-factory-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
...@@ -16,8 +16,13 @@ ...@@ -16,8 +16,13 @@
<!-- License along with this library; if not, write to the Free Software --> <!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- --> <!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Damien Fournier --> <!-- Author: Damien Fournier -->
<!-- Christophe Demarey --> <!-- Christophe Demarey -->
<!-- -->
<!-- Contributor(s): Nicolas Dolet -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-pojo"> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-pojo">
<service name="r" promote="client/r"/> <service name="r" promote="client/r"/>
......
============================================================================
OW2 FraSCAti Examples: ISBN test
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
============================================================================
ISBN Test Web Service Client:
-----------------------------