use of org.apache.jackrabbit.standalone.cli.CommandException in project jackrabbit by apache.
the class SourceCommand method execute.
/**
* {@inheritDoc}
*/
public boolean execute(Context ctx) throws Exception {
File f = new File((String) ctx.get(this.fileKey));
if (!f.exists()) {
throw new CommandException("exception.file.not.found", new String[] { f.getAbsolutePath() });
}
// client
JcrClient client = new JcrClient(ctx);
BufferedReader in = new BufferedReader(new FileReader(f));
PrintWriter out = CommandHelper.getOutput(ctx);
String line = null;
while ((line = in.readLine()) != null) {
out.println(bundle.getString("word.running") + ": " + line);
client.runCommand(line);
}
in.close();
return false;
}
Aggregations