01: /*
02: * Copyright 2006-2007 Luca Garulli (luca.garulli@assetdata.it)
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 org.romaframework.wizard.command;
17:
18: import org.romaframework.core.command.CommandIO;
19: import org.romaframework.wizard.MainWizard;
20: import org.romaframework.wizard.WizardConstants;
21:
22: /**
23: * Base abstract Wizard Command class with IO management.
24: *
25: * @author Luca Garulli (luca.garulli@assetdata.it)
26: */
27: public abstract class BaseWizardCommand implements WizardCommand {
28: private static CommandIO iO = MainWizard.getIO();
29:
30: public CommandIO getIO() {
31: return iO;
32: }
33:
34: public static void setIO(CommandIO io) {
35: iO = io;
36: }
37:
38: protected String getCommandHelp() {
39: StringBuffer buffer = new StringBuffer();
40: buffer.append(WizardConstants.HEADER);
41: buffer.append("\n\nUse this syntax:");
42: buffer.append("\n\nroma ");
43: buffer.append(getName());
44: buffer.append(" ");
45: buffer.append(getParameters());
46: return buffer.toString();
47: }
48:
49: protected void syntaxError() {
50: help();
51:
52: MainWizard.stop(1);
53: }
54: }
|