protected void updateExternalServices(ActionRequest actionRequest, PortletPreferences preferences)
      throws Exception {

    boolean imageMagickEnabled = ParamUtil.getBoolean(actionRequest, "imageMagickEnabled");
    String imageMagickPath = ParamUtil.getString(actionRequest, "imageMagickPath");
    boolean openOfficeEnabled = ParamUtil.getBoolean(actionRequest, "openOfficeEnabled");
    int openOfficePort = ParamUtil.getInteger(actionRequest, "openOfficePort");
    boolean xugglerEnabled = ParamUtil.getBoolean(actionRequest, "xugglerEnabled");

    preferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled));
    preferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath);
    preferences.setValue(PropsKeys.OPENOFFICE_SERVER_ENABLED, String.valueOf(openOfficeEnabled));
    preferences.setValue(PropsKeys.OPENOFFICE_SERVER_PORT, String.valueOf(openOfficePort));
    preferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled));

    Enumeration<String> enu = actionRequest.getParameterNames();

    while (enu.hasMoreElements()) {
      String name = enu.nextElement();

      if (name.startsWith("imageMagickLimit")) {
        String key = name.substring(16, name.length()).toLowerCase();
        String value = ParamUtil.getString(actionRequest, name);

        preferences.setValue(PropsKeys.IMAGEMAGICK_RESOURCE_LIMIT + key, value);
      }
    }

    preferences.store();

    GhostscriptUtil.reset();
    ImageMagickUtil.reset();
  }
  @Override
  public void reset() {
    if (isEnabled()) {
      try {
        _globalSearchPath = ImageMagickUtil.getGlobalSearchPath();

        _commandPath = getCommandPath();
      } catch (Exception e) {
        _log.error(e, e);
      }
    }
  }
 @Override
 public boolean isEnabled() {
   return ImageMagickUtil.isEnabled();
 }