当前位置: 首页>>代码示例>>Java>>正文


Java ToolInstallation类代码示例

本文整理汇总了Java中hudson.tools.ToolInstallation的典型用法代码示例。如果您正苦于以下问题:Java ToolInstallation类的具体用法?Java ToolInstallation怎么用?Java ToolInstallation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ToolInstallation类属于hudson.tools包,在下文中一共展示了ToolInstallation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doFillTypeItems

import hudson.tools.ToolInstallation; //导入依赖的package包/类
public ListBoxModel doFillTypeItems() {
    ListBoxModel r = new ListBoxModel();
    r.add("<any>", "");
    for (ToolDescriptor<?> desc : ToolInstallation.all()) {
        String idOrSymbol = desc.getId();

        Set<String> symbols = SymbolLookup.getSymbolValue(desc);

        if (!symbols.isEmpty()) {
            idOrSymbol = symbols.iterator().next();
        }

        r.add(desc.getDisplayName(), idOrSymbol);
    }
    return r;
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:17,代码来源:ToolStep.java

示例2: performInstallation

import hudson.tools.ToolInstallation; //导入依赖的package包/类
/**
 * The following code changes the file download request for installer files 
 * (iOSAppInstaller, MATT, or SCommand) to have a User-Agent of 
 * "Jenkins/<Jenkins version #>" instead of "Java/<Java version #>".
 * This allow this call to correctly identify itself as coming from the Jenkins 
 * plugin.
 * 
 * WARNING: This code was taken from Jenkins (1.544) src, FilePath.java
 * and DownloadFromUrlInstaller.java.
 * A few changes were made to logging and to make the code work.  May be
 * vulnerable to Jenkins base code changes in the future.  Issues related
 * to this may crop up in the future concerning any type of installer 
 * downloading because of this.  This addition is because of Bug 71924.
 * 
 * TODO: Remove code when Jenkins will properly identify itself in the 
 * User-Agent.  All the code below is tied to being able to add to the
 * URLConnection that the User-Agent is, instead, "Jenkins/..." and not
 * "Java/...".
 */
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
  try
  {
    return super.performInstallation(tool, node, log);
  }
  catch (IOException e)
  {
    FilePath expected = preferredLocation(tool, node);
    Installable inst = getInstallable();
    
    if(installIfNecessaryFrom(expected, new URL(inst.url), log, "Unpacking " + inst.url + " to " + expected + " on " + node.getDisplayName())) {
      expected.child(".timestamp").delete(); // we don't use the timestamp
      FilePath base = findPullUpDirectory(expected);
      if(base!=null && base!=expected)
          base.moveAllChildrenTo(expected);
      // leave a record for the next up-to-date check
      expected.child(".installedFrom").write(inst.url,"UTF-8");
      expected.act(new ChmodRecAPlusX());
    }
    
    return expected;
  }
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:43,代码来源:CommonInstaller.java

示例3: doSetUp

import hudson.tools.ToolInstallation; //导入依赖的package包/类
private boolean doSetUp(FilePath tarBall, List<String> packages, ChrootToolsetProperty property, ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {

        // build setup command
        ArgumentListBuilder cmd = defaultArgumentList(tarBall, "--create");

        // don't forget to install additional packages
        if (!getDefaultPackages().isEmpty()) {
            cmd.add("--extrapackages").add(StringUtils.join(packages, " "));
        }

        if (property != null && !Strings.isNullOrEmpty(property.getSetupArguments())) {
            cmd.add(QuotedStringTokenizer.tokenize(property.getSetupArguments()));
        }
        //make pbuilder less verbose by ignoring stdout
        return node.createLauncher(log).launch().cmds(cmd).stderr(log.getLogger()).join() == 0;
    }
 
开发者ID:rmohr,项目名称:chroot-plugin,代码行数:17,代码来源:PBuilderWorker.java

示例4: doFillNameItems

import hudson.tools.ToolInstallation; //导入依赖的package包/类
public ListBoxModel doFillNameItems(@QueryParameter String type) {
    type = Util.fixEmpty(type);
    ListBoxModel r = new ListBoxModel();

    for (ToolDescriptor<?> desc : ToolInstallation.all()) {
        if (type != null && !desc.getId().equals(type) && !SymbolLookup.getSymbolValue(desc).contains(type)) {
            continue;
        }
        for (ToolInstallation tool : desc.getInstallations()) {
            r.add(tool.getName());
        }
    }
    return r;
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:15,代码来源:ToolStep.java

示例5: getOpenEdgeInstallations

import hudson.tools.ToolInstallation; //导入依赖的package包/类
public List<OpenEdgeInstallation> getOpenEdgeInstallations() {
  List<OpenEdgeInstallation> list = new ArrayList<>();
  for (ToolDescriptor<?> desc : ToolInstallation.all()) {
    for (ToolInstallation inst : desc.getInstallations()) {
      if (inst instanceof OpenEdgeInstallation) {
        list.add((OpenEdgeInstallation) inst);
      }
    }
  }
  return list;
}
 
开发者ID:Riverside-Software,项目名称:openedge-jenkins-plugin,代码行数:12,代码来源:OpenEdgeAxis.java

示例6: doFillToolUsedItems

import hudson.tools.ToolInstallation; //导入依赖的package包/类
/**
 * List model to choose the tool used (normally, it should be the ZAProxy tool).
 * 
 * @return a {@link ListBoxModel}
 */
public ListBoxModel doFillToolUsedItems() {
	ListBoxModel items = new ListBoxModel();
	for(ToolDescriptor<?> desc : ToolInstallation.all()) {
		for (ToolInstallation tool : desc.getInstallations()) {
			items.add(tool.getName());
		}
	}
	return items;
}
 
开发者ID:jenkinsci,项目名称:zaproxy-plugin,代码行数:15,代码来源:ZAProxy.java

示例7: performInstallation

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public FilePath performInstallation(ToolInstallation tool, Node node,
        TaskListener log) throws IOException, InterruptedException {
    // Gather properties for the node to install on
    final String[] nodeProperties = node.getChannel().call(
            new GetSystemProperties("os.name", "os.arch"));

    final Installable inst = getInstallable(nodeProperties[0], nodeProperties[1]);
    if (inst == null) {
        String msg = String
                .format("%s [%s]: No tool download known for OS `%s` and arch `%s`.",
                        getDescriptor().getDisplayName(), tool.getName(),
                        nodeProperties[0], nodeProperties[1]);
        throw new AbortException(msg);
    }

    final FilePath toolPath = getFixedPreferredLocation(tool, node);
    if (!isUpToDate(toolPath, inst)) {
        if (toolPath.installIfNecessaryFrom(
                new URL(inst.url),
                log,
                "Unpacking " + inst.url + " to " + toolPath + " on "
                        + node.getDisplayName())) {
            // we don't use the timestamp..
            toolPath.child(".timestamp").delete();
            // pull up extra subdir...
            FilePath base = findPullUpDirectory(toolPath);
            if (base != null && !base.equals(toolPath)) {
                base.moveAllChildrenTo(toolPath);
            }
            // needed for executable flag
            toolPath.act(new ChmodRecAPlusX());
            // leave a record for the next up-to-date check
            toolPath.child(".installedFrom").write(inst.url, "UTF-8");
        }
    }

    return toolPath.child("ninja");
}
 
开发者ID:15knots,项目名称:jenkins-ninja-installer,代码行数:40,代码来源:NinjaInstaller.java

示例8: getToolHome

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public String getToolHome(Node node, ToolInstallation installation,
                          TaskListener log) throws IOException, InterruptedException {
    final Executor currentExecutor = Executor.currentExecutor();
    if (installation.getHome() == null && currentExecutor != null
            && currentExecutor.getOwner().getNode() instanceof DeployNowSlave) {
        return "/notmaven";
    } else {
        return null;
    }
}
 
开发者ID:jenkinsci,项目名称:deployer-framework-plugin,代码行数:12,代码来源:MavenInstallationProvider.java

示例9: getApplicableDescriptors

import hudson.tools.ToolInstallation; //导入依赖的package包/类
/**
 * Return list of applicable GitTool descriptors.
 * @return list of applicable GitTool descriptors
 */
@SuppressWarnings("unchecked")
public List<ToolDescriptor<? extends GitTool>> getApplicableDescriptors() {
    List<ToolDescriptor<? extends GitTool>> r = new ArrayList<>();
    Jenkins jenkinsInstance = Jenkins.getInstance();
    for (ToolDescriptor<?> td : jenkinsInstance.<ToolInstallation,ToolDescriptor<?>>getDescriptorList(ToolInstallation.class)) {
        if (GitTool.class.isAssignableFrom(td.clazz)) { // This checks cast is allowed
            r.add((ToolDescriptor<? extends GitTool>)td); // This is the unchecked cast
        }
    }
    return r;
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:16,代码来源:GitTool.java

示例10: getApplicableDescriptors

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<ToolDescriptor<? extends TransifexTool>> getApplicableDescriptors()
{
	List<ToolDescriptor<? extends TransifexTool>> r = new ArrayList<ToolDescriptor<? extends TransifexTool>>();
	for (ToolDescriptor td : Jenkins.getInstance().<ToolInstallation, ToolDescriptor<?>> getDescriptorList(
	        ToolInstallation.class))
	{
		if (TransifexTool.class.isAssignableFrom(td.clazz))
			r.add(td);
	}
	return r;
}
 
开发者ID:jenkinsci,项目名称:transifex-plugin,代码行数:13,代码来源:TransifexTool.java

示例11: performInstallation

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
    ChrootToolset toolset = ChrootToolset.getInstallationByName(tool.getName());
    FilePath path = ChrootWorker.getByName(toolset.getToolName()).setUp(tool, node, log);
    if (path == null) {
        throw new IOException("Installation of tool " + tool.getName() + " on node " + node.getDisplayName() + " failed.");
    }
    return path;
}
 
开发者ID:rmohr,项目名称:chroot-plugin,代码行数:10,代码来源:ChrootCreator.java

示例12: performInstallation

import hudson.tools.ToolInstallation; //导入依赖的package包/类
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
    FilePath expectedLocation = preferredLocation(tool, node);
    PrintStream out = log.getLogger();
    try {
        if(!acceptLicense) {
            out.println(Messages.JDKInstaller_UnableToInstallUntilLicenseAccepted());
            return expectedLocation;
        }
        // already installed?
        FilePath marker = expectedLocation.child(".installedByHudson");
        if (marker.exists() && marker.readToString().equals(id)) {
            return expectedLocation;
        }
        expectedLocation.deleteRecursive();
        expectedLocation.mkdirs();

        JDKInstaller.Platform p = JDKInstaller.Platform.of(node);
        URL url = locate(log, p, JDKInstaller.CPU.of(node), true);

        FilePath file = expectedLocation.child(p.bundleFileName);
        file.copyFrom(url);

        // JDK6u13 on Windows doesn't like path representation like "/tmp/foo", so make it a strict platform native format by doing 'absolutize'
        installer.install(node.createLauncher(log), p, new ClientFilePathFileSystem(node), log, expectedLocation.absolutize().getRemote(), file.getRemote());

        // successfully installed
        file.delete();
        marker.write(id, null);

    } catch (Exception e) {
        out.println("JDK installation skipped: "+e.getMessage());
        if (e instanceof IOException) {
            throw (IOException)e;
        }
        if (e instanceof InterruptedException) {
            throw (InterruptedException)e;
        }
    }

    return expectedLocation;
}
 
开发者ID:jenkinsci,项目名称:apache-httpcomponents-client-4-api-plugin,代码行数:42,代码来源:Client4JDKInstaller.java

示例13: isApplicable

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public boolean isApplicable(Class<? extends ToolInstallation> toolType) {
    return toolType==JDK.class;
}
 
开发者ID:jenkinsci,项目名称:apache-httpcomponents-client-4-api-plugin,代码行数:5,代码来源:Client4JDKInstaller.java

示例14: isApplicable

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public boolean isApplicable(Class<? extends ToolInstallation> toolType) {
    return toolType == TerraformInstallation.class;
}
 
开发者ID:dpires,项目名称:jenkins-terraform-plugin,代码行数:5,代码来源:TerraformInstaller.java

示例15: isApplicable

import hudson.tools.ToolInstallation; //导入依赖的package包/类
@Override
public boolean isApplicable(Class<? extends ToolInstallation> toolType) {
    return toolType == DockerTool.class;
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:5,代码来源:DockerToolInstaller.java


注:本文中的hudson.tools.ToolInstallation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。