1 10 11 package org.mule.providers.gs.transformers; 12 13 import net.jini.core.entry.Entry; 14 15 import org.mule.providers.gs.GigaSpacesEntryConverter; 16 import org.mule.transformers.AbstractEventAwareTransformer; 17 import org.mule.umo.UMOEventContext; 18 import org.mule.umo.UMOMessage; 19 import org.mule.umo.transformer.TransformerException; 20 21 public class UMOMessageToGigaSpacesEntry extends AbstractEventAwareTransformer 22 { 23 26 private static final long serialVersionUID = -3378344993441495689L; 27 28 private final GigaSpacesEntryConverter converter = new GigaSpacesEntryConverter(); 29 30 public UMOMessageToGigaSpacesEntry() 31 { 32 setReturnClass(Entry.class); 33 } 34 35 public Object transform(Object src, String encoding, UMOEventContext context) throws TransformerException 36 { 37 Object result = null; 38 UMOMessage msg = context.getMessage(); 39 if (Object [].class.isAssignableFrom(src.getClass())) 40 { 41 Object [] srcArr = (Object [])src; 42 Object [] resultArr = new Object [srcArr.length]; 43 44 for (int i = 0; i < srcArr.length; ++i) 45 { 46 resultArr[i] = converter.toEntry(srcArr[i], msg); 47 } 48 result = resultArr; 49 } 50 else 51 { 52 result = converter.toEntry(src, msg); 53 } 54 return result; 55 } 56 57 protected Object checkReturnClass(Object object) throws TransformerException 58 { 59 return object; 70 } 71 72 } 73 | Popular Tags |