bdi4jade

Changes

Details

diff --git a/bdi-jade/src/bdi4jade/annotation/Parameter.java b/bdi-jade/src/bdi4jade/annotation/Parameter.java
index 16e70b3..ac690b1 100644
--- a/bdi-jade/src/bdi4jade/annotation/Parameter.java
+++ b/bdi-jade/src/bdi4jade/annotation/Parameter.java
@@ -30,16 +30,19 @@ import java.lang.annotation.Target;
 
 /**
  * @author ingrid
- *
+ * 
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
+@Target(ElementType.METHOD)
 public @interface Parameter {
 
-	public enum Direction { IN, OUT, INOUT };
+	public enum Direction {
+		IN, INOUT, OUT
+	};
 
 	Direction direction() default Direction.IN;
+
 	boolean mandatory() default false;
-	
+
 }
diff --git a/bdi-jade/src/bdi4jade/core/Intention.java b/bdi-jade/src/bdi4jade/core/Intention.java
index 88991c7..688c6d5 100644
--- a/bdi-jade/src/bdi4jade/core/Intention.java
+++ b/bdi-jade/src/bdi4jade/core/Intention.java
@@ -263,7 +263,7 @@ public class Intention {
 			EndState endState = this.currentPlan.getEndState();
 			if (EndState.FAILED.equals(endState)) {
 				return GoalStatus.PLAN_FAILED;
-			} else if (EndState.SUCCESSFUL.equals(endState)) {
+			} else if (EndState.SUCCESSFULL.equals(endState)) {
 				return GoalStatus.ACHIEVED;
 			} else {
 				return GoalStatus.TRYING_TO_ACHIEVE;
diff --git a/bdi-jade/src/bdi4jade/exception/GoalParameterException.java b/bdi-jade/src/bdi4jade/exception/GoalParameterException.java
new file mode 100644
index 0000000..291c19b
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/exception/GoalParameterException.java
@@ -0,0 +1,71 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011  Ingrid Nunes
+// 
+// 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 (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
+// 
+// To contact the authors:
+// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.exception;
+
+/**
+ * @author Ingrid Nunes
+ * 
+ */
+public class GoalParameterException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Creates a new instance of GoalParameterException.
+	 */
+	public GoalParameterException() {
+	}
+
+	/**
+	 * Creates a new instance of GoalParameterException.
+	 * 
+	 * @param _message
+	 *            the message to show.
+	 */
+	public GoalParameterException(final String _message) {
+		super(_message);
+	}
+
+	/**
+	 * Creates a new instance of GoalParameterException.
+	 * 
+	 * @param _message
+	 *            the message to show.
+	 * @param _cause
+	 *            the exception that caused this exception.
+	 */
+	public GoalParameterException(final String _message, final Throwable _cause) {
+		super(_message, _cause);
+	}
+
+	/**
+	 * Creates a new instance of GoalParameterException.
+	 * 
+	 * @param _cause
+	 *            the exception that caused this exception.
+	 */
+	public GoalParameterException(final Throwable _cause) {
+		super(_cause);
+	}
+
+}
diff --git a/bdi-jade/src/bdi4jade/plan/Plan.java b/bdi-jade/src/bdi4jade/plan/Plan.java
index 88db798..849b1fd 100644
--- a/bdi-jade/src/bdi4jade/plan/Plan.java
+++ b/bdi-jade/src/bdi4jade/plan/Plan.java
@@ -43,7 +43,7 @@ public interface Plan extends MetadataElement {
 	 * @author ingrid
 	 */
 	public enum EndState {
-		FAILED, SUCCESSFUL;
+		FAILED, SUCCESSFULL;
 	}
 
 	/**
diff --git a/bdi-jade/src/bdi4jade/util/plan/BeliefGoalPlanBody.java b/bdi-jade/src/bdi4jade/util/plan/BeliefGoalPlanBody.java
index c446745..6b5784a 100644
--- a/bdi-jade/src/bdi4jade/util/plan/BeliefGoalPlanBody.java
+++ b/bdi-jade/src/bdi4jade/util/plan/BeliefGoalPlanBody.java
@@ -46,7 +46,7 @@ public abstract class BeliefGoalPlanBody extends AbstractPlanBody {
 	protected boolean isGoalAchieved() {
 		BeliefGoal goal = (BeliefGoal) getGoal();
 		if (goal.isAchieved(getBeliefBase())) {
-			setEndState(EndState.SUCCESSFUL);
+			setEndState(EndState.SUCCESSFULL);
 			return true;
 		}
 		return false;
diff --git a/bdi-jade/src/bdi4jade/util/plan/ParallelGoalPlanBody.java b/bdi-jade/src/bdi4jade/util/plan/ParallelGoalPlanBody.java
index 4a3329a..d572e63 100644
--- a/bdi-jade/src/bdi4jade/util/plan/ParallelGoalPlanBody.java
+++ b/bdi-jade/src/bdi4jade/util/plan/ParallelGoalPlanBody.java
@@ -72,7 +72,7 @@ public class ParallelGoalPlanBody extends AbstractPlanBody implements
 					this.completedGoals.add(goalEvent.getGoal());
 					log.debug("Goal " + goalEvent.getGoal() + " completed!");
 					if (completedGoals.size() == parallelGoal.getGoals().size()) {
-						setEndState(EndState.SUCCESSFUL);
+						setEndState(EndState.SUCCESSFULL);
 						log.debug("All goals completed.");
 					}
 				} else {
diff --git a/bdi-jade/src/bdi4jade/util/plan/SequentialGoalPlanBody.java b/bdi-jade/src/bdi4jade/util/plan/SequentialGoalPlanBody.java
index 61fb1f6..19e3722 100644
--- a/bdi-jade/src/bdi4jade/util/plan/SequentialGoalPlanBody.java
+++ b/bdi-jade/src/bdi4jade/util/plan/SequentialGoalPlanBody.java
@@ -29,12 +29,15 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import bdi4jade.annotation.Parameter;
 import bdi4jade.event.GoalFinishedEvent;
+import bdi4jade.exception.GoalParameterException;
 import bdi4jade.goal.Goal;
 import bdi4jade.goal.GoalStatus;
 import bdi4jade.plan.AbstractPlanBody;
 import bdi4jade.plan.OutputPlanBody;
 import bdi4jade.plan.Plan.EndState;
+import bdi4jade.util.ReflectionUtils;
 import bdi4jade.util.goal.SequentialGoal;
 
 /**
@@ -67,13 +70,20 @@ public class SequentialGoalPlanBody extends AbstractPlanBody implements
 	public void action() {
 		if (this.currentGoal == null) {
 			if (!it.hasNext()) {
-				setEndState(EndState.SUCCESSFUL);
+				setEndState(EndState.SUCCESSFULL);
 				log.debug("All goals completed.");
 			} else {
 				this.currentGoal = it.next();
 				if (!this.completedGoals.isEmpty()) {
-					setNextGoal(this.completedGoals.get(this.completedGoals
-							.size() - 1), this.currentGoal);
+					try {
+						setNextGoal(this.completedGoals.get(this.completedGoals
+								.size() - 1), this.currentGoal);
+					} catch (GoalParameterException gpe) {
+						log.error(gpe);
+						gpe.printStackTrace();
+						setEndState(EndState.FAILED);
+						return;
+					}
 				}
 				dispatchSubgoalAndListen(currentGoal);
 				log.debug("Dispatching goal: " + currentGoal);
@@ -120,15 +130,21 @@ public class SequentialGoalPlanBody extends AbstractPlanBody implements
 
 	/**
 	 * Sets the parameters of the next goal to be executed based on the previous
-	 * goal execution. This is an empty place holder for subclasses.
+	 * goal execution. It should be overridden by subclass of goals are not
+	 * annotated with the {@link Parameter} annotation.
 	 * 
 	 * @param previousGoal
 	 *            the previously executed goal.
 	 * @param goal
 	 *            the goal that is going to be dispatched.
+	 * 
+	 * @throws a
+	 *             @{@link GoalParameterException} if an error occurred during
+	 *             setting up the next goal.
 	 */
-	protected void setNextGoal(Goal previousGoal, Goal goal) {
-
+	protected void setNextGoal(Goal previousGoal, Goal goal)
+			throws GoalParameterException {
+		ReflectionUtils.setupParameters(previousGoal, goal);
 	}
 
 }
diff --git a/bdi-jade/src/bdi4jade/util/ReflectionUtils.java b/bdi-jade/src/bdi4jade/util/ReflectionUtils.java
new file mode 100644
index 0000000..796cf28
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/util/ReflectionUtils.java
@@ -0,0 +1,140 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011  Ingrid Nunes
+// 
+// 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 (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
+// 
+// To contact the authors:
+// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.util;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import bdi4jade.annotation.Parameter;
+import bdi4jade.annotation.Parameter.Direction;
+import bdi4jade.exception.GoalParameterException;
+import bdi4jade.goal.Goal;
+
+/**
+ * @author Ingrid Nunes
+ * 
+ */
+public abstract class ReflectionUtils {
+
+	private static final String GETTER_PREFIX = "get";
+	private static final Log log = LogFactory.getLog(ReflectionUtils.class);
+	private static final String SETTER_PREFIX = "set";
+
+	private static void checkSkipIsOK(Parameter parameter, String msg,
+			Exception cause) throws GoalParameterException {
+		if (parameter.mandatory()) {
+			GoalParameterException exc = new GoalParameterException(msg, cause);
+			log.warn(exc);
+			throw exc;
+		}
+	}
+
+	protected static boolean isGetter(Method method) {
+		if (!method.getName().startsWith(GETTER_PREFIX))
+			return false;
+		if (method.getParameterTypes().length != 0)
+			return false;
+		if (void.class.equals(method.getReturnType()))
+			return false;
+		return true;
+	}
+
+	protected static boolean isSetter(Method method) {
+		if (!method.getName().startsWith(SETTER_PREFIX))
+			return false;
+		if (method.getParameterTypes().length != 1)
+			return false;
+		if (!void.class.equals(method.getReturnType()))
+			return false;
+		return true;
+	}
+
+	protected static String methodToPropertyName(String prefix, Method method) {
+		String property = method.getName().substring(prefix.length());
+		return property.substring(0, 1).toLowerCase() + property.substring(1);
+	}
+
+	protected static String propertyToMethodName(String prefix, String property) {
+		return prefix + property.substring(0, 1).toUpperCase()
+				+ property.substring(1);
+	}
+
+	public static void setupParameters(Goal goalOut, Goal goalIn)
+			throws GoalParameterException {
+		for (Method method : goalIn.getClass().getMethods()) {
+			if (method.isAnnotationPresent(Parameter.class)) {
+				Parameter parameter = method.getAnnotation(Parameter.class);
+
+				if (Direction.OUT.equals(parameter.direction())) {
+					continue;
+				}
+				if (!isGetter(method)) {
+					checkSkipIsOK(parameter, "Method " + method
+							+ " should be a getter.", null);
+					continue;
+				}
+				String property = methodToPropertyName(GETTER_PREFIX, method);
+
+				Method setter = null;
+				try {
+					setter = goalIn.getClass().getMethod(
+							propertyToMethodName(SETTER_PREFIX, property),
+							method.getReturnType());
+				} catch (NoSuchMethodException nsme) {
+					checkSkipIsOK(parameter,
+							"There is no setter method associated with property "
+									+ property, nsme);
+					continue;
+				}
+
+				Method getter = null;
+				try {
+					getter = goalOut.getClass().getMethod(
+							propertyToMethodName(GETTER_PREFIX, property));
+					if (!getter.isAnnotationPresent(Parameter.class)
+							|| Direction.IN.equals(getter.getAnnotation(
+									Parameter.class).direction())) {
+						checkSkipIsOK(parameter,
+								"There is no output parameter associated with method "
+										+ method + " name " + property, null);
+						continue;
+					}
+				} catch (NoSuchMethodException nsme) {
+					checkSkipIsOK(parameter,
+							"There is no getter method associated with property "
+									+ property, nsme);
+					continue;
+				}
+
+				try {
+					setter.invoke(goalIn, getter.invoke(goalOut));
+				} catch (Exception exc) {
+					checkSkipIsOK(parameter, "An unknown error occurrred.", exc);
+				}
+			}
+		}
+	}
+
+}
diff --git a/bdi-jade-test/APDescription.txt b/bdi-jade-test/APDescription.txt
index 398983c..f5daa80 100644
--- a/bdi-jade-test/APDescription.txt
+++ b/bdi-jade-test/APDescription.txt
@@ -1 +1 @@
-( ap-description  :name "192.168.0.2:1099/JADE" :ap-services (set ( ap-service  :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://ingrid-asus:7778/acc))))
+( ap-description  :name "143.54.13.160:1099/JADE" :ap-services (set ( ap-service  :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://IngridNunes-PC.inf.ufrgs.br:7778/acc))))
diff --git a/bdi-jade-test/MTPs-Main-Container.txt b/bdi-jade-test/MTPs-Main-Container.txt
index 6b6c35d..08cdd31 100644
--- a/bdi-jade-test/MTPs-Main-Container.txt
+++ b/bdi-jade-test/MTPs-Main-Container.txt
@@ -1 +1 @@
-http://ingrid-asus:7778/acc
+http://IngridNunes-PC.inf.ufrgs.br:7778/acc
diff --git a/bdi-jade-test/src/bdi4jade/examples/BDIAgent1.java b/bdi-jade-test/src/bdi4jade/examples/BDIAgent1.java
index 0a6d854..ccff86b 100644
--- a/bdi-jade-test/src/bdi4jade/examples/BDIAgent1.java
+++ b/bdi-jade-test/src/bdi4jade/examples/BDIAgent1.java
@@ -23,7 +23,7 @@
 package bdi4jade.examples;
 
 import bdi4jade.core.BDIAgent;
-import bdi4jade.examples.blocksworld.BlocksWorldCapability;
+import bdi4jade.examples.compositegoal.CompositeGoalCapability;
 
 /**
  * @author ingrid
@@ -36,12 +36,12 @@ public class BDIAgent1 extends BDIAgent {
 
 	@Override
 	protected void init() {
-		this.addCapability(new BlocksWorldCapability());
+		// this.addCapability(new BlocksWorldCapability());
 		// this.addCapability(new PlanFailedCapability());
 		// this.addCapability(new SubgoalCapability());
 		// this.addCapability(new PingPongCapability(BDIAgent1.MY_NAME,
 		// BDIAgent2.MY_NAME));
-		// this.addCapability(new CompositeGoalCapability(true));
+		this.addCapability(new CompositeGoalCapability(true));
 		// this.addCapability(new CompositeGoalCapability(false));
 	}
 }
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
index ca8bb89..78ef183 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
@@ -73,7 +73,7 @@ public class PerformMovePlanBody extends AbstractPlanBody {
 		onSet.addValue(new On(thing1, thing2));
 		log.debug(new On(thing1, thing2));
 
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 	@Override
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
index fec122a..8cbe5e6 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
@@ -68,7 +68,7 @@ public class TopLevelPlanBody extends AbstractPlanBody {
 		counter++;
 
 		if (counter > target.length)
-			setEndState(EndState.SUCCESSFUL);
+			setEndState(EndState.SUCCESSFULL);
 	}
 
 	@Override
diff --git a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
index 697438a..99d4360 100644
--- a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
@@ -28,6 +28,8 @@ import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import bdi4jade.annotation.Parameter;
+import bdi4jade.annotation.Parameter.Direction;
 import bdi4jade.core.BeliefBase;
 import bdi4jade.core.Capability;
 import bdi4jade.core.PlanLibrary;
@@ -47,16 +49,67 @@ import bdi4jade.util.goal.SequentialGoal;
  */
 public class CompositeGoalCapability extends Capability implements GoalListener {
 
-	class MyGoal1 implements Goal {
+	public class MyGoal1 implements Goal {
 		private static final long serialVersionUID = 3405041038738876061L;
+
+		private String msg;
+
+		public MyGoal1(String msg) {
+			this.msg = msg;
+		}
+
+		@Parameter(direction = Direction.OUT)
+		public String getMsg() {
+			return msg;
+		}
+
+		@Override
+		public String toString() {
+			return getClass().getSimpleName() + ": " + msg;
+		}
+
 	};
 
-	class MyGoal2 implements Goal {
+	public class MyGoal2 implements Goal {
 		private static final long serialVersionUID = 3405041038738876061L;
+
+		private String message;
+
+		@Parameter(direction = Direction.INOUT)
+		public String getMsg() {
+			return message;
+		}
+
+		public void setMsg(String msg) {
+			this.message = msg;
+		}
+
+		@Override
+		public String toString() {
+			return getClass().getSimpleName() + ": " + message;
+		}
+
 	};
 
-	class MyGoal3 implements Goal {
+	public class MyGoal3 implements Goal {
 		private static final long serialVersionUID = 3405041038738876061L;
+
+		private String msg;
+
+		@Parameter(direction = Direction.IN)
+		public String getMsg() {
+			return msg;
+		}
+
+		public void setMsg(String msg) {
+			this.msg = msg;
+		}
+
+		@Override
+		public String toString() {
+			return getClass().getSimpleName() + ": " + msg;
+		}
+
 	};
 
 	private static final Log log = LogFactory
@@ -94,7 +147,8 @@ public class CompositeGoalCapability extends Capability implements GoalListener 
 
 	@Override
 	protected void setup() {
-		Goal[] goals = { new MyGoal1(), new MyGoal2(), new MyGoal3() };
+		Goal[] goals = { new MyGoal1("Hello World!"), new MyGoal2(),
+				new MyGoal3() };
 		CompositeGoal compositeGoal = null;
 		if (this.sequential) {
 			compositeGoal = new SequentialGoal(goals);
diff --git a/bdi-jade-test/src/bdi4jade/examples/compositegoal/MyPlan.java b/bdi-jade-test/src/bdi4jade/examples/compositegoal/MyPlan.java
index f66d277..46adf49 100644
--- a/bdi-jade-test/src/bdi4jade/examples/compositegoal/MyPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/compositegoal/MyPlan.java
@@ -27,8 +27,8 @@ import java.util.Random;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import bdi4jade.plan.Plan.EndState;
 import bdi4jade.plan.AbstractPlanBody;
+import bdi4jade.plan.Plan.EndState;
 
 /**
  * @author ingrid
@@ -43,8 +43,8 @@ public class MyPlan extends AbstractPlanBody {
 	public void action() {
 		long random = new Random().nextLong();
 		log.info("Random: " + random);
-		if (random % 3 != 0)
-			setEndState(EndState.SUCCESSFUL);
+		if (random % 10 != 0)
+			setEndState(EndState.SUCCESSFULL);
 		else
 			setEndState(EndState.FAILED);
 		log.info(getGoal() + " Plan#" + getPlan().getId() + " EndState: "
diff --git a/bdi-jade-test/src/bdi4jade/examples/helloworld/HelloWorldPlan.java b/bdi-jade-test/src/bdi4jade/examples/helloworld/HelloWorldPlan.java
index db0033b..cd87a05 100644
--- a/bdi-jade-test/src/bdi4jade/examples/helloworld/HelloWorldPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/helloworld/HelloWorldPlan.java
@@ -36,7 +36,7 @@ public class HelloWorldPlan extends AbstractPlanBody {
 	public void action() {
 		System.out.println("Hello, " + ((HelloWorldGoal) getGoal()).getName()
 				+ "!");
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 }
diff --git a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/SuccessPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/SuccessPlanBody.java
index 513667e..fa93dcb 100644
--- a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/SuccessPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/SuccessPlanBody.java
@@ -36,7 +36,7 @@ public class SuccessPlanBody extends AbstractPlanBody {
 
 	public void action() {
 		log.info(this.getClass().getSimpleName() + " executed.");
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 	public void onStart() {
diff --git a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/TestPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/TestPlanBody.java
index 3f690cf..0de61e4 100644
--- a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/TestPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/TestPlanBody.java
@@ -126,7 +126,7 @@ public class TestPlanBody extends AbstractPlanBody {
 		}
 
 		if (TestStep.COMPLETED.equals(step))
-			setEndState(EndState.SUCCESSFUL);
+			setEndState(EndState.SUCCESSFULL);
 	}
 
 	public void onStart() {
diff --git a/bdi-jade-test/src/bdi4jade/examples/ping/PingPlan.java b/bdi-jade-test/src/bdi4jade/examples/ping/PingPlan.java
index c5c663a..a9a2395 100644
--- a/bdi-jade-test/src/bdi4jade/examples/ping/PingPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/ping/PingPlan.java
@@ -69,7 +69,7 @@ public class PingPlan extends AbstractPlanBody {
 				log.info("Content: " + reply.getContent());
 				counter++;
 				if (counter == times) {
-					setEndState(EndState.SUCCESSFUL);
+					setEndState(EndState.SUCCESSFULL);
 				} else {
 					this.sent = false;
 				}
diff --git a/bdi-jade-test/src/bdi4jade/examples/ping/PongPlan.java b/bdi-jade-test/src/bdi4jade/examples/ping/PongPlan.java
index ed2b343..6af3732 100644
--- a/bdi-jade-test/src/bdi4jade/examples/ping/PongPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/ping/PongPlan.java
@@ -50,7 +50,7 @@ public class PongPlan extends AbstractPlanBody {
 		reply.setContent(PingPongCapability.PONG);
 		this.myAgent.send(reply);
 		log.info("Pong sent to agent" + pingMsg.getSender().getName() + "!");
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 	@Override
diff --git a/bdi-jade-test/src/bdi4jade/examples/planfailed/MyPlan.java b/bdi-jade-test/src/bdi4jade/examples/planfailed/MyPlan.java
index 6faf431..33408e4 100644
--- a/bdi-jade-test/src/bdi4jade/examples/planfailed/MyPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/planfailed/MyPlan.java
@@ -44,7 +44,7 @@ public class MyPlan extends AbstractPlanBody {
 		long random = new Random().nextLong();
 		log.info("Random: " + random);
 		if (random % 3 == 0)
-			setEndState(EndState.SUCCESSFUL);
+			setEndState(EndState.SUCCESSFULL);
 		else
 			setEndState(EndState.FAILED);
 		log.info(getGoal() + " Plan#" + getPlan().getId() + " EndState: "
diff --git a/bdi-jade-test/src/bdi4jade/examples/planselection/TransportationPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/planselection/TransportationPlanBody.java
index bf3e18a..2b46447 100644
--- a/bdi-jade-test/src/bdi4jade/examples/planselection/TransportationPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/planselection/TransportationPlanBody.java
@@ -127,7 +127,7 @@ public class TransportationPlanBody extends AbstractPlanBody {
 		this.satisfaction.addValue(this.satisfaction.getCount() + 1,
 				satisfaction);
 		log.debug("Plan finished!");
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 	@SuppressWarnings("unchecked")
diff --git a/bdi-jade-test/src/bdi4jade/examples/subgoal/MyPlan.java b/bdi-jade-test/src/bdi4jade/examples/subgoal/MyPlan.java
index 99d21e0..cd89325 100644
--- a/bdi-jade-test/src/bdi4jade/examples/subgoal/MyPlan.java
+++ b/bdi-jade-test/src/bdi4jade/examples/subgoal/MyPlan.java
@@ -45,7 +45,7 @@ public class MyPlan extends AbstractPlanBody {
 		counter++;
 
 		if (counter >= 10) {
-			setEndState(EndState.SUCCESSFUL);
+			setEndState(EndState.SUCCESSFULL);
 		}
 	}
 
diff --git a/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan1Body.java b/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan1Body.java
index a5721aa..5fa91ca 100644
--- a/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan1Body.java
+++ b/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan1Body.java
@@ -36,7 +36,7 @@ public class MyPlan1Body extends AbstractPlanBody {
 	@Override
 	public void action() {
 		// TODO Auto-generated method stub
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 }
diff --git a/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan2Body.java b/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan2Body.java
index a0891df..7822dca 100644
--- a/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan2Body.java
+++ b/bdi-jade-test/src/bdi4jade/examples/template/plan/MyPlan2Body.java
@@ -36,7 +36,7 @@ public class MyPlan2Body extends AbstractPlanBody {
 	@Override
 	public void action() {
 		// TODO Auto-generated method stub
-		setEndState(EndState.SUCCESSFUL);
+		setEndState(EndState.SUCCESSFULL);
 	}
 
 }