KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > control > activity > task > NoSuchTaskException


1 /**
2  * Dream Copyright (C) 2003-2004 INRIA Rhone-Alpes
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option) any
7  * later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Contact: dream@objectweb.org
19  *
20  * Initial developer(s): Matthieu Leclercq
21  * Contributor(s):
22  */

23
24 package org.objectweb.dream.control.activity.task;
25
26 import org.objectweb.fractal.api.control.NameController;
27
28 /**
29  * Exception thrown by task controller when a given task component is unknown.
30  */

31 public class NoSuchTaskException extends Exception JavaDoc
32 {
33
34   Task task;
35
36   /**
37    * @param task a task.
38    */

39   public NoSuchTaskException(Task task)
40   {
41     this.task = task;
42   }
43
44   /**
45    * @param task a task.
46    * @param message a message.
47    */

48   public NoSuchTaskException(Task task, String JavaDoc message)
49   {
50     super(message);
51     this.task = task;
52   }
53
54   /**
55    * @return the task.
56    */

57   public Task getTask()
58   {
59     return task;
60   }
61
62   /**
63    * @see java.lang.Throwable#toString()
64    */

65   public String JavaDoc toString()
66   {
67     if (task != null && task instanceof NameController)
68     {
69       return super.toString() + " task name : "
70           + ((NameController) task).getFcName();
71     }
72     return super.toString();
73   }
74 }
Popular Tags