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

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

本文整理了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

@Override
public VirtualChannel getChannel() {
  return inner.getChannel();
}

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

@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();
}

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

/**
 * 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> {

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

/**
 * 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> {

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

@Override
public VirtualChannel getChannel() {
  return inner.getChannel();
}

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

@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();
}

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

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);
   }
  });
 }
}

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

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;
    }
  });
}

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

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;
    }
  });
}

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

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

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

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

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

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

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

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;
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean isSupported(Launcher launcher, final TaskListener listener) {
  try {
    return launcher.getChannel().call(new TomcatNativeInstalled(listener));
  } catch (Throwable throwable) {
    return false;
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public RemoteAgent start(Launcher launcher, final TaskListener listener) throws Throwable {
  return launcher.getChannel().call(new JNRRemoteAgentStarter(listener));
}

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

public FilePath getHome() {
  if (home == null) {
    home = new FilePath(launcher.getChannel(), installation.getHome());
  }
  return home;
}

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

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

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

public static Computer getCurrentComputer(Launcher launcher) {
  Jenkins j = Jenkins.getInstance();
  for (Computer c : j.getComputers()) {
    if (c.getChannel() == launcher.getChannel()) {
      return c;
    }
  }
  return null;
}

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

@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()));
}

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

@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();
}

相关文章