00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.core.config.xml;
00032
00033 import java.util.Properties;
00034
00035 import org.objectweb.proactive.core.config.ProActiveConfiguration;
00036 import org.objectweb.proactive.core.xml.handler.AbstractUnmarshallerDecorator;
00037 import org.objectweb.proactive.core.xml.handler.UnmarshallerHandler;
00038 import org.objectweb.proactive.core.xml.io.Attributes;
00039
00040
00045 public class PropertiesHandler extends AbstractUnmarshallerDecorator
00046 implements MasterFileConstants {
00047
00048 private Properties properties = null;
00049
00050 public PropertiesHandler(ProActiveConfiguration config) {
00051 super();
00052 properties = new Properties();
00053 addHandler(PROP_TAG, new PropHandler(properties, config));
00054 }
00055
00056 public Object getResultObject() throws org.xml.sax.SAXException {
00057 return properties;
00058 }
00059
00060 public void startContextElement(String name, Attributes attributes)
00061 throws org.xml.sax.SAXException {
00062 }
00063
00064 protected void notifyEndActiveHandler(String name,
00065 UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException {
00066 }
00067
00068
00069 private static class PropHandler extends AbstractUnmarshallerDecorator {
00070 private Properties properties = null;
00071 private ProActiveConfiguration config;
00072
00073 PropHandler(Properties properties, ProActiveConfiguration config) {
00074 super();
00075 this.properties = properties;
00076 this.config = config;
00077 }
00078
00079 public Object getResultObject() throws org.xml.sax.SAXException {
00080 return properties;
00081 }
00082
00083 public void startContextElement(String name, Attributes attributes)
00084 throws org.xml.sax.SAXException {
00085
00086 String key = attributes.getValue("key");
00087 String value = attributes.getValue("value");
00088
00089
00090
00091
00092
00093
00094
00095 config.propertyFound(key, value);
00096 }
00097
00098 protected void notifyEndActiveHandler(String name,
00099 UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException {
00100 }
00101 }
00102 }