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 | public class IfTask | ||||
| extends AbstractContainerTask | extends AbstractContainerTask | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( IfTask.class ); | ResourceManager.getPackageResources( IfTask.class ); | ||||
| private Condition m_condition; | private Condition m_condition; | ||||
| @@ -22,10 +22,13 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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; | private FtpFileSystem m_ftpFs; | ||||
| @@ -33,12 +36,11 @@ class FtpFileObject extends AbstractFileObject | |||||
| private FTPFile m_fileInfo; | private FTPFile m_fileInfo; | ||||
| private FTPFile[] m_children; | 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. | * 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 | // Get the parent folder to find the info for this file | ||||
| FtpFileObject parent = (FtpFileObject)getParent(); | 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 | * Determines the type of the file, returns null if the file does not | ||||
| * exist. | * exist. | ||||
| */ | */ | ||||
| protected FileType doGetType() throws Exception | |||||
| protected FileType doGetType() | |||||
| throws Exception | |||||
| { | { | ||||
| if( m_fileInfo == null ) | if( m_fileInfo == null ) | ||||
| { | { | ||||
| @@ -129,7 +133,8 @@ class FtpFileObject extends AbstractFileObject | |||||
| /** | /** | ||||
| * Lists the children of the file. | * Lists the children of the file. | ||||
| */ | */ | ||||
| protected String[] doListChildren() throws Exception | |||||
| protected String[] doListChildren() | |||||
| throws Exception | |||||
| { | { | ||||
| if( m_children == null ) | if( m_children == null ) | ||||
| { | { | ||||
| @@ -166,7 +171,8 @@ class FtpFileObject extends AbstractFileObject | |||||
| /** | /** | ||||
| * Creates this file as a folder. | * Creates this file as a folder. | ||||
| */ | */ | ||||
| protected void doCreateFolder() throws Exception | |||||
| protected void doCreateFolder() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_ftpFs.getClient().makeDirectory( getName().getPath() ) ) | if( !m_ftpFs.getClient().makeDirectory( getName().getPath() ) ) | ||||
| { | { | ||||
| @@ -194,7 +200,8 @@ class FtpFileObject extends AbstractFileObject | |||||
| /** | /** | ||||
| * Notification of the input stream being closed. | * Notification of the input stream being closed. | ||||
| */ | */ | ||||
| protected void doEndInput() throws Exception | |||||
| protected void doEndInput() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_ftpFs.getClient().completePendingCommand() ) | if( !m_ftpFs.getClient().completePendingCommand() ) | ||||
| { | { | ||||
| @@ -206,7 +213,8 @@ class FtpFileObject extends AbstractFileObject | |||||
| /** | /** | ||||
| * Creates an output stream to write the file content to. | * 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() ); | return m_ftpFs.getClient().storeFileStream( getName().getPath() ); | ||||
| } | } | ||||
| @@ -214,7 +222,8 @@ class FtpFileObject extends AbstractFileObject | |||||
| /** | /** | ||||
| * Notification of the output stream being closed. | * Notification of the output stream being closed. | ||||
| */ | */ | ||||
| protected void doEndOutput() throws Exception | |||||
| protected void doEndOutput() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_ftpFs.getClient().completePendingCommand() ) | if( !m_ftpFs.getClient().completePendingCommand() ) | ||||
| { | { | ||||
| @@ -23,17 +23,19 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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; | 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 ); | super( rootName ); | ||||
| try | try | ||||
| @@ -95,7 +97,8 @@ class FtpFileSystem extends AbstractFileSystem | |||||
| /** | /** | ||||
| * Creates a file object. | * Creates a file object. | ||||
| */ | */ | ||||
| protected FileObject createFile( FileName name ) throws FileSystemException | |||||
| protected FileObject createFile( FileName name ) | |||||
| throws FileSystemException | |||||
| { | { | ||||
| return new FtpFileObject( name, this ); | return new FtpFileObject( name, this ); | ||||
| } | } | ||||
| @@ -25,10 +25,12 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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 File m_file; | ||||
| private String m_fileName; | private String m_fileName; | ||||
| @@ -36,16 +38,19 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Creates a non-root file. | * 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; | m_fileName = fileName; | ||||
| } | } | ||||
| /** | /** | ||||
| * Attaches this file object to its file resource. | * Attaches this file object to its file resource. | ||||
| */ | */ | ||||
| protected void doAttach() throws Exception | |||||
| protected void doAttach() | |||||
| throws Exception | |||||
| { | { | ||||
| if( m_file == null ) | if( m_file == null ) | ||||
| { | { | ||||
| @@ -56,7 +61,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Returns the file's type. | * Returns the file's type. | ||||
| */ | */ | ||||
| protected FileType doGetType() throws Exception | |||||
| protected FileType doGetType() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_file.exists() ) | if( !m_file.exists() ) | ||||
| { | { | ||||
| @@ -78,7 +84,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Returns the children of the file. | * Returns the children of the file. | ||||
| */ | */ | ||||
| protected String[] doListChildren() throws Exception | |||||
| protected String[] doListChildren() | |||||
| throws Exception | |||||
| { | { | ||||
| return m_file.list(); | return m_file.list(); | ||||
| } | } | ||||
| @@ -86,7 +93,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Deletes this file, and all children. | * Deletes this file, and all children. | ||||
| */ | */ | ||||
| public void doDelete() throws Exception | |||||
| public void doDelete() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_file.delete() ) | if( !m_file.delete() ) | ||||
| { | { | ||||
| @@ -98,7 +106,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Creates this folder. | * Creates this folder. | ||||
| */ | */ | ||||
| protected void doCreateFolder() throws Exception | |||||
| protected void doCreateFolder() | |||||
| throws Exception | |||||
| { | { | ||||
| if( !m_file.mkdir() ) | if( !m_file.mkdir() ) | ||||
| { | { | ||||
| @@ -110,7 +119,8 @@ final class LocalFile extends AbstractFileObject implements FileObject | |||||
| /** | /** | ||||
| * Creates an input stream to read the content from. | * Creates an input stream to read the content from. | ||||
| */ | */ | ||||
| protected InputStream doGetInputStream() throws Exception | |||||
| protected InputStream doGetInputStream() | |||||
| throws Exception | |||||
| { | { | ||||
| return new FileInputStream( m_file ); | 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. | * 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 ); | 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). | * Returns the size of the file content (in bytes). | ||||
| */ | */ | ||||
| protected long doGetContentSize() throws Exception | |||||
| protected long doGetContentSize() | |||||
| throws Exception | |||||
| { | { | ||||
| return m_file.length(); | return m_file.length(); | ||||
| } | } | ||||
| @@ -19,10 +19,11 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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; | private boolean m_windowsNames; | ||||
| @@ -35,7 +36,7 @@ class LocalFileNameParser extends UriParser | |||||
| /** | /** | ||||
| * Determines if a name is an absolute file name. | * Determines if a name is an absolute file name. | ||||
| */ | */ | ||||
| public boolean isAbsoluteName( String name ) | |||||
| public boolean isAbsoluteName( final String name ) | |||||
| { | { | ||||
| // TODO - this is yucky | // TODO - this is yucky | ||||
| StringBuffer b = new StringBuffer( name ); | StringBuffer b = new StringBuffer( name ); | ||||
| @@ -54,10 +55,10 @@ class LocalFileNameParser extends UriParser | |||||
| /** | /** | ||||
| * Parses an absolute URI, splitting it into its components. | * 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(); | StringBuffer name = new StringBuffer(); | ||||
| ParsedFileUri uri = new ParsedFileUri(); | 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. | * 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 | throws FileSystemException | ||||
| { | { | ||||
| // TODO - split this into sub-classes | // TODO - split this into sub-classes | ||||
| @@ -116,8 +117,8 @@ class LocalFileNameParser extends UriParser | |||||
| /** | /** | ||||
| * Extracts a Windows root prefix from a name. | * 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 | throws FileSystemException | ||||
| { | { | ||||
| // Looking for: | // Looking for: | ||||
| @@ -158,7 +159,8 @@ class LocalFileNameParser extends UriParser | |||||
| /** | /** | ||||
| * Extracts a drive prefix from a path. Leading '/' chars have been removed. | * 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> ':' '/' | // Looking for <letter> ':' '/' | ||||
| if( name.length() < 3 ) | if( name.length() < 3 ) | ||||
| @@ -191,8 +193,9 @@ class LocalFileNameParser extends UriParser | |||||
| /** | /** | ||||
| * Extracts a UNC name from a path. Leading '/' chars have been removed. | * 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> ) | // Looking for <name> '/' <name> ( '/' | <end> ) | ||||
| @@ -18,10 +18,11 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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. | * Parses an absolute URI, splitting it into its components. | ||||
| @@ -25,17 +25,21 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| * | * | ||||
| * @author Adam Murdoch | * @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 String m_fileName; | ||||
| private SmbFile m_file; | 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; | m_fileName = fileName; | ||||
| } | } | ||||
| @@ -28,8 +28,8 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| */ | */ | ||||
| public class ZipFileSystem extends AbstractFileSystem implements FileSystem | 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 File m_file; | ||||
| private ZipFile m_zipFile; | private ZipFile m_zipFile; | ||||
| @@ -33,10 +33,10 @@ public class DefaultExtensionManager | |||||
| extends DefaultPackageRepository | extends DefaultPackageRepository | ||||
| implements LogEnabled, Parameterizable, Initializable, Disposable, ExtensionManager | implements LogEnabled, Parameterizable, Initializable, Disposable, ExtensionManager | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultExtensionManager.class ); | 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; | private Logger m_logger; | ||||