Class VersioningUtils

java.lang.Object
org.glassfish.deployment.versioning.VersioningUtils

public class VersioningUtils extends Object
This class provides utility methods to handle application names in the versioning context
Author:
Romain GRECOURT - SERLI (romain.grecourt@serli.com)
  • Field Details

  • Constructor Details

    • VersioningUtils

      public VersioningUtils()
  • Method Details

    • getUntaggedName

      public static final String getUntaggedName(String appName) throws VersioningSyntaxException
      Extract the untagged name for a given application name that complies with versioning rules (version identifier / expression) or not. If the application name is using versioning rules, the method will split the application names with the colon character and retrieve the untagged name from the first token. Else the given application name is an untagged name.
      Parameters:
      appName - the application name
      Returns:
      the untagged version name
      Throws:
      VersioningSyntaxException - if the given application name had some critical patterns.
    • getExpression

      public static final String getExpression(String appName) throws VersioningSyntaxException
      Extract the version identifier / expression for a given application name that complies with versioning rules. The method splits the application name with the colon character and retrieve the 2nd token.
      Parameters:
      appName - the application name
      Returns:
      the version identifier / expression extracted from application name
      Throws:
      VersioningSyntaxException - if the given application name had some critical patterns.
    • checkIdentifier

      public static final void checkIdentifier(String appName) throws VersioningException
      Check a versionned application name. This method is used to provide consistant error messages for identifier aware operations.
      Parameters:
      appName - the application name
      Throws:
      VersioningSyntaxException - if the given application name had some critical patterns.
      VersioningException - if the given application name had some wildcard character(s) in its identifier part.
    • getVersions

      public static final List<String> getVersions(String untaggedName, List<com.sun.enterprise.config.serverbeans.Application> allApplications)
      Extract the set of version(s) of the given application from a set of applications. This method is used by unit tests.
      Parameters:
      untaggedName - the application name as an untagged version : an application name without version identifier
      allApplications - the set of applications
      Returns:
      all the version(s) of the given application in the given set of applications
    • matchExpression

      public static final List<String> matchExpression(List<String> listVersion, String appName) throws VersioningException
      Search for the version(s) matched by the expression contained in the given application name. This method is used by unit tests.
      Parameters:
      listVersion - the set of all versions of the application
      appName - the application name containing the expression
      Returns:
      the expression matched list
      Throws:
      VersioningException - if the expression is an identifier matching a version not registered, or if getExpression throws an exception
    • getRepositoryName

      public static final String getRepositoryName(String appName)
      Replaces colons with dashs in the given application name.
      Parameters:
      appName - the application name
      Returns:
      a valid repository name
    • isUntagged

      public static final Boolean isUntagged(String appName) throws VersioningSyntaxException
      Test if the given application name is an untagged name
      Parameters:
      appName - the application name
      Returns:
      true is the given application name is not versioned
      Throws:
      VersioningSyntaxException - if getUntaggedName throws exception
    • isVersionExpression

      public static final Boolean isVersionExpression(String appName) throws VersioningSyntaxException
      Test if the given application name is a version expression
      Parameters:
      appName - the application name
      Returns:
      true if the appName is a version expression
      Throws:
      VersioningSyntaxException - if isUntaggedName throws exception
    • isVersionExpressionWithWildCard

      public static final Boolean isVersionExpressionWithWildCard(String appName) throws VersioningSyntaxException
      Test if the given application name is a version expression containing any wildcard character. That is to say the version expression is matching more than one version.
      Parameters:
      appName - the application name
      Returns:
      true if the appName is a version expression matching more than one version.
      Throws:
      VersioningSyntaxException - if isVersionExpression throws exception
    • isVersionIdentifier

      public static final Boolean isVersionIdentifier(String appName) throws VersioningSyntaxException
      Test if the given application name is a version identifier.
      Parameters:
      appName - the application name
      Returns:
      true if the appName is a version identifier
      Throws:
      VersioningSyntaxException - if isVersionExpression throws exception