Source Code Cross Referenced for HostExpandDeployGenerator.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » server » host » 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 » EJB Server resin 3.1.5 » resin » com.caucho.server.host 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:
030:        package com.caucho.server.host;
031:
032:        import com.caucho.config.Config;
033:        import com.caucho.config.ConfigELContext;
034:        import com.caucho.config.ConfigException;
035:        import com.caucho.config.types.RawString;
036:        import com.caucho.el.EL;
037:        import com.caucho.el.MapVariableResolver;
038:        import com.caucho.log.Log;
039:        import com.caucho.server.deploy.DeployContainer;
040:        import com.caucho.server.deploy.ExpandDeployGenerator;
041:        import com.caucho.vfs.Path;
042:
043:        import javax.el.ELContext;
044:        import javax.el.ELResolver;
045:        import java.util.ArrayList;
046:        import java.util.logging.Level;
047:        import java.util.logging.Logger;
048:
049:        /**
050:         * The generator for the host deploy
051:         */
052:        public class HostExpandDeployGenerator extends
053:                ExpandDeployGenerator<HostController> {
054:            private static final Logger log = Log
055:                    .open(HostExpandDeployGenerator.class);
056:
057:            private final HostExpandDeployGeneratorAdmin _admin = new HostExpandDeployGeneratorAdmin(
058:                    this );
059:
060:            private HostContainer _container;
061:
062:            private ArrayList<HostConfig> _hostDefaults = new ArrayList<HostConfig>();
063:
064:            private String _hostName;
065:
066:            /**
067:             * Creates the new host deploy.
068:             */
069:            public HostExpandDeployGenerator(
070:                    DeployContainer<HostController> container,
071:                    HostContainer hostContainer) {
072:                super (container, hostContainer.getRootDirectory());
073:
074:                _container = hostContainer;
075:            }
076:
077:            /**
078:             * Gets the host container.
079:             */
080:            public HostContainer getContainer() {
081:                return _container;
082:            }
083:
084:            /**
085:             * Sets the host name.
086:             */
087:            public void setHostName(RawString name) {
088:                _hostName = name.getValue();
089:            }
090:
091:            /**
092:             * Gets the host name.
093:             */
094:            public String getHostName() {
095:                return _hostName;
096:            }
097:
098:            /**
099:             * Sets true for a lazy-init.
100:             */
101:            public void setLazyInit(boolean lazyInit) throws ConfigException {
102:                log
103:                        .config("lazy-init is deprecated.  Use <startup>lazy</startup> instead.");
104:                if (lazyInit)
105:                    setStartupMode("lazy");
106:                else
107:                    setStartupMode("automatic");
108:            }
109:
110:            /**
111:             * Adds a default.
112:             */
113:            public void addHostDefault(HostConfig config) {
114:                _hostDefaults.add(config);
115:            }
116:
117:            @Override
118:            protected void initImpl() throws ConfigException {
119:                super .initImpl();
120:            }
121:
122:            @Override
123:            protected void startImpl() throws ConfigException {
124:                super .startImpl();
125:
126:                _admin.register();
127:            }
128:
129:            /**
130:             * Returns the log.
131:             */
132:            protected Logger getLog() {
133:                return log;
134:            }
135:
136:            /**
137:             * Returns the current array of application entries.
138:             */
139:            public HostController createController(String name) {
140:                // server/13g3
141:                if (name.equals(""))
142:                    return null;
143:
144:                /*
145:                if (! isDeployedKey(name))
146:                  return null;
147:                 */
148:
149:                Path rootDirectory = getExpandDirectory().lookup("./" + name);
150:
151:                HostController controller = new HostController(name,
152:                        rootDirectory, _container);
153:
154:                Path jarPath = getArchiveDirectory().lookup(
155:                        "./" + name + ".jar");
156:                controller.setArchivePath(jarPath);
157:
158:                if (rootDirectory.isDirectory()
159:                        && !isValidDirectory(rootDirectory, name))
160:                    return null;
161:                else if (!rootDirectory.isDirectory() && !jarPath.isFile())
162:                    return null;
163:
164:                try {
165:                    String hostName = getHostName();
166:
167:                    if (hostName != null) {
168:                        ELContext parentEnv = Config.getEnvironment();
169:                        ELResolver resolver = new MapVariableResolver(
170:                                controller.getVariableMap());
171:
172:                        ELContext env = new ConfigELContext(resolver);
173:
174:                        controller.setHostName(EL.evalString(hostName, env));
175:                    } else
176:                        controller.setHostName(name);
177:
178:                    controller.addDepend(jarPath);
179:                } catch (Throwable e) {
180:                    log.log(Level.WARNING, e.toString(), e);
181:
182:                    controller.setConfigException(e);
183:                }
184:
185:                return controller;
186:            }
187:
188:            /**
189:             * Adds configuration to the current controller
190:             */
191:            protected HostController mergeController(HostController controller,
192:                    String key) {
193:                try {
194:                    controller.setStartupMode(getStartupMode());
195:
196:                    for (int i = 0; i < _hostDefaults.size(); i++)
197:                        controller.addConfigDefault(_hostDefaults.get(i));
198:                } catch (ConfigException e) {
199:                    log.warning(e.toString());
200:                    log.log(Level.FINER, e.toString(), e);
201:
202:                    controller.setConfigException(e);
203:                } catch (Throwable e) {
204:                    log.log(Level.WARNING, e.toString(), e);
205:
206:                    controller.setConfigException(e);
207:                }
208:
209:                return controller;
210:            }
211:
212:            @Override
213:            protected void destroyImpl() {
214:                _admin.unregister();
215:
216:                super .destroyImpl();
217:            }
218:
219:            public boolean equals(Object o) {
220:                if (o == null || !getClass().equals(o.getClass()))
221:                    return false;
222:
223:                HostExpandDeployGenerator deploy = (HostExpandDeployGenerator) o;
224:
225:                Path expandPath = getExpandDirectory();
226:                Path deployExpandPath = deploy.getExpandDirectory();
227:                if (expandPath != deployExpandPath
228:                        && (expandPath == null || !expandPath
229:                                .equals(deployExpandPath)))
230:                    return false;
231:
232:                return true;
233:            }
234:
235:            public String toString() {
236:                return "HostExpandDeployGenerator[" + getExpandDirectory()
237:                        + "]";
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.