bdi4jade

Details

diff --git a/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java b/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
index 8dd8548..076c9a1 100644
--- a/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
+++ b/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
@@ -267,8 +267,8 @@ public abstract class AbstractBDIAgent extends Agent implements BDIAgent {
 	 *      bdi4jade.goal.Goal)
 	 */
 	@Override
-	public final void addGoal(Capability dispatcher, Goal goal) {
-		addIntention(dispatcher, goal, null);
+	public final boolean addGoal(Capability dispatcher, Goal goal) {
+		return addIntention(dispatcher, goal, null) == null ? false : true;
 	}
 
 	/**
@@ -276,17 +276,18 @@ public abstract class AbstractBDIAgent extends Agent implements BDIAgent {
 	 *      bdi4jade.goal.Goal, bdi4jade.event.GoalListener)
 	 */
 	@Override
-	public final void addGoal(Capability dispatcher, Goal goal,
+	public final boolean addGoal(Capability dispatcher, Goal goal,
 			GoalListener goalListener) {
-		addIntention(dispatcher, goal, goalListener);
+		return addIntention(dispatcher, goal, goalListener) == null ? false
+				: true;
 	}
 
 	/**
 	 * @see bdi4jade.core.BDIAgent#addGoal(bdi4jade.goal.Goal)
 	 */
 	@Override
-	public final void addGoal(Goal goal) {
-		addIntention(null, goal, null);
+	public final boolean addGoal(Goal goal) {
+		return addIntention(null, goal, null) == null ? false : true;
 	}
 
 	/**
@@ -294,8 +295,8 @@ public abstract class AbstractBDIAgent extends Agent implements BDIAgent {
 	 *      bdi4jade.event.GoalListener)
 	 */
 	@Override
-	public final void addGoal(Goal goal, GoalListener goalListener) {
-		addIntention(null, goal, goalListener);
+	public final boolean addGoal(Goal goal, GoalListener goalListener) {
+		return addIntention(null, goal, goalListener) == null ? false : true;
 	}
 
 	/**
diff --git a/bdi-jade/src/bdi4jade/core/BDIAgent.java b/bdi-jade/src/bdi4jade/core/BDIAgent.java
index 3f2868a..1ee1559 100644
--- a/bdi-jade/src/bdi4jade/core/BDIAgent.java
+++ b/bdi-jade/src/bdi4jade/core/BDIAgent.java
@@ -51,8 +51,10 @@ public interface BDIAgent {
 	 *            the capability that dispatched this goal.
 	 * @param goal
 	 *            the goal to be achieved.
+	 * 
+	 * @return true if the goal was added, false otherwise.
 	 */
-	public void addGoal(Capability dispatcher, Goal goal);
+	public boolean addGoal(Capability dispatcher, Goal goal);
 
 	/**
 	 * Adds a new goal to this agent to be achieved and adds a listener to
@@ -64,8 +66,10 @@ public interface BDIAgent {
 	 *            the goal to be achieved.
 	 * @param goalListener
 	 *            the listener to be notified about this goal events.
+	 * 
+	 * @return true if the goal was added, false otherwise.
 	 */
-	public void addGoal(Capability dispatcher, Goal goal,
+	public boolean addGoal(Capability dispatcher, Goal goal,
 			GoalListener goalListener);
 
 	/**
@@ -73,8 +77,10 @@ public interface BDIAgent {
 	 * 
 	 * @param goal
 	 *            the goal to be achieved.
+	 * 
+	 * @return true if the goal was added, false otherwise.
 	 */
-	public void addGoal(Goal goal);
+	public boolean addGoal(Goal goal);
 
 	/**
 	 * Adds a new goal to this agent to be achieved and adds a listener to
@@ -84,8 +90,10 @@ public interface BDIAgent {
 	 *            the goal to be achieved.
 	 * @param goalListener
 	 *            the listener to be notified.
+	 * 
+	 * @return true if the goal was added, false otherwise.
 	 */
-	public void addGoal(Goal goal, GoalListener goalListener);
+	public boolean addGoal(Goal goal, GoalListener goalListener);
 
 	/**
 	 * Adds a listener to be notified when about goal events.
diff --git a/bdi-jade/src/bdi4jade/core/Intention.java b/bdi-jade/src/bdi4jade/core/Intention.java
index dec4efd..63ef69e 100644
--- a/bdi-jade/src/bdi4jade/core/Intention.java
+++ b/bdi-jade/src/bdi4jade/core/Intention.java
@@ -122,7 +122,7 @@ public class Intention {
 					throw new IllegalAccessException("Capability " + dispatcher
 							+ " has no access to goal "
 							+ goal.getClass().getName() + " of capability "
-							+ owner.getClass().getName());
+							+ owner.capability().getName());
 				}
 			}
 		}
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
index ea92b8e..fd800b6 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
@@ -75,31 +75,35 @@ public abstract class AbstractPlanBody extends Behaviour implements PlanBody {
 	/**
 	 * @see PlanBody#dispatchGoal(Goal)
 	 */
-	public void dispatchGoal(Goal goal) {
-		this.intention.getMyAgent().addGoal(
+	public boolean dispatchGoal(Goal goal) {
+		return this.intention.getMyAgent().addGoal(
 				this.plan.getPlanLibrary().getCapability(), goal);
 	}
 
 	/**
 	 * @see PlanBody#dispatchSubgoal(Goal)
 	 */
-	public void dispatchSubgoal(Goal subgoal) {
-		this.intention.getMyAgent().addGoal(
+	public boolean dispatchSubgoal(Goal subgoal) {
+		boolean goalAdded = this.intention.getMyAgent().addGoal(
 				this.plan.getPlanLibrary().getCapability(), subgoal);
 		synchronized (subgoals) {
-			this.subgoals.add(subgoal);
+			if (goalAdded)
+				this.subgoals.add(subgoal);
 		}
+		return goalAdded;
 	}
 
 	/**
 	 * @see PlanBody#dispatchSubgoalAndListen(Goal)
 	 */
-	public void dispatchSubgoalAndListen(Goal subgoal) {
-		this.intention.getMyAgent().addGoal(
+	public boolean dispatchSubgoalAndListen(Goal subgoal) {
+		boolean goalAdded = this.intention.getMyAgent().addGoal(
 				this.plan.getPlanLibrary().getCapability(), subgoal, this);
 		synchronized (subgoals) {
-			this.subgoals.add(subgoal);
+			if (goalAdded)
+				this.subgoals.add(subgoal);
 		}
+		return goalAdded;
 	}
 
 	/**
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
index 9b018ac..8c564ab 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
@@ -54,16 +54,16 @@ public class FSMPlanBody extends FSMBehaviour implements PlanBody {
 		};
 	}
 
-	public void dispatchGoal(Goal goal) {
-		abstractPlanBody.dispatchGoal(goal);
+	public boolean dispatchGoal(Goal goal) {
+		return abstractPlanBody.dispatchGoal(goal);
 	}
 
-	public void dispatchSubgoal(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoal(subgoal);
+	public boolean dispatchSubgoal(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoal(subgoal);
 	}
 
-	public void dispatchSubgoalAndListen(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoalAndListen(subgoal);
+	public boolean dispatchSubgoalAndListen(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoalAndListen(subgoal);
 	}
 
 	public BeliefBase getBeliefBase() {
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
index c2810f1..c2e00d4 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
@@ -54,16 +54,16 @@ public class ParallelActionPlanBody extends ParallelBehaviour implements
 		};
 	}
 
-	public void dispatchGoal(Goal goal) {
-		abstractPlanBody.dispatchGoal(goal);
+	public boolean dispatchGoal(Goal goal) {
+		return abstractPlanBody.dispatchGoal(goal);
 	}
 
-	public void dispatchSubgoal(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoal(subgoal);
+	public boolean dispatchSubgoal(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoal(subgoal);
 	}
 
-	public void dispatchSubgoalAndListen(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoalAndListen(subgoal);
+	public boolean dispatchSubgoalAndListen(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoalAndListen(subgoal);
 	}
 
 	public BeliefBase getBeliefBase() {
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
index 90d3aaa..be312eb 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
@@ -53,8 +53,10 @@ public interface PlanBody extends GoalListener {
 	 * 
 	 * @param goal
 	 *            the goal to be dispatched.
+	 * 
+	 * @return true if the goal could be dispatched, false otherwise.
 	 */
-	public void dispatchGoal(Goal goal);
+	public boolean dispatchGoal(Goal goal);
 
 	/**
 	 * Dispatches a subgoal to be achieved. Dispatched subgoals are goals of an
@@ -62,8 +64,10 @@ public interface PlanBody extends GoalListener {
 	 * 
 	 * @param subgoal
 	 *            the subgoal to be dispatched.
+	 * 
+	 * @return true if the goal could be dispatched, false otherwise.
 	 */
-	public void dispatchSubgoal(Goal subgoal);
+	public boolean dispatchSubgoal(Goal subgoal);
 
 	/**
 	 * Dispatches a subgoal to be achieved and registers itself as a listener to
@@ -71,8 +75,10 @@ public interface PlanBody extends GoalListener {
 	 * 
 	 * @param subgoal
 	 *            the subgoal to be dispatched.
+	 * 
+	 * @return true if the goal could be dispatched, false otherwise.
 	 */
-	public void dispatchSubgoalAndListen(Goal subgoal);
+	public boolean dispatchSubgoalAndListen(Goal subgoal);
 
 	/**
 	 * Returns the belief base of the capability associated with the plan of
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
index 0d22445..526c1f4 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
@@ -54,16 +54,16 @@ public class SequentialActionPlanBody extends SequentialBehaviour implements
 		};
 	}
 
-	public void dispatchGoal(Goal goal) {
-		abstractPlanBody.dispatchGoal(goal);
+	public boolean dispatchGoal(Goal goal) {
+		return abstractPlanBody.dispatchGoal(goal);
 	}
 
-	public void dispatchSubgoal(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoal(subgoal);
+	public boolean dispatchSubgoal(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoal(subgoal);
 	}
 
-	public void dispatchSubgoalAndListen(Goal subgoal) {
-		abstractPlanBody.dispatchSubgoalAndListen(subgoal);
+	public boolean dispatchSubgoalAndListen(Goal subgoal) {
+		return abstractPlanBody.dispatchSubgoalAndListen(subgoal);
 	}
 
 	public BeliefBase getBeliefBase() {
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java
index da1162d..9d34f90 100644
--- a/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java
@@ -33,7 +33,7 @@ import bdi4jade.plan.Plan;
 /**
  * @author Ingrid Nunes
  */
-public class Middle1Capability extends Capability {
+public class Middle1Capability extends Middle1ParentCapability {
 
 	@GoalOwner(capability = Middle1Capability.class, internal = false)
 	public static class Middle1ExternalGoal implements Goal {
@@ -52,9 +52,6 @@ public class Middle1Capability extends Capability {
 
 	private static final long serialVersionUID = -2281419044730158505L;
 
-	@PartCapability
-	private Capability bottomCapability = new BottomCapability();
-
 	@bdi4jade.annotation.Plan
 	private Plan externalGoalPlan = new DefaultPlan(Middle1ExternalGoal.class,
 			SuccessPlanBody.class);
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1ParentCapability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1ParentCapability.java
new file mode 100644
index 0000000..0c7e103
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1ParentCapability.java
@@ -0,0 +1,55 @@
+//----------------------------------------------------------------------------
+// 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/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.PartCapability;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Middle1ParentCapability extends Capability {
+
+	@GoalOwner(capability = Middle1ParentCapability.class, internal = true)
+	public static class Middle1ParentInternalGoal implements Goal {
+		private static final long serialVersionUID = -5054184951317760743L;
+	}
+
+	private static final long serialVersionUID = -2281419044730158505L;
+
+	@PartCapability
+	private Capability bottomCapability = new BottomCapability();
+
+	@bdi4jade.annotation.Plan
+	private Plan internalGoalParentPlan = new DefaultPlan(
+			Middle1ParentInternalGoal.class, SuccessPlanBody.class);
+
+	@TransientBelief
+	private String middle1ParentBelief = "MIDDLE1_PARENT_BELIEF";
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/TestPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/TestPlanBody.java
index 3ad0f7a..e393e05 100644
--- a/bdi-jade-test/src/bdi4jade/examples/capabilities/TestPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/TestPlanBody.java
@@ -24,6 +24,7 @@ package bdi4jade.examples.capabilities;
 
 import bdi4jade.belief.Belief;
 import bdi4jade.event.GoalEvent;
+import bdi4jade.goal.Goal;
 import bdi4jade.goal.GoalStatus;
 import bdi4jade.plan.Plan.EndState;
 import bdi4jade.plan.planbody.AbstractPlanBody;
@@ -34,7 +35,7 @@ import bdi4jade.plan.planbody.AbstractPlanBody;
 public class TestPlanBody extends AbstractPlanBody {
 
 	enum TestStep {
-		BELIEF, CHILD_GOAL, COMPLETED, MY_EXTERNAL_GOAL, MY_INTERNAL_GOAL, PARENT_GOAL, PARENT_PROTECTED_GOAL, SIBLING_GOAL, SIBLING_PROTECTED_GOAL;
+		BELIEF, BOTTOM_EXTERNAL_GOAL, BOTTOM_INTERNAL_GOAL, COMPLETED, MIDDLE2_EXTERNAL_GOAL, MY_EXTERNAL_GOAL, MY_INTERNAL_GOAL, MY_PARENT_INTERNAL_GOAL, TOP_EXTERNAL_GOAL, TOP_INTERNAL_GOAL, TOP_PARENT_INTERNAL_GOAL;
 	}
 
 	private static final long serialVersionUID = -9039447524062487795L;
@@ -44,17 +45,23 @@ public class TestPlanBody extends AbstractPlanBody {
 	@bdi4jade.annotation.Belief
 	private Belief<String> middle1Belief;
 	@bdi4jade.annotation.Belief
+	private Belief<String> middle1ParentBelief;
+	@bdi4jade.annotation.Belief
 	private Belief<String> middle2Belief;
 	private TestStep step;
 	@bdi4jade.annotation.Belief
 	private Belief<String> topBelief;
+	@bdi4jade.annotation.Belief
+	private Belief<String> topParentBelief;
 
 	public void action() {
 		switch (step) {
 		case BELIEF:
 			log.info("Testing beliefs...");
 			log.info("These should be not null:");
+			log.info("topParentBelief: " + topParentBelief);
 			log.info("topBelief: " + topBelief);
+			log.info("middle1ParentBelief: " + middle1ParentBelief);
 			log.info("middle1Belief: " + middle1Belief);
 			log.info("These should be null:");
 			log.info("middle2Belief: " + middle2Belief);
@@ -80,9 +87,67 @@ public class TestPlanBody extends AbstractPlanBody {
 				return;
 			} else {
 				printGoal(goalEvent, true);
-				// FIXME dispatchSubgoalAndListen(new TopGoal());
+				dispatchSubgoalAndListen(new Middle1ParentCapability.Middle1ParentInternalGoal());
 			}
-
+			this.step = TestStep.MY_PARENT_INTERNAL_GOAL;
+			break;
+		case MY_PARENT_INTERNAL_GOAL:
+			goalEvent = getGoalEvent();
+			if (goalEvent == null) {
+				return;
+			} else {
+				printGoal(goalEvent, true);
+				dispatchSubgoalAndListen(new TopCapability.TopExternalGoal());
+			}
+			this.step = TestStep.TOP_EXTERNAL_GOAL;
+			break;
+		case TOP_EXTERNAL_GOAL:
+			goalEvent = getGoalEvent();
+			if (goalEvent == null) {
+				return;
+			} else {
+				printGoal(goalEvent, true);
+				dispatchSubgoalAndListen(new TopCapability.TopInternalGoal());
+			}
+			this.step = TestStep.TOP_INTERNAL_GOAL;
+			break;
+		case TOP_INTERNAL_GOAL:
+			goalEvent = getGoalEvent();
+			if (goalEvent == null) {
+				return;
+			} else {
+				printGoal(goalEvent, true);
+				dispatchSubgoalAndListen(new TopParentCapability.TopParentInternalGoal());
+			}
+			this.step = TestStep.TOP_PARENT_INTERNAL_GOAL;
+			break;
+		case TOP_PARENT_INTERNAL_GOAL:
+			goalEvent = getGoalEvent();
+			if (goalEvent == null) {
+				return;
+			} else {
+				printGoal(goalEvent, true);
+				Goal goal = new Middle2Capability.Middle2ExternalGoal();
+				printGoal(goal, dispatchSubgoal(goal), false);
+			}
+			this.step = TestStep.MIDDLE2_EXTERNAL_GOAL;
+			break;
+		case MIDDLE2_EXTERNAL_GOAL:
+			dispatchSubgoalAndListen(new BottomCapability.BottomExternalGoal());
+			this.step = TestStep.BOTTOM_EXTERNAL_GOAL;
+			break;
+		case BOTTOM_EXTERNAL_GOAL:
+			goalEvent = getGoalEvent();
+			if (goalEvent == null) {
+				return;
+			} else {
+				printGoal(goalEvent, true);
+				Goal goal = new BottomCapability.BottomInternalGoal();
+				printGoal(goal, dispatchSubgoal(goal), false);
+			}
+			this.step = TestStep.BOTTOM_INTERNAL_GOAL;
+			break;
+		case BOTTOM_INTERNAL_GOAL:
 			this.step = TestStep.COMPLETED;
 			break;
 		case COMPLETED:
@@ -95,6 +160,11 @@ public class TestPlanBody extends AbstractPlanBody {
 		this.step = TestStep.BELIEF;
 	}
 
+	private void printGoal(Goal goal, boolean observed, boolean expected) {
+		log.debug("Goal " + goal.getClass().getSimpleName() + " dispatched - "
+				+ ((observed == expected) ? "" : "un") + "expected result");
+	}
+
 	private void printGoal(GoalEvent goalEvent, boolean achievedExpected) {
 		if (GoalStatus.ACHIEVED.equals(goalEvent.getStatus())) {
 			log.debug("Goal " + goalEvent.getGoal().getClass().getSimpleName()
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java
index b1de9f0..3dfec01 100644
--- a/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java
@@ -33,7 +33,7 @@ import bdi4jade.plan.Plan;
 /**
  * @author Ingrid Nunes
  */
-public class TopCapability extends Capability {
+public class TopCapability extends TopParentCapability {
 
 	@GoalOwner(capability = TopCapability.class, internal = false)
 	public static class TopExternalGoal implements Goal {
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/TopParentCapability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopParentCapability.java
new file mode 100644
index 0000000..aa79dfe
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopParentCapability.java
@@ -0,0 +1,51 @@
+//----------------------------------------------------------------------------
+// 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/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class TopParentCapability extends Capability {
+
+	@GoalOwner(capability = TopParentCapability.class, internal = true)
+	public static class TopParentInternalGoal implements Goal {
+		private static final long serialVersionUID = 1371943799864265143L;
+	}
+
+	private static final long serialVersionUID = -8981563986693758609L;
+
+	@bdi4jade.annotation.Plan
+	private Plan internalGoalParentPlan = new DefaultPlan(
+			TopParentInternalGoal.class, SuccessPlanBody.class);
+
+	@TransientBelief
+	private String topParentBelief = "TOP_PARENT_BELIEF";
+
+}