com.meyling.hudson.plugin.job_exporter
Class ExporterBuilder

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Builder
          extended by com.meyling.hudson.plugin.job_exporter.ExporterBuilder
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Builder>, hudson.tasks.BuildStep

public class ExporterBuilder
extends hudson.tasks.Builder

Export hudson job information into a properties file.

When the user configures the project and enables this builder, Descriptor.newInstance(StaplerRequest) is invoked and a new ExporterBuilder is created. The created instance is persisted to the project configuration XML by using XStream, so this allows you to use instance fields to remember the configuration.

When a build is performed, the BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener) method will be invoked.

Author:
Michael Meyling

Nested Class Summary
static class ExporterBuilder.DescriptorImpl
          Descriptor for ExporterBuilder.
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
ExporterBuilder()
           
 
Method Summary
 ExporterBuilder.DescriptorImpl getDescriptor()
           
static java.lang.reflect.Field getField(java.lang.Object obj, java.lang.String name)
          Get field of given name in given object.
static java.lang.Object getFieldValue(java.lang.Object obj, java.lang.String name)
          We learned so much from the great Jedi master.
protected  void log(java.io.PrintStream logger, java.lang.String message)
           
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
 
Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, prebuild
 

Constructor Detail

ExporterBuilder

@DataBoundConstructor
public ExporterBuilder()
Method Detail

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer

log

protected void log(java.io.PrintStream logger,
                   java.lang.String message)

getDescriptor

public ExporterBuilder.DescriptorImpl getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Builder>
Overrides:
getDescriptor in class hudson.tasks.Builder

getFieldValue

public static java.lang.Object getFieldValue(java.lang.Object obj,
                                             java.lang.String name)
                                      throws java.lang.NoSuchFieldException
We learned so much from the great Jedi master. Using the force we can get and set private fields of arbitrary objects. This method returns the contents of an object variable. The class hierarchy is recursively searched to find such a field (even if it is private).

Parameters:
obj - Object.
name - Variable name.
Returns:
Contents of variable.
Throws:
java.lang.NoSuchFieldException - Variable of given name was not found.

getField

public static java.lang.reflect.Field getField(java.lang.Object obj,
                                               java.lang.String name)
                                        throws java.lang.NoSuchFieldException
Get field of given name in given object. The class hierarchy is recursively searched to find such a field (even if it is private).

Parameters:
obj - Object to work on.
name - Search this field.
Returns:
Found field.
Throws:
java.lang.NoSuchFieldException - Field with name name was not found.


Copyright © 2009-2011. All Rights Reserved.