KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > chain > impl > ExceptionCommand


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.chain.impl;
17
18
19 import org.apache.commons.chain.Chain;
20 import org.apache.commons.chain.Command;
21 import org.apache.commons.chain.Context;
22
23
24 /**
25  * <p>Implementation of {@link Command} that logs its identifier and
26  * and throws an Exception.</p>
27  *
28  * @author Craig R. McClanahan
29  * @version $Revision: 1.4 $ $Date: 2004/02/25 00:01:05 $
30  */

31 public class ExceptionCommand extends NonDelegatingCommand {
32
33
34     // ------------------------------------------------------------ Constructor
35

36
37     public ExceptionCommand() {
38     this("");
39     }
40
41
42     // Construct an instance that will log the specified identifier
43
public ExceptionCommand(String JavaDoc id) {
44         super(id);
45     }
46
47
48     // -------------------------------------------------------- Command Methods
49

50
51     // Execution method for this Command
52
public void execute(Context context, Chain chain) throws Exception JavaDoc {
53
54         super.execute(context);
55         throw new ArithmeticException JavaDoc(this.id);
56
57     }
58
59
60 }
61
Popular Tags