public void testTranslationKeyExistence() throws IOException { // use English version as the reference: final File englishFile = getEnglishTranslationFile(); final Properties enProps = new Properties(); enProps.load(new FileInputStream(englishFile)); final Set<Object> englishKeys = enProps.keySet(); for (Language lang : Language.REAL_LANGUAGES) { if (lang.getShortName().equals("en")) { continue; } final Properties langProps = new Properties(); final File langFile = getTranslationFile(lang); if (!langFile.exists()) { continue; } try (FileInputStream stream = new FileInputStream(langFile)) { langProps.load(stream); final Set<Object> langKeys = langProps.keySet(); for (Object englishKey : englishKeys) { if (!langKeys.contains(englishKey)) { System.err.println("***** No key '" + englishKey + "' in file " + langFile); } } } } }
public static Container setup() throws IOException { Properties properties = new Properties(); File revProps = new File("revenj.properties"); if (revProps.exists() && revProps.isFile()) { properties.load(new FileReader(revProps)); } else { String location = System.getProperty("revenj.properties"); if (location != null) { revProps = new File(location); if (revProps.exists() && revProps.isFile()) { properties.load(new FileReader(revProps)); } else { throw new IOException( "Unable to find revenj.properties in alternative location. Searching in: " + revProps.getAbsolutePath()); } } else { throw new IOException( "Unable to find revenj.properties. Searching in: " + revProps.getAbsolutePath()); } } String plugins = properties.getProperty("revenj.pluginsPath"); File pluginsPath = null; if (plugins != null) { File pp = new File(plugins); pluginsPath = pp.isDirectory() ? pp : null; } return setup( dataSource(properties), properties, Optional.ofNullable(pluginsPath), Optional.ofNullable(Thread.currentThread().getContextClassLoader())); }
/** implemented. */ public void test_propertyNames() { th.checkPoint("propertyNames()java.util.Enumeration"); Properties p = new Properties(); try { p.load(bin); } catch (Exception e) { } Enumeration en = p.propertyNames(); Enumeration ek = p.keys(); boolean ok = true; Vector v = new Vector(); Enumeration ek2 = p.keys(); while (ek2.hasMoreElements()) { v.add(ek2.nextElement()); } while (ek.hasMoreElements() && en.hasMoreElements()) { ek.nextElement(); Object next = en.nextElement(); if (!v.contains(next)) { ok = false; th.debug(next + " not in " + v); } } th.check(ok, "all elements are the same"); th.check( !ek.hasMoreElements() && !en.hasMoreElements(), "make sure both enumerations are empty"); p = new Properties(defProps); resetStreams(); try { p.load(bin); } catch (Exception e) { } v.add("Smart"); v.add("animal"); en = p.propertyNames(); ok = true; Object o; while (en.hasMoreElements()) { o = en.nextElement(); if (v.contains(o)) v.removeElement(o); else { ok = false; th.debug("got extra element: " + o); } } th.check(ok, "see if no double were generated"); th.check(v.isEmpty(), "check if all names were mentioned -- got:" + v); }
private List<String> getOutOfTopicTweets(HttpServletRequest request) throws ServletException { String topicFile = request.getParameter("topicFile"); List<String> listFiles = new ArrayList<String>(); Properties properties = new Properties(); try { properties.load(new FileInputStream(topicFile)); } catch (FileNotFoundException e) { final String emsg = "missing file for out of topic tweets: '" + topicFile + "'" + e.getMessage(); LOGGER.error(emsg); throw new ServletException(emsg, e); } catch (IOException e) { final String emsg = "can't read file for out of topic tweets: '" + topicFile + "'" + e.getMessage(); LOGGER.error(emsg); throw new ServletException(emsg); } for (Entry<Object, Object> propertyEntry : properties.entrySet()) { String key = (String) propertyEntry.getKey(); if (key.startsWith("outOfTopic")) { listFiles.add((String) propertyEntry.getValue()); } } List<String> tweets = new ArrayList<String>(); for (String filtFile : listFiles) { tweets.addAll(parseTweetsFromFile(filtFile)); } return tweets; }
public static void exportWithProperties(String propFile, String outFile) throws IOException { Properties props = new Properties(); try { props.load(new FileInputStream(propFile)); } catch (FileNotFoundException e) { System.err.println("Property file not found: " + propFile); System.exit(2); } catch (IOException e) { System.err.println("Unable to read properties: " + propFile); System.exit(2); } OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(outFile)); WikiEngine engine = new WikiEngine(props); Exporter x = new Exporter(out, true); x.export(engine); } catch (WikiException e) { // TODO Auto-generated catch block e.printStackTrace(System.err); System.exit(3); } catch (IOException e) { e.printStackTrace(System.err); System.exit(3); } finally { if (out != null) out.close(); // Make sure JSPWiki dies too System.exit(0); } }
/** * Read in a properties file containing the mapping between the emoticon names and image files and * return the mapping as a {@link Map} * * @param blogID Blog ID * @return {@link Map}between emoticon names and image files or <code>null</code> if the mapping * file could not be read */ private Map readEmoticonsMapForBlog(String blogID) { Map emoticonsMap = null; Properties emoticonsProperties = new Properties(); String configurationFile = _blojsomConfiguration.getBaseConfigurationDirectory() + blogID + '/' + _emoticonsConfigurationFile; InputStream is = _servletConfig.getServletContext().getResourceAsStream(configurationFile); if (is == null) { _logger.info("No emoticons configuration file found: " + configurationFile); } else { try { emoticonsProperties.load(is); is.close(); return BlojsomUtils.propertiesToMap(emoticonsProperties); } catch (IOException e) { _logger.error(e); } } return emoticonsMap; }
private static void loadPlatformZipPropertiesFromFile() { File installLocation = getInstallLocation(); if (installLocation != null) { // parent will be "eclipse" and the parent's parent will be "eclipse-testing" File parent = installLocation.getParentFile(); if (parent != null) { parent = parent.getParentFile(); if (parent != null) { File propertiesFile = new File(parent, "equinoxp2tests.properties"); if (!propertiesFile.exists()) return; archiveAndRepositoryProperties = new Properties(); try { InputStream is = null; try { is = new BufferedInputStream(new FileInputStream(propertiesFile)); archiveAndRepositoryProperties.load(is); } finally { is.close(); } } catch (IOException e) { return; } } } } }
/** 读取配置文件中的全局参数的配置,存到缓存中 */ private static void initProperties() { try { logger.debug("加载属性配置文件开始!"); String propUrl = getSysPath() + "config.properties"; logger.debug("系统全局参数的路径是:" + propUrl); FileInputStream fis = new FileInputStream(propUrl); // 属性文件流 Properties prop = new Properties(); // 属性集合对象 prop.load(fis); // 将属性文件流装载到Properties对象中 logger.debug("属性的长度:" + prop.size()); Map<String, String> paramMap = new HashMap<String, String>(); Iterator<Object> it = prop.keySet().iterator(); while (it.hasNext()) { String key = (String) (it.next()); String value = prop.getProperty(key); logger.debug(key + "=" + value); // global.ip=192.168.0.242的格式 // map.put(key, prop.getProperty(key)); paramMap.put(key, value); } logger.debug("加载属性配置文件结束!"); setConfigMap(paramMap); } catch (FileNotFoundException e) { logger.error("文件未找到!"); e.printStackTrace(); } catch (IOException e) { logger.error("读取文件的时候异常!"); e.printStackTrace(); } catch (Exception e) { logger.error("其它异常!"); e.printStackTrace(); } }
public Properties loadUpdateProperties() { File propertiesDirectory; Properties updateProperties = new Properties(); // First we look at local configuration directory propertiesDirectory = new File(System.getProperty("user.home"), PROPERTIES_DIRECTORY_NAME); if (!propertiesDirectory.exists()) { // Second we look at tangara binary path propertiesDirectory = getTangaraPath().getParentFile(); } BufferedInputStream input = null; try { input = new BufferedInputStream( new FileInputStream( new File(propertiesDirectory, getProperty("checkUpdate.fileName")))); updateProperties.load(input); input.close(); return updateProperties; } catch (IOException e) { LOG.warn("Error trying to load update properties"); } finally { IOUtils.closeQuietly(input); } return null; }
private void readConfig() throws FileNotFoundException, IOException { Properties p = new Properties(); p.load(new FileInputStream(new File(config))); mongoDb = p.getProperty("mongodb.url").trim(); dataBase = p.getProperty("mongodb.dbname_config").trim(); }
private Map<String, Plugin> loadPluginsFromClasspath(Settings settings) { Map<String, Plugin> plugins = newHashMap(); Enumeration<URL> pluginUrls = null; try { pluginUrls = settings.getClassLoader().getResources("es-plugin.properties"); } catch (IOException e) { logger.warn("Failed to find plugins from classpath", e); } while (pluginUrls.hasMoreElements()) { URL pluginUrl = pluginUrls.nextElement(); Properties pluginProps = new Properties(); InputStream is = null; try { is = pluginUrl.openStream(); pluginProps.load(is); String sPluginClass = pluginProps.getProperty("plugin"); Class<?> pluginClass = settings.getClassLoader().loadClass(sPluginClass); Plugin plugin = (Plugin) pluginClass.newInstance(); plugins.put(plugin.name(), plugin); } catch (Exception e) { logger.warn("Failed to load plugin from [" + pluginUrl + "]", e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } } return plugins; }
static String getPropertyName(int propertyId, boolean bNamed) { if (bFirstTime) { bFirstTime = false; propertyNames = new Properties(); try { InputStream propertyStream = PSTFile.class.getResourceAsStream("/PropertyNames.txt"); if (propertyStream != null) { propertyNames.load(propertyStream); } else { propertyNames = null; } } catch (FileNotFoundException e) { propertyNames = null; e.printStackTrace(); } catch (IOException e) { propertyNames = null; e.printStackTrace(); } } if (propertyNames != null) { String key = String.format((bNamed ? "%08X" : "%04X"), propertyId); return propertyNames.getProperty(key); } return null; }
@Test public void testState() throws IOException { final File fcontent = File.createTempFile("foo", "bar"); final Properties properties = new Properties(); final Date dt = new Date(); properties.put("int", 10453); properties.put("long", 1000000L); properties.put("date", dt); final OutputStream out = new FileOutputStream(fcontent); properties.store(out); final Properties loadProperties = new Properties(); final InputStream in = new FileInputStream(fcontent); loadProperties.load(in); assertNotNull(properties.get("int")); assertNotNull(properties.get("long")); assertNotNull(properties.get("date")); assertEquals(10453, properties.get("int")); assertEquals(1000000L, properties.get("long")); assertEquals(dt, properties.get("date")); }
/** * Parses the given file as properties file if it exists. Returns null if the file does not exist, * cannot be parsed or has no properties. */ private Properties parseProperties(File propsFile) { InputStream fis = null; try { if (mFileOp.exists(propsFile)) { fis = mFileOp.newFileInputStream(propsFile); Properties props = new Properties(); props.load(fis); // To be valid, there must be at least one property in it. if (!props.isEmpty()) { return props; } } } catch (IOException e) { // Ignore } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { } } } return null; }
private List<String> getTopicTweets(HttpServletRequest request) throws ServletException { final String topicFile = request.getParameter("topicFile"); final String fullFilePath = topicFile; List<String> listFiles = new ArrayList<String>(); Properties properties = new Properties(); try { properties.load(new FileInputStream(fullFilePath)); } catch (FileNotFoundException e) { LOGGER.error("missing file for in topic tweets: '" + fullFilePath + "'" + e.getMessage()); e.printStackTrace(); } catch (IOException e) { LOGGER.error("can't read file for in topic tweets: '" + fullFilePath + "'" + e.getMessage()); e.printStackTrace(); } for (Entry<Object, Object> propertyEntry : properties.entrySet()) { String key = (String) propertyEntry.getKey(); if (key.startsWith("inTopic")) { listFiles.add((String) propertyEntry.getValue()); } } List<String> tweets = new ArrayList<String>(); for (String filtFile : listFiles) { tweets.addAll(parseTweetsFromFile(filtFile)); } return tweets; }
/** * Returns the dev.properties as a property store. * * @return properties */ protected static Properties getDevProperties() { if (fgIsDev) { if (fgDevProperties == null) { fgDevProperties = new Properties(); if (fgDevPropertiesURL != null) { try { URL url = new URL(fgDevPropertiesURL); String path = url.getFile(); if (path != null && path.length() > 0) { File file = new File(path); if (file.exists()) { BufferedInputStream stream = null; try { stream = new BufferedInputStream(new FileInputStream(file)); fgDevProperties.load(stream); } catch (FileNotFoundException e) { PDECore.log(e); } catch (IOException e) { PDECore.log(e); } finally { if (stream != null) stream.close(); } } } } catch (MalformedURLException e) { PDECore.log(e); } catch (IOException e) { PDECore.log(e); } } } return fgDevProperties; } return null; }
private BalanceElementExtractor() { InputStream inputStream = null; try { Properties prop = new Properties(); String propFileName = "runtimecfg/balance_rules.properties"; inputStream = getClass().getClassLoader().getResourceAsStream(propFileName); if (inputStream != null) { prop.load(inputStream); Set<Map.Entry<Object, Object>> set = prop.entrySet(); for (Map.Entry<Object, Object> entry : set) { String[] values = entry.getValue().toString().split(";"); for (String v : values) { extract(entry.getKey().toString().toUpperCase(), v); } } } else { throw new FileNotFoundException( "property file '" + propFileName + "' not found in the classpath"); } } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
// -------------------------------- main ------------------------------- public static void main(String[] args) { String fileName; if (args.length > 0) fileName = args[0]; else fileName = Utils.getFileName("Choose a flow field metadata file"); Properties metaData = new Properties(); try { metaData.load(new FileInputStream(fileName)); } catch (IOException fnf) { System.err.println("Can't find file: " + fileName); System.exit(-1); } // ----- get all the properties from the prpoerty file and // VectorField.xData = new File(metaData.getProperty("xfile")); VectorField.yData = new File(metaData.getProperty("yfile")); VectorField.width = Utils.toInt(metaData.getProperty("xsize"), 128); VectorField.height = Utils.toInt(metaData.getProperty("ysize"), 128); VectorField.displayScale = Utils.toInt(metaData.getProperty("displayScale"), 6); VectorField.vectorScale = Utils.toDouble(metaData.getProperty("vectorScale"), 10.75); VectorField.numParticles = Utils.toInt(metaData.getProperty("numParticles"), 200); VectorField.timerDelay = Utils.toInt(metaData.getProperty("delay"), 30); FlowQuad vectorField = new FlowQuad("Static Vector Field"); }
/** * Constructor. * * @param ee comma separated list of execution environments names. * @throws PlatformException - If encountered during reading of profiles - If profile cannot be * found or determined */ ExecutionEnvironment(final String ee) throws PlatformException { // we make an union of the packages form each ee so let's have a unique set for it final Set<String> uniquePackages = new TreeSet<String>(); final Set<String> uniqueEE = new TreeSet<String>(); for (String segment : ee.split(",")) { try { final Properties profile = new Properties(); profile.load(discoverExecutionEnvironmentURL(segment).openStream()); final String systemPackagesProp = profile.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES, ""); if (systemPackagesProp != null && systemPackagesProp.trim().length() > 0) { uniquePackages.addAll(Arrays.asList(systemPackagesProp.split(","))); } final String eeProp = profile.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ""); if (eeProp != null && eeProp.trim().length() > 0) { uniqueEE.addAll(Arrays.asList(eeProp.split(","))); } } catch (IOException e) { throw new PlatformException("Could not read execution environment profile", e); } } m_systemPackages = join(uniquePackages, ","); m_executionEnvironment = join(uniqueEE, ","); }
// Recovery the application parameters from the properties file. private void recoverParameters() { try { // Open the file InputStream is = new FileInputStream(PROPERTIES_FILE); Properties props = new Properties(); props.load(is); // Obtain each property if (props.getProperty(PORT) != null) { port = Integer.parseInt(props.getProperty(PORT)); } if (props.getProperty(TRANSPORT) != null) { transport = props.getProperty(TRANSPORT); } if (props.getProperty(PROXY_ADDRESS) != null) { proxyAddress = props.getProperty(PROXY_ADDRESS); } if (props.getProperty(PROXY_PORT) != null) { proxyPort = Integer.parseInt(props.getProperty(PROXY_PORT)); } if (props.getProperty(PROXY_TRANSPORT) != null) { proxyTransport = props.getProperty(PROXY_TRANSPORT); } if (props.getProperty(SIP_URI) != null) { sip_uri = props.getProperty(SIP_URI); } // Close throws file is.close(); } catch (IOException ex) { System.err.println("Error reading properties file: " + ex); ex.printStackTrace(System.err); // System.exit(-1); } }
protected boolean checkConfig() { String configPath = System.getProperty(Utils.CONFIGPATH); if (configPath == null || configPath.equals("")) { logger.error("config.path not define, example: -Dconfig.path=/opt/path/config.properties"); return false; } try { properties.load(new FileInputStream(configPath)); } catch (IOException e) { logger.error("config file not exist :{0}", configPath); return false; } logger.debug(Utils.SIMPLETASKPACKAGE + ":" + properties.getProperty(Utils.SIMPLETASKPACKAGE)); if (!Utils.checkConfigValue(properties, Utils.SIMPLETASKPACKAGE)) { logger.error( Utils.SIMPLETASKPACKAGE + " not define, example: -D" + Utils.SIMPLETASKPACKAGE + "=cn.huangchaosuper.steps"); return false; } logger.debug(Utils.OPENSTEP + ":" + properties.getProperty(Utils.OPENSTEP)); if (!Utils.checkConfigValue(properties, Utils.OPENSTEP, "0")) { return false; } logger.debug(Utils.CLOSESTEP + ":" + properties.getProperty(Utils.CLOSESTEP)); if (!Utils.checkConfigValue(properties, Utils.CLOSESTEP, "9999")) { return false; } return true; }
/** * Reinitialize the logging properties and reread the logging configuration * from the given stream, which should be in java.util.Properties format. * A PropertyChangeEvent will be fired after the properties are read. * <p> * Any log level definitions in the new configuration file will be * applied using Logger.setLevel(), if the target Logger exists. * * @param ins stream to read properties from * @exception SecurityException if a security manager exists and if * the caller does not have LoggingPermission("control"). * @exception IOException if there are problems reading from the stream. */ public void readConfiguration(InputStream ins) throws IOException, SecurityException { checkAccess(); reset(); // Load the properties props.load(ins); // Instantiate new configuration objects. String names[] = parseClassNames("config"); for (int i = 0; i < names.length; i++) { String word = names[i]; try { Class clz = ClassLoader.getSystemClassLoader().loadClass(word); clz.newInstance(); } catch (Exception ex) { System.err.println("Can't load config class \"" + word + "\""); System.err.println("" + ex); // ex.printStackTrace(); } } // Set levels on any pre-existing loggers, based on the new properties. setLevelsOnExistingLoggers(); // Notify any interested parties that our properties have changed. changes.firePropertyChange(null, null, null); // Note that we need to reinitialize global handles when // they are first referenced. synchronized (this) { initializedGlobalHandlers = false; } }
public synchronized boolean reload(boolean force) { long now = System.currentTimeMillis(); if (force == false && now < last_check + 3000) return false; last_check = now; File file = getPropertyFile(); if (file.lastModified() == last_load_time) { return false; } last_load_time = file.lastModified(); Properties temp = new Properties(); if (file.canRead()) { FileInputStream in = null; try { in = new FileInputStream(file); temp.load(in); } catch (Exception e) { e.printStackTrace(); } finally { FileUtil.close(in); } } property = ConfigValueUtil.replaceSysProp(temp); apply(); ConfObserver.run(); return true; }
public static Map<String, String> readProperties(InputStream inputStream) { Map<String, String> propertiesMap = null; try { propertiesMap = new LinkedHashMap<String, String>(); Properties properties = new Properties(); properties.load(inputStream); Enumeration<?> enumeration = properties.propertyNames(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); String value = (String) properties.get(key); propertiesMap.put(key, value); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return propertiesMap; }
public void load() { datasources.clear(); try { if (repoURL != null) { File[] files = new File(repoURL.getFile()).listFiles(); for (File file : files) { if (!file.isHidden()) { Properties props = new Properties(); props.load(new FileInputStream(file)); String name = props.getProperty("name"); String type = props.getProperty("type"); if (name != null && type != null) { Type t = SaikuDatasource.Type.valueOf(type.toUpperCase()); SaikuDatasource ds = new SaikuDatasource(name, t, props); datasources.put(name, ds); } } } } else { throw new Exception("repo URL is null"); } } catch (Exception e) { throw new SaikuServiceException(e.getMessage(), e); } }
public static void main(String[] args) throws MessagingException, IOException { Properties props = new Properties(); try (InputStream in = Files.newInputStream(Paths.get("mail", "mail.properties"))) { props.load(in); } List<String> lines = Files.readAllLines(Paths.get(args[0]), Charset.forName("UTF-8")); String from = lines.get(0); String to = lines.get(1); String subject = lines.get(2); StringBuilder builder = new StringBuilder(); for (int i = 3; i < lines.size(); i++) { builder.append(lines.get(i)); builder.append("\n"); } Console console = System.console(); String password = new String(console.readPassword("Password: ")); Session mailSession = Session.getDefaultInstance(props); // mailSession.setDebug(true); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress(from)); message.addRecipient(RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); message.setText(builder.toString()); Transport tr = mailSession.getTransport(); try { tr.connect(null, password); tr.sendMessage(message, message.getAllRecipients()); } finally { tr.close(); } }
/** * Loads test configuration. * * @throws Exception if configuration is unawailable or broken. */ private void loadTestConfiguration() throws Exception { assert TEST_CONFIGURATION_FILE.isFile(); InputStream in = null; Properties p = new Properties(); try { in = new FileInputStream(TEST_CONFIGURATION_FILE); p.load(in); } finally { U.closeQuiet(in); } clientNodes = Integer.parseInt(p.getProperty("client.nodes.count")); srvNodes = Integer.parseInt(p.getProperty("server.nodes.count")); threadsPerClient = Integer.parseInt(p.getProperty("threads.per.client")); cancelRate = Integer.parseInt(p.getProperty("cancel.rate")); submitDelay = Long.parseLong(p.getProperty("submit.delay")); taskParams = new GridJobLoadTestParams( Integer.parseInt(p.getProperty("jobs.count")), Integer.parseInt(p.getProperty("jobs.test.duration")), Integer.parseInt(p.getProperty("jobs.test.completion.delay")), Double.parseDouble(p.getProperty("jobs.failure.probability"))); }
/* * Read system packages from a properties file * //TODO: we should probably grab this file from the Karaf distro itself instead of duplicating it in the plugin */ private void readSystemPackages() throws IOException { Properties properties = new Properties(); if (karafConfig.equals("config.properties")) { properties.load(getClass().getClassLoader().getResourceAsStream("config.properties")); } else { properties.load(new FileInputStream(new File(karafConfig))); } String packages = (String) properties.get(jreVersion); for (String pkg : packages.split(";")) { systemExports.add(pkg.trim()); } for (String pkg : packages.split(",")) { systemExports.add(pkg.trim()); } }
/** * Method used to load configuration from specific file * * @param propertiesFile configuration file */ public static void load(String propertiesFile) { try { FileInputStream cfgInStream = new FileInputStream(propertiesFile); prop.load(cfgInStream); } catch (Exception e) { logger.debug("error opening propertiesFile: " + propertiesFile, e); } }
protected static void initSystemProperties(MoquiStart cl, boolean useProperties) throws IOException { Properties moquiInitProperties = new Properties(); URL initProps = cl.getResource("MoquiInit.properties"); if (initProps != null) { InputStream is = initProps.openStream(); moquiInitProperties.load(is); is.close(); } // before doing anything else make sure the moqui.runtime system property exists (needed for // config of various things) String runtimePath = System.getProperty("moqui.runtime"); if (runtimePath != null && runtimePath.length() > 0) System.out.println("Determined runtime from system property: " + runtimePath); if (useProperties && (runtimePath == null || runtimePath.length() == 0)) { runtimePath = moquiInitProperties.getProperty("moqui.runtime"); if (runtimePath != null && runtimePath.length() > 0) System.out.println("Determined runtime from MoquiInit.properties file: " + runtimePath); } if (runtimePath == null || runtimePath.length() == 0) { // see if runtime directory under the current directory exists, if not default to the current // directory File testFile = new File("runtime"); if (testFile.exists()) runtimePath = "runtime"; if (runtimePath != null && runtimePath.length() > 0) System.out.println("Determined runtime from existing runtime directory: " + runtimePath); } if (runtimePath == null || runtimePath.length() == 0) { runtimePath = "."; System.out.println("Determined runtime by defaulting to current directory: " + runtimePath); } File runtimeFile = new File(runtimePath); runtimePath = runtimeFile.getCanonicalPath(); System.out.println("Canonicalized runtimePath: " + runtimePath); if (runtimePath.endsWith("/")) runtimePath = runtimePath.substring(0, runtimePath.length() - 1); System.setProperty("moqui.runtime", runtimePath); /* Don't do this here... loads as lower-level that WEB-INF/lib jars and so can't have dependencies on those, and dependencies on those are necessary // add runtime/lib jar files to the class loader File runtimeLibFile = new File(runtimePath + "/lib"); for (File jarFile: runtimeLibFile.listFiles()) { if (jarFile.getName().endsWith(".jar")) cl.jarFileList.add(new JarFile(jarFile)); } */ // moqui.conf=conf/development/MoquiDevConf.xml String confPath = System.getProperty("moqui.conf"); if (confPath == null || confPath.length() == 0) { confPath = moquiInitProperties.getProperty("moqui.conf"); } if (confPath == null || confPath.length() == 0) { File testFile = new File(runtimePath + "/" + defaultConf); if (testFile.exists()) confPath = defaultConf; } if (confPath != null) System.setProperty("moqui.conf", confPath); }