private void readExternal9_1_1(ObjectInput in) throws IOException, ClassNotFoundException { uid = BootIOUtils.readString(in); vmName = BootIOUtils.readString(in); vmVersion = BootIOUtils.readString(in); vmVendor = BootIOUtils.readString(in); startTime = in.readLong(); memoryHeapInit = in.readLong(); memoryHeapMax = in.readLong(); memoryNonHeapInit = in.readLong(); memoryNonHeapMax = in.readLong(); inputArguments = BootIOUtils.readStringArray(in); bootClassPath = BootIOUtils.readString(in); classPath = BootIOUtils.readString(in); systemProperties = BootIOUtils.readMapStringString(in); pid = in.readLong(); environmentVariables = BootIOUtils.readMapStringString(in); } }
private void writeExternal9_1_1(ObjectOutput out) throws IOException { BootIOUtils.writeString(out, uid); BootIOUtils.writeString(out, vmName); BootIOUtils.writeString(out, vmVersion); BootIOUtils.writeString(out, vmVendor); out.writeLong(startTime); out.writeLong(memoryHeapInit); out.writeLong(memoryHeapMax); out.writeLong(memoryNonHeapInit); out.writeLong(memoryNonHeapMax); BootIOUtils.writeStringArray(out, inputArguments); BootIOUtils.writeString(out, bootClassPath); BootIOUtils.writeString(out, classPath); BootIOUtils.writeMapStringString(out, systemProperties); out.writeLong(pid); BootIOUtils.writeMapStringString(out, environmentVariables); }
public static Long parseStringAsBytes(String property) { return BootIOUtils.parseStringAsBytes(property); }
private void addLibs(StringBuilder classpath, String path) { File libDir = new File(path); if (libDir.exists() && libDir.isDirectory()) { for (File f : BootIOUtils.listFiles(libDir)) { if (logger.isLoggable(Level.FINE)) logger.fine("Adding " + f.getAbsolutePath() + " to ClassPath"); classpath.append(f.getAbsolutePath()).append(File.pathSeparator); } } }
public static void writeString(ObjectOutput out, String s) throws IOException { BootIOUtils.writeString(out, s); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { version = BootIOUtils.readString(in); }
public static Map<String, String> readMapStringString(ObjectInput in) throws IOException, ClassNotFoundException { return BootIOUtils.readMapStringString(in); }
public static void writeStringArray(ObjectOutput out, String[] array) throws IOException { BootIOUtils.writeStringArray(out, array); }
public static void writeMapStringString(ObjectOutput out, Map<String, String> map) throws IOException { BootIOUtils.writeMapStringString(out, map); }
public static Long parseStringAsBytes(String property) { if (isEmpty(property)) return null; // Find first non-digit char: int pos = 0; while (pos < property.length() && Character.isDigit(property.charAt(pos))) pos++; String prefix = property.substring(0, pos); long number = Long.parseLong(prefix); String suffix = pos < property.length() ? property.substring(pos) : null; int factor = parseMemoryUnit(suffix); return number * factor; }
public JavaCommandBuilder classpath(String classpath) { if (!isEmpty(classpath)) { this.classpath.add(BootIOUtils.quoteIfContainsSpace(classpath)); } return this; }
private XapLookup(XapManagerClusterInfo managerClusterInfo) { setGroups(System.getProperty(XAP_LOOKUP_GROUPS, System.getenv("XAP_LOOKUP_GROUPS"))); String explicitLocators = System.getProperty(XAP_LOOKUP_LOCATORS, System.getenv("XAP_LOOKUP_LOCATORS")); String managerLocators = toLocators(managerClusterInfo); if (!BootIOUtils.isEmpty(managerLocators) && !BootIOUtils.isEmpty(explicitLocators) && !managerLocators.equals(explicitLocators)) throw new IllegalStateException("Ambiguous locators: Manager locators: [" + managerLocators +"], explicit locators: [" + explicitLocators + "]"); setLocators(!managerLocators.isEmpty() ? managerLocators : explicitLocators); }
private void appendLibPlatformToClasspath( final StringBuilder defaultESMClasspath, final String platformName) { final File lib = new File(gsLibPlatform + "/" + platformName); if (lib.exists() && lib.isDirectory()) { for (File f : BootIOUtils.listFiles(lib)) { defaultESMClasspath.append(f.getAbsolutePath()).append(File.pathSeparator); } } }
@Override public void writeExternal(ObjectOutput out) throws IOException { BootIOUtils.writeString(out, version); }
public static String readString(ObjectInput in) throws IOException, ClassNotFoundException { return BootIOUtils.readString(in); }
public static boolean deleteFileOrDirectoryIfExists(File fileOrDirectory) { if (fileOrDirectory.isDirectory()) { for (File file : BootIOUtils.listFiles(fileOrDirectory)) deleteFileOrDirectoryIfExists(file); } return fileOrDirectory.delete(); }
public static void writeStringArray(ObjectOutput out, String[] array) throws IOException { if (array == null) out.writeInt(-1); else { int length = array.length; out.writeInt(length); for (int i = 0; i < length; i++) writeString(out, array[i]); } }
public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException { String[] array = null; int length = in.readInt(); if (length >= 0) { array = new String[length]; for (int i = 0; i < length; i++) array[i] = readString(in); } return array; }
public ClasspathBuilder append(String path, FileFilter filter, boolean archivesOnly) { filter = archivesOnly ? new JarFileFilter(filter) : filter; File f = new File(path); if (f.isDirectory()) { final File[] files = BootIOUtils.listFiles(f, filter); for (File file : files) this.files.add(file); } else { if (filter == null || filter.accept(f)) files.add(f); } return this; }
public static void writeMapStringString(ObjectOutput out, Map<String, String> map) throws IOException { if (map == null) out.writeInt(-1); else { int length = map.size(); out.writeInt(length); for (Entry<String, String> entry : map.entrySet()) { writeString(out, entry.getKey()); writeString(out, entry.getValue()); } } }