com.ibm.wsspi.artifact

Interface ArtifactEntry

All Superinterfaces:
EnclosedEntity, Entity

  1. public interface ArtifactEntry
  2. extends EnclosedEntity
Represents an Entry within a Container. Note that Container does not require hashCode/equals, and thus should not be used as a key in HashMaps, etc.

Method Summary

Modifier and Type Method and Description
  1. ArtifactContainer
convertToContainer()
Attempt to convert this entry into a Container.
  1. ArtifactContainer
convertToContainer(boolean localOnly)
Attempt to convert this entry into a ArtifactContainer.
  1. java.io.InputStream
getInputStream()
Obtain inputstream for entry.
  1. long
getLastModified()
Obtain the time that this entry was last modified
  1. java.net.URL
getResource()
This method should return a URL suitable for the ServletContext.getResource(String path) method.
  1. long
getSize()
Obtain size of this Entries data, if any.
Methods inherited from interface com.ibm.wsspi.artifact.EnclosedEntity
getEnclosingContainer, getPath, getPhysicalPath, getRoot
Methods inherited from interface com.ibm.wsspi.artifact.Entity
getName

Method Detail

convertToContainer

  1. ArtifactContainer convertToContainer( )
Attempt to convert this entry into a Container.

Returned container may be a new type of artifact, check ArtifactContainer.isRoot() on the return.

Returns:
Container if conversion is possible, null otherwise.

convertToContainer

  1. ArtifactContainer convertToContainer( boolean localOnly)
Attempt to convert this entry into a ArtifactContainer.

Returned container may be a new type of artifact, check ArtifactContainer.isRoot() on the return.

Parameters:
localOnly - pass true if conversion should be restricted to returning Containers where isRoot returns false.
Returns:
ArtifactContainer if conversion is possible, null otherwise.

getInputStream

  1. java.io.InputStream getInputStream( )
  2. throws java.io.IOException
Obtain inputstream for entry.
Returns:
inputStream if possible for this entry, or null otherwise.
Throws:
java.io.IOException - if there is supposed to be a stream, but an error occurred obtaining it.

getSize

  1. long getSize()
Obtain size of this Entries data, if any.
Returns:
number of bytes this Entry represents.

getLastModified

  1. long getLastModified()
Obtain the time that this entry was last modified
Returns:
A long value indicating the last modified time or 0L if the value is not available

getResource

  1. java.net.URL getResource()

This method should return a URL suitable for the ServletContext.getResource(String path) method.

If this Entry represents a container then this method will not work because some implementations of this API may map more than one location to a single container. Therefore to load all of the locations that contribute to a container you should do:

Container container = entry.convertToContainer();
if (container != null) {
  Collection<URI> allUrisForContainer = container.getUri();
}

This may return null if this Entry is a virtual container that does not have a real location on disk.

Returns:
The URL pointing to this entry on disk
See Also:
ServletContext.getResource(String path)