Example usage for org.apache.commons.configuration ConfigurationException printStackTrace

List of usage examples for org.apache.commons.configuration ConfigurationException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Usage

From source file:main.java.workload.twitter.TwitterWorkload.java

public void readConfig() {
    BufferedReader config_file = null;
    AbstractFileConfiguration parameters = null;
    int i, j = 0;

    try {//  ww w.  j  a  v a 2s. co  m
        config_file = new BufferedReader(
                new InputStreamReader(getClass().getResourceAsStream(this.getFile_name())));

        //Load configuration parameters
        parameters = new PropertiesConfiguration();
        parameters.load(config_file);

        //Read Twitter scale
        //WorkloadConstants.SCALE_FACTOR = parameters.getDouble("twitter.scale");
        WorkloadConstants.SCALE_FACTOR = Global.scaleFactor;
        Global.LOGGER.info("Twitter scale (as the number of users): " + WorkloadConstants.SCALE_FACTOR);

        //Read Twitter table types
        i = 1;
        for (Object param : parameters.getList("twitter.tbl.type")) {
            tbl_types.put(i, Integer.parseInt((String) param));
            ++i;
        }

        Global.LOGGER.info("Twitter tables types: " + tbl_types);

        //Read Twitter schema
        i = j = 0;
        ArrayList<Integer> temp = null;
        for (Object param : parameters.getList("twitter.schema")) {
            if (j >= tbl_types.size() || j == 0) {
                ++i;
                j = 0;
                temp = new ArrayList<Integer>();
                schema.put(i, temp);
            }

            schema.get(i).add(Integer.parseInt((String) param));
            ++j;
        }

        Global.LOGGER.info("Twitter table-level schema: " + schema);

        //Read Twitter transaction proportion
        i = 0;
        //new 
        this.trTypes = new int[tr_types];
        this.trProbabilities = new double[tr_types];

        for (Object param : parameters.getList("twitter.trs.proportions")) {
            ++i;
            tr_proportions.put(i, Double.parseDouble((String) param));

            this.trTypes[i - 1] = i;
            this.trProbabilities[i - 1] = Double.parseDouble((String) param);
        }

        Global.LOGGER.info("Twitter transaction proportions: " + tr_proportions);

    } catch (ConfigurationException e) {
        e.printStackTrace();
    } finally {
        if (config_file != null) {
            try {
                config_file.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:com.sf.energy.transfer.form.DataConfiguration.java

/**
 * ?/* w  w w  . ja v a  2 s.c  o  m*/
 */
@SuppressWarnings("unchecked")
private void initComponents() {

    try {
        config = Configuration.getConfiguration();
    } catch (ConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    config.setAutoSave(true);

    jPanel1 = new javax.swing.JPanel();
    scan = new javax.swing.JButton();
    pathSubmit = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    backupDays = new javax.swing.JTextField();
    backupSubmit = new javax.swing.JButton();
    manualBackup = new javax.swing.JButton();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    filePath = new javax.swing.JTextField();

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setTitle("???");

    scan.setText("?");
    scan.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            scanActionPerformed(evt);
        }
    });

    pathSubmit.setText("");
    pathSubmit.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            pathSubmitActionPerformed(e);
        }
    });

    jLabel2.setText("");

    backupSubmit.setText("");
    backupSubmit.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            backupSubmitAnctionPerformed(e);
        }
    });

    manualBackup.setText("");

    jLabel3.setText("");

    jLabel4.setText("");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 94,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(backupDays, javax.swing.GroupLayout.PREFERRED_SIZE, 115,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jLabel4).addGap(120, 120, 120).addComponent(backupSubmit))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(filePath, javax.swing.GroupLayout.PREFERRED_SIZE, 317,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(scan)))
                            .addGap(18, 18, 18).addComponent(pathSubmit))
                    .addComponent(manualBackup).addComponent(jLabel3)).addContainerGap(43, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(22, 22, 22).addComponent(jLabel3)
                    .addGap(8, 8, 8)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(scan).addComponent(pathSubmit).addComponent(filePath,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(24, 24, 24)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2).addComponent(backupSubmit)
                            .addComponent(backupDays, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                    .addGap(29, 29, 29).addComponent(manualBackup)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
}

From source file:au.com.dw.testdatacapturej.config.Configuration.java

private Configuration() {
    try {/*from www. ja  v a  2 s . co m*/
        // read in the list of configuration file names
        org.apache.commons.configuration.Configuration propConfig = new PropertiesConfiguration(
                "configuration.properties");

        String[] constructorConfigFiles = propConfig.getStringArray("constructor.config.files");
        constructors = new HashMap<String, List<String>>();

        readConstructorConfigFile(constructorConfigFiles);

        setters = new HashMap<String, List<String>>();

        String[] setterConfigFiles = propConfig.getStringArray("setter.config.files");
        readSetterConfigFile(setterConfigFiles);

        adderCollections = new HashMap<String, List<CollectionAdderConfig>>();
        String[] collectionConfigFiles = propConfig.getStringArray("collection.config.files");
        readCollectionConfigFile(collectionConfigFiles);

    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:com.sf.energy.transfer.form.ServerConfiguration.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   w  w  w  .jav a2 s .c o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
// desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    reset = new javax.swing.JButton();
    submit = new javax.swing.JButton();

    try {
        config = Configuration.getConfiguration();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    config.setAutoSave(true);

    ipAddress = new javax.swing.JTextField();
    ipPort = new javax.swing.JTextField();
    transferName = new javax.swing.JTextField();
    String ip = config.getString("server.serverIP");
    String port = config.getString("server.serverPort");
    String name = config.getString("server.transferName");

    if (ip != null && !"".equals(ip) && port != null && !"".equals(port) && port != null && !"".equals(port)) {
        ipAddress.setText(ip);
        ipPort.setText(port);
        transferName.setText(name);
    }
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setTitle("??");

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setText("    ?   IP ");

    jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel2.setText("  ?    ?");

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("???");

    reset.setText("?");
    reset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetActionPerformed(evt);
        }
    });

    submit.setText("");
    submit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            submitActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(reset)
                    .addGap(40, 40, 40).addComponent(submit).addGap(104, 104, 104))
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(63, 63, 63)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel2))
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ipPort, javax.swing.GroupLayout.PREFERRED_SIZE, 113,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ipAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 113,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(transferName, javax.swing.GroupLayout.PREFERRED_SIZE, 113,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(73, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(23, 23, 23)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(ipAddress, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(23, 23, 23)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2).addComponent(ipPort, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(31, 31, 31)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(transferName,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(33, 33, 33)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(reset).addComponent(submit))
                    .addContainerGap(27, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));

    pack();
}

From source file:au.com.dw.testdatacapturej.config.Configuration.java

/**
 * Load the constructor configurations from file. 
 * //from ww w. j  a v  a  2s  .com
 * An example of the XML structure:
 * 
 * <constructor-config>
 *
 *   <constructor class="dummy.ClassName">
 *      <argument>
 *        <field-name>paramFieldName</field-name>
 *      </argument>
 *      <argument>
 *        <field-name>param2FieldName</field-name>
 *      </argument>
 *   </constructor>
 *   .
 *   .
 *   .
 * 
 */
private void readConstructorConfigFile(String[] configFileNames) {
    XMLConfiguration xmlConfig = null;

    try {
        for (String fileName : configFileNames) {
            xmlConfig = new XMLConfiguration(fileName);

            if (xmlConfig != null) {
                // get all the constructor nodes and iterate through them
                List<?> constructorNodes = xmlConfig.configurationsAt("constructor");
                for (Iterator<?> it = constructorNodes.iterator(); it.hasNext();) {
                    HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();
                    // sub contains now all data about a single field

                    String className = sub.getString("[@class]");

                    List<String> paramFieldNames = configUtil.toStringList(sub.getList("argument.field-name"));

                    if (paramFieldNames != null && !paramFieldNames.isEmpty()) {
                        constructors.put(className, paramFieldNames);
                    }
                }
            }
        }
    } catch (ConfigurationException cex) {
        cex.printStackTrace();
    }
}

From source file:au.com.dw.testdatacapturej.config.Configuration.java

/**
 * Load the setter configurations from file. 
 * /*from  w w w.j  a  v a 2  s .  c o m*/
 * An example of the XML structure:
 * 
 *    <setter class="dummy.Classname">
 *      <argument>
 *        <field-name>paramFieldName</field-name>
 *          <alternative>ignore</alternative>
 *      </argument>
 *      <argument>
 *        <field-name>param2FieldName</field-name>
 *          <alternative>ignore</alternative>
 *      </argument>
 *    
 *   .
 *   .
 *   .
 *   
 *   Note that the <alternative> tag is currently unused, it is a placeholder for future dev is we
 *   want to substitute a setter method name.
 * 
 */
private void readSetterConfigFile(String[] configFileNames) {
    XMLConfiguration xmlConfig = null;

    try {
        for (String fileName : configFileNames) {
            xmlConfig = new XMLConfiguration(fileName);

            if (xmlConfig != null) {
                // get all the setter nodes and iterate through them
                List<?> constructorNodes = xmlConfig.configurationsAt("setter");
                for (Iterator<?> it = constructorNodes.iterator(); it.hasNext();) {
                    HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();
                    // sub contains now all data about a single field

                    String className = sub.getString("[@class]");

                    List<String> paramFieldNames = configUtil.toStringList(sub.getList("field.field-name"));

                    if (paramFieldNames != null && !paramFieldNames.isEmpty()) {
                        setters.put(className, paramFieldNames);
                    }
                }
            }
        }
    } catch (ConfigurationException cex) {
        cex.printStackTrace();
    }
}

From source file:au.com.dw.testdatacapturej.config.Configuration.java

/**
 * Load the collection configurations from file. 
 * //w  w w. jav a 2s . com
 * An example of the XML structure:
 * 
 * <collection-config>
 *
 *   <container class="dummy.ClassName">
 *      <argument>
 *        <field-name>collectionFieldName</field-name>
 *        <adder-method>adderMethodName</adder-method>
 *      </argument>
 *   </container>
 *   .
 *   .
 *   .
 * 
 */
private void readCollectionConfigFile(String[] configFileNames) {
    XMLConfiguration xmlConfig = null;

    try {
        for (String fileName : configFileNames) {
            xmlConfig = new XMLConfiguration(fileName);

            if (xmlConfig != null) {
                // get all the collection nodes and iterate through them
                List<?> collectionNodes = xmlConfig.configurationsAt("container");
                for (Iterator<?> it = collectionNodes.iterator(); it.hasNext();) {
                    HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();
                    // sub contains now all data about a single field

                    String className = sub.getString("[@class]");

                    List<String> collectionFieldNames = configUtil
                            .toStringList(sub.getList("argument.field-name"));
                    // not sure if this is the best way to handle multiple sub elements
                    List<String> adderMethodNames = configUtil
                            .toStringList(sub.getList("argument.adder-method"));

                    // TODO need more error checking here in case of incorrect configuration
                    if (collectionFieldNames != null && !collectionFieldNames.isEmpty()
                            && adderMethodNames != null && !adderMethodNames.isEmpty()) {
                        List<CollectionAdderConfig> collectionConfigs = new ArrayList<CollectionAdderConfig>();
                        for (int i = 0; i < collectionFieldNames.size(); i++) {
                            CollectionAdderConfig collectionConfig = new CollectionAdderConfig();
                            collectionConfig.setFieldName(collectionFieldNames.get(i));
                            collectionConfig.setAdderMethodName(adderMethodNames.get(i));

                            collectionConfigs.add(collectionConfig);
                        }

                        adderCollections.put(className, collectionConfigs);
                    }
                }
            }
        }
    } catch (ConfigurationException cex) {
        cex.printStackTrace();
    }
}

From source file:com.sf.energy.transfer.form.TransferConfiguration.java

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
// desc="Generated Code">//GEN-BEGIN:initComponents
/**//from ww w  .  j av  a  2s.co m
 * ?
 */
private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    connType = new javax.swing.JComboBox();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    ipAddress = new javax.swing.JTextField();
    ipPort = new javax.swing.JTextField();
    reset = new javax.swing.JButton();
    submit = new javax.swing.JButton();
    String ip = null;
    String port = null;

    try {
        config = Configuration.getConfiguration();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    config.setAutoSave(true);
    ip = config.getString("transfer.transferIP");
    port = config.getString("transfer.transferPort");
    if (null != ip && !"".equals(ip)) {
        ipAddress.setText(ip);
    }
    if (null != ip && !"".equals(ip)) {
        ipPort.setText(port);
    }

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setTitle("?");

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setText("?");

    connType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

    jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel2.setText(" ? IP");

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("??");

    reset.setText("?");
    reset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetActionPerformed(evt);
        }
    });

    submit.setText("");
    submit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            submitActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap(52, Short.MAX_VALUE)
                    .addGroup(
                            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(reset).addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel1).addComponent(jLabel2).addComponent(jLabel3)))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout
                                    .createSequentialGroup().addGap(17, 17, 17)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(ipPort, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel1Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(connType,
                                                            javax.swing.GroupLayout.Alignment.LEADING, 0,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(ipAddress,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 111,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGap(29, 29, 29))
                            .addGroup(jPanel1Layout.createSequentialGroup().addGap(49, 49, 49)
                                    .addComponent(submit)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(32, 32, 32).addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1)
                    .addComponent(connType, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(21, 21, 21)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2).addComponent(ipAddress,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(28, 28, 28)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(ipPort, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(reset).addComponent(submit))
                    .addContainerGap(26, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));

    pack();
}

From source file:edu.isi.wings.portal.controllers.DomainController.java

private boolean saveUserConfig(String file) {
    PropertyListConfiguration config = new PropertyListConfiguration();
    config.addProperty("user.domain", this.domain.getDomainName());
    for (String domname : this.user_domains.keySet()) {
        DomainInfo dom = this.user_domains.get(domname);
        config.addProperty("user.domains.domain(-1).name", dom.getName());
        config.addProperty("user.domains.domain.dir", dom.getDirectory());
        if (dom.isLegacy())
            config.addProperty("user.domains.domain.legacy", dom.isLegacy());
        else/* w w w . j av  a2  s  . c  o  m*/
            config.addProperty("user.domains.domain.url", dom.getUrl());
    }
    try {
        config.save(file);
        return true;
    } catch (ConfigurationException e) {
        e.printStackTrace();
        return false;
    }
}

From source file:net.pms.test.formats.FormatRecognitionTest.java

/**
 * When PMS is in the process of starting up, something particular happens.
 * The RootFolder is initialized and several VirtualVideoActions are added
 * as children. VirtualVideoActions use the MPG format and at the time of
 * initialization getDefaultRenderer() is used to determine whether or not
 * the format can be streamed./*  ww w.j a v  a2  s. c  om*/
 * <p>
 * Under these conditions Format.isCompatible() must return true, or
 * selecting the VirtualVideoAction will result in a "Corrupted data"
 * message.
 * <p>
 * This test verifies the case above.
 */
@Test
public void testVirtualVideoActionInitializationCompatibility() {
    boolean configurationLoaded = false;

    try {
        // Initialize PMS configuration like at initialization time, this
        // is relevant for RendererConfiguration.isCompatible().
        PMS.setConfiguration(new PmsConfiguration());
        configurationLoaded = true;
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }

    // Continue the test if the configuration loaded, otherwise skip it.
    assumeTrue(configurationLoaded);

    // Continue the test if the LibMediaInfoParser can be loaded, otherwise skip it.
    assumeTrue(LibMediaInfoParser.isValid());

    // Construct media info exactly as VirtualVideoAction does
    DLNAMediaInfo info = new DLNAMediaInfo();
    info.setContainer("mpegps");
    List<DLNAMediaAudio> audioCodes = new ArrayList<DLNAMediaAudio>();
    info.setAudioTracksList(audioCodes);
    info.setMimeType("video/mpeg");
    info.setCodecV("mpeg2");
    info.setMediaparsed(true);
    Format format = new MPG();
    format.match("test.mpg");

    // Test without rendererConfiguration, as can happen when plugins
    // create virtual video actions under a folder.

    assertEquals("VirtualVideoAction is initialized as compatible with null configuration", true,
            format.isCompatible(info, null));
}