Class NPMRegistry

java.lang.Object
hudson.model.AbstractDescribableImpl<NPMRegistry>
jenkins.plugins.nodejs.configfiles.NPMRegistry
All Implemented Interfaces:
Describable<NPMRegistry>, Serializable

public class NPMRegistry extends AbstractDescribableImpl<NPMRegistry> implements Serializable
Holder of all informations about a npm public/private registry.

This class keep all necessary information to access a npm registry that must be stored in a user config file. Typically information are:

  • the registry URL
  • list of scope for the registry, used typical in private registry
  • account credentials to access the registry
Since:
1.0
Author:
Nikolas Falco
See Also:
  • Constructor Details

    • NPMRegistry

      public NPMRegistry(@NonNull String url, String credentialsId, String scopes)
      Default constructor.
      Parameters:
      url - url of a npm registry
      credentialsId - credentials identifier
      scopes - url-safe characters, no leading dots or underscores
    • NPMRegistry

      @DataBoundConstructor public NPMRegistry(@NonNull String url, String credentialsId, boolean hasScopes, String scopes)
      Default constructor used by jelly page for the optional block.
      Parameters:
      url - url of a npm registry
      credentialsId - credentials identifier
      hasScopes - if this registry was designed for a specific scope
      scopes - url-safe characters, no leading dots or underscores
  • Method Details

    • getUrl

      @Nullable public String getUrl()
      Get the registry URL
      Returns:
      the registry URL
    • getScopes

      public String getScopes()
      Get list of scope for this registry.

      The scope are not prefixed with @ character.

      Returns:
      a space separated list of scope.
    • isHasScopes

      public boolean isHasScopes()
    • getScopesAsList

      public List<String> getScopesAsList()
      Provide a list of scope for this registry.

      The scope are not prefixed with @ character.

      Returns:
      list of scope.
    • getCredentialsId

      public String getCredentialsId()
      Get list of scope for this registry.

      The scope are not prefixed with @ character.

      Returns:
      a space separated list of scope.
    • doVerify

      public void doVerify() throws VerifyConfigProviderException
      Perform the validation of current registry.

      If validation pass then no VerifyConfigProviderException will be raised.

      Throws:
      VerifyConfigProviderException - in case this configuration is not valid.
    • toString

      public String toString()
      Overrides:
      toString in class Object