List of usage examples for org.apache.commons.transaction.file FileResourceManager FileResourceManager
public FileResourceManager(String storeDir, String workDir, ResourceIdToPathMapper idMapper, LoggerFacade logger, boolean debug)
From source file:org.apache.slide.store.txfile.AbstractTxFileStoreService.java
public void setParameters(Hashtable parameters) throws ServiceParameterErrorException, ServiceParameterMissingException { storeDir = (String) parameters.get(STORE_DIR_PARAMETER); workDir = (String) parameters.get(WORK_DIR_PARAMETER); if (storeDir == null) { throw new ServiceParameterMissingException(this, STORE_DIR_PARAMETER); }//from w ww .j av a2 s . co m if (workDir == null) { throw new ServiceParameterMissingException(this, WORK_DIR_PARAMETER); } new File(storeDir).mkdirs(); new File(workDir).mkdirs(); boolean debug = false; String debugString = (String) parameters.get(DEBUG_MODE_PARAMETER); if (debugString != null) { debug = "true".equals(debugString); } boolean urlEncodePath = false; String urlEncodePathString = (String) parameters.get(URLENCODE_PATH_PARAMETER); if (urlEncodePathString != null) { urlEncodePath = "true".equals(urlEncodePathString); } rm = new FileResourceManager(storeDir, workDir, urlEncodePath, new TxLogger(getLogger(), FileResourceManager.class.getName()), debug); getLogger().log("File Store configured to " + storeDir + ", working directory " + workDir, getLogChannel(), Logger.INFO); String timeoutString = (String) parameters.get(TIMEOUT_PARAMETER); if (timeoutString != null) { try { int timeout = Integer.parseInt(timeoutString); rm.setDefaultTransactionTimeout(timeout * 1000); getLogger().log("Set timeout to " + timeoutString, getLogChannel(), Logger.INFO); } catch (NumberFormatException nfe) { getLogger().log("Can not set timeout, '" + timeoutString + "' must be an integer!", getLogChannel(), Logger.WARNING); } } }