1 16 package org.apache.cocoon.components.source; 17 18 import org.apache.avalon.framework.component.ComponentManager; 19 import org.apache.avalon.framework.logger.AbstractLogEnabled; 20 import org.apache.cocoon.ProcessingException; 21 import org.apache.cocoon.environment.Environment; 22 import org.apache.cocoon.environment.Source; 23 import org.apache.cocoon.Processor; 24 25 import java.io.IOException ; 26 import java.net.MalformedURLException ; 27 import java.net.URL ; 28 29 37 public final class CocoonSourceFactory 38 extends AbstractLogEnabled 39 implements SourceFactory { 40 41 42 private ComponentManager manager; 43 44 public CocoonSourceFactory(Processor processor, 45 ComponentManager manager) { 46 this.manager = manager; 47 } 48 49 52 public Source getSource(Environment environment, String location) 53 throws ProcessingException, IOException , MalformedURLException { 54 if (environment == null) 55 throw new ProcessingException("CocoonSourceFactory: environment is required."); 56 return new SitemapSource(this.manager, 57 location, 58 this.getLogger()); 59 } 60 61 64 public Source getSource(Environment environment, URL base, String location) 65 throws ProcessingException, IOException , MalformedURLException { 66 if (environment == null) 67 throw new ProcessingException("CocoonSourceFactory: environment is required."); 68 return this.getSource(environment, base.toExternalForm() + location); 69 } 70 } 71 | Popular Tags |