01: /*
02: * Copyright 2007 Roy van der Kuil (roy@vanderkuil.nl) and Stefan Rotman (stefan@rotman.net)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 nl.improved.sqlclient.commands;
17:
18: import java.util.List;
19: import nl.improved.sqlclient.SQLCommand;
20: import nl.improved.sqlclient.Point;
21: import nl.improved.sqlclient.SQLUtil;
22: import nl.improved.sqlclient.TabCompletionInfo;
23:
24: /**
25: * Implement this interface to add a specific command to the sql client.
26: */
27: public interface Command {
28: /**
29: * Execute a command.
30: * @param command the command to execute
31: * @return a readable result so the user knows what happened
32: */
33: CharSequence execute(SQLCommand cmd);
34:
35: /**
36: * Return the command key (like quit, help, connect) that should show up in the help list.
37: * @return the command key that should show up in the help list.
38: */
39: CharSequence getCommandString();
40:
41: /**
42: * Returns some tab completion info for the specified command.
43: * @param commandInfo the command lines
44: * @param commandPoint the cursor position
45: * @return some tab completion info for the specified command.
46: */
47: TabCompletionInfo getTabCompletionInfo(SQLCommand commandInfo,
48: Point commandPoint);
49:
50: /**
51: * Returns a explenation string of how to use this command.
52: * @return a explenation string of how to use this command.
53: */
54: CharSequence getHelp();
55:
56: /**
57: * Attempt to abort the command and return true if succeeded.
58: * @return true if abort succeeded
59: */
60: boolean abort();
61:
62: /**
63: * Return true if the command (instance) supports to be started in the background.
64: * @return true if the command (instance) supports to be started in the background.
65: */
66: boolean backgroundProcessSupported();
67: }
|