Commit 90e2c5fc authored by Christophe Demarey's avatar Christophe Demarey
Browse files

Adds Hello World POJO as a core example.

parent 9e2ce7d4
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- Examples : HelloWorld POJO -->
<!-- Copyright (C) 2008-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: Christophe Demarey -->
<project name="helloworld-pojo" default="dist" basedir=".">
<description>
A simple SCA application (Hello World) using POJOs.
</description>
<!-- set global properties for this build -->
<property name="src" location="src/main"/>
<property name="target" location="target"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${target}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${target} -->
<javac srcdir="${src}/java" destdir="${target}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Copy SCA composite definitions into the ${target} dir -->
<copy todir="${target}">
<fileset dir="${src}/resources">
<include name="**/*.composite"/>
</fileset>
</copy>
<!-- Put everything in ${target} into the ${ant.project.name}.jar file -->
<jar jarfile="${dist}/${ant.project.name}.jar" basedir="${target}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${target} and ${dist} directory trees -->
<delete dir="${target}"/>
<delete dir="${dist}"/>
</target>
</project>
/***
* OW2 FraSCAti Examples : HelloWorld POJO
* Copyright (C) 2008-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: Damien Fournier
* Christophe Demarey
*/
package org.ow2.frascati.examples.helloworld.pojo;
/** A print service client. */
public class Client implements Runnable {
protected PrintService s;
/** Default Constructor */
public Client() {
System.out.println("CLIENT created.");
}
/** Run the client. */
public void run() {
s.print("Hello World!");
}
/** Set the reference of the service. */
public void setPrintService(PrintService service) {
this.s = service;
}
}
\ No newline at end of file
/***
* OW2 FraSCAti Examples : HelloWorld POJO
* Copyright (C) 2008-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
*
* Authors: Damien Fournier
* Christophe Demarey
*/
package org.ow2.frascati.examples.helloworld.pojo;
public interface PrintService {
void print(String msg);
}
\ No newline at end of file
/***
* OW2 FraSCAti Examples : HelloWorld POJO
* Copyright (C) 2008-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: Damien Fournier
* Christophe Demarey
*/
package org.ow2.frascati.examples.helloworld.pojo;
/** The print service implementation. */
public class Server implements PrintService {
private 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.");
}
/** Set the Header property */
public void setHeader(final String header) {
System.out.println("SERVER: setting header to '" + header + "'.");
this.header = header;
}
/** Set the count property. */
public void setCount(final int count) {
System.out.println("SERVER: setting count to '" + count + "'.");
this.count = count;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples : HelloWorld POJO -->
<!-- Copyright (C) 2008-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: Damien Fournier -->
<!-- Christophe Demarey -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworld-pojo">
<service name="r" promote="client/r">
<interface.java interface="java.lang.Runnable"/>
</service>
<component name="client">
<implementation.java class="org.ow2.frascati.examples.helloworld.pojo.Client"/>
<service name="r">
<interface.java interface="java.lang.Runnable"/>
</service>
<reference name="printService" target="server/printService">
<interface.java interface="org.ow2.frascati.examples.helloworld.pojo.PrintService"/>
</reference>
</component>
<component name="server">
<implementation.java class="org.ow2.frascati.examples.helloworld.pojo.Server"/>
<service name="printService">
<interface.java interface="org.ow2.frascati.examples.helloworld.pojo.PrintService"/>
</service>
</component>
</composite>
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