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 Stringcredentialstatic StringdefaultExcludes
-
Constructor Summary
Constructors Constructor Description AbstractP4ScmSource(String credential)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PerforceScmbuild(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)protected jenkins.scm.api.SCMProbecreateProbe(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)protected booleanfindInclude(String path)abstract P4BrowsergetBrowser()StringgetCharset()StringgetCredential()StringgetExcludes()List<Filter>getFilter()StringgetFormat()abstract List<P4SCMHead>getHeads(TaskListener listener)List<String>getIncludePaths()StringgetIncludes()PopulategetPopulate()protected StringgetProperty(net.sf.json.JSONObject payload, ReviewProp property)P4SCMRevisiongetRevision(net.sf.json.JSONObject payload)A specific revision based on the Event Payload.P4SCMRevisiongetRevision(TempClientHelper p4, P4SCMHead head)Get the Latest change for the path specified in P4SCMHead.protected P4BranchScannergetScanner(P4Ref ref)Scans for a Jenkinsfile given a submitted change.StringgetScriptPathOrDefault()abstract List<P4SCMHead>getTags(TaskListener listener)List<jenkins.scm.api.trait.SCMSourceTrait>getTraits()abstract WorkspacegetWorkspace(P4Path path)protected booleanisCategoryEnabled(jenkins.scm.api.SCMHeadCategory category)Enable specific SCMHeadCategory categories.booleanpathContainsFolderPropertyVar(List<String> paths)protected voidretrieve(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.voidsetCharset(String charset)voidsetExcludes(String excludes)voidsetFilter(List<Filter> filter)voidsetFormat(String format)voidsetIncludes(String includes)voidsetPopulate(Populate populate)voidsetTraits(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:
setTraitsin classjenkins.scm.api.SCMSource
-
getCredential
public String getCredential()
-
getTraits
public List<jenkins.scm.api.trait.SCMSourceTrait> getTraits()
- Overrides:
getTraitsin 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:
retrievein classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
createProbe
protected jenkins.scm.api.SCMProbe createProbe(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision) throws IOException- Overrides:
createProbein classjenkins.scm.api.SCMSource- Throws:
IOException
-
build
public PerforceScm build(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision)
- Specified by:
buildin 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:
retrieveActionsin 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
Actioninstances 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:
retrieveActionsin 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
Actioninstances 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:
retrieveActionsin classjenkins.scm.api.SCMSource- Parameters:
revision- theSCMRevisionevent- Optional event (might be null) use payload to help filter calls.listener- the listener to report progress on.- Returns:
- the list of
Actioninstances 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:
isCategoryEnabledin classjenkins.scm.api.SCMSource- Parameters:
category- the Category- Returns:
trueif the supplied category is enabled for thisSCMSourceinstance.
-
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)
-
-