public String[] getMultiple(String key) {
   if (key == null) throw new IllegalArgumentException();
   String[] values = properties.getStringArray(key);
   for (int i = 0; i < values.length; i++) {
     values[i] = process(key, values[i]);
   }
   return values;
 }
  /** @see Plugin#init() */
  public void init() throws PluginException {
    try {
      if (System.getProperty("roda.home") != null) {
        RODA_HOME = System.getProperty("roda.home");
      } else if (System.getenv("RODA_HOME") != null) {
        RODA_HOME = System.getenv("RODA_HOME");
      } else {
        RODA_HOME = null;
      }
      if (StringUtils.isBlank(RODA_HOME)) {
        throw new PluginException(
            "RODA_HOME enviroment variable and ${roda.home} system property are not set.");
      }
      final File pluginsConfigDirectory = new File(new File(RODA_HOME, "config"), "plugins");

      final File configFile = new File(pluginsConfigDirectory, CONFIGURATION_FILENAME);
      final PropertiesConfiguration configuration = new PropertiesConfiguration();

      if (configFile.isFile()) {
        configuration.load(configFile);
        logger.info("Loading configuration file from " + configFile);
      } else {
        configuration.load(getClass().getResourceAsStream("/" + CONFIGURATION_FILENAME));
        logger.info("Loading default configuration file from resources");
      }

      taverna_bin = configuration.getString("taverna_bin");
      logger.debug("taverna_bin=" + taverna_bin);

      xpathSelectIDs = configuration.getString("xpathSelectIDs");
      logger.debug("xpathSelectIDs=" + xpathSelectIDs);

      xpathSelectWorkflow = configuration.getString("xpathSelectWorkflow");
      logger.debug("xpathSelectWorkflow=" + xpathSelectWorkflow);

      workflowInputPort = configuration.getString("workflowInputPort");
      logger.debug("workflowInputPort=" + workflowInputPort);

      workflowOutputPort = configuration.getString("workflowOutputPort");
      logger.debug("workflowOutputPort=" + workflowOutputPort);

      workflowExtraPorts = configuration.getStringArray("workflowExtraPorts");
      logger.debug("workflowExtraPorts=" + Arrays.asList(workflowExtraPorts));

    } catch (ConfigurationException ex) {
      logger.debug("Error reading plugin configuration - " + ex.getMessage(), ex);
      throw new PluginException("Error reading plugin configuration - " + ex.getMessage(), ex);
    }

    planFile = new File(new File(RODA_HOME, "data"), PLAN_FILENAME);

    logger.debug("init() OK");
  }
  public ModuleContainer(File directory) throws Exception {
    this.directory = directory;
    this.config = new PropertiesConfiguration(new File(directory, "module.conf"));

    String[] jars = config.getStringArray("jars");
    URL[] urls = new URL[jars.length];
    for (int i = 0; i < jars.length; i++) {
      urls[i] = new URL("file:" + new File(directory, jars[i]).getPath());
    }

    urlClassLoader = new URLClassLoader(urls);
    Class<?> classApp = Class.forName(config.getString("moduleClass"), true, urlClassLoader);
    Object object = classApp.newInstance();
    module = (Module) object;
    defaultTopologyConfig = config.subset("defaultTopology");
    defaultAlgorithmConfiguration = new File(config.getString("defaultAlgorithmConfiguration"));
  }
  /** @see Plugin#init() */
  public void init() throws PluginException {
    PropertiesConfiguration configuration = new PropertiesConfiguration();
    try {

      String RODA_HOME = null;

      if (System.getProperty("roda.home") != null) {
        RODA_HOME = System.getProperty("roda.home"); // $NON-NLS-1$
      } else if (System.getenv("RODA_HOME") != null) {
        RODA_HOME = System.getenv("RODA_HOME"); // $NON-NLS-1$
      } else {
        RODA_HOME = null;
      }

      if (StringUtils.isBlank(RODA_HOME)) {
        throw new PluginException(
            "RODA_HOME enviroment variable and ${roda.home} system property are not set.");
      }

      File RODA_PLUGINS_CONFIG_DIRECTORY = new File(new File(RODA_HOME, "config"), "plugins");

      File configFile = new File(RODA_PLUGINS_CONFIG_DIRECTORY, getConfigurationFile());

      logger.debug("Trying to load configuration file from " + configFile);

      if (configFile.isFile()) {
        configuration.load(configFile);
        logger.info("Loading configuration file from " + configFile);
      } else {
        configuration.load(getClass().getResourceAsStream(getConfigurationFile()));
        logger.info("Loading default configuration file from resources");
      }

      this.converterServiceURL = configuration.getString("converterServiceURL");

      this.representationSubTypes = configuration.getStringArray("representationSubTypes");
      if (this.representationSubTypes == null) {
        this.representationSubTypes = new String[0];
      }

    } catch (ConfigurationException e) {
      logger.debug("Error reading plugin configuration - " + e.getMessage(), e);
      throw new PluginException("Error reading plugin configuration - " + e.getMessage(), e);
    }
  }
Esempio n. 5
0
  // Loads the settings from config file. If no values defined, the deafult values are returned.
  public static Settings loadSettings() {
    config.setListDelimiter('|');
    Settings s = new Settings();
    try {
      config.load("vidor.config");
    } catch (ConfigurationException ex) {
      ex.printStackTrace();
    }

    s.setVlcLocation(config.getString("vlclocation", ""));
    s.setThumbnailCount(config.getInt("thumbnailcount", 10));
    s.setThumbnailWidth(config.getInt("thumbnailwidth", 200));
    s.setThumbnailHighlightColor(config.getString("thumbnailhighlightcolor", ""));

    List<String> f = new ArrayList(Arrays.asList(config.getStringArray("folders")));
    if (!f.get(0).trim().isEmpty()) { // Bug fix - Empty folder check
      s.setFolders(f);
    }

    return s;
  }
Esempio n. 6
0
 private String[] getStringArray(String name) {
   return mProperties.getStringArray(name);
 }