@Override
public boolean selectPlugin(GazeHandlerFactory creator) {
GazeEvaluatorImpl.this.logger.finer("Examining plugin factory " + creator);
final PluginInformation pi = GazeEvaluatorImpl.this.pluginInformation;
if (!creator.getEvaluatorType().isAssignableFrom(listener.getClass()))
return false;
GazeEvaluatorImpl.this.logger.finer("Plugin looks promising");
// Now check the requested versions
for (OptionRequestVersion rqv : requestedVersions) {
// Check if we're dealing with the proper listener.
if (!rqv.getListener().isAssignableFrom(listener.getClass()))
continue;
GazeEvaluatorImpl.this.logger.finer("Found a version request. Checking authors ... ");
// Check author
if (rqv.getAuthor() != null) {
if (!pi.getInformation(Information.AUTHORS, creator).contains(rqv.getAuthor()))
return false;
}
GazeEvaluatorImpl.this.logger.finer("Checking implementaiton version ... ");
// Check version
if (rqv.getVersion() >= 0) {
final Collection<String> information = pi.getInformation(Information.VERSION, creator);
if (information.size() != 1) return false;
final int version = Integer.parseInt(information.iterator().next());
// We accept any newer version
if (version < rqv.getVersion()) return false;
}
GazeEvaluatorImpl.this.logger.finer("Checking capabilities ... ");
// Check capabilities
if (rqv.getCapabilities().length > 0) {
final Collection<String> information = pi.getInformation(Information.CAPABILITIES, creator);
// Must match all caps
if (!information.containsAll(Arrays.asList(rqv.getCapabilities())))
return false;
}