Package sc.repos

Class RepositoryPackage

  • All Implemented Interfaces:
    java.io.Serializable, IComponent, IStoppable
    Direct Known Subclasses:
    MvnRepositoryPackage

    public class RepositoryPackage
    extends LayerComponent
    implements java.io.Serializable
    Represents a package or software component obtained from some source location - e.g. a git repository, maven, file system, etc. Each package may come from one or more sources, where the source contains the specific version. Ultimately a single currentSource is selected and that's used to install or update the package. Once installed, the package produces access to the assets such as the class path, src path, web path and config path entries added by this package. Packages can be installed in either source or binary form with different sources for the two types.
    See Also:
    Serialized Form
    • Field Detail

      • packageName

        public java.lang.String packageName
        A unique name of this package within the layered system
      • installedTime

        public long installedTime
      • installError

        public java.lang.String installError
        If an error occurred, the description of that error
      • installed

        public boolean installed
      • definesClasses

        public boolean definesClasses
        Does this package define class files?
      • definesSrc

        public boolean definesSrc
        Does this package define src files?
      • buildFromSrc

        public boolean buildFromSrc
        Are we building it from src or download the compiled version?
      • sources

        public RepositorySource[] sources
        List of possible sources for this package
      • parentPkgURL

        public java.lang.String parentPkgURL
        Only set if this package is a module of another parent package
      • subPackages

        public transient java.util.ArrayList<RepositoryPackage> subPackages
        If this is a package of packages, contains the sub-packages. Otherwise null.
      • subPkgURLs

        public java.util.ArrayList<java.lang.String> subPkgURLs
      • depPkgURLs

        public java.util.ArrayList<java.lang.String> depPkgURLs
      • installedRoot

        public java.lang.String installedRoot
      • fileNames

        public java.util.List<java.lang.String> fileNames
      • url

        public java.lang.String url
      • type

        public java.lang.String type
      • unzip

        public boolean unzip
        True if the download is a zip file that needs to be unpacked
      • unwrapZip

        public boolean unwrapZip
        True if the name of the zip should be used to create a new directory for the contents
      • srcPaths

        public java.lang.String[] srcPaths
      • webPaths

        public java.lang.String[] webPaths
      • configPaths

        public java.lang.String[] configPaths
      • testPaths

        public java.lang.String[] testPaths
      • packageInited

        public transient boolean packageInited
      • rebuildReason

        public transient java.lang.String rebuildReason
      • preInstalled

        public transient boolean preInstalled
        Set to true when this package and it's dependencies have been successfully restored from the .ser file
      • initedSources

        public transient java.util.ArrayList<RepositorySource> initedSources
        The current source when this package was inited/installed for diagnostics
      • packageAlias

        public java.lang.String packageAlias
        Lets you define a separate alias for this package
    • Method Detail

      • addFileName

        public void addFileName​(java.lang.String fn)
      • init

        public void init()
        Description copied from interface: IComponent
        You can optionally implement this method to receive a initialization hook
        Specified by:
        init in interface IComponent
        Overrides:
        init in class LayerComponent
      • getDefinedInLayer

        public Layer getDefinedInLayer()
      • register

        public void register()
      • registerForLayer

        public void registerForLayer​(Layer layer)
      • update

        public java.lang.String update()
      • getIndexFileName

        public java.lang.String getIndexFileName()
        Like the logic from updateInstallRoot, we need to compute a name for the package which is consistent across the lifespan of the package. For maven packages, they first get a package name based on their file storage (i.e. parentModule/childModule, then after we read the POM, the real package name is known - groupId/artifactId). Here we need to use the original name parent__child since that's the only name we'll have when we need to restore the package from the tag file.
      • getModuleBaseName

        public java.lang.String getModuleBaseName()
      • getClassPath

        public java.lang.String getClassPath()
      • saveToFile

        public void saveToFile​(java.io.File tagFile)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getVersionSuffix

        public java.lang.String getVersionSuffix()
      • getVersionRoot

        public java.lang.String getVersionRoot()
      • getInstalledRoot

        public java.lang.String getInstalledRoot()
      • getClassPathFileNames

        public java.util.List<java.lang.String> getClassPathFileNames()
        There's a file name that's set as part of the package but sometimes this name will change based on the source. If we have two different versions of the same component. If this method returns null, this package has no class path entry.
      • updateCurrentSource

        public void updateCurrentSource​(RepositorySource src,
                                        boolean resetFileNames)
      • updateCurrentFileNames

        public void updateCurrentFileNames​(RepositorySource src)
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • setIncludeTests

        public void setIncludeTests​(boolean newVal)
      • getIncludeTests

        public boolean getIncludeTests()
      • setIncludeRuntime

        public void setIncludeRuntime​(boolean newVal)
      • getIncludeRuntime

        public boolean getIncludeRuntime()
      • addSrcPath

        public void addSrcPath​(java.lang.String srcPath)
      • getPackageSrcURL

        public java.lang.String getPackageSrcURL()
      • getPackageURL

        public java.lang.String getPackageURL()
      • getReusePackageDirectory

        public boolean getReusePackageDirectory()
        Should we skip backing up this project directory? For maven, if there's only a pom file we do not want to redownload that file each time and yet we never save the .ser file so we can't determine that it's pre-installed.
      • sameURL

        public boolean sameURL​(java.lang.String url)
      • sameParentURL

        public boolean sameParentURL​(java.lang.String url)