Re-factoring in support of https://issues.apache.org/bugzilla/show_bug.cgi?id=50360
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Dec 2010 14:19:23 +0000 (14:19 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Dec 2010 14:19:23 +0000 (14:19 +0000)
Pull up init()

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1043429 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
java/org/apache/coyote/AbstractProtocolHandler.java
java/org/apache/coyote/LocalStrings.properties
java/org/apache/coyote/ajp/AjpAprProtocol.java
java/org/apache/coyote/ajp/AjpProtocol.java
java/org/apache/coyote/ajp/LocalStrings.properties
java/org/apache/coyote/ajp/LocalStrings_es.properties
java/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java
java/org/apache/coyote/http11/Http11AprProtocol.java
java/org/apache/coyote/http11/Http11NioProtocol.java
java/org/apache/coyote/http11/Http11Protocol.java
java/org/apache/coyote/http11/LocalStrings.properties
java/org/apache/coyote/http11/LocalStrings_es.properties
java/org/apache/coyote/http11/LocalStrings_fr.properties
java/org/apache/coyote/http11/LocalStrings_ja.properties

index e730e56..9ed9b01 100644 (file)
@@ -337,13 +337,32 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler,
 
     // ------------------------------------------------------- Lifecycle methods
 
-    // TODO Keep current state and check for invalid transitions
+    /*
+     * NOTE: There is no maintenance of state or checking for valid transitions
+     * within this class. It is expected that the connector will maintain state
+     * and prevent invalid state transitions.
+     */
 
     @Override
-    public abstract void init() throws Exception;
+    public void init() throws Exception {
+        if (getLog().isInfoEnabled())
+            getLog().info(sm.getString("abstractProtocolHandler.init",
+                    getName()));
+
+        endpoint.setName(getName());
+
+        try {
+            endpoint.init();
+        } catch (Exception ex) {
+            getLog().error(sm.getString("abstractProtocolHandler.initError",
+                    getName()), ex);
+            throw ex;
+        }
+    }
+
 
     @Override
-    public final void pause() throws Exception {
+    public void pause() throws Exception {
         if(getLog().isInfoEnabled())
             getLog().info(sm.getString("abstractProtocolHandler.pause",
                     getName()));
@@ -357,7 +376,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler,
     }
 
     @Override
-    public final void resume() throws Exception {
+    public void resume() throws Exception {
         if(getLog().isInfoEnabled())
             getLog().info(sm.getString("abstractProtocolHandler.resume",
                     getName()));
@@ -372,7 +391,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler,
 
 
     @Override
-    public final void stop() throws Exception {
+    public void stop() throws Exception {
         try {
             endpoint.stop();
         } catch (Exception ex) {
@@ -387,7 +406,7 @@ public abstract class AbstractProtocolHandler implements ProtocolHandler,
 
 
     @Override
-    public final void destroy() {
+    public void destroy() {
         if(getLog().isInfoEnabled()) {
             getLog().info(sm.getString("abstractProtocolHandler.destroy",
                     getName()));
index 3e376cf..8fc5c81 100644 (file)
@@ -15,6 +15,8 @@
 
 abstractProtocolHandler.getAttribute=Get attribute [{0}] with value [{1}]
 abstractProtocolHandler.setAttribute=Set attribute [{0}] with value [{1}]
+abstractProtocolHandler.pause=Initializing ProtocolHandler [{0}]
+abstractProtocolHandler.pauseError=Failed to initialize end point associated with ProtocolHandler [{0}]
 abstractProtocolHandler.pause=Pausing ProtocolHandler [{0}]
 abstractProtocolHandler.pauseError=Failed to pause end point associated with ProtocolHandler [{0}]
 abstractProtocolHandler.resume=Resuming ProtocolHandler [{0}]
index 1ff933b..d3dca6e 100644 (file)
@@ -86,24 +86,6 @@ public class AjpAprProtocol extends AbstractAjpProtocol {
     // --------------------------------------------------------- Public Methods
 
 
-    /** Start the protocol
-     */
-    @Override
-    public void init() throws Exception {
-        endpoint.setName(getName());
-
-        try {
-            endpoint.init();
-        } catch (Exception ex) {
-            log.error(sm.getString("ajpprotocol.endpoint.initerror"), ex);
-            throw ex;
-        }
-        if (log.isInfoEnabled()) {
-            log.info(sm.getString("ajpprotocol.init", getName()));
-        }
-    }
-
-
     @Override
     public void start() throws Exception {
         if (this.domain != null ) {
index 3c13326..04d21c5 100644 (file)
@@ -86,24 +86,6 @@ public class AjpProtocol extends AbstractAjpProtocol {
     // --------------------------------------------------------- Public Methods
 
 
-    /** Start the protocol
-     */
-    @Override
-    public void init() throws Exception {
-        endpoint.setName(getName());
-
-        try {
-            endpoint.init();
-        } catch (Exception ex) {
-            log.error(sm.getString("ajpprotocol.endpoint.initerror"), ex);
-            throw ex;
-        }
-        if (log.isInfoEnabled()) {
-            log.info(sm.getString("ajpprotocol.init", getName()));
-        }
-    }
-
-
     @Override
     public void start() throws Exception {
         if (this.domain != null ) {
index f7559cb..b19bc71 100644 (file)
@@ -23,9 +23,7 @@
 # AjpAprProtocol
 #
 
-ajpprotocol.endpoint.initerror=Error initializing endpoint
 ajpprotocol.endpoint.starterror=Error starting endpoint
-ajpprotocol.endpoint.stoperror=Error stopping endpoint
 ajpprotocol.init=Initializing Coyote AJP/1.3 on {0}
 ajpprotocol.proto.error=Error reading request, ignored
 ajpprotocol.start=Starting Coyote AJP/1.3 on {0}
index 9695d66..a32037a 100644 (file)
@@ -13,9 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ajpprotocol.endpoint.initerror = Error inicializando punto final
 ajpprotocol.endpoint.starterror = Error arrancando punto final
-ajpprotocol.init = Inicializando Coyote AJP/1.3 en {0}
 ajpprotocol.proto.error = Error leyendo requerimiento, ignorado
 ajpprotocol.start = Arrancando Coyote AJP/1.3 en {0}
 ajpprotocol.failedread = Fallo en lectura de Conector
index 42a3a12..8786fb4 100644 (file)
@@ -17,6 +17,7 @@
 package org.apache.coyote.http11;
 
 import org.apache.tomcat.util.net.SSLImplementation;
+import org.apache.tomcat.util.net.jsse.JSSEImplementation;
 
 public abstract class AbstractHttp11JsseProtocol
         extends AbstractHttp11Protocol {
@@ -102,4 +103,13 @@ public abstract class AbstractHttp11JsseProtocol
     public String getAllowUnsafeLegacyRenegotiation() {
         return endpoint.getAllowUnsafeLegacyRenegotiation();
     }
+
+
+    // ------------------------------------------------------- Lifecycle methods
+
+    @Override
+    public void init() throws Exception {
+        super.init();
+        sslImplementation = new JSSEImplementation();
+    }
 }
index 8a5b1d4..7f5072e 100644 (file)
@@ -79,23 +79,6 @@ public class Http11AprProtocol extends AbstractHttp11Protocol {
         setProcessorCache(-1);
     }
 
-    /** Start the protocol
-     */
-    @Override
-    public void init() throws Exception {
-        endpoint.setName(getName());
-
-        try {
-            endpoint.init();
-        } catch (Exception ex) {
-            log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
-            throw ex;
-        }
-        if(log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.init", getName()));
-
-    }
-
     @Override
     public void start() throws Exception {
         if( this.domain != null ) {
index 06ce6e1..7ff52e6 100644 (file)
@@ -39,7 +39,6 @@ import org.apache.tomcat.util.net.NioEndpoint;
 import org.apache.tomcat.util.net.NioEndpoint.Handler;
 import org.apache.tomcat.util.net.SecureNioChannel;
 import org.apache.tomcat.util.net.SocketStatus;
-import org.apache.tomcat.util.net.jsse.JSSEImplementation;
 
 
 /**
@@ -82,24 +81,6 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol {
     }
 
 
-    /** Start the protocol
-     */
-    @Override
-    public void init() throws Exception {
-        endpoint.setName(getName());
-        
-        try {
-            endpoint.init();
-            sslImplementation = new JSSEImplementation();
-        } catch (Exception ex) {
-            log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
-            throw ex;
-        }
-        if(log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.init", getName()));
-
-    }
-
     @Override
     public void start() throws Exception {
         if( this.domain != null ) {
index ef99f06..f902455 100644 (file)
@@ -37,7 +37,6 @@ import org.apache.tomcat.util.net.JIoEndpoint;
 import org.apache.tomcat.util.net.JIoEndpoint.Handler;
 import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
-import org.apache.tomcat.util.net.jsse.JSSEImplementation;
 
 
 /**
@@ -86,22 +85,6 @@ public class Http11Protocol extends AbstractHttp11JsseProtocol {
     // ----------------------------------------- ProtocolHandler Implementation
 
     @Override
-    public void init() throws Exception {
-        endpoint.setName(getName());
-
-        try {
-            endpoint.init();
-            sslImplementation = new JSSEImplementation();
-        } catch (Exception ex) {
-            log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
-            throw ex;
-        }
-        if (log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.init", getName()));
-
-    }
-
-    @Override
     public void start() throws Exception {
         if (this.domain != null) {
             try {
index 17b330f..c0c27fc 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-http11protocol.destroy=Destroying Coyote HTTP/1.1 on {0}
-http11protocol.endpoint.initerror=Error initializing endpoint
 http11protocol.endpoint.starterror=Error starting endpoint
-http11protocol.endpoint.stoperror=Error stopping endpoint
-http11protocol.init=Initializing Coyote HTTP/1.1 on {0}
 http11protocol.proto.error=Error reading request, ignored
 http11protocol.proto.ioexception.debug=IOException reading request
 http11protocol.proto.ioexception.info=IOException reading request, ignored
 http11protocol.proto.socketexception.debug=SocketException reading request
 http11protocol.proto.socketexception.info=SocketException reading request, ignored
-http11protocol.socketfactory.initerror=Error initializing socket factory
 http11protocol.start=Starting Coyote HTTP/1.1 on {0}
 
 http11processor.regexp.error=Error parsing regular expression {0}
index 4e3218c..3c9d805 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-http11protocol.endpoint.initerror = Error inicializando punto final (endpoint)
 http11protocol.endpoint.starterror = Error arrancando punto final (endpoint)
-http11protocol.init = Inicializando Coyote HTTP/1.1 en puerto {0}
 http11protocol.proto.error = Error leyendo requerimiento, ignorado
 http11protocol.proto.ioexception.debug = IOException leyendo requerimiento
 http11protocol.proto.ioexception.info = IOException leyendo requerimiento, ignorada
 http11protocol.proto.socketexception.debug = SocketException leyendo requerimiento
 http11protocol.proto.socketexception.info = SocketException leyendo requerimiento, ignorada
-http11protocol.socketfactory.initerror = Error inicializando f\u00E1brica de enchufes (sockets)
 http11protocol.start = Arrancando Coyote HTTP/1.1 en puerto {0}
 
 http11processor.regexp.error = Error al analizar expresi\u00F3n regular {0}
index a451d43..cb4e2b3 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-http11protocol.endpoint.initerror=Erreur \u00e0 l'initialisation du point de contact
 http11protocol.endpoint.starterror=Erreur au d\u00e9marrage du point de contact
-http11protocol.init=Initialisation de Coyote HTTP/1.1 sur {0}
 http11protocol.proto.error=Erreur \u00e0 la lecture de la requ\u00eate, ignor\u00e9
 http11protocol.proto.ioexception.debug=Exception d'entr\u00e9e/sortie (IOException) \u00e0 la lecture de la requ\u00eate
 http11protocol.proto.ioexception.info=Exception d'entr\u00e9e/sortie \u00e0 la lecture de la requ\u00eate, ignor\u00e9
 http11protocol.proto.socketexception.debug=Exception "Socket" (SocketException) \u00e0 la lecture de la requ\u00eate
 http11protocol.proto.socketexception.info=Exception "Socket" (SocketException) \u00e0 la lecture de la requ\u00eate, ignor\u00e9
-http11protocol.socketfactory.initerror=Erreur \u00e0 l'initialisation du cr\u00e9ateur de socket (socket factory)
 http11protocol.start=D\u00e9marrage de Coyote HTTP/1.1 sur {0}
 
 iib.eof.error=Fin de flux (EOF) inattendue \u00e0 la lecture sur la socket
index cc71e2e..d79a78c 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-http11protocol.endpoint.initerror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
 http11protocol.endpoint.starterror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8d77\u52d5\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-http11protocol.init=Coyote HTTP/1.1\u3092 {0} \u3067\u521d\u671f\u5316\u3057\u307e\u3059
 http11protocol.proto.error=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
 http11protocol.proto.ioexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059
 http11protocol.proto.ioexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
 http11protocol.proto.socketexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059
 http11protocol.proto.socketexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
-http11protocol.socketfactory.initerror=\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30af\u30c8\u30ea\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
 http11protocol.start=Coyote HTTP/1.1\u3092 {0} \u3067\u8d77\u52d5\u3057\u307e\u3059
  
 iib.eof.error=\u30bd\u30b1\u30c3\u30c8\u304b\u3089\u4e88\u671f\u3057\u306a\u3044EOF\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3057\u305f