@Override
  public void save(URL file, Object data) throws FileException {
    if (!(data instanceof Map)) {
      Application.handleException(
          new ControlledException(
              this,
              ExceptionSeverity.UNEXPECTED_BEHAVIOR,
              "SettingPersistence#save() got a wrong"
                  + " object, object is the following instance:\n"
                  + data.getClass()));
    }

    try {
      FileOutputStream fos = new FileOutputStream(Tools.urlToFile(file));
      BufferedOutputStream bos = new BufferedOutputStream(fos);
      ObjectOutputStream oos = new ObjectOutputStream(bos);

      oos.writeObject(data);
      oos.close();
      bos.close();
      fos.close();
    } catch (IOException e) {
      throw new FileException(Type.NOT_WRITABLE, e);
    }
  }
  @Override
  public void actionPerformed(ActionEvent e) {
    ConnectingFunctionsEvent cfe = (ConnectingFunctionsEvent) e;

    try {
      cfe.getConnectionSource().addConnectionTo(cfe.getConnectionDestination());
    } catch (ConnectorException e1) {
      Application.handleException(
          new ControlledException(
              this,
              ExceptionSeverity.WARNING,
              I18N.getInstance().getString("Model.Pipeline.AddConnection." + e1.getType())));
    }
  }
 @Override
 public void update(Observable o, Object arg) {
   if (arg instanceof SettingsObserverObject) {
     try {
       SettingsObserverObject soo = (SettingsObserverObject) arg;
       soo.getSettingsModel().saveSettings();
     } catch (FileException e) {
       /* forward the exception to the view */
       Application.handleException(
           new ControlledException(
               this,
               ExceptionSeverity.WARNING,
               e,
               I18N.getInstance().getString("Model.Settings.AutosaveSettingsFailed")));
     }
   }
 }