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 88 public abstract class BaseConfigManager implements ConfigManager { 89 protected Hashtable dds = new Hashtable(); 90 protected String [] serviceNamesCache ; 91 protected ServletContext context = null; 92 93 96 public void setContext(ServletContext context) { 97 this.context = context; 98 } 99 100 104 public void init() throws SOAPException { 105 loadRegistry(); 106 } 107 108 116 public void deploy( DeploymentDescriptor dd ) throws SOAPException { 117 String id = dd.getID(); 118 dds.put( id, dd ); 119 saveRegistry(); 120 serviceNamesCache = null ; 121 } 122 123 131 public DeploymentDescriptor undeploy( String id ) throws SOAPException { 132 DeploymentDescriptor dd = (DeploymentDescriptor) dds.remove( id ); 133 if ( dd != null ) { 134 saveRegistry(); 135 serviceNamesCache = null ; 136 } else { 137 throw new SOAPException( Constants.FAULT_CODE_SERVER, 138 "Service '" + id + "' unknown" ); 139 } 140 return( dd ); 141 } 142 143 146 public String [] list() throws SOAPException { 147 if (serviceNamesCache != null) { 148 return serviceNamesCache; 149 } 150 Enumeration e = dds.keys (); 151 int count = dds.size (); 152 serviceNamesCache = new String [count]; 153 for (int i = 0; i < count; i++) { 154 serviceNamesCache[i] = (String ) e.nextElement (); 155 } 156 return serviceNamesCache; 157 } 158 159 167 public DeploymentDescriptor query(String id) throws SOAPException { 168 DeploymentDescriptor dd = (DeploymentDescriptor) dds.get (id); 169 return( dd ); 170 } 171 172 176 public abstract void loadRegistry() throws SOAPException; 177 178 182 public abstract void saveRegistry() throws SOAPException; 183 } 184 | Popular Tags |