View Javadoc

1   package org.lsst.ccs.command.remote;
2   
3   import java.io.Serializable;
4   import org.lsst.ccs.command.CommandInvocationException;
5   
6   /**
7    * The result of invoking a command on a remote server. May consist of <b>either</b>
8    * a result (which must be Serializable) or an exception (which by definition must 
9    * be serializable).
10   * @author tonyj
11   */
12  public class CommandResponse implements Serializable {
13      private Serializable result;
14      private CommandInvocationException exception;
15  
16      public CommandResponse(Serializable result) {
17          this.result = result;
18      }
19  
20      public CommandResponse(CommandInvocationException exception) {
21          this.exception = exception;
22      }
23      
24      public Object getResult() throws CommandInvocationException {
25          if (exception != null) throw exception;
26          return result;
27      }
28  }