use of com.oracle.bedrock.runtime.remote.java.options.JavaDeployment in project oracle-bedrock by coherence-community.
the class RemoteJavaApplicationLauncher method onLaunching.
@Override
protected void onLaunching(OptionsByType optionsByType) {
// ----- establish default Profiles for this Platform (and Builder) -----
// java applications can automatically detect the following profiles
optionsByType.get(RemoteDebugging.class);
optionsByType.get(CommercialFeatures.class);
// ----- determine the remote classpath based on the deployment option -----
// when no deployment is specified we assume automatic
JavaDeployment deployment = (JavaDeployment) optionsByType.getOrSetDefault(Deployment.class, JavaDeployment.automatic());
if (deployment.isAutoDeployEnabled()) {
// determine the PlatformSeparators (assume unix if not defined)
PlatformSeparators separators = optionsByType.getOrSetDefault(PlatformSeparators.class, PlatformSeparators.forUnix());
// when an automatic deployment is specified,
// we use our modified class-path
// (which is where all of the deployed jars will be located)
String thisDir = ".";
String thisDirAllJars = thisDir + separators.getFileSeparator() + "*";
remoteClassPath = new ClassPath(thisDir, thisDirAllJars);
} else {
// when a non-automatic deployment is specified we use the specified class path
remoteClassPath = optionsByType.get(ClassPath.class);
}
// register the defined RemoteEventListeners before the application starts so they can
// immediately start receiving RemoteEvents
RemoteEvents remoteEvents = optionsByType.get(RemoteEvents.class);
remoteEvents.forEach((remoteEventListener, listenerOptions) -> remoteChannel.addListener(remoteEventListener, listenerOptions));
}
Aggregations