1 31 package org.objectweb.proactive.core.config.xml; 32 33 import java.util.Properties ; 34 35 import org.objectweb.proactive.core.config.ProActiveConfiguration; 36 import org.objectweb.proactive.core.xml.handler.AbstractUnmarshallerDecorator; 37 import org.objectweb.proactive.core.xml.handler.UnmarshallerHandler; 38 import org.objectweb.proactive.core.xml.io.Attributes; 39 40 41 45 public class PropertiesHandler extends AbstractUnmarshallerDecorator 46 implements MasterFileConstants { 47 private Properties properties = null; 49 50 public PropertiesHandler(ProActiveConfiguration config) { 51 super(); 52 properties = new Properties (); 53 addHandler(PROP_TAG, new PropHandler(properties, config)); 54 } 55 56 public Object getResultObject() throws org.xml.sax.SAXException { 57 return properties; 58 } 59 60 public void startContextElement(String name, Attributes attributes) 61 throws org.xml.sax.SAXException { 62 } 63 64 protected void notifyEndActiveHandler(String name, 65 UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException { 66 } 67 68 private static class PropHandler extends AbstractUnmarshallerDecorator { 70 private Properties properties = null; 71 private ProActiveConfiguration config; 72 73 PropHandler(Properties properties, ProActiveConfiguration config) { 74 super(); 75 this.properties = properties; 76 this.config = config; 77 } 78 79 public Object getResultObject() throws org.xml.sax.SAXException { 80 return properties; 81 } 82 83 public void startContextElement(String name, Attributes attributes) 84 throws org.xml.sax.SAXException { 85 String key = attributes.getValue("key"); 87 String value = attributes.getValue("value"); 88 PropertiesHandler.logger.debug("Key " + key + " value " + value); 89 90 config.propertyFound(key, value); 96 } 97 98 protected void notifyEndActiveHandler(String name, 99 UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException { 100 } 101 } 102 } 103 | Popular Tags |