* @throws PluginConflictException
* when the operation to be loaded already exists and does not belong to the plugin being mapped
*/
public synchronized void addOperation(Operation operation, ParserPlugin plugin) throws PluginConflictException {
if (!(plugin instanceof OperationPlugin))
throw new PluginConflictException("A plugin without operation support attempted to load an operation", plugin);
if (!plugin.getID().equals(operation.getPlugin().getID()))
throw new PluginConflictException("A plugin attempted to load an operation under a different ID", plugin);
if (!operations.containsKey(operation.getName())) {
operations.put(operation.getName(), operation);
if (operation.isFinal()) {
finalOperations.add(operation.getName());
log.logInfo("Added an operation, " + operation.getName() + ", to " + plugin.getID() + ", as a Final Operation");
}
else
log.logInfo("Added an operation, " + operation.getName() + ", to " + plugin.getID());
}
else if (operations.containsKey(operation.getName()) && operations.get(operation.getName()).getPlugin() != plugin)
throw new PluginConflictException("The operation: " + operation.getName() + " is already mapped to " + operations.get(operation.getName()).getPlugin().getID(), plugin);
allNames.add(operation.getName());
for (String abbreviation : operation.getAlternateNames())
abbreviations.put(abbreviation, operation.getName());
propertyChangeSupport.firePropertyChange("Operation", operation, null);
}