summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/distribution/tomcat
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-06 10:36:27 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-06 10:36:27 +0000
commit6f59e2b8ff7510241f4abb6fbe1f8b158ebeca33 (patch)
treead0d993372bcf494210770f1610173b42f051f18 /sca-java-2.x/trunk/distribution/tomcat
parente683e1408e610457f280e8c7efa301ecd104bbee (diff)
Remove all the old Tuscany cofig code from the TuscanyContext as its now done from the conf/tuscany-web.xml file
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@887659 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/distribution/tomcat')
-rw-r--r--sca-java-2.x/trunk/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java55
1 files changed, 6 insertions, 49 deletions
diff --git a/sca-java-2.x/trunk/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java b/sca-java-2.x/trunk/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
index 5e9b5d90e5..2a8e066b94 100644
--- a/sca-java-2.x/trunk/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
+++ b/sca-java-2.x/trunk/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
@@ -30,7 +30,6 @@ import javax.naming.NamingException;
import org.apache.catalina.Loader;
import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.deploy.FilterDef;
/**
* A Tuscany StandardContext to initilize SCA applications.
@@ -42,14 +41,10 @@ public class TuscanyStandardContext extends StandardContext {
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(TuscanyStandardContext.class.getName());
- protected static final String TUSCANY_FILTER_NAME = "TuscanyFilter";
- protected static final String TUSCANY_SERVLET_FILTER = "org.apache.tuscany.sca.host.webapp.TuscanyServletFilter";
- protected static final String TUSCANY_CONTEXT_LISTENER = "org.apache.tuscany.sca.host.webapp.TuscanyContextListener";
- protected static final String TUSCANY_MANAGER_LISTENER = "org.apache.tuscany.sca.tomcat.foo.TuscanyTomcatNode";
-
private boolean isSCAApp;
// TODO: this gives an instance per webapp, work out how to have only one per server
+ // ?? is that comment still true?
private static URLClassLoader tuscanyClassLoader;
/**
@@ -66,15 +61,9 @@ public class TuscanyStandardContext extends StandardContext {
}
ClassLoader parent = getParentClassLoader();
- if (isSCAApp = isSCAApplication() || isTuscanyManager()) {
- String sharedProp = System.getProperty(TuscanyLifecycleListener.TUSCANY_SHARED_PROP, "false");
- boolean shared = "true".equalsIgnoreCase(sharedProp);
- if (!shared) {
- setParentClassLoader(copy(getTuscanyClassloader(parent)));
- } else {
- // The default parent classloader is the one for the webapp
- setParentClassLoader(getTuscanyClassloader(parent));
- }
+ if (isSCAApp = isSCAApplication()) {
+ setParentClassLoader(getTuscanyClassloader(parent));
+ setDefaultWebXml("conf/tuscany-web.xml");
}
return super.getLoader();
@@ -82,11 +71,7 @@ public class TuscanyStandardContext extends StandardContext {
@Override
public boolean listenerStart() {
- if (isTuscanyManager()) {
- // this isn't great having the manager app config scattered about different modules
- // but is temp until this is all tidied up in a refactor after the basics are working
- addApplicationListener(TUSCANY_MANAGER_LISTENER);
- } else if (isSCAApp) {
+ if (isSCAApp) {
enableTuscany();
}
return super.listenerStart();
@@ -94,27 +79,6 @@ public class TuscanyStandardContext extends StandardContext {
private void enableTuscany() {
- for (String listener : findApplicationListeners()) {
- if (TUSCANY_CONTEXT_LISTENER.equals(listener)) {
- // The web application already has the context listener configured
- return;
- }
- }
-
- for (FilterDef filterDef : findFilterDefs()) {
- if (TUSCANY_SERVLET_FILTER.equals(filterDef.getFilterClass())) {
- // The web application already has the filter configured
- return;
- }
- }
-
- addApplicationListener(TUSCANY_CONTEXT_LISTENER);
-
- FilterDef filterDef = new FilterDef();
- filterDef.setFilterName(TUSCANY_FILTER_NAME);
- filterDef.setFilterClass(TUSCANY_SERVLET_FILTER);
- addFilterDef(filterDef);
-
if (isUseNaming() && getNamingContextListener() != null) {
setAnnotationProcessor(new TuscanyAnnotationsProcessor(this, getNamingContextListener().getEnvContext()));
} else {
@@ -157,14 +121,6 @@ public class TuscanyStandardContext extends StandardContext {
return true;
}
- private boolean isTuscanyManager() {
- return "/tuscany".equals(getName());
- }
-
- private static URLClassLoader copy(URLClassLoader classLoader) {
- return new URLClassLoader(classLoader.getURLs(), classLoader.getParent());
- }
-
private synchronized URLClassLoader getTuscanyClassloader(ClassLoader parent) {
if (tuscanyClassLoader == null) {
File tuscanyWar = new File(System.getProperty(TuscanyLifecycleListener.TUSCANY_WAR_PROP));
@@ -182,4 +138,5 @@ public class TuscanyStandardContext extends StandardContext {
}
return tuscanyClassLoader;
}
+
}