imario 2004/06/23 11:17:44 Modified: vfs/src/java/org/apache/commons/vfs/provider AbstractFileObject.java vfs/src/test/org/apache/commons/vfs/test AbstractTestSuite.java vfs/src/java/org/apache/commons/vfs/impl DefaultFileSystemManager.java vfs/src/java/org/apache/commons/vfs FileSystemManager.java Resources.properties vfs/src/java/org/apache/commons/vfs/provider/http HttpFileObject.java Removed: vfs/src/java/org/apache/commons/vfs GlobalConfiguration.java Log: For clarification, remove GlobalConfiguration and reworked it into DefaultFileSystemManager Revision Changes Path 1.47 +3 -5 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java Index: AbstractFileObject.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- AbstractFileObject.java 17 Jun 2004 19:29:28 -0000 1.46 +++ AbstractFileObject.java 23 Jun 2004 18:17:44 -0000 1.47 @@ -25,7 +25,6 @@ import org.apache.commons.vfs.FileSystemException; import org.apache.commons.vfs.FileType; import org.apache.commons.vfs.FileUtil; -import org.apache.commons.vfs.GlobalConfiguration; import org.apache.commons.vfs.NameScope; import org.apache.commons.vfs.RandomAccessContent; import org.apache.commons.vfs.Selectors; @@ -904,7 +903,7 @@ attach(); if (content == null) { - content = new DefaultFileContent(this, createFileContentInfoFactory()); + content = new DefaultFileContent(this, getFileContentInfoFactory()); } return content; } @@ -1351,10 +1350,9 @@ /** * create the filecontentinfo implementation */ - protected FileContentInfoFactory createFileContentInfoFactory() + protected FileContentInfoFactory getFileContentInfoFactory() { - GlobalConfiguration gc = getFileSystem().getFileSystemManager().getGlobalConfiguration(); - return gc.getFileContentInfoFactory(); + return getFileSystem().getFileSystemManager().getFileContentInfoFactory(); } protected void injectType(FileType fileType) 1.3 +2 -6 jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractTestSuite.java Index: AbstractTestSuite.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractTestSuite.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractTestSuite.java 17 May 2004 17:56:57 -0000 1.2 +++ AbstractTestSuite.java 23 Jun 2004 18:17:44 -0000 1.3 @@ -21,7 +21,6 @@ import org.apache.commons.AbstractVfsTestCase; import org.apache.commons.vfs.FileName; import org.apache.commons.vfs.FileObject; -import org.apache.commons.vfs.GlobalConfiguration; import org.apache.commons.vfs.impl.DefaultFileReplicator; import org.apache.commons.vfs.impl.DefaultFileSystemManager; import org.apache.commons.vfs.impl.PrivilegedFileReplicator; @@ -128,11 +127,8 @@ checkTempDir("Temp dir not empty before test"); // Create the file system manager - GlobalConfiguration config = new GlobalConfiguration(); - config.setFilesCache(providerConfig.getFilesCache()); - manager = new DefaultFileSystemManager(); - manager.setGlobalConfiguration(config); + manager.setFilesCache(providerConfig.getFilesCache()); final DefaultFileReplicator replicator = new DefaultFileReplicator(tempDir); manager.setReplicator(new PrivilegedFileReplicator(replicator)); 1.31 +42 -21 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java Index: DefaultFileSystemManager.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- DefaultFileSystemManager.java 19 May 2004 19:34:06 -0000 1.30 +++ DefaultFileSystemManager.java 23 Jun 2004 18:17:44 -0000 1.31 @@ -16,13 +16,14 @@ package org.apache.commons.vfs.impl; import org.apache.commons.logging.Log; +import org.apache.commons.vfs.FileContentInfoFactory; import org.apache.commons.vfs.FileObject; import org.apache.commons.vfs.FileSystemException; import org.apache.commons.vfs.FileSystemManager; import org.apache.commons.vfs.FileSystemOptions; import org.apache.commons.vfs.FilesCache; -import org.apache.commons.vfs.GlobalConfiguration; import org.apache.commons.vfs.SystemInfo; +import org.apache.commons.vfs.cache.DefaultFilesCache; import org.apache.commons.vfs.provider.DefaultURLStreamHandler; import org.apache.commons.vfs.provider.FileProvider; import org.apache.commons.vfs.provider.FileReplicator; @@ -80,6 +81,16 @@ private FileObject baseFile; /** + * The files cache + */ + private FilesCache filesCache; + + /** + * The class to use to determine the content-type (mime-type) + */ + private FileContentInfoFactory fileContentInfoFactory; + + /** * The logger to use. */ private Log log; @@ -116,8 +127,6 @@ private final VirtualFileProvider vfsProvider = new VirtualFileProvider(); private boolean init; - private GlobalConfiguration globalConfiguration = null; - /** * Returns the logger used by this manager. */ @@ -220,36 +229,45 @@ } /** - * Sets the filesCache implementation used to cache files.<br> - * - * @see org.apache.commons.vfs.FilesCache + * Returns the filesCache implementation used to cache files */ - public void setGlobalConfiguration(GlobalConfiguration globalConfiguration) throws FileSystemException + public FilesCache getFilesCache() { - if (this.globalConfiguration != null) + return filesCache; + } + + /** + * Sets the filesCache implementation used to cache files + */ + public void setFilesCache(FilesCache filesCache) throws FileSystemException + { + if (init) { - throw new FileSystemException("vfs.impl/configuration-already-set.error"); + throw new FileSystemException("vfs.impl/already-inited.error"); } - this.globalConfiguration = globalConfiguration; - setupComponent(this.globalConfiguration); + this.filesCache = filesCache; } - /** - * returns the global configuration + * get the fileContentInfoFactory used to determine the infos of a file content. */ - public GlobalConfiguration getGlobalConfiguration() + public FileContentInfoFactory getFileContentInfoFactory() { - return globalConfiguration; + return fileContentInfoFactory; } /** - * Returns the filesCache implementation used to cache files + * set the fileContentInfoFactory used to determine the infos of a file content. */ - public FilesCache getFilesCache() + public void setFileContentInfoFactory(FileContentInfoFactory fileContentInfoFactory) throws FileSystemException { - return this.globalConfiguration.getFilesCache(); + if (init) + { + throw new FileSystemException("vfs.impl/already-inited.error"); + } + + this.fileContentInfoFactory = fileContentInfoFactory; } /** @@ -352,11 +370,14 @@ */ public void init() throws FileSystemException { - if (globalConfiguration == null) + if (filesCache == null) + { + filesCache = new DefaultFilesCache(); + } + if (fileContentInfoFactory == null) { - setGlobalConfiguration(new GlobalConfiguration()); + fileContentInfoFactory = new FileContentInfoFilenameFactory(); } - globalConfiguration.init(); setupComponent(vfsProvider); 1.20 +6 -4 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileSystemManager.java Index: FileSystemManager.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileSystemManager.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- FileSystemManager.java 21 May 2004 20:43:29 -0000 1.19 +++ FileSystemManager.java 23 Jun 2004 18:17:44 -0000 1.20 @@ -196,12 +196,14 @@ FilesCache getFilesCache(); /** - * Get the global configuration + * Gets the system info. e.g. Available schemes, provider configuration builder, ... */ - GlobalConfiguration getGlobalConfiguration(); + SystemInfo getSystemInfo(); /** - * Gets the system info. e.g. Available schemes, provider configuration builder, ... + * The class to use to determine the content-type (mime-type) + * + * @return */ - SystemInfo getSystemInfo(); + FileContentInfoFactory getFileContentInfoFactory(); } 1.38 +1 -0 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties Index: Resources.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- Resources.properties 17 Jun 2004 19:29:28 -0000 1.37 +++ Resources.properties 23 Jun 2004 18:17:44 -0000 1.38 @@ -108,6 +108,7 @@ vfs.impl/replicate-file.error=Could not replicate "{0}". vfs.impl/delete-temp.warn=Could not clean up temporary file "{0}". vfs.impl/init-replicator.error=Could not initialise file replicator. +vfs.impl/already-inited.error=Manager already inited, cant change the configuration now. # StandardFileSystemManager vfs.impl/find-config-file.error=Could not find VFS configuration resource "{0}". 1.9 +2 -2 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/http/HttpFileObject.java Index: HttpFileObject.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/http/HttpFileObject.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- HttpFileObject.java 17 Jun 2004 19:29:29 -0000 1.8 +++ HttpFileObject.java 23 Jun 2004 18:17:44 -0000 1.9 @@ -195,7 +195,7 @@ } - protected FileContentInfoFactory createFileContentInfoFactory() + protected FileContentInfoFactory getFileContentInfoFactory() { return new HttpFileContentInfoFactory(); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]