Package jenkins.scm.api
Class SCMHeadMigration<S extends SCMSource,H extends SCMHead,R extends SCMRevision>
- java.lang.Object
-
- jenkins.scm.api.SCMHeadMigration<S,H,R>
-
- All Implemented Interfaces:
ExtensionPoint
public abstract class SCMHeadMigration<S extends SCMSource,H extends SCMHead,R extends SCMRevision> extends Object implements ExtensionPoint
If aSCMSource
plugin needs to migrate the implementation classes forSCMHead
this extension point allows the plugin to register type migrations. For speed of migration implementations should just jump directly to the final end-point and not expect recursive chain walking.- Since:
- 2.0.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Class<H>
getSCMHeadClass()
Gets theSCMHead
that the migration applies to.Class<R>
getSCMRevisionClass()
Gets theSCMRevision
that the migration applies to.Class<S>
getSCMSourceClass()
Gets theSCMSource
that the migration applies to.abstract SCMHead
migrate(S source, H head)
Perform a migration.SCMRevision
migrate(S source, R revision)
Perform a migration.static SCMHead
readResolveSCMHead(SCMSource source, SCMHead head)
Perform a migration.static SCMRevision
readResolveSCMRevision(SCMSource source, SCMRevision revision)
Perform a migration.
-
-
-
Constructor Detail
-
SCMHeadMigration
protected SCMHeadMigration(Class<S> sourceClass, Class<H> headClass, Class<R> revisionClass)
Constructor.- Parameters:
sourceClass
- theSCMSource
that the migration applies to.headClass
- theSCMHead
that the migration applies to.revisionClass
- theSCMRevision
that the migration applies to.
-
-
Method Detail
-
getSCMSourceClass
public final Class<S> getSCMSourceClass()
Gets theSCMSource
that the migration applies to.- Returns:
- the
SCMSource
that the migration applies to.
-
getSCMHeadClass
public final Class<H> getSCMHeadClass()
Gets theSCMHead
that the migration applies to.- Returns:
- the
SCMHead
that the migration applies to.
-
getSCMRevisionClass
public final Class<R> getSCMRevisionClass()
Gets theSCMRevision
that the migration applies to.- Returns:
- the
SCMRevision
that the migration applies to.
-
migrate
@CheckForNull public abstract SCMHead migrate(@NonNull S source, @NonNull H head)
Perform a migration.Note: if you migrate a
SCMHead
then most likely you will also want to migrate theSCMRevision
instances associated with thatSCMHead
- at the very least to updateSCMRevision.getHead()
.- Parameters:
source
- the source instance.head
- the candidate head.- Returns:
- the migrated head or
null
if the migration was not appropriate.
-
migrate
@CheckForNull public SCMRevision migrate(@NonNull S source, @NonNull R revision)
Perform a migration.- Parameters:
source
- the source instance.revision
- the candidate revision.- Returns:
- the migrated revision or
null
if the migration was not appropriate.
-
readResolveSCMHead
@NonNull public static SCMHead readResolveSCMHead(@NonNull SCMSource source, @NonNull SCMHead head)
Perform a migration.- Parameters:
source
- the source instance.head
- the candidate head.- Returns:
- the migrated head or the original head.
-
readResolveSCMRevision
@CheckForNull public static SCMRevision readResolveSCMRevision(@NonNull SCMSource source, @CheckForNull SCMRevision revision)
Perform a migration.- Parameters:
source
- the source instance.revision
- the candidate revision.- Returns:
- the migrated revision or the original revision.
-
-