summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/myfaces/META-INF/MANIFEST.MF3
-rw-r--r--java/sca/modules/myfaces/pom.xml7
-rw-r--r--java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationLifecycleProvider.java30
-rw-r--r--java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationProcessor.java17
4 files changed, 29 insertions, 28 deletions
diff --git a/java/sca/modules/myfaces/META-INF/MANIFEST.MF b/java/sca/modules/myfaces/META-INF/MANIFEST.MF
index 7a89c80b5c..01cdcc8214 100644
--- a/java/sca/modules/myfaces/META-INF/MANIFEST.MF
+++ b/java/sca/modules/myfaces/META-INF/MANIFEST.MF
@@ -14,8 +14,7 @@ Import-Package: javax.naming,
org.apache.myfaces.config.annotation;version="1.2.2",
org.apache.myfaces.shared_impl.util;version="1.2.2",
org.apache.tuscany.sca.node.impl;version="2.0",
- org.apache.tuscany.sca.implementation.web.runtime.utils;version="2.0",
- org.apache;version="6.0.18"
+ org.apache.tuscany.sca.implementation.web.runtime.utils;version="2.0"
Bundle-SymbolicName: org.apache.tuscany.sca.myfaces
Bundle-DocURL: http://www.apache.org/
diff --git a/java/sca/modules/myfaces/pom.xml b/java/sca/modules/myfaces/pom.xml
index 7e85f8bb14..288e996ce7 100644
--- a/java/sca/modules/myfaces/pom.xml
+++ b/java/sca/modules/myfaces/pom.xml
@@ -58,13 +58,6 @@
</dependency>
<dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>catalina</artifactId>
- <version>6.0.18</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
diff --git a/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationLifecycleProvider.java b/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationLifecycleProvider.java
index 8f9000ffe6..c98366d033 100644
--- a/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationLifecycleProvider.java
+++ b/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationLifecycleProvider.java
@@ -26,34 +26,44 @@ import javax.faces.context.ExternalContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
-import org.apache.AnnotationProcessor;
import org.apache.myfaces.config.annotation.DiscoverableLifecycleProvider;
-import org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider;
import org.apache.myfaces.shared_impl.util.ClassUtils;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-public class TuscanyAnnotationLifecycleProvider extends TomcatAnnotationLifecycleProvider implements DiscoverableLifecycleProvider {
+public class TuscanyAnnotationLifecycleProvider implements DiscoverableLifecycleProvider {
private static final Logger logger = Logger.getLogger(TuscanyAnnotationLifecycleProvider.class.getName());
private TuscanyAnnotationProcessor annotationProcessor;
private ServletContext servletContext;
+
public TuscanyAnnotationLifecycleProvider(ExternalContext externalContext) {
- super(externalContext);
this.servletContext = (ServletContext)externalContext.getContext();
- AnnotationProcessor ap = (org.apache.AnnotationProcessor)servletContext.getAttribute(org.apache.AnnotationProcessor.class.getName());
- annotationProcessor = new TuscanyAnnotationProcessor(ap);
+
+ // TODO: Should this use any existing AnnotationProcessor?
+ // Tomcat based runtimes may use an org.apache.AnnotationProcessor which
+ // if exists this could delegate to so as to support both SCA and other annotations
+ // AnnotationProcessor existingAnnotationProcessor = (AnnotationProcessor)
+ // servletContext.getAttribute(org.apache.AnnotationProcessor.class.getName());
+ // annotationProcessor = new TuscanyAnnotationProcessor(existingAnnotationProcessor);
+ annotationProcessor = new TuscanyAnnotationProcessor();
}
public Object newInstance(String className) throws InstantiationException, IllegalAccessException, InvocationTargetException, NamingException, ClassNotFoundException {
-
- Class<?> clazz = ClassUtils.classForName(className);
logger.info("Creating instance of " + className);
+ Class<?> clazz = ClassUtils.classForName(className);
Object object = clazz.newInstance();
annotationProcessor.processAnnotations(object, servletContext);
annotationProcessor.postConstruct(object);
-
return object;
}
+ public boolean isAvailable() {
+ return true;
+ }
+
+ public void destroyInstance(Object o) throws IllegalAccessException, InvocationTargetException {
+ logger.info("Destroy instance of " + o.getClass().getName());
+ annotationProcessor.preDestroy(o);
+ }
+
}
diff --git a/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationProcessor.java b/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationProcessor.java
index bd9b19fd8c..bd0ead8087 100644
--- a/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationProcessor.java
+++ b/java/sca/modules/myfaces/src/main/java/org/apache/tuscany/myfaces/TuscanyAnnotationProcessor.java
@@ -24,31 +24,30 @@ import java.lang.reflect.InvocationTargetException;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
-import org.apache.AnnotationProcessor;
import org.apache.tuscany.sca.implementation.web.runtime.utils.ContextHelper;
-public class TuscanyAnnotationProcessor implements org.apache.AnnotationProcessor {
+//public class TuscanyAnnotationProcessor implements org.apache.AnnotationProcessor {
+public class TuscanyAnnotationProcessor {
- org.apache.AnnotationProcessor annotationProcessor;
+// private AnnotationProcessor annotationProcessor;
- public TuscanyAnnotationProcessor(AnnotationProcessor annotationProcessor) {
- this.annotationProcessor = annotationProcessor;
+ public TuscanyAnnotationProcessor() {
}
public void postConstruct(Object arg0) throws IllegalAccessException, InvocationTargetException {
- annotationProcessor.postConstruct(arg0);
+// annotationProcessor.postConstruct(arg0);
}
public void preDestroy(Object arg0) throws IllegalAccessException, InvocationTargetException {
- annotationProcessor.preDestroy(arg0);
+// annotationProcessor.preDestroy(arg0);
}
public void processAnnotations(Object arg0, ServletContext servletContext) throws IllegalAccessException, InvocationTargetException, NamingException {
ContextHelper.inject(arg0, servletContext);
- annotationProcessor.processAnnotations(arg0);
+// annotationProcessor.processAnnotations(arg0);
}
public void processAnnotations(Object arg0) throws IllegalAccessException, InvocationTargetException, NamingException {
- annotationProcessor.processAnnotations(arg0);
+// annotationProcessor.processAnnotations(arg0);
}
}