Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.FileConfiguration


    public void save()
        throws RegistryException
    {
        if ( configuration instanceof FileConfiguration )
        {
            FileConfiguration fileConfiguration = (FileConfiguration) configuration;
            try
            {
                fileConfiguration.save();
            }
            catch ( ConfigurationException e )
            {
                throw new RegistryException( e.getMessage(), e );
            }
View Full Code Here


            this.giraphGraph = GiraphGraph.open(new BaseConfiguration());
            this.shell.getInterp().getContext().setProperty("g", this.giraphGraph);
        }
        if (args.size() == 1) {
            try {
                final FileConfiguration configuration = new PropertiesConfiguration();
                configuration.load(new File(args.get(0)));
                this.giraphGraph = GiraphGraph.open(configuration);
                this.shell.getInterp().getContext().setProperty("g", this.giraphGraph);
            } catch (final Exception e) {
                throw new RuntimeException(e.getMessage(), e);
            }
        } else if (args.size() == 2) {
            try {
                final FileConfiguration configuration = new PropertiesConfiguration();
                configuration.load(new File(args.get(0)));
                this.giraphGraph = GiraphGraph.open(configuration);
                this.graphVariable = args.get(1);
                this.shell.getInterp().getContext().setProperty(args.get(1), this.giraphGraph);
            } catch (final Exception e) {
                throw new RuntimeException(e.getMessage(), e);
View Full Code Here

    public void save()
        throws RegistryException
    {
        if ( configuration instanceof FileConfiguration )
        {
            FileConfiguration fileConfiguration = (FileConfiguration) configuration;
            try
            {
                fileConfiguration.save();
            }
            catch ( ConfigurationException e )
            {
                throw new RegistryException( e.getMessage(), e );
            }
View Full Code Here

  private boolean isBreakOnPingPong;
  private boolean isBreakOnAll;

    @Override
    protected void parse() {
      FileConfiguration cfg = getConfig();
      isForwardAll = cfg.getBoolean(FORWARD_ALL, false);
      isBreakOnPingPong = cfg.getBoolean(BREAK_ON_PING_PONG, false);
      isBreakOnAll = cfg.getBoolean(BREAK_ON_ALL, false);
    }
View Full Code Here

  private ProxyListenerPassiveScan getProxyListenerPassiveScan() {
        if (proxyListener == null) {
            proxyListener = new ProxyListenerPassiveScan(this);
           
            // Read from the configs
            FileConfiguration config = this.getModel().getOptionsParam().getConfig();
            List<String> pscanList = config.getList(PSCAN_NAMES);
            for (String pscanName : pscanList) {
                proxyListener.add(
                  new PassiveScanDefn(pscanName,
                    TYPE.valueOf(config.getString("pscans." + pscanName + ".type")),
                    config.getString("pscans." + pscanName + ".config"),
                    config.getString("pscans." + pscanName + ".reqUrlRegex"),
                    config.getString("pscans." + pscanName + ".reqHeadRegex"),
                    config.getString("pscans." + pscanName + ".resHeadRegex"),
                    config.getString("pscans." + pscanName + ".resBodyRegex"),
                    config.getBoolean("pscans." + pscanName + ".enabled")));
            }

            // TODO: can these be read automatically?
            /*
             * Disabled for now - concentrating on non automated stuff first
View Full Code Here

        }
        return proxyListener;
  }
 
  protected void save (PassiveScanDefn defn) {
        FileConfiguration config = this.getModel().getOptionsParam().getConfig();
      String pscanName = defn.getName();

      // Note that the name and type cant change on a save
    config.setProperty("pscans." + pscanName + ".config", defn.getConfig());
    config.setProperty("pscans." + pscanName + ".reqUrlRegex", defn.getRequestUrlRegex());
    config.setProperty("pscans." + pscanName + ".reqHeadRegex", defn.getRequestHeaderRegex());
    config.setProperty("pscans." + pscanName + ".resHeadRegex", defn.getResponseHeaderRegex());
    config.setProperty("pscans." + pscanName + ".resBodyRegex", defn.getResponseBodyRegex());
    config.setProperty("pscans." + pscanName + ".enabled", defn.isEnabled());
   
  }
View Full Code Here

   
  }

  @SuppressWarnings("unchecked")
  protected void add (PassiveScanDefn defn) {
        FileConfiguration config = this.getModel().getOptionsParam().getConfig();
      String pscanName = defn.getName();

        // Add to the list
      List names = config.getList(PSCAN_NAMES);
      names.add(pscanName);
    config.setProperty(PSCAN_NAMES, names);

      // Add the details
    config.setProperty("pscans." + pscanName + ".type", defn.getType().toString());
    config.setProperty("pscans." + pscanName + ".config", defn.getConfig());
    config.setProperty("pscans." + pscanName + ".reqUrlRegex", defn.getRequestUrlRegex());
    config.setProperty("pscans." + pscanName + ".reqHeadRegex", defn.getRequestHeaderRegex());
    config.setProperty("pscans." + pscanName + ".resHeadRegex", defn.getResponseHeaderRegex());
    config.setProperty("pscans." + pscanName + ".resBodyRegex", defn.getResponseBodyRegex());
    config.setProperty("pscans." + pscanName + ".enabled", defn.isEnabled());
   
  }
View Full Code Here

        }
    }

    public static void main(final String[] args) throws Exception {
        try {
            final FileConfiguration configuration = new PropertiesConfiguration();
            configuration.load(new File(args[0]));
            final GiraphGraphComputer computer = new GiraphGraphComputer(GiraphGraph.open(configuration));
            computer.program(VertexProgram.createVertexProgram(configuration)).submit().get();
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
View Full Code Here

     * @throws ConfigurationException if an error occurs
     */
    protected void setUpFileConfiguration() throws ConfigurationException,
            IOException
    {
        FileConfiguration fc = (FileConfiguration) config;
        fc.setReloadingStrategy(new AlwaysReloadingStrategy());
        fc.setURL(getSourceURL());

        // deregister event listener before load because load will cause
        // other events being generated
        config.removeConfigurationListener(l);
        fc.load();
        config.addConfigurationListener(l);
    }
View Full Code Here

     * @throws ConfigurationException if an error occurs
     */
    protected void setUpFileConfiguration() throws ConfigurationException,
            IOException
    {
        FileConfiguration fc = (FileConfiguration) config;
        fc.setReloadingStrategy(new AlwaysReloadingStrategy());
        fc.setURL(getSourceURL());

        // deregister event listener before load because load will cause
        // other events being generated
        config.removeConfigurationListener(l);
        fc.load();
        config.addConfigurationListener(l);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.FileConfiguration

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.