|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.jdeveloper.deploy.DefaultArchive
public class DefaultArchive
Utility class used to build a jar file.
| Field Summary |
|---|
| Fields inherited from interface oracle.jdeveloper.deploy.Archive |
|---|
ARCHIVE_ENTRY_NAME_COMPARATOR, BUFFER_SIZE |
| Constructor Summary | |
|---|---|
protected |
DefaultArchive(boolean forceRewrite)Creates a new instance of DefaultArchive and initializes it to omit the Created-By line in the manifest file. |
| Method Summary | |
|---|---|
void |
addContents(ArchiveEntry cdaPacket) |
void |
addContents(ArchiveEntry[] cdaPackets)Fills in the manifest with all necessary information provided by the ArchiveEntry array passed in. |
void |
addContents(java.util.Collection cdaPackets)Fills in the manifest with all necessary information provided by the Collection of ArchiveEntry instances passed in. |
void |
addContents(java.util.Collection cdaPackets, java.lang.String entryNamePrefix)Fills in the manifest with all necessary information provided by the Collection of ArchiveEntry instances passed in. |
void |
addDirectoryTrees(java.net.URL[] dirs, java.lang.String entryNamePrefix) |
boolean |
containsEntry(java.lang.String entryName) |
java.lang.Object |
copyTo(java.lang.Object target)Copies the internal state of this object to the specified copy. |
protected void |
copyToImpl(DefaultArchive copy) |
static DefaultArchive |
create(boolean includeManifest, boolean forceRewrite)Convenience method. |
java.util.Iterator<ArchiveEntry> |
getArchiveEntries()Returns an iterator to the contents that have been added to the Archive instance so far. |
oracle.jdevimpl.deploy.CdaPacket[] |
getCdaPackets()Deprecated. Use getArchiveEntries() instead. |
java.util.ArrayList<ArchiveEntry[]> |
getCollisions() |
int |
getCompressionLevel()Return the desired compression level. |
ArchiveEntry |
getEntryByName(java.lang.String entryName)Get a handle to an ArchiveEntry by its name. |
protected static java.lang.String |
getJarFileCreatedBy()Returns the string that should be used in the manifest file's Created-By main attribute. |
java.lang.String |
getMainAttribute(java.lang.String attrName)Returns the specified main attribute from the jar's manifest file. |
java.util.jar.Manifest |
getManifest()Returns the current Manifest. |
java.lang.String |
getManifestAsString()Returns the current Manfiest as a String. |
java.util.SortedSet |
getMissingEntryNames()Returns a SortedSet of entry names corresponding to entries which could not be found (i.e. |
boolean |
hasContents()Returns whether the written jar file had any contents. |
boolean |
isCompressed() |
boolean |
isIncludeManifest() |
void |
mergeManifest(java.util.jar.Manifest manifest)Merges the given Manifest with the manifest currently held by DefaultArchive. |
void |
mergeManifest(java.net.URL manifestURL)Merge the manifest at the specified URL. |
ArchiveEntry |
removeEntry(java.lang.String entryName) |
ArchiveEntry |
renameEntry(java.lang.String fromName, java.lang.String toName)Change the name of an ArchiveEntry. |
void |
setCompressed(boolean compressed)Sets whether the jar file that is written out should be compressed. |
void |
setCompressionLevel(int level)Set the desired compression level. |
void |
setCreatedBy(java.lang.String creator)Sets the Created-By main attribute for the manifest file. |
void |
setIncludeManifest(boolean includeManifest) |
void |
setMainAttribute(java.lang.String attrName, java.lang.String attrValue)Sets the specified main attribute for the jar's manifest file. |
void |
setMainClass(java.lang.String mainClass)Sets the Main-Class main attribute for the manifest file. |
void |
setReportNameCollisions(boolean reportNameCollisions)Deprecated. |
static boolean |
writeJarFile(Archive archive, java.net.URL outputURL, java.io.PrintWriter printWriter, boolean forceRewrite, boolean compressed)Utility method to write out a Jar file given an Archive. |
boolean |
writeJarFile(java.net.URL outputURL, java.io.PrintWriter printWriter)Writes out the jar file according to all of the ArchiveEntrys, manifests, and attributes that have been set on this DefaultArchive instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected DefaultArchive(boolean forceRewrite)
DefaultArchive and initializes it to omit the Created-By line in the manifest file.| Method Detail |
|---|
public static DefaultArchive create(boolean includeManifest,
boolean forceRewrite)
DefaultArchive instance. If includeManifest is true, a manifest file will be produced by the DefaultArchive instance, and the manifest file's Created-By attribute will be set to the appropriate value automatically.protected static java.lang.String getJarFileCreatedBy()
public java.util.jar.Manifest getManifest()
Manifest.getManifest in interface Archive
public java.lang.String getManifestAsString()
throws java.io.IOException
Manfiest as a String. If there is no manifest, null is returned.getManifestAsString in interface Archivejava.io.IOException - if an I/O exception occurs while converting the manifest contents to String.public void setCreatedBy(java.lang.String creator)
Created-By main attribute for the manifest file.
If creator is null, then the Created-By attribute is removed from the manifest.
setCreatedBy in interface Archivepublic java.lang.String getMainAttribute(java.lang.String attrName)
null if the attribute does not exist. Throws IllegalArgumentException if the attribute name is not formatted properly.getMainAttribute in interface Archive
public void setMainAttribute(java.lang.String attrName,
java.lang.String attrValue)
attrName is null this method does nothing. If attrValue is null then the specified attribute is removed from the manifest's main attributes section.setMainAttribute in interface Archivepublic void setMainClass(java.lang.String mainClass)
Main-Class main attribute for the manifest file. The Main-Class attribute allows a jar file to be used on the command line to launch an application, so that you can launch the application with a command like java -jar MyApp.jar.
If mainClass is null, then the Main-Class attribute is removed from the manifest.
setMainClass in interface Archivepublic void setCompressed(boolean compressed)
setCompressed in interface Archivepublic void setCompressionLevel(int level)
ArchivesetCompressionLevel in interface Archivelevel - the compression level, -1 or 0-9Deflaterpublic boolean isCompressed()
isCompressed in interface Archivepublic int getCompressionLevel()
ArchivegetCompressionLevel in interface ArchiveDeflaterpublic boolean isIncludeManifest()
isIncludeManifest in interface Archivepublic void setIncludeManifest(boolean includeManifest)
setIncludeManifest in interface Archive
@Deprecated
public void setReportNameCollisions(boolean reportNameCollisions)
setReportNameCollisions in interface Archivepublic java.util.ArrayList<ArchiveEntry[]> getCollisions()
public void mergeManifest(java.util.jar.Manifest manifest)
Manifest with the manifest currently held by DefaultArchive.mergeManifest in interface Archive
public void mergeManifest(java.net.URL manifestURL)
throws java.io.IOException
URL.mergeManifest in interface Archivejava.io.IOException
public void addContents(java.util.Collection cdaPackets,
java.lang.String entryNamePrefix)
Collection of ArchiveEntry instances passed in. This Collection is traversed in the order provided by its Iterator. Before the collection of ArchiveEntrys is processed, the given entryNamePrefix is prepended to each ArchiveEntry's entryName. This provides a convenient way of adding a collection of content to a particular directory tree within the archive (e.g. "WEB-INF/classes/"). If the entryNamePrefix represents a directory, it must end with a forward-slash ("/"), because there is no automatic insertion of any intermediate character during the prepending.addContents in interface Archivepublic void addContents(java.util.Collection cdaPackets)
Collection of ArchiveEntry instances passed in. This Collection is traversed in the order provided by its Iterator.addContents in interface Archivepublic void addContents(ArchiveEntry cdaPacket)
addContents in interface Archivepublic boolean containsEntry(java.lang.String entryName)
containsEntry in interface Archivepublic ArchiveEntry removeEntry(java.lang.String entryName)
removeEntry in interface Archivepublic void addContents(ArchiveEntry[] cdaPackets)
ArchiveEntry array passed in.addContents in interface Archive
public void addDirectoryTrees(java.net.URL[] dirs,
java.lang.String entryNamePrefix)
addDirectoryTrees in interface Archive
@Deprecated
public oracle.jdevimpl.deploy.CdaPacket[] getCdaPackets()
CdaPacket objects corresponding to the contents that have been added to the DefaultArchive instance so far.public java.util.SortedSet getMissingEntryNames()
SortedSet of entry names corresponding to entries which could not be found (i.e. their URL is null). This information is based on the entries that have been added through one of the addContent() methods up to the point in time that getMissingEntryNames() is called. If no entries are missing, an empty SortedSet is returned.getMissingEntryNames in interface Archivepublic boolean hasContents()
writeJarFile() methods), then this will return false.hasContents in interface Archive
public boolean writeJarFile(java.net.URL outputURL,
java.io.PrintWriter printWriter)
throws java.io.IOException
ArchiveEntrys, manifests, and attributes that have been set on this DefaultArchive instance.outputURL - The URL where the jar file will be written.printWriter - A PrintWriter where any output messages will be written. This parameter can be null which means that any output messages will not be printed at all.java.io.IOException
public static boolean writeJarFile(Archive archive,
java.net.URL outputURL,
java.io.PrintWriter printWriter,
boolean forceRewrite,
boolean compressed)
throws java.io.IOException
archive - the Archive to write out.outputURL - the file to write to.printWriter - print writer for log messagesforceRewrite - whether the jar should be re-written if one already exists at outputURL and if it is up-to-date. A timestamp comparision is done of the files within the jar and its Manifest.compressed - if the file should be compressedDeployExceptionjava.io.IOExceptionpublic java.util.Iterator<ArchiveEntry> getArchiveEntries()
ArchiveArchive instance so far.getArchiveEntries in interface Archivepublic java.lang.Object copyTo(java.lang.Object target)
Copyablethis object to the specified copy. If copy is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.
Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this object's state was copied.
There is a standard implementation pattern for the copyTo method that helps avoid problems that arise when a Copyable object is subclassed. The pattern is:
public Object copyTo( Object target )
{
final <this_class> copy =
target != null ? (<this_class>) target : new <this_class>();
copyToImpl( copy );
return copy;
}
protected final void copyToImpl( <this_class> copy )
{
super.copyToImpl( copy ); // if necessary
// put code here for copying the properties of <this_class>
}
The parameter passed into the copyToImpl method is the same type of this class. The responsibility of copyToImpl is to copy the state of this class through direct access of the fields. The copyToImpl method should not use getters and setters since these may be overridden, causing the state of this class to be incompletely copied.copyTo in interface Copyabletarget - The target object to which the state of this object should be copied. If target is null, then the copyTo method will return a new instance of this class.this object was copied. If the target was non-null, then the return value is the same as the target object that was passed in; otherwise, the return value is a new instance of this class.protected void copyToImpl(DefaultArchive copy)
public ArchiveEntry getEntryByName(java.lang.String entryName)
ArchiveArchiveEntry e = archive.getEntryByName("WEB-INF/web.xml");getEntryByName in interface Archive
public ArchiveEntry renameEntry(java.lang.String fromName,
java.lang.String toName)
ArchiverenameEntry in interface Archive
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||