Commit ef837621 authored by Gwenael Cattez's avatar Gwenael Cattez

Helloworld multiple reference example

parent b9c5bb54
============================================================================
* OW2 FraSCAti HelloWorld multiple
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s):
*
============================================================================
<name>OW2 FraSCAti Examples: HelloWorld multiple reference</name>
<description>Illustrate use of multiple reference with FraSCAti</description>
HelloWorld Property:
--------------------
This example illustrate use of multiple reference with FraSCAti.
Compilation with Maven:
-----------------------
mvn install
Execution with Maven:
---------------------
mvn -Prun (standalone execution)
mvn -Pexplorer (with FraSCAti Explorer)
mvn -Pexplorer-fscript (with FraSCAti Explorer and FScript plugin)
mvn -Pfscript-console (with FraSCAti FScript Console)
mvn -Pfscript-console-explorer (with FraSCAti Explorer and FScript Console)
mvn -Pexplorer-jdk6 (with FraSCAti Explorer and JDK6)
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld multiple reference
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>org.ow2.frascati.examples</groupId>
<version>1.5-SNAPSHOT</version>
</parent>
<artifactId>helloworld-multiple-reference</artifactId>
<name>OW2 FraSCAti Examples: HelloWorld multiple reference</name>
<description>Illustrate use of multiple reference with FraSCAti</description>
<properties>
<composite.file>RunnerMultipleTopLevel</composite.file>
</properties>
<dependencies>
<!-- OW2 FraSCAti WS Binding. -->
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-binding-ws</artifactId>
<version>${frascati.version}</version>
</dependency>
</dependencies>
<!--generate a frascati contribution -->
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.ow2.frascati.mojo</groupId>
<artifactId>frascati-contribution-plugin</artifactId>
<executions>
<execution>
<id>frascati-contribution</id>
<phase>package</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<name>helloworld-multiple-reference</name>
<deployables>
<deployable>RunnerMultipleTopLevel.composite</deployable>
<deployable>RunnerSimple.composite</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
/**
* OW2 FraSCAti Examples: HelloWorld multiple reference
* Copyright (C) 2013Inria, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s): Philippe Merle
*
*/
package org.ow2.frascati.examples.helloworld.multiple;
import org.osoa.sca.annotations.ComponentName;
import org.osoa.sca.annotations.Scope;
@Scope("COMPOSITE")
public class Runner implements Runnable
{
@ComponentName
private String name;
public void run()
{
System.out.println("Runner(name=" + this.name + ") runs.");
}
}
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2012 Inria, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s): Philippe Merle
*
*/
package org.ow2.frascati.examples.helloworld.multiple;
import java.util.List;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.objectweb.fractal.fraclet.annotations.Lifecycle;
import org.objectweb.fractal.fraclet.types.Step;
@Scope("COMPOSITE")
public class RunnerMultiple implements Runnable
{
private List<Runnable> runnables;
private Runnable runner;
public RunnerMultiple()
{
System.out.println("RunnerMultiple Constructor");
}
@Lifecycle(step=Step.CREATE)
public void create()
{
System.out.println("RunnerMultiple CREATE");
}
@Lifecycle(step=Step.START)
public void start()
{
System.out.println("RunnerMultiple START");
}
public void run()
{
System.out.println();
for(Runnable runnable : this.runnables)
{
if(runnable!=null)
{
runnable.run();
}
}
}
public java.util.List<Runnable> getRunnables()
{
System.out.println("Get Runnables");
return runnables;
}
@Reference(name="runnables")
public void setRunnables(List<Runnable> runnables)
{
System.out.println("set Runnables with "+runnables.size()+" elements");
this.runnables = runnables;
}
public Runnable getRunner()
{
System.out.println("Get Runner");
return runner;
}
@Reference(name="runner")
public void setRunner(Runnable runner)
{
this.runner = runner;
}
@Lifecycle(step=Step.STOP)
public void stop()
{
System.out.println("RunnerMultiple STOP");
}
@Lifecycle(step=Step.DESTROY)
public void destry()
{
System.out.println("RunnerMultiple DESTROY");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- OW2 FraSCAti: Assembly Factory -->
<!-- Copyright (C) 2012 Inria, University of Lille 1 -->
<!-- -->
<!-- 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: Gwenael Cattez -->
<!-- -->
<!-- Contributor(s): -->
<!-- -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="RunnerMultipleContainer">
<reference name="runnablesContainer" promote="RunnerMultiple/runnables" multiplicity="0..n"/>
<reference name="runnerContainer" promote="RunnerMultiple/runner"/>
<component name="RunnerMultiple">
<implementation.java class="org.ow2.frascati.examples.helloworld.multiple.RunnerMultiple"/>
<service name="run">
<interface.java interface="java.lang.Runnable"/>
</service>
<reference name="runnables" multiplicity="0..n">
<interface.java interface="java.lang.Runnable"/>
</reference>
<reference name="runner">
<interface.java interface="java.lang.Runnable"/>
</reference>
</component>
<service name="runContainer" promote="RunnerMultiple/run"></service>
</composite>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* OW2 FraSCAti Examples: HelloWorld multiple reference
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s):
*
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="RunnerMultipleLevel1">
<reference name="runnablesLevel1" promote="RunnerMultipleContainer/runnablesContainer" multiplicity="0..n"/>
<reference name="runnerLevel1" promote="RunnerMultipleContainer/runnerContainer"/>
<component name="RunnerMultipleContainer">
<implementation.composite name="RunnerMultipleContainer"></implementation.composite>
</component>
<service name="runLevel1" promote="RunnerMultipleContainer/runContainer"></service>
</composite>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* OW2 FraSCAti Examples: HelloWorld multiple reference
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s):
*
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="RunnerMultipleLevel2">
<reference name="runnablesLevel2" promote="RunnerMultipleLevel1/runnablesLevel1" multiplicity="0..n"/>
<reference name="runnerLevel2" promote="RunnerMultipleLevel1/runnerLevel1"/>
<component name="RunnerMultipleLevel1">
<implementation.composite name="RunnerMultipleLevel1"></implementation.composite>
</component>
<service name="runLevel2" promote="RunnerMultipleLevel1/runLevel1"></service>
</composite>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* OW2 FraSCAti Examples: HelloWorld multiple reference
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s):
*
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="RunnerMultipleTopLevel">
<reference name="runnablesTopLevel" promote="RunnerMultipleLevel2/runnablesLevel2" multiplicity="0..n"/>
<reference name="runnerTopLevel" promote="RunnerMultipleLevel2/runnerLevel2"/>
<component name="RunnerMultipleLevel2">
<implementation.composite name="RunnerMultipleLevel2"></implementation.composite>
</component>
<component name="Runner">
<implementation.java class="org.ow2.frascati.examples.helloworld.multiple.Runner"/>
<service name="run">
<interface.java interface="java.lang.Runnable"/>
</service>
</component>
<wire source="RunnerMultipleLevel2/runnablesLevel2" target="Runner/run"/>
<service name="runTopLevel" promote="RunnerMultipleLevel2/runLevel2"></service>
</composite>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* OW2 FraSCAti Examples: HelloWorld multiple reference
*
* Copyright (c) 2011-2013 INRIA, University of Lille 1
*
* 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: Gwenael Cattez
*
* Contributor(s):
*
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="RunnerSimple">
<component name="RunnerSimple">
<implementation.java class="org.ow2.frascati.examples.helloworld.multiple.Runner"/>
<service name="runSimple">
<interface.java interface="java.lang.Runnable"/>
<binding.ws uri="http://localhost:9000/runSimple"/>
</service>
</component>
</composite>
......@@ -802,6 +802,7 @@
<!--
<module>picweb</module>
-->
<module>helloworld-multiple-reference</module>
</modules>
</project>
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