1 10 11 package org.mule.transformers.xml; 12 13 import com.thoughtworks.xstream.XStream; 14 import org.mule.config.i18n.Message; 15 import org.mule.transformers.AbstractEventAwareTransformer; 16 import org.mule.umo.transformer.TransformerException; 17 18 import java.util.List ; 19 import java.util.Map ; 20 21 25 26 public abstract class AbstractXStreamTransformer extends AbstractEventAwareTransformer 27 { 28 private String driverClassName = XStreamFactory.XSTREAM_XPP_DRIVER; 29 private XStream xstream; 30 private Map aliases; 31 private List converters; 32 33 public synchronized final XStream getXStream() throws TransformerException 34 { 35 if (xstream == null) 36 { 37 try 38 { 39 xstream = new XStreamFactory(driverClassName, aliases, converters).getInstance(); 40 } 41 catch (Exception e) 42 { 43 throw new TransformerException(Message.createStaticMessage("Unable to initialize XStream"), e); 44 } 45 } 46 47 return xstream; 48 } 49 50 public synchronized String getDriverClassName() 51 { 52 return driverClassName; 53 } 54 55 public synchronized void setDriverClassName(String driverClassName) 56 { 57 this.driverClassName = driverClassName; 58 } 59 60 public synchronized Map getAliases() 61 { 62 return aliases; 63 } 64 65 public synchronized void setAliases(Map aliases) 66 { 67 this.aliases = aliases; 68 } 69 70 public synchronized List getConverters() 71 { 72 return converters; 73 } 74 75 public synchronized void setConverters(List converters) 76 { 77 this.converters = converters; 78 } 79 80 protected boolean requiresCurrentEvent() 81 { 82 return false; 83 } 84 85 } 86 | Popular Tags |