List of usage examples for org.apache.commons.configuration Configuration getString
String getString(String key);
From source file:com.discursive.jccook.configuration.ConfigurationExample.java
public static void main(String[] args) throws Exception { ConfigurationExample example = new ConfigurationExample(); ConfigurationFactory factory = new ConfigurationFactory(); URL configURL = example.getClass().getResource("configuration.xml"); factory.setConfigurationURL(configURL); Configuration config = factory.getConfiguration(); System.out.println("Timeout: " + config.getFloat("timeout")); System.out.println("Region: " + config.getString("region")); System.out.println("Name: " + config.getString("name")); System.out.println("Speed: " + config.getInt("speed")); }
From source file:com.knowbout.epg.FakeUpdate.java
public static void main(String[] args) { String configFile = "/etc/knowbout.tv/epg.xml"; int nextarg = 0; if (args.length > 1) { if (args.length == 3 && args[0].equals("-config")) { configFile = args[1];//from ww w .j ava 2s . co m nextarg = 2; } else { System.err.println( "Usage: java " + FakeUpdate.class.getName() + " [-config <xmlfile>] <program title>"); System.exit(1); } } if (args.length <= nextarg) { System.err .println("Usage: java " + FakeUpdate.class.getName() + " [-config <xmlfile>] <program title>"); System.exit(1); } String title = args[nextarg]; try { XMLConfiguration config = new XMLConfiguration(configFile); HashMap<String, String> hibernateProperties = new HashMap<String, String>(); Configuration database = config.subset("database"); hibernateProperties.put(Environment.DRIVER, database.getString("driver")); hibernateProperties.put(Environment.URL, database.getString("url")); hibernateProperties.put(Environment.USER, database.getString("user")); hibernateProperties.put(Environment.PASS, database.getString("password")); hibernateProperties.put(Environment.DATASOURCE, null); HibernateUtil.setProperties(hibernateProperties); Session session = HibernateUtil.openSession(); Transaction tx = session.beginTransaction(); String hqlUpdate = "update Program set lastModified = :now where title = :title"; int updatedEntities = session.createQuery(hqlUpdate).setTimestamp("now", new Date()) .setString("title", title).executeUpdate(); tx.commit(); session.close(); String alertUrl = config.getString("alertUrl"); HessianProxyFactory factory = new HessianProxyFactory(); AlertQueue alerts = (AlertQueue) factory.create(AlertQueue.class, alertUrl); alerts.checkAlerts(); } catch (ConfigurationException e) { log.fatal("Configuration error in file " + configFile, e); } catch (IOException e) { log.fatal("Error downloading or processing EPG information", e); } }
From source file:edu.emory.library.tast.spss.Import.java
public static void main(String[] args) throws FileNotFoundException, IOException { if (args.length != 1) return;// www. java 2s. c o m String importDir = args[0]; Configuration conf = AppConfig.getConfiguration(); String fullImportDir = conf.getString(AppConfig.IMPORT_ROOTDIR) + File.separatorChar + importDir; LogWriter log = new LogWriter(fullImportDir); log.startImport(); AbstractDescriptiveObjectFactory objectFactory = new VoyageFactory(); ImportableAttribute[] attributes = Voyage.getAttributes(); Import imp = new Import(fullImportDir, "voyageid", objectFactory, attributes); imp.runImport(log); log.close(); }
From source file:com.knowbout.epg.EPG.java
public static void main(String[] args) { String configFile = "/etc/flip.tv/epg.xml"; boolean sitemaponly = false; if (args.length > 0) { if (args.length == 2 && args[0].equals("-config")) { configFile = args[1];/* w w w . ja v a 2 s. c om*/ } else if (args.length == 1 && args[0].equals("-sitemaponly")) { sitemaponly = true; } else { System.err.println("Usage: java " + EPG.class.getName() + " [-config <xmlfile>]"); System.exit(1); } } try { XMLConfiguration config = new XMLConfiguration(configFile); HashMap<String, String> hibernateProperties = new HashMap<String, String>(); Configuration database = config.subset("database"); hibernateProperties.put(Environment.DRIVER, database.getString("driver")); hibernateProperties.put(Environment.URL, database.getString("url")); hibernateProperties.put(Environment.USER, database.getString("user")); hibernateProperties.put(Environment.PASS, database.getString("password")); hibernateProperties.put(Environment.DATASOURCE, null); HibernateUtil.setProperties(hibernateProperties); if (!sitemaponly) { //test(config); // Get the server configuration to download the content Configuration provider = config.subset("provider"); InetAddress server = InetAddress.getByName(provider.getString("server")); File destinationFolder = new File(provider.getString("destinationFolder")); String username = provider.getString("username"); String password = provider.getString("password"); String remoteDirectory = provider.getString("remoteWorkingDirectory"); boolean forceDownload = provider.getBoolean("forceDownload"); Downloader downloader = new Downloader(server, username, password, destinationFolder, remoteDirectory, forceDownload); int count = downloader.downloadFiles(); log.info("Downloaded " + count + " files"); // int count = 14; if (count > 0) { log.info("Processing downloads now."); //Get the name of the files to process Configuration files = config.subset("files"); File headend = new File(destinationFolder, files.getString("headend")); File lineup = new File(destinationFolder, files.getString("lineup")); File stations = new File(destinationFolder, files.getString("stations")); File programs = new File(destinationFolder, files.getString("programs")); File schedules = new File(destinationFolder, files.getString("schedules")); Parser parser = new Parser(config, headend, lineup, stations, programs, schedules); parser.parse(); log.info("Finished parsing EPG Data. Invoking AlertQueue service now."); String alertUrl = config.getString("alertUrl"); HessianProxyFactory factory = new HessianProxyFactory(); AlertQueue alerts = (AlertQueue) factory.create(AlertQueue.class, alertUrl); alerts.checkAlerts(); log.info("Updating sitemap"); updateSitemap(config.getString("sitemap", "/usr/local/webapps/search/sitemap.xml.gz")); log.info("Exiting EPG now."); } else { log.info("No files were downloaded, so don't process the old files."); } } else { log.info("Updating sitemap"); updateSitemap(config.getString("sitemap", "/usr/local/webapps/search/sitemap.xml.gz")); log.info("Done updating sitemap"); } } catch (ConfigurationException e) { log.fatal("Configuration error in file " + configFile, e); e.printStackTrace(); } catch (UnknownHostException e) { log.fatal("Unable to connect to host", e); e.printStackTrace(); } catch (IOException e) { log.fatal("Error downloading or processing EPG information", e); e.printStackTrace(); } catch (Throwable e) { log.fatal("Unexpected Error", e); e.printStackTrace(); } }
From source file:co.turnus.analysis.pipelining.SimplePipeliningCliLauncher.java
public static void main(String[] args) { try {//from w w w . j av a 2s.c o m CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); SimplePipelining sp = new SimplePipelining(project); sp.setConfiguration(config); SimplePipelingData data = sp.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Simple Pipeling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsSimplePipeliningDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(SimplePipeliningCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.buffers.BoundedBufferSchedulingCliLauncher.java
public static void main(String[] args) { try {/*from ww w . j a v a 2 s. c o m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); BoundedBufferScheduling bbs = new BoundedBufferScheduling(project); bbs.setConfiguration(config); BufferMinimizationData data = bbs.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Bounded Buffer Scheduling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsBufferMinimizationDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(BXDF, ""); if (!bxdfName.isEmpty()) { File bxdfFile = new File(outPath, bxdfName + ".bxdf"); new XmlBufferMinimizationDataWriter().write(data, bxdfFile); TurnusLogger.info("BXDF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(BoundedBufferSchedulingCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getCause().toString()); } }
From source file:co.turnus.analysis.bottlenecks.AlgorithmicBottlenecksCliLauncher.java
public static void main(String[] args) { try {//w ww. j av a 2 s .c om CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); // load profiling weights File wFile = new File(config.getString(PROFILING_WEIGHTS)); ProfilingWeights weights = new XmlProfilingWeightsReader().read(project.getNetwork(), wFile); // build the trace weighter StatisticalTraceWeighter tw = new StatisticalTraceWeighter(); tw.configure(weights, ActionWeightsDistribution.class); // run the analysis AlgorithmicBottlenecks ab = new AlgorithmicBottlenecks(project, tw); ab.setConfiguration(config); AlgoBottlenecksData data = ab.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Algorithmic Bottlenecks results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsAlgoBottlenecksDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(AlgorithmicBottlenecksCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.buffers.MpcBoundedSchedulingCliLauncher.java
public static void main(String[] args) { try {/*from ww w. j av a 2 s . co m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); MpcBoundedScheduling mpc = new MpcBoundedScheduling(project); mpc.setConfiguration(config); BufferMinimizationData data = mpc.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Bounded Buffer Scheduling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsBufferMinimizationDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(BXDF, ""); if (!bxdfName.isEmpty()) { File bxdfFile = new File(outPath, bxdfName + ".bxdf"); new XmlBufferMinimizationDataWriter().write(data, bxdfFile); TurnusLogger.info("BXDF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(AlgorithmicBottlenecksCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.partitioning.CommunicationCostPartitioningCli.java
public static void main(String[] args) { try {/*from www . j a v a2 s . co m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); CommunicationCostPartitioning ccp = new CommunicationCostPartitioning(project); ccp.setConfiguration(config); PartitioningData data = ccp.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Communication cost partitioning results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsPartitioningDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(XCF, ""); if (!bxdfName.isEmpty()) { File xcfFile = new File(outPath, bxdfName + ".xcf"); new XmlPartitioningDataWriter().write(data, xcfFile); TurnusLogger.info("XCF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(CommunicationCostPartitioningCli.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:edu.pitt.dbmi.facebase.hd.HumanDataController.java
/** Entry point to application. Firstly it gathers properties from hd.properties file on CLASSPATH * Most properties are localisms to do with file path information, database connection strings, * and TrueCrypt program operation. Hopefully the application can run by only editing entries in * hd.properties file. hd.properties has normal java properties fragility but also app-specific * fragility--for example, the sshServerUrl must end with a colon, as in root@server: * Notice that program properties can also be set below--by filling in the empty strings following * declaration AND commenting-out the try-catch clause that follows which gathers these properties * from hd.properties. //w w w. j av a 2 s . c om */ public static void main(String[] args) { /** holds human-readable error data to be passed to addError() */ String errorString = ""; log.info("HumanDataController Started"); /** length of time to sleep in between each polling loop, 5secs is responsive, 5mins is alot */ String sleepFor = ""; /** Prefix path where TrueCrypt write operations will be performed (i.e. /tmp or /var/tmp), no trailing-slash */ String trueCryptBasePath = ""; /** TrueCrypt volume file extension (probably .tc or .zip) */ String trueCryptExtension = ""; /** Middle-of-path directory name to be created where TrueCrypt volume will be mounted */ String trueCryptMountpoint = ""; /** Human Data Server database credentials */ String hdDbUser = ""; String hdPasswd = ""; String hdJdbcUrl = ""; /** Hub database credentials */ String fbDbUser = ""; String fbPasswd = ""; String fbJdbcUrl = ""; /** Full path to truecrypt binary, (ie /usr/bin/truecrypt) */ String trueCryptBin = ""; /** Full path to scp binary, (ie /usr/bin/scp) */ String scpBin = ""; /** user@host portion of scp destination argument (ie. root@www.server.com:) */ String sshServerUrl = ""; /** file full path portion of scp destination argument (ie. /usr/local/downloads/) */ String finalLocation = ""; /** Full path to touch binary, (ie /bin/touch) */ String touchBin = ""; /** hardcoded truecrypt parameters; run "truecrypt -h" to learn about these */ String algorithm = ""; String hash = ""; String filesystem = ""; String volumeType = ""; String randomSource = ""; String protectHidden = ""; String extraArgs = ""; /** truecrypt parameters are packed into a map so we only pass one arg (this map) to method invoking truecrypt */ HashMap<String, String> trueCryptParams = new HashMap<String, String>(); trueCryptParams.put("trueCryptBin", ""); trueCryptParams.put("scpBin", ""); trueCryptParams.put("sshServerUrl", ""); trueCryptParams.put("finalLocation", ""); trueCryptParams.put("touchBin", ""); trueCryptParams.put("algorithm", ""); trueCryptParams.put("hash", ""); trueCryptParams.put("filesystem", ""); trueCryptParams.put("volumeType", ""); trueCryptParams.put("randomSource", ""); trueCryptParams.put("protectHidden", ""); trueCryptParams.put("extraArgs", ""); try { /** The properties file name is hardcoded to hd.properties--cannot be changed--this file must be on or at root of classpath */ final Configuration config = new PropertiesConfiguration("hd.properties"); sleepFor = config.getString("sleepFor"); hubURL = config.getString("hubURL"); responseTrigger = config.getString("responseTrigger"); trueCryptBasePath = config.getString("trueCryptBasePath"); trueCryptExtension = config.getString("trueCryptExtension"); trueCryptMountpoint = config.getString("trueCryptMountpoint"); hdDbUser = config.getString("hdDbUser"); hdPasswd = config.getString("hdPasswd"); hdJdbcUrl = config.getString("hdJdbcUrl"); fbDbUser = config.getString("fbDbUser"); fbPasswd = config.getString("fbPasswd"); fbJdbcUrl = config.getString("fbJdbcUrl"); trueCryptBin = config.getString("trueCryptBin"); scpBin = config.getString("scpBin"); sshServerUrl = config.getString("sshServerUrl"); finalLocation = config.getString("finalLocation"); touchBin = config.getString("touchBin"); algorithm = config.getString("algorithm"); hash = config.getString("hash"); filesystem = config.getString("filesystem"); volumeType = config.getString("volumeType"); randomSource = config.getString("randomSource"); protectHidden = config.getString("protectHidden"); extraArgs = config.getString("extraArgs"); trueCryptParams.put("trueCryptBin", trueCryptBin); trueCryptParams.put("scpBin", scpBin); trueCryptParams.put("sshServerUrl", sshServerUrl); trueCryptParams.put("finalLocation", finalLocation); trueCryptParams.put("touchBin", touchBin); trueCryptParams.put("algorithm", algorithm); trueCryptParams.put("hash", hash); trueCryptParams.put("filesystem", filesystem); trueCryptParams.put("volumeType", volumeType); trueCryptParams.put("randomSource", randomSource); trueCryptParams.put("protectHidden", protectHidden); trueCryptParams.put("extraArgs", extraArgs); log.debug("properties file loaded successfully"); } catch (final ConfigurationException e) { errorString = "Properties file problem"; String logString = e.getMessage(); addError(errorString, logString); log.error(errorString); } log.debug("initialize static class variable HumanDataManager declared earlier"); hdm = new HumanDataManager(hdDbUser, hdPasswd, hdJdbcUrl); log.debug("declare and initialize InstructionQueueManager"); InstructionQueueManager iqm = new InstructionQueueManager(fbDbUser, fbPasswd, fbJdbcUrl); log.debug("pass to the logfile/console all startup parameters for troubleshooting"); log.info("HumanDataController started with these settings from hd.properties: " + "hubURL=" + hubURL + " " + "responseTrigger=" + responseTrigger + " " + "trueCryptBasePath=" + trueCryptBasePath + " " + "trueCryptExtension=" + trueCryptExtension + " " + "trueCryptMountpoint=" + trueCryptMountpoint + " " + "hdDbUser=" + hdDbUser + " " + "hdPasswd=" + hdPasswd + " " + "hdJdbcUrl=" + hdJdbcUrl + " " + "fbDbUser=" + fbDbUser + " " + "fbPasswd=" + fbPasswd + " " + "fbJdbcUrl=" + fbJdbcUrl + " " + "trueCryptBin=" + trueCryptBin + " " + "scpBin=" + scpBin + " " + "sshServerUrl=" + sshServerUrl + " " + "finalLocation=" + finalLocation + " " + "touchBin=" + touchBin + " " + "algorithm=" + algorithm + " " + "hash=" + hash + " " + "filesystem=" + filesystem + " " + "volumeType=" + volumeType + " " + "randomSource=" + randomSource + " " + "protectHidden=" + protectHidden + " " + "extraArgs=" + extraArgs); log.debug("Enter infinite loop where program will continuously poll Hub server database for new requests"); while (true) { log.debug("LOOP START"); try { Thread.sleep(Integer.parseInt(sleepFor) * 1000); } catch (InterruptedException ie) { errorString = "Failed to sleep, got interrupted."; log.error(errorString, ie); addError(errorString, ie.getMessage()); } log.debug( "About to invoke InstructionQueueManager.queryInstructions()--Hibernate to fb_queue starts NOW"); List<InstructionQueueItem> aiqi = iqm.queryInstructions(); log.debug("Currently there are " + aiqi.size() + " items in the queue"); InstructionQueueItem iqi; String instructionName = ""; log.debug("About to send http request -status- telling Hub we are alive:"); httpGetter("status", "0"); if (aiqi.size() > 0) { log.debug( "There is at least one request, status=pending, queue item; commence processing of most recent item"); iqi = aiqi.get(0); log.debug("About to get existing user key, or create a new one, via fb_keychain Hibernate"); FbKey key = hdm.queryKey(iqi.getUid()); log.debug( "About to pull the JSON Instructions string, and other items, from the InstructionQueueItem"); String instructionsString = iqi.getInstructions(); instructionName = iqi.getName(); log.debug("About to create a new FileManager object with:"); log.debug(instructionName + trueCryptBasePath + trueCryptExtension + trueCryptMountpoint); FileManager fm = new FileManager(instructionName, trueCryptBasePath, trueCryptExtension, trueCryptMountpoint); ArrayList<Instructions> ali = new ArrayList<Instructions>(); log.debug( "FileManager.makeInstructionsObjects() creates multiple Instruction objects from the InstructionQueueItem.getInstructions() value"); if (fm.makeInstructionsObjects(instructionsString, ali)) { log.debug("FileManager.makeInstructionsObjects() returned true"); } else { errorString = "FileManager.makeInstructionsObjects() returned false"; log.error(errorString); addError(errorString, ""); } log.debug( "FileManager.makeFiles() uses its list of Instruction objects and calls its makeFiles() method to make/get requested data files"); if (fm.makeFiles(ali)) { log.debug("FileManager.makeFiles() returned true"); } else { errorString = "FileManager.makeFiles() returned false"; log.error(errorString); addError(errorString, ""); } //sends the size/100000 as seconds(100k/sec)...needs to be real seconds."); long bytesPerSecond = 100000; Long timeToMake = new Long(fm.getSize() / bytesPerSecond); String timeToMakeString = timeToMake.toString(); log.debug("Send http request -status- to Hub with total creation time estimate:"); log.debug(timeToMakeString); httpGetter("status", timeToMakeString); log.debug( "Update the queue_item row with the total size of the data being packaged with InstructionQueueManager.updateInstructionSize()"); if (iqm.updateInstructionSize(fm.getSize(), iqi.getQid())) { log.debug("InstructionQueueManager.updateInstructionSize() returned true"); } else { errorString = "InstructionQueueManager.updateInstructionSize() returned false"; log.error(errorString); addError(errorString, ""); } log.debug("About to make new TrueCryptManager with these args:"); log.debug(key.getEncryption_key() + fm.getSize() + fm.getTrueCryptPath() + fm.getTrueCryptVolumePath() + trueCryptParams); TrueCryptManager tcm = new TrueCryptManager(key.getEncryption_key(), fm.getSize(), fm.getTrueCryptPath(), fm.getTrueCryptVolumePath(), trueCryptParams); if (tcm.touchVolume()) { log.debug("TrueCryptManager.touchVolume() returned true, touched file"); } else { errorString = "TrueCryptManager.touchVolume() returned false"; log.error(errorString); addError(errorString, ""); } if (tcm.makeVolume()) { log.debug("TrueCryptManager.makeVolume() returned true, created TrueCrypt volume"); } else { errorString = "TrueCryptManager.makeVolume() returned false"; log.error(errorString); addError(errorString, ""); } if (tcm.mountVolume()) { log.debug("TrueCryptManager.mountVolume() returned true, mounted TrueCrypt volume"); } else { errorString = "TrueCryptManager.mountVolume() returned false"; log.error(errorString); addError(errorString, ""); } if (fm.copyFilesToVolume(ali)) { log.debug( "TrueCryptManager.copyFilesToVolume() returned true, copied requested files to mounted volume"); } else { errorString = "TrueCryptManager.copyFilesToVolume() returned false"; log.error(errorString); addError(errorString, ""); } if (tcm.disMountVolume()) { log.debug("TrueCryptManager.disMountVolume() returned true, umounted TrueCrypt volume"); } else { errorString = "TrueCryptManager.disMountVolume() returned false"; log.error(errorString); addError(errorString, ""); } if (tcm.sendVolumeToFinalLocation()) { log.debug( "TrueCryptManager.sendVolumeToFinalLocation() returned true, copied TrueCrypt volume to retreivable, final location"); } else { errorString = "TrueCryptManager.sendVolumeToFinalLocation() returned false"; log.error(errorString); addError(errorString, ""); } if (iqm.updateInstructionToCompleted(tcm.getFinalLocation() + fm.getTrueCryptFilename(), fm.getSize(), iqi.getQid(), getErrors(), getLogs())) { log.debug("InstructionQueueManager.updateInstructionToCompleted() returned true"); log.debug( "Processing of queue item is almost finished, updated fb_queue item row with location, size, status, errors, logs:"); log.debug(tcm.getFinalLocation() + fm.getTrueCryptFilename() + fm.getSize() + iqi.getQid() + getErrors() + getLogs()); } else { errorString = "InstructionQueueManager.updateInstructionToCompleted() returned false"; log.error(errorString); addError(errorString, ""); } log.debug("About to send http request -update- telling Hub which item is finished."); httpGetter("update", iqi.getHash()); log.debug("Finished processing pending queue item, status should now be complete or error"); } else { log.debug("Zero queue items"); } log.debug("LOOP END"); } }