}
public boolean parse (String[] inputParams) throws PackageException, CommandLineException {
// validate at least one parameter
if (inputParams.length < 1) {
throw new CommandLineException("EXCEPTION_INVALID_COMMAND_LINE");
}
// get first param - exception case: /h
String input1 = inputParams[0].toLowerCase().trim();
if (input1.equals(OPTION_HELP)) {
Logger.logMessage(LogType.NONE, isPlayBook() ? "BBWP_PLAYBOOK_USAGE" : "BBWP_USAGE", WidgetPackager.getVersion());
return false;
}
Logger.logMessage(LogType.INFO, "PROGRESS_CMDLINE_OPTIONS");
// check archive format
if (!input1.endsWith(".zip")) {
throw new CommandLineException("EXCEPTION_INVALID_COMMAND_LINE");
}
// parse the command line
_widgetArchive = getAbsolutePath(input1);
_archiveName = parseWidgetName(_widgetArchive);
Pattern patternWidgetName = Pattern.compile("[a-zA-Z][a-zA-Z0-9]*");
if (!patternWidgetName.matcher(_archiveName).matches()) {
throw new PackageException("EXCEPTION_INVALID_ARCHIVE_NAME");
}
// parse options
try {
parseOptionParameters(inputParams);
} catch (Exception e) {
throw new CommandLineException("EXCEPTION_INVALID_COMMAND_LINE");
}
return true;
}