Package lipstone.joshua.parser.exceptions

Examples of lipstone.joshua.parser.exceptions.PluginConflictException


   * @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);
  }
View Full Code Here


   *            the plugin removing the operation
   * @throws PluginConflictException
   */
  public synchronized void removeOperation(String operation, ParserPlugin plugin) throws PluginConflictException {
    if (operations.containsKey(operation) && !plugin.getID().equals(operations.get(operation).getPlugin().getID()))
      throw new PluginConflictException("The operation: " + operation + " is mapped to " + operations.get(operation).getPlugin().getID(), plugin);
    operations.remove(operation);
    finalOperations.remove(operation);
    allNames.remove(operation);
    abbreviations.values().remove(operation);
    log.logInfo("Removed an operation, " + operation + ", from " + plugin.getID());
View Full Code Here

   * @throws PluginConflictException
   *             when the keyword to be loaded already exists and does not belong to the plugin being mapped
   */
  public synchronized void addKeyword(Keyword keyword, ParserPlugin plugin) throws PluginConflictException {
    if (!(plugin instanceof KeywordPlugin))
      throw new PluginConflictException("A plugin without keyword support attempted to load an keyword", plugin);
    if (!plugin.getID().equals(keyword.getPlugin().getID()))
      throw new PluginConflictException("A plugin attempted to load an keyword under a different ID", plugin);
    if (keywords.containsKey(keyword.getName()) && keywords.get(keyword.getName()).getPlugin() != plugin)
      throw new PluginConflictException("The keyword: " + keyword.getName() + " is already mapped to " + keywords.get(keyword.getName()).getPlugin().getID(), plugin);
    keywords.put(keyword.getName(), keyword);
    allNames.add(keyword.getName());
    for (String abbreviation : keyword.getAlternateNames())
      abbreviations.put(abbreviation, keyword.getName());
    log.logInfo("Added a keyword, " + keyword.getName() + ", to " + plugin.getID());
View Full Code Here

   *            the plugin removing the keyword
   * @throws PluginConflictException
   */
  public synchronized void removeKeyword(String keyword, ParserPlugin plugin) throws PluginConflictException {
    if (keywords.containsKey(keyword) && !keywords.get(keyword).getPlugin().getID().equals(plugin.getID()))
      throw new PluginConflictException("The keyword: " + keyword + " is mapped to " + keywords.get(keyword).getPlugin().getID(), plugin);
    keywords.remove(keyword);
    allNames.remove(keyword);
    abbreviations.values().remove(keyword);
    log.logInfo("Removed a keyword, " + keyword + ", from " + plugin.getID());
    propertyChangeSupport.firePropertyChange("Keyword", keyword, null);
View Full Code Here

   * @throws PluginConflictException
   *             when the command to be loaded already exists and does not belong to the plugin being mapped
   */
  public synchronized void addCommand(Command command, ParserPlugin plugin) throws PluginConflictException {
    if (!(plugin instanceof CommandPlugin))
      throw new PluginConflictException("A plugin without command support attempted to load an command", plugin);
    if (!plugin.getID().equals(command.getPlugin().getID()))
      throw new PluginConflictException("A plugin attempted to load an command under a different ID", plugin);
    if (commands.containsKey(command.getName()) && commands.get(command.getName()).getPlugin() != plugin)
      throw new PluginConflictException("The command: " + command.getName() + " is already mapped to " + commands.get(command.getName()).getPlugin().getID(), plugin);
    commands.put(command.getName(), command);
    allNames.add(command.getName());
    for (String abbreviation : command.getAlternateNames())
      abbreviations.put(abbreviation, command.getName());
    log.logInfo("Added a command, " + command.getName() + ", to " + plugin.getID());
View Full Code Here

   *            the plugin removing the command
   * @throws PluginConflictException
   */
  public synchronized void removeCommand(String command, ParserPlugin plugin) throws PluginConflictException {
    if (commands.containsKey(command) && !commands.get(command).getPlugin().getID().equals(plugin.getID()))
      throw new PluginConflictException("The command: " + command + " is mapped to " + commands.get(command).getPlugin().getID(), plugin);
    commands.remove(command);
    allNames.remove(command);
    abbreviations.values().remove(command);
    log.logInfo("Removed a command, " + command + ", from " + plugin.getID());
    propertyChangeSupport.firePropertyChange("Command", command, null);
View Full Code Here

TOP

Related Classes of lipstone.joshua.parser.exceptions.PluginConflictException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.