You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2004/08/02 08:13:32 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans ConnectorMBean.java
billbarker 2004/08/01 23:13:32
Modified: catalina/src/share/org/apache/catalina/mbeans
ConnectorMBean.java
Log:
Make certain that attributes get set, even if called before init.
Also fix Connector <==> Protocol attribute name translation, and clean up the code a bit.
Revision Changes Path
1.8 +47 -15 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ConnectorMBean.java
Index: ConnectorMBean.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ConnectorMBean.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConnectorMBean.java 23 Jun 2004 08:25:03 -0000 1.7
+++ ConnectorMBean.java 2 Aug 2004 06:13:32 -0000 1.8
@@ -95,13 +95,9 @@
throw new MBeanException(e);
}
- if (("algorithm").equals(name) || ("keystoreType").equals(name) ||
- ("maxThreads").equals(name) || ("maxSpareThreads").equals(name) ||
- ("minSpareThreads").equals(name)) {
+ if (isProtocolProperty(name)) {
- if (("keystoreType").equals(name)) {
- name = "keyType";
- }
+ name = translateAttributeName(name);
ProtocolHandler protocolHandler = connector.getProtocolHandler();
/* check the Protocol first, since JkCoyote has an independent
@@ -110,6 +106,8 @@
try {
if( protocolHandler != null ) {
attribute = IntrospectionUtils.getAttribute(protocolHandler, name);
+ } else {
+ attribute = connector.getProperty(name);
}
} catch (Exception e) {
throw new MBeanException(e);
@@ -161,13 +159,9 @@
throw new MBeanException(e);
}
- if (("algorithm").equals(name) || ("keystoreType").equals(name) ||
- ("maxThreads").equals(name) || ("maxSpareThreads").equals(name) ||
- ("minSpareThreads").equals(name)) {
+ if (isProtocolProperty(name)) {
- if (("keystoreType").equals(name)) {
- name = "keyType";
- }
+ name = translateAttributeName(name);
ProtocolHandler protocolHandler = connector.getProtocolHandler();
/* check the Protocol first, since JkCoyote has an independent
@@ -176,7 +170,9 @@
try {
if( protocolHandler != null ) {
IntrospectionUtils.setAttribute(protocolHandler, name, value);
- }
+ } else {
+ connector.setProperty(name, value);
+ }
} catch (Exception e) {
throw new MBeanException(e);
}
@@ -190,5 +186,41 @@
// ------------------------------------------------------------- Operations
-
+ // ------------------------------------------------------------- Methods
+
+ /**
+ * Test for a property that is really on the Protocol.
+ */
+ private boolean isProtocolProperty(String name) {
+ return ("algorithm").equals(name) ||
+ ("keystoreType").equals(name) ||
+ ("maxThreads").equals(name) ||
+ ("maxSpareThreads").equals(name) ||
+ ("minSpareThreads").equals(name);
+ }
+
+ /*
+ * Translate the attribute name from the legacy Factory names to their
+ * internal protocol names.
+ */
+ private String translateAttributeName(String name) {
+ if ("clientAuth".equals(name)) {
+ return "clientauth";
+ } else if ("keystoreFile".equals(name)) {
+ return "keystore";
+ } else if ("randomFile".equals(name)) {
+ return "randomfile";
+ } else if ("rootFile".equals(name)) {
+ return "rootfile";
+ } else if ("keystorePass".equals(name)) {
+ return "keypass";
+ } else if ("keystoreType".equals(name)) {
+ return "keytype";
+ } else if ("sslProtocol".equals(name)) {
+ return "protocol";
+ } else if ("sslProtocols".equals(name)) {
+ return "protocols";
+ }
+ return name;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org