hudson.Launcher.getChannel()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中hudson.Launcher.getChannel()方法的一些代码示例,展示了Launcher.getChannel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Launcher.getChannel()方法的具体详情如下:
包路径:hudson.Launcher
类名称:Launcher
方法名:getChannel

Launcher.getChannel介绍

[英]Gets the channel that can be used to run a program remotely.
[中]获取可用于远程运行程序的通道。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public VirtualChannel getChannel() {
  3. return inner.getChannel();
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. @Nonnull
  3. @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
  4. justification = "We always require nonnull channel when we initialize this launcher")
  5. public VirtualChannel getChannel() {
  6. VirtualChannel vc = super.getChannel();
  7. if (vc == null) {
  8. throw new IllegalStateException("RemoteLauncher has been initialized with Null channel. It should not happen");
  9. }
  10. return super.getChannel();
  11. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Gets the executable path of this maven on the given target system.
  3. */
  4. public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
  5. return launcher.getChannel().call(new GetExecutable());
  6. }
  7. private class GetExecutable extends MasterToSlaveCallable<String, IOException> {

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Compares the version of this Maven installation to the minimum required version specified.
  3. *
  4. * @param launcher
  5. * Represents the node on which we evaluate the path.
  6. * @param mavenReqVersion
  7. * Represents the minimum required Maven version - constants defined above.
  8. */
  9. public boolean meetsMavenReqVersion(Launcher launcher, int mavenReqVersion) throws IOException, InterruptedException {
  10. // FIXME using similar stuff as in the maven plugin could be better
  11. // olamy : but will add a dependency on maven in core -> so not so good
  12. String mavenVersion = launcher.getChannel().call(new GetMavenVersion());
  13. if (!mavenVersion.equals("")) {
  14. if (mavenReqVersion == MAVEN_20) {
  15. if(mavenVersion.startsWith("2."))
  16. return true;
  17. }
  18. else if (mavenReqVersion == MAVEN_21) {
  19. if(mavenVersion.startsWith("2.") && !mavenVersion.startsWith("2.0"))
  20. return true;
  21. }
  22. else if (mavenReqVersion == MAVEN_30) {
  23. if(mavenVersion.startsWith("3."))
  24. return true;
  25. }
  26. }
  27. return false;
  28. }
  29. private class GetMavenVersion extends MasterToSlaveCallable<String, IOException> {

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. public VirtualChannel getChannel() {
  3. return inner.getChannel();
  4. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. @Nonnull
  3. @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
  4. justification = "We always require nonnull channel when we initialize this launcher")
  5. public VirtualChannel getChannel() {
  6. VirtualChannel vc = super.getChannel();
  7. if (vc == null) {
  8. throw new IllegalStateException("RemoteLauncher has been initialized with Null channel. It should not happen");
  9. }
  10. return super.getChannel();
  11. }

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

  1. public String getToolPath(Launcher launcher) throws IOException, InterruptedException {
  2. return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() {
  3. private static final long serialVersionUID = 1L;
  4. @Override
  5. public String call() {
  6. String home = Util.replaceMacro(getHome(), EnvVars.masterEnvVars);
  7. return getScannerToolPath(home);
  8. }
  9. });
  10. }
  11. }

代码示例来源:origin: org.jvnet.hudson.plugins/gradle

  1. public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
  2. return launcher.getChannel().call(new Callable<String, IOException>() {
  3. public String call() throws IOException {
  4. File exe = getExeFile();
  5. if (exe.exists())
  6. return exe.getPath();
  7. return null;
  8. }
  9. });
  10. }

代码示例来源:origin: jenkinsci/gradle-plugin

  1. public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
  2. return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() {
  3. public String call() throws IOException {
  4. File exe = getExeFile();
  5. if (exe.exists()) {
  6. return exe.getPath();
  7. }
  8. return null;
  9. }
  10. });
  11. }

代码示例来源:origin: org.jenkins-ci.plugins/port-allocator

  1. public void cleanUp() throws IOException, InterruptedException {
  2. manager.free(n);
  3. launcher.getChannel().call(new GlassFishCleanUpTask(buildListener));
  4. }
  5. };

代码示例来源:origin: org.jenkins-ci.plugins/port-allocator

  1. public void cleanUp() throws IOException, InterruptedException {
  2. manager.free(n);
  3. launcher.getChannel().call(new TomcatCleanUpTask(buildListener));
  4. }
  5. };

代码示例来源:origin: org.jvnet.hudson.plugins/port-allocator

  1. public void cleanUp() throws IOException, InterruptedException {
  2. manager.free(n);
  3. launcher.getChannel().call(new GlassFishCleanUpTask(buildListener));
  4. }
  5. };

代码示例来源:origin: jenkinsci/docker-plugin

  1. public static Optional<DockerCloud> getCloudThatWeBuiltOn(Run<?,?> build, Launcher launcher) {
  2. Optional<DockerCloud> cloud;
  3. // A bit unpleasant, but the getBuiltOn method is in AbstractBuild and
  4. // we may be a workflow run.
  5. if( build instanceof AbstractBuild ) {
  6. cloud = JenkinsUtils.getCloudForBuild((AbstractBuild)build);
  7. } else {
  8. cloud = JenkinsUtils.getCloudForChannel(launcher.getChannel());
  9. }
  10. return cloud;
  11. }

代码示例来源:origin: org.jenkins-ci.plugins/ssh-agent

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public boolean isSupported(Launcher launcher, final TaskListener listener) {
  6. try {
  7. return launcher.getChannel().call(new TomcatNativeInstalled(listener));
  8. } catch (Throwable throwable) {
  9. return false;
  10. }
  11. }

代码示例来源:origin: org.jenkins-ci.plugins/ssh-agent

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public RemoteAgent start(Launcher launcher, final TaskListener listener) throws Throwable {
  6. return launcher.getChannel().call(new JNRRemoteAgentStarter(listener));
  7. }

代码示例来源:origin: org.jvnet.hudson.main/maven3-plugin

  1. public FilePath getHome() {
  2. if (home == null) {
  3. home = new FilePath(launcher.getChannel(), installation.getHome());
  4. }
  5. return home;
  6. }

代码示例来源:origin: org.jvnet.hudson.plugins/port-allocator

  1. public void cleanUp() throws IOException, InterruptedException {
  2. manager.free(n);
  3. launcher.getChannel().call(new TomcatCleanUpTask(buildListener));
  4. }
  5. };

代码示例来源:origin: jenkinsci/artifactory-plugin

  1. public static Computer getCurrentComputer(Launcher launcher) {
  2. Jenkins j = Jenkins.getInstance();
  3. for (Computer c : j.getComputers()) {
  4. if (c.getChannel() == launcher.getChannel()) {
  5. return c;
  6. }
  7. }
  8. return null;
  9. }

代码示例来源:origin: jenkinsci/ssh-steps-plugin

  1. @Override
  2. protected Object run() throws Exception {
  3. RemoveStep step = (RemoveStep) getStep();
  4. if (Util.fixEmpty(step.getPath()) == null) {
  5. throw new IllegalArgumentException("path is null or empty");
  6. }
  7. return getLauncher().getChannel().call(new RemoveCallable(step, getListener()));
  8. }

代码示例来源:origin: jenkinsci/http-request-plugin

  1. @Override
  2. protected ResponseContentSupplier run() throws Exception {
  3. HttpRequestExecution exec = HttpRequestExecution.from(step,
  4. step.getQuiet() ? TaskListener.NULL : listener,
  5. this);
  6. Launcher launcher = getContext().get(Launcher.class);
  7. if (launcher != null) {
  8. return launcher.getChannel().call(exec);
  9. }
  10. return exec.call();
  11. }

相关文章