1 16 package org.apache.cocoon.serialization; 17 18 import org.apache.avalon.framework.activity.Initializable; 19 import org.apache.avalon.framework.configuration.Configurable; 20 import org.apache.avalon.framework.configuration.Configuration; 21 import org.apache.avalon.framework.configuration.ConfigurationException; 22 23 import org.apache.cocoon.components.elementprocessor.ElementProcessorFactory; 24 import org.apache.cocoon.components.elementprocessor.impl.poi.hssf.HSSFElementProcessorFactory; 25 26 33 public class HSSFSerializer extends POIFSSerializer 34 implements Initializable, Configurable { 35 36 private ElementProcessorFactory _element_processor_factory; 37 private final static String _mime_type = "application/vnd.ms-excel"; 38 String locale; 39 40 43 public HSSFSerializer() { 44 super(); 45 } 46 47 53 public void initialize() throws Exception { 54 _element_processor_factory = new HSSFElementProcessorFactory(locale); 55 setupLogger(_element_processor_factory); 56 } 57 58 public void configure(Configuration conf) throws ConfigurationException { 59 Configuration[] parameters = conf.getChildren("parameter"); 60 for (int i = 0; i < parameters.length; i++) { 61 String name = parameters[i].getAttribute("name"); 62 if (name.trim().equals("locale")) { 63 locale = parameters[i].getAttribute("value"); 64 } 65 } 66 } 67 68 73 public String getMimeType() { 74 return _mime_type; 75 } 76 77 82 protected ElementProcessorFactory getElementProcessorFactory() { 83 return _element_processor_factory; 84 } 85 86 89 protected void doLocalPostEndDocument() { 90 } 91 92 95 protected void doLocalPreEndDocument() { 96 } 97 } 98 | Popular Tags |