Search in sources :

Example 1 with JavaDeployment

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));
}
Also used : PlatformSeparators(com.oracle.bedrock.runtime.options.PlatformSeparators) ClassPath(com.oracle.bedrock.runtime.java.ClassPath) RemoteEvents(com.oracle.bedrock.runtime.java.options.RemoteEvents) Deployment(com.oracle.bedrock.runtime.remote.options.Deployment) JavaDeployment(com.oracle.bedrock.runtime.remote.java.options.JavaDeployment) JavaDeployment(com.oracle.bedrock.runtime.remote.java.options.JavaDeployment)

Aggregations

ClassPath (com.oracle.bedrock.runtime.java.ClassPath)1 RemoteEvents (com.oracle.bedrock.runtime.java.options.RemoteEvents)1 PlatformSeparators (com.oracle.bedrock.runtime.options.PlatformSeparators)1 JavaDeployment (com.oracle.bedrock.runtime.remote.java.options.JavaDeployment)1 Deployment (com.oracle.bedrock.runtime.remote.options.Deployment)1