1 21 22 package org.apache.derby.drda; 23 24 import java.io.PrintWriter ; 25 import java.net.InetAddress ; 26 import java.util.Properties ; 27 import org.apache.derby.iapi.reference.Property; 28 29 import org.apache.derby.impl.drda.NetworkServerControlImpl; 30 31 164 165 public class NetworkServerControl{ 166 167 168 169 public final static int DEFAULT_PORTNUMBER = 1527; 170 private NetworkServerControlImpl serverImpl; 171 172 174 195 public NetworkServerControl(InetAddress address,int portNumber) throws Exception 196 { 197 198 serverImpl = new NetworkServerControlImpl(address, 199 portNumber); 200 201 } 202 203 204 220 public NetworkServerControl() throws Exception 221 { 222 223 serverImpl = new NetworkServerControlImpl(); 224 225 } 226 227 228 234 public static void main(String args[]) { 235 NetworkServerControlImpl server = null; 236 try 237 { 238 server = new NetworkServerControlImpl(); 239 server.executeWork(args); 240 } 241 catch (Exception e) 242 { 243 if ((e.getMessage() == null) || 245 !e.getMessage().equals(NetworkServerControlImpl.UNEXPECTED_ERR)) 246 { 247 if (server != null) 248 server.consoleExceptionPrint(e); 249 else 250 e.printStackTrace(); } 252 System.exit(1); 254 } 255 System.exit(0); 256 257 } 258 259 265 266 284 public void start(PrintWriter consoleWriter) throws Exception 285 { 286 serverImpl.start(consoleWriter); 287 } 288 289 290 291 298 public void shutdown() 299 throws Exception 300 { 301 serverImpl.shutdown(); 302 } 303 304 310 public void ping() throws Exception 311 { 312 serverImpl.ping(); 313 } 314 315 323 public void trace(boolean on) 324 throws Exception 325 { 326 serverImpl.trace(on); 327 } 328 329 330 339 public void trace(int connNum, boolean on) 340 throws Exception 341 { 342 serverImpl.trace(connNum, on); 343 } 344 345 354 public void logConnections(boolean on) 355 throws Exception 356 { 357 serverImpl.logConnections(on); 358 } 359 360 369 public void setTraceDirectory(String traceDirectory) 370 throws Exception 371 { 372 serverImpl.sendSetTraceDirectory(traceDirectory); 373 } 374 375 382 public String getSysinfo() 383 throws Exception 384 { 385 386 return serverImpl.sysinfo(); 387 } 388 389 396 public String getRuntimeInfo() 397 throws Exception 398 { 399 return serverImpl.runtimeInfo(); 400 } 401 402 403 415 public void setMaxThreads(int max) throws Exception 416 { 417 serverImpl.netSetMaxThreads(max); 418 } 419 420 421 427 public int getMaxThreads() throws Exception 428 { 429 String val =serverImpl.getCurrentProperties().getProperty(Property.DRDA_PROP_MAXTHREADS); 430 431 432 return Integer.parseInt(val); 433 } 434 435 445 public void setTimeSlice(int timeslice) throws Exception 446 { 447 serverImpl.netSetTimeSlice(timeslice); 448 } 449 450 456 public int getTimeSlice() throws Exception 457 { 458 String val = 459 serverImpl.getCurrentProperties().getProperty(Property.DRDA_PROP_TIMESLICE); 460 return Integer.parseInt(val); 461 } 462 463 464 465 471 public Properties getCurrentProperties() throws Exception 472 { 473 return serverImpl.getCurrentProperties(); 474 } 475 476 477 478 483 484 protected void setClientLocale(String locale) 485 { 486 serverImpl.clientLocale = locale; 487 } 488 } 489 490 491 492 493 494 | Popular Tags |