From 219123401efb3fb09ad935b9a56d3a2028705328 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Thu, 14 Feb 2002 11:23:26 +0000 Subject: [PATCH] Temporarily delete file - will readd later git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271347 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/unix/Chmod.java | 188 ------------------ .../apache/tools/ant/taskdefs/unix/Chmod.java | 188 ------------------ 2 files changed, 376 deletions(-) delete mode 100644 proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java delete mode 100644 proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java deleted file mode 100644 index 5e00fa3a7..000000000 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. - * - * This software is published under the terms of the Apache Software License - * version 1.1, a copy of which has been included with this distribution in - * the LICENSE.txt file. - */ -package org.apache.tools.ant.taskdefs.unix; - -import java.io.File; -import java.io.IOException; -import org.apache.aut.nativelib.Os; -import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.framework.Pattern; -import org.apache.myrmidon.framework.PatternSet; -import org.apache.tools.ant.taskdefs.exec.Execute; -import org.apache.tools.ant.taskdefs.exec.ExecuteOn; -import org.apache.tools.ant.types.Argument; -import org.apache.tools.ant.types.FileSet; - -/** - * Chmod equivalent for unix-like environments. - * - * @author costin@eng.sun.com - * @author Mariusz Nowostawski (Marni) - * mnowostawski@infoscience.otago.ac.nz - * @author Stefan Bodewig - */ -public class Chmod - extends ExecuteOn -{ - private FileSet m_defaultSet = new FileSet(); - private boolean m_defaultSetDefined; - private boolean m_havePerm; - - public Chmod() - throws TaskException - { - super.setExecutable( "chmod" ); - super.setParallel( true ); - super.setSkipEmptyFilesets( true ); - } - - /** - * Sets whether default exclusions should be used or not. - * - * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions - * should be used, "false"|"off"|"no" when they shouldn't be used. - */ - public void setDefaultExcludes( boolean useDefaultExcludes ) - { - m_defaultSetDefined = true; - m_defaultSet.setDefaultExcludes( useDefaultExcludes ); - } - - public void setDir( File src ) - { - m_defaultSet.setDir( src ); - } - - /** - * Sets the set of exclude patterns. Patterns may be separated by a comma or - * a space. - */ - public void setExcludes( String excludes ) - { - m_defaultSetDefined = true; - m_defaultSet.setExcludes( excludes ); - } - - public void setExecutable( String e ) - throws TaskException - { - throw new TaskException( getContext().getName() + " doesn\'t support the executable attribute" ); - } - - public void setFile( File src ) - { - final FileSet fileSet = new FileSet(); - fileSet.setDir( new File( src.getParent() ) ); - fileSet.addInclude( new Pattern( src.getName() ) ); - addFileset( fileSet ); - } - - /** - * 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 ) - { - m_defaultSetDefined = true; - m_defaultSet.setIncludes( includes ); - } - - public void setPerm( String perm ) - { - addArg( new Argument( perm ) ); - m_havePerm = true; - } - - public void setSkipEmptyFilesets( final boolean skip ) - { - final String message = getContext().getName() + " doesn\'t support the skipemptyfileset attribute"; - throw new IllegalArgumentException( message ); - } - - /** - * add a name entry on the exclude list - */ - public void addExclude( final Pattern pattern ) - { - m_defaultSetDefined = true; - m_defaultSet.addExclude( pattern ); - } - - /** - * add a name entry on the include list - */ - public void addInclude( final Pattern pattern ) - { - m_defaultSetDefined = true; - m_defaultSet.addInclude( pattern ); - } - - /** - * add a set of patterns - */ - public void addPatternSet( final PatternSet set ) - { - m_defaultSetDefined = true; - m_defaultSet.addPatternSet( set ); - } - - public void execute() - throws TaskException - { - if( m_defaultSetDefined || m_defaultSet.getDir() == null ) - { - super.execute(); - } - else if( isValidOs() ) - { - // we are chmodding the given directory - final Argument argument = - new Argument( m_defaultSet.getDir().getPath() ); - addArg( argument ); - final Execute execute = prepareExec(); - try - { - execute.setCommandline( getCommand().getCommandline() ); - runExecute( execute ); - } - catch( final IOException ioe ) - { - final String message = "Execute failed: " + ioe; - throw new TaskException( message, ioe ); - } - finally - { - // close the output file if required - logFlush(); - } - } - } - - protected boolean isValidOs() - { - return Os.isFamily( "unix" ) && super.isValidOs(); - } - - protected void validate() - throws TaskException - { - if( !m_havePerm ) - { - throw new TaskException( "Required attribute perm not set in chmod" ); - } - - if( m_defaultSetDefined && m_defaultSet.getDir() != null ) - { - addFileset( m_defaultSet ); - } - super.validate(); - } -} diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java deleted file mode 100644 index 5e00fa3a7..000000000 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. - * - * This software is published under the terms of the Apache Software License - * version 1.1, a copy of which has been included with this distribution in - * the LICENSE.txt file. - */ -package org.apache.tools.ant.taskdefs.unix; - -import java.io.File; -import java.io.IOException; -import org.apache.aut.nativelib.Os; -import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.framework.Pattern; -import org.apache.myrmidon.framework.PatternSet; -import org.apache.tools.ant.taskdefs.exec.Execute; -import org.apache.tools.ant.taskdefs.exec.ExecuteOn; -import org.apache.tools.ant.types.Argument; -import org.apache.tools.ant.types.FileSet; - -/** - * Chmod equivalent for unix-like environments. - * - * @author costin@eng.sun.com - * @author Mariusz Nowostawski (Marni) - * mnowostawski@infoscience.otago.ac.nz - * @author Stefan Bodewig - */ -public class Chmod - extends ExecuteOn -{ - private FileSet m_defaultSet = new FileSet(); - private boolean m_defaultSetDefined; - private boolean m_havePerm; - - public Chmod() - throws TaskException - { - super.setExecutable( "chmod" ); - super.setParallel( true ); - super.setSkipEmptyFilesets( true ); - } - - /** - * Sets whether default exclusions should be used or not. - * - * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions - * should be used, "false"|"off"|"no" when they shouldn't be used. - */ - public void setDefaultExcludes( boolean useDefaultExcludes ) - { - m_defaultSetDefined = true; - m_defaultSet.setDefaultExcludes( useDefaultExcludes ); - } - - public void setDir( File src ) - { - m_defaultSet.setDir( src ); - } - - /** - * Sets the set of exclude patterns. Patterns may be separated by a comma or - * a space. - */ - public void setExcludes( String excludes ) - { - m_defaultSetDefined = true; - m_defaultSet.setExcludes( excludes ); - } - - public void setExecutable( String e ) - throws TaskException - { - throw new TaskException( getContext().getName() + " doesn\'t support the executable attribute" ); - } - - public void setFile( File src ) - { - final FileSet fileSet = new FileSet(); - fileSet.setDir( new File( src.getParent() ) ); - fileSet.addInclude( new Pattern( src.getName() ) ); - addFileset( fileSet ); - } - - /** - * 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 ) - { - m_defaultSetDefined = true; - m_defaultSet.setIncludes( includes ); - } - - public void setPerm( String perm ) - { - addArg( new Argument( perm ) ); - m_havePerm = true; - } - - public void setSkipEmptyFilesets( final boolean skip ) - { - final String message = getContext().getName() + " doesn\'t support the skipemptyfileset attribute"; - throw new IllegalArgumentException( message ); - } - - /** - * add a name entry on the exclude list - */ - public void addExclude( final Pattern pattern ) - { - m_defaultSetDefined = true; - m_defaultSet.addExclude( pattern ); - } - - /** - * add a name entry on the include list - */ - public void addInclude( final Pattern pattern ) - { - m_defaultSetDefined = true; - m_defaultSet.addInclude( pattern ); - } - - /** - * add a set of patterns - */ - public void addPatternSet( final PatternSet set ) - { - m_defaultSetDefined = true; - m_defaultSet.addPatternSet( set ); - } - - public void execute() - throws TaskException - { - if( m_defaultSetDefined || m_defaultSet.getDir() == null ) - { - super.execute(); - } - else if( isValidOs() ) - { - // we are chmodding the given directory - final Argument argument = - new Argument( m_defaultSet.getDir().getPath() ); - addArg( argument ); - final Execute execute = prepareExec(); - try - { - execute.setCommandline( getCommand().getCommandline() ); - runExecute( execute ); - } - catch( final IOException ioe ) - { - final String message = "Execute failed: " + ioe; - throw new TaskException( message, ioe ); - } - finally - { - // close the output file if required - logFlush(); - } - } - } - - protected boolean isValidOs() - { - return Os.isFamily( "unix" ) && super.isValidOs(); - } - - protected void validate() - throws TaskException - { - if( !m_havePerm ) - { - throw new TaskException( "Required attribute perm not set in chmod" ); - } - - if( m_defaultSetDefined && m_defaultSet.getDir() != null ) - { - addFileset( m_defaultSet ); - } - super.validate(); - } -}