Mail Archive Home | gotm-commits List | November 2004 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Friday, November 19, 2004 @ 19:20:19
Author: rouvoy
Path: /cvsroot/gotm/gotm-drink
Added: externals/apollon/apollon-runtime.jar
externals/fractal-adl/dtdparser.jar
externals/fractal-adl/fractal-adl.jar
externals/fractal-adl/ow_deployment_scheduling.jar
externals/fractal-explorer/basic-plugin.jar
externals/fractal-explorer/browser.jar
externals/fractal-explorer/fractal-browser.jar
externals/fractal-explorer/fractal-plugin.jar
externals/xerces/xerces.jar
src/fractal/org/objectweb/gotm/drink/api/FcAccount.fractal
src/fractal/org/objectweb/gotm/drink/api/FcMixerCoiner.fractal
src/fractal/org/objectweb/gotm/drink/api/FcUserCoiner.fractal
src/fractal/org/objectweb/gotm/drink/comp/FcApplication.fractal
src/fractal/org/objectweb/gotm/drink/comp/FcCoinerComposite.fractal
src/fractal/org/objectweb/gotm/drink/comp/FcDrinkMachine.fractal
src/fractal/org/objectweb/gotm/drink/comp/FcFractalExplorer.fractal
src/fractal/org/objectweb/gotm/drink/lib/FcAccountComponent.fractal
src/fractal/org/objectweb/gotm/drink/lib/FcCoinerComponent.fractal
src/java/org/objectweb/gotm/drink/api/Account.java
src/java/org/objectweb/gotm/drink/api/MixerCoiner.java
src/java/org/objectweb/gotm/drink/api/NotEnoughMoneyException.java
src/java/org/objectweb/gotm/drink/api/OperationNotAllowedException.java
src/java/org/objectweb/gotm/drink/api/UserCoiner.java
src/java/org/objectweb/gotm/drink/lib/AccountComponent.java
src/java/org/objectweb/gotm/drink/lib/CoinerComponent.java
src/java/org/objectweb/gotm/drink/lib/PrimitiveComponent.java
Modified: .classpath .cvsignore build.xml src/etc/julia.cfg
* Adding Fractal-ADL library,
* Adding Fractal-explorer library,
* Importing the Coiner composite component for the Drink Machine,
* Updating the compilation process for running the drink machine with the
fractal-explorer administration console.
-------------------------------------------------------------------------+
.classpath |
4
.cvsignore |
1
build.xml |
8
externals/apollon/apollon-runtime.jar |
<<Binary file>>
externals/fractal-adl/dtdparser.jar |
<<Binary file>>
externals/fractal-adl/fractal-adl.jar |
<<Binary file>>
externals/fractal-adl/ow_deployment_scheduling.jar |
<<Binary file>>
externals/fractal-explorer/basic-plugin.jar |
<<Binary file>>
externals/fractal-explorer/browser.jar |
<<Binary file>>
externals/fractal-explorer/fractal-browser.jar |
<<Binary file>>
externals/fractal-explorer/fractal-plugin.jar |
<<Binary file>>
externals/xerces/xerces.jar |
<<Binary file>>
src/etc/julia.cfg |
22 +
src/fractal/org/objectweb/gotm/drink/api/FcAccount.fractal |
9
src/fractal/org/objectweb/gotm/drink/api/FcMixerCoiner.fractal |
9
src/fractal/org/objectweb/gotm/drink/api/FcUserCoiner.fractal |
9
src/fractal/org/objectweb/gotm/drink/comp/FcApplication.fractal |
14
src/fractal/org/objectweb/gotm/drink/comp/FcCoinerComposite.fractal |
20 +
src/fractal/org/objectweb/gotm/drink/comp/FcDrinkMachine.fractal |
13
src/fractal/org/objectweb/gotm/drink/comp/FcFractalExplorer.fractal |
15
src/fractal/org/objectweb/gotm/drink/lib/FcAccountComponent.fractal |
9
src/fractal/org/objectweb/gotm/drink/lib/FcCoinerComponent.fractal |
12
src/java/org/objectweb/gotm/drink/api/Account.java |
58 +++
src/java/org/objectweb/gotm/drink/api/MixerCoiner.java |
47 ++
src/java/org/objectweb/gotm/drink/api/NotEnoughMoneyException.java |
45 ++
src/java/org/objectweb/gotm/drink/api/OperationNotAllowedException.java |
45 ++
src/java/org/objectweb/gotm/drink/api/UserCoiner.java |
51 ++
src/java/org/objectweb/gotm/drink/lib/AccountComponent.java |
102 +++++
src/java/org/objectweb/gotm/drink/lib/CoinerComponent.java |
151 ++++++++
src/java/org/objectweb/gotm/drink/lib/PrimitiveComponent.java |
173 ++++++++++
30 files changed, 810 insertions(+), 7 deletions(-)
Index: gotm-drink/.classpath
diff -u gotm-drink/.classpath:1.1 gotm-drink/.classpath:1.2
--- gotm-drink/.classpath:1.1 Fri Nov 19 15:38:35 2004
+++ gotm-drink/.classpath Fri Nov 19 19:20:18 2004
@@ -2,5 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="lib" path="externals/fractal/fractal.jar"/>
+ <classpathentry kind="lib" path="externals/monolog/ow_monolog.jar"/>
+ <classpathentry kind="output" path="build/class"/>
</classpath>
Index: gotm-drink/.cvsignore
diff -u gotm-drink/.cvsignore:1.1 gotm-drink/.cvsignore:1.2
--- gotm-drink/.cvsignore:1.1 Fri Nov 19 15:38:35 2004
+++ gotm-drink/.cvsignore Fri Nov 19 19:20:18 2004
@@ -1 +1,2 @@
bin
+build
Index: gotm-drink/build.xml
diff -u gotm-drink/build.xml:1.1 gotm-drink/build.xml:1.2
--- gotm-drink/build.xml:1.1 Fri Nov 19 15:38:35 2004
+++ gotm-drink/build.xml Fri Nov 19 19:20:18 2004
@@ -21,7 +21,7 @@
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: build.xml,v 1.1 2004/11/19 14:38:35 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.2 2004/11/19 18:20:18 rouvoy Exp $ -->
<!-- ==================================================================== -->
<project name="gotm-drink" default="drink-all">
@@ -47,7 +47,7 @@
</path>
<path id="classpath-compile">
- <pathelement id="classpath-execute"/>
+ <path refid="classpath-execute"/>
<pathelement location="${build.dir}/${class.dir}"/>
</path>
@@ -60,7 +60,7 @@
<mkdir dir="${build.dir}/${lib.dir}"/>
<copy todir="${build.dir}/${lib.dir}">
<mapper type="flatten"/>
- <fileset dir="${basedir}/externals" includes="**/*"/>
+ <fileset dir="${basedir}/externals" includes="**/*.*"/>
</copy>
<mkdir dir="${build.dir}/${etc.dir}"/>
<copy todir="${build.dir}/${etc.dir}">
@@ -112,7 +112,7 @@
value="org.objectweb.fractal.julia.loader.DynamicLoader" />
<sysproperty key="julia.config"
value="${julia.cfg}" />
- <arg line="-fractal org.objectweb.gotm.drink.??? r"/>
+ <arg line="-fractal org.objectweb.gotm.drink.comp.FcApplication r"/>
</java>
</target>
</project>
Index: gotm-drink/externals/apollon/apollon-runtime.jar
cvs rdiff: failed to read diff file header /tmp/cvsaXNqZ9 for
apollon-runtime.jar,v: end of file
Index: gotm-drink/externals/fractal-adl/dtdparser.jar
cvs rdiff: failed to read diff file header /tmp/cvsD9VdSa for
dtdparser.jar,v: end of file
Index: gotm-drink/externals/fractal-adl/fractal-adl.jar
cvs rdiff: failed to read diff file header /tmp/cvsuik5I4 for
fractal-adl.jar,v: end of file
Index: gotm-drink/externals/fractal-adl/ow_deployment_scheduling.jar
cvs rdiff: failed to read diff file header /tmp/cvsDSRpS5 for
ow_deployment_scheduling.jar,v: end of file
Index: gotm-drink/externals/fractal-explorer/basic-plugin.jar
cvs rdiff: failed to read diff file header /tmp/cvscKlmL6 for
basic-plugin.jar,v: end of file
Index: gotm-drink/externals/fractal-explorer/browser.jar
cvs rdiff: failed to read diff file header /tmp/cvsJ8Esw7 for browser.jar,v:
end of file
Index: gotm-drink/externals/fractal-explorer/fractal-browser.jar
cvs rdiff: failed to read diff file header /tmp/cvsiCgjxg for
fractal-browser.jar,v: end of file
Index: gotm-drink/externals/fractal-explorer/fractal-plugin.jar
cvs rdiff: failed to read diff file header /tmp/cvsRftHkh for
fractal-plugin.jar,v: end of file
Index: gotm-drink/externals/xerces/xerces.jar
cvs rdiff: failed to read diff file header /tmp/cvscG6BBb for xerces.jar,v:
end of file
Index: gotm-drink/src/etc/julia.cfg
diff -u gotm-drink/src/etc/julia.cfg:1.1 gotm-drink/src/etc/julia.cfg:1.2
--- gotm-drink/src/etc/julia.cfg:1.1 Fri Nov 19 15:38:35 2004
+++ gotm-drink/src/etc/julia.cfg Fri Nov 19 19:20:18 2004
@@ -299,7 +299,19 @@
)
# LifeCycleController implementation (for primitive or composite components)
-
+#(lifecycle-controller-impl
+# ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+# LifeCycleControllerImpl
+# org.objectweb.fractal.julia.BasicControllerMixin
+# org.objectweb.fractal.julia.UseComponentMixin
+#
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleCoordinatorMixin
+#
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin
+ # to check that mandatory client interfaces are bound in startFc:
+# org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ # to notify the encapsulated component (if present) when its state
changes:
+# org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
+# ))
+#)
(lifecycle-controller-impl
((org.objectweb.fractal.julia.asm.MixinClassGenerator
LifeCycleControllerImpl
@@ -309,9 +321,15 @@
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin
# to check that mandatory client interfaces are bound in startFc:
org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ # to automatically assign the logger and logger factory:
+ org.objectweb.fractal.julia.BasicInitializableMixin
+ org.objectweb.fractal.julia.logger.LoggerLifeCycleMixin
# to notify the encapsulated component (if present) when its state
changes:
org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
- ))
+ )
+ # optional initialization parameter (monolog configuration file name):
+ (monolog-conf-file monolog.properties)
+ )
)
# LifeCycleController implementation (for composite components only)
Index: gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcAccount.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcAccount.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcAccount.fractal
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,9 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.api.FcAccount">
+ <interface name="account" role="server"
+ signature="org.objectweb.gotm.drink.api.Account" />
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcMixerCoiner.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcMixerCoiner.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcMixerCoiner.fractal
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,9 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.api.FcMixerCoiner">
+ <interface name="mixer-coiner" role="server"
+ signature="org.objectweb.gotm.drink.api.MixerCoiner" />
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcUserCoiner.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcUserCoiner.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/fractal/org/objectweb/gotm/drink/api/FcUserCoiner.fractal
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,9 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.api.FcUserCoiner">
+ <interface name="user-coiner" role="server"
+ signature="org.objectweb.gotm.drink.api.UserCoiner" />
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcApplication.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcApplication.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcApplication.fractal
Fri Nov 19 19:20:19 2004
@@ -0,0 +1,14 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.comp.FcApplication">
+ <component name="FcFractalExplorer"
+ definition="org.objectweb.gotm.drink.comp.FcFractalExplorer"/>
+ <component name="FcDrinkMachine"
+ definition="org.objectweb.gotm.drink.comp.FcDrinkMachine"/>
+
+ <binding client="FcFractalExplorer.fcAppl"
+ server="FcDrinkMachine.component"/>
+</definition>
\ No newline at end of file
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcCoinerComposite.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcCoinerComposite.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcCoinerComposite.fractal
Fri Nov 19 19:20:19 2004
@@ -0,0 +1,20 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.comp.FcCoinerComposite"
+
extends="org.objectweb.gotm.drink.api.FcUserCoiner,org.objectweb.gotm.drink.api.FcMixerCoiner">
+
+ <component name="FcCoiner"
+ definition="org.objectweb.gotm.drink.lib.FcCoinerComponent"/>
+ <component name="FcAccount"
+ definition="org.objectweb.gotm.drink.lib.FcAccountComponent"/>
+
+ <binding client="this.user-coiner"
+ server="FcCoiner.user-coiner"/>
+ <binding client="this.mixer-coiner"
+ server="FcCoiner.mixer-coiner"/>
+ <binding client="FcCoiner.account"
+ server="FcAccount.account"/>
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcDrinkMachine.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcDrinkMachine.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcDrinkMachine.fractal
Fri Nov 19 19:20:19 2004
@@ -0,0 +1,13 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.comp.FcDrinkMachine"
+ extends="org.objectweb.gotm.drink.api.FcUserCoiner">
+ <component name="FcCoinerComposite"
+ definition="org.objectweb.gotm.drink.comp.FcCoinerComposite"/>
+
+ <binding client="this.user-coiner"
+ server="FcCoinerComposite.user-coiner"/>
+</definition>
\ No newline at end of file
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcFractalExplorer.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcFractalExplorer.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/comp/FcFractalExplorer.fractal
Fri Nov 19 19:20:19 2004
@@ -0,0 +1,15 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.comp.FcFractalExplorer">
+ <interface name="fcAppl" role="client"
+ signature="org.objectweb.fractal.api.Component" />
+
+ <content class="BrowserImpl"/>
+
+ <attributes signature="BrowserAttributes">
+ <attribute name="ConfigFiles" value="fractalProperties.xml" />
+ </attributes>
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcAccountComponent.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcAccountComponent.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcAccountComponent.fractal
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,9 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.lib.FcAccountComponent"
+ extends="org.objectweb.gotm.drink.api.FcAccount">
+ <content class="org.objectweb.gotm.drink.lib.AccountComponent"/>
+</definition>
Index:
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcCoinerComponent.fractal
diff -u /dev/null
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcCoinerComponent.fractal:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/fractal/org/objectweb/gotm/drink/lib/FcCoinerComponent.fractal
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,12 @@
+<?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">
+
+<definition name="org.objectweb.gotm.drink.lib.FcCoinerComponent"
+
extends="org.objectweb.gotm.drink.api.FcUserCoiner,org.objectweb.gotm.drink.api.FcMixerCoiner">
+
+ <interface name="account" role="client"
+ signature="org.objectweb.gotm.drink.api.Account"/>
+ <content class="org.objectweb.gotm.drink.lib.CoinerComponent"/>
+</definition>
Index: gotm-drink/src/java/org/objectweb/gotm/drink/api/Account.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/api/Account.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/api/Account.java Fri
Nov 19 19:20:18 2004
@@ -0,0 +1,58 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Account.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.api;
+
+/**
+ * This interface provides the list of methods usually available on an
account.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public interface Account {
+ /** Default interface identifier for the Account interface. */
+ public static final String ACCOUNT = "account";
+
+ /**
+ * Deposit some money on the Account.
+ * @param amount the amount of money to deposit.
+ */
+ public void deposit(Double amount);
+
+ /**
+ * Provides the current value of the Account balance.
+ * @return the current value of the balance.
+ */
+ public Double getBalance();
+
+ /**
+ * Withdraw some money from the Account.
+ * @param amount the amount of money to withdraw.
+ * @throws OperationNotAllowedException this exception is throwed
+ * if amount < getBalance().
+ */
+ public void withdraw(Double amount) throws OperationNotAllowedException;
+}
Index: gotm-drink/src/java/org/objectweb/gotm/drink/api/MixerCoiner.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/api/MixerCoiner.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/api/MixerCoiner.java Fri
Nov 19 19:20:18 2004
@@ -0,0 +1,47 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: MixerCoiner.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.api;
+
+/**
+ * Interface used by the Mixer component.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public interface MixerCoiner {
+ /** Default interface identifier for the MixerCoiner interface. */
+ public static final String MIXER_COINER = "mixer-coiner";
+
+ /**
+ * Notify the coiner to consume the amount of money required the mix the
+ * user's drink.
+ * @param amount the price of the requested drink.
+ * @throws NotEnoughMoneyException this exception is raised if the money
+ * available in the coiner is not enough to mix the requested drink.
+ */
+ public void consumeMoney(Double amount) throws NotEnoughMoneyException ;
+}
Index:
gotm-drink/src/java/org/objectweb/gotm/drink/api/NotEnoughMoneyException.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/api/NotEnoughMoneyException.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/java/org/objectweb/gotm/drink/api/NotEnoughMoneyException.java
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,45 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: NotEnoughMoneyException.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.api;
+
+/**
+ * Exception raised when not enough money is available.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public class NotEnoughMoneyException
+extends Exception
+{
+ /**
+ * Default constructor for the exception
+ * @param msg the cause of the exception.
+ */
+ public NotEnoughMoneyException(String msg) {
+ super(msg);
+ }
+}
Index:
gotm-drink/src/java/org/objectweb/gotm/drink/api/OperationNotAllowedException.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/api/OperationNotAllowedException.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++
gotm-drink/src/java/org/objectweb/gotm/drink/api/OperationNotAllowedException.java
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,45 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: OperationNotAllowedException.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.api;
+
+/**
+ * Exception raised when an operation on an Account is not allowed.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public class OperationNotAllowedException
+extends Exception
+{
+ /**
+ * Default constructor.
+ * @param msg the cause of the exception.
+ */
+ public OperationNotAllowedException(String msg) {
+ super(msg);
+ }
+}
Index: gotm-drink/src/java/org/objectweb/gotm/drink/api/UserCoiner.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/api/UserCoiner.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/api/UserCoiner.java Fri
Nov 19 19:20:18 2004
@@ -0,0 +1,51 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: UserCoiner.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.api;
+
+/**
+ * This interface provides the list of actions available to the user on the
+ * coiner.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public interface UserCoiner {
+ /** Default interface identifier for the UserCoiner interface.*/
+ public static final String USER_COINER ="user-coiner";
+
+ /**
+ * Insert some piece of money in the Coiner.
+ * @param amount the amount of money inserted.
+ */
+ public void insertMoney(Double amount);
+
+ /**
+ * Returns the remaining amount of money in the Coiner.
+ * @return amount of money not used by the coiner.
+ */
+ public Double cancel();
+}
Index: gotm-drink/src/java/org/objectweb/gotm/drink/lib/AccountComponent.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/lib/AccountComponent.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/lib/AccountComponent.java
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,102 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: AccountComponent.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.lib;
+
+import org.objectweb.gotm.drink.api.Account;
+import org.objectweb.gotm.drink.api.OperationNotAllowedException;
+
+/**
+ * <p>Implementation of a simple Account component.</p>
+ * <p>No client interface is required so the <code>clientFc()</code> method
+ * returns <code>new String[0]</code>.</p>
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public class AccountComponent
+extends PrimitiveComponent
+implements Account
+{
+ //
*************************************************************************
+ // Implementation of the PrimitiveComponent class.
+ //
*************************************************************************
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.lib.PrimitiveComponent#clientFc()
+ */
+ protected String[] clientFc() {
+ return new String[0];
+ }
+
+ //
*************************************************************************
+ // Implementation of the Account interface.
+ //
*************************************************************************
+ /** The current value of the Account balance. */
+ private Double balance;
+
+ /**
+ * @param balance The balance to set.
+ */
+ protected final void setBalance(Double balance) {
+ this.balance = balance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.api.Account#getBalance()
+ */
+ public Double getBalance() {
+ return this.balance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.api.Account#deposit(java.lang.Double)
+ */
+ public void deposit(Double amount) {
+ setBalance(new
Double(getBalance().doubleValue()+amount.doubleValue()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.api.Account#withdraw(java.lang.Double)
+ */
+ public void withdraw(Double amount) throws OperationNotAllowedException {
+ if (amount.doubleValue() > getBalance().doubleValue())
+ throw new OperationNotAllowedException("Trying to withdraw " +
+
amount.doubleValue() +
+ "
but current balance=" +
+
getBalance().doubleValue());
+ setBalance(new
Double(getBalance().doubleValue()-amount.doubleValue()));
+ }
+
+ //
*************************************************************************
+ // Implementation of the AccountComponent class.
+ //
*************************************************************************
+ /**
+ * Default Constructor.
+ */
+ public AccountComponent() {
+ setBalance(new Double(0));
+ }
+}
Index: gotm-drink/src/java/org/objectweb/gotm/drink/lib/CoinerComponent.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/lib/CoinerComponent.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/lib/CoinerComponent.java
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,151 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+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.1 of the License, or 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
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: CoinerComponent.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.drink.lib;
+
+import org.objectweb.fractal.api.NoSuchInterfaceException;
+import org.objectweb.gotm.drink.api.Account;
+import org.objectweb.gotm.drink.api.MixerCoiner;
+import org.objectweb.gotm.drink.api.NotEnoughMoneyException;
+import org.objectweb.gotm.drink.api.OperationNotAllowedException;
+import org.objectweb.gotm.drink.api.UserCoiner;
+import org.objectweb.util.monolog.api.BasicLevel;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public class CoinerComponent
+extends PrimitiveComponent
+implements UserCoiner, MixerCoiner
+{
+ //
*************************************************************************
+ // Implementation of the PrimitiveComponent class.
+ //
*************************************************************************
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.lib.PrimitiveComponent#clientFc()
+ */
+ protected String[] clientFc() {
+ return new String[]{Account.ACCOUNT};
+ }
+
+
+ //
*************************************************************************
+ // Implementation of the UserCoiner interface.
+ //
*************************************************************************
+ /** The current amount of money available in the coiner. */
+ private Double amount;
+
+ /**
+ * @return Returns the amount.
+ */
+ protected final Double getAmount() {
+ return amount;
+ }
+
+ /**
+ * @param amount The amount to set.
+ */
+ protected final void setAmount(Double amount) {
+ this.amount = amount;
+ }
+
+ /**
+ * Reset the the value of the coiner to zero.
+ */
+ protected final void resetAmount() {
+ getLogger().log(BasicLevel.DEBUG,"Reseting coiner from " +
+
getAmount().doubleValue() +
+ " to 0
Euro");
+ setAmount(new Double(0));
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.drink.api.UserCoiner#insertMoney(java.lang.Double)
+ */
+ public void insertMoney(Double amount) {
+ getLogger().log(BasicLevel.INFO,"Inserting " +
+
amount.doubleValue() +
+ " Euros in
the coiner...");
+ setAmount(new Double(getAmount().doubleValue() +
amount.doubleValue()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.drink.api.UserCoiner#cancel()
+ */
+ public Double cancel() {
+ Double toCancel = getAmount();
+ getLogger().log(BasicLevel.INFO,"Cancelling " +
+
toCancel.doubleValue() +
+ " Euros from the
coiner...");
+ resetAmount();
+ return toCancel;
+ }
+
+
+ //
*************************************************************************
+ // Implementation of the UserCoiner interface.
+ //
*************************************************************************
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.drink.api.MixerCoiner#consumeMoney(java.lang.Double)
+ */
+ public void consumeMoney(Double amount) throws NotEnoughMoneyException {
+ if (amount.doubleValue() > getAmount().doubleValue())
+ throw new NotEnoughMoneyException("Only " +
+
getAmount().doubleValue() +
+ " Euros
available");
+
+ getLogger().log(BasicLevel.INFO,"Consuming " +
+
amount.doubleValue() +
+ " Euros in
the coiner...");
+ setAmount(new Double(getAmount().doubleValue() -
amount.doubleValue()));
+
+ try {
+ Account account = (Account) lookupFc(Account.ACCOUNT);
+ account.withdraw(amount);
+ } catch (NoSuchInterfaceException e) {
+ getLogger().log(BasicLevel.ERROR,
+ "lookupFc(Account.ACCOUNT) failed",
+ e);
+ } catch (OperationNotAllowedException e) {
+ getLogger().log(BasicLevel.ERROR,
+ "withdraw(amount) failed",
+ e);
+ }
+ }
+
+
+ //
*************************************************************************
+ // Implementation of the CoinerComponent class.
+ //
*************************************************************************
+ /**
+ * Default Constructor.
+ */
+ public CoinerComponent() {
+ setAmount(new Double(0));
+ }
+}
Index:
gotm-drink/src/java/org/objectweb/gotm/drink/lib/PrimitiveComponent.java
diff -u /dev/null
gotm-drink/src/java/org/objectweb/gotm/drink/lib/PrimitiveComponent.java:1.1
--- /dev/null Fri Nov 19 19:20:19 2004
+++ gotm-drink/src/java/org/objectweb/gotm/drink/lib/PrimitiveComponent.java
Fri Nov 19 19:20:18 2004
@@ -0,0 +1,173 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ 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.1 of the License, or 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
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: PrimitiveComponent.java,v 1.1 2004/11/19 18:20:18 rouvoy Exp $
+ ====================================================================*/
+package org.objectweb.gotm.drink.lib;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.fractal.api.NoSuchInterfaceException;
+import org.objectweb.fractal.api.control.BindingController;
+import org.objectweb.fractal.api.control.IllegalBindingException;
+import org.objectweb.fractal.api.control.IllegalLifeCycleException;
+import org.objectweb.util.monolog.api.Loggable;
+import org.objectweb.util.monolog.api.Logger;
+import org.objectweb.util.monolog.api.LoggerFactory;
+
+/**
+ * <p>This class represent an abstract fractal component without any
behaviour.
+ * It just implements the main interfaces required by the Fractal component
+ * model.</p>
+ * <p>The <code>Loggable</code> interface is implemented to provide to the
+ * component a preconfigured logger.</p>
+ * <p>The <code>BindingController</code> interface is implemented to support
the
+ * binding of client interfaces to the current component. The clientFc()
method
+ * must be implemented to provide the list of supported client
interfaces.</p>
+ *
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version 0.1
+ */
+public abstract class PrimitiveComponent
+implements Loggable, BindingController
+{
+ //
*************************************************************************
+ // Implementation of the Loggable Interface
+ //
*************************************************************************
+ /** The Component Logger. */
+ private Logger logger ;
+ /** LoggerFactory provided for the Component (optional). */
+ private LoggerFactory factory;
+
+ /* (non-Javadoc)
+ * @see org.objectweb.util.monolog.api.Loggable#getLogger()
+ */
+ public final Logger getLogger() {
+ return this.logger;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.util.monolog.api.Loggable#setLogger(org.objectweb.util.monolog.api.Logger)
+ */
+ public final void setLogger(Logger log) {
+ this.logger = log;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.util.monolog.api.Loggable#getLoggerFactory()
+ */
+ public final LoggerFactory getLoggerFactory() {
+ return this.factory;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.util.monolog.api.Loggable#setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory)
+ */
+ public final void setLoggerFactory(LoggerFactory arg0) {
+ this.factory = arg0;
+ }
+
+
+ //
*************************************************************************
+ // Implementation of the BindingController Interface
+ //
*************************************************************************
+ /** The list of client interfaces currently bound to the component. */
+ private final Map fcBindings ;
+
+ /**
+ * @return Returns the fcBindings.
+ */
+ private final Map getFcBindings() {
+ return this.fcBindings;
+ }
+
+ /**
+ * Provides the list of static client interfaces allowed by the
component.
+ * @return the list of static interfaces.
+ */
+ protected abstract String[] clientFc();
+
+ /**
+ * Checks if the interface name is allowed to be binded.
+ * @param name the interface to check.
+ * @return the name of the allowed interface.
+ * @throws NoSuchInterfaceException if the interface is unknown.
+ */
+ private final String checkBinding(String name)
+ throws NoSuchInterfaceException
+ {
+ String[] list = clientFc();
+ for (int i=0 ; i < list.length ; i++)
+ if (name.startsWith(list[i]))
+ return name ;
+ throw new NoSuchInterfaceException(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.fractal.api.control.BindingController#listFc()
+ */
+ public String[] listFc() {
+ return (String[]) getFcBindings().keySet().toArray(new String[0]);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.fractal.api.control.BindingController#lookupFc(java.lang.String)
+ */
+ public Object lookupFc(String arg0)
+ throws NoSuchInterfaceException
+ {
+ return getFcBindings().get(checkBinding(arg0));
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.fractal.api.control.BindingController#bindFc(java.lang.String,
java.lang.Object)
+ */
+ public void bindFc(String arg0, Object arg1)
+ throws NoSuchInterfaceException, IllegalBindingException,
IllegalLifeCycleException
+ {
+ getFcBindings().put(checkBinding(arg0),arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.fractal.api.control.BindingController#unbindFc(java.lang.String)
+ */
+ public void unbindFc(String arg0)
+ throws NoSuchInterfaceException, IllegalBindingException,
IllegalLifeCycleException
+ {
+ getFcBindings().remove(checkBinding(arg0));
+ }
+
+
+ //
*************************************************************************
+ // Implementation of the PrimitiveComponent Class
+ //
*************************************************************************
+ /**
+ * Default constructor of the primitive component.
+ */
+ protected PrimitiveComponent() {
+ this.fcBindings = new HashMap();
+ }
+}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.