Package org.jenkinsci.plugins.p4.scm
Class AbstractP4ScmSource
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<jenkins.scm.api.SCMSource>
-
- jenkins.scm.api.SCMSource
-
- org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<jenkins.scm.api.SCMSource>
- Direct Known Subclasses:
BranchesScmSource
,GlobalLibraryScmSource
,GraphScmSource
,StreamsScmSource
,SwarmScmSource
public abstract class AbstractP4ScmSource extends jenkins.scm.api.SCMSource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jenkins.scm.api.SCMSource
jenkins.scm.api.SCMSource.SourceByItem
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description protected String
credential
static String
defaultExcludes
-
Constructor Summary
Constructors Constructor Description AbstractP4ScmSource(String credential)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PerforceScm
build(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)
protected jenkins.scm.api.SCMProbe
createProbe(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)
protected boolean
findInclude(String path)
abstract P4Browser
getBrowser()
String
getCharset()
String
getCredential()
String
getExcludes()
List<Filter>
getFilter()
String
getFormat()
abstract List<P4SCMHead>
getHeads(TaskListener listener)
List<String>
getIncludePaths()
String
getIncludes()
Populate
getPopulate()
protected String
getProperty(net.sf.json.JSONObject payload, ReviewProp property)
P4SCMRevision
getRevision(net.sf.json.JSONObject payload)
A specific revision based on the Event Payload.P4SCMRevision
getRevision(TempClientHelper p4, P4SCMHead head)
Get the Latest change for the path specified in P4SCMHead.protected P4BranchScanner
getScanner(P4Ref ref)
Scans for a Jenkinsfile given a submitted change.String
getScriptPathOrDefault()
abstract List<P4SCMHead>
getTags(TaskListener listener)
List<jenkins.scm.api.trait.SCMSourceTrait>
getTraits()
abstract Workspace
getWorkspace(P4Path path)
protected boolean
isCategoryEnabled(jenkins.scm.api.SCMHeadCategory category)
Enable specific SCMHeadCategory categories.protected void
retrieve(jenkins.scm.api.SCMSourceCriteria criteria, jenkins.scm.api.SCMHeadObserver observer, jenkins.scm.api.SCMHeadEvent<?> event, TaskListener listener)
protected List<Action>
retrieveActions(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMHeadEvent event, TaskListener listener)
SCMHead level action.protected List<Action>
retrieveActions(jenkins.scm.api.SCMRevision revision, jenkins.scm.api.SCMHeadEvent event, TaskListener listener)
SCMRevision level action.protected List<Action>
retrieveActions(jenkins.scm.api.SCMSourceEvent event, TaskListener listener)
SCMSource level action.void
setCharset(String charset)
void
setExcludes(String excludes)
void
setFilter(List<Filter> filter)
void
setFormat(String format)
void
setIncludes(String includes)
void
setPopulate(Populate populate)
void
setTraits(List<jenkins.scm.api.trait.SCMSourceTrait> traits)
protected List<String>
toLines(String value)
-
Methods inherited from class jenkins.scm.api.SCMSource
afterSave, build, canProbe, checkInterrupt, defaultListener, equals, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetchActions, fetchActions, fetchActions, fetchRevisions, fetchRevisions, fromSCMFileSystem, getCategories, getCriteria, getDescriptor, getId, getOwner, getPronoun, getTrustedRevision, hashCode, hasId, newProbe, parentHeads, parentRevisions, retrieve, retrieve, retrieve, retrieve, retrieve, retrieve, retrieve, retrieveRevisions, retrieveRevisions, setId, setOwner, toString, withId
-
-
-
-
Field Detail
-
defaultExcludes
public static final String defaultExcludes
- See Also:
- Constant Field Values
-
credential
protected final String credential
-
-
Constructor Detail
-
AbstractP4ScmSource
public AbstractP4ScmSource(String credential)
-
-
Method Detail
-
setFormat
@DataBoundSetter public void setFormat(String format)
-
setPopulate
@DataBoundSetter public void setPopulate(Populate populate)
-
setIncludes
@DataBoundSetter public void setIncludes(String includes)
-
setExcludes
@DataBoundSetter public void setExcludes(String excludes)
-
setCharset
@DataBoundSetter public void setCharset(String charset)
-
setTraits
@DataBoundSetter public void setTraits(@CheckForNull List<jenkins.scm.api.trait.SCMSourceTrait> traits)
- Overrides:
setTraits
in classjenkins.scm.api.SCMSource
-
getCredential
public String getCredential()
-
getTraits
public List<jenkins.scm.api.trait.SCMSourceTrait> getTraits()
- Overrides:
getTraits
in classjenkins.scm.api.SCMSource
-
getIncludes
public String getIncludes()
-
getExcludes
public String getExcludes()
-
getCharset
public String getCharset()
-
getFormat
public String getFormat()
-
getPopulate
public Populate getPopulate()
-
getBrowser
public abstract P4Browser getBrowser()
-
getHeads
public abstract List<P4SCMHead> getHeads(@NonNull TaskListener listener) throws Exception
- Throws:
Exception
-
getTags
public abstract List<P4SCMHead> getTags(@NonNull TaskListener listener) throws Exception
- Throws:
Exception
-
getScriptPathOrDefault
public String getScriptPathOrDefault()
-
retrieve
protected void retrieve(@CheckForNull jenkins.scm.api.SCMSourceCriteria criteria, @NonNull jenkins.scm.api.SCMHeadObserver observer, @CheckForNull jenkins.scm.api.SCMHeadEvent<?> event, @NonNull TaskListener listener) throws IOException, InterruptedException
- Specified by:
retrieve
in classjenkins.scm.api.SCMSource
- Throws:
IOException
InterruptedException
-
createProbe
protected jenkins.scm.api.SCMProbe createProbe(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision) throws IOException
- Overrides:
createProbe
in classjenkins.scm.api.SCMSource
- Throws:
IOException
-
build
public PerforceScm build(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision)
- Specified by:
build
in classjenkins.scm.api.SCMSource
-
retrieveActions
protected List<Action> retrieveActions(@CheckForNull jenkins.scm.api.SCMSourceEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException
SCMSource level action. `jenkins.branch.MetadataAction`- Overrides:
retrieveActions
in classjenkins.scm.api.SCMSource
- Parameters:
event
- Optional event (might be null) use payload to help filter calls.listener
- the listener to report progress on.- Returns:
- the list of
Action
instances to persist. - Throws:
IOException
- if an error occurs while performing the operation.InterruptedException
- if any thread has interrupted the current thread.
-
retrieveActions
protected List<Action> retrieveActions(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMHeadEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException
SCMHead level action.- Overrides:
retrieveActions
in classjenkins.scm.api.SCMSource
- Parameters:
head
- Changes on a branchevent
- Optional event (might be null) use payload to help filter calls.listener
- the listener to report progress on.- Returns:
- the list of
Action
instances to persist. - Throws:
IOException
- if an error occurs while performing the operation.InterruptedException
- if any thread has interrupted the current thread.
-
retrieveActions
protected List<Action> retrieveActions(@NonNull jenkins.scm.api.SCMRevision revision, @CheckForNull jenkins.scm.api.SCMHeadEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException
SCMRevision level action.- Overrides:
retrieveActions
in classjenkins.scm.api.SCMSource
- Parameters:
revision
- theSCMRevision
event
- Optional event (might be null) use payload to help filter calls.listener
- the listener to report progress on.- Returns:
- the list of
Action
instances to persist. - Throws:
IOException
- if an error occurs while performing the operation.InterruptedException
- if any thread has interrupted the current thread.
-
isCategoryEnabled
protected boolean isCategoryEnabled(@NonNull jenkins.scm.api.SCMHeadCategory category)
Enable specific SCMHeadCategory categories.TagSCMHeadCategory: Branches, Streams, Swarm and Graph ChangeRequestSCMHeadCategory: Swarm and Graph
- Overrides:
isCategoryEnabled
in classjenkins.scm.api.SCMSource
- Parameters:
category
- the Category- Returns:
true
if the supplied category is enabled for thisSCMSource
instance.
-
getRevision
public P4SCMRevision getRevision(TempClientHelper p4, P4SCMHead head) throws Exception
Get the Latest change for the path specified in P4SCMHead.- Parameters:
p4
- TempClient instancehead
- SCMHead- Returns:
- The latest change as a P4SCMRevision object
- Throws:
Exception
- pushed up stack
-
getRevision
public P4SCMRevision getRevision(net.sf.json.JSONObject payload)
A specific revision based on the Event Payload.- Parameters:
payload
- JSON payload from an external Event- Returns:
- the change as a P4SCMRevision object or null if no match.
-
getScanner
protected P4BranchScanner getScanner(P4Ref ref)
Scans for a Jenkinsfile given a submitted change.Looks a the first submitted file and walks up the path looking for a Jenkinsfile.
- Parameters:
ref
- A Perforce Change or Label- Returns:
- Scanning results.
-
findInclude
protected boolean findInclude(String path)
-
getProperty
protected String getProperty(net.sf.json.JSONObject payload, ReviewProp property)
-
-