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 ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXPRESSION_SEPARATOR
static String
EXPRESSION_WILDCARD
static LocalStringManagerImpl
LOCALSTRINGS
static String
REPOSITORY_DASH
-
Constructor Summary
Constructors Constructor Description VersioningUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkIdentifier(String appName)
Check a versionned application name.static String
getExpression(String appName)
Extract the version identifier / expression for a given application name that complies with versioning rules.static String
getRepositoryName(String appName)
Replaces colons with dashs in the given application name.static String
getUntaggedName(String appName)
Extract the untagged name for a given application name that complies with versioning rules (version identifier / expression) or not.static List<String>
getVersions(String untaggedName, List<Application> allApplications)
Extract the set of version(s) of the given application from a set of applications.static Boolean
isUntagged(String appName)
Test if the given application name is an untagged namestatic Boolean
isVersionExpression(String appName)
Test if the given application name is a version expressionstatic Boolean
isVersionExpressionWithWildCard(String appName)
Test if the given application name is a version expression containing any wildcard character.static Boolean
isVersionIdentifier(String appName)
Test if the given application name is a version identifier.static List<String>
matchExpression(List<String> listVersion, String appName)
Search for the version(s) matched by the expression contained in the given application name.
-
-
-
Field Detail
-
LOCALSTRINGS
public static final LocalStringManagerImpl LOCALSTRINGS
-
EXPRESSION_SEPARATOR
public static final String EXPRESSION_SEPARATOR
- See Also:
- Constant Field Values
-
EXPRESSION_WILDCARD
public static final String EXPRESSION_WILDCARD
- See Also:
- Constant Field Values
-
REPOSITORY_DASH
public static final String REPOSITORY_DASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
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<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 identifierallApplications
- 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 applicationappName
- 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
-
-