Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 68236 invoked from network); 19 Jan 2001 19:50:13 -0000 Received: from 4tune.net (216.122.12.44) by h31.sny.collab.net with SMTP; 19 Jan 2001 19:50:13 -0000 Received: from guru (mvdbt.demon.nl [212.238.110.75]) by 4tune.net (8.9.3/8.9.3) with SMTP id LAA15649 for ; Fri, 19 Jan 2001 11:50:12 -0800 (PST) From: "Martin van den Bemt" To: "Antdev" Subject: [PROPOSAL] Chgrp and Chown or deprecate Chmod and add chrights? Date: Fri, 19 Jan 2001 20:49:07 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003D_01C08259.446D06F0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N ------=_NextPart_000_003D_01C08259.446D06F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Guys, Before you freeze, these 2 will be handy. I don't know when you're gonna freeze the cvs tree, but I was also working on chrights (which calls chmod, chgrp and chown), but I still have a little trouble calling them... Any tips are appreciated. I could also make chrights so it's works on his own and that we deprecate the chmod in 1.3. I attached the 2, with a little "test" xml file, which shows its functionality. chrights is also in there as a test, with the properties I had in mind. Mvgr, Martin van den Bemt mvdb.com ------=_NextPart_000_003D_01C08259.446D06F0 Content-Type: application/octet-stream; name="Chown.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Chown.java" /* * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights=20 * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.=20 * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: =20 * "This product includes software developed by the=20 * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software = itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Ant", and "Apache Software * Foundation" must not be used to endorse or promote products = derived * from this software without prior written permission. For written=20 * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.*; import org.apache.tools.ant.types.*; import java.io.*; import java.util.*; /** * Chgrp equivalent for unix-like environments. * * @author costin@eng.sun.com * @author Mariusz Nowostawski (Marni) mnowostawski@infosci= ence.otago.ac.nz * @author Stefan = Bodewig * @author Martin van den Bemt */ public class Chown extends ExecuteOn { private FileSet defaultSet =3D new FileSet(); private boolean haveOwner =3D false; =20 public Chown() { super.setExecutable("chown"); super.setParallel(true); } public void setFile(File src) { FileSet fs =3D new FileSet(); fs.setDir(new File(src.getParent())); fs.createInclude().setName(src.getName()); addFileset(fs); } public void setDir(File src) { defaultSet.setDir(src); } public void setOwner(String owner) { createArg().setValue(owner); haveOwner =3D true; } /** * add a name entry on the include list */ public PatternSet.NameEntry createInclude() { return defaultSet.createInclude(); } =20 /** * add a name entry on the exclude list */ public PatternSet.NameEntry createExclude() { return defaultSet.createExclude(); } /** * add a set of patterns */ public PatternSet createPatternSet() { return defaultSet.createPatternSet(); } /** * Sets the set of include patterns. Patterns may be separated by a = comma * or a space. * * @param includes the string containing the include patterns */ public void setIncludes(String includes) { defaultSet.setIncludes(includes); } /** * Sets the set of exclude patterns. Patterns may be separated by a = comma * or a space. * * @param excludes the string containing the exclude patterns */ public void setExcludes(String excludes) { defaultSet.setExcludes(excludes); } /** * Sets whether default exclusions should be used or not. * * @param useDefaultExcludes "true"|"on"|"yes" when default = exclusions=20 * should be used, "false"|"off"|"no" when = they * shouldn't be used. */ public void setDefaultexcludes(boolean useDefaultExcludes) { defaultSet.setDefaultexcludes(useDefaultExcludes); } =20 protected void checkConfiguration() { if (!haveOwner) { throw new BuildException("Required attribute owner not set = in chown",=20 location); } =20 if (defaultSet.getDir(project) !=3D null) { addFileset(defaultSet); } super.checkConfiguration(); } public void setExecutable(String e) { throw new BuildException(taskType+" doesn\'t support the = executable attribute", location); } public void setCommand(String e) { throw new BuildException(taskType+" doesn\'t support the command = attribute", location); } protected boolean isValidOs() { // XXX if OS=3Dunix return System.getProperty("path.separator").equals(":")=20 && (!System.getProperty("os.name").startsWith("Mac")=20 || System.getProperty("os.name").endsWith("X")) && super.isValidOs(); } } ------=_NextPart_000_003D_01C08259.446D06F0 Content-Type: application/octet-stream; name="Chgrp.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Chgrp.java" /* * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights=20 * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.=20 * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: =20 * "This product includes software developed by the=20 * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software = itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Ant", and "Apache Software * Foundation" must not be used to endorse or promote products = derived * from this software without prior written permission. For written=20 * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.*; import org.apache.tools.ant.types.*; import java.io.*; import java.util.*; /** * Chgrp equivalent for unix-like environments. * * @author costin@eng.sun.com * @author Mariusz Nowostawski (Marni) mnowostawski@infosci= ence.otago.ac.nz * @author Stefan = Bodewig * @author Martin van den Bemt */ public class Chgrp extends ExecuteOn { private FileSet defaultSet =3D new FileSet(); private boolean haveGroup =3D false; =20 public Chgrp() { super.setExecutable("chgrp"); super.setParallel(true); } public void setFile(File src) { FileSet fs =3D new FileSet(); fs.setDir(new File(src.getParent())); fs.createInclude().setName(src.getName()); addFileset(fs); } =20 public void setDir(File src) { defaultSet.setDir(src); } public void setGroup(String group) { createArg().setValue(group); haveGroup =3D true; } /** * add a name entry on the include list */ public PatternSet.NameEntry createInclude() { return defaultSet.createInclude(); } =20 /** * add a name entry on the exclude list */ public PatternSet.NameEntry createExclude() { return defaultSet.createExclude(); } /** * add a set of patterns */ public PatternSet createPatternSet() { return defaultSet.createPatternSet(); } /** * Sets the set of include patterns. Patterns may be separated by a = comma * or a space. * * @param includes the string containing the include patterns */ public void setIncludes(String includes) { defaultSet.setIncludes(includes); } /** * Sets the set of exclude patterns. Patterns may be separated by a = comma * or a space. * * @param excludes the string containing the exclude patterns */ public void setExcludes(String excludes) { defaultSet.setExcludes(excludes); } /** * Sets whether default exclusions should be used or not. * * @param useDefaultExcludes "true"|"on"|"yes" when default = exclusions=20 * should be used, "false"|"off"|"no" when = they * shouldn't be used. */ public void setDefaultexcludes(boolean useDefaultExcludes) { defaultSet.setDefaultexcludes(useDefaultExcludes); } =20 protected void checkConfiguration() { if (!haveGroup) { throw new BuildException("Required attribute group not set = in chgrp",=20 location); } =20 if (defaultSet.getDir(project) !=3D null) { addFileset(defaultSet); } super.checkConfiguration(); } public void setExecutable(String e) { throw new BuildException(taskType+" doesn\'t support the = executable attribute", location); } public void setCommand(String e) { throw new BuildException(taskType+" doesn\'t support the command = attribute", location); } protected boolean isValidOs() { // XXX if OS=3Dunix return System.getProperty("path.separator").equals(":")=20 && (!System.getProperty("os.name").startsWith("Mac")=20 || System.getProperty("os.name").endsWith("X")) && super.isValidOs(); } } ------=_NextPart_000_003D_01C08259.446D06F0 Content-Type: text/xml; name="chtest.xml" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="chtest.xml" =20 =20 =20 =20 ------=_NextPart_000_003D_01C08259.446D06F0--