public class ArtificerArchive extends Object implements Serializable
Constructor and Description |
---|
ArtificerArchive()
Creates a new, empty S-RAMP archive.
|
ArtificerArchive(File file)
Creates an S-RAMP archive from an existing archive file.
|
ArtificerArchive(InputStream input)
Creates an S-RAMP archive from an
InputStream . |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(String path,
org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType metaData,
InputStream content)
Adds an entry to the S-RAMP archive.
|
void |
close()
The S-RAMP archive should always be closed when the client is done with it.
|
static void |
closeQuietly(ArtificerArchive archive)
Close the archive quietly (eat any
IOException ). |
boolean |
containsEntry(String archivePath)
Returns true if the s-ramp archive contains an entry at the given path.
|
Collection<ArtificerArchiveEntry> |
getEntries()
Gets all of the entries found in this S-RAMP archive.
|
ArtificerArchiveEntry |
getEntry(String archivePath)
Gets a single entry in the archive by path.
|
InputStream |
getInputStream(ArtificerArchiveEntry entry)
Gets the content
InputStream for the given S-RAMP archive entry. |
File |
pack()
Packs up the current contents of the S-RAMP archive into a single (.zip) file and
returns a reference to it.
|
boolean |
removeEntry(String archivePath)
Removes the s-ramp archive entry at the given path if it exists.
|
void |
updateEntry(ArtificerArchiveEntry entry,
InputStream content)
Updates an existing entry in the S-RAMP archive.
|
public ArtificerArchive() throws ArtificerArchiveException
ArtificerArchiveException
public ArtificerArchive(File file) throws ArtificerArchiveException
file
- ArtificerArchiveException
public ArtificerArchive(InputStream input) throws ArtificerArchiveException
InputStream
. This will consume and close the
InputStream
, creating a temporary local file that will be used as the basis for
the archive input.input
- ArtificerArchiveException
public void close() throws IOException
IOException
public static void closeQuietly(ArtificerArchive archive)
IOException
).archive
- public Collection<ArtificerArchiveEntry> getEntries() throws ArtificerArchiveException
ArtificerArchiveException
public InputStream getInputStream(ArtificerArchiveEntry entry) throws IOException
InputStream
for the given S-RAMP archive entry.entry
- the s-ramp archive entryInputStream
over the artifact content or null if no content found (meta-data only)IOException
public void addEntry(String path, org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType metaData, InputStream content) throws ArtificerArchiveException
InputStream
.path
- the path in the archive (usually just the name of the artifact)metaData
- the artifact meta-datacontent
- the entry content (or null if a meta-data only entry)ArtificerArchiveException
public void updateEntry(ArtificerArchiveEntry entry, InputStream content) throws ArtificerArchiveException
InputStream
.entry
- the archive entry (or null if just udpating the content)content
- the entry content (or null if just updating meta data)ArtificerArchiveException
public File pack() throws ArtificerArchiveException
File
. It will never throw and leave a temporary file
behind.ArtificerArchiveException
public ArtificerArchiveEntry getEntry(String archivePath)
archivePath
- the path of the entry within the archivepublic boolean containsEntry(String archivePath)
archivePath
- path to the entry within the archivepublic boolean removeEntry(String archivePath)
archivePath
- path to the entry within the archiveCopyright © 2011–2015 JBoss, a division of Red Hat. All rights reserved.