public void writeCommand(Command command) throws Exception {

        checkConnected();

        switch (command.getKind()) {
        case PREPARE:
            writeCommand((PrepareCommand) command);
            break;
        case START:
            writeCommand((StartCommand) command);
            break;
        case ABORT:
            writeCommand((AbortCommand) command);
            break;
        case AWAIT:
            writeCommand((AwaitCommand) command);
            break;
        case NOTIFY:
            writeCommand((NotifyCommand) command);
            break;
        case CLOSE:
            writeCommand((CloseCommand) command);
            break;
        default:
            throw new IllegalArgumentException("Urecognized command kind: " + command.getKind());
        }
    }
public void writeCommand ( Command command ) throws Exception { checkConnected ( ) ; switch ( command . getKind ( ) ) { case PREPARE : writeCommand ( ( PrepareCommand ) command ) ; break ; case START : writeCommand ( ( StartCommand ) command ) ; break ; case ABORT : writeCommand ( ( AbortCommand ) command ) ; break ; case AWAIT : writeCommand ( ( AwaitCommand ) command ) ; break ; case NOTIFY : writeCommand ( ( NotifyCommand ) command ) ; break ; case CLOSE : writeCommand ( ( CloseCommand ) command ) ; break ; default : throw new IllegalArgumentException ( "Urecognized command kind: " + command . getKind ( ) ) ; } }
Writes a command to the wire.
@param command to write to the wire
@throws Exception if the command is not recognized