List of usage examples for org.apache.commons.configuration2 AbstractConfiguration getString
@Override public String getString(final String key)
From source file:org.objectspace.library.marcxmlimporter.MarcReader.java
/** * @param config// w w w. ja va 2 s .c om * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException * @throws SQLException * */ public MarcReader(AbstractConfiguration config) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { sig_subfield = config.getString("marcreader.signature.subfield"); datafield = config.getString("marcreader.datafield"); code_subfield = config.getString("marcreader.barcode.subfield"); title_datafield = config.getString("marcreader.title.datafield"); title_subfield = config.getString("marcreader.title.subfield"); if (conn == null) { if (config != null) { 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); } } } }
From source file:org.objectspace.rfid.elatec.ISO15693Elatec.java
/** * //from w w w.j ava2 s. c om */ public ISO15693Elatec(AbstractConfiguration config) { this.config = config; elatec = new ElatecRFID(config); readattempts = config.getInt("device.elatec.readattempts", 2); writeattempts = config.getInt("device.elatec.writeattempts", 3); 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.feig.ISO15693Feig.java
/** * constructor/* www . j a va2 s . 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.FinnishDataModelRegex.java
/** * /*w ww. ja v a2 s . c om*/ */ 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.ISO15693ReaderFactory.java
public static ISO15693Reader createReader(AbstractConfiguration config) throws Exception { String reader = config.getString("device.select"); switch (reader) { case "feig": return new ISO15693Feig(config); case "elatec": return new ISO15693Elatec(config); default://from w w w . j a v a 2 s . c o m throw new Exception("unknow reader: " + reader); } }
From source file:org.objectspace.rfid.library.inventory.InventoryCallback.java
/** * @throws ClassNotFoundException/*from w w w . ja v a2 s . com*/ * @throws IllegalAccessException * @throws InstantiationException * @throws SQLException * */ public InventoryCallback(InventoryDialog dlg, AbstractConfiguration config) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { this.config = config; this.dlg = dlg; sessionName = LocalDateTime.now().toString(); if (conn == null) { if (config != null) { 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); } } } uidList = new TreeSet<String>(); String insertSQL = "REPLACE INTO `rfid`.`inventory` " + "(`uid`, `version`, `usagetype`, `parts`, `partno`, `itemid`, `country`, `isil`, `inventorytime`" + ", `marker`, `sessionname`, `raw`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, ?, ?)"; stmt = conn.prepareStatement(insertSQL); String selectsql = "SELECT signatur FROM code_sig WHERE barcode=?"; stmt2 = conn.prepareStatement(selectsql); }
From source file:org.objectspace.rfid.library.taghandle.TagHandleInventory.java
/** * @throws ClassNotFoundException/*from ww w .j a 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 www. ja va 2s .c o m*/ * @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(); }