/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import "JVMArgs.h"
- (void) dealloc {
[super dealloc];
}
}
// Replaces occurances of $JAVAROOT, $APP_PACKAGE, and $USER_HOME
if ([str rangeOfString:@"$JAVAROOT"].length == 0 && [str rangeOfString:@"$APP_PACKAGE"].length == 0 && [str rangeOfString:@"$USER_HOME"].length == 0) return str;
// expand $JAVAROOT first, because it can contain $APP_PACKAGE
[mutable replaceOccurrencesOfString:@"$JAVAROOT" withString:javaRoot options:0 range:NSMakeRange(0, [str length])];
[mutable replaceOccurrencesOfString:@"$APP_PACKAGE" withString:appPackage options:0 range:NSMakeRange(0, [str length])];
[mutable replaceOccurrencesOfString:@"$USER_HOME" withString:userHome options:0 range:NSMakeRange(0, [str length])];
return mutable;
}
[NSException raise:@kArgsFailure format:@"%@", [NSString stringWithFormat:@"Failed to find '%@' array in JVMInfo Info.plist"]];
}
// split
}
// for verbose logging
// all apps must have a JVMInfo dictionary inside their Info.plist
}
// initialize macro expansion values
// if the 'Arguments' key is defined, those override the ones that came into main()
if (jvmInfoArgs != nil) {
}];
} else if (argc != 0) {
// put the (macro expanded) args to main() in an NSArray
for (int i = 0; i < argc; i++) {
}
}
// all JVMInfo's must have a JRE or JDK key
[NSException raise:@kArgsFailure format:@"Failed to find 'JRE' or 'JDK' string in Info.plist JVMInfo"];
}
}
// if the app prefers 'client' or 'server', use the JVM key
// sniff for StartOnFirstThread
// for key compatability with the Apple JavaApplicationStub's 'Java' dictionary
}
// add $JAVAROOT directory to the JNI library search path
// 'WorkingDirectory' key changes current working directory
NSLog(@kArgsFailure " chdir() failed, could not change the current working directory to %s\n", [javaWorkingDir UTF8String]);
}
// 'Jar' key sets exactly one classpath entry
}
// 'ClassPath' key allows arbitrary classpath
[classpath addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kClassPathKey] delimitedBy:@":" withErrKey:kClassPathKey]];
[classpath addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kArchClassPathKey] delimitedBy:@":" withErrKey:kArchClassPathKey]];
// Sum up all the classpath entries into one big JVM arg
}];
// 'VMOptions' key allows arbitary VM start up options
[jvmOptions addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kVMOptionsKey] delimitedBy:@" " withErrKey:kVMOptionsKey]];
[jvmOptions addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kArchVMOptionsKey] delimitedBy:@" " withErrKey:kArchVMOptionsKey]];
// 'Properties' key is a sub-dictionary transfered to initial System.properties
if (properties != nil) {
[NSException raise:@kArgsFailure format:@"Failed to find 'Properties' dictionary in Info.plist JVMInfo"];
}
}];
}
// build the real JVM init args struct
NSString *expanded = [self expandMacros:[obj description]]; // turn everything into a string, and expand macros
}];
}
return [args autorelease];
}
@end