Package net.jini.config

Examples of net.jini.config.ConfigurationFile


   *
   * @param conf the configuration to examine
   * @return the array of entry/value pairs
   */
  private Object getEntries(Configuration conf) {
      ConfigurationFile cf = (ConfigurationFile) conf;
      ArrayList list = new ArrayList();
      Set names = cf.getEntryNames();
      Iterator it = names.iterator();
      String s = "";
      while (it.hasNext()) {
    String name = (String) it.next();
    s += name + "\n";
View Full Code Here


            } else if (forReader instanceof URL) {
                cfis = ((URL)forReader).openStream();
                reader = new InputStreamReader(cfis, "UTF-8");
            }
        }
        ConfigurationFile cf = null;
        if (       testCase == OPT_TEST_CASE) {
            cf = new ConfigurationFile(options);
        } else if (testCase == OPT_CL_TEST_CASE) {
            cf = new ConfigurationFile(options, fakeClassLoader);
        } else if (testCase == OPT_NULL_TEST_CASE) {
            cf = new ConfigurationFile(options, null);
        } else if (testCase == RDR_OPT_TEST_CASE) {
            cf = new ConfigurationFile(reader, options);
        } else if (testCase == RDR_OPT_CL_TEST_CASE) {
            cf = new ConfigurationFile(reader, options, fakeClassLoader);
        } else if (testCase == RDR_OPT_NULL_TEST_CASE) {
            cf = new ConfigurationFile(reader, options, null);
        }
        String s = cf.toString();
        logger.log(Level.INFO, "toString()=" + s);
        assertion(s != null, "toString method returns null");
        assertion(s.length() != 0, "toString method returns empty string");
        if (withReader(testCase)) {
            if (reader != null) reader.close();
View Full Code Here

            IOException,
            TestException
    {
        InputStream cfis = null;
        Reader reader = null;
        ConfigurationFile result = null;
        if (withReader(testCase)) {
            if (forReader instanceof File) {
                cfis = new FileInputStream((File)forReader);
                reader = new InputStreamReader(cfis, "UTF-8");
            } else if (forReader instanceof URL) {
View Full Code Here

      logger.log(Level.FINER, "Test Configuration options:");
      for (int i = 0; i < options.length; i++) {
    logger.log(Level.FINER, "   " + options[i]);
      }
      if (currentTag.equals("none")) {
    configuration = new ConfigurationFile(options);
      } else {
    configuration = new QAConfiguration(options, this);
      }
  } catch (ConfigurationException e) {
      if (getBooleanConfigVal("testConfigurationOptional",false)) {
View Full Code Here

    public Configuration createConfiguration() throws ConfigurationException
    {
        try {
            StringReader sr = new StringReader( getConfigurationText() );

            final ConfigurationFile cf = new ConfigurationFile(sr,null);

            return cf ;
        } catch( ConfigurationException c ) {
            throw c ;
        } catch( Exception e ) {
View Full Code Here

    }

    public Object run() {
  StringBuffer result = new StringBuffer();
  try {
      ConfigurationFile config =
    new ConfigurationFile(new StringReader(source), options);
      Object[] entryNames = config.getEntryNames().toArray();
      Arrays.sort(entryNames);
      for (int i = 0; i < entryNames.length; i++) {
    String fullName = (String) entryNames[i];
    int dot = fullName.lastIndexOf('.');
    String component = fullName.substring(0, dot);
    String name = fullName.substring(dot + 1);
    Class type = config.getEntryType(component, name);
    if (type == null) {
        type = Object.class;
    }
    if (i > 0) {
        result.append(' ');
    }
    result.append(fullName).append(" = ");
    result.append(config.getEntry(component, name, type));
    result.append(";");
      }
  } catch (Throwable t) {
      result.setLength(0);
      while (true) {
View Full Code Here

    }

    public Object run() {
  try {
      if (clSupplied) {
    return new ConfigurationFile(options, cl);
      } else {
    return new ConfigurationFile(options);
      }
  } catch (ConfigurationException e) {
      return e;
  }
    }
View Full Code Here

  this.name = name;
    }

    public Object run() {
  try {
      ConfigurationFile config = getConfig();
      return config.getEntryType(component, name);
  } catch (Exception e) {
      return e;
  }
    }
View Full Code Here

  }
    }

    ConfigurationFile getConfig() throws ConfigurationException {
  return clSpecified
      ? new ConfigurationFile(new String[]{location}, cl)
      : getDefaultConfig();
    }
View Full Code Here

      : getDefaultConfig();
    }

    public void check(Object result) throws Exception {
  Object compareTo = getCompareTo();
  ConfigurationFile config = getConfig();
  if (compareTo instanceof Class &&
      Exception.class.isAssignableFrom((Class) compareTo) &&
      result != null)
  {
      result = result.getClass();
View Full Code Here

TOP

Related Classes of net.jini.config.ConfigurationFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.