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


Java InitMilestone类代码示例

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


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

示例1: jobLoaded

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(before = InitMilestone.COMPLETED, after = InitMilestone.JOB_LOADED)
public static void jobLoaded() throws IOException
{
	m_logger.fine("Initialization milestone: All jobs have been loaded"); //$NON-NLS-1$
	Jenkins jenkins = Jenkins.getInstance();
	for (AbstractProject<?, ?> project : jenkins.getAllItems(AbstractProject.class))
	{
		try
		{
			SCM scmConfig = project.getScm();
			if (scmConfig instanceof AbstractConfiguration && ((AbstractConfiguration) scmConfig).isMigrated())
			{
				project.save();

				m_logger.info(String.format(
								"Project %s has been migrated.", //$NON-NLS-1$
								project.getFullName()));
			}
		}
		catch (IOException e)
		{
			m_logger.log(Level.SEVERE, String.format("Failed to upgrade job %s", project.getFullName()), e); //$NON-NLS-1$
		}
	}
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:26,代码来源:AbstractConfiguration.java

示例2: run

import hudson.init.InitMilestone; //导入依赖的package包/类
public void run() {
    // TODO switch to Jenkins.getActiveInstance() once 1.590+ is the baseline
    Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        throw new IllegalStateException("Jenkins has not been started, or was already shut down");
    }
    while (jenkins.getInitLevel() != InitMilestone.COMPLETED) {
        try {
            logger.log(Level.INFO, "Waiting for Jenkins to be up before computing disk usage");
            Thread.sleep(3 * 60 * 1000);
        } catch (InterruptedException e) {
            return;
        }
    }
    refreshData();
}
 
开发者ID:jenkinsci,项目名称:cloudbees-disk-usage-simple-plugin,代码行数:17,代码来源:QuickDiskUsagePlugin.java

示例3: packageRenameConverting

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(before = InitMilestone.JOB_LOADED)
@Restricted(NoExternalUse.class)
public static void packageRenameConverting() {
    for(XStream2 xs : Arrays.asList(Items.XSTREAM2, Run.XSTREAM2, Jenkins.XSTREAM2, getFingerprintXStream())) {
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerHubTrigger",
                                 DockerHubTrigger.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerHubWebHookCause",
                                 DockerHubWebHookCause.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerPullImageBuilder",
                                 DockerPullImageBuilder.class);
        //TODO no back-compat tests for the column and filter
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerListViewColumn",
                                 TriggerListViewColumn.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerViewFilter",
                                 TriggerViewFilter.class);
        //The TriggerOption extension point has also changed package name and will not be backwards compatible API
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.opt.impl.TriggerForAllUsedInJob",
                                 TriggerForAllUsedInJob.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.opt.impl.TriggerOnSpecifiedImageNames",
                                 TriggerOnSpecifiedImageNames.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerStore$TriggerEntry",
                                 TriggerStore.TriggerEntry.class);
        xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerStore$TriggerEntry$RunEntry",
                                 TriggerStore.TriggerEntry.RunEntry.class);
    }
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:27,代码来源:DockerHubTrigger.java

示例4: getInstance

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * Gets the effective singleton instance.
 *
 * @return the effective singleton instance.
 * @throws AssertionError if the singleton is missing, i.e. not running on a Jenkins master.
 */
@Nonnull
public static TriggerStore getInstance() {
    Jenkins instance = Jenkins.getInstance();
    TriggerStore d;
    if (instance == null) {
        d = null;
    } else if (instance.getInitLevel().compareTo(InitMilestone.JOB_LOADED) < 0) {
        throw new AssertionError(TriggerStore.class.getName() + " is not available until after all jobs are loaded");
    } else {
        d = instance.getDescriptorByType(TriggerStore.class);
    }
    if (d == null) {
        throw new AssertionError(TriggerStore.class.getName() + " is missing");
    }
    return d;
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:23,代码来源:TriggerStore.java

示例5: onLoaded

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * Creates a default tool installation if needed. Uses "ninja" or migrates
 * data from previous versions
 *
 */
@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED)
public static void onLoaded() {

    Jenkins jenkinsInstance = Jenkins.getInstance();
    if (jenkinsInstance == null) {
        return;
    }
    DescriptorImpl descriptor = (DescriptorImpl) jenkinsInstance
            .getDescriptor(NinjaTool.class);
    NinjaTool[] installations = getInstallations(descriptor);

    if (installations != null && installations.length > 0) {
        // No need to initialize if there's already something
        return;
    }

    NinjaTool tool = new NinjaTool(DEFAULT, "ninja",
            Collections.<ToolProperty<?>> emptyList());
    descriptor.setInstallations(new NinjaTool[] { tool });
    descriptor.save();
}
 
开发者ID:15knots,项目名称:jenkins-ninja-installer,代码行数:27,代码来源:NinjaTool.java

示例6: init

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(after=InitMilestone.PLUGINS_STARTED)
public static void init() {
    if (germanHolidayCalculator == null) {
        germanHolidayCalculator = new GermanHolidayCalculator();
    }

    Calendar now = Calendar.getInstance();

    int year = now.get(Calendar.YEAR);

    for (int i = 0; i < 6; i++) {
        year = year + i;
        List<Calendar> holidays = germanHolidayCalculator.calculatePublicHolidays(year);
        publicHolidays.put(year, holidays);
    }
}
 
开发者ID:mvb-online,项目名称:jenkins-run-condition-holiday-plugin,代码行数:17,代码来源:GermanHolidayCalculator.java

示例7: addAliases

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(before = InitMilestone.PLUGINS_STARTED)
public static void addAliases() {
    Jenkins.XSTREAM2.addCompatibilityAlias(
            "org.csanchez.jenkins.plugins.kubernetes.OpenShiftBearerTokenCredentialImpl",
            org.jenkinsci.plugins.kubernetes.credentials.OpenShiftBearerTokenCredentialImpl.class);
    Jenkins.XSTREAM2.addCompatibilityAlias(
            "org.csanchez.jenkins.plugins.kubernetes.OpenShiftTokenCredentialImpl",
            StringCredentialsImpl.class);
    Jenkins.XSTREAM2.addCompatibilityAlias("org.csanchez.jenkins.plugins.kubernetes.ServiceAccountCredential",
            org.jenkinsci.plugins.kubernetes.credentials.FileSystemServiceAccountCredential.class);
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:12,代码来源:KubernetesCloud.java

示例8: migrate

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(after = InitMilestone.PLUGINS_STARTED)
public static void migrate() throws IOException {
    GitLabConnectionConfig descriptor = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
    for (GitLabConnection connection : descriptor.getConnections()) {
        if (connection.apiTokenId == null && connection.apiToken != null) {
            for (CredentialsStore credentialsStore : CredentialsProvider.lookupStores(Jenkins.getInstance())) {
                if (credentialsStore instanceof SystemCredentialsProvider.StoreImpl) {
                    List<Domain> domains = credentialsStore.getDomains();
                    connection.apiTokenId = UUID.randomUUID().toString();
                    credentialsStore.addCredentials(domains.get(0),
                        new GitLabApiTokenImpl(CredentialsScope.SYSTEM, connection.apiTokenId, "GitLab API Token", Secret.fromString(connection.apiToken)));
                }
            }
        }
    }
    descriptor.save();
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:18,代码来源:GitLabConnection.java

示例9: initialize

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(after = InitMilestone.JOB_LOADED)
public static void initialize() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            ACL.impersonate(ACL.SYSTEM, new ListenerInitializerTask(GitLabSCMWebHook.get()));
        }
    }).start();
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:10,代码来源:GitLabSCMWebHook.java

示例10: initAliases

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(after = InitMilestone.PLUGINS_STARTED)
public static void initAliases() {
    Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        LOGGER.severe("Called for initialization but Jenkins instance no longer available.");
        return;
    }
    // Alias all RunSelectors to their simple names
    for (Descriptor<RunSelector> d : jenkins.getDescriptorByType(DescriptorImpl.class).getRunSelectors())
        XSTREAM.alias(d.clazz.getSimpleName(), d.clazz);
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:12,代码来源:RunSelectorParameter.java

示例11: initAliases

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * 
 */
@Initializer(after=InitMilestone.PLUGINS_STARTED)
public static void initAliases() {
    Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        LOGGER.severe("Called for initialization but Jenkins instance no longer available.");
        return;
    }
    for (RunFilterDescriptor d : RunFilter.all()) {
        XSTREAM.alias(d.clazz.getSimpleName(), d.clazz);
    }
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:15,代码来源:ParameterizedRunFilter.java

示例12: initialize

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * Let's trigger an update after Jenkins is fully up.
 *
 * JOB_LOADED is the last milestone that can be triggered with an @Initializer,
 * COMPLETED doesn't work. So, we queue the update and check that Jenkins is fully up in the runnable
 * used in refreshDataOnStartup()
 */
@Initializer(after = InitMilestone.JOB_LOADED)
public static void initialize() {
    // TODO switch to Jenkins.getActiveInstance() once 1.590+ is the baseline
    Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        throw new IllegalStateException("Jenkins has not been started, or was already shut down");
    }
    QuickDiskUsagePlugin plugin = jenkins.getPlugin(QuickDiskUsagePlugin.class);
    if (plugin == null) return;
    plugin.refreshDataOnStartup();
}
 
开发者ID:jenkinsci,项目名称:cloudbees-disk-usage-simple-plugin,代码行数:19,代码来源:QuickDiskUsageInitializer.java

示例13: initializeXStream

import hudson.init.InitMilestone; //导入依赖的package包/类
@Initializer(before=InitMilestone.PLUGINS_STARTED)
public static void initializeXStream() {
	InheritableParameterReferenceConverter conv = new InheritableParameterReferenceConverter();
	
	final XStream2[] xs = {
			Jenkins.XSTREAM2, Run.XSTREAM2, Items.XSTREAM2
	};
	for (XStream2 x : xs) {
		//Add the custom converter to hide some fields
		x.registerConverter(conv);
	}
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:13,代码来源:InheritableStringParameterReferenceDefinition.java

示例14: init

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * We want to start the Mesos scheduler as part of the initialization of Jenkins
 * and after the cloud class values have been restored from persistence.If this is
 * the very first time, this method will be NOOP as MesosCloud is not registered yet.
 */

@Initializer(after=InitMilestone.JOB_LOADED)
public static void init() {

  Jenkins jenkins = getJenkins();
  List<Node> slaves = jenkins.getNodes();

  // Turning the AUTOMATIC_SLAVE_LAUNCH flag off because the below slave removals
  // causes computer launch in other slaves that have not been removed yet.
  // To study how a slave removal updates the entire list, one can refer to
  // Hudson NodeProvisioner class and follow this method chain removeNode() ->
  // setNodes() -> updateComputerList() -> updateComputer().
  Jenkins.AUTOMATIC_SLAVE_LAUNCH = false;
  for (Node n : slaves) {
    //Remove all slaves that were persisted when Jenkins shutdown.
    if (n instanceof MesosSlave) {
      ((MesosSlave)n).terminate();
    }
  }

  // Turn it back on for future real slaves.
  Jenkins.AUTOMATIC_SLAVE_LAUNCH = true;

  for (Cloud c : jenkins.clouds) {
    if( c instanceof MesosCloud) {
      // Register mesos framework on init, if on demand registration is not enabled.
      if (!((MesosCloud) c).isOnDemandRegistration()) {
        ((MesosCloud)c).restartMesos();
      }
    }
  }
}
 
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:38,代码来源:MesosCloud.java

示例15: installLoadBalancer

import hudson.init.InitMilestone; //导入依赖的package包/类
/**
 * Replaces {@link LoadBalancer} registered to Jenkins to ScoringLoadBalancer.
 * 
 * The {@link LoadBalancer} originally registered are used as one to fall back.
 */
@Initializer(after=InitMilestone.PLUGINS_STARTED, fatal=false)
public static void installLoadBalancer()
{
    LOGGER.info("Replace LoadBalancer to ScoringLoadBalancer");
    Queue q = Jenkins.getInstance().getQueue();
    LoadBalancer fallback = q.getLoadBalancer();
    q.setLoadBalancer(new ScoringLoadBalancer(fallback));
}
 
开发者ID:ikedam,项目名称:scoring-load-balancer,代码行数:14,代码来源:ScoringLoadBalancer.java


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