public class PlexusIoFileResourceCollection extends AbstractPlexusIoResourceCollectionWithAttributes
PlexusIoResourceCollection
for the set
of files in a common directory.AbstractPlexusIoResourceCollection.IdentityTransformer
Modifier and Type | Field and Description |
---|---|
private java.io.File |
baseDir |
private boolean |
isFollowingSymLinks |
static java.lang.String |
ROLE_HINT
Role hint of this component
|
identityTransformer
DEFAULT_ROLE_HINT, ROLE
Constructor and Description |
---|
PlexusIoFileResourceCollection() |
Modifier and Type | Method and Description |
---|---|
private void |
addResources(java.util.List<PlexusIoResource> result,
java.lang.String[] resources) |
private static PlexusIoResourceAttributes |
createDefaults(int uid,
java.lang.String userName,
int gid,
java.lang.String groupName,
int mode) |
java.io.File |
getBaseDir() |
java.io.InputStream |
getInputStream(PlexusIoResource resource)
Returns an input stream for the provided resource, with stream transformers applied
|
java.lang.String |
getName(PlexusIoResource resource)
Returns the resources suggested name.
|
java.util.Iterator<PlexusIoResource> |
getResources()
Returns an iterator over the resources in the collection.
|
boolean |
isConcurrentAccessSupported()
Indicates if this collection supports concurrent access to its resources.
|
boolean |
isFollowingSymLinks() |
PlexusIoResource |
resolve(PlexusIoResource resource)
Resolves the supplide resource into a "real" resource.
|
void |
setBaseDir(java.io.File baseDir) |
void |
setDefaultAttributes(int uid,
java.lang.String userName,
int gid,
java.lang.String groupName,
int fileMode,
int dirMode) |
void |
setFollowingSymLinks(boolean pIsFollowingSymLinks) |
void |
setOverrideAttributes(int uid,
java.lang.String userName,
int gid,
java.lang.String groupName,
int fileMode,
int dirMode) |
void |
setPrefix(java.lang.String prefix)
Sets the prefix, which the file sets contents shall
have.
|
Stream |
stream()
Returns the resources as a stream.
|
getDefaultDirAttributes, getDefaultFileAttributes, getOverrideDirAttributes, getOverrideFileAttributes, mergeAttributes, setDefaultDirAttributes, setDefaultFileAttributes, setOverrideDirAttributes, setOverrideFileAttributes
getExcludes, getFileMappers, getFileSelectors, getIncludes, getLastModified, getName, getPrefix, getStreamTransformer, isCaseSensitive, isIncludingEmptyDirectories, isSelected, isUsingDefaultExcludes, iterator, setCaseSensitive, setExcludes, setFileMappers, setFileSelectors, setIncludes, setIncludingEmptyDirectories, setStreamTransformer, setUsingDefaultExcludes
public static final java.lang.String ROLE_HINT
private java.io.File baseDir
private boolean isFollowingSymLinks
public PlexusIoResource resolve(PlexusIoResource resource) throws java.io.IOException
PlexusIoResourceCollection
resolve
in interface PlexusIoResourceCollection
resolve
in class AbstractPlexusIoResourceCollection
resource
- The resourcesjava.io.IOException
- when something goes badpublic java.io.InputStream getInputStream(PlexusIoResource resource) throws java.io.IOException
PlexusIoResourceCollection
getInputStream
in interface PlexusIoResourceCollection
getInputStream
in class AbstractPlexusIoResourceCollection
resource
- The resourcesjava.io.IOException
- when something goes badpublic java.lang.String getName(PlexusIoResource resource)
PlexusIoResourceCollection
getName
in interface PlexusIoResourceCollection
getName
in class AbstractPlexusIoResourceCollection
resource
- A resource, which has been obtained by
calling PlexusIoResourceCollection.getResources()
.public void setBaseDir(java.io.File baseDir)
baseDir
- The base directory of the file collectionpublic java.io.File getBaseDir()
public boolean isFollowingSymLinks()
public void setFollowingSymLinks(boolean pIsFollowingSymLinks)
pIsFollowingSymLinks
- whether symbolic links should be followedpublic void setDefaultAttributes(int uid, java.lang.String userName, int gid, java.lang.String groupName, int fileMode, int dirMode)
public void setOverrideAttributes(int uid, java.lang.String userName, int gid, java.lang.String groupName, int fileMode, int dirMode)
private static PlexusIoResourceAttributes createDefaults(int uid, java.lang.String userName, int gid, java.lang.String groupName, int mode)
public void setPrefix(java.lang.String prefix)
AbstractPlexusIoResourceCollection
setPrefix
in class AbstractPlexusIoResourceCollection
private void addResources(java.util.List<PlexusIoResource> result, java.lang.String[] resources) throws java.io.IOException
java.io.IOException
public Stream stream()
PlexusIoResourceCollection
public java.util.Iterator<PlexusIoResource> getResources() throws java.io.IOException
PlexusIoResourceCollection
java.io.IOException
- .public boolean isConcurrentAccessSupported()
PlexusIoResourceCollection
Some resource collections (like tar files) may not support efficient random access
or seek operation so implementations that represent such collections may not be able
to provide concurrent access to its resources. If implementation returns false
,
then it is not safe to access its methods and resources in concurrent fashion.
For example it is not safe to read from two resources in two concurrent threads,
to read a resource and iterate over the iterator returned by PlexusIoResourceCollection.getResources()
in two concurrent threads, etc.
Please note that this method indicates concurrent support only for the collection,
not for the individual resources. This means there is no guarantee that
the resources returned by PlexusIoResourceCollection.resolve(PlexusIoResource)
or the input stream
returned by PlexusIoResourceCollection.getInputStream(PlexusIoResource)
are thread-safe,
even if true
is returned.
true
if this collection supports concurrent access,
otherwise false