Java 类hudson.tasks.BuildWrapper 实例源码

项目:browserstack-integration-plugin    文件:BrowserStackBuildWrapper.java   
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;
}
项目:jenkinslint-plugin    文件:TimeoutChecker.java   
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;
}
项目:ravello-jenkins-plugin    文件:RavelloBuildWrapper.java   
@Override
public BuildWrapper.Environment setUp(
        @SuppressWarnings("rawtypes") final AbstractBuild build,
        final Launcher launcher, final BuildListener listener)
        throws IOException, InterruptedException
{

    EnvVars env = build.getEnvironment(listener);
    env.put("RavelloUsername", Util.fixEmptyAndTrim(userId));
    env.put("RavelloPassword", Scrambler.scramble(Util.fixEmptyAndTrim(authKey)));

    return new Environment()
    {
   /* empty implementation */
    };
}
项目:uno-choice-plugin    文件:Utils.java   
/**
 * Get parameter definitions associated with {@link BuildWrapper}s of the given {@link Project}.
 * @param project the project for which the parameter definitions should be found
 * @return Map
 */
public static @Nonnull Map<BuildWrapper, List<ParameterDefinition>> getBuildWrapperParameterDefinitions(@Nonnull Project<?, ?> project) {
    final List<BuildWrapper> buildWrappersList = project.getBuildWrappersList();

    final Map<BuildWrapper, List<ParameterDefinition>> result = new LinkedHashMap<BuildWrapper, List<ParameterDefinition>>();

    List<ParameterDefinition> value = new ArrayList<ParameterDefinition>();

    for (BuildWrapper buildWrapper : buildWrappersList) {
        final PropertyDescriptor[] propertyDescriptors;
        try {
            propertyDescriptors = Introspector.getBeanInfo(buildWrapper.getClass()).getPropertyDescriptors();
        } catch (IntrospectionException e) {
            continue;
        }
        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
            addParameterDefinitionsTo(value, buildWrapper, propertyDescriptor);
        }
        if (!value.isEmpty()) {
            result.put(buildWrapper, value);
            value = new ArrayList<ParameterDefinition>();
        }
    }
    return result.isEmpty() ? Collections.<BuildWrapper, List<ParameterDefinition>> emptyMap() : result;
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList(
        IMode mode) {
    InheritanceGovernor<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>> gov =
            new InheritanceGovernor<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>>(
                    "buildWrappersList", SELECTOR.BUILD_WRAPPER, this) {
        @Override
        protected DescribableList<BuildWrapper, Descriptor<BuildWrapper>> castToDestinationType(Object o) {
            return castToDescribableList(o);
        }

        @Override
        public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getRawField(
                InheritanceProject ip) {
            return ip.getRawBuildWrappersList();
        }

        @Override
        protected DescribableList<BuildWrapper, Descriptor<BuildWrapper>> reduceFromFullInheritance(
                Deque<DescribableList<BuildWrapper, Descriptor<BuildWrapper>>> list) {
            return InheritanceGovernor.reduceDescribableByMergeWithoutDuplicates(list);
        }
    };

    return gov.retrieveFullyDerivedField(this, mode);
}
项目:jenkinslint-plugin    文件:TimeoutChecker.java   
private boolean isTimeout(List<BuildWrapper> builders) {
    boolean status = false;
    if (builders != null && builders.size() > 0 ) {
        for (BuildWrapper builder : builders) {
            if (builder.getClass().getName().endsWith("BuildTimeoutWrapper")) {
                status = true;
            }
        }
    }
    return status;
}
项目:yaml-project-plugin    文件:AbstractRunnableItemGroup.java   
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>>
    getBuildWrappersList() {
  if (buildWrappers == null) {
    buildWrappersSetter.compareAndSet(this, null,
        new DescribableList<BuildWrapper, Descriptor<BuildWrapper>>(this));
  }
  return buildWrappers;
}
项目:DotCi    文件:BuildEnvironment.java   
public boolean setupWrappers(final List<BuildWrapper> wrappers) throws IOException, InterruptedException {
    for (final BuildWrapper w : wrappers) {
        final Environment e = w.setUp((AbstractBuild<?, ?>) this.build, this.launcher, this.listener);
        if (e == null) {
            return false;
        }
        final List<Environment> buildEnvironments = getBuildEnvironments();
        buildEnvironments.add(e);
    }

    return true;

}
项目:DotCi    文件:BuildEnvironment.java   
public boolean initialize() throws IOException, InterruptedException {
    final List<BuildWrapper> wrappers = new ArrayList<>(getProject().getBuildWrappers().values());
    final ParametersAction parameters = getAction(ParametersAction.class);
    if (parameters != null) {
        parameters.createBuildWrappers(this.build, wrappers);
    }
    return setupWrappers(wrappers);

}
项目:testgrid-plugin    文件:TestgridBuildWrapper.java   
@Inject
public BuildWrapper setDockerClient(DockerClient client) {
    replacementDockerClient = client;

    return this;
}
项目:ssh2easy-plugin    文件:GsshBuilderWrapper.java   
public GsshDescriptorImpl(Class<? extends BuildWrapper> clazz) {
    super(clazz);
    load();
}
项目:ssh2easy-plugin    文件:GsshBuilderWrapper.java   
@Override
public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) {
    GsshBuilderWrapper pub = new GsshBuilderWrapper();
    req.bindParameters(pub, "gssh.wrapp.");
    return pub;
}
项目:plugin-stats-plugin    文件:PluginStatsAction.java   
private void queryProject(Project job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {
       // Query Builders
        if (job.getBuilders() != null && job.getBuilders().size() > 0) {
            for (int i = 0; i < job.getBuilders().size(); i++) {
                LOG.log(Level.FINE, "getBuilders " + addJob(job.getName(), job.getShortUrl(), job.getBuilders().get(i).getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getBuilders is empty");
        }

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        if (job.getProperties() !=null && job.getProperties().size() > 0){
            Map<JobPropertyDescriptor,JobProperty> properties = job.getProperties();
            for (Map.Entry<JobPropertyDescriptor,JobProperty> entry : properties.entrySet()) {
                LOG.log(Level.FINE, "getProperties " + addJob(job.getName(), job.getShortUrl(), entry.getKey().getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
项目:plugin-stats-plugin    文件:PluginStatsAction.java   
private void queryMatrixProject(MatrixProject job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {
        if (job.getBuilders() != null && job.getBuilders().size() > 0) {
            for (int i = 0; i < job.getBuilders().size(); i++) {
                LOG.log(Level.FINE, "getBuilders " + addJob(job.getName(), job.getShortUrl(), job.getBuilders().get(i).getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getBuilders is empty");
        }

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger<?>> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        // TODO: Query Properties
        if (job.getProperties() !=null && job.getProperties().size() > 0){
            LOG.log(Level.FINE, "getProperties is " + job.getProperties().size());
            for (int j = 0; j < job.getProperties().size(); j++) {
                LOG.log(Level.FINE, "getProperties " +job.getProperties().get(j));//+ /+ addJob(job, job.getProperties().get(j).getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
项目:plugin-stats-plugin    文件:PluginStatsAction.java   
private void queryMavenProject(MavenModuleSet job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger<?>> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        if (job.getProperties() !=null && job.getProperties().size() > 0){
            Map<JobPropertyDescriptor, JobProperty<? super MavenModuleSet>> properties = job.getProperties();
            for (Map.Entry<JobPropertyDescriptor, JobProperty<? super MavenModuleSet>> entry : properties.entrySet()) {
                LOG.log(Level.FINE, "getProperties " + addJob(job.getName(), job.getShortUrl(), entry.getKey().getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
项目:yaml-project-plugin    文件:AbstractRunnableItemGroup.java   
public Map<Descriptor<BuildWrapper>, BuildWrapper> getBuildWrappers() {
  return getBuildWrappersList().toMap();
}
项目:DotCi    文件:DynamicSubProject.java   
@Override
public Map<Descriptor<BuildWrapper>, BuildWrapper> getBuildWrappers() {
    return getParent().getBuildWrappers();
}
项目:DotCi    文件:DynamicSubProject.java   
@Override
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList() {
    return getParent().getBuildWrappersList();
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * This method implements the actual association of a set of objects with
 * a given version.
 * <p>
 * Subclasses should override this method, call the super() implementation
 * and then associate their own fields with that version by calling
 * {@link VersionedObjectStore#setObjectFor(Version, String, Object)}.
 * 
 * @param v the version to archive settings for. Must never be null.
 */
protected void dumpConfigToVersion(Version v) {
    //Storing the list of parents
    this.versionStore.setObjectFor(
            v, "parentReferences",
            new LinkedList<AbstractProjectReference>(this.getRawParentReferences())
    );

    //Storing the list of compatibility matings -- also contains
    //the parameters defined on them.
    this.versionStore.setObjectFor(
            v, "compatibleProjects",
            new LinkedList<AbstractProjectReference>(this.compatibleProjects)
    );

    //Storing the properties of this job; this contains the project parameters
    this.versionStore.setObjectFor(
            v, "properties",
            new LinkedList<JobProperty<? super InheritanceProject>>(
                    super.getAllProperties()
            )
    );

    //Storing build wrappers
    this.versionStore.setObjectFor(
            v, "buildWrappersList",
            new DescribableList<BuildWrapper, Descriptor<BuildWrapper>>(
                    NOOP, super.getBuildWrappersList().toList()
            )
    );

    //Storing builders
    this.versionStore.setObjectFor(
            v, "buildersList",
            new DescribableList<Builder, Descriptor<Builder>>(
                    NOOP, super.getBuildersList().toList()
            )
    );

    //Storing publishers
    this.versionStore.setObjectFor(
            v, "publishersList",
            new DescribableList<Publisher, Descriptor<Publisher>>(
                    NOOP, super.getPublishersList().toList()
            )
    );

    //Storing actions
    this.versionStore.setObjectFor(
            v, "actions", new LinkedList<Action>(super.getActions())
    );


    //Storing the other, more simple properties
    this.versionStore.setObjectFor(v, "scm", super.getScm());
    this.versionStore.setObjectFor(v, "quietPeriod", this.getRawQuietPeriod());
    this.versionStore.setObjectFor(v, "scmCheckoutRetryCount", this.getRawScmCheckoutRetryCount());
    this.versionStore.setObjectFor(v, "scmCheckoutStrategy", super.getScmCheckoutStrategy());
    this.versionStore.setObjectFor(v, "blockBuildWhenDownstreamBuilding", super.blockBuildWhenDownstreamBuilding());
    this.versionStore.setObjectFor(v, "blockBuildWhenUpstreamBuilding", super.blockBuildWhenUpstreamBuilding());
    this.versionStore.setObjectFor(v, "logRotator", super.getBuildDiscarder());
    this.versionStore.setObjectFor(v, "customWorkspace", super.getCustomWorkspace());
    this.versionStore.setObjectFor(v, "parameterizedWorkspace", this.getRawParameterizedWorkspace());
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * {@inheritDoc}
 */
@Override
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList() {
    return this.getBuildWrappersList(IMode.AUTO);
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getRawBuildWrappersList() {
    return super.getBuildWrappersList();
}
项目:credentials-binding-plugin    文件:BuildWrapperOrderCredentialsBindingTest.java   
@Override
public BuildWrapper newInstance(StaplerRequest req, @Nonnull JSONObject formData) throws FormException {
    return new BuildWrapperOrder();
}
项目:jenkins-reviewbot    文件:ReviewboardParameterValue.java   
@Override
public BuildWrapper createBuildWrapper(AbstractBuild<?,?> build) {
  return new ReviewboardBuildWrapper() ;
}