KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > AbstractVfsComponent


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.provider;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.vfs.FileSystemException;
20
21 /**
22  * A partial {@link VfsComponent} implementation.
23  *
24  * @author <a HREF="mailto:adammurdoch@apache.org">Adam Murdoch</a>
25  */

26 public abstract class AbstractVfsComponent
27     implements VfsComponent
28 {
29     private VfsComponentContext context;
30     private Log log;
31
32     /**
33      * Sets the Logger to use for the component.
34      */

35     public final void setLogger(final Log log)
36     {
37         this.log = log;
38     }
39
40     /**
41      * Sets the context for this file system provider.
42      */

43     public final void setContext(final VfsComponentContext context)
44     {
45         this.context = context;
46     }
47
48     /**
49      * Initialises the component. This implementation does nothing.
50      */

51     public void init() throws FileSystemException
52     {
53     }
54
55     /**
56      * Closes the provider. This implementation does nothing.
57      */

58     public void close()
59     {
60     }
61
62     /**
63      * Returns the logger for this file system to use.
64      */

65     protected final Log getLogger()
66     {
67         return log;
68     }
69
70     /**
71      * Returns the context for this provider.
72      */

73     protected final VfsComponentContext getContext()
74     {
75         return context;
76     }
77 }
78
Popular Tags