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


Java Hudson.getInstance方法代码示例

本文整理汇总了Java中hudson.model.Hudson.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Hudson.getInstance方法的具体用法?Java Hudson.getInstance怎么用?Java Hudson.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.model.Hudson的用法示例。


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

示例1: doCheckCloudName

import hudson.model.Hudson; //导入方法依赖的package包/类
public FormValidation doCheckCloudName(@QueryParameter String value) {
    try {
        Hudson.checkGoodName(value);
    } catch (Failure e){
        return FormValidation.error(e.getMessage());
    }

    String cloudId = createCloudId(value);
    int found = 0;
    for (Cloud c : Hudson.getInstance().clouds) {
        if (c.name.equals(cloudId)) {
            found++;
        }
    }
    if (found>1) {
        return FormValidation.error(Messages.AmazonEC2Cloud_NonUniqName());
    }
    return FormValidation.ok();
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:20,代码来源:AmazonEC2Cloud.java

示例2: copyKeychainsToWorkspace

import hudson.model.Hudson; //导入方法依赖的package包/类
/**
 * Copy the keychains configured for this build job to the workspace of the job.
 * @param build the current build
 * @throws IOException
 * @throws InterruptedException 
 */
private void copyKeychainsToWorkspace(AbstractBuild build) throws IOException, InterruptedException {
    FilePath projectWorkspace = build.getWorkspace();

    Hudson hudson = Hudson.getInstance();
    FilePath hudsonRoot = hudson.getRootPath();

    if (copiedKeychains == null) {
        copiedKeychains = new ArrayList<FilePath>();
    } else {
        copiedKeychains.clear();
    }

    for (KPPKeychainCertificatePair pair : keychainCertificatePairs) {
        FilePath from = new FilePath(hudsonRoot, pair.getKeychainFilePath());
        FilePath to = new FilePath(projectWorkspace, pair.getKeychainFileName());
        if (overwriteExistingKeychains || !to.exists()) {
            from.copyTo(to);
            copiedKeychains.add(to);
        }
    }
}
 
开发者ID:SICSoftwareGmbH,项目名称:kpp-management-plugin,代码行数:28,代码来源:KPPKeychainsBuildWrapper.java

示例3: doFillDatacenterDescriptionItems

import hudson.model.Hudson; //导入方法依赖的package包/类
public ListBoxModel doFillDatacenterDescriptionItems() {
    ListBoxModel items = new ListBoxModel();
    for (Cloud cloud : Hudson.getInstance().clouds) {
        if (cloud instanceof Datacenter) {
            //TODO: Possibly add the `datacenterDescription` as the `displayName` and `value` (http://javadoc.jenkins-ci.org/hudson/util/ListBoxModel.html)
            //Add by `display name` and then the `value`
            items.add(((Datacenter) cloud).getHostname(), ((Datacenter) cloud).getDatacenterDescription());
        }
    }
    return items;
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:12,代码来源:VirtualMachineSlave.java

示例4: getDatacenterByDescription

import hudson.model.Hudson; //导入方法依赖的package包/类
private Datacenter getDatacenterByDescription (String datacenterDescription) {
    if (datacenterDescription != null && !datacenterDescription.equals("")) {
        for (Cloud cloud : Hudson.getInstance().clouds) {
            if (cloud instanceof Datacenter && ((Datacenter) cloud).getDatacenterDescription().equals(datacenterDescription)) {
                return (Datacenter) cloud;
            }
        }
    }
    return null;
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:11,代码来源:VirtualMachineSlave.java

示例5: findDatacenterInstance

import hudson.model.Hudson; //导入方法依赖的package包/类
public Datacenter findDatacenterInstance() throws RuntimeException {
    if (datacenterDescription != null && virtualMachineId != null) {
        for (Cloud cloud : Hudson.getInstance().clouds) {
            if (cloud instanceof Datacenter
                    && ((Datacenter) cloud).getDatacenterDescription().equals(datacenterDescription)) {
                return (Datacenter) cloud;
            }
        }
    }
    throw new RuntimeException("Could not find the proxmox datacenter instance!");
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:12,代码来源:VirtualMachineLauncher.java

示例6: getDatacenterByDescription

import hudson.model.Hudson; //导入方法依赖的package包/类
private Datacenter getDatacenterByDescription(String datacenterDescription) {
    for (Cloud cloud : Hudson.getInstance().clouds) {
        if (cloud instanceof Datacenter) {
            Datacenter datacenter = (Datacenter) cloud;
            if (datacenterDescription != null
                    && datacenterDescription.equals(datacenter.getDatacenterDescription())) {
                return datacenter;
            }
        }
    }
    return null;
}
 
开发者ID:justnom,项目名称:proxmox-plugin,代码行数:13,代码来源:PluginImpl.java

示例7: buildStatusData

import hudson.model.Hudson; //导入方法依赖的package包/类
private String buildStatusData(AbstractBuild<?, ?> build) {
    Hudson hudson = Hudson.getInstance();
    AbstractProject<?, ?> project = build.getProject();

    Map data = new HashMap<String, String>();

    data.put("name", project.getName());
    data.put("number", build.getNumber());
    data.put("manager", masterName);
    data.put("worker", this.worker.getWorkerID());

    String rootUrl = Hudson.getInstance().getRootUrl();
    if (rootUrl != null) {
        data.put("url", rootUrl + build.getUrl());
    }

    Result result = build.getResult();
    if (result != null) {
        data.put("result", result.toString());
    }

    ArrayList<String> nodeLabels = new ArrayList<String>();
    Node node = build.getBuiltOn();
    if (node != null) {
        Set<LabelAtom> nodeLabelAtoms = node.getAssignedLabels();
        for (LabelAtom labelAtom : nodeLabelAtoms) {
            nodeLabels.add(labelAtom.getDisplayName());
        }
    }
    data.put("node_labels", nodeLabels);
    data.put("node_name", node.getNodeName());

    Gson gson = new Gson();
    return gson.toJson(data);
}
 
开发者ID:openstack-infra,项目名称:gearman-plugin,代码行数:36,代码来源:StartJobWorker.java

示例8: getPort

import hudson.model.Hudson; //导入方法依赖的package包/类
private int getPort() {
    Hudson hudson = Hudson.getInstance();
    HudsonNotificationProperty.HudsonNotificationPropertyDescriptor globalProperty =
        (HudsonNotificationProperty.HudsonNotificationPropertyDescriptor)
            hudson.getDescriptor(HudsonNotificationProperty.class);
    if (globalProperty != null) {
        return globalProperty.getPort();
    }
    return 8888;
}
 
开发者ID:cboylan,项目名称:zmq-event-publisher,代码行数:11,代码来源:ZMQRunnable.java

示例9: copyProvisioningProfiles

import hudson.model.Hudson; //导入方法依赖的package包/类
/**
 * Copy the provisioning profiles configured for this job to the mobile provisioning profile path of the node or master, where the job is executed.
 * @param build current build
 * @throws IOException
 * @throws InterruptedException 
 */
private void copyProvisioningProfiles(AbstractBuild build) throws IOException, InterruptedException {
    
    Hudson hudson = Hudson.getInstance();
    FilePath hudsonRoot = hudson.getRootPath();
    VirtualChannel channel;
    String toProvisioningProfilesDirectoryPath = null;
    
    String buildOn = build.getBuiltOnStr();
    boolean isMaster = false;
    if (buildOn==null || buildOn.isEmpty()) {
        // build on master
        FilePath projectWorkspace = build.getWorkspace();
        channel = projectWorkspace.getChannel();
        toProvisioningProfilesDirectoryPath = KPPProvisioningProfilesProvider.getInstance().getProvisioningProfilesPath();
        isMaster = true;
    } else {
        // build on slave
        Node node = build.getBuiltOn();
        channel = node.getChannel();
        KPPNodeProperty nodeProperty = KPPNodeProperty.getCurrentNodeProperties();
        if (nodeProperty != null) {
            toProvisioningProfilesDirectoryPath = KPPNodeProperty.getCurrentNodeProperties().getProvisioningProfilesPath();
        }
    }
    
    if (toProvisioningProfilesDirectoryPath==null || toProvisioningProfilesDirectoryPath.isEmpty()) {
        // nothing to copy to provisioning profiles path
        String message;
        if (isMaster) {
            message = Messages.KPPProvisioningProfilesBuildWrapper_NoProvisioningProfilesPathForMaster();
        } else {
            message = Messages.KPPProvisioningProfilesBuildWrapper_NoProvisioningProfilesPathForSlave();
        }
        throw new IOException(message);
    }
    
    // remove file seperator char at the end of the path
    if (toProvisioningProfilesDirectoryPath.endsWith(File.separator)) {
        toProvisioningProfilesDirectoryPath = toProvisioningProfilesDirectoryPath.substring(0, toProvisioningProfilesDirectoryPath.length()-1);
    }
    
    if (copiedProfiles == null) {
        copiedProfiles = new ArrayList<FilePath>();
    } else {
        copiedProfiles.clear();
    }
    
    for (KPPProvisioningProfile pp : provisioningProfiles) {
        FilePath from = new FilePath(hudsonRoot, pp.getProvisioningProfileFilePath());
        String toPPPath = String.format("%s%s%s", toProvisioningProfilesDirectoryPath, File.separator, KPPProvisioningProfilesProvider.getUUIDFileName(pp.getUuid()));
        FilePath to = new FilePath(channel, toPPPath);
        if (overwriteExistingProfiles || !to.exists()) {
            from.copyTo(to);
            copiedProfiles.add(to);
        }
    }
}
 
开发者ID:SICSoftwareGmbH,项目名称:kpp-management-plugin,代码行数:64,代码来源:KPPProvisioningProfilesBuildWrapper.java

示例10: areOnMaster

import hudson.model.Hudson; //导入方法依赖的package包/类
/**
 * Detect whether we are on the master, to determine how to
 * serialize things.
 */
private boolean areOnMaster() {
  return Hudson.getInstance() != null;
}
 
开发者ID:jenkinsci,项目名称:google-source-plugin,代码行数:8,代码来源:GoogleRobotUsernamePassword.java


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