}
public void run(CommandLine commandLine) {
String cls = commandLine.getOptionValue('c');
if (cls == null) {
throw new MissingParameterException("class");
}
Formatter formatter;
if (cls.equals("al")) {
Writer writer = getSingleWriter(commandLine);
formatter = new AlFormatter(writer);
} else if (cls.equals("txt")) {
if (commandLine.getArgs().length != 2) {
throw new WrongArgumentCountException("2", commandLine.getArgs().length);
}
String sourceFileName = commandLine.getArgs()[0];
String targetFileName = commandLine.getArgs()[1];
Writer sourceWriter = getWriter(getFileOutputStream(sourceFileName));
Writer targetWriter = getWriter(getFileOutputStream(targetFileName));
formatter = new PlaintextFormatter(sourceWriter, targetWriter);
} else if (cls.equals("tmx")) {
Writer writer = getSingleWriter(commandLine);
String languages = commandLine.getOptionValue('l');
if (languages == null) {
throw new MissingParameterException("languages");
}
String[] languageArray = languages.split(",");
if (languageArray.length != 2) {
throw new ParameterFormatException("languages");
}