Class VersioningService


  • @Service
    @PerLookup
    public class VersioningService
    extends Object
    This service provides methods to handle application names in the versioning context
    Author:
    Romain GRECOURT - SERLI ([email protected])
    • Constructor Detail

      • VersioningService

        public VersioningService()
    • Method Detail

      • getEnabledVersionInReferencedTargetsForExpression

        public Map<String,​Set<String>> getEnabledVersionInReferencedTargetsForExpression​(String versionExpression)
                                                                                        throws VersioningSyntaxException
        Search the enabled versions on the referenced targets of each version matched by the expression. This method is designed to be used with domain target. As different versions maybe enabled on different targets, the return type used is a map.
        Parameters:
        versionExpression - a version expression (that contains wildcard character)
        Returns:
        a map matching the enabled versions with their target(s)
        Throws:
        VersioningSyntaxException - if getEnabledVersion throws an exception
      • getEnabledVersionsInReferencedTargets

        public Map<String,​Set<String>> getEnabledVersionsInReferencedTargets​(String versionIdentifier)
                                                                            throws VersioningSyntaxException
        Search the enabled versions on the referenced targets of the given version. This method is designed to be used with domain target. As different versions maybe enabled on different targets, the return type used is a map.
        Parameters:
        versionIdentifier - a version expression (that contains wildcard character)
        Returns:
        a map matching the enabled versions with their target(s)
        Throws:
        VersioningSyntaxException - if getEnabledVersion throws an exception
      • getEnabledVersion

        public final String getEnabledVersion​(String name,
                                              String target)
                                       throws VersioningSyntaxException
        Search for the enabled version of the given application.
        Parameters:
        name - the application name
        target - an option supply from admin command, it's retained for compatibility with other releases
        Returns:
        the enabled version of the application, if exists
        Throws:
        VersioningSyntaxException - if getUntaggedName throws an exception
      • getMatchedVersions

        public final List<String> getMatchedVersions​(String name,
                                                     String target)
                                              throws VersioningSyntaxException,
                                                     VersioningException
        Process the expression matching operation of the given application name.
        Parameters:
        name - the application name containing the version expression
        target - the target we are looking for the verisons
        Returns:
        a List of all expression matched versions, return empty list if no version is registered on this target or if getUntaggedName throws an exception
        Throws:
        VersioningSyntaxException
        VersioningException
      • handleDisable

        public void handleDisable​(String appName,
                                  String target,
                                  ActionReport report,
                                  Subject subject)
                           throws VersioningSyntaxException
        Disable the enabled version of the application if it exists. This method is used in versioning context.
        Parameters:
        appName - application's name
        target - an option supply from admin command, it's retained for compatibility with other releases
        report - ActionReport, report object to send back to client.
        subject - the Subject on whose behalf to run
        Throws:
        VersioningSyntaxException
      • getVersionFromSameDir

        public String getVersionFromSameDir​(File dir)
                                     throws VersioningSyntaxException
        Get the version directory-deployed from the given directory
        Parameters:
        directory -
        Returns:
        the name of the version currently using the directory, else null
        Throws:
        VersioningSyntaxException - *