adammurdoch 2002/11/16 19:37:12
Modified: vfs/src/java/org/apache/commons/vfs/impl
DefaultFileSystemManager.java
PrivilegedFileReplicator.java
vfs/src/java/org/apache/commons/vfs/provider
AbstractVfsComponent.java
DefaultURLStreamHandler.java VfsComponent.java
Added: vfs/src/java/org/apache/commons/vfs/impl
DefaultVfsComponentContext.java
vfs/src/java/org/apache/commons/vfs/provider
VfsComponentContext.java
Removed: vfs/src/java/org/apache/commons/vfs/impl
DefaultProviderContext.java
vfs/src/java/org/apache/commons/vfs/provider
FileSystemProviderContext.java
Log:
- Renamed FileSystemProviderContext to VfsComponentContext.
- DefaultFileSystemManager uses LogFactory to find a logger if none specified.
Revision Changes Path
1.16 +8 -4
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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DefaultFileSystemManager.java 1 Nov 2002 03:29:31 -0000 1.15
+++ DefaultFileSystemManager.java 17 Nov 2002 03:37:11 -0000 1.16
@@ -80,7 +80,7 @@
* <ul>
* <li>Create an instance of this class.
* <li>Call {@link #setLogger} to set the logger that the manager, and its
- * components, should use.
+ * components, should use (optional).
* <li>Add one or more file providers using {@link #addProvider}.
* <li>Set the default provider using {@link #setDefaultProvider} (optional).
* <li>Set the file replicator using {@link #setReplicator} (optional).
@@ -122,8 +122,8 @@
private Log log = LogFactory.getLog( DefaultFileSystemManager.class );
/** The context to pass to providers. */
- private final DefaultProviderContext context =
- new DefaultProviderContext( this );
+ private final DefaultVfsComponentContext context =
+ new DefaultVfsComponentContext( this );
private TemporaryFileStore tempFileStore;
@@ -135,6 +135,10 @@
*/
protected Log getLog()
{
+ if ( log == null )
+ {
+ log = LogFactory.getLog( this.getClass() );
+ }
return log;
}
@@ -244,7 +248,7 @@
if ( component instanceof VfsComponent )
{
final VfsComponent vfsComponent = (VfsComponent)component;
- vfsComponent.setLogger( log );
+ vfsComponent.setLogger( getLog() );
vfsComponent.setContext( context );
vfsComponent.init();
}
1.7 +3 -3
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java
Index: PrivilegedFileReplicator.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PrivilegedFileReplicator.java 23 Oct 2002 11:59:40 -0000 1.6
+++ PrivilegedFileReplicator.java 17 Nov 2002 03:37:11 -0000 1.7
@@ -64,7 +64,7 @@
import org.apache.commons.vfs.FileSelector;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.provider.FileReplicator;
-import org.apache.commons.vfs.provider.FileSystemProviderContext;
+import org.apache.commons.vfs.provider.VfsComponentContext;
import org.apache.commons.vfs.provider.VfsComponent;
import org.apache.commons.logging.Log;
@@ -108,7 +108,7 @@
/**
* Sets the context for the replicator.
*/
- public void setContext( final FileSystemProviderContext context )
+ public void setContext( final VfsComponentContext context )
{
if ( replicatorComponent != null )
{
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/DefaultVfsComponentContext.java
Index: DefaultVfsComponentContext.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* 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.
*
* 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:
* "This product includes software developed by the
* 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", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 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.
* ====================================================================
*
* 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
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.impl;
import java.io.File;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.provider.FileReplicator;
import org.apache.commons.vfs.provider.VfsComponentContext;
import org.apache.commons.vfs.provider.TemporaryFileStore;
/**
* The default context implementation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/11/17 03:37:11 $
*/
final class DefaultVfsComponentContext
implements VfsComponentContext
{
private final DefaultFileSystemManager manager;
public DefaultVfsComponentContext( final DefaultFileSystemManager manager )
{
this.manager = manager;
}
/**
* Locate a file by name.
*/
public FileObject resolveFile( final FileObject baseFile, final String name )
throws FileSystemException
{
return manager.resolveFile( baseFile, name );
}
/**
* Locate a file by name.
*/
public FileObject resolveFile( final String name )
throws FileSystemException
{
return manager.resolveFile( name );
}
/**
* Returns a {@link FileObject} for a local file.
*/
public FileObject toFileObject( File file )
throws FileSystemException
{
return manager.toFileObject( file );
}
/**
* Locates a file replicator for the provider to use.
*/
public FileReplicator getReplicator() throws FileSystemException
{
return manager.getReplicator();
}
/**
* Locates a temporary file store for the provider to use.
*/
public TemporaryFileStore getTemporaryFileStore() throws FileSystemException
{
return manager.getTemporaryFileStore();
}
}
1.3 +4 -4
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractVfsComponent.java
Index: AbstractVfsComponent.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractVfsComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractVfsComponent.java 23 Oct 2002 11:59:40 -0000 1.2
+++ AbstractVfsComponent.java 17 Nov 2002 03:37:11 -0000 1.3
@@ -67,7 +67,7 @@
public abstract class AbstractVfsComponent
implements VfsComponent
{
- private FileSystemProviderContext context;
+ private VfsComponentContext context;
private Log log;
/**
@@ -81,7 +81,7 @@
/**
* Sets the context for this file system provider.
*/
- public final void setContext( final FileSystemProviderContext context )
+ public final void setContext( final VfsComponentContext context )
{
this.context = context;
}
@@ -111,7 +111,7 @@
/**
* Returns the context for this provider.
*/
- protected final FileSystemProviderContext getContext()
+ protected final VfsComponentContext getContext()
{
return context;
}
1.6 +2 -2
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLStreamHandler.java
Index: DefaultURLStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLStreamHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultURLStreamHandler.java 1 Nov 2002 03:29:53 -0000 1.5
+++ DefaultURLStreamHandler.java 17 Nov 2002 03:37:11 -0000 1.6
@@ -71,9 +71,9 @@
public class DefaultURLStreamHandler
extends URLStreamHandler
{
- private final FileSystemProviderContext context;
+ private final VfsComponentContext context;
- public DefaultURLStreamHandler( final FileSystemProviderContext context )
+ public DefaultURLStreamHandler( final VfsComponentContext context )
{
this.context = context;
}
1.5 +2 -2
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/VfsComponent.java
Index: VfsComponent.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/VfsComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VfsComponent.java 28 Oct 2002 02:05:06 -0000 1.4
+++ VfsComponent.java 17 Nov 2002 03:37:11 -0000 1.5
@@ -85,7 +85,7 @@
*
* @param context The context.
*/
- void setContext( FileSystemProviderContext context );
+ void setContext( VfsComponentContext context );
/**
* Initialises the component.
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/VfsComponentContext.java
Index: VfsComponentContext.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* 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.
*
* 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:
* "This product includes software developed by the
* 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", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 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.
* ====================================================================
*
* 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
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider;
import java.io.File;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
/**
* Allows VFS components to access the services they need, such as the file
* replicator. A VFS component is supplied with a context as part of its
* initialisation.
*
* @see VfsComponent#setContext
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/11/17 03:37:11 $
*/
public interface VfsComponentContext
{
/**
* Locate a file by name. See
* {@link FileSystemManager#resolveFile(FileObject, String)} for a
* description of how this works.
*/
FileObject resolveFile( FileObject baseFile, String name )
throws FileSystemException;
/**
* Locate a file by name. See
* {@link FileSystemManager#resolveFile( String)} for a
* description of how this works.
*/
FileObject resolveFile( String name )
throws FileSystemException;
/**
* Locates a file replicator for the provider to use.
*/
FileReplicator getReplicator() throws FileSystemException;
/**
* Locates a temporary file store for the provider to use.
*/
TemporaryFileStore getTemporaryFileStore() throws FileSystemException;
/**
* Returns a {@link FileObject} for a local file.
*/
FileObject toFileObject( File file )
throws FileSystemException;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>