clean();
try {
final StreamManager streamManager = new StreamManager(out, err, lineSep);
final ConsoleReader reader = new ConsoleReader(sin, streamManager.getSout());
reader.addCompletor(new FileNameCompletor());
reader.addCompletor(new SimpleCompletor(COMMANDS.keySet().toArray(new String[COMMANDS.size()])));
// TODO : add completers
String line;
StringBuilder builtWelcome = new StringBuilder("Apache OpenEJB ")
.append(OpenEjbVersion.get().getVersion())
.append(" build: ")
.append(OpenEjbVersion.get().getDate())
.append("-")
.append(OpenEjbVersion.get().getTime())
.append(lineSep);
if (tomee) {
builtWelcome.append(OS_LINE_SEP).append(PROPERTIES.getProperty(WELCOME_TOMEE_KEY));
} else {
builtWelcome.append(OS_LINE_SEP).append(PROPERTIES.getProperty(WELCOME_OPENEJB_KEY));
}
builtWelcome.append(lineSep).append(PROPERTIES.getProperty(WELCOME_COMMON_KEY));
streamManager.writeOut(OpenEjbVersion.get().getUrl());
streamManager.writeOut(builtWelcome.toString()
.replace("$bind", bind)
.replace("$port", Integer.toString(port))
.replace("$name", NAME)
.replace(OS_LINE_SEP, lineSep));
while ((line = reader.readLine(prompt())) != null) {
// exit simply let us go out of the loop
// do we need a command for it?
if (EXIT_COMMAND.equals(line)) {
break;
}