Class ScatteredEnterpriseArchive

    • Constructor Detail

      • ScatteredEnterpriseArchive

        public ScatteredEnterpriseArchive​(String name)
        Construct a new scattered enterprise archive.
        Parameters:
        name - Name of the enterprise archive.
        Throws:
        NullPointerException - if name is null.
    • Method Detail

      • addArchive

        public void addArchive​(URI archiveURI)
                        throws IOException
        Add a module or a library to this scattered enterprise archive.

        The addArchive(archiveURI) method has the same effect as:

              addMetadata(archiveURI, null)
         
        Follows the same semantics as addArchive(URI, String) method.
        Throws:
        IOException
      • addArchive

        public void addArchive​(URI archiveURI,
                               String name)
                        throws IOException
        Add a module or a library to this scattered enterprise archive.

        The specified archiveURI must be one of the following:

              ScatteredArchive URI obtained via ScatteredArchive.toURI().
              Location of a library JAR file. Must be a File URI.
              Location of a Java EE module. Must be a File URI.
         
        If the specified name is null, then the name is computed as the name of the File as located by archiveURI.
        Parameters:
        archiveURI - Module or library archive URI.
        name - name of the module/library as specified in META-INF/application.xml
        Throws:
        NullPointerException - if archiveURI is null
        IOException - if the archiveURI location is not found.
      • addArchive

        public void addArchive​(File archive)
                        throws IOException
        Add a module or a library to this scattered enterprise archive.

        The addArchive(archive) method has the same effect as:

              addArchive(archive, null)
         
        Follows the same semantics as addArchive(File, String) method.
        Throws:
        IOException
      • addArchive

        public void addArchive​(File archive,
                               String name)
                        throws IOException
        Add a module or a library to this scattered enterprise archive.

        The specified archive location should be one of the following:

              Location of a library JAR file.
              Location of a Java EE module.
         
        If the specified name is null, then the name is computed as archive.getName()
        Parameters:
        archive - Location of module or library archive.
        name - name of the module/library as specified in META-INF/application.xml
        Throws:
        NullPointerException - if archive is null
        IOException - if the archive file is not found
      • addMetadata

        public void addMetadata​(File metadata)
                         throws IOException
        Add a new metadata to this scattered enterprise archive.

        The addMetadata(metadata) method has the same effect as:

              addMetadata(metadata, null)
         
        Follows the same semantics as addMetadata(File, String) method.
        Throws:
        IOException
      • addMetadata

        public void addMetadata​(File metadata,
                                String name)
                         throws IOException
        Add a new metadata to this enterprise archive.

        A metadata is identified by its name (e.g., META-INF/application.xml) If the specified name is null, then the name is computed as "META-INF/" + metadata.getName()

        If the scattered enterprise archive already contains the metadata with the same name, the old value is replaced.

        Parameters:
        metadata - location of metdata.
        name - name of the metadata (e.g., META-INF/application.xml)
        Throws:
        NullPointerException - if metadata is null
        IOException - if metadata is not found
        IllegalArgumentException - if metadata is a directory.
      • toURI

        public URI toURI()
                  throws IOException
        Get the deployable URI for this scattered enterprise archive.

        Note : java.io.tmpdir is used while building the URI.

        Returns:
        Deployable scattered enterprise Archive URI.
        Throws:
        IOException - if any I/O error happens while building the URI or while reading metadata, archives.