Source Code Cross Referenced for POAManagerMonitorImpl.java in  » Collaboration » JacORB » org » jacorb » poa » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » JacORB » org.jacorb.poa 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jacorb.poa;
002:
003:        /*
004:         *        JacORB - a free Java ORB
005:         *
006:         *   Copyright (C) 1997-2004 Gerald Brose.
007:         *
008:         *   This library is free software; you can redistribute it and/or
009:         *   modify it under the terms of the GNU Library General Public
010:         *   License as published by the Free Software Foundation; either
011:         *   version 2 of the License, or (at your option) any later version.
012:         *
013:         *   This library is distributed in the hope that it will be useful,
014:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         *   Library General Public License for more details.
017:         *
018:         *   You should have received a copy of the GNU Library General Public
019:         *   License along with this library; if not, write to the Free
020:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         */
022:
023:        import org.jacorb.poa.gui.*;
024:
025:        import org.apache.avalon.framework.logger.Logger;
026:        import org.apache.avalon.framework.configuration.*;
027:
028:        /**
029:         * This class extends the POAManager with a monitoring gui for interacting
030:         * with the POAManager and start and stop poa monitoring.
031:         *
032:         * @author Reimo Tiedemann, FU Berlin
033:         * @version 1.05, 12/08/99, RT
034:         */
035:
036:        public class POAManagerMonitorImpl implements  POAManagerMonitor,
037:                POAManagerMonitorController, Configurable {
038:            private POAManager model = null;
039:            private POAManagerMonitorView view = null;
040:
041:            /** the configuration object for this POA instance */
042:            private org.jacorb.config.Configuration configuration = null;
043:            private Logger logger;
044:
045:            public void configure(Configuration myConfiguration)
046:                    throws ConfigurationException {
047:                this .configuration = (org.jacorb.config.Configuration) myConfiguration;
048:                logger = configuration
049:                        .getNamedLogger("jacorb.poa.manager_monitor");
050:            }
051:
052:            public void actionClosePOAMonitor(String name) {
053:                if (model != null) {
054:                    try {
055:                        printMessage("invoke \"closeMonitor()\" on POAMonitor "
056:                                + name);
057:                        model.getRegisteredPOA(reducePOAName(name))
058:                                .getMonitor().closeMonitor();
059:                        printMessage("closeMonitor() on POAMonitor " + name
060:                                + " is returned successfully");
061:                    } catch (Throwable e) {
062:                        printMessage("exception ocurred: " + e);
063:                    }
064:                }
065:            }
066:
067:            public void actionCloseView() {
068:                closeMonitor();
069:            }
070:
071:            public void actionDestroyPOA(String name) {
072:                if (model != null) {
073:                    try {
074:                        printMessage("invoke \"destroy()\" on POA " + name);
075:                        model.getRegisteredPOA(reducePOAName(name)).destroy(
076:                                true, true);
077:                        printMessage("destroy() on POA " + name
078:                                + " is returned successfully");
079:                    } catch (Throwable e) {
080:                        printMessage("exception ocurred: " + e);
081:                    }
082:                }
083:            }
084:
085:            public void actionOpenPOAMonitor(String name) {
086:                if (model != null) {
087:                    try {
088:                        printMessage("invoke \"openMonitor()\" on POAMonitor "
089:                                + name);
090:                        model.getRegisteredPOA(reducePOAName(name))
091:                                .getMonitor().openMonitor();
092:                        printMessage("openMonitor() on POAMonitor " + name
093:                                + " is returned successfully");
094:                    } catch (Throwable e) {
095:                        printMessage("exception ocurred: " + e);
096:                    }
097:                }
098:            }
099:
100:            public void actionSetToActive() {
101:                if (model != null) {
102:                    try {
103:                        printMessage("invoke \"activate()\" on POAManager");
104:                        model.activate();
105:                        printMessage("activate() on POAManager is returned successfully");
106:                    } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
107:                        printMessage("exception ocurred: " + e);
108:                        resetState();
109:                    }
110:                }
111:            }
112:
113:            public void actionSetToDiscarding(boolean wait) {
114:                if (model != null) {
115:                    try {
116:                        printMessage("invoke \"discard_requests(" + wait
117:                                + ")\" on POAManager");
118:                        model.discard_requests(wait);
119:                        printMessage("discard_requests(" + wait
120:                                + ") on POAManager is returned successfully");
121:                    } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
122:                        printMessage("exception ocurred: " + e);
123:                        resetState();
124:                    }
125:                }
126:            }
127:
128:            public void actionSetToHolding(boolean wait) {
129:                if (model != null) {
130:                    try {
131:                        printMessage("invoke \"hold_requests(" + wait
132:                                + ")\" on POAManager");
133:                        model.hold_requests(wait);
134:                        printMessage("hold_requests(" + wait
135:                                + ") on POAManager is returned successfully");
136:                    } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
137:                        printMessage("exception ocurred: " + e);
138:                        resetState();
139:                    }
140:                }
141:            }
142:
143:            public void actionSetToInactive(boolean wait, boolean etherialize) {
144:                if (model != null) {
145:                    try {
146:                        printMessage("invoke \"deactivate(" + etherialize
147:                                + ", " + wait + ")\" on POAManager");
148:                        model.deactivate(etherialize, wait);
149:                        printMessage("deactivate(" + etherialize + ", " + wait
150:                                + ") on POAManager is returned successfully");
151:                    } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
152:                        printMessage("exception ocurred: " + e);
153:                        resetState();
154:                    }
155:                }
156:            }
157:
158:            public synchronized void addPOA(String name) {
159:                if (view != null) {
160:                    try {
161:                        view._addPOA(expandPOAName(name));
162:                    } catch (Throwable exception) {
163:                        if (logger.isErrorEnabled()) {
164:                            logger.error("Exception in addPOA()"
165:                                    + exception.getMessage());
166:                        }
167:                    }
168:                    printMessage("register POA " + name);
169:                }
170:            }
171:
172:            public synchronized void closeMonitor() {
173:                if (view != null) {
174:                    try {
175:                        POAManagerMonitor newMonitor = (POAManagerMonitor) Class
176:                                .forName("org.jacorb.poa.POAManagerMonitorImpl")
177:                                .newInstance();
178:                        newMonitor.init(model);
179:                        newMonitor.configure(configuration);
180:                        model.setMonitor(newMonitor);
181:                        POAManagerMonitorView tmp = view;
182:                        view = null;
183:                        tmp._destroy();
184:                    } catch (Throwable exception) {
185:                        if (logger.isErrorEnabled()) {
186:                            logger.error("Exception in closeMonitor"
187:                                    + exception.getMessage());
188:                        }
189:                    }
190:                }
191:            }
192:
193:            private String expandPOAName(String name) {
194:                return name.equals("") ? POAConstants.ROOT_POA_NAME
195:                        : POAConstants.ROOT_POA_NAME
196:                                + POAConstants.OBJECT_KEY_SEPARATOR + name;
197:            }
198:
199:            public void init(POAManager poaManager) {
200:                model = poaManager;
201:            }
202:
203:            public synchronized void openMonitor() {
204:                try {
205:                    view = new org.jacorb.poa.gui.pm.POAManagerFrame(this );
206:                    view._setVisible(true);
207:                } catch (Throwable exception) {
208:                    if (logger.isErrorEnabled()) {
209:                        logger.error("Exception in openMonitor"
210:                                + exception.getMessage());
211:                    }
212:                }
213:            }
214:
215:            public synchronized void printMessage(String str) {
216:                if (view != null) {
217:                    try {
218:                        view._printMessage(str);
219:                    } catch (Throwable exception) {
220:                        if (logger.isErrorEnabled()) {
221:                            logger.error("Exception int printMessage(): "
222:                                    + exception.getMessage());
223:                        }
224:                    }
225:                }
226:            }
227:
228:            private String reducePOAName(String name) {
229:                return name.equals(POAConstants.ROOT_POA_NAME) ? "" : name
230:                        .substring(POAConstants.ROOT_POA_NAME.length() + 1);
231:            }
232:
233:            public synchronized void removePOA(String name) {
234:                if (view != null) {
235:                    try {
236:                        view._removePOA(expandPOAName(name));
237:                    } catch (Throwable exception) {
238:                        if (logger.isErrorEnabled()) {
239:                            logger.error("Exception in printMessage(): "
240:                                    + exception.getMessage());
241:                        }
242:                    }
243:                    printMessage("unregister POA " + name);
244:                }
245:            }
246:
247:            protected synchronized void resetState() {
248:                if (view != null) {
249:                    try {
250:                        view._resetState();
251:                    } catch (Throwable exception) {
252:                        if (logger.isErrorEnabled()) {
253:                            logger.error("Exception in resetState(): "
254:                                    + exception.getMessage());
255:                        }
256:                    }
257:                }
258:            }
259:
260:            public synchronized void setToActive() {
261:                if (view != null) {
262:                    try {
263:                        view._setToActive();
264:                    } catch (Throwable exception) {
265:                        if (logger.isErrorEnabled()) {
266:                            logger.error("Exception in setToActive(): "
267:                                    + exception.getMessage());
268:                        }
269:                    }
270:                    printMessage("POAManager is set to \"active\"");
271:                }
272:            }
273:
274:            public synchronized void setToDiscarding(boolean wait) {
275:                if (view != null) {
276:                    try {
277:                        view._setToDiscarding(wait);
278:                    } catch (Throwable exception) {
279:                        if (logger.isErrorEnabled()) {
280:                            logger.error("Exception in setToActive(): "
281:                                    + exception.getMessage());
282:                        }
283:                    }
284:                    printMessage("POAManager is set to \"discarding\"");
285:                }
286:            }
287:
288:            public synchronized void setToHolding(boolean wait) {
289:                if (view != null) {
290:                    try {
291:                        view._setToHolding(wait);
292:                    } catch (Throwable exception) {
293:                        if (logger.isErrorEnabled()) {
294:                            logger.error("Exception in setToHolding(): "
295:                                    + exception.getMessage());
296:                        }
297:                    }
298:                    printMessage("POAManager is set to \"holding\"");
299:                }
300:            }
301:
302:            public synchronized void setToInactive(boolean wait,
303:                    boolean etherialize) {
304:                if (view != null) {
305:                    try {
306:                        view._setToInactive(wait, etherialize);
307:                    } catch (Throwable exception) {
308:                        if (logger.isErrorEnabled()) {
309:                            logger.error("Exception in setToInactive(): "
310:                                    + exception.getMessage());
311:                        }
312:                    }
313:                    printMessage("POAManager is set to \"inactive\"");
314:                }
315:            }
316:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.