public void init(Helper helper) {
    this.helper = helper;

    if (!helper.getEventContext().isCurrentUserAdmin()) {
      throw helper.cancel(new ERR(), new omero.SecurityViolation(), "not-admin");
    }

    log.debug("Looking repo " + repoUuid);
    try {
      String proposedName = "InternalRepository-" + repoUuid;
      InternalRepositoryPrx[] proxies = reg.lookupRepositories();
      for (InternalRepositoryPrx prx : proxies) {
        Ice.Identity id = prx.ice_getIdentity();
        if (proposedName.equals(id.name)) {
          repo = prx;
          log.debug("Found repo " + repoUuid);
          break;
        }
      }
    } catch (Exception e) {
      throw helper.cancel(new ERR(), e, "registry-lookup", "repoUuid", repoUuid);
    }

    if (repo == null) {
      throw helper.cancel(new Unknown(), null, "unknown-repo", "repoUuid", repoUuid);
    }
    this.helper.setSteps(1);
  }
  public void init(Helper helper) {
    this.helper = helper;
    helper.setSteps(5);

    final ImportConfig config = new ImportConfig();
    final String sessionUuid = helper.getEventContext().getCurrentSessionUuid();

    if (!(location instanceof ManagedImportLocationI)) {
      throw helper.cancel(
          new ERR(), null, "bad-location", "location-type", location.getClass().getName());
    }

    ManagedImportLocationI managedLocation = (ManagedImportLocationI) location;
    logPath = managedLocation.getLogFile();
    logFilename = logPath.getFullFsPath();
    MDC.put("fileset", logFilename);

    file = ((ManagedImportLocationI) location).getTarget();

    try {
      sf = reg.getInternalServiceFactory(sessionUuid, "unused", 3, 1, clientUuid);
      store = new OMEROMetadataStoreClient();
      store.setCurrentLogFile(logFilename, token);
      store.initialize(sf);
      registerKeepAlive();

      fileName = file.getFullFsPath();
      shortName = file.getName();
      format = null;
      usedFiles = new String[] {fileName};

      open(reader, store, file);
      format = reader.getFormat();
      if (reader.getUsedFiles() != null) {
        usedFiles = reader.getUsedFiles();
      }
      if (usedFiles == null) {
        throw new NullPointerException("usedFiles must be non-null");
      }

      // Process all information which has been passed in as annotations
      detectKnownAnnotations();

      // Now that we've possibly updated the settings object, copy out
      // all the values needed by import.
      userSpecifiedTarget = settings.userSpecifiedTarget;
      userSpecifiedName =
          settings.userSpecifiedName == null ? null : settings.userSpecifiedName.getValue();
      userSpecifiedDescription =
          settings.userSpecifiedDescription == null
              ? null
              : settings.userSpecifiedDescription.getValue();
      userPixels = settings.userSpecifiedPixels;
      annotationList = settings.userSpecifiedAnnotationList;
      doThumbnails = settings.doThumbnails == null ? true : settings.doThumbnails.getValue();
      noStatsInfo = settings.noStatsInfo == null ? false : settings.noStatsInfo.getValue();

      IFormatReader baseReader = reader.getImageReader().getReader();
      if (log.isInfoEnabled()) {
        log.info("File format: " + format);
        log.info("Base reader: " + baseReader.getClass().getName());
      }
      notifyObservers(new ImportEvent.LOADED_IMAGE(shortName, 0, 0, 0));

      formatString = baseReader.getClass().getSimpleName();
      formatString = formatString.replace("Reader", "");

    } catch (Cancel c) {
      throw c;
    } catch (Throwable t) {
      throw helper.cancel(new ERR(), t, "error-on-init");
    } finally {
      MDC.clear();
    }
  }