1 31 package org.objectweb.proactive.core.config.xml; 32 33 import java.io.IOException ; 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 import org.xml.sax.SAXException ; 40 41 public class MasterFileHandler extends AbstractUnmarshallerDecorator 42 implements MasterFileConstants { 43 44 48 protected static ProActiveConfiguration config; 49 50 public MasterFileHandler() { 51 addHandler(PROPERTIES_TAG, new PropertiesHandler(MasterFileHandler.config)); 52 } 54 55 59 public static void createMasterFileHandler(String filename, 60 ProActiveConfiguration config) { 61 MasterFileHandler.config = config; 62 InitialHandler h = new InitialHandler(); 63 org.objectweb.proactive.core.xml.io.StreamReader sr; 64 try { 65 sr = new org.objectweb.proactive.core.xml.io.StreamReader(new org.xml.sax.InputSource ( 66 filename), h); 67 sr.read(); 68 } catch (IOException e) { 69 e.printStackTrace(); 70 } 71 } 72 73 protected void notifyEndActiveHandler(String name, 74 UnmarshallerHandler activeHandler) throws SAXException { 75 } 77 78 public Object getResultObject() throws SAXException { 79 return null; 81 } 82 83 public void startContextElement(String name, Attributes attributes) 84 throws SAXException { 85 } 86 87 private static class InitialHandler extends AbstractUnmarshallerDecorator { 91 private MasterFileHandler masterFileHandler; 92 93 private InitialHandler() { 95 super(); 96 masterFileHandler = new MasterFileHandler(); 97 this.addHandler(MASTER_TAG, masterFileHandler); 99 } 100 101 public Object getResultObject() throws org.xml.sax.SAXException { 102 return null; } 105 106 public void startContextElement(String name, Attributes attributes) 107 throws org.xml.sax.SAXException { 108 } 109 110 protected void notifyEndActiveHandler(String name, 111 UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException { 112 } 113 } 114 115 } 147 | Popular Tags |