1 57 58 package org.apache.soap.server ; 59 60 import java.util.* ; 61 import java.io.* ; 62 import javax.servlet.* ; 63 import javax.servlet.http.* ; 64 import org.apache.soap.* ; 65 import org.apache.soap.rpc.* ; 66 import org.apache.soap.server.* ; 67 import org.apache.soap.server.http.* ; 68 import org.apache.soap.util.* ; 69 70 96 public class DefaultConfigManager extends BaseConfigManager 97 implements ConfigManager { 98 99 100 protected String filename = "DeployedServices.ds"; 101 102 103 107 public void setOptions( Hashtable options ) { 108 if ( options == null ) return ; 109 110 String value = (String ) options.get( "filename" ); 111 if ( value != null && !"".equals(value) ) 112 filename = value ; 113 } 114 115 119 public void loadRegistry() throws SOAPException { 120 dds = null ; 122 try { 123 File file = ServerHTTPUtils.getFileFromNameAndContext(filename, 124 context); 125 FileInputStream fis = new FileInputStream (file); 126 ObjectInputStream is = new ObjectInputStream (fis); 127 128 dds = (Hashtable) is.readObject (); 129 is.close (); 130 } catch(Exception e) { 131 dds = new Hashtable (); 132 System.err.println ("SOAP Service Manager: Unable to read '" + 133 filename + "': assuming fresh start"); 134 } 135 } 136 137 141 public void saveRegistry() throws SOAPException { 142 try { 143 File file = ServerHTTPUtils.getFileFromNameAndContext(filename, 144 context); 145 FileOutputStream fos = new FileOutputStream (file); 146 ObjectOutputStream os = new ObjectOutputStream (fos); 147 148 os.writeObject (dds); 149 os.close (); 150 } catch (Exception e) { 151 throw new SOAPException (Constants.FAULT_CODE_SERVER, 152 "Error saving services registry: " + 153 e.getMessage ()); 154 }; 155 } 156 }; 157 | Popular Tags |