Mail Archive Home | fractal-commits List | August 2006 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Tuesday, August 29, 2006 @ 08:45:05
Author: seintur
Path: /cvsroot/fractal/aokell/examples
Tag: AOKELL_2_1
Added: build.xml src/bench/README.txt src/collection/README.txt
src/comanche/README.txt src/hw/README.txt
Modified: src/bench/Bench.fractal src/bench/ClientImpl.java
src/comanche/RequestAnalyzer.java
src/comanche/RequestDispatcher.java
src/comanche/RequestReceiver.java src/hw/Main.java
src/hw/cs/ClientImpl.java
src/hw/csadl/AbstractClientServer.fractal
src/hw/csadl/ClientImpl.fractal src/hw/csadl/ClientImpl.java
src/hw/csadl/ClientServerImpl.fractal
src/hw/csadl/ClientType.fractal src/hw/csadl/Main.java
src/hw/csadl/RootType.fractal src/hw/csadl/ServerImpl.fractal
src/hw/csadl/ServerType.fractal
src/hw/cstemplate/ClientImpl.java
src/hw/cstemplateadl/AbstractClientServer.fractal
src/hw/cstemplateadl/ClientImpl.fractal
src/hw/cstemplateadl/ClientImpl.java
src/hw/cstemplateadl/ClientServerImpl.fractal
src/hw/cstemplateadl/ClientType.fractal
src/hw/cstemplateadl/Main.java
src/hw/cstemplateadl/RootType.fractal
src/hw/cstemplateadl/ServerImpl.fractal
src/hw/cstemplateadl/ServerType.fractal
Removed: src/benchsep/Bench.fractal src/benchsep/Bench.java
src/benchsep/BenchInterface.java src/benchsep/ClientImpl.java
src/benchsep/Main.java src/estore/Main.java
src/estore/Root.fractal src/estore/RootType.fractal
src/estore/bank/Bank.fractal src/estore/bank/BankHelper.java
src/estore/bank/BankType.fractal src/estore/bank/IBank.java
src/estore/bank/InsufficientBalanceException.java
src/estore/bank/UnknownAccountException.java
src/estore/bank/account/Account.fractal
src/estore/bank/account/AccountImpl.java
src/estore/bank/account/AccountType.fractal
src/estore/bank/account/IAccount.java
src/estore/bank/account/IAccountProperties.java
src/estore/bank/desk/Desk.fractal
src/estore/bank/desk/DeskHelper.java
src/estore/bank/desk/DeskImpl.java
src/estore/bank/desk/DeskType.fractal
src/estore/client/Client.fractal
src/estore/client/ClientImpl.java
src/estore/client/ClientType.fractal
src/estore/client/IClient.java
src/estore/provider/IProvider.java
src/estore/provider/Provider.fractal
src/estore/provider/ProviderImpl.java
src/estore/provider/ProviderType.fractal
src/estore/provider/UnknownItemException.java
src/estore/store/Cart.java src/estore/store/IFastLane.java
src/estore/store/IJustHaveALook.java src/estore/store/ILane.java
src/estore/store/IStore.java
src/estore/store/InvalidCartException.java
src/estore/store/ItemInStock.java src/estore/store/Order.java
src/estore/store/Store.fractal src/estore/store/StoreImpl.java
src/estore/store/StoreType.fractal src/hw/cssep/ClientImpl.java
src/hw/cssep/Main.java src/hw/cssep/ServerImpl.java
src/hw/cssep/Service.java src/hw/cssep/ServiceAttributes.java
New organisation of the examples.
---------------------------------------------------+
build.xml | 155 +++++++++
src/bench/Bench.fractal | 2
src/bench/ClientImpl.java | 38 +-
src/bench/README.txt | 31 +
src/benchsep/Bench.fractal | 43 --
src/benchsep/Bench.java | 66 ----
src/benchsep/BenchInterface.java | 48 --
src/benchsep/ClientImpl.java | 157 ---------
src/benchsep/Main.java | 62 ---
src/collection/README.txt | 2
src/comanche/README.txt | 18 +
src/comanche/RequestAnalyzer.java | 32 -
src/comanche/RequestDispatcher.java | 48 +-
src/comanche/RequestReceiver.java | 25 +
src/estore/Main.java | 116 -------
src/estore/Root.fractal | 41 --
src/estore/RootType.fractal | 29 -
src/estore/bank/Bank.fractal | 30 -
src/estore/bank/BankHelper.java | 61 ---
src/estore/bank/BankType.fractal | 29 -
src/estore/bank/IBank.java | 35 --
src/estore/bank/InsufficientBalanceException.java | 42 --
src/estore/bank/UnknownAccountException.java | 43 --
src/estore/bank/account/Account.fractal | 38 --
src/estore/bank/account/AccountImpl.java | 94 -----
src/estore/bank/account/AccountType.fractal | 33 --
src/estore/bank/account/IAccount.java | 34 --
src/estore/bank/account/IAccountProperties.java | 38 --
src/estore/bank/desk/Desk.fractal | 33 --
src/estore/bank/desk/DeskHelper.java | 62 ---
src/estore/bank/desk/DeskImpl.java | 164 ----------
src/estore/bank/desk/DeskType.fractal | 43 --
src/estore/client/Client.fractal | 29 -
src/estore/client/ClientImpl.java | 125 -------
src/estore/client/ClientType.fractal | 33 --
src/estore/client/IClient.java | 31 -
src/estore/provider/IProvider.java | 52 ---
src/estore/provider/Provider.fractal | 29 -
src/estore/provider/ProviderImpl.java | 87 -----
src/estore/provider/ProviderType.fractal | 29 -
src/estore/provider/UnknownItemException.java | 42 --
src/estore/store/Cart.java | 60 ---
src/estore/store/IFastLane.java | 60 ---
src/estore/store/IJustHaveALook.java | 51 ---
src/estore/store/ILane.java | 74 ----
src/estore/store/IStore.java | 31 -
src/estore/store/InvalidCartException.java | 37 --
src/estore/store/ItemInStock.java | 61 ---
src/estore/store/Order.java | 155 ---------
src/estore/store/Store.fractal | 29 -
src/estore/store/StoreImpl.java | 328 --------------------
src/estore/store/StoreType.fractal | 33 --
src/hw/Main.java | 6
src/hw/README.txt | 109 ++++++
src/hw/cs/ClientImpl.java | 27 -
src/hw/csadl/AbstractClientServer.fractal | 8
src/hw/csadl/ClientImpl.fractal | 4
src/hw/csadl/ClientImpl.java | 29 -
src/hw/csadl/ClientServerImpl.fractal | 8
src/hw/csadl/ClientType.fractal | 6
src/hw/csadl/Main.java | 2
src/hw/csadl/RootType.fractal | 2
src/hw/csadl/ServerImpl.fractal | 6
src/hw/csadl/ServerType.fractal | 4
src/hw/cssep/ClientImpl.java | 65 ---
src/hw/cssep/Main.java | 120 -------
src/hw/cssep/ServerImpl.java | 67 ----
src/hw/cssep/Service.java | 30 -
src/hw/cssep/ServiceAttributes.java | 35 --
src/hw/cstemplate/ClientImpl.java | 28 -
src/hw/cstemplateadl/AbstractClientServer.fractal | 8
src/hw/cstemplateadl/ClientImpl.fractal | 4
src/hw/cstemplateadl/ClientImpl.java | 29 -
src/hw/cstemplateadl/ClientServerImpl.fractal | 8
src/hw/cstemplateadl/ClientType.fractal | 6
src/hw/cstemplateadl/Main.java | 2
src/hw/cstemplateadl/RootType.fractal | 2
src/hw/cstemplateadl/ServerImpl.fractal | 6
src/hw/cstemplateadl/ServerType.fractal | 4
79 files changed, 501 insertions(+), 3192 deletions(-)
Index: aokell/examples/build.xml
diff -u /dev/null aokell/examples/build.xml:1.1.2.1
--- /dev/null Tue Aug 29 08:45:06 2006
+++ aokell/examples/build.xml Tue Aug 29 08:45:05 2006
@@ -0,0 +1,155 @@
+<!--
+ ! AOKell
+ ! Copyright (C) 2005-2006 INRIA, France Telecom
+ !
+ ! 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: Lionel.Seinturier@xxxxxxx
+-->
+
+<project name="AOKell-examples" default="help">
+
+ <!-- ==================================== -->
+ <!-- ======== PROPERTY DEFINITION ======= -->
+ <!-- ==================================== -->
+
+ <import file="../build-common.xml" />
+
+ <property name="examples.src" value="${basedir}/src" />
+
+
+ <!-- =================================== -->
+ <!-- ========== CHECK ========== -->
+ <!-- =================================== -->
+
+ <!-- Check that this example directory fits the feature configuration -->
+
+ <target name="check" depends="check.j2me-cldc" />
+
+ <condition property="feature.j2me-cldc">
+ <and>
+ <isset property="feature.platform" />
+ <equals arg1="${feature.platform}" arg2="j2me-cldc" />
+ </and>
+ </condition>
+
+ <target name="check.j2me-cldc" if="feature.j2me-cldc">
+ <echo message="To access the examples developed for the j2me-cldc
version of the platform feature:" />
+ <echo message=" cd ../features/platform/j2me-cldc/examples" />
+ <fail />
+ </target>
+
+
+ <!-- =================================== -->
+ <!-- ========== COMPILE ========== -->
+ <!-- =================================== -->
+
+ <target name="compile.aokell">
+ <ant antfile="../build.xml" target="compile" />
+ </target>
+
+ <target name="compile" description="Compiles AOKell examples"
+ depends="check, compile.aokell" >
+
+ <mkdir dir="${out.build}"/>
+
+ <!-- Compile the source code -->
+ <javac destdir="${out.build}">
+ <src path="${examples.src}" />
+ <classpath refid="classpath" />
+ </javac>
+
+ <!-- Apply feature-dependant build processes -->
+ <ant antfile="${path.feature.platform}/examples/platform.xml"
inheritrefs="true" inheritall="true" />
+
+ <!-- Copy ressources to the build directory -->
+ <copy todir="${out.build}">
+ <fileset dir="${examples.src}">
+ <include name="**/*.fractal" />
+ <include name="**/*.jpg" />
+ </fileset>
+ </copy>
+
+ </target>
+
+
+ <!-- =================================== -->
+ <!-- ========== EXECUTE ========== -->
+ <!-- =================================== -->
+
+ <target name="execute.all" description="Run AOKell examples"
+ depends="compile" >
+
+ <echo message="==============================" />
+ <echo message="==== Example: Hello World ====" />
+ <echo message="==============================" />
+ <run classname="hw.Main" />
+
+ <echo message="" />
+ <echo message="==============================" />
+ <echo message="==== Example: Collection ====" />
+ <echo message="==============================" />
+ <run classname="collection.Collection" />
+
+ <echo message="" />
+ <echo message="==============================" />
+ <echo message="==== Example: Bench ====" />
+ <echo message="==============================" />
+ <run classname="bench.Main" />
+ </target>
+
+ <presetdef name="run">
+ <java classname="hw.Main"
+ classpathref="classpath" fork="yes" failonerror="yes">
+ <jvmarg
line="-Dfractal.provider=org.objectweb.fractal.aokell.AOKell" />
+ </java>
+ </presetdef>
+
+ <target name="execute.bench" depends="compile">
+ <run classname="bench.Main" />
+ </target>
+
+ <target name="execute.collection" depends="compile">
+ <run classname="collection.Collection" />
+ </target>
+
+ <target name="execute.comanche" depends="compile">
+ <run classname="comanche.Main" />
+ </target>
+
+ <target name="execute.hw" depends="compile">
+ <run />
+ </target>
+
+
+ <!-- ==================================== -->
+ <!-- ========== HELP ========== -->
+ <!-- ==================================== -->
+
+ <target name="help" description="Displays AOKell examples help message">
+ <echo message="${product.name}-${product.version}"/>
+ <echo message="INRIA & France Telecom implementation of the
Fractal Specifications"/>
+ <echo message=""/>
+ <echo message="The main Ant targets are:"/>
+ <echo message=" compile: compiles AOKell examples"/>
+ <echo message=" execute.all: executes all examples (except
comanche)"/>
+ <echo message=""/>
+ <echo message=" execute.bench: executes the Bench example"/>
+ <echo message=" execute.collection: executes the Collection
example"/>
+ <echo message=" execute.comanche: executes the Comanche example"/>
+ <echo message=" execute.hw: executes the Hello World example"/>
+ </target>
+
+</project>
Index: aokell/examples/src/bench/Bench.fractal
diff -u aokell/examples/src/bench/Bench.fractal:1.1.2.1
aokell/examples/src/bench/Bench.fractal:1.1.2.2
--- aokell/examples/src/bench/Bench.fractal:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/bench/Bench.fractal Tue Aug 29 08:45:05 2006
@@ -41,5 +41,3 @@
<binding client="this.r" server="client.r"/>
<binding client="client.bench" server="bench.bench"/>
</definition>
-
-
Index: aokell/examples/src/bench/ClientImpl.java
diff -u aokell/examples/src/bench/ClientImpl.java:1.1.2.1
aokell/examples/src/bench/ClientImpl.java:1.1.2.2
--- aokell/examples/src/bench/ClientImpl.java:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/bench/ClientImpl.java Tue Aug 29 08:45:05 2006
@@ -25,13 +25,12 @@
package bench;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
/**
* @author Nicolas Pessemier <Nicolas.Pessemier@xxxxxxx>
*/
-public class ClientImpl implements Runnable {
+public class ClientImpl implements Runnable, BindingController {
private BenchInterface b;
@@ -50,13 +49,6 @@
this.n = 1000000;
this.rCalls=false;
- try {
- b = (BenchInterface) ((BindingController) this).lookupFc("bench");
- }
- catch( NoSuchInterfaceException nsie ) {
- throw new RuntimeException(nsie.getMessage());
- }
-
// Let the VM optimize
System.out.print("Warming up ");
doBench(); System.out.print(".");
@@ -140,8 +132,26 @@
}
}
-
-
-
-
-}
\ No newline at end of file
+ public String[] listFc () {
+ return new String[] { "bench" };
+ }
+
+ public Object lookupFc (final String cItf) {
+ if (cItf.equals("bench")) {
+ return b;
+ }
+ return null;
+ }
+
+ public void bindFc (final String cItf, final Object sItf) {
+ if (cItf.equals("bench")) {
+ b = (BenchInterface)sItf;
+ }
+ }
+
+ public void unbindFc (final String cItf) {
+ if (cItf.equals("bench")) {
+ b = null;
+ }
+ }
+}
Index: aokell/examples/src/bench/README.txt
diff -u /dev/null aokell/examples/src/bench/README.txt:1.1.2.1
--- /dev/null Tue Aug 29 08:45:06 2006
+++ aokell/examples/src/bench/README.txt Tue Aug 29 08:45:05 2006
@@ -0,0 +1,31 @@
+This example implements a benchmark suite to measure the cost of
+programming components with AOKell.
+
+When run, the example creates the following components
+architecture:
+- 1 root composite component
+- 2 primitive components included in the root composite
+
+ |--------------------------------------|
+ | |
+ | |--------| |--------| |
+|-|-|--->|-| Client |-|--->|-| Server | |
+ | |--------| |--------| |
+ | |
+ |--------------------------------------|
+
+The server component exports an interface with 8 different methods,
+each of them being trivial but non empty to bypass VM
+optimizations.
+
+The bench consists in calling the 8 methods of the server 1,000,000
+times. The bench is performed 4 times in a warmup phase, and then
+measures are taken on 5 different executions of the bench. The
+result is the average (in milliseconds) of these last 5 executions.
+
+A typical run of the program should return something like:
+
+BENCH CREATED
+Warming up ....
+Starting bench
+0: 741ms; 1: 751ms; 2: 751ms; 3: 751ms; 4: 742ms; average=747ms
Index: aokell/examples/src/benchsep/Bench.fractal
diff -u aokell/examples/src/benchsep/Bench.fractal:1.1.2.1
aokell/examples/src/benchsep/Bench.fractal:removed
--- aokell/examples/src/benchsep/Bench.fractal:1.1.2.1 Fri Aug 11 16:48:09
2006
+++ aokell/examples/src/benchsep/Bench.fractal Tue Aug 29 08:45:06 2006
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<!--
- * JACBenchmark
- * Copyright (C) 2002 AOPSYS
- *
- * 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: laurent@xxxxxxxxxx
- * Contact: Nicolas.Pessemier@xxxxxxx
- *
- * Author: Laurent Martelli
- * Author: Nicolas Pessemier
- -->
-
-<definition name="benchsep.Bench">
- <interface name="r" role="server" signature="java.lang.Runnable"/>
- <component name="client">
- <interface name="r" role="server" signature="java.lang.Runnable"/>
- <interface name="bench" role="client"
signature="benchsep.BenchInterface"/>
- <content class="benchsep.ClientImpl"/>
- <controller desc="primitive"/>
- </component>
- <component name="bench">
- <interface name="bench" role="server"
signature="benchsep.BenchInterface"/>
- <content class="benchsep.Bench"/>
- </component>
- <binding client="this.r" server="client.r"/>
- <binding client="client.bench" server="bench.bench"/>
-</definition>
Index: aokell/examples/src/benchsep/Bench.java
diff -u aokell/examples/src/benchsep/Bench.java:1.1.2.1
aokell/examples/src/benchsep/Bench.java:removed
--- aokell/examples/src/benchsep/Bench.java:1.1.2.1 Fri Aug 11 16:48:09
2006
+++ aokell/examples/src/benchsep/Bench.java Tue Aug 29 08:45:06 2006
@@ -1,66 +0,0 @@
-/***
- * JACBenchmark
- * Copyright (C) 2002 AOPSYS
- *
- * 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: laurent@xxxxxxxxxx
- * Contact: Nicolas.Pessemier@xxxxxxx
- *
- * Author: Laurent Martelli
- * Author: Nicolas Pessemier
- */
-
-package benchsep;
-
-public class Bench implements BenchInterface {
-
- public Bench() {
- System.out.println("BENCH CREATED");
- }
-
- public void m1() {
-// System.out.println("m1");
- int i = 0;
- }
-
- public void m2(Integer a) {
- int i = 0;
- }
-
- public void m3(Integer a, Integer b) {
- int i = 0;
- }
-
- public Integer m4() {
- return new Integer(0);
- }
-
- public Integer m5(Integer a) {
- return new Integer(0);
- }
-
- public Integer m6(Integer a, Integer b) {
- return new Integer(0);
- }
-
- public void m7(Object a) {
- return;
- }
-
- public void m8(Object a, Object b) {
- return;
- }
-}
\ No newline at end of file
Index: aokell/examples/src/benchsep/BenchInterface.java
diff -u aokell/examples/src/benchsep/BenchInterface.java:1.1.2.1
aokell/examples/src/benchsep/BenchInterface.java:removed
--- aokell/examples/src/benchsep/BenchInterface.java:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/benchsep/BenchInterface.java Tue Aug 29 08:45:06
2006
@@ -1,48 +0,0 @@
-/***
- * JACBenchmark
- * Copyright (C) 2002 AOPSYS
- *
- * 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: laurent@xxxxxxxxxx
- * Contact: Nicolas.Pessemier@xxxxxxx
- *
- * Author: Laurent Martelli
- * Author: Nicolas Pessemier
- */
-
-package benchsep;
-
-/**
- * @author Nicolas Pessemier <Nicolas.Pessemier@xxxxxxx>
- */
-public interface BenchInterface {
-
- public void m1();
-
- public void m2(Integer a);
-
- public void m3(Integer a, Integer b);
-
- public Integer m4();
-
- public Integer m5(Integer a);
-
- public Integer m6(Integer a, Integer b);
-
- public void m7(Object a);
-
- public void m8(Object a, Object b);
-}
\ No newline at end of file
Index: aokell/examples/src/benchsep/ClientImpl.java
diff -u aokell/examples/src/benchsep/ClientImpl.java:1.1.2.1
aokell/examples/src/benchsep/ClientImpl.java:removed
--- aokell/examples/src/benchsep/ClientImpl.java:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/benchsep/ClientImpl.java Tue Aug 29 08:45:06
2006
@@ -1,157 +0,0 @@
-/***
- * JACBenchmark
- * Copyright (C) 2002 AOPSYS
- *
- * 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: laurent@xxxxxxxxxx
- * Contact: Nicolas.Pessemier@xxxxxxx
- *
- * Author: Laurent Martelli
- * Author: Nicolas Pessemier
- */
-
-package benchsep;
-
-import org.objectweb.fractal.api.control.BindingController;
-
-/**
- * @author Nicolas Pessemier <Nicolas.Pessemier@xxxxxxx>
- */
-public class ClientImpl implements Runnable, BindingController {
-
- private BenchInterface b;
-
- boolean rCalls;
-
-
-
- private int n;
- String s;
-
- // from Main interface
-
- public void run() {
-
-
- this.n = 1000000;
- this.rCalls=false;
-
- // Let the VM optimize
- System.out.print("Warming up ");
- doBench(); System.out.print(".");
- doBench(); System.out.print(".");
- doBench(); System.out.print(".");
- doBench(); System.out.println(".");
- //Thread.currentThread().sleep(5000);
-
- System.out.println("Starting bench");
- long total = 0;
- int num_runs = 5;
- for (int i=0; i<num_runs; i++) {
- long start = System.currentTimeMillis();
- doBench();
- long end = System.currentTimeMillis();
- System.out.print(i+": "+(end-start)+"ms; ");
- total += end-start;
- }
- System.out.println(" average="+(total/num_runs)+"ms; ");
- }
-
- void doBench() {
- sbench1();
- sbench2();
- sbench3();
- sbench4();
- sbench5();
- sbench6();
- sbench7();
- sbench8();
- }
-
-
-
- void sbench1() {
- for(int i=0; i<n; i++) {
- b.m1();
- }
- }
-
- void sbench2() {
- //System.out.print("bench 2: ");
- for(int i=0; i<n; i++) {
- b.m2(new Integer(0));
- }
- }
-
- void sbench3() {
- for(int i=0; i<n; i++) {
- b.m3(new Integer(0),new Integer(0));
- }
- }
-
- void sbench4() {
- for(int i=0; i<n; i++) {
- b.m4();
- }
- }
-
- void sbench5() {
- for(int i=0; i<n; i++) {
- b.m5(new Integer(0));
- }
- }
-
- void sbench6() {
- for(int i=0; i<n; i++) {
- b.m6(new Integer(0),new Integer(0));
- }
- }
-
- void sbench7() {
- for(int i=0; i<n; i++) {
- b.m7(null);
- }
- }
-
- void sbench8() {
- for(int i=0; i<n; i++) {
- b.m8(null,null);
- }
- }
-
- public String[] listFc () {
- return new String[] { "bench" };
- }
-
- public Object lookupFc (final String cItf) {
- if (cItf.equals("bench")) {
- return b;
- }
- return null;
- }
-
- public void bindFc (final String cItf, final Object sItf) {
- if (cItf.equals("bench")) {
- b = (BenchInterface)sItf;
- }
- }
-
- public void unbindFc (final String cItf) {
- if (cItf.equals("bench")) {
- b = null;
- }
- }
-}
Index: aokell/examples/src/benchsep/Main.java
diff -u aokell/examples/src/benchsep/Main.java:1.1.2.1
aokell/examples/src/benchsep/Main.java:removed
--- aokell/examples/src/benchsep/Main.java:1.1.2.1 Fri Aug 11 16:48:09
2006
+++ aokell/examples/src/benchsep/Main.java Tue Aug 29 08:45:06 2006
@@ -1,62 +0,0 @@
-/***
- * JACBenchmark
- * Copyright (C) 2002 AOPSYS
- *
- * 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: laurent@xxxxxxxxxx
- * Contact: Nicolas.Pessemier@xxxxxxx
- *
- * Author: Laurent Martelli
- * Author: Nicolas Pessemier
- */
-
-package benchsep;
-
-import java.util.HashMap;
-
-import org.objectweb.fractal.adl.Factory;
-import org.objectweb.fractal.adl.FactoryFactory;
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.util.Fractal;
-
-
-/**
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public class Main {
-
- public static void main(String[] args) throws Exception {
-
- // ----------------------------------------------------------
- // Load the ADL definition
- // ----------------------------------------------------------
- Factory factory =
- FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND);
- Component root = (Component)
- factory.newComponent("benchsep.Bench",new HashMap());
-
- // ----------------------------------------------------------
- // Start the Root component
- // ----------------------------------------------------------
- Fractal.getLifeCycleController(root).startFc();
-
- // ----------------------------------------------------------
- // Call the entry point of the application
- // ----------------------------------------------------------
- ((Runnable)root.getFcInterface("r")).run();
-
- }
-}
Index: aokell/examples/src/collection/README.txt
diff -u /dev/null aokell/examples/src/collection/README.txt:1.1.2.1
--- /dev/null Tue Aug 29 08:45:06 2006
+++ aokell/examples/src/collection/README.txt Tue Aug 29 08:45:05 2006
@@ -0,0 +1,2 @@
+Example taken from the Julia distribution to illustrate the usage of
collection
+interfaces and auto-bindings.
\ No newline at end of file
Index: aokell/examples/src/comanche/README.txt
diff -u /dev/null aokell/examples/src/comanche/README.txt:1.1.2.1
--- /dev/null Tue Aug 29 08:45:06 2006
+++ aokell/examples/src/comanche/README.txt Tue Aug 29 08:45:05 2006
@@ -0,0 +1,18 @@
+This is the comanche web server. This program was implemented with
+Julia and runs, unmodified, with AOKell.
+
+See "Developing with Fractal" in the Documentation section of the
+Fractal web site <http://fractal.objectweb.org> for a description
+of the comanche architecture.
+
+When run, comanche waits for HTTP request on port 8080. A typical
+run of the program should return something like:
+
+Comanche HTTP Server ready on port 8080.
+
+Open the <http://localhost:8080/src/gnu.jpg> URL in your favorite
+web browser. A well-known head should appear! To stop the server,
+type Ctrl-C in the launching shell.
+
+You can add any file you like in the comanche/ directory to have
+them served by comanche.
Index: aokell/examples/src/comanche/RequestAnalyzer.java
diff -u aokell/examples/src/comanche/RequestAnalyzer.java:1.1.2.1
aokell/examples/src/comanche/RequestAnalyzer.java:1.1.2.2
--- aokell/examples/src/comanche/RequestAnalyzer.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/comanche/RequestAnalyzer.java Tue Aug 29 08:45:05
2006
@@ -33,26 +33,26 @@
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
-public class RequestAnalyzer implements RequestHandler /*,
BindingController*/ {
+public class RequestAnalyzer implements RequestHandler, BindingController {
private RequestHandler rh;
private Logger l;
-// // configuration aspect
-// public String[] listFc () { return new String[] { "l", "rh" }; }
-// public Object lookupFc (String itfName) {
-// if (itfName.equals("l")) { return l; }
-// else if (itfName.equals("rh")) { return rh; }
-// else return null;
-// }
-// public void bindFc (String itfName, Object itfValue) {
-// if (itfName.equals("l")) { l = (Logger)itfValue; }
-// else if (itfName.equals("rh")) { rh = (RequestHandler)itfValue; }
-// }
-// public void unbindFc (String itfName) {
-// if (itfName.equals("l")) { l = null; }
-// else if (itfName.equals("rh")) { rh = null; }
-// }
+ // configuration aspect
+ public String[] listFc () { return new String[] { "l", "rh" }; }
+ public Object lookupFc (String itfName) {
+ if (itfName.equals("l")) { return l; }
+ else if (itfName.equals("rh")) { return rh; }
+ else return null;
+ }
+ public void bindFc (String itfName, Object itfValue) {
+ if (itfName.equals("l")) { l = (Logger)itfValue; }
+ else if (itfName.equals("rh")) { rh = (RequestHandler)itfValue; }
+ }
+ public void unbindFc (String itfName) {
+ if (itfName.equals("l")) { l = null; }
+ else if (itfName.equals("rh")) { rh = null; }
+ }
// functional aspect
public void handleRequest (Request r) throws IOException {
Index: aokell/examples/src/comanche/RequestDispatcher.java
diff -u aokell/examples/src/comanche/RequestDispatcher.java:1.1.2.1
aokell/examples/src/comanche/RequestDispatcher.java:1.1.2.2
--- aokell/examples/src/comanche/RequestDispatcher.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/comanche/RequestDispatcher.java Tue Aug 29 08:45:05
2006
@@ -27,43 +27,33 @@
import java.io.IOException;
import java.util.Iterator;
-import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
-public class RequestDispatcher implements RequestHandler /*,
BindingController */ {
+public class RequestDispatcher implements RequestHandler, BindingController {
-// private Map handlers = new TreeMap();
-// // configuration aspect
-// public String[] listFc () {
-// return (String[])handlers.keySet().toArray(new
String[handlers.size()]);
-// }
-// public Object lookupFc (String itfName) {
-// if (itfName.startsWith("h")) { return handlers.get(itfName); }
-// else return null;
-// }
-// public void bindFc (String itfName, Object itfValue) {
-// if (itfName.startsWith("h")) { handlers.put(itfName, itfValue); }
-// }
-// public void unbindFc (String itfName) {
-// if (itfName.startsWith("h")) { handlers.remove(itfName); }
-// }
+ private Map handlers = new TreeMap();
+ // configuration aspect
+ public String[] listFc () {
+ return (String[])handlers.keySet().toArray(new String[handlers.size()]);
+ }
+ public Object lookupFc (String itfName) {
+ if (itfName.startsWith("h")) { return handlers.get(itfName); }
+ else return null;
+ }
+ public void bindFc (String itfName, Object itfValue) {
+ if (itfName.startsWith("h")) { handlers.put(itfName, itfValue); }
+ }
+ public void unbindFc (String itfName) {
+ if (itfName.startsWith("h")) { handlers.remove(itfName); }
+ }
// functional aspect
public void handleRequest (Request r) throws IOException {
-// Iterator i = handlers.values().iterator();
-
- List handlers = null;
- try {
- handlers = (List) ((BindingController)this).lookupFc("h");
- }
- catch(NoSuchInterfaceException nsie) {
- throw new RuntimeException(nsie.getMessage());
- }
+ Iterator i = handlers.values().iterator();
- Iterator i = handlers.iterator();
-
while (i.hasNext()) {
try {
RequestHandler rh = (RequestHandler) i.next();
Index: aokell/examples/src/comanche/RequestReceiver.java
diff -u aokell/examples/src/comanche/RequestReceiver.java:1.1.2.1
aokell/examples/src/comanche/RequestReceiver.java:1.1.2.2
--- aokell/examples/src/comanche/RequestReceiver.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/comanche/RequestReceiver.java Tue Aug 29 08:45:05
2006
@@ -31,13 +31,14 @@
import org.objectweb.fractal.api.control.BindingController;
-public class RequestReceiver implements Runnable /*, BindingController*/ {
+public class RequestReceiver implements Runnable, BindingController {
public void run () {
try {
ServerSocket ss = new ServerSocket(8080);
System.out.println("Comanche HTTP Server ready on port 8080.");
- System.out.println("Load http://localhost:8080/gnu.jpg");
+ System.out.println("Type Ctrl-C to stop the server.");
+ System.out.println("Use a web browser to load
http://localhost:8080/comanche/gnu.jpg");
while (true) {
final Socket socket = ss.accept();
@@ -54,4 +55,24 @@
}
} catch (Exception e) { e.printStackTrace(); }
}
+
+ private RequestHandler rh;
+ private Scheduler s;
+
+ // configuration aspect
+ public String[] listFc () { return new String[] { "s", "rh" }; }
+ public Object lookupFc (String itfName) {
+ if (itfName.equals("s")) { return s; }
+ else if (itfName.equals("rh")) { return rh; }
+ else return null;
+ }
+ public void bindFc (String itfName, Object itfValue) {
+ if (itfName.equals("s")) { s = (Scheduler)itfValue; }
+ else if (itfName.equals("rh")) { rh = (RequestHandler)itfValue; }
+ }
+ public void unbindFc (String itfName) {
+ if (itfName.equals("s")) { s = null; }
+ else if (itfName.equals("rh")) { rh = null; }
+ }
+
}
Index: aokell/examples/src/estore/Main.java
diff -u aokell/examples/src/estore/Main.java:1.1.2.1
aokell/examples/src/estore/Main.java:removed
--- aokell/examples/src/estore/Main.java:1.1.2.1 Fri Aug 11 16:48:10
2006
+++ aokell/examples/src/estore/Main.java Tue Aug 29 08:45:06 2006
@@ -1,116 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore;
-
-import org.objectweb.fractal.adl.ADLException;
-import org.objectweb.fractal.adl.Factory;
-import org.objectweb.fractal.adl.FactoryFactory;
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.ContentController;
-import org.objectweb.fractal.api.control.LifeCycleController;
-import org.objectweb.fractal.api.control.NameController;
-import org.objectweb.fractal.util.Fractal;
-
-import estore.bank.desk.DeskHelper;
-
-
-/**
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public class Main {
-
- public static void main(String[] args) throws Exception {
-
- // Create the Root component
- Factory f = getFactory();
- root = (Component) f.newComponent("estore.Root",null);
-
- // Start the Root component
- LifeCycleController lc = Fractal.getLifeCycleController(root);
- lc.startFc();
-
- Component desk = DeskHelper.getDeskComponent();
- Runnable idc = (Runnable)
- desk.getFcInterface("IDeskConfiguration");;
- idc.run();
-
- // Call the run() method of the IRun interface of the Root component
- Runnable r = (Runnable) root.getFcInterface("IRun");
- r.run();
- }
-
-
- private static Factory factory;
-
- /**
- * Return the singleton instance of a FRACTAL_BACKEND factory.
- * FactoryFactory.getFactory always return a new instance.
- * For dynamic creation of component instances,
- * we need to access the same factory, and thus retain its reference.
- *
- * @return the singleton instance of a FRACTAL_BACKEND factory
- */
- public static Factory getFactory() {
- if ( factory == null ) {
- try {
- factory =
-
FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND);
- } catch (ADLException e) {
- e.printStackTrace();
- }
- }
- return factory;
- }
-
- /**
- * Get a named direct sub-component contained inside a composite.
- * This is not a recursive search.
- *
- * @param c the composite
- * @param name the name of the sub-component
- * @return the sub-component or null
- */
- public static Component getSubComponent( Component c, String name )
- throws NoSuchInterfaceException {
-
- ContentController cc = Fractal.getContentController(c);
- Component[] comps = cc.getFcSubComponents();
- for (int i = 0; i < comps.length; i++) {
- NameController nc = Fractal.getNameController(comps[i]);
- if( nc.getFcName().equals(name) )
- return comps[i];
- }
-
- return null;
-
- }
-
- /** The root component of this application. */
- protected static Component root;
- public static Component getRootComponent() {
- return root;
- }
-
-}
Index: aokell/examples/src/estore/Root.fractal
diff -u aokell/examples/src/estore/Root.fractal:1.1.2.1
aokell/examples/src/estore/Root.fractal:removed
--- aokell/examples/src/estore/Root.fractal:1.1.2.1 Fri Aug 11 16:48:10
2006
+++ aokell/examples/src/estore/Root.fractal Tue Aug 29 08:45:06 2006
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition extends="estore.RootType" name="estore.Root">
-
- <component definition="estore.client.Client" name="Client" />
- <component definition="estore.store.Store" name="Store" />
- <component definition="estore.bank.Bank" name="Bank" />
- <component definition="estore.provider.Provider" name="Provider" />
-
- <binding client="this.IRun" server="Client.IRun" />
- <binding client="Client.IFastLane" server="Store.IFastLane" />
- <binding client="Client.ILane" server="Store.ILane"/>
- <binding client="Client.IJustHaveALook" server="Store.IJustHaveALook" />
- <binding client="Store.IBank" server="Bank.IBank" />
- <binding client="Store.IProvider" server="Provider.IProvider" />
-
-</definition>
Index: aokell/examples/src/estore/RootType.fractal
diff -u aokell/examples/src/estore/RootType.fractal:1.1.2.1
aokell/examples/src/estore/RootType.fractal:removed
--- aokell/examples/src/estore/RootType.fractal:1.1.2.1 Fri Aug 11 16:48:10
2006
+++ aokell/examples/src/estore/RootType.fractal Tue Aug 29 08:45:06 2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.RootType">
- <interface signature="java.lang.Runnable" role="server" name="IRun"/>
-</definition>
Index: aokell/examples/src/estore/bank/Bank.fractal
diff -u aokell/examples/src/estore/bank/Bank.fractal:1.1.2.1
aokell/examples/src/estore/bank/Bank.fractal:removed
--- aokell/examples/src/estore/bank/Bank.fractal:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/bank/Bank.fractal Tue Aug 29 08:45:06
2006
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition extends="estore.bank.BankType" name="estore.bank.Bank">
- <component definition="estore.bank.desk.Desk" name="Desk" />
- <binding client="this.IBank" server="Desk.IBank" />
-</definition>
Index: aokell/examples/src/estore/bank/BankHelper.java
diff -u aokell/examples/src/estore/bank/BankHelper.java:1.1.2.1
aokell/examples/src/estore/bank/BankHelper.java:removed
--- aokell/examples/src/estore/bank/BankHelper.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/bank/BankHelper.java Tue Aug 29 08:45:06
2006
@@ -1,61 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank;
-
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-
-import estore.Main;
-
-/**
- * Helper class for retrieving the Bank component.
- *
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public class BankHelper {
-
- /** The name of the Bank component defined in Root.fractal. */
- final private static String BANK_NAME = "Bank";
-
- private static Component bank;
-
- /**
- * Return the Bank component.
- */
- public static Component getBankComponent() {
-
- if( bank == null ) {
- try {
- Component root = Main.getRootComponent();
- bank = Main.getSubComponent(root,BANK_NAME);
- }
- catch (NoSuchInterfaceException e) {
- e.printStackTrace();
- }
-
- }
- return bank;
- }
-
-}
Index: aokell/examples/src/estore/bank/BankType.fractal
diff -u aokell/examples/src/estore/bank/BankType.fractal:1.1.2.1
aokell/examples/src/estore/bank/BankType.fractal:removed
--- aokell/examples/src/estore/bank/BankType.fractal:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/bank/BankType.fractal Tue Aug 29 08:45:06
2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.bank.BankType">
- <interface signature="estore.bank.IBank" role="server" name="IBank"/>
-</definition>
Index: aokell/examples/src/estore/bank/IBank.java
diff -u aokell/examples/src/estore/bank/IBank.java:1.1.2.1
aokell/examples/src/estore/bank/IBank.java:removed
--- aokell/examples/src/estore/bank/IBank.java:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/estore/bank/IBank.java Tue Aug 29 08:45:06 2006
@@ -1,35 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank;
-
-
-/**
- * @author Lionel Seinturier
- */
-public interface IBank {
-
- void transfert( Object from, Object to, double amount )
- throws InsufficientBalanceException, UnknownAccountException;
-
-}
Index: aokell/examples/src/estore/bank/InsufficientBalanceException.java
diff -u
aokell/examples/src/estore/bank/InsufficientBalanceException.java:1.1.2.1
aokell/examples/src/estore/bank/InsufficientBalanceException.java:removed
--- aokell/examples/src/estore/bank/InsufficientBalanceException.java:1.1.2.1
Fri Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/bank/InsufficientBalanceException.java Tue
Aug 29 08:45:06 2006
@@ -1,42 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank;
-
-/**
- * @author Lionel Seinturier
- */
-public class InsufficientBalanceException extends Exception {
-
- private static final long serialVersionUID = 1365771904467860173L;
- private String account;
-
- public InsufficientBalanceException( String account ) {
- super();
- this.account = account;
- }
-
- public String getMessage() {
- return "The account "+account+" is not sufficiently balanced.";
- }
-}
Index: aokell/examples/src/estore/bank/UnknownAccountException.java
diff -u aokell/examples/src/estore/bank/UnknownAccountException.java:1.1.2.1
aokell/examples/src/estore/bank/UnknownAccountException.java:removed
--- aokell/examples/src/estore/bank/UnknownAccountException.java:1.1.2.1
Fri Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/bank/UnknownAccountException.java Tue
Aug 29 08:45:06 2006
@@ -1,43 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank;
-
-/**
- * @author Lionel Seinturier
- */
-public class UnknownAccountException extends Exception {
-
- private static final long serialVersionUID = 8340333926671329022L;
- private String account;
-
- public UnknownAccountException( String account ) {
- super();
- this.account = account;
- }
-
- public String getMessage() {
- return "The account "+account+" is unknown.";
- }
-
-}
Index: aokell/examples/src/estore/bank/account/Account.fractal
diff -u aokell/examples/src/estore/bank/account/Account.fractal:1.1.2.1
aokell/examples/src/estore/bank/account/Account.fractal:removed
--- aokell/examples/src/estore/bank/account/Account.fractal:1.1.2.1 Fri
Aug 11 16:48:10 2006
+++ aokell/examples/src/estore/bank/account/Account.fractal Tue Aug 29
08:45:06 2006
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition
- extends="estore.bank.account.AccountType"
- name="estore.bank.account.Account">
-
- <content class="estore.bank.account.AccountImpl" />
-
- <attributes signature="estore.bank.account.IAccountProperties">
- <attribute name="owner" value="" />
- <attribute name="amount" value="0" />
- </attributes>
-
-</definition>
Index: aokell/examples/src/estore/bank/account/AccountImpl.java
diff -u aokell/examples/src/estore/bank/account/AccountImpl.java:1.1.2.1
aokell/examples/src/estore/bank/account/AccountImpl.java:removed
--- aokell/examples/src/estore/bank/account/AccountImpl.java:1.1.2.1 Fri
Aug 11 16:48:10 2006
+++ aokell/examples/src/estore/bank/account/AccountImpl.java Tue Aug 29
08:45:06 2006
@@ -1,94 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank.account;
-
-import estore.bank.InsufficientBalanceException;
-
-public class AccountImpl implements IAccount, IAccountProperties {
-
- /**
- * Constructs a new AccountImpl
- */
- public AccountImpl() {
- }
-
- // -----------------------------------------------------
- // Implementation of the IAccountProperties interface
- // -----------------------------------------------------
-
- private double amount;
- private String owner;
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public double getAmount() {
- return amount;
- }
-
- public void setAmount(double amount) {
- this.amount = amount;
- }
-
- // -----------------------------------------------------
- // Implementation of the IAccount interface
- // -----------------------------------------------------
-
- public void credit(double amount) {
- this.amount += amount;
- }
-
- public void withdraw(double amount) throws InsufficientBalanceException {
- if ( this.amount < amount )
- throw new InsufficientBalanceException(owner);
- this.amount -= amount;
- }
-
- // -----------------------------------------------------
- // Implementation of the Object interface
- // -----------------------------------------------------
-
- /**
- * Two AccountImpl instances are considered equals
- * if they share the same owner.
- * Of course, in a more realistic implementation,
- * we should have a account number.
- */
- public boolean equals( Object other ) {
- if( ! (other instanceof AccountImpl) )
- return false;
- AccountImpl otherAccount = (AccountImpl) other;
- return ( otherAccount.owner == owner);
- }
-
- public int hashCode() {
- return owner.hashCode();
- }
-
-}
Index: aokell/examples/src/estore/bank/account/AccountType.fractal
diff -u aokell/examples/src/estore/bank/account/AccountType.fractal:1.1.2.1
aokell/examples/src/estore/bank/account/AccountType.fractal:removed
--- aokell/examples/src/estore/bank/account/AccountType.fractal:1.1.2.1 Fri
Aug 11 16:48:10 2006
+++ aokell/examples/src/estore/bank/account/AccountType.fractal Tue Aug 29
08:45:06 2006
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.bank.account.AccountType">
- <interface
- name="IAccount"
- role="server"
- signature="estore.bank.account.IAccount"
- />
-</definition>
Index: aokell/examples/src/estore/bank/account/IAccount.java
diff -u aokell/examples/src/estore/bank/account/IAccount.java:1.1.2.1
aokell/examples/src/estore/bank/account/IAccount.java:removed
--- aokell/examples/src/estore/bank/account/IAccount.java:1.1.2.1 Fri
Aug 11 16:48:10 2006
+++ aokell/examples/src/estore/bank/account/IAccount.java Tue Aug 29
08:45:06 2006
@@ -1,34 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank.account;
-
-import estore.bank.InsufficientBalanceException;
-
-/**
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public interface IAccount {
- void credit( double amount );
- void withdraw( double amount ) throws InsufficientBalanceException;
-}
Index: aokell/examples/src/estore/bank/account/IAccountProperties.java
diff -u
aokell/examples/src/estore/bank/account/IAccountProperties.java:1.1.2.1
aokell/examples/src/estore/bank/account/IAccountProperties.java:removed
--- aokell/examples/src/estore/bank/account/IAccountProperties.java:1.1.2.1
Fri Aug 11 16:48:10 2006
+++ aokell/examples/src/estore/bank/account/IAccountProperties.java Tue
Aug 29 08:45:06 2006
@@ -1,38 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank.account;
-
-import org.objectweb.fractal.api.control.AttributeController;
-
-/**
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public interface IAccountProperties extends AttributeController {
-
- String getOwner();
- void setOwner( String name );
-
- double getAmount();
- void setAmount( double amount );
-}
Index: aokell/examples/src/estore/bank/desk/Desk.fractal
diff -u aokell/examples/src/estore/bank/desk/Desk.fractal:1.1.2.1
aokell/examples/src/estore/bank/desk/Desk.fractal:removed
--- aokell/examples/src/estore/bank/desk/Desk.fractal:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/estore/bank/desk/Desk.fractal Tue Aug 29 08:45:06
2006
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition
- extends="estore.bank.desk.DeskType"
- name="estore.bank.desk.Desk">
-
- <content class="estore.bank.desk.DeskImpl"/>
-
-</definition>
Index: aokell/examples/src/estore/bank/desk/DeskHelper.java
diff -u aokell/examples/src/estore/bank/desk/DeskHelper.java:1.1.2.1
aokell/examples/src/estore/bank/desk/DeskHelper.java:removed
--- aokell/examples/src/estore/bank/desk/DeskHelper.java:1.1.2.1 Fri
Aug 11 16:48:09 2006
+++ aokell/examples/src/estore/bank/desk/DeskHelper.java Tue Aug 29
08:45:06 2006
@@ -1,62 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank.desk;
-
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-
-import estore.Main;
-import estore.bank.BankHelper;
-
-/**
- * Helper class for retrieving the Desk component.
- *
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public class DeskHelper {
-
- /** The name of the Desk component defined in Bank.fractal. */
- final private static String DESK_NAME = "Desk";
-
- private static Component desk;
-
- /**
- * Return the Desk component.
- */
- public static Component getDeskComponent() {
-
- if ( desk == null ) {
- try {
- Component bank = BankHelper.getBankComponent();
- desk = Main.getSubComponent(bank,DESK_NAME);
- }
- catch (NoSuchInterfaceException e) {
- e.printStackTrace();
- }
- }
-
- return desk;
- }
-
-}
Index: aokell/examples/src/estore/bank/desk/DeskImpl.java
diff -u aokell/examples/src/estore/bank/desk/DeskImpl.java:1.1.2.1
aokell/examples/src/estore/bank/desk/DeskImpl.java:removed
--- aokell/examples/src/estore/bank/desk/DeskImpl.java:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/estore/bank/desk/DeskImpl.java Tue Aug 29 08:45:06
2006
@@ -1,164 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.bank.desk;
-
-
-import org.objectweb.fractal.adl.Factory;
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.Interface;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.BindingController;
-import org.objectweb.fractal.api.control.ContentController;
-import org.objectweb.fractal.api.control.LifeCycleController;
-import org.objectweb.fractal.api.control.NameController;
-import org.objectweb.fractal.api.control.SuperController;
-import org.objectweb.fractal.util.Fractal;
-
-import estore.Main;
-import estore.bank.IBank;
-import estore.bank.InsufficientBalanceException;
-import estore.bank.UnknownAccountException;
-import estore.bank.account.IAccountProperties;
-
-public class DeskImpl implements IBank, Runnable {
-
- // -----------------------------------------------------
- // Implementation of the IBank interface
- // -----------------------------------------------------
-
- public void transfert(Object from, Object to, double amount)
- throws InsufficientBalanceException, UnknownAccountException {
-
- try {
- // Get the Account components
- String fromAccountItfName = IACCOUNT_BINDING+from;
-
- Interface fromAccountItf = (Interface)
((BindingController)this).lookupFc(fromAccountItfName);
- Component fromAccount = fromAccountItf.getFcItfOwner();
-
- String toAccountItfName = IACCOUNT_BINDING+to;
- Interface toAccountItf = (Interface)
((BindingController)this).lookupFc(toAccountItfName);
- Component toAccount = toAccountItf.getFcItfOwner();
-
- // Get the balance of the account to widthdraw
- IAccountProperties acFrom = (IAccountProperties)
- Fractal.getAttributeController(fromAccount);
- double fromBalance = acFrom.getAmount();
-
- // Check whether the account is sufficiently balanced
- if ( fromBalance < amount )
- throw new InsufficientBalanceException(from.toString());
-
- // Get the balance of the account to credit
- IAccountProperties acTo = (IAccountProperties)
- Fractal.getAttributeController(toAccount);
- double toBalance = acTo.getAmount();
-
- // Perform the transfert
- acFrom.setAmount( fromBalance - amount );
- acTo.setAmount( toBalance + amount );
- }
- catch (NoSuchInterfaceException e) {
- // We do not want this exception to appear in the business
- // interface, so we wrap it in a runtime exception
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- // -----------------------------------------------------
- // Implementation of the Runnable interface
- // -----------------------------------------------------
-
- public void run() {
- Component desk = DeskHelper.getDeskComponent();
- createAndBindAccount(desk,"Bob",100);
- createAndBindAccount(desk,"Anne",30);
- createAndBindAccount(desk,"E-Store",0);
- }
-
- /**
- * Create a Account component with the given initial values,
- * insert it in the Bank component that contains the given Desk
component,
- * bind it to the current Desk component, and
- * start it.
- *
- * @param desk the Desk component that perform the creation
- * @param owner the owner of the account
- * @param amount the initial balance of the account
- */
- private void createAndBindAccount(
- Component desk,
- String owner,
- double amount ) {
-
- Factory f = Main.getFactory();
-
- try {
- // Create a new Account component
- Component c = (Component)
- f.newComponent("estore.bank.account.Account",null);
-
- // Give a name (owner) to the Account component
- NameController nc = Fractal.getNameController(c);
- nc.setFcName(owner);
-
- // Initialize the Account component properties
- IAccountProperties props =
- (IAccountProperties) Fractal.getAttributeController(c);
- props.setOwner(owner);
- props.setAmount(amount);
-
- // Get the Bank composite that contains the Desk component
- // Nota: we "know" that Desk in not shared and that supers[0]
- // is the only composite containing Desk, and is Bank
- SuperController sc = Fractal.getSuperController(desk);
- Component[] supers = sc.getFcSuperComponents();
- Component bank = supers[0];
-
- // Add the Account component to the Bank composite
- ContentController cc = Fractal.getContentController(bank);
- cc.addFcSubComponent(c);
-
- // Bind the Account component to the current Desk component
- // bindFc(IACCOUNT_BINDING,c);
- BindingController bc = Fractal.getBindingController(desk);
- String clientItfName = IACCOUNT_BINDING+owner;
- Object itf = c.getFcInterface("IAccount");
- bc.bindFc(clientItfName,itf);
-
- // Start the Account component
- LifeCycleController lc = Fractal.getLifeCycleController(c);
- lc.startFc();
- }
- catch (Exception e) {
- throw new RuntimeException(
- "Failed to create account for "+owner, e );
- }
-
- }
-
- public final static String IACCOUNT_BINDING = "IAccount";
-
-}
Index: aokell/examples/src/estore/bank/desk/DeskType.fractal
diff -u aokell/examples/src/estore/bank/desk/DeskType.fractal:1.1.2.1
aokell/examples/src/estore/bank/desk/DeskType.fractal:removed
--- aokell/examples/src/estore/bank/desk/DeskType.fractal:1.1.2.1 Fri
Aug 11 16:48:09 2006
+++ aokell/examples/src/estore/bank/desk/DeskType.fractal Tue Aug 29
08:45:06 2006
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.bank.desk.DeskType">
-
- <interface signature="estore.bank.IBank" role="server" name="IBank" />
-
- <interface
- signature = "java.lang.Runnable"
- role = "server"
- name = "IDeskConfiguration" />
-
- <interface
- role = "client"
- name = "IAccount"
- signature = "estore.bank.account.IAccount"
- cardinality = "collection"
- contingency = "optional" />
-
-</definition>
Index: aokell/examples/src/estore/client/Client.fractal
diff -u aokell/examples/src/estore/client/Client.fractal:1.1.2.1
aokell/examples/src/estore/client/Client.fractal:removed
--- aokell/examples/src/estore/client/Client.fractal:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/estore/client/Client.fractal Tue Aug 29 08:45:06
2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition extends="estore.client.ClientType" name="estore.client.Client">
- <content class="estore.client.ClientImpl"/>
-</definition>
Index: aokell/examples/src/estore/client/ClientImpl.java
diff -u aokell/examples/src/estore/client/ClientImpl.java:1.1.2.1
aokell/examples/src/estore/client/ClientImpl.java:removed
--- aokell/examples/src/estore/client/ClientImpl.java:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/estore/client/ClientImpl.java Tue Aug 29 08:45:06
2006
@@ -1,125 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.client;
-
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.BindingController;
-
-import estore.bank.InsufficientBalanceException;
-import estore.bank.UnknownAccountException;
-import estore.provider.UnknownItemException;
-import estore.store.Cart;
-import estore.store.IFastLane;
-import estore.store.ILane;
-import estore.store.InvalidCartException;
-import estore.store.Order;
-
-public class ClientImpl implements Runnable, IClient {
-
- private ILane iLane;
- private IFastLane iFastLane;
-
- // -----------------------------------------------------
- // Implementation of the Runnable interface
- // -----------------------------------------------------
-
- public void run() {
-
- // Scenario 1
- // Direct ordering of an item
- // The scenario is run twice
- System.out.println("Scenario 1");
- scenario1("CD",2,"Lille","Bob");
- scenario1("CD",1,"Lille","Anne");
- System.out.println();
-
- // Scenario 2
- // Ordering of several items by using a cart
- System.out.println("Scenario 2");
- scenario2(new String[]{"DVD","CD"},new int[]{2,1},"Lille","Bob");
- System.out.println();
- }
-
- private void scenario1(
- String item, int qty, String address, String account ) {
-
- try {
- _scenario1(item,qty,address,account);
- }
- catch (Exception e) {
- System.err.println("Exception: "+e.getMessage());
- e.printStackTrace();
- }
- }
-
- private void _scenario1(
- String item, int qty, String address, String account )
- throws
- UnknownItemException,
- InsufficientBalanceException, UnknownAccountException,
- NoSuchInterfaceException {
-
- iFastLane = (IFastLane)
((BindingController)this).lookupFc("IFastLane");
-
- System.out.println("Ordering "+qty+" "+item+" for "+account+"...");
- Order order = iFastLane.oneShotOrder(this,item,qty,address,account);
- System.out.println(order);
- }
-
- private void scenario2(
- String[] items, int[] qties, String address, String account ) {
-
- try {
- _scenario2(items,qties,address,account);
- }
- catch (Exception e) {
- System.err.println("Exception: "+e.getMessage());
- e.printStackTrace();
- }
- }
-
- private void _scenario2(
- String[] items, int[] qties, String address, String account )
- throws
- InsufficientBalanceException, UnknownAccountException,
- UnknownItemException, InvalidCartException,
- NoSuchInterfaceException {
-
- iLane = (ILane) ((BindingController)this).lookupFc("ILane");
-
- System.out.println("Ordering for "+account+"...");
- Cart cart = null;
- for (int i = 0; i < items.length; i++) {
- System.out.println("Item: "+items[i]+", quantity: "+qties[i]);
- cart = iLane.addItemToCart(cart,this,items[i],qties[i]);
- }
- Order order = iLane.pay(cart,address,account);
- System.out.println(order);
- }
-
- // -----------------------------------------------------
- // Implementation of the IClient interface
- // -----------------------------------------------------
-
-}
\ No newline at end of file
Index: aokell/examples/src/estore/client/ClientType.fractal
diff -u aokell/examples/src/estore/client/ClientType.fractal:1.1.2.1
aokell/examples/src/estore/client/ClientType.fractal:removed
--- aokell/examples/src/estore/client/ClientType.fractal:1.1.2.1 Fri
Aug 11 16:48:09 2006
+++ aokell/examples/src/estore/client/ClientType.fractal Tue Aug 29
08:45:06 2006
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.client.ClientType">
- <interface signature="java.lang.Runnable" role="server" name="IRun"/>
- <interface signature="estore.client.IClient" role="server" name="IClient"/>
- <interface signature="estore.store.IFastLane" role="client"
name="IFastLane"/>
- <interface signature="estore.store.ILane" role="client" name="ILane"/>
- <interface signature="estore.store.IJustHaveALook" role="client"
name="IJustHaveALook"/>
-</definition>
Index: aokell/examples/src/estore/client/IClient.java
diff -u aokell/examples/src/estore/client/IClient.java:1.1.2.1
aokell/examples/src/estore/client/IClient.java:removed
--- aokell/examples/src/estore/client/IClient.java:1.1.2.1 Fri Aug 11
16:48:09 2006
+++ aokell/examples/src/estore/client/IClient.java Tue Aug 29 08:45:06
2006
@@ -1,31 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.client;
-
-/**
- * @author Lionel Seinturier
- */
-public interface IClient {
-
-}
Index: aokell/examples/src/estore/provider/IProvider.java
diff -u aokell/examples/src/estore/provider/IProvider.java:1.1.2.1
aokell/examples/src/estore/provider/IProvider.java:removed
--- aokell/examples/src/estore/provider/IProvider.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/provider/IProvider.java Tue Aug 29 08:45:06
2006
@@ -1,52 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.provider;
-
-import estore.store.IStore;
-
-/**
- * @author Lionel Seinturier
- */
-public interface IProvider {
-
- /**
- * Get the price of an item provided by this provider.
- *
- * @param item
- * @return
- */
- double getPrice( Object item ) throws UnknownItemException;
-
- /**
- * Emit an order for items.
- * The provider returns the delay for delivering the items.
- *
- * @param store the store that emits the order
- * @param item the item ordered
- * @param qty the quantity ordered
- * @return the delay (in hours)
- */
- int order( IStore store, Object item, int qty ) throws
UnknownItemException;
-
-}
Index: aokell/examples/src/estore/provider/Provider.fractal
diff -u aokell/examples/src/estore/provider/Provider.fractal:1.1.2.1
aokell/examples/src/estore/provider/Provider.fractal:removed
--- aokell/examples/src/estore/provider/Provider.fractal:1.1.2.1 Fri
Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/provider/Provider.fractal Tue Aug 29
08:45:06 2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition extends="estore.provider.ProviderType"
name="estore.provider.Provider">
- <content class="estore.provider.ProviderImpl"/>
-</definition>
Index: aokell/examples/src/estore/provider/ProviderImpl.java
diff -u aokell/examples/src/estore/provider/ProviderImpl.java:1.1.2.1
aokell/examples/src/estore/provider/ProviderImpl.java:removed
--- aokell/examples/src/estore/provider/ProviderImpl.java:1.1.2.1 Fri
Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/provider/ProviderImpl.java Tue Aug 29
08:45:06 2006
@@ -1,87 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.provider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import estore.store.IStore;
-
-public class ProviderImpl implements IProvider {
-
- private Map itemPrices = new HashMap();
-
- /**
- * Constructs a new ProviderImpl
- */
- public ProviderImpl() {
- itemPrices.put("CD",new Double(15));
- itemPrices.put("DVD",new Double(20));
- }
-
- // -----------------------------------------------------
- // Implementation of the IProvider interface
- // -----------------------------------------------------
-
- /**
- * Get the price of an item provided by this provider.
- *
- * @param item
- * @return
- */
- public double getPrice( Object item ) throws UnknownItemException {
-
- if ( ! itemPrices.containsKey(item) )
- throw new UnknownItemException(
- "Item "+item+
- " is not an item delivered by this provider.");
-
- Double price = (Double) itemPrices.get(item);
- return price.doubleValue();
- }
-
- /**
- * Emit an order for items.
- * The provider returns the delay for delivering the items.
- *
- * @param store the store that emits the order
- * @param item the item ordered
- * @param qty the quantity ordered
- * @return the delay (in hours)
- */
- public int order( IStore store, Object item, int qty )
- throws UnknownItemException {
-
- if ( ! itemPrices.containsKey(item) )
- throw new UnknownItemException(
- "Item "+item+
- " is not an item delivered by this provider.");
-
- // Actually the production process is quite chaotic
- // We only know that the production a random number of hours!!
- double r = Math.random() * 10 * qty;
- return (int)r;
- }
-
-}
\ No newline at end of file
Index: aokell/examples/src/estore/provider/ProviderType.fractal
diff -u aokell/examples/src/estore/provider/ProviderType.fractal:1.1.2.1
aokell/examples/src/estore/provider/ProviderType.fractal:removed
--- aokell/examples/src/estore/provider/ProviderType.fractal:1.1.2.1 Fri
Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/provider/ProviderType.fractal Tue Aug 29
08:45:06 2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition name="estore.provider.ProviderType">
- <interface signature="estore.provider.IProvider" role="server"
name="IProvider"/>
-</definition>
Index: aokell/examples/src/estore/provider/UnknownItemException.java
diff -u aokell/examples/src/estore/provider/UnknownItemException.java:1.1.2.1
aokell/examples/src/estore/provider/UnknownItemException.java:removed
--- aokell/examples/src/estore/provider/UnknownItemException.java:1.1.2.1
Fri Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/provider/UnknownItemException.java Tue
Aug 29 08:45:06 2006
@@ -1,42 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.provider;
-
-/**
- * @author Lionel Seinturier
- */
-public class UnknownItemException extends Exception {
-
- private static final long serialVersionUID = -1585427033037517192L;
-
- private Object item;
-
- public UnknownItemException( String msg ) {
- super(msg);
- }
-
- public String getMessage() {
- return "Item "+item+" is not an item delivered by this provider.";
- }
-}
Index: aokell/examples/src/estore/store/Cart.java
diff -u aokell/examples/src/estore/store/Cart.java:1.1.2.1
aokell/examples/src/estore/store/Cart.java:removed
--- aokell/examples/src/estore/store/Cart.java:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/estore/store/Cart.java Tue Aug 29 08:45:06 2006
@@ -1,60 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import estore.client.IClient;
-
-/**
- * @author Lionel Seinturier
- */
-public class Cart {
-
- /** The client owning the cart. */
- public IClient client;
-
- /** The items currently added to the cart. key=item, value=quantity. */
- private Map items = new HashMap();
-
-
- public Cart(IClient client) {
- this.client = client;
- }
-
- public void addItem( Object item, int qty ) {
- int oldQty = 0;
- if ( items.containsKey(item) ) {
- // The item has already been put in the cart
- // Increase the number
- oldQty = ((Integer) items.get(item)).intValue();
- }
- items.put( item, new Integer(qty+oldQty) );
- }
-
- public Map getItems() {
- return items;
- }
-}
Index: aokell/examples/src/estore/store/IFastLane.java
diff -u aokell/examples/src/estore/store/IFastLane.java:1.1.2.1
aokell/examples/src/estore/store/IFastLane.java:removed
--- aokell/examples/src/estore/store/IFastLane.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/store/IFastLane.java Tue Aug 29 08:45:06
2006
@@ -1,60 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import estore.bank.InsufficientBalanceException;
-import estore.bank.UnknownAccountException;
-import estore.client.IClient;
-import estore.provider.UnknownItemException;
-
-/**
- * @author Lionel Seinturier
- */
-public interface IFastLane extends IStore {
-
- /**
- * Used by a client to order an item.
- * The whole process of ordering is encapsulated by this method.
- * If several items need to be ordered, this method needs to be
- * called several times, but the items will appear in separate orders.
- *
- * @param client
- * @param item
- * @param quantity
- * @param address
- * @param bankAccount
- * @return the order
- */
- Order oneShotOrder(
- IClient client,
- Object item,
- int quantity,
- Object address,
- Object bankAccount
- )
- throws
- UnknownItemException,
- InsufficientBalanceException, UnknownAccountException;
-
-}
Index: aokell/examples/src/estore/store/IJustHaveALook.java
diff -u aokell/examples/src/estore/store/IJustHaveALook.java:1.1.2.1
aokell/examples/src/estore/store/IJustHaveALook.java:removed
--- aokell/examples/src/estore/store/IJustHaveALook.java:1.1.2.1 Fri
Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/store/IJustHaveALook.java Tue Aug 29
08:45:06 2006
@@ -1,51 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import estore.provider.UnknownItemException;
-
-/**
- * @author Lionel Seinturier
- */
-public interface IJustHaveALook extends IStore {
-
- /**
- * @param item a given item
- * @return the price of a given item
- * @throws UnknownItemException
- */
- double getPrice( Object item ) throws UnknownItemException;
-
- /**
- * @param item a given item
- * @param qty a given quantity
- * @return
- * true if the given quantity of the given item is available
- * directly from the store
- * i.e. without having to re-order it from the provider
- * @throws UnknownItemException
- */
- boolean isAvailable( Object item, int qty ) throws UnknownItemException;
-
-}
Index: aokell/examples/src/estore/store/ILane.java
diff -u aokell/examples/src/estore/store/ILane.java:1.1.2.1
aokell/examples/src/estore/store/ILane.java:removed
--- aokell/examples/src/estore/store/ILane.java:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/estore/store/ILane.java Tue Aug 29 08:45:06 2006
@@ -1,74 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import estore.bank.InsufficientBalanceException;
-import estore.bank.UnknownAccountException;
-import estore.client.IClient;
-import estore.provider.UnknownItemException;
-
-/**
- * @author Lionel Seinturier
- */
-public interface ILane extends IStore {
-
- /**
- * Add an item to a cart.
- * If the cart does not exist yet, create a new one.
- * This method is called for each item one wants to add to the cart.
- *
- * @param cart a previously created cart or null
- * @param client
- * @param item
- * @param qty
- * @return
- * Implementation dependant.
- * Either a new cart at each call or the same cart updated.
- *
- * @throws UnknownItemException
- * @throws InvalidCartException
- * if the given client does not own the given cart
- */
- Cart addItemToCart(
- Cart cart,
- IClient client,
- Object item,
- int qty )
- throws UnknownItemException, InvalidCartException;
-
- /**
- * Once all the items have been added to the cart,
- * this method finish make the payment.
- *
- * @param cart
- * @param address
- * @param bankAccount
- * @return the order
- */
- Order pay( Cart cart, Object address, Object bankAccount )
- throws
- InvalidCartException, UnknownItemException,
- InsufficientBalanceException, UnknownAccountException;
-
-}
Index: aokell/examples/src/estore/store/IStore.java
diff -u aokell/examples/src/estore/store/IStore.java:1.1.2.1
aokell/examples/src/estore/store/IStore.java:removed
--- aokell/examples/src/estore/store/IStore.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/store/IStore.java Tue Aug 29 08:45:06
2006
@@ -1,31 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-/**
- * @author Lionel Seinturier
- */
-public interface IStore {
-
-}
Index: aokell/examples/src/estore/store/InvalidCartException.java
diff -u aokell/examples/src/estore/store/InvalidCartException.java:1.1.2.1
aokell/examples/src/estore/store/InvalidCartException.java:removed
--- aokell/examples/src/estore/store/InvalidCartException.java:1.1.2.1 Fri
Aug 11 16:48:08 2006
+++ aokell/examples/src/estore/store/InvalidCartException.java Tue Aug 29
08:45:06 2006
@@ -1,37 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-/**
- * @author Lionel Seinturier
- */
-public class InvalidCartException extends Exception {
-
- private static final long serialVersionUID = -6561524790558683191L;
-
- public InvalidCartException(String msg) {
- super(msg);
- }
-
-}
Index: aokell/examples/src/estore/store/ItemInStock.java
diff -u aokell/examples/src/estore/store/ItemInStock.java:1.1.2.1
aokell/examples/src/estore/store/ItemInStock.java:removed
--- aokell/examples/src/estore/store/ItemInStock.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/store/ItemInStock.java Tue Aug 29 08:45:06
2006
@@ -1,61 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import estore.provider.IProvider;
-
-/**
- * @author Lionel Seinturier
- */
-public class ItemInStock {
-
- /** The total number of ItemInStock instances created. */
- private static int numItems;
-
- /** The index of this item. */
- private int num;
-
- public Object item;
- public int quantity;
- public double price;
- public IProvider provider;
-
- private ItemInStock() {
- num = numItems++;
- }
-
- public ItemInStock(Object item, int quantity, double price,
- IProvider provider) {
- this();
- this.item = item;
- this.quantity = quantity;
- this.price = price;
- this.provider = provider;
- }
-
- public String toString() {
- return "Item #"+num;
- }
-
-}
Index: aokell/examples/src/estore/store/Order.java
diff -u aokell/examples/src/estore/store/Order.java:1.1.2.1
aokell/examples/src/estore/store/Order.java:removed
--- aokell/examples/src/estore/store/Order.java:1.1.2.1 Fri Aug 11 16:48:08
2006
+++ aokell/examples/src/estore/store/Order.java Tue Aug 29 08:45:06 2006
@@ -1,155 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package estore.store;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import estore.client.IClient;
-import estore.provider.UnknownItemException;
-
-/**
- * @author Lionel Seinturier
- */
-public class Order {
-
- /** The total number of orders emitted so far. */
- private static int numOrders;
-
- /** The index of this order. */
- private int num;
-
- public IClient client;
- public Object item;
- public Object address;
- public Object bankAccount;
-
- /** The date at which the ordered is issued. */
- public Date date;
-
- /** The delay for delivering the items in the order. */
- private int delay;
-
- /** The items currently in the order. */
- private Set items = new HashSet();
-
- /** The quantities of each item ordered. key=item, value=quantity. */
- private Map itemQuantities = new HashMap();
-
- /** The individual prices of each item ordered. key=item, value=price. */
- private Map itemPrices = new HashMap();
-
-
- private Order() {
- num = numOrders++;
- date = new Date();
- }
-
- public Order(IClient client, Object address, Object bankAccount) {
- this();
- this.client = client;
- this.address = address;
- this.bankAccount = bankAccount;
- }
-
- /**
- * Add an item to the order.
- *
- * @param item
- * @param qty
- * @param price
- * @throws UnknownItemException
- */
- public void addItem( Object item, int qty, double price )
- throws UnknownItemException {
-
- if ( itemPrices.containsKey(item) ) {
- double oldPrice = ((Double) itemPrices.get(item)).doubleValue();
- if ( oldPrice != price )
- throw new UnknownItemException(
- "Item "+item+" price ("+price+
- ") added to cart is different from the price ("+
- oldPrice+") of the same item already in the cart" );
- }
-
- items.add(item);
- itemPrices.put( item, new Double(price) );
-
- int newQty = qty;
- if ( itemQuantities.containsKey(item) ) {
- newQty += ((Integer) itemQuantities.get(item)).intValue();
- }
- itemQuantities.put( item, new Integer(newQty) );
- }
-
- /**
- * Compute the total amount of the order
- */
- public double computeAmount() {
-
- double amount = 0;
-
- for (Iterator iter = items.iterator(); iter.hasNext();) {
- Object item = iter.next();
- int qty = ((Integer)itemQuantities.get(item)).intValue();
- double price = ((Double)itemPrices.get(item)).doubleValue();
-
- amount += qty*price;
- }
-
- return amount;
- }
-
- /**
- * @return Returns the delay for delivering this order.
- */
- public int getDelay() {
- return delay;
- }
-
- /**
- * Set the delay for this order.
- * The delay is the highest delay for delivering all the items of an
order.
- */
- public void setDelay(int delay) {
- if ( delay > this.delay )
- this.delay = delay;
- }
-
- public int getKey() {
- return num;
- }
-
- public String toString() {
- String msg = "Order #"+num+" ";
- msg += "amount: "+computeAmount()+" ";
- msg += "delay: "+getDelay()+"h ";
- msg += "issued on: "+date;
- return msg;
- }
-}
Index: aokell/examples/src/estore/store/Store.fractal
diff -u aokell/examples/src/estore/store/Store.fractal:1.1.2.1
aokell/examples/src/estore/store/Store.fractal:removed
--- aokell/examples/src/estore/store/Store.fractal:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/store/Store.fractal Tue Aug 29 08:45:06
2006
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-
-<!--
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
--->
-
-<definition extends="estore.store.StoreType" name="estore.store.Store">
- <content class="estore.store.StoreImpl"/>
-</definition>
Index: aokell/examples/src/estore/store/StoreImpl.java
diff -u aokell/examples/src/estore/store/StoreImpl.java:1.1.2.1
aokell/examples/src/estore/store/StoreImpl.java:removed
--- aokell/examples/src/estore/store/StoreImpl.java:1.1.2.1 Fri Aug 11
16:48:08 2006
+++ aokell/examples/src/estore/store/StoreImpl.java Tue Aug 29 08:45:06
2006
@@ -1,328 +0,0 @@
-/***
- * AOKell E-Store application
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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 la