View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

IButtonMapper.java (stage 3)

   0: import edu.gatech.cc.realjin.umiddle.mapper.DeviceMappingPolicy;
   1: import edu.gatech.cc.realjin.umiddle.mapper.Mapper;
   2: import edu.gatech.cc.realjin.umiddle.mapper.MapperException;
   3: import java.util.HashMap;
   4: import java.util.Map;
   5: import org.w3c.dom.Node;
   6: 
   7: public class IButtonMapper extends Mapper{
   8:     private Map policies = new HashMap();
   9:
  10:     public IButtonMapper() {
  11:     }
  12: 
  13:     protected void init() {
  14:     }
  15:     
  16:     protected void stop() {
  17:     }
  18: 
  19:     public int map(DeviceMappingPolicy policy) throws MapperException {
  20:         String idOrType = parseIButton(policy.getPolicy());
  21:         policies.add(idOrType, policy);
  22:         return POSTPONED; // meaning that the translator instantiation will be done in the future.
  23:     }
  24: 
  25:     protected String getNamespaceURI() {
  26:         return "//edu.gatech.cc.umiddle.ibutton";
  27:     }
  28:
  29:     private String parseIButton(Node node){
  30:         return <id or type contained in the node>; //use your favarite XML parser
  31:     }
  32: }


Link to this Page