PosixFilePermissions for resources.
This task provides a subset of Chmod's and org.'s abilities
in less platform dependent way.
It requires a file system that supports PosixFilePermissions for
its full potential. It can optionally fall back to
DosFilePermissions (only changing the readonly state) on file
systems that don't support POSIX permissions. See SetPermissions.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | SetPermissions.
Options for dealing with file systems that don't support POSIX permissions. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private SetPermissions. | |
| private final Set | |
| private Resources |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(ResourceCollection
a resource collection rc)Adds a collection of resources to set permissions on. |
| public void | execute()
Overrides org. |
| private boolean | |
| private void | |
| private void | |
| public void | setFailOnError(final boolean
true or false. failonerror)Set whether to fail when errors are encountered. |
| public void | |
| public void | setNonPosixMode(SetPermissions.
what to do if changing the permissions of a file is not possible mSet what to do if changing the permissions of a file is not possible because the file-system doesn't support POSIX file permissions. |
| public void | setPermissions(String
comma separated list of names of perms)PosixFilePermissions.Adds permissions as a comma separated list. |
| private void |
| failonerror | back to summary |
|---|---|
| private boolean failonerror | |
| nonPosixMode | back to summary |
|---|---|
| private SetPermissions. | |
| permissions | back to summary |
|---|---|
| private final Set<PosixFilePermission> permissions | |
| resources | back to summary |
|---|---|
| private Resources resources | |
| SetPermissions | back to summary |
|---|---|
| public SetPermissions() | |
| add | back to summary |
|---|---|
| public void add(ResourceCollection rc) Adds a collection of resources to set permissions on.
| |
| execute | back to summary |
|---|---|
| public void execute() Overrides org. Doc from org. Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.
| |
| isWritable | back to summary |
|---|---|
| private boolean isWritable() | |
| maybeThrowException | back to summary |
|---|---|
| private void maybeThrowException(Exception exc, String msgFormat, Object... msgArgs) | |
| posixPermissionsNotSupported | back to summary |
|---|---|
| private void posixPermissionsNotSupported(Path p) | |
| setFailOnError | back to summary |
|---|---|
| public void setFailOnError(final boolean failonerror) Set whether to fail when errors are encountered. If false, note errors to the output but keep going. Default is true. Only applies to IO and SecurityExceptions, see
| |
| setMode | back to summary |
|---|---|
| public void setMode(String octalString) A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion;
| |
| setNonPosixMode | back to summary |
|---|---|
| public void setNonPosixMode(SetPermissions. Set what to do if changing the permissions of a file is not possible because the file-system doesn't support POSIX file permissions. The default is
| |
| setPermissions | back to summary |
|---|---|
| public void setPermissions(String perms) Adds permissions as a comma separated list.
| |
| tryDos | back to summary |
|---|---|
| private void tryDos(Path p, boolean failIfDosIsNotSupported) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final SetPermissions. | fail
Fail the build. |
| public static final SetPermissions. | pass
Log an error and go on. |
| public static final SetPermissions. | tryDosOrFail
Try DosFilePermissions - setting the read-only flag - and fail the build if that fails as well. |
| public static final SetPermissions. | tryDosOrPass
Try DosFilePermissions - setting the read-only flag - and log an error and go on if that fails as well. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SetPermissions. | |
| public static SetPermissions. |
| fail | back to summary |
|---|---|
| public static final SetPermissions. Fail the build. | |
| pass | back to summary |
|---|---|
| public static final SetPermissions. Log an error and go on. | |
| tryDosOrFail | back to summary |
|---|---|
| public static final SetPermissions. Try DosFilePermissions - setting the read-only flag - and fail the build if that fails as well. | |
| tryDosOrPass | back to summary |
|---|---|
| public static final SetPermissions. Try DosFilePermissions - setting the read-only flag - and log an error and go on if that fails as well. | |
| NonPosixMode | back to summary |
|---|---|
| private NonPosixMode() | |
| valueOf | back to summary |
|---|---|
| public static SetPermissions. | |
| values | back to summary |
|---|---|
| public static SetPermissions. | |