Class Container


  • public class Container
    extends java.lang.Object
    • Field Detail

      • file

        private volatile java.io.File file
      • path

        private final java.lang.String path
      • bsn

        private final java.lang.String bsn
      • version

        private final java.lang.String version
      • error

        private volatile java.lang.String error
      • project

        private final Project project
      • attributes

        private volatile java.util.Map<java.lang.String,​java.lang.String> attributes
      • manifestTime

        private long manifestTime
      • manifest

        private java.util.jar.Manifest manifest
      • bundleClasspathExpansion

        private volatile java.io.File[] bundleClasspathExpansion
      • warning

        public java.lang.String warning
    • Constructor Detail

      • Container

        Container​(Project project,
                  java.lang.String bsn,
                  java.lang.String version,
                  Container.TYPE type,
                  java.io.File source,
                  java.lang.String error,
                  java.util.Map<java.lang.String,​java.lang.String> attributes,
                  DownloadBlocker db)
      • Container

        public Container​(Project project,
                         java.io.File file,
                         java.util.Map<java.lang.String,​java.lang.String> attributes)
      • Container

        public Container​(Project project,
                         java.io.File file)
      • Container

        private Container​(Project project,
                          java.lang.String message)
    • Method Detail

      • getFile

        public java.io.File getFile()
      • contributeFiles

        public boolean contributeFiles​(java.util.List<java.io.File> files,
                                       Processor reporter)
                                throws java.lang.Exception
        Iterate over the containers and get the files they represent. If a file is already in the list, it is not added again.
        Parameters:
        files -
        Throws:
        java.lang.Exception
      • getBundleSymbolicName

        public java.lang.String getBundleSymbolicName()
      • getVersion

        public java.lang.String getVersion()
      • getError

        public java.lang.String getError()
      • 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
      • getProject

        public Project getProject()
      • toString

        public java.lang.String toString()
        Must show the file name or the error formatted as a file name
        Overrides:
        toString in class java.lang.Object
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      • putAttribute

        public void putAttribute​(java.lang.String name,
                                 java.lang.String value)
      • getWritableAttributes

        private java.util.Map<java.lang.String,​java.lang.String> getWritableAttributes()
      • getMembers

        public java.util.List<Container> getMembers()
                                             throws java.lang.Exception
        Return the this if this is anything else but a library. If it is a library, return the members. This could work recursively, e.g., libraries can point to libraries.
        Throws:
        java.lang.Exception
      • flatten

        public static void flatten​(Container container,
                                   java.util.List<Container> list)
                            throws java.lang.Exception
        Flatten a container in the output list. (e.g. expand any libraries).
        Parameters:
        container - the container to flatten
        list - the result list
        Throws:
        java.lang.Exception
      • flatten

        public static java.util.List<Container> flatten​(java.util.Collection<Container> containers)
                                                 throws java.lang.Exception
        Take a container list and flatten it (e.g. expand any libraries).
        Parameters:
        containers - The containers to flatten, can be null
        Returns:
        a list of containers guaranteed to contain no libraries
        Throws:
        java.lang.Exception
      • flatten

        public static void flatten​(java.util.Collection<Container> containers,
                                   java.util.List<Container> list)
                            throws java.lang.Exception
        Take a container list and flatten it (e.g. expand any libraries).
        Parameters:
        containers - The containers to flatten, can be null
        list - of containers guaranteed to contain no libraries
        Throws:
        java.lang.Exception
      • getManifest

        public java.util.jar.Manifest getManifest()
                                           throws java.lang.Exception
        Answer the manifest for this container (if possible). Manifest is cached until the file is renewed.
        Throws:
        java.lang.Exception
      • getBundleClasspathFiles

        private java.io.File[] getBundleClasspathFiles()
                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isCurrent

        private boolean isCurrent​(java.io.File file,
                                  java.io.File member)
      • toName

        private java.lang.String toName​(java.lang.String key)
      • getWarning

        public java.lang.String getWarning()
      • toPaths

        public static java.util.List<java.lang.String> toPaths​(java.util.List<java.lang.String> errors,
                                                               java.util.Collection<Container> containers)
        Convert a set of containers to a list of paths. Only containers that have no error will be converted. Any errors will be collected in the errors parameter. If the errors parameter is null, an exception is thrown for the first erroneous container.
        Parameters:
        errors - a list of errors or null
        containers - the containers to convert.
      • error

        public static Container error​(Project project,
                                      java.lang.String message)
      • isOk

        public boolean isOk()
      • getBundleId

        public BundleId getBundleId()