1 | public class Chgrp extends AbstractAccessTask {↵ | | 1 | public class Chown extends AbstractAccessTask {↵
|
|
2 | private boolean haveGroup = false;↵ | | 2 | private boolean haveOwner = false;↵
|
|
3 | /**↵ | | 3 | /**↵
|
4 | * Chgrp task for setting unix group of a file.↵ | | 4 | * Chown task for setting file and directory permissions.↵
|
5 | */↵ | | 5 | */↵
|
6 | public Chgrp() {↵ | | 6 | public Chown() {↵
|
7 | super.setExecutable("chgrp");↵ | | 7 | super.setExecutable("chown");↵
|
8 | }↵ | | 8 | }↵
|
|
9 | /**↵ | | 9 | /**↵
|
10 | * Set the group atribute.↵ | | 10 | * Set the owner atribute.↵
|
11 | *↵ | | 11 | *↵
|
12 | * @param group The new group for the file(s) or directory(ies)↵ | | 12 | * @param owner The new owner for the file(s) or directory(ies)↵
|
13 | */↵ | | 13 | */↵
|
14 | public void setGroup(String group) {↵ | | 14 | public void setOwner(String owner) {↵
|
15 | createArg().setValue(group);↵ | | 15 | createArg().setValue(owner);↵
|
16 | haveGroup = true;↵ | | 16 | haveOwner = true;↵
|
17 | }↵ | | 17 | }↵
|
|
18 | /**↵ | | 18 | /**↵
|
19 | * Ensure that all the required arguments and other conditions have↵ | | 19 | * Ensure that all the required arguments and other conditions have↵
|
20 | * been set.↵ | | 20 | * been set.↵
|
21 | */↵ | | 21 | */↵
|
22 | protected void checkConfiguration() {↵ | | 22 | protected void checkConfiguration() {↵
|
23 | if (!haveGroup) {↵ | | 23 | if (!haveOwner) {↵
|
24 | throw new BuildException("Required attribute group not set in "↵ | | 24 | throw new BuildException("Required attribute owner not set in"↵
|
25 | + "chgrp", getLocation());↵ | | 25 | + " chown", getLocation());↵
|
26 | }↵ | | 26 | }↵
|
27 | super.checkConfiguration();↵ | | 27 | super.checkConfiguration();↵
|
28 | }↵ | | 28 | }↵
|
|
29 | /**↵ | | 29 | /**↵
|
30 | * We don't want to expose the executable atribute, so overide it.↵ | | 30 | * We don't want to expose the executable atribute, so overide it.↵
|
31 | *↵ | | 31 | *↵
|
32 | * @param e User supplied executable that we won't accept.↵ | | 32 | * @param e User supplied executable that we won't accept.↵
|
33 | */↵ | | 33 | */↵
|
34 | public void setExecutable(String e) {↵ | | 34 | public void setExecutable(String e) {↵
|
35 | throw new BuildException(getTaskType()↵ | | 35 | throw new BuildException(getTaskType()↵
|
36 | + " doesn\'t support the executable"↵ | | 36 | + " doesn\'t support the executable"↵
|
37 | + " attribute", getLocation());↵ | | 37 | + " attribute", getLocation());↵
|
38 | | | 38 |
|