Source Code Cross Referenced for ConnectorMBean.java in  » Sevlet-Container » tomcat-catalina » org » apache » catalina » mbeans » 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 » Sevlet Container » tomcat catalina » org.apache.catalina.mbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999,2004 The Apache Software Foundation.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.apache.catalina.mbeans;
018:
019:        import javax.management.Attribute;
020:        import javax.management.AttributeNotFoundException;
021:        import javax.management.InstanceNotFoundException;
022:        import javax.management.MBeanException;
023:        import javax.management.ReflectionException;
024:        import javax.management.RuntimeOperationsException;
025:        import javax.management.modelmbean.InvalidTargetObjectTypeException;
026:
027:        import org.apache.coyote.ProtocolHandler;
028:        import org.apache.coyote.tomcat5.CoyoteConnector;
029:        import org.apache.tomcat.util.IntrospectionUtils;
030:
031:        /**
032:         * <p>A <strong>ModelMBean</strong> implementation for the
033:         * <code>org.apache.coyote.tomcat5.CoyoteConnector</code> component.</p>
034:         *
035:         * @author Amy Roh
036:         * @version $Revision: 1.6 $ $Date: 2004/05/27 23:43:42 $
037:         */
038:
039:        public class ConnectorMBean extends ClassNameMBean {
040:
041:            // ----------------------------------------------------------- Constructors
042:
043:            /**
044:             * Construct a <code>ModelMBean</code> with default
045:             * <code>ModelMBeanInfo</code> information.
046:             *
047:             * @exception MBeanException if the initializer of an object
048:             *  throws an exception
049:             * @exception RuntimeOperationsException if an IllegalArgumentException
050:             *  occurs
051:             */
052:            public ConnectorMBean() throws MBeanException,
053:                    RuntimeOperationsException {
054:
055:                super ();
056:
057:            }
058:
059:            // ------------------------------------------------------------- Attributes
060:
061:            /**
062:             * Obtain and return the value of a specific attribute of this MBean.
063:             *
064:             * @param name Name of the requested attribute
065:             *
066:             * @exception AttributeNotFoundException if this attribute is not
067:             *  supported by this MBean
068:             * @exception MBeanException if the initializer of an object
069:             *  throws an exception
070:             * @exception ReflectionException if a Java reflection exception
071:             *  occurs when invoking the getter
072:             */
073:            public Object getAttribute(String name)
074:                    throws AttributeNotFoundException, MBeanException,
075:                    ReflectionException {
076:
077:                Object attribute = null;
078:                // Validate the input parameters
079:                if (name == null)
080:                    throw new RuntimeOperationsException(
081:                            new IllegalArgumentException(
082:                                    "Attribute name is null"),
083:                            "Attribute name is null");
084:
085:                CoyoteConnector connector = null;
086:                try {
087:                    connector = (CoyoteConnector) getManagedResource();
088:                } catch (InstanceNotFoundException e) {
089:                    throw new MBeanException(e);
090:                } catch (InvalidTargetObjectTypeException e) {
091:                    throw new MBeanException(e);
092:                }
093:
094:                if (("algorithm").equals(name) || ("keystoreType").equals(name)
095:                        || ("maxThreads").equals(name)
096:                        || ("maxSpareThreads").equals(name)
097:                        || ("minSpareThreads").equals(name)) {
098:
099:                    if (("keystoreType").equals(name)) {
100:                        name = "keyType";
101:                    }
102:
103:                    ProtocolHandler protocolHandler = connector
104:                            .getProtocolHandler();
105:                    /* check the Protocol first, since JkCoyote has an independent
106:                     * configure method.
107:                     */
108:                    try {
109:                        if (protocolHandler != null) {
110:                            attribute = IntrospectionUtils.getAttribute(
111:                                    protocolHandler, name);
112:                        }
113:                    } catch (Exception e) {
114:                        throw new MBeanException(e);
115:                    }
116:                } else {
117:                    attribute = super .getAttribute(name);
118:                }
119:
120:                return attribute;
121:
122:            }
123:
124:            /**
125:             * Set the value of a specific attribute of this MBean.
126:             *
127:             * @param attribute The identification of the attribute to be set
128:             *  and the new value
129:             *
130:             * @exception AttributeNotFoundException if this attribute is not
131:             *  supported by this MBean
132:             * @exception MBeanException if the initializer of an object
133:             *  throws an exception
134:             * @exception ReflectionException if a Java reflection exception
135:             *  occurs when invoking the getter
136:             */
137:            public void setAttribute(Attribute attribute)
138:                    throws AttributeNotFoundException, MBeanException,
139:                    ReflectionException {
140:
141:                // Validate the input parameters
142:                if (attribute == null)
143:                    throw new RuntimeOperationsException(
144:                            new IllegalArgumentException("Attribute is null"),
145:                            "Attribute is null");
146:                String name = attribute.getName();
147:                Object value = attribute.getValue();
148:                if (name == null)
149:                    throw new RuntimeOperationsException(
150:                            new IllegalArgumentException(
151:                                    "Attribute name is null"),
152:                            "Attribute name is null");
153:
154:                CoyoteConnector connector = null;
155:                try {
156:                    connector = (CoyoteConnector) getManagedResource();
157:                } catch (InstanceNotFoundException e) {
158:                    throw new MBeanException(e);
159:                } catch (InvalidTargetObjectTypeException e) {
160:                    throw new MBeanException(e);
161:                }
162:
163:                if (("algorithm").equals(name) || ("keystoreType").equals(name)
164:                        || ("maxThreads").equals(name)
165:                        || ("maxSpareThreads").equals(name)
166:                        || ("minSpareThreads").equals(name)) {
167:
168:                    if (("keystoreType").equals(name)) {
169:                        name = "keyType";
170:                    }
171:
172:                    ProtocolHandler protocolHandler = connector
173:                            .getProtocolHandler();
174:                    /* check the Protocol first, since JkCoyote has an independent
175:                     * configure method.
176:                     */
177:                    try {
178:                        if (protocolHandler != null) {
179:                            IntrospectionUtils.setAttribute(protocolHandler,
180:                                    name, value);
181:                        }
182:                    } catch (Exception e) {
183:                        throw new MBeanException(e);
184:                    }
185:
186:                } else {
187:                    super .setAttribute(attribute);
188:                }
189:
190:            }
191:
192:            // ------------------------------------------------------------- Operations
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.