Author: remy.maucherat(a)jboss.com
Date: 2007-09-10 15:17:32 -0400 (Mon, 10 Sep 2007)
New Revision: 275
Added:
trunk/java/org/apache/AnnotationProcessor.java
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
Log:
- For compatibility with Tomcat 6.0.x, add
AnnotationProcessor interface and facade implementation.
Added: trunk/java/org/apache/AnnotationProcessor.java
===================================================================
--- trunk/java/org/apache/AnnotationProcessor.java (rev 0)
+++ trunk/java/org/apache/AnnotationProcessor.java 2007-09-10 19:17:32 UTC (rev 275)
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ * @version $Revision: 467222 $
+ * @deprecated Replaced by InstanceManager which provides a subset of the capabilities
+ */
+public interface AnnotationProcessor {
+ public void postConstruct(Object instance)
+ throws IllegalAccessException, InvocationTargetException;
+ public void preDestroy(Object instance)
+ throws IllegalAccessException, InvocationTargetException;
+ public void processAnnotations(Object instance)
+ throws IllegalAccessException, InvocationTargetException, NamingException;
+}
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-10 14:50:39 UTC (rev
274)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-10 19:17:32 UTC (rev
275)
@@ -27,6 +27,7 @@
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
@@ -61,6 +62,7 @@
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionListener;
+import org.apache.AnnotationProcessor;
import org.apache.InstanceManager;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerListener;
@@ -187,6 +189,12 @@
*/
private String hostName;
+
+ /**
+ * Dummy annotation processor.
+ */
+ private AnnotationProcessor annotationProcessor = new DummyAnnotationProcessor();
+
/**
* The antiJARLocking flag for this Context.
@@ -4321,6 +4329,7 @@
// Binding thread
oldCCL = bindThread();
+ // Annotation processor setup
if (ok ) {
if (instanceManager == null) {
javax.naming.Context context = null;
@@ -4335,6 +4344,7 @@
} else {
getServletContext().setAttribute(InstanceManager.class.getName(),
instanceManager);
}
+ getServletContext().setAttribute(AnnotationProcessor.class.getName(),
annotationProcessor);
}
try {
@@ -5684,5 +5694,33 @@
public boolean isStatisticsProvider() {
return false;
}
+
+ // ----------------------------------------------- DummyAnnotationProcessor Inner
Class
+
+
+ protected class DummyAnnotationProcessor implements AnnotationProcessor {
+
+ @Override
+ public void postConstruct(Object instance)
+ throws IllegalAccessException, InvocationTargetException {
+ // Do nothing
+ }
+
+ @Override
+ public void preDestroy(Object instance) throws IllegalAccessException,
+ InvocationTargetException {
+ getInstanceManager().destroyInstance(instance);
+ }
+
+ @Override
+ public void processAnnotations(Object instance)
+ throws IllegalAccessException, InvocationTargetException,
+ NamingException {
+ getInstanceManager().newInstance(instance);
+ }
+
+ }
+
+
}