01: //========================================================================
02: //$Id: AbstractJetty6Mojo.java 669 2006-07-10 10:51:55Z janb $
03: //Copyright 2000-2004 Mort Bay Consulting Pty. Ltd.
04: //------------------------------------------------------------------------
05: //Licensed under the Apache License, Version 2.0 (the "License");
06: //you may not use this file except in compliance with the License.
07: //You may obtain a copy of the License at
08: //http://www.apache.org/licenses/LICENSE-2.0
09: //Unless required by applicable law or agreed to in writing, software
10: //distributed under the License is distributed on an "AS IS" BASIS,
11: //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: //See the License for the specific language governing permissions and
13: //limitations under the License.
14: //========================================================================
15:
16: package org.mortbay.jetty.plugin;
17:
18: import java.io.File;
19:
20: import org.mortbay.jetty.Connector;
21: import org.mortbay.jetty.RequestLog;
22: import org.mortbay.jetty.plugin.util.JettyPluginServer;
23: import org.mortbay.jetty.security.UserRealm;
24: import org.mortbay.xml.XmlConfiguration;
25:
26: /**
27: * AbstractJetty6Mojo
28: *
29: * Base class for all jetty6 mojos.
30: *
31: */
32: public abstract class AbstractJetty6Mojo extends AbstractJettyMojo {
33:
34: /**
35: * List of connectors to use. If none are configured
36: * then we use a single SelectChannelConnector at port 8080
37: *
38: * @parameter
39: */
40: private Connector[] connectors;
41:
42: /**
43: * List of security realms to set up. Optional.
44: * @parameter
45: */
46: private UserRealm[] userRealms;
47:
48: /**
49: * A RequestLog implementation to use for the webapp at runtime.
50: * Optional.
51: * @parameter
52: */
53: private RequestLog requestLog;
54:
55: /**
56: * @see org.mortbay.jetty.plugin.AbstractJettyMojo#getConfiguredUserRealms()
57: */
58: public Object[] getConfiguredUserRealms() {
59: return this .userRealms;
60: }
61:
62: /**
63: * @see org.mortbay.jetty.plugin.AbstractJettyMojo#getConfiguredConnectors()
64: */
65: public Object[] getConfiguredConnectors() {
66: return this .connectors;
67: }
68:
69: public Object getConfiguredRequestLog() {
70: return this .requestLog;
71: }
72:
73: public void applyJettyXml() throws Exception {
74:
75: if (getJettyXmlFileName() == null)
76: return;
77:
78: getLog().info(
79: "Configuring Jetty from xml configuration file = "
80: + getJettyXmlFileName());
81: File f = new File(getJettyXmlFileName());
82: XmlConfiguration xmlConfiguration = new XmlConfiguration(f
83: .toURL());
84: xmlConfiguration.configure(getServer().getProxiedObject());
85: }
86:
87: /**
88: * @see org.mortbay.jetty.plugin.AbstractJettyMojo#createServer()
89: */
90: public JettyPluginServer createServer() throws Exception {
91: return new Jetty6PluginServer();
92: }
93:
94: }
|