Example usage for org.apache.commons.configuration2 AbstractConfiguration getBoolean

List of usage examples for org.apache.commons.configuration2 AbstractConfiguration getBoolean

Introduction

In this page you can find the example usage for org.apache.commons.configuration2 AbstractConfiguration getBoolean.

Prototype

@Override
public Boolean getBoolean(final String key, final Boolean defaultValue) 

Source Link

Document

Obtains the value of the specified key and tries to convert it into a Boolean object.

Usage

From source file:org.objectspace.rfid.FinnishDataModelRegex.java

/**
 * //ww  w.  j a v a 2  s  . c o m
 */
public FinnishDataModelRegex(AbstractConfiguration config, String field) {
    String baseconfig = "taghandle.autocorrect." + field.toLowerCase();
    pattern = new HashMap<String, Pattern>();
    Boolean active = config.getBoolean(baseconfig + ".active", false);
    if (active) {
        List<Object> matches = config.getList(baseconfig + ".matches.match.field");
        for (int i = 0; i < matches.size(); i++) {
            String name = config.getString(baseconfig + ".matches.match(" + i + ").field");
            String patternStr = config.getString(baseconfig + ".matches.match(" + i + ").pattern");
            Pattern p = Pattern.compile(patternStr);
            pattern.put(name, p);
        }
        replacement = config.getString(baseconfig + ".replacement");
    }

}

From source file:org.objectspace.rfid.library.taghandle.TagHandleInventory.java

/**
 * @throws ClassNotFoundException// w ww.  ja  v  a 2  s  . c  o m
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws SQLException
 * 
 */
public TagHandleInventory(AbstractConfiguration config, MainDialog mainDialog, WebCamThread wct)
        throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
    this.config = config;
    this.mainDialog = mainDialog;
    this.wct = wct;
    countryOfOwnerLib = config.getString("taghandle.countryofownerlib");
    ISIL = config.getString("taghandle.isil");
    usage = config.getInt("taghandle.usage");
    imageFile = config.getString("taghandle.imagefile", null);

    if (conn == null) {

        if (config != null) {
            if (config.getBoolean("database.active", false)) {
                String driver = config.getString("database.driver");
                String dsn = config.getString("database.dsn");

                if (driver != null && dsn != null) {
                    Class.forName(driver).newInstance();
                    conn = DriverManager.getConnection(dsn);
                    conn.setAutoCommit(true);
                }
            }
        }
    }

    regex = new HashMap<String, FinnishDataModelRegex>();
    for (String fld : FinnishDataModel.stringFieldNames) {
        FinnishDataModelRegex r = new FinnishDataModelRegex(config, fld);
        regex.put(fld, r);
    }

    uidList = new TreeSet<String>();
    if (conn != null) {
        String insertSQL = "INSERT INTO `rfid`.`inventory` "
                + "(`uid`, `version`, `usagetype`, `parts`, `partno`, `itemid`, `country`, `isil`, `inventorytime`"
                + ", `marker`, `sessionname`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, ?)";

        stmt = conn.prepareStatement(insertSQL);
    }

}

From source file:org.objectspace.rfid.library.taghandle.WebCamThread.java

/**
 * @param config//from  ww w .  ja v a 2s.com
 * @param md
 * 
 */
public WebCamThread(AbstractConfiguration config, MainDialog md) {
    this.config = config;
    this.md = md;
    canvas = new CanvasFrame(config.getString("taghandle.camera.windowtitle"));
    canvas.setLocation(config.getInt("taghandle.camera.window.posx", 0),
            config.getInt("taghandle.camera.window.posy", 0));
    canvas.setSize(config.getInt("taghandle.camera.window.width", 640),
            config.getInt("taghandle.camera.window.height", 480));
    sleep = config.getInt("taghandle.camera.sleep", 50);
    transpose = config.getBoolean("taghandle.camera.transpose", false);
    flip = config.getInt("taghandle.camera.flip", -2);
    cropX = config.getInt("taghandle.camera.crop.x", 0);
    cropY = config.getInt("taghandle.camera.crop.y", 0);
    cropWidth = config.getInt("taghandle.camera.crop.width", 1080);
    cropHeight = config.getInt("taghandle.camera.crop.height", 1900);

    converter = new OpenCVFrameConverter.ToIplImage();
}