List of usage examples for org.apache.commons.configuration2 AbstractConfiguration getInt
@Override public int getInt(final String key)
From source file:org.objectspace.rfid.feig.ISO15693Feig.java
/** * constructor//from w ww . j a v a 2s. c o m * reads configuration data * * tagfeatures.tag<i>.name (name of ISO15693 tag) * * tagfeatures.tag<i>.usermemory (number of bits, which are stored on tag) * * tagfeatures.tag<i>.blocksize (number of bytes per block) * @param config abstract configuration */ public ISO15693Feig(AbstractConfiguration config) { assert config != null; this.config = config; feig = new FeigRFID(config); maxBlocksMap = new HashMap<String, Integer>(); if (config != null) { List<Object> tagFeatures = config.getList("tagfeatures.tag.name"); for (int i = 0; i < tagFeatures.size(); i++) { String tagName = config.getString("tagfeatures.tag(" + i + ").name"); int userMemory = config.getInt("tagfeatures.tag(" + i + ").usermemory"); int blockSize = config.getInt("tagfeatures.tag(" + i + ").blocksize"); int blocks = userMemory / (blockSize * 8); maxBlocksMap.put(tagName, blocks); } } }
From source file:org.objectspace.rfid.library.taghandle.TagHandleInventory.java
/** * @throws ClassNotFoundException/*from w w w . ja v a 2 s .com*/ * @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); } }