01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.harness;
07:
08: import java.util.Hashtable;
09: import java.util.Vector;
10:
11: /**
12: * TestLog class manages log outputs through a provided "ticket" which is used
13: * to look up a particular log session from a hash table. Done this way so that
14: * we aren't putting the potentially large log output classes on the session, only
15: * the key used with this switchboard class to retrieve them.
16: */
17: class TestLog {
18:
19: static final String HARNESS_LOG = "harness";
20: static final String DESKTOP_LOG = "desktop";
21:
22: static void clear(String ticket) {
23: LogSession ls = (LogSession) m_LogTab.get(ticket);
24: if (ls != null) {
25: ls.clear();
26: }
27: }
28:
29: static LogView getLogView(String ticket, String nm) {
30: LogSession ls = (LogSession) m_LogTab.get(ticket);
31: return ls.getView(nm);
32: }
33:
34: // Somewhat inefficient to be copying these vectors all the time.
35:
36: static void getLogViews(String ticket, Vector v) {
37: LogSession ls = (LogSession) m_LogTab.get(ticket);
38: ls.getViews(v);
39: }
40:
41: static String open(String dir) {
42: ++m_Counter;
43: String ticket = "Log:" + m_Counter;
44: m_LogTab.put(ticket, new LogSession(dir));
45: return ticket;
46: }
47:
48: static void close(String ticket) {
49: m_LogTab.remove(ticket);
50: }
51:
52: static private int m_Counter = 0;
53: static private Hashtable m_LogTab = new Hashtable(); // Hashtable - we want synchronized version.
54: }
|