01: package org.jacorb.poa;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Library General Public License for more details.
17: *
18: * You should have received a copy of the GNU Library General Public
19: * License along with this library; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: */
22:
23: import org.apache.avalon.framework.logger.Logger;
24: import org.apache.avalon.framework.configuration.*;
25:
26: import org.jacorb.poa.util.*;
27: import org.jacorb.util.ObjectUtil;
28:
29: import org.jacorb.orb.dsi.ServerRequest;
30:
31: /**
32: * A lightweight implementation of a POA monitor
33: *
34: * @author Reimo Tiedemann, FU Berlin
35: * @version 1.02, 12/08/99, RT
36: */
37:
38: public class POAMonitorLightImpl implements POAMonitor {
39: private POA poaModel;
40: private AOM aomModel;
41: private RequestQueue queueModel;
42: private RPPoolManager pmModel;
43:
44: /** the configuration object for this POA instance */
45: private org.jacorb.config.Configuration configuration = null;
46: private Logger logger;
47: private boolean doMonitor;
48:
49: private String prefix;
50:
51: public void changeState(String state) {
52: }
53:
54: public void closeMonitor() {
55: }
56:
57: public void init(POA poa, AOM aom, RequestQueue queue,
58: RPPoolManager pm, String _prefix) {
59: poaModel = poa;
60: aomModel = aom;
61: queueModel = queue;
62: pmModel = pm;
63: prefix = _prefix;
64: }
65:
66: public void configure(Configuration myConfiguration)
67: throws ConfigurationException {
68: this .configuration = (org.jacorb.config.Configuration) myConfiguration;
69: logger = configuration.getNamedLogger("jacorb.poa.monitor");
70: doMonitor = configuration.getAttributeAsBoolean(
71: "jacorb.poa.monitoring", false);
72: }
73:
74: public void openMonitor() {
75: if (doMonitor) {
76: try {
77: POAMonitor newMonitor = (POAMonitor) ObjectUtil
78: .classForName("org.jacorb.poa.POAMonitorImpl")
79: .newInstance();
80: newMonitor.init(poaModel, aomModel, queueModel,
81: pmModel, prefix);
82: newMonitor.configure(configuration);
83: poaModel.setMonitor(newMonitor);
84: newMonitor.openMonitor();
85: } catch (Throwable exception) {
86: if (logger.isWarnEnabled()) {
87: logger
88: .warn("Exception during openMonitor() of POAMonitorLightImpl"
89: + exception.getMessage());
90: }
91: }
92: }
93: }
94: }
|