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.e_app;
031:
032: import com.caucho.config.ConfigException;
033: import com.caucho.util.L10N;
034: import com.caucho.vfs.Path;
035:
036: import java.util.ArrayList;
037:
038: /**
039: * Configuration for the application.xml file.
040: */
041: public class ApplicationConfig {
042: private static final L10N L = new L10N(ApplicationConfig.class);
043:
044: private String _displayName;
045: private String _description;
046:
047: private ArrayList<WebModule> _webModules = new ArrayList<WebModule>();
048: private ArrayList<Path> _ejbModules = new ArrayList<Path>();
049: private ArrayList<Path> _javaModules = new ArrayList<Path>();
050: private ArrayList<String> _connectorModules = new ArrayList<String>();
051: private ArrayList<String> _altDDModules = new ArrayList<String>();
052:
053: /**
054: * Sets the root directory.
055: */
056: public ApplicationConfig() {
057: }
058:
059: /**
060: * Sets the id
061: */
062: public void setId(String id) {
063: }
064:
065: /**
066: * Sets the application version.
067: */
068: public void setVersion(String version) {
069: }
070:
071: /**
072: * Sets the schema location
073: */
074: public void setSchemaLocation(String schema) {
075: }
076:
077: /**
078: * Sets the display name.
079: */
080: public void setDisplayName(String name) {
081: _displayName = name;
082: }
083:
084: /**
085: * Sets the description.
086: */
087: public void setDescription(String description) {
088: _description = description;
089: }
090:
091: /**
092: * Sets the icon.
093: */
094: public void setIcon(Icon icon) {
095: }
096:
097: /**
098: * Adds a module.
099: */
100: public Module createModule() {
101: return new Module();
102: }
103:
104: /**
105: * Adds a security role.
106: */
107: public void addSecurityRole(SecurityRole role) {
108: }
109:
110: /**
111: * Returns the web modules.
112: */
113: ArrayList<WebModule> getWebModules() {
114: return _webModules;
115: }
116:
117: /**
118: * Returns the ejb modules.
119: */
120: ArrayList<Path> getEjbModules() {
121: return _ejbModules;
122: }
123:
124: /**
125: * Returns the application client module.
126: */
127: ArrayList<Path> getJavaModules() {
128: return _javaModules;
129: }
130:
131: public class Module {
132: private String _id;
133:
134: /**
135: * Sets the module id.
136: */
137: public void setId(String id) {
138: _id = id;
139: }
140:
141: /**
142: * Creates a new web module.
143: */
144: public void addWeb(WebModule web) {
145: _webModules.add(web);
146:
147: }
148:
149: /**
150: * Adds a new ejb module.
151: */
152: public void addEjb(Path path) {
153: _ejbModules.add(path);
154: }
155:
156: /**
157: * Adds a new java module.
158: */
159: public void addJava(Path path) throws ConfigException {
160: if (!path.canRead())
161: throw new ConfigException(L
162: .l("<java> module {0} must be a valid path.",
163: path));
164:
165: _javaModules.add(path);
166: }
167:
168: /**
169: * Adds a new connector
170: */
171: public void addConnector(String path) {
172: _connectorModules.add(path);
173: }
174:
175: /**
176: * Adds a new alt-dd module.
177: */
178: public void addAltDD(String path) {
179: _altDDModules.add(path);
180: }
181: }
182: }
|