Example #1
0
  public static Config getDefaultMiscellaneous() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.verbose(), Defaults.verbose());
    cb.put(Keys.schedulerService(), Defaults.schedulerService());
    return cb.build();
  }
Example #2
0
  public static Config getSandboxBinaries() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.executorSandboxBinary(), Defaults.executorSandboxBinary());
    cb.put(Keys.stmgrSandboxBinary(), Defaults.stmgrSandboxBinary());
    cb.put(Keys.tmasterSandboxBinary(), Defaults.tmasterSandboxBinary());
    cb.put(Keys.shellSandboxBinary(), Defaults.shellSandboxBinary());
    return cb.build();
  }
Example #3
0
  public static Config getDefaultResources() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.stmgrRam(), Defaults.stmgrRam());
    cb.put(Keys.instanceCpu(), Defaults.instanceCpu());
    cb.put(Keys.instanceRam(), Defaults.instanceRam());
    cb.put(Keys.instanceDisk(), Defaults.instanceDisk());
    return cb.build();
  }
Example #4
0
  public static Config getSandboxHome() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.heronSandboxHome(), Defaults.heronSandboxHome());
    cb.put(Keys.heronSandboxBin(), Defaults.heronSandboxBin());
    cb.put(Keys.heronSandboxConf(), Defaults.heronSandboxConf());
    cb.put(Keys.heronSandboxLib(), Defaults.heronSandboxLib());
    cb.put(Keys.javaSandboxHome(), Defaults.javaSandboxHome());
    return cb.build();
  }
 /**
  * Creates DirectoryValidator to ensure directories read from user (if any - default otherwise)
  * settings via keys:
  *
  * <ul>
  *   <li>{@link DeploymentConfiguration#KEY_USER_CACHE_DIR}
  *   <li>{@link DeploymentConfiguration#KEY_USER_PERSISTENCE_CACHE_DIR}
  *   <li>{@link DeploymentConfiguration#KEY_SYSTEM_CACHE_DIR}
  *   <li>{@link DeploymentConfiguration#KEY_USER_LOG_DIR}
  *   <li>{@link DeploymentConfiguration#KEY_USER_TMP_DIR}
  *   <li>{@link DeploymentConfiguration#KEY_USER_LOCKS_DIR}
  * </ul>
  */
 public DirectoryValidator() {
   dirsToCheck = new ArrayList<File>(6);
   DeploymentConfiguration dc = JNLPRuntime.getConfiguration();
   String[] keys =
       new String[] {
         DeploymentConfiguration.KEY_USER_CACHE_DIR,
         DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR,
         DeploymentConfiguration.KEY_SYSTEM_CACHE_DIR,
         DeploymentConfiguration.KEY_USER_LOG_DIR,
         DeploymentConfiguration.KEY_USER_TMP_DIR,
         DeploymentConfiguration.KEY_USER_LOCKS_DIR
       };
   for (String key : keys) {
     String value = dc.getProperty(key);
     if (value == null) {
       OutputController.getLogger()
           .log(
               OutputController.Level.MESSAGE_DEBUG,
               "WARNING: key " + key + " has no value, setting to default value");
       value = Defaults.getDefaults().get(key).getValue();
     }
     if (value == null) {
       if (JNLPRuntime.isDebug()) {
         OutputController.getLogger()
             .log(
                 OutputController.Level.MESSAGE_DEBUG,
                 "WARNING: key " + key + " has no value, skipping");
       }
       continue;
     }
     File f = new File(value);
     dirsToCheck.add(f);
   }
 }
Example #6
0
 public void l(int level, String str, boolean sysOnly) {
   synchronized (MyLog.class) {
     str = str.trim();
     // Messages of this severity are handled specially
     if (level == Log.ERROR || level == Log.WARN) {
       Globals.setLastError(str);
     }
     if (level >= Defaults.getConsoleLogLevel()) {
       Log.println(level, tag, str);
     }
     if (!sysOnly) { // some messages only go to the Android log
       if (level >= Defaults.getUiLogLevel()) {
         FTPServerService.log(level, str);
       }
     }
   }
 }
Example #7
0
  public static Config getSandboxDefaultFiles() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.clusterSandboxFile(), Defaults.clusterSandboxFile());
    cb.put(Keys.defaultsSandboxFile(), Defaults.defaultsSandboxFile());
    cb.put(Keys.metricsSinksSandboxFile(), Defaults.metricsSinksSandboxFile());
    cb.put(Keys.packingSandboxFile(), Defaults.packingSandboxFile());
    cb.put(Keys.schedulerSandboxFile(), Defaults.schedulerSandboxFile());
    cb.put(Keys.stateManagerSandboxFile(), Defaults.stateManagerSandboxFile());
    cb.put(Keys.systemSandboxFile(), Defaults.systemSandboxFile());
    cb.put(Keys.uploaderSandboxFile(), Defaults.uploaderSandboxFile());
    return cb.build();
  }
Example #8
0
  public static Config getDefaultHome() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.heronHome(), Defaults.heronHome());
    cb.put(Keys.heronBin(), Defaults.heronBin());
    cb.put(Keys.heronConf(), Defaults.heronConf());
    cb.put(Keys.heronDist(), Defaults.heronDist());
    cb.put(Keys.heronEtc(), Defaults.heronEtc());
    cb.put(Keys.heronLib(), Defaults.heronLib());
    cb.put(Keys.javaHome(), Defaults.javaHome());
    return cb.build();
  }
  /**
   * Returns the caller UserDTO. If the caller is not set, the default for unauthenticated calls is
   * returned instead.
   */
  public static UserDTO get() {
    if (caller.get() == null) {
      // no caller set, try to get default username and password
      Defaults defaults = (Defaults) Context.getBean(Context.Name.WEB_SERVICES_CALLER_DEFAULTS);

      if (defaults.getUsername() != null && defaults.getPassword() != null) {
        IUserSessionBean userSession =
            (IUserSessionBean) Context.getBean(Context.Name.USER_SESSION);
        UserDTO user =
            userSession.webServicesAuthenticate(defaults.getUsername(), defaults.getPassword());

        if (user != null) {
          LOG.info("Using default username and password for " + "unauthenticated API call/s.");
          set(user);
        } else {
          throw new SecurityException("Invalid default " + "username/password");
        }
      } else {
        throw new SecurityException("No caller set.");
      }
    }
    return caller.get();
  }
Example #10
0
  public static Config getDefaultFilesAndPaths() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.corePackageUri(), Defaults.corePackageUri());
    // cb.put(Keys.logDirectory(), Defaults.logDirectory());

    cb.put(Keys.instanceClassPath(), Defaults.instanceClassPath());
    cb.put(Keys.metricsManagerClassPath(), Defaults.metricsManagerClassPath());
    cb.put(Keys.packingClassPath(), Defaults.packingClassPath());
    cb.put(Keys.schedulerClassPath(), Defaults.schedulerClassPath());
    cb.put(Keys.stateManagerClassPath(), Defaults.stateManagerClassPath());
    cb.put(Keys.uploaderClassPath(), Defaults.uploaderClassPath());
    return cb.build();
  }
Example #11
0
  public static Config getSandboxFilesAndPaths() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.instanceSandboxClassPath(), Defaults.instanceSandboxClassPath());
    cb.put(Keys.metricsManagerSandboxClassPath(), Defaults.metricsManagerSandboxClassPath());
    cb.put(Keys.packingSandboxClassPath(), Defaults.packingSandboxClassPath());
    cb.put(Keys.schedulerSandboxClassPath(), Defaults.schedulerSandboxClassPath());
    cb.put(Keys.stateManagerSandboxClassPath(), Defaults.stateManagerSandboxClassPath());
    cb.put(Keys.uploaderSandboxClassPath(), Defaults.uploaderSandboxClassPath());
    return cb.build();
  }
  /**
   * this is what a Mapper does
   *
   * @param valuein @return iterator over mapped key values
   */
  @Override
  public Iterable<KeyValueObject<PeakMZKey, ICluster>> mapValues(final ICluster valuein) {
    double precursorMZ = valuein.getPrecursorMz();

    List<KeyValueObject<PeakMZKey, ICluster>> ret =
        new ArrayList<KeyValueObject<PeakMZKey, ICluster>>();
    List<ISpectrum> clusteredSpectra = valuein.getClusteredSpectra();
    if (!clusteredSpectra.isEmpty() && precursorMZ < MZIntensityUtilities.HIGHEST_USABLE_MZ) {
      for (ISpectrum match : clusteredSpectra) {
        ICluster cluster = ClusterUtilities.asCluster(match);
        for (int peakMz : match.asMajorPeakMZs(Defaults.getMajorPeakCount())) {
          PeakMZKey mzKey = new PeakMZKey(peakMz, precursorMZ);
          ret.add(new KeyValueObject<PeakMZKey, ICluster>(mzKey, cluster));
        }
      }
    }
    return ret;
  }
Example #13
0
 /** Create a default instance of F10. */
 public F10() {
   this(Defaults.getRandomizer(F10.class));
 }
Example #14
0
  public static Config getSandboxJars() {
    Config.Builder cb = Config.newBuilder();

    cb.put(Keys.schedulerSandboxJar(), Defaults.schedulerSandboxJar());
    return cb.build();
  }
Example #15
0
 private EquatableArray(String serialized) {
   this(Defaults.deserialize(serialized));
 }
Example #16
0
 @Override
 public String toString() {
   return Defaults.serialize(content);
 }
Example #17
0
 /** Create a default instance of F6. */
 public F6() {
   this(Defaults.getRandomizer(F6.class));
 }