Source Code Cross Referenced for Jetty6RunMojo.java in  » Sevlet-Container » jetty-modules » org » mortbay » jetty » plugin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » jetty modules » org.mortbay.jetty.plugin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //========================================================================
002:        //$Id: Jetty6RunMojo.java 669 2006-07-10 10:51:55Z janb $
003:        //Copyright 2000-2004 Mort Bay Consulting Pty. Ltd.
004:        //------------------------------------------------------------------------
005:        //Licensed under the Apache License, Version 2.0 (the "License");
006:        //you may not use this file except in compliance with the License.
007:        //You may obtain a copy of the License at 
008:        //http://www.apache.org/licenses/LICENSE-2.0
009:        //Unless required by applicable law or agreed to in writing, software
010:        //distributed under the License is distributed on an "AS IS" BASIS,
011:        //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        //See the License for the specific language governing permissions and
013:        //limitations under the License.
014:        //========================================================================
015:
016:        package org.mortbay.jetty.plugin;
017:
018:        import java.io.File;
019:
020:        import org.apache.maven.plugin.MojoExecutionException;
021:        import org.apache.maven.plugin.MojoFailureException;
022:        import org.mortbay.jetty.Connector;
023:        import org.mortbay.jetty.Handler;
024:        import org.mortbay.jetty.RequestLog;
025:        import org.mortbay.jetty.Server;
026:        import org.mortbay.jetty.handler.ContextHandler;
027:        import org.mortbay.jetty.handler.ContextHandlerCollection;
028:        import org.mortbay.jetty.handler.HandlerCollection;
029:        import org.mortbay.jetty.plugin.util.JettyPluginServer;
030:        import org.mortbay.jetty.security.UserRealm;
031:        import org.mortbay.xml.XmlConfiguration;
032:
033:        /**
034:         *  <p>
035:         *  This goal is used in-situ on a Maven project without first requiring that the project 
036:         *  is assembled into a war, saving time during the development cycle.
037:         *  The plugin forks a parallel lifecycle to ensure that the "compile" phase has been completed before invoking Jetty. This means
038:         *  that you do not need to explicity execute a "mvn compile" first. It also means that a "mvn clean jetty:run" will ensure that
039:         *  a full fresh compile is done before invoking Jetty.
040:         *  </p>
041:         *  <p>
042:         *  Once invoked, the plugin can be configured to run continuously, scanning for changes in the project and automatically performing a 
043:         *  hot redeploy when necessary. This allows the developer to concentrate on coding changes to the project using their IDE of choice and have those changes
044:         *  immediately and transparently reflected in the running web container, eliminating development time that is wasted on rebuilding, reassembling and redeploying.
045:         *  </p>
046:         *  <p>
047:         *  You may also specify the location of a jetty.xml file whose contents will be applied before any plugin configuration.
048:         *  This can be used, for example, to deploy a static webapp that is not part of your maven build. 
049:         *  </p>
050:         *  <p>
051:         *  There is a <a href="run-mojo.html">reference guide</a> to the configuration parameters for this plugin, and more detailed information
052:         *  with examples in the <a href="howto.html">Configuration How-To</a>.
053:         *  </p>
054:         * @author janb
055:         * 
056:         * @goal run
057:         * @requiresDependencyResolution runtime
058:         * @execute phase="compile"
059:         * @description Runs jetty6 directly from a maven project
060:         */
061:        public class Jetty6RunMojo extends AbstractJettyRunMojo {
062:
063:            /**
064:             * List of connectors to use. If none are configured
065:             * then we use a single SelectChannelConnector at port 8080
066:             * 
067:             * @parameter 
068:             */
069:            private Connector[] connectors;
070:
071:            /**
072:             * List of other contexts to set up. Optional.
073:             * @parameter
074:             */
075:            private ContextHandler[] contextHandlers;
076:
077:            /**
078:             * List of security realms to set up. Optional.
079:             * @parameter
080:             */
081:            private UserRealm[] userRealms;
082:
083:            /**
084:             * A RequestLog implementation to use for the webapp at runtime.
085:             * Optional.
086:             * @parameter
087:             */
088:            private RequestLog requestLog;
089:
090:            public Object getConfiguredRequestLog() {
091:                return this .requestLog;
092:            }
093:
094:            /**
095:             * 
096:             * 
097:             * @see org.mortbay.jetty.plugin.AbstractJettyRunMojo#getConfiguredConnectors()
098:             */
099:            public Object[] getConfiguredConnectors() {
100:                return this .connectors;
101:            }
102:
103:            /**
104:             * 
105:             * 
106:             * @see org.mortbay.jetty.plugin.AbstractJettyRunMojo#getConfiguredUserRealms()
107:             */
108:            public Object[] getConfiguredUserRealms() {
109:                return this .userRealms;
110:            }
111:
112:            /**
113:             * @return Returns the contextHandlers.
114:             */
115:            public ContextHandler[] getConfiguredContextHandlers() {
116:                return this .contextHandlers;
117:            }
118:
119:            /**
120:             *
121:             * 
122:             * @see org.mortbay.jetty.plugin.AbstractJettyRunMojo#createServer()
123:             */
124:            public JettyPluginServer createServer() {
125:                return new Jetty6PluginServer();
126:            }
127:
128:            public void finishConfigurationBeforeStart() throws Exception {
129:                Handler[] handlers = getConfiguredContextHandlers();
130:                JettyPluginServer plugin = getServer();
131:                Server server = (Server) plugin.getProxiedObject();
132:
133:                HandlerCollection contexts = (HandlerCollection) server
134:                        .getChildHandlerByClass(ContextHandlerCollection.class);
135:                if (contexts == null)
136:                    contexts = (HandlerCollection) server
137:                            .getChildHandlerByClass(HandlerCollection.class);
138:
139:                for (int i = 0; (handlers != null) && (i < handlers.length); i++) {
140:                    contexts.addHandler(handlers[i]);
141:                }
142:            }
143:
144:            public void applyJettyXml() throws Exception {
145:                if (getJettyXmlFileName() == null)
146:                    return;
147:
148:                getLog().info(
149:                        "Configuring Jetty from xml configuration file = "
150:                                + getJettyXmlFileName());
151:                File f = new File(getJettyXmlFileName());
152:                XmlConfiguration xmlConfiguration = new XmlConfiguration(f
153:                        .toURL());
154:                xmlConfiguration.configure(getServer().getProxiedObject());
155:            }
156:
157:            public void execute() throws MojoExecutionException,
158:                    MojoFailureException {
159:                super.execute();
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.