KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > source > impl > CommonsVFSSourceFactory


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

17 package org.apache.excalibur.source.impl;
18
19 import java.io.IOException JavaDoc;
20 import java.net.MalformedURLException JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import org.apache.avalon.framework.container.ContainerUtil;
24 import org.apache.avalon.framework.logger.AbstractLogEnabled;
25 import org.apache.avalon.framework.thread.ThreadSafe;
26 import org.apache.excalibur.source.Source;
27 import org.apache.excalibur.source.SourceFactory;
28
29 /**
30  * A factory for source types supported by
31  * <a HREF="http://jakarta.apache.org/commons/sandbox/vfs">Commons VFS</a>.
32  *
33  * @avalon.component
34  * @avalon.service type=SourceFactory
35  * @x-avalon.info name=commons-vfs-source
36  * @x-avalon.lifestyle type=singleton
37  *
38  * @author <a HREF="mailto:crafterm@apache.org">Marcus Crafter</a>
39  * @version $Id: $
40  */

41 public class CommonsVFSSourceFactory extends AbstractLogEnabled
42     implements SourceFactory, ThreadSafe
43 {
44     /**
45      * Returns a {@link CommonsVFSSource} instance primed with the specified location
46      *
47      * @param location source location
48      * @param parameters source parameters
49      * @throws IOException if an IO error occurs
50      * @throws MalformedURLException if a URL is malformed
51      * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
52      */

53     public Source getSource( String JavaDoc location, Map JavaDoc parameters ) throws IOException JavaDoc, MalformedURLException JavaDoc
54     {
55         final Source source = new CommonsVFSSource( location, parameters );
56         ContainerUtil.enableLogging(source, getLogger());
57         return source;
58     }
59
60     /**
61      * Releases the given source.
62      *
63      * @param source source to release
64      * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
65      */

66     public void release( Source source )
67     {
68         // Nothing to do here
69
}
70 }
71
Popular Tags