KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > poa > POAMonitorLightImpl


1 package org.jacorb.poa;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * 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 /**
33  * A lightweight implementation of a POA monitor
34  *
35  * @author Reimo Tiedemann, FU Berlin
36  * @version 1.02, 12/08/99, RT
37  */

38
39 public class POAMonitorLightImpl
40     implements POAMonitor
41 {
42     private POA poaModel;
43     private AOM aomModel;
44     private RequestQueue queueModel;
45     private RPPoolManager pmModel;
46
47     /** the configuration object for this POA instance */
48     private org.jacorb.config.Configuration configuration = null;
49     private Logger logger;
50     private boolean doMonitor;
51
52     private String JavaDoc prefix;
53
54     public void changeState(String JavaDoc state)
55     {
56     }
57
58     public void closeMonitor()
59     {
60     }
61
62
63     public void init(POA poa, AOM aom, RequestQueue queue, RPPoolManager pm,
64                      String JavaDoc _prefix)
65     {
66         poaModel = poa;
67         aomModel = aom;
68         queueModel = queue;
69         pmModel = pm;
70         prefix = prefix;
71     }
72
73     
74     public void configure(Configuration myConfiguration)
75         throws ConfigurationException
76     {
77         this.configuration = (org.jacorb.config.Configuration)myConfiguration;
78         logger = configuration.getNamedLogger("jacorb.poa.monitor");
79         doMonitor =
80             configuration.getAttributeAsBoolean("jacorb.poa.monitoring",false);
81     }
82
83     public void openMonitor()
84     {
85         if ( doMonitor )
86         {
87             try
88             {
89                 POAMonitor newMonitor =
90                     (POAMonitor)ObjectUtil.classForName("org.jacorb.poa.POAMonitorImpl").newInstance();
91                 newMonitor.init(poaModel, aomModel, queueModel, pmModel, prefix );
92                 newMonitor.configure(configuration);
93                 poaModel.setMonitor(newMonitor);
94                 newMonitor.openMonitor();
95             }
96             catch (Throwable JavaDoc exception)
97             {
98                 if (logger.isWarnEnabled())
99                 {
100                     logger.warn("Exception during openMonitor() of POAMonitorLightImpl" +
101                                 exception.getMessage());
102                 }
103             }
104         }
105     }
106 }
107
Popular Tags