jenkins.model.Jenkins.get()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(379)

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

Jenkins.get介绍

[英]Gets the Jenkins singleton.
[中]得到詹金斯单身汉。

代码示例

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

/**
 * Returns all the registered {@link Cloud} descriptors.
 */
public static DescriptorExtensionList<Cloud,Descriptor<Cloud>> all() {
  return Jenkins.get().getDescriptorList(Cloud.class);
}

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

@Override
  public boolean isActivated() {
    return Jenkins.get().getCrumbIssuer() == null;
  }
}

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

/**
 * Gets the directory where Hudson stores user information.
 */
static File getRootDir() {
  return new File(Jenkins.get().getRootDir(), "users");
}

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

public Executor(@Nonnull Computer owner, int n) {
  super("Executor #"+n+" for "+owner.getDisplayName());
  this.owner = owner;
  this.queue = Jenkins.get().getQueue();
  this.number = n;
}

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

@CheckForNull
public PluginWrapper getPlugin(@Nonnull UpdateSite.Warning warning) {
  if (warning.type != UpdateSite.Warning.Type.PLUGIN) {
    return null;
  }
  return Jenkins.get().getPluginManager().getPlugin(warning.component);
}

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

/**
 * @deprecated This is a verbose historical alias for {@link #get}.
 * @since 1.590
 */
@Deprecated
@Nonnull
public static Jenkins getActiveInstance() throws IllegalStateException {
  return get();
}

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

@Override
@Nonnull
public ACL getACL() {
  ACL base = Jenkins.get().getAuthorizationStrategy().getACL(this);
  // always allow a non-anonymous user full control of himself.
  return ACL.lambda((a, permission) -> (idStrategy().equals(a.getName(), id) && !(a instanceof AnonymousAuthenticationToken))
      || base.hasPermission(a, permission));
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean filter(@CheckForNull Object context, @Nonnull Descriptor descriptor) {
  return descriptor.clazz != JNLPLauncher.class || Jenkins.get().getTcpSlaveAgentListener() != null;
}

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

/**
   * Sets up the Setup Wizard filter if the current state requires it.
   */
  private void checkFilter() {
    if (!Jenkins.get().getInstallState().isSetupComplete()) {
      setUpFilter();
    }
  }
}

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

public void initializeState() {
    Jenkins j = Jenkins.get();
    try {
      j.getSetupWizard().completeSetup();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    j.setInstallState(RUNNING);
  }
}

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

/**
 * Returns all login page decorators.
 * @since 2.156
 */
public static List<SimplePageDecorator> all() {
  return Jenkins.get().getDescriptorList(SimplePageDecorator.class);
}

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

/**
 * File that captures the state of upgrade.
 *
 * This file records the version number that the installation has upgraded to.
 */
/*package*/ static File getUpdateStateFile() {
  return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state");
}

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

/**
 * Returns true if this monitor {@link #disable(boolean) isn't disabled} earlier.
 *
 * <p>
 * This flag implements the ability for the admin to say "no thank you" to the monitor that
 * he wants to ignore.
 */
public boolean isEnabled() {
  return !((AbstractCIBase)Jenkins.get()).disabledAdministrativeMonitors.contains(id);
}

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

/**
 * Returns all the registered {@link NodeDescriptor} descriptors.
 */
public static DescriptorExtensionList<Node,NodeDescriptor> all() {
  return Jenkins.get().getDescriptorList(Node.class);
}

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

@Override
@Restricted(NoExternalUse.class)
public Object getTarget() {
  if (!SKIP_PERMISSION_CHECK) {
    if (!Jenkins.get().hasPermission(Jenkins.READ)) {
      return null;
    }
  }
  return this;
}

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

/**
 * Returns all the registered {@link RetentionStrategy} descriptors.
 */
public static DescriptorExtensionList<RetentionStrategy<?>,Descriptor<RetentionStrategy<?>>> all() {
  return (DescriptorExtensionList) Jenkins.get().getDescriptorList(RetentionStrategy.class);
}

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

@Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    try {
      Jenkins.get().clouds.rebuildHetero(req,json, Cloud.all(), "cloud");
      return true;
    } catch (IOException e) {
      throw new FormException(e,"clouds");
    }
  }
}

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

/**
   * Returns all the registered {@link GlobalConfiguration} descriptors.
   */
  public static @Nonnull ExtensionList<GlobalConfiguration> all() {
    return Jenkins.get().getDescriptorList(GlobalConfiguration.class);
    // pointless type parameters help work around bugs in javac in earlier versions http://codepad.org/m1bbFRrH
  }
}

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

/**
 * Gets the list of {@link Build}s that include changes by this user,
 * by the timestamp order.
 */
@SuppressWarnings("unchecked")
@WithBridgeMethods(List.class)
public @Nonnull
RunList getBuilds() {
  return RunList.fromJobs((Iterable) Jenkins.get().
      allItems(Job.class)).filter((Predicate<Run<?, ?>>) r -> r instanceof AbstractBuild && relatedTo((AbstractBuild<?, ?>) r));
}

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

@Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.get();
    if (json.has("myViewsTabBar")) {
      j.setMyViewsTabBar(req.bindJSON(MyViewsTabBar.class,json.getJSONObject("myViewsTabBar")));
    } else {
      j.setMyViewsTabBar(new DefaultMyViewsTabBar());
    }
    return true;
  }
}

相关文章

微信公众号

最新文章

更多

Jenkins类方法