commandbox.system.services

Class ArtifactService

lucee.Component
    extended by commandbox.system.services.ArtifactService

Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I handle artifacts, which are basically just a cache of downloaded packages. Artifacts are stored in this format: /packageName/version/packageName.zip We are not currently using a group ID, but we may need to in the future

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Brad Wood, Luis Majano, Denny Valliant
  •  
    Property Summary
    type property default serializable required
    any artifactDir


    • access = public
    • returntype = any
    • inject = artifactDir@constants
    true false
    any configService


    • access = public
    • returntype = any
    • inject = ConfigService
    true false
    any logger


    • access = public
    • returntype = any
    • inject = logbox:logger:{this}
    true false
    any packageService


    • access = public
    • returntype = any
    • inject = PackageService
    true false
    any semanticVersion


    • access = public
    • returntype = any
    • inject = provider:semanticVersion@semver
    true false
    any tempDir


    • access = public
    • returntype = any
    • inject = tempDir@constants
    true false
    Method Summary
    boolean artifactExists(any packageName, any version)
         Returns true if a package exists in the artifact cache, false if not.
    numeric cleanArtifacts()
         Removes all artifacts from the cache and returns the number of wiped out directories.
    ArtifactService createArtifact(any packageName, any version, any packagePath)
         Store a package in the artifact cache.
    any createArtifactFromFolder(any packageName, any version, any packageFolder)
         Store a package in the artifact cache.
    any findSatisfyingVersion(string slug, string version)
         Figures out the closest satisfying version that's available for a package in the local artifacts cache.
    struct getArtifactDescriptor(any packageName, any version)
         Returns the descriptor file (box.
    string getArtifactDir()
    any getArtifactPath(any packageName, any version)
         Returns the filesystem path of the artifact zip file.
    string getArtifactsDirectory()
    string getConfigService()
    string getLogger()
    any getPackagePath(any packageName, [any version=''])
         Returns the filesystem path of the package path.
    string getPackageService()
    string getSemanticVersion()
    string getTempDir()
    struct listArtifacts([any packageName=''])
         List the packages in the artifacts cache.
    any onDIComplete()
         DI complete.
    boolean packageExists(any packageName, [any version=''])
         Returns true if a package exists in the artifact cache, false if not.
    boolean removeArtifact(any packageName, [any version=''])
         Removes an artifact or an artifact package, true if removed.
    any setArtifactDir(any artifactDir)
    any setConfigService(any configService)
    any setLogger(any logger)
    any setPackageService(any packageService)
    any setSemanticVersion(any semanticVersion)
    any setTempDir(any tempDir)
     
    Methods inherited from class lucee.Component
    None

    Property Detail

    artifactDir

    property any artifactDir

    Attributes:
    access - public
    required - false
    returntype - any
    inject - artifactDir@constants
    serializable - true

    configService

    property any configService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - ConfigService
    serializable - true

    logger

    property any logger

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:{this}
    serializable - true

    packageService

    property any packageService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - PackageService
    serializable - true

    semanticVersion

    property any semanticVersion

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:semanticVersion@semver
    serializable - true

    tempDir

    property any tempDir

    Attributes:
    access - public
    required - false
    returntype - any
    inject - tempDir@constants
    serializable - true

    Method Detail

    artifactExists

    public boolean artifactExists(any packageName, any version)

    Returns true if a package exists in the artifact cache, false if not.

    Parameters:
    packageName - The package name to look for
    version - The version of the package to look for

    cleanArtifacts

    public numeric cleanArtifacts()

    Removes all artifacts from the cache and returns the number of wiped out directories


    createArtifact

    public ArtifactService createArtifact(any packageName, any version, any packagePath)

    Store a package in the artifact cache. This expects that the package is already downloaded and stored somewhere on the local filesystem. An error is thrown if the packageZip file doesn't exist or doesn't have a ".zip" extension.

    Parameters:
    packageName - The package name to look for
    version - The version of the package to look for
    packagePath - A file path to a local zip file that contains the package

    createArtifactFromFolder

    public any createArtifactFromFolder(any packageName, any version, any packageFolder)

    Store a package in the artifact cache. This expects that the package is already downloaded and stored somewhere on the local filesystem.

    Parameters:
    packageName - The package name to look for
    version - The version of the package to look for
    packageFolder - A file path to a local folder that contains the package

    findSatisfyingVersion

    public any findSatisfyingVersion(string slug, string version)

    Figures out the closest satisfying version that's available for a package in the local artifacts cache.

    Parameters:
    slug - Slug of package
    version - Version range to satisfy

    getArtifactDescriptor

    public struct getArtifactDescriptor(any packageName, any version)

    Returns the descriptor file (box.json) for a packge parsed as a struct. This data will be merged with a default document to guaruntee existence of standard variables and reduce the need for "exist" checks in our code

    Parameters:
    packageName - The package name to look for
    version - The version of the package to look for

    getArtifactDir

    public string getArtifactDir()


    getArtifactPath

    public any getArtifactPath(any packageName, any version)

    Returns the filesystem path of the artifact zip file

    Parameters:
    packageName - The package name to look for
    version - The version of the package to look for

    getArtifactsDirectory

    public string getArtifactsDirectory()


    getConfigService

    public string getConfigService()


    getLogger

    public string getLogger()


    getPackagePath

    public any getPackagePath(any packageName, [any version=''])

    Returns the filesystem path of the package path

    Parameters:
    packageName - The package name to look for
    version - The version to look for

    getPackageService

    public string getPackageService()


    getSemanticVersion

    public string getSemanticVersion()


    getTempDir

    public string getTempDir()


    listArtifacts

    public struct listArtifacts([any packageName=''])

    List the packages in the artifacts cache.

    Parameters:
    packageName - Supply a package to see only versions of this package

    onDIComplete

    public any onDIComplete()

    DI complete


    packageExists

    public boolean packageExists(any packageName, [any version=''])

    Returns true if a package exists in the artifact cache, false if not.

    Parameters:
    packageName - The package name to look for
    version - The version to look for

    removeArtifact

    public boolean removeArtifact(any packageName, [any version=''])

    Removes an artifact or an artifact package, true if removed

    Parameters:
    packageName - The package name to look for
    version - The version to look for

    setArtifactDir

    public any setArtifactDir(any artifactDir)

    Parameters:
    artifactDir

    setConfigService

    public any setConfigService(any configService)

    Parameters:
    configService

    setLogger

    public any setLogger(any logger)

    Parameters:
    logger

    setPackageService

    public any setPackageService(any packageService)

    Parameters:
    packageService

    setSemanticVersion

    public any setSemanticVersion(any semanticVersion)

    Parameters:
    semanticVersion

    setTempDir

    public any setTempDir(any tempDir)

    Parameters:
    tempDir