if (configurations == null)
return new Plugin[0];
for (Configuration config : configurations) {
Plugin plugin = new Plugin();
plugin.setId(config.getId());
plugin.setPath(config.getValue());
File path = new File(plugin.getPath());
if (path.isDirectory()) {
plugin.setStatus(Constants.PLUGIN_STATUS_VALID);
plugin.setStatusMessage("Valid");
} else {
plugin.setStatus(Constants.PLUGIN_STATUS_NOT_DIRECTORY);
plugin.setStatusMessage("Path is not a directory");
}
if (!onlyValid || plugin.getStatus() == Constants.PLUGIN_STATUS_VALID)
plugins.add(plugin);
}
return plugins.toArray(new Plugin[0]);
}