package edu.vt.marian.server; import java.io.*; import java.net.*; import java.lang.*; import java.util.*; import edu.vt.marian.common.*; /** class name: resource_manager class description: this class contain all the resources of the system, currently it only contains log manager and showable message, but in the future it may also contain databases. uses the services of class(es): designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu) implementator(s): Ning Chai (nchai@csgrad.cs.vt.edu) finished time: Nov 30th, 1998 known bugs: JDK version: 1.1.5 side effects: */ public class resource_manager { public final static int OK = 0; private log_manager lm = null; private user_message_table umt = null; private String dir = null; /** this is just used for debugging */ Debug debug; /** method description: this constructor will create an resource_manager object from the specified directory uses the services of class(es): input parameter(s): dir -- this directory contains all the configuration information of the resource manager object of the system debug -- used for debugging output parameter(s): none return value: none synchronization: none */ public resource_manager(String dir, Debug debug) { this.debug = debug; if (dir == null) { debug.dumpTrace("Class:resource_manager Method:constructor Dir name is null."); return; } this.dir = dir; lm = new log_manager(dir+"log_manager"+File.separator, debug); umt = new user_message_table(dir + "user_message_table"+File.separator, debug); return; } /** method description: this method will return the log manager of this object uses the services of class(es): none input parameter(s): none output parameter(s): none return value: the log_manage of this object synchronization: none */ public log_manager get_log_manager() { return lm; } /** method description: this method will return the user message table of the system uses the services of class(es): input parameter(s): none output parameter(s): none return value: the user_message_table of this object synchronization: none */ public user_message_table get_user_message_table() { return umt; } /** method description: this method will let this object exit smoothly, release all the resources it occupied, kill all the threads it created. uses the services of class(es): log_manager, user_message_table input parameter(s): condition -- specify under which condition this method is called output parameter(s): none return value: OK -- the exit is smooth synchronization: none */ public int exit(String condition) { lm.exit(condition); umt.exit(condition); return OK; } }