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


Java Descriptor类代码示例

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


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

示例1: configure

import hudson.model.Descriptor; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
	json = json.getJSONObject("keycloak");
	keycloakJson = json.getString("keycloakJson");
	save();
	return true;
}
 
开发者ID:devlauer,项目名称:jenkins-keycloak-plugin,代码行数:8,代码来源:KeycloakSecurityRealm.java

示例2: doTestConnection

import hudson.model.Descriptor; //导入依赖的package包/类
public FormValidation doTestConnection(
        @QueryParameter("mirrorGateAPIUrl") final String mirrorGateAPIUrl,
        @QueryParameter("mirrorgateCredentialsId") final String credentialsId)
        throws Descriptor.FormException {
    MirrorGateService testMirrorGateService = getMirrorGateService();
    if (testMirrorGateService != null) {
        MirrorGateResponse response
                = testMirrorGateService.testConnection();
        return response.getResponseCode() == HttpStatus.SC_OK
                ? FormValidation.ok("Success")
                : FormValidation.error("Failure<"
                        + response.getResponseCode() + ">");
    } else {
        return FormValidation.error("Failure");
    }
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:17,代码来源:MirrorGatePublisher.java

示例3: NomadSlave

import hudson.model.Descriptor; //导入依赖的package包/类
public NomadSlave(
    NomadCloud cloud,
    String name,
    String nodeDescription,
    NomadSlaveTemplate template,
    String labelString,
    Mode mode,
    hudson.slaves.RetentionStrategy retentionStrategy,
    List<? extends NodeProperty<?>> nodeProperties
) throws Descriptor.FormException, IOException {
    super(
        name,
        nodeDescription,
        template.getRemoteFs(),
        template.getNumExecutors(),
        mode,
        labelString,
        new JNLPLauncher(),
        retentionStrategy,
        nodeProperties
    );

    this.cloud = cloud;
}
 
开发者ID:iverberk,项目名称:jenkins-nomad,代码行数:25,代码来源:NomadSlave.java

示例4: all

import hudson.model.Descriptor; //导入依赖的package包/类
/**
 * @return all descriptors of {@link RunFilter} without {@link NoRunFilter}
 */
public static List<RunFilterDescriptor> all() {
    Jenkins j = Jenkins.getInstance();
    if (j == null) {
        return Collections.emptyList();
    }
    return Lists.transform(
            j.getDescriptorList(RunFilter.class),
            new Function<Descriptor<?>, RunFilterDescriptor>() {
                @Override
                public RunFilterDescriptor apply(Descriptor<?> arg0) {
                    return (RunFilterDescriptor)arg0;
                }
            }
    );
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:19,代码来源:RunFilter.java

示例5: getRunSelectorDescriptorList

import hudson.model.Descriptor; //导入依赖的package包/类
/**
 * @return descriptors of all {@link RunSelector} except {@link FallbackRunSelector}
 */
public Iterable<? extends Descriptor<? extends RunSelector>> getRunSelectorDescriptorList() {
    Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        return Collections.emptyList();
    }
    // remove FallbackRunSelector itself.
    return Iterables.filter(
            jenkins.getDescriptorList(RunSelector.class),
            new Predicate<Descriptor<? extends RunSelector>>() {
                @Override
                public boolean apply(Descriptor<? extends RunSelector> d) {
                    return !FallbackRunSelector.class.isAssignableFrom(d.clazz);
                }
            }
    );
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:20,代码来源:FallbackRunSelector.java

示例6: findItemWithBuildWrapper

import hudson.model.Descriptor; //导入依赖的package包/类
private static <T extends BuildWrapper> BuildWrapperItem<T> findItemWithBuildWrapper(final AbstractItem buildItem, Class<T> buildWrapperClass) {
    if (buildItem == null) {
        return null;
    }

    if (buildItem instanceof BuildableItemWithBuildWrappers) {
        BuildableItemWithBuildWrappers buildWrapper = (BuildableItemWithBuildWrappers) buildItem;
        DescribableList<BuildWrapper, Descriptor<BuildWrapper>> buildWrappersList = buildWrapper.getBuildWrappersList();

        if (buildWrappersList != null && !buildWrappersList.isEmpty()) {
            return new BuildWrapperItem<T>(buildWrappersList.get(buildWrapperClass), buildItem);
        }
    }

    if (buildItem.getParent() instanceof AbstractItem) {
        return findItemWithBuildWrapper((AbstractItem) buildItem.getParent(), buildWrapperClass);
    }

    return null;
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:21,代码来源:BrowserStackBuildWrapper.java

示例7: testInvokeOperations

import hudson.model.Descriptor; //导入依赖的package包/类
@Test
public void testInvokeOperations()
        throws Exception
{
    IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class);
    JiraOperationExtension mockOperation = mock(JiraOperationExtension.class);
    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor");
    when(mockOperation.getDescriptor()).thenReturn(mockDescriptor);
    JiraExtPublisherStep publisher = new JiraExtPublisherStep(mockStrategy,
            Arrays.asList(mockOperation));
    List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101",
            MockChangeLogUtil.mockChangeLogSetEntry("example ticket")));

    when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class)))
            .thenReturn(commits);

    assertTrue(publisher.perform(mock(AbstractBuild.class), mock(Launcher.class),
            new StreamBuildListener(System.out, Charset.defaultCharset())));
    verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:JiraPublisherStepTest.java

示例8: testInvokeOperations

import hudson.model.Descriptor; //导入依赖的package包/类
@Test
public void testInvokeOperations()
{
    IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class);
    JiraOperationExtension mockOperation = mock(JiraOperationExtension.class);
    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor");
    when(mockOperation.getDescriptor()).thenReturn(mockDescriptor);
    JiraExtBuildStep builder = new JiraExtBuildStep(mockStrategy,
            Arrays.asList(mockOperation));
    List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101",
                    MockChangeLogUtil.mockChangeLogSetEntry("example ticket")));

    when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class)))
                .thenReturn(commits);

    assertTrue(builder.perform(mock(AbstractBuild.class), mock(Launcher.class), new StreamBuildListener(System.out)));
    verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:20,代码来源:JiraBuildStepPublisherTest.java

示例9: executeCheck

import hudson.model.Descriptor; //导入依赖的package包/类
public boolean executeCheck(Item item) {
    boolean notfound = true;
    if (Jenkins.getInstance().pluginManager.getPlugin("build-timeout") != null) {
        if (item.getClass().getName().endsWith("hudson.maven.MavenModuleSet")) {
            try {
                Method method = item.getClass().getMethod("getBuildWrappersList");
                DescribableList<BuildWrapper,Descriptor<BuildWrapper>> buildWrapperList = ((DescribableList<BuildWrapper,Descriptor<BuildWrapper>>) method.invoke(item));
                notfound = !isTimeout(buildWrapperList);
            } catch (Exception e) {
                LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
                notfound = false;
            }
        }
        if (item instanceof Project) {
            notfound = !isTimeout(((Project) item).getBuildWrappersList());
        }
        if (item instanceof MatrixProject) {
            notfound = !isTimeout(((MatrixProject) item).getBuildWrappersList());
        }
    }
    return notfound;
}
 
开发者ID:v1v,项目名称:jenkinslint-plugin,代码行数:23,代码来源:TimeoutChecker.java

示例10: executeCheck

import hudson.model.Descriptor; //导入依赖的package包/类
public boolean executeCheck(Item item) {
    LOG.log(Level.FINE, "executeCheck " + item);

    if (item instanceof Project) {
        Project project = (Project) item;
        DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList();
        for (Publisher publisher : publishersList) {
            if (publisher instanceof ArtifactArchiver) {
                LOG.log(Level.FINEST, "ArtifactChecker " + publisher);
                return (((ArtifactArchiver) publisher).getArtifacts() == null ||
                        (((ArtifactArchiver) publisher).getArtifacts() != null &&
                                ((ArtifactArchiver) publisher).getArtifacts().length() == 0));
            }
        }
    }
    return false;
}
 
开发者ID:v1v,项目名称:jenkinslint-plugin,代码行数:18,代码来源:ArtifactChecker.java

示例11: DockerSlave

import hudson.model.Descriptor; //导入依赖的package包/类
public DockerSlave(String slaveName, String nodeDescription, ComputerLauncher launcher, String containerId,
                   DockerSlaveTemplate dockerSlaveTemplate, String cloudId, ProvisioningActivity.Id provisioningId)
        throws IOException, Descriptor.FormException {
    super(slaveName,
            nodeDescription, //description
            dockerSlaveTemplate.getRemoteFs(),
            dockerSlaveTemplate.getNumExecutors(),
            dockerSlaveTemplate.getMode(),
            dockerSlaveTemplate.getLabelString(),
            launcher,
            dockerSlaveTemplate.getRetentionStrategyCopy(),
            dockerSlaveTemplate.getNodeProperties()
    );
    this.displayName = slaveName; // initial value
    this.containerId = containerId;
    this.cloudId = cloudId;
    setDockerSlaveTemplate(dockerSlaveTemplate);
    this.provisioningId = provisioningId;
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:20,代码来源:DockerSlave.java

示例12: reconfigure

import hudson.model.Descriptor; //导入依赖的package包/类
/**
 * This method is called whenever the Job form is saved. We use the 'on' property
 * to determine if the controls are selected.
 *
 * @param req - The request
 * @param form - A JSONObject containing the submitted form data from the job configuration
 * @return a {@link JobProperty} object representing the tagging added to the job
 * @throws hudson.model.Descriptor.FormException if querying of form throws an error
 */
@Override
public JobProperty<?> reconfigure(StaplerRequest req, @Nonnull JSONObject form)
        throws Descriptor.FormException {

  DatadogJobProperty prop = (DatadogJobProperty) super.reconfigure(req, form);
  System.out.println(form);
  boolean isEnableFile = form.getBoolean("enableFile");
  boolean isEnableTagProperties = form.getBoolean("enableProperty");

  if(!isEnableFile) {
      prop.tagFile = null;
      prop.emitOnCheckout = false;
  }
  if(!isEnableTagProperties) {
      prop.tagProperties = null;
  }


  return prop;
}
 
开发者ID:DataDog,项目名称:jenkins-datadog-plugin,代码行数:30,代码来源:DatadogJobProperty.java

示例13: create

import hudson.model.Descriptor; //导入依赖的package包/类
public <T extends DotCiExtension> T create(String pluginName, Object options, Class<T> extensionClass) {
    for (T adapter : all(extensionClass)) {
        if (adapter.getName().equals(pluginName)) {
            try {
                adapter = (T) adapter.getClass().newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            adapter.setOptions(options);
            return adapter;
        }

    }

    for (Descriptor<?> pluginDescriptor : getDescriptors()) {
        if (pluginDescriptor.clazz.getSimpleName().equals(pluginName)) {
            return (T) new GenericSimpleBuildStepPlugin(pluginDescriptor, options);
        }
    }
    throw new InvalidBuildConfigurationException("Plugin " + pluginName + " not supported");
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:22,代码来源:DotCiExtensionsHelper.java

示例14: KubernetesSlave

import hudson.model.Descriptor; //导入依赖的package包/类
@DataBoundConstructor
public KubernetesSlave(PodTemplate template, String nodeDescription, String cloudName, String labelStr,
                       RetentionStrategy rs)
        throws Descriptor.FormException, IOException {

    super(getSlaveName(template),
            nodeDescription,
            template.getRemoteFs(),
            1,
            template.getNodeUsageMode() != null ? template.getNodeUsageMode() : Node.Mode.NORMAL,
            labelStr == null ? null : labelStr,
            new KubernetesLauncher(),
            rs,
            template.getNodeProperties());

    this.cloudName = cloudName;
    this.namespace = Util.fixEmpty(template.getNamespace());
    this.template = template;
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:20,代码来源:KubernetesSlave.java

示例15: getDeploySourceDescriptors

import hudson.model.Descriptor; //导入依赖的package包/类
/**
 * Returns the {@link DeploySourceDescriptor}s that are valid for the specific context.
 *
 * @param origins the valid origins.
 * @param jobType the project type.
 * @return the {@link DeploySourceDescriptor}s that are valid for the specific context.
 */
@SuppressWarnings("unused") // used by stapler
@NonNull
public List<DeploySourceDescriptor> getDeploySourceDescriptors(@CheckForNull Set<DeploySourceOrigin> origins,
                                                               @CheckForNull Class<? extends AbstractProject>
                                                                       jobType) {
    List<DeploySourceDescriptor> result = new ArrayList<DeploySourceDescriptor>();
    if (origins != null) {
        for (Descriptor<DeploySource> d : Hudson.getInstance().getDescriptorList(DeploySource.class)) {
            if (d instanceof DeploySourceDescriptor) {
                DeploySourceDescriptor descriptor = (DeploySourceDescriptor) d;
                for (DeploySourceOrigin source : origins) {
                    if (descriptor.isSupported(source) && descriptor.isApplicable(jobType)) {
                        if ((isFileTarget() && descriptor.isFileSource())
                                || (isDirectoryTarget() && descriptor.isDirectorySource())) {
                            result.add(descriptor);
                        }
                        break;
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:jenkinsci,项目名称:deployer-framework-plugin,代码行数:32,代码来源:DeployTargetDescriptor.java


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