KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > remoting > Command


1 package hudson.remoting;
2
3 import java.io.Serializable JavaDoc;
4
5 /**
6  * One-way command to be sent over to the remote system and executed there.
7  * This is layer 0, the lower most layer.
8  *
9  * <p>
10  * At this level, remoting of class files are not provided, so both {@link Channel}s
11  * need to have the definition of {@link Command}-implementation.
12  *
13  * @author Kohsuke Kawaguchi
14  */

15 abstract class Command implements Serializable JavaDoc {
16     /**
17      * This exception captures the stack trace of where the Command object is created.
18      * This is useful for diagnosing the error when command fails to execute on the remote peer.
19      */

20     public final Exception JavaDoc createdAt;
21
22
23     protected Command() {
24         this.createdAt = new Source();
25     }
26
27     /**
28      * Called on a remote system to perform this command.
29      *
30      * @param channel
31      * The {@link Channel} of the remote system.
32      */

33     protected abstract void execute(Channel channel);
34
35     private static final long serialVersionUID = 1L;
36
37     private final class Source extends Exception JavaDoc {
38         public Source() {
39         }
40
41         public String JavaDoc toString() {
42             return "Command "+Command.this.toString()+" created at";
43         }
44
45         private static final long serialVersionUID = 1L;
46     }
47 }
48
Popular Tags