01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.tomcat;
17:
18: import org.apache.catalina.Context;
19: import org.apache.catalina.Lifecycle;
20: import org.apache.catalina.startup.ContextConfig;
21: import org.apache.catalina.startup.Embedded;
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24: import org.apache.geronimo.webservices.WebServiceContainer;
25:
26: /**
27: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
28: */
29: public class TomcatGeronimoEmbedded extends Embedded {
30:
31: private static final Log log = LogFactory
32: .getLog(TomcatGeronimoEmbedded.class);
33:
34: public Context createContext(String path, String docBase,
35: ClassLoader cl) {
36:
37: if (log.isDebugEnabled())
38: log.debug("Creating context '" + path + "' with docBase '"
39: + docBase + "'");
40:
41: GeronimoStandardContext context = new GeronimoStandardContext();
42:
43: context.setDocBase(docBase);
44: context.setPath(path);
45:
46: if (cl != null)
47: context.setParentClassLoader(cl);
48:
49: ContextConfig config = new ContextConfig();
50: config.setCustomAuthenticators(authenticators);
51: ((Lifecycle) context).addLifecycleListener(config);
52:
53: context.setDelegate(true);
54: return (context);
55:
56: }
57:
58: public Context createEJBWebServiceContext(String contextPath,
59: WebServiceContainer webServiceContainer,
60: String securityRealmName, String realmName,
61: String transportGuarantee, String authMethod,
62: ClassLoader classLoader) {
63:
64: if (log.isDebugEnabled())
65: log.debug("Creating EJBWebService context '" + contextPath
66: + "'.");
67:
68: TomcatEJBWebServiceContext context = new TomcatEJBWebServiceContext(
69: contextPath, webServiceContainer, securityRealmName,
70: realmName, transportGuarantee, authMethod, classLoader);
71:
72: ContextConfig config = new ContextConfig();
73: config.setCustomAuthenticators(authenticators);
74: ((Lifecycle) context).addLifecycleListener(config);
75:
76: return (context);
77:
78: }
79:
80: }
|