@Override public VirtualChannel getChannel() { return inner.getChannel(); }
@Override @Nonnull @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "We always require nonnull channel when we initialize this launcher") public VirtualChannel getChannel() { VirtualChannel vc = super.getChannel(); if (vc == null) { throw new IllegalStateException("RemoteLauncher has been initialized with Null channel. It should not happen"); } return super.getChannel(); }
/** * Gets the executable path of this maven on the given target system. */ public String getExecutable(Launcher launcher) throws IOException, InterruptedException { return launcher.getChannel().call(new GetExecutable()); } private class GetExecutable extends MasterToSlaveCallable<String, IOException> {
/** * Compares the version of this Maven installation to the minimum required version specified. * * @param launcher * Represents the node on which we evaluate the path. * @param mavenReqVersion * Represents the minimum required Maven version - constants defined above. */ public boolean meetsMavenReqVersion(Launcher launcher, int mavenReqVersion) throws IOException, InterruptedException { // FIXME using similar stuff as in the maven plugin could be better // olamy : but will add a dependency on maven in core -> so not so good String mavenVersion = launcher.getChannel().call(new GetMavenVersion()); if (!mavenVersion.equals("")) { if (mavenReqVersion == MAVEN_20) { if(mavenVersion.startsWith("2.")) return true; } else if (mavenReqVersion == MAVEN_21) { if(mavenVersion.startsWith("2.") && !mavenVersion.startsWith("2.0")) return true; } else if (mavenReqVersion == MAVEN_30) { if(mavenVersion.startsWith("3.")) return true; } } return false; } private class GetMavenVersion extends MasterToSlaveCallable<String, IOException> {
@Override public VirtualChannel getChannel() { return inner.getChannel(); }
@Override @Nonnull @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "We always require nonnull channel when we initialize this launcher") public VirtualChannel getChannel() { VirtualChannel vc = super.getChannel(); if (vc == null) { throw new IllegalStateException("RemoteLauncher has been initialized with Null channel. It should not happen"); } return super.getChannel(); }
public String getToolPath(Launcher launcher) throws IOException, InterruptedException { return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() { private static final long serialVersionUID = 1L; @Override public String call() { String home = Util.replaceMacro(getHome(), EnvVars.masterEnvVars); return getScannerToolPath(home); } }); } }
public String getExecutable(Launcher launcher) throws IOException, InterruptedException { return launcher.getChannel().call(new Callable<String, IOException>() { public String call() throws IOException { File exe = getExeFile(); if (exe.exists()) return exe.getPath(); return null; } }); }
public String getExecutable(Launcher launcher) throws IOException, InterruptedException { return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() { public String call() throws IOException { File exe = getExeFile(); if (exe.exists()) { return exe.getPath(); } return null; } }); }
public void cleanUp() throws IOException, InterruptedException { manager.free(n); launcher.getChannel().call(new GlassFishCleanUpTask(buildListener)); } };
public void cleanUp() throws IOException, InterruptedException { manager.free(n); launcher.getChannel().call(new TomcatCleanUpTask(buildListener)); } };
public void cleanUp() throws IOException, InterruptedException { manager.free(n); launcher.getChannel().call(new GlassFishCleanUpTask(buildListener)); } };
public static Optional<DockerCloud> getCloudThatWeBuiltOn(Run<?,?> build, Launcher launcher) { Optional<DockerCloud> cloud; // A bit unpleasant, but the getBuiltOn method is in AbstractBuild and // we may be a workflow run. if( build instanceof AbstractBuild ) { cloud = JenkinsUtils.getCloudForBuild((AbstractBuild)build); } else { cloud = JenkinsUtils.getCloudForChannel(launcher.getChannel()); } return cloud; }
/** * {@inheritDoc} */ @Override public boolean isSupported(Launcher launcher, final TaskListener listener) { try { return launcher.getChannel().call(new TomcatNativeInstalled(listener)); } catch (Throwable throwable) { return false; } }
/** * {@inheritDoc} */ @Override public RemoteAgent start(Launcher launcher, final TaskListener listener) throws Throwable { return launcher.getChannel().call(new JNRRemoteAgentStarter(listener)); }
public FilePath getHome() { if (home == null) { home = new FilePath(launcher.getChannel(), installation.getHome()); } return home; }
public void cleanUp() throws IOException, InterruptedException { manager.free(n); launcher.getChannel().call(new TomcatCleanUpTask(buildListener)); } };
public static Computer getCurrentComputer(Launcher launcher) { Jenkins j = Jenkins.getInstance(); for (Computer c : j.getComputers()) { if (c.getChannel() == launcher.getChannel()) { return c; } } return null; }
@Override protected Object run() throws Exception { RemoveStep step = (RemoveStep) getStep(); if (Util.fixEmpty(step.getPath()) == null) { throw new IllegalArgumentException("path is null or empty"); } return getLauncher().getChannel().call(new RemoveCallable(step, getListener())); }
@Override protected ResponseContentSupplier run() throws Exception { HttpRequestExecution exec = HttpRequestExecution.from(step, step.getQuiet() ? TaskListener.NULL : listener, this); Launcher launcher = getContext().get(Launcher.class); if (launcher != null) { return launcher.getChannel().call(exec); } return exec.call(); }