KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > source > impl > BlobSourceFactory


1 /*
2  * Copyright 1999-2004 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.cocoon.components.source.impl;
17
18 import org.apache.avalon.framework.logger.AbstractLogEnabled;
19 import org.apache.avalon.framework.service.ServiceException;
20 import org.apache.avalon.framework.service.ServiceManager;
21 import org.apache.avalon.framework.service.Serviceable;
22 import org.apache.avalon.framework.thread.ThreadSafe;
23
24 import org.apache.excalibur.source.Source;
25 import org.apache.excalibur.source.SourceException;
26 import org.apache.excalibur.source.SourceFactory;
27
28 import java.io.IOException JavaDoc;
29 import java.net.MalformedURLException JavaDoc;
30 import java.util.Map JavaDoc;
31
32 /**
33  * A factory for 'blob:' sources.
34  *
35  * @author <a HREF="mailto:sylvain@apache.org">Sylvain Wallez</a>
36  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels</a>
37  * @version CVS $Id: BlobSourceFactory.java 30932 2004-07-29 17:35:38Z vgritsenko $
38  */

39 public class BlobSourceFactory
40   extends AbstractLogEnabled
41   implements Serviceable, SourceFactory, ThreadSafe {
42     
43     /** The ServiceManager instance */
44     protected ServiceManager manager;
45
46     /**
47      * Get a <code>Source</code> object.
48      * @param parameters This is optional.
49      */

50     public Source getSource(String JavaDoc location, Map JavaDoc parameters)
51         throws MalformedURLException JavaDoc, IOException JavaDoc, SourceException {
52         BlobSource blob = new BlobSource(location);
53         this.setupLogger(blob);
54         blob.service(this.manager);
55         return blob;
56     }
57
58     /**
59      * Release a {@link Source} object.
60      */

61     public void release( Source source ) {
62         // Nothing to do
63
}
64     
65     /**
66      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
67      */

68     public void service(ServiceManager manager) throws ServiceException {
69         this.manager = manager;
70     }
71
72 }
73     
74
Popular Tags