git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271233 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -28,7 +28,7 @@ import org.apache.myrmidon.interfaces.executor.Executor; | |||
| public class IfTask | |||
| extends AbstractContainerTask | |||
| { | |||
| private static final Resources REZ = | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( IfTask.class ); | |||
| private Condition m_condition; | |||
| @@ -22,10 +22,13 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| class FtpFileObject extends AbstractFileObject | |||
| class FtpFileObject | |||
| extends AbstractFileObject | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( FtpFileObject.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( FtpFileObject.class ); | |||
| private final static FTPFile[] EMPTY_FTP_FILE_ARRAY = {}; | |||
| private FtpFileSystem m_ftpFs; | |||
| @@ -33,12 +36,11 @@ class FtpFileObject extends AbstractFileObject | |||
| private FTPFile m_fileInfo; | |||
| private FTPFile[] m_children; | |||
| private static final FTPFile[] EMPTY_FTP_FILE_ARRAY = {}; | |||
| public FtpFileObject( FileName name, FtpFileSystem fs ) | |||
| public FtpFileObject( final FileName name, final FtpFileSystem fileSystem ) | |||
| { | |||
| super( name, fs ); | |||
| m_ftpFs = fs; | |||
| super( name, fileSystem ); | |||
| m_ftpFs = fileSystem; | |||
| } | |||
| /** | |||
| @@ -74,7 +76,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Attaches this file object to its file resource. | |||
| */ | |||
| protected void doAttach() throws Exception | |||
| protected void doAttach() | |||
| throws Exception | |||
| { | |||
| // Get the parent folder to find the info for this file | |||
| FtpFileObject parent = (FtpFileObject)getParent(); | |||
| @@ -106,7 +109,8 @@ class FtpFileObject extends AbstractFileObject | |||
| * Determines the type of the file, returns null if the file does not | |||
| * exist. | |||
| */ | |||
| protected FileType doGetType() throws Exception | |||
| protected FileType doGetType() | |||
| throws Exception | |||
| { | |||
| if( m_fileInfo == null ) | |||
| { | |||
| @@ -129,7 +133,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Lists the children of the file. | |||
| */ | |||
| protected String[] doListChildren() throws Exception | |||
| protected String[] doListChildren() | |||
| throws Exception | |||
| { | |||
| if( m_children == null ) | |||
| { | |||
| @@ -166,7 +171,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Creates this file as a folder. | |||
| */ | |||
| protected void doCreateFolder() throws Exception | |||
| protected void doCreateFolder() | |||
| throws Exception | |||
| { | |||
| if( !m_ftpFs.getClient().makeDirectory( getName().getPath() ) ) | |||
| { | |||
| @@ -194,7 +200,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Notification of the input stream being closed. | |||
| */ | |||
| protected void doEndInput() throws Exception | |||
| protected void doEndInput() | |||
| throws Exception | |||
| { | |||
| if( !m_ftpFs.getClient().completePendingCommand() ) | |||
| { | |||
| @@ -206,7 +213,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Creates an output stream to write the file content to. | |||
| */ | |||
| protected OutputStream doGetOutputStream() throws Exception | |||
| protected OutputStream doGetOutputStream() | |||
| throws Exception | |||
| { | |||
| return m_ftpFs.getClient().storeFileStream( getName().getPath() ); | |||
| } | |||
| @@ -214,7 +222,8 @@ class FtpFileObject extends AbstractFileObject | |||
| /** | |||
| * Notification of the output stream being closed. | |||
| */ | |||
| protected void doEndOutput() throws Exception | |||
| protected void doEndOutput() | |||
| throws Exception | |||
| { | |||
| if( !m_ftpFs.getClient().completePendingCommand() ) | |||
| { | |||
| @@ -23,17 +23,19 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| class FtpFileSystem extends AbstractFileSystem | |||
| class FtpFileSystem | |||
| extends AbstractFileSystem | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( FtpFileSystem.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( FtpFileSystem.class ); | |||
| private FTPClient m_client; | |||
| public FtpFileSystem( FileName rootName, | |||
| String hostname, | |||
| String username, | |||
| String password ) throws FileSystemException | |||
| public FtpFileSystem( final FileName rootName, | |||
| final String hostname, | |||
| final String username, | |||
| final String password ) | |||
| throws FileSystemException | |||
| { | |||
| super( rootName ); | |||
| try | |||
| @@ -95,7 +97,8 @@ class FtpFileSystem extends AbstractFileSystem | |||
| /** | |||
| * Creates a file object. | |||
| */ | |||
| protected FileObject createFile( FileName name ) throws FileSystemException | |||
| protected FileObject createFile( FileName name ) | |||
| throws FileSystemException | |||
| { | |||
| return new FtpFileObject( name, this ); | |||
| } | |||
| @@ -25,10 +25,12 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| final class LocalFile extends AbstractFileObject implements FileObject | |||
| final class LocalFile | |||
| extends AbstractFileObject | |||
| implements FileObject | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( LocalFile.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( LocalFile.class ); | |||
| private File m_file; | |||
| private String m_fileName; | |||
| @@ -36,16 +38,19 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Creates a non-root file. | |||
| */ | |||
| public LocalFile( LocalFileSystem fs, String fileName, FileName name ) | |||
| public LocalFile( final LocalFileSystem fileSystem, | |||
| final String fileName, | |||
| final FileName name ) | |||
| { | |||
| super( name, fs ); | |||
| super( name, fileSystem ); | |||
| m_fileName = fileName; | |||
| } | |||
| /** | |||
| * Attaches this file object to its file resource. | |||
| */ | |||
| protected void doAttach() throws Exception | |||
| protected void doAttach() | |||
| throws Exception | |||
| { | |||
| if( m_file == null ) | |||
| { | |||
| @@ -56,7 +61,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Returns the file's type. | |||
| */ | |||
| protected FileType doGetType() throws Exception | |||
| protected FileType doGetType() | |||
| throws Exception | |||
| { | |||
| if( !m_file.exists() ) | |||
| { | |||
| @@ -78,7 +84,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Returns the children of the file. | |||
| */ | |||
| protected String[] doListChildren() throws Exception | |||
| protected String[] doListChildren() | |||
| throws Exception | |||
| { | |||
| return m_file.list(); | |||
| } | |||
| @@ -86,7 +93,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Deletes this file, and all children. | |||
| */ | |||
| public void doDelete() throws Exception | |||
| public void doDelete() | |||
| throws Exception | |||
| { | |||
| if( !m_file.delete() ) | |||
| { | |||
| @@ -98,7 +106,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Creates this folder. | |||
| */ | |||
| protected void doCreateFolder() throws Exception | |||
| protected void doCreateFolder() | |||
| throws Exception | |||
| { | |||
| if( !m_file.mkdir() ) | |||
| { | |||
| @@ -110,7 +119,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Creates an input stream to read the content from. | |||
| */ | |||
| protected InputStream doGetInputStream() throws Exception | |||
| protected InputStream doGetInputStream() | |||
| throws Exception | |||
| { | |||
| return new FileInputStream( m_file ); | |||
| } | |||
| @@ -118,7 +128,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Creates an output stream to write the file content to. | |||
| */ | |||
| protected OutputStream doGetOutputStream() throws Exception | |||
| protected OutputStream doGetOutputStream() | |||
| throws Exception | |||
| { | |||
| return new FileOutputStream( m_file ); | |||
| } | |||
| @@ -126,7 +137,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||
| /** | |||
| * Returns the size of the file content (in bytes). | |||
| */ | |||
| protected long doGetContentSize() throws Exception | |||
| protected long doGetContentSize() | |||
| throws Exception | |||
| { | |||
| return m_file.length(); | |||
| } | |||
| @@ -19,10 +19,11 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| class LocalFileNameParser extends UriParser | |||
| class LocalFileNameParser | |||
| extends UriParser | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( LocalFileNameParser.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( LocalFileNameParser.class ); | |||
| private boolean m_windowsNames; | |||
| @@ -35,7 +36,7 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Determines if a name is an absolute file name. | |||
| */ | |||
| public boolean isAbsoluteName( String name ) | |||
| public boolean isAbsoluteName( final String name ) | |||
| { | |||
| // TODO - this is yucky | |||
| StringBuffer b = new StringBuffer( name ); | |||
| @@ -54,10 +55,10 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Parses an absolute URI, splitting it into its components. | |||
| * | |||
| * @param name | |||
| * The URI. | |||
| * @param uriStr The URI. | |||
| */ | |||
| public ParsedUri parseUri( String uriStr ) throws FileSystemException | |||
| public ParsedUri parseUri( final String uriStr ) | |||
| throws FileSystemException | |||
| { | |||
| StringBuffer name = new StringBuffer(); | |||
| ParsedFileUri uri = new ParsedFileUri(); | |||
| @@ -90,8 +91,8 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Pops the root prefix off a URI, which has had the scheme removed. | |||
| */ | |||
| private String extractRootPrefix( String uri, | |||
| StringBuffer name ) | |||
| private String extractRootPrefix( final String uri, | |||
| final StringBuffer name ) | |||
| throws FileSystemException | |||
| { | |||
| // TODO - split this into sub-classes | |||
| @@ -116,8 +117,8 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Extracts a Windows root prefix from a name. | |||
| */ | |||
| private String extractWindowsRootPrefix( String uri, | |||
| StringBuffer name ) | |||
| private String extractWindowsRootPrefix( final String uri, | |||
| final StringBuffer name ) | |||
| throws FileSystemException | |||
| { | |||
| // Looking for: | |||
| @@ -158,7 +159,8 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Extracts a drive prefix from a path. Leading '/' chars have been removed. | |||
| */ | |||
| private String extractDrivePrefix( StringBuffer name ) throws FileSystemException | |||
| private String extractDrivePrefix( final StringBuffer name ) | |||
| throws FileSystemException | |||
| { | |||
| // Looking for <letter> ':' '/' | |||
| if( name.length() < 3 ) | |||
| @@ -191,8 +193,9 @@ class LocalFileNameParser extends UriParser | |||
| /** | |||
| * Extracts a UNC name from a path. Leading '/' chars have been removed. | |||
| */ | |||
| private String extractUNCPrefix( String uri, | |||
| StringBuffer name ) throws FileSystemException | |||
| private String extractUNCPrefix( final String uri, | |||
| final StringBuffer name ) | |||
| throws FileSystemException | |||
| { | |||
| // Looking for <name> '/' <name> ( '/' | <end> ) | |||
| @@ -18,10 +18,11 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| public class SmbFileNameParser extends UriParser | |||
| public class SmbFileNameParser | |||
| extends UriParser | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( SmbFileNameParser.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( SmbFileNameParser.class ); | |||
| /** | |||
| * Parses an absolute URI, splitting it into its components. | |||
| @@ -25,17 +25,21 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| * | |||
| * @author Adam Murdoch | |||
| */ | |||
| public class SmbFileObject extends AbstractFileObject implements FileObject | |||
| public class SmbFileObject | |||
| extends AbstractFileObject | |||
| implements FileObject | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( SmbFileObject.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( SmbFileObject.class ); | |||
| private String m_fileName; | |||
| private SmbFile m_file; | |||
| protected SmbFileObject( String fileName, FileName name, SmbFileSystem fs ) | |||
| protected SmbFileObject( final String fileName, | |||
| final FileName name, | |||
| final SmbFileSystem fileSystem ) | |||
| { | |||
| super( name, fs ); | |||
| super( name, fileSystem ); | |||
| m_fileName = fileName; | |||
| } | |||
| @@ -28,8 +28,8 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||
| */ | |||
| public class ZipFileSystem extends AbstractFileSystem implements FileSystem | |||
| { | |||
| private static final Resources REZ | |||
| = ResourceManager.getPackageResources( ZipFileSystem.class ); | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( ZipFileSystem.class ); | |||
| private File m_file; | |||
| private ZipFile m_zipFile; | |||
| @@ -33,10 +33,10 @@ public class DefaultExtensionManager | |||
| extends DefaultPackageRepository | |||
| implements LogEnabled, Parameterizable, Initializable, Disposable, ExtensionManager | |||
| { | |||
| private static final Resources REZ = | |||
| private final static Resources REZ = | |||
| ResourceManager.getPackageResources( DefaultExtensionManager.class ); | |||
| private static final String TOOLS_JAR = File.separator + "lib" + File.separator + "tools.jar"; | |||
| private final static String TOOLS_JAR = File.separator + "lib" + File.separator + "tools.jar"; | |||
| private Logger m_logger; | |||