Class AbstractMavenArtifactChoiceListProvider
java.lang.Object
hudson.model.AbstractDescribableImpl<jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider>
jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactChoiceListProvider
- All Implemented Interfaces:
ExtensionPoint,Describable<jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider>,Serializable
- Direct Known Subclasses:
ArtifactoryChoiceListProvider,ArtifactoryChoiceListProviderForDockerImages,ArtifactoryChoiceListProviderMavenVersionOnly,MavenCentralChoiceListProvider,MavenMetadataChoiceListProvider,Nexus3ChoiceListProvider,Nexus3ChoiceListProviderForDockerImages,Nexus3GenericChoiceListProvider,NexusChoiceListProvider
public abstract class AbstractMavenArtifactChoiceListProvider
extends jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
Base Class for different
ChoiceListProvider that can display information from an artifact repository, like
NexusChoiceListProvider, MavenCentralChoiceListProvider and ArtifactoryChoiceListProvider- Author:
- stephan.watermeyer, Diebold Nixdorf
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMavenArtifactChoiceListProvider(String artifactId) Initializes the choice list with at the artifactId. -
Method Summary
Modifier and TypeMethodDescriptionabstract IVersionReadercreateServiceInstance(Item item) Different implementation will return differentIVersionReaderinstances.filterArtifacts(List<String> pChoices, boolean pInverseFilter, String pFilterExpression) Returns a new list containing/excluding the matching artifacts based on whether inversion was required.static com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImplgetCredentials(String pCredentialId, Item pItem) Returns theUsernamePasswordCredentialsImplfor the given CredentialIdbooleanbooleanprotected static booleanisErrorResult(Map<String, String> pChoices) Checks whetherreadURL(org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, boolean)failed: then the result holds a single entry named "error", whose value is the error message.voidonBuildCompletedWithValue(AbstractBuild<?, ?> build, jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition def, String value) voidonBuildTriggeredWithValue(AbstractProject<?, ?> job, jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition def, String value) readURL(IVersionReader pInstance, String pRepositoryId, String pGroupId, String pArtifactId, String pPackaging, String pClassifier, boolean pInverseFilter, String pFilterExpression, boolean pReverseOrder) Retrieves the versions from the given source.protected Collection<String> selectChoiceList(Map<String, String> pChoices) voidsetArtifactId(String artifactId) voidsetClassifier(String classifier) voidsetFilterExpression(String filterExpression) voidsetGroupId(String groupId) voidsetInverseFilter(boolean inverseFilter) voidsetPackaging(String packaging) voidsetRepositoryId(String repositoryId) voidsetReverseOrder(boolean reverseOrder) Methods inherited from class jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
all, getDefaultChoice, requiresBuildPermissionMethods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Field Details
-
DEFAULT_REGEX_MATCH_ALL
- See Also:
-
-
Constructor Details
-
AbstractMavenArtifactChoiceListProvider
Initializes the choice list with at the artifactId.- Parameters:
artifactId- the artifactId is the minimum required information.
-
-
Method Details
-
isErrorResult
Checks whetherreadURL(org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, boolean)failed: then the result holds a single entry named "error", whose value is the error message.- Parameters:
pChoices- the map returned byreadURL(org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, boolean).- Returns:
trueif the result is an error.
-
selectChoiceList
Selects what to display from the result ofreadURL(org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, boolean). Returns the full artifact URLs; subclasses may override this to display something else. Not called when the result is an error, seeisErrorResult(java.util.Map<java.lang.String, java.lang.String>).- Parameters:
pChoices- the map returned byreadURL(org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, boolean): version number to full artifact URL.- Returns:
- the entries to display, never null
-
getChoiceList
- Specified by:
getChoiceListin classjp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
-
createServiceInstance
Different implementation will return differentIVersionReaderinstances.- Parameters:
item- for security checks.- Returns:
- the service implementation.
-
getCredentials
public static com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl getCredentials(@Nonnull String pCredentialId, Item pItem) Returns theUsernamePasswordCredentialsImplfor the given CredentialId- Parameters:
pCredentialId- the internal jenkins id for the credentials- Returns:
- the credentials for the ID or NULL
-
readURL
public static Map<String,String> readURL(IVersionReader pInstance, String pRepositoryId, String pGroupId, String pArtifactId, String pPackaging, String pClassifier, boolean pInverseFilter, String pFilterExpression, boolean pReverseOrder) Retrieves the versions from the given source.- Parameters:
pInstance- the artifact repository service.pRepositoryId- the repositoryIdpGroupId- the groupId of the artifactpArtifactId- the artifactIdpPackaging- the packagingpClassifier- the classifierpInverseFilter-trueif the result should contain artifacts which don't match the pFilterExpression regexpfalseif the result should contain artifacts which match the pFilterExpression regexppFilterExpression- Regexp applied on the artifacts for further selection of what should be returned. Empty string acts like.*.pReverseOrder-trueif the result should be reversed.- Returns:
- never null
-
filterArtifacts
public static List<String> filterArtifacts(List<String> pChoices, boolean pInverseFilter, String pFilterExpression) Returns a new list containing/excluding the matching artifacts based on whether inversion was required.- Parameters:
pChoices- List of artifacts to filter. This function won't change its elements.pInverseFilter- Decides whether the pFilterExpression should be negated. Iftruethen only non matching artifacts will be returned.pFilterExpression- A regular expression which will be applied to the whole artifact string. Empty string and null are treated as perfect match (value of inverse is still considered).- Returns:
- A new list of matching artifacts only
- Throws:
PatternSyntaxException- If pFilterExpression parameter is not a valid regular expression
-
onBuildCompletedWithValue
public void onBuildCompletedWithValue(AbstractBuild<?, ?> build, jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition def, String value) - Overrides:
onBuildCompletedWithValuein classjp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
-
onBuildTriggeredWithValue
public void onBuildTriggeredWithValue(AbstractProject<?, ?> job, jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition def, String value) - Overrides:
onBuildTriggeredWithValuein classjp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider
-
setGroupId
-
setArtifactId
-
setPackaging
-
setClassifier
-
setInverseFilter
@DataBoundSetter public void setInverseFilter(boolean inverseFilter) -
setFilterExpression
-
setReverseOrder
@DataBoundSetter public void setReverseOrder(boolean reverseOrder) -
setRepositoryId
-
getGroupId
-
getArtifactId
-
getPackaging
-
getClassifier
-
getInverseFilter
public boolean getInverseFilter() -
getFilterExpression
-
getReverseOrder
public boolean getReverseOrder() -
getRepositoryId
-