private void commonInitializer(File file) throws IOException { File parent = file.getParentFile(); if (parent == null) parent = new File(System.getProperty("user.dir")); if (!parent.canWrite()) { String msg = Logging.getMessage("generic.FolderNoWritePermission", parent.getAbsolutePath()); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } this.targetFile = new RandomAccessFile(file, "rw"); this.theChannel = this.targetFile.getChannel(); }
protected static String propertyToPath(String propName) { if (propName == null || propName.length() == 0) return null; String prop = System.getProperty(propName); if (prop != null) return prop; if (propName.equalsIgnoreCase("gov.nasa.worldwind.platform.alluser.store")) return determineAllUserLocation(); if (propName.equalsIgnoreCase("gov.nasa.worldwind.platform.user.store")) return determineSingleUserLocation(); return null; }
/** * Determines and stores the network sites to test for public network connectivity. The sites are * drawn from the JVM's gov.nasa.worldwind.avkey.NetworkStatusTestSites property ({@link * AVKey#NETWORK_STATUS_TEST_SITES}). If that property is not defined, the sites are drawn from * the same property in the World Wind or application configuration file. If the sites are not * specified there, the set of sites specified in {@link #DEFAULT_NETWORK_TEST_SITES} are used. To * indicate an empty list in the JVM property or configuration file property, specify an empty * site list, "". */ protected void establishNetworkTestSites() { String testSites = System.getProperty(AVKey.NETWORK_STATUS_TEST_SITES); if (testSites == null) testSites = Configuration.getStringValue(AVKey.NETWORK_STATUS_TEST_SITES); if (testSites == null) { this.networkTestSites.addAll(Arrays.asList(DEFAULT_NETWORK_TEST_SITES)); } else { String[] sites = testSites.split(","); List<String> actualSites = new ArrayList<String>(sites.length); for (String site : sites) { site = WWUtil.removeWhiteSpace(site); if (!WWUtil.isEmpty(site)) actualSites.add(site); } this.setNetworkTestSites(actualSites); } }
protected static String getUserHomeDir() { return System.getProperty("user.home"); }