Source Code Cross Referenced for AbstractOrionContainer.java in  » Testing » jakarta-cactus » org » apache » cactus » integration » ant » container » orion » 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 » Testing » jakarta cactus » org.apache.cactus.integration.ant.container.orion 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * ========================================================================
003:         * 
004:         * Copyright 2003 The Apache Software Foundation.
005:         *
006:         * Licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         * 
010:         *   http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         * 
018:         * ========================================================================
019:         */
020:        package org.apache.cactus.integration.ant.container.orion;
021:
022:        import java.io.File;
023:        import java.io.IOException;
024:
025:        import org.apache.cactus.integration.ant.container.AbstractJavaContainer;
026:        import org.apache.cactus.integration.ant.util.ResourceUtils;
027:        import org.apache.tools.ant.BuildException;
028:        import org.apache.tools.ant.taskdefs.Java;
029:        import org.apache.tools.ant.types.FileSet;
030:        import org.apache.tools.ant.types.FilterChain;
031:        import org.apache.tools.ant.types.Path;
032:        import org.apache.tools.ant.util.FileUtils;
033:
034:        /**
035:         * Basic support for the Orin application server.
036:         * 
037:         * @version $Id: AbstractOrionContainer.java 239130 2005-01-29 15:49:18Z vmassol $
038:         */
039:        public abstract class AbstractOrionContainer extends
040:                AbstractJavaContainer {
041:
042:            // Instance Variables ------------------------------------------------------
043:
044:            /**
045:             * The Orion 1.x installation directory.
046:             */
047:            private File dir;
048:
049:            /**
050:             * The port to which the container should be bound.
051:             */
052:            private int port = 8080;
053:
054:            /**
055:             * The temporary directory from which the container will be started.
056:             */
057:            private File tmpDir;
058:
059:            // Public Methods ----------------------------------------------------------
060:
061:            /**
062:             * Sets the Orion installation directory.
063:             * 
064:             * @param theDir The directory to set
065:             */
066:            public final void setDir(File theDir) {
067:                this .dir = theDir;
068:            }
069:
070:            /**
071:             * Sets the port to which the container should listen.
072:             * 
073:             * @param thePort The port to set
074:             */
075:            public final void setPort(int thePort) {
076:                this .port = thePort;
077:            }
078:
079:            /**
080:             * Sets the temporary directory from which to start the container.
081:             * 
082:             * @param theTmpDir The directory to set
083:             */
084:            public final void setTmpDir(File theTmpDir) {
085:                this .tmpDir = theTmpDir;
086:            }
087:
088:            // AbstractContainer Implementation ----------------------------------------
089:
090:            /**
091:             * Returns the port to which the container should listen.
092:             * 
093:             * @return The port
094:             */
095:            public final int getPort() {
096:                return this .port;
097:            }
098:
099:            /**
100:             * @see org.apache.cactus.integration.ant.container.Container#init
101:             */
102:            public final void init() {
103:                if (!this .dir.isDirectory()) {
104:                    throw new BuildException(this .dir + " is not a directory");
105:                }
106:            }
107:
108:            /**
109:             * @see org.apache.cactus.integration.ant.container.Container#shutDown
110:             */
111:            public final void shutDown() {
112:                // invoke the main class
113:                Java java = createJavaForShutDown();
114:                Path classpath = java.createClasspath();
115:                FileSet fileSet = new FileSet();
116:                fileSet.setDir(this .dir);
117:                fileSet.createInclude().setName("*.jar");
118:                classpath.addFileset(fileSet);
119:                java
120:                        .setClassname("com.evermind.client.orion.OrionConsoleAdmin");
121:                java.createArg().setValue(
122:                        "ormi://" + this .getServer() + ":23791/");
123:                java.createArg().setValue("admin");
124:                java.createArg().setValue("password");
125:                java.createArg().setValue("-shutdown");
126:                java.execute();
127:            }
128:
129:            // Private Methods ---------------------------------------------------------
130:
131:            /**
132:             * Invokes the command to start the Orion application server.
133:             */
134:            protected final void invokeServer() {
135:                // invoke the main class
136:                Java java = createJavaForStartUp();
137:                Path classpath = java.createClasspath();
138:                FileSet fileSet = new FileSet();
139:                fileSet.setDir(this .dir);
140:                fileSet.createInclude().setName("*.jar");
141:                classpath.addFileset(fileSet);
142:                addToolsJarToClasspath(classpath);
143:                java.setClassname("com.evermind.server.ApplicationServer");
144:                java.createArg().setValue("-config");
145:                java.createArg().setFile(new File(tmpDir, "conf/server.xml"));
146:                java.execute();
147:            }
148:
149:            /**
150:             * Prepares a temporary installation of the container and deploys the 
151:             * web-application.
152:             * 
153:             * @param theResourcePrefix The prefix to use when looking up container
154:             *        resource in the JAR
155:             * @param theDirName The name of the temporary container installation
156:             *        directory
157:             * @throws IOException If an I/O error occurs
158:             */
159:            protected final void prepare(String theResourcePrefix,
160:                    String theDirName) throws IOException {
161:                FileUtils fileUtils = FileUtils.newFileUtils();
162:                FilterChain filterChain = createFilterChain();
163:
164:                this .tmpDir = setupTempDirectory(this .tmpDir, theDirName);
165:                cleanTempDirectory(this .tmpDir);
166:
167:                // Copy configuration files into the temporary container directory
168:
169:                File confDir = createDirectory(tmpDir, "conf");
170:
171:                // Configuration files are not the same whether we deploy a 
172:                // WAR or an EAR
173:                String sharePath = RESOURCE_PATH + theResourcePrefix + "/share";
174:                String specificPath;
175:                if (getDeployableFile().isWar()) {
176:                    specificPath = RESOURCE_PATH + theResourcePrefix + "/war";
177:                } else {
178:                    specificPath = RESOURCE_PATH + theResourcePrefix + "/ear";
179:                }
180:
181:                ResourceUtils.copyResource(getProject(), specificPath
182:                        + "/server.xml", new File(confDir, "server.xml"),
183:                        filterChain);
184:                ResourceUtils.copyResource(getProject(), specificPath
185:                        + "/application.xml", new File(confDir,
186:                        "application.xml"), filterChain);
187:                ResourceUtils.copyResource(getProject(), specificPath
188:                        + "/default-web-site.xml", new File(confDir,
189:                        "default-web-site.xml"), filterChain);
190:
191:                ResourceUtils.copyResource(getProject(), sharePath
192:                        + "/global-web-application.xml", new File(confDir,
193:                        "global-web-application.xml"), filterChain);
194:                ResourceUtils.copyResource(getProject(), sharePath
195:                        + "/mime.types", new File(confDir, "mime.types"),
196:                        filterChain);
197:                ResourceUtils.copyResource(getProject(), sharePath
198:                        + "/principals.xml",
199:                        new File(confDir, "principals.xml"), filterChain);
200:                ResourceUtils.copyResource(getProject(),
201:                        sharePath + "/rmi.xml", new File(confDir, "rmi.xml"),
202:                        filterChain);
203:
204:                // Create default web app (required by Orion unfortunately...)
205:                File defaultWebAppDir = createDirectory(tmpDir,
206:                        "default-web-app/WEB-INF");
207:                ResourceUtils.copyResource(getProject(),
208:                        sharePath + "/web.xml", new File(defaultWebAppDir,
209:                                "web.xml"), filterChain);
210:
211:                // Orion need to have a /persistence directory created, otherwise it
212:                // throws an error
213:                createDirectory(tmpDir, "persistence");
214:
215:                // Directory where modules to be deployed are located
216:                File appDir = createDirectory(tmpDir, "applications");
217:
218:                // Deployment directory (i.e. where Orion expands modules)
219:                createDirectory(tmpDir, "application-deployments");
220:
221:                // Orion log directory
222:                createDirectory(tmpDir, "log");
223:
224:                fileUtils.copyFile(getDeployableFile().getFile(), new File(
225:                        appDir, getDeployableFile().getFile().getName()), null,
226:                        true);
227:            }
228:
229:        }
ww___w___._j__av__a2_s___._c___o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.