/**
  * Stores the configuration object on the server. The server bean path is the one returned by
  * mo.getPath().
  *
  * @param mo the ManagementObject to read from the server
  */
 private void saveConfiguration(ConnectorManagementObject mo) throws AdminException {
   Log.debug("Saving configuration object " + mo.getPath());
   businessDelegate.setServerBean(mo.getPath(), mo.getObject());
   Log.info("Configuration saved.");
 }
  /**
   * Starts the process to create a new SyncSouce
   *
   * @param node SyncTypeNode involved in the process
   * @throws AdminException if a error occurs during the process
   */
  public void editConnector(ConnectorNode node) throws AdminException {
    Sync4jModule module = node.getModule();
    Sync4jConnector connector = node.getConnector();

    Log.debug("node:" + node);

    final String panelName = module.getModuleName() + " - " + connector.getConnectorName();

    ConnectorManagementPanel panel = (ConnectorManagementPanel) PanelManager.getPanel(panelName);

    ConnectorManagementObject mo =
        new ConnectorManagementObject(
            null, module.getModuleId(), connector.getConnectorId(), connector.getConnectorName());

    if (panel != null) {
      //
      // Management object loading and setting
      //
      readConfiguration(mo);

      panel.setManagementObject(mo);
      panel.updateForm();
      PanelManager.showPanel(panelName);
    } else {
      String adminClassName = connector.getAdminClass();

      Log.debug("admin class name: " + adminClassName);

      if ((adminClassName == null) || (adminClassName.trim().length() == 0)) {
        //
        // There is no configuration panel for this connector... just
        // do nothing
        //
        return;
      }

      //
      // Admin class loading
      //

      Class adminClass = null;

      SyncAdminController adminController = ExplorerUtil.getSyncAdminController();

      ClassLoader cl = adminController.getSync4jClassLoader();

      try {
        adminClass = cl.loadClass(adminClassName);
        panel = (ConnectorManagementPanel) adminClass.newInstance();
      } catch (Exception e) {
        String errorMessage = Bundle.getMessage(Bundle.ERROR_LOADING_CONNECTOR_CONFIG_PANEL);
        Log.error(errorMessage + " (class name: " + adminClassName + ")");
        Log.error(e);
        NotifyDescriptor desc = new NotifyDescriptor.Message(errorMessage);
        DialogDisplayer.getDefault().notify(desc);
        return;
      }

      //
      // Management object loading and setting
      //
      readConfiguration(mo);

      panel.setName(panelName);
      panel.setManagementObject(mo);
      panel.addActionListener(this);

      //
      // Tell the panel to rewrite its content
      //
      panel.updateForm();

      panel.validate();

      PanelManager.addPanel(panel);
    }
  }
 /**
  * Reads the configuration object from the server. The server bean path is the one returned by
  * mo.getPath().
  *
  * @param mo the ManagementObject to read from the server
  */
 private void readConfiguration(ConnectorManagementObject mo) throws AdminException {
   Log.debug("Reading configuration object " + mo.getPath());
   mo.setObject(businessDelegate.getServerBean(mo.getPath()));
 }