Class Container


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

      • warning

        public java.lang.String warning
    • Constructor Detail

      • Container

        public Container​(Project project,
                         java.lang.String bsn,
                         java.io.File file,
                         java.util.Map<java.lang.String,​java.lang.String> attributes)
      • 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)
    • 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)
      • 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
      • 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()