1 16 package org.apache.cocoon.components.source.impl; 17 18 import java.io.IOException ; 19 import java.net.MalformedURLException ; 20 import java.util.Map ; 21 22 import org.apache.avalon.framework.component.ComponentManager; 23 import org.apache.avalon.framework.component.Composable; 24 import org.apache.avalon.framework.logger.AbstractLogEnabled; 25 import org.apache.avalon.framework.thread.ThreadSafe; 26 27 import org.apache.excalibur.source.Source; 28 import org.apache.excalibur.source.SourceFactory; 29 import org.apache.excalibur.source.URIAbsolutizer; 30 import org.apache.excalibur.source.SourceUtil; 31 32 40 public final class SitemapSourceFactory 41 extends AbstractLogEnabled 42 implements SourceFactory, ThreadSafe, Composable, URIAbsolutizer 43 { 44 45 private ComponentManager manager; 46 47 50 public void compose(ComponentManager manager) { 51 this.manager = manager; 52 } 53 54 58 public Source getSource( String location, Map parameters ) 59 throws MalformedURLException , IOException { 60 if( getLogger().isDebugEnabled() ) { 61 getLogger().debug( "Creating source object for " + location ); 62 } 63 64 return new SitemapSource( this.manager, 65 location, 66 parameters, 67 getLogger()); 68 } 69 70 73 public void release( Source source ) { 74 if ( null != source ) { 75 if ( this.getLogger().isDebugEnabled() ) { 76 this.getLogger().debug("Releasing source " + source.getURI()); 77 } 78 ((SitemapSource)source).recycle(); 79 } 80 } 81 82 public String absolutize(String baseURI, String location) { 83 return SourceUtil.absolutize(baseURI, location, true); 84 } 85 86 } 87 | Popular Tags |