Source Code Cross Referenced for HttpAdaptor.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » jmx » 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 » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.jmx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Sequoia: Database clustering technology.
003:         * Copyright (C) 2002-2004 French National Institute For Research In Computer
004:         * Science And Control (INRIA).
005:         * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
006:         * Contact: sequoia@continuent.org
007:         * 
008:         * Licensed under the Apache License, Version 2.0 (the "License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         * 
012:         * http://www.apache.org/licenses/LICENSE-2.0
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License. 
019:         *
020:         * Initial developer(s): Marc Wick.
021:         * Contributor(s): ______________________.
022:         */package org.continuent.sequoia.controller.jmx;
023:
024:        import java.net.InetAddress;
025:        import java.net.UnknownHostException;
026:        import java.util.ArrayList;
027:        import java.util.List;
028:
029:        import javax.management.Attribute;
030:        import javax.management.MBeanServer;
031:        import javax.management.ObjectName;
032:
033:        import org.continuent.sequoia.common.i18n.Translate;
034:        import org.continuent.sequoia.common.jmx.JmxException;
035:        import org.continuent.sequoia.common.log.Trace;
036:        import org.continuent.sequoia.common.net.SSLConfiguration;
037:
038:        /**
039:         * This class defines a HttpAdaptor
040:         * 
041:         * @author <a href="mailto:marc.wick@monte-bre.ch">Marc Wick </a>
042:         * @version 1.0
043:         */
044:        public class HttpAdaptor
045:
046:        {
047:            static Trace logger = Trace
048:                    .getLogger("org.continuent.sequoia.controller.jmx");
049:
050:            private String hostName;
051:            private int port;
052:            //private JMXAuthenticator authenticator;
053:            private SSLConfiguration sslConfig;
054:
055:            private mx4j.tools.adaptor.http.HttpAdaptor adaptor;
056:            private ObjectName objectName;
057:            private ObjectName processorName;
058:
059:            private static List httpAdaptors = new ArrayList();
060:
061:            /**
062:             * Creates a new <code>HttpAdaptor</code> object
063:             * 
064:             * @param hostName the host name the adaptor binds to
065:             * @param port the http port
066:             * @param sslConfig the ssl configuration, if null ssl is disabled
067:             * @throws JmxException problems to get name of localhost
068:             */
069:            public HttpAdaptor(String hostName, int port,
070:                    SSLConfiguration sslConfig) throws JmxException {
071:                if (hostName != null) {
072:                    this .hostName = hostName;
073:                } else {
074:                    try {
075:                        /** TODO: dssmith - determine applicability of getLocalHost() */
076:                        this .hostName = InetAddress.getLocalHost()
077:                                .getHostName();
078:                    } catch (UnknownHostException ex) {
079:                        throw new JmxException(ex);
080:                    }
081:                }
082:                this .port = port;
083:                //this.authenticator = authenticator;
084:                this .sslConfig = sslConfig;
085:                addHttpAdaptor(this );
086:            }
087:
088:            /**
089:             * Start the HTTP adaptor
090:             * 
091:             * @throws JmxException the adaptor could not be started
092:             */
093:            public void start() throws JmxException {
094:                try {
095:
096:                    MBeanServer server = MBeanServerManager.getInstance();
097:                    // register the HTTP adaptor MBean to the agent
098:                    logger.info(Translate.get("jmx.create.http.adaptor",
099:                            new Object[] { hostName, String.valueOf(port) }));
100:                    adaptor = new mx4j.tools.adaptor.http.HttpAdaptor();
101:                    objectName = new ObjectName("Server:name=HttpAdaptor");
102:                    server.registerMBean(adaptor, objectName);
103:                    adaptor.setHost(hostName);
104:                    adaptor.setPort(port);
105:                    // set XSLT processor
106:                    logger.debug(Translate.get("jmx.create.xslt.processor"));
107:                    processorName = new ObjectName("Server:name=XSLTProcessor");
108:                    server.createMBean(
109:                            mx4j.tools.adaptor.http.XSLTProcessor.class
110:                                    .getName(), processorName, null);
111:                    server.setAttribute(objectName, new Attribute(
112:                            "ProcessorName", processorName));
113:                    if (this .sslConfig != null) {
114:                        // TODO: SSL support for HTTP adaptor
115:                        throw new JmxException("ssl for http not implemented");
116:                    }
117:                    adaptor.start();
118:                } catch (Exception e) {
119:                    e.printStackTrace();
120:                    throw new JmxException(e);
121:                }
122:            }
123:
124:            /**
125:             * stop the http adaptor
126:             * 
127:             * @throws JmxException problems stoping the adaptor
128:             */
129:            public void stop() throws JmxException {
130:                try {
131:                    MBeanServer server = MBeanServerManager.getInstance();
132:                    adaptor.stop();
133:                    server.unregisterMBean(objectName);
134:                    server.unregisterMBean(processorName);
135:                } catch (Exception e) {
136:                    throw new JmxException(e);
137:                }
138:            }
139:
140:            /**
141:             * Returns a list of HttpAdaptor .
142:             * 
143:             * @return Returns list of HttpAdaptor.
144:             */
145:            public static List getHttpAdaptors() {
146:                return httpAdaptors;
147:            }
148:
149:            /**
150:             * Adds an HttpAdaptor to the list.
151:             * 
152:             * @param httpAdaptor The HttpAdaptor to add.
153:             */
154:            private static synchronized void addHttpAdaptor(
155:                    HttpAdaptor httpAdaptor) {
156:                httpAdaptors.add(httpAdaptor);
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.