KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > server > e_app > ApplicationConfig


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.server.e_app;
31
32 import com.caucho.config.ConfigException;
33 import com.caucho.util.L10N;
34 import com.caucho.vfs.Path;
35
36 import java.util.ArrayList JavaDoc;
37
38 /**
39  * Configuration for the application.xml file.
40  */

41 public class ApplicationConfig {
42   private static final L10N L = new L10N(ApplicationConfig.class);
43   
44   private String JavaDoc _displayName;
45   private String JavaDoc _description;
46   
47   private ArrayList JavaDoc<WebModule> _webModules = new ArrayList JavaDoc<WebModule>();
48   private ArrayList JavaDoc<Path> _ejbModules = new ArrayList JavaDoc<Path>();
49   private ArrayList JavaDoc<Path> _javaModules = new ArrayList JavaDoc<Path>();
50   private ArrayList JavaDoc<String JavaDoc> _connectorModules = new ArrayList JavaDoc<String JavaDoc>();
51   private ArrayList JavaDoc<String JavaDoc> _altDDModules = new ArrayList JavaDoc<String JavaDoc>();
52
53   /**
54    * Sets the root directory.
55    */

56   public ApplicationConfig()
57   {
58   }
59   
60   /**
61    * Sets the id
62    */

63   public void setId(String JavaDoc id)
64   {
65   }
66   
67   /**
68    * Sets the application version.
69    */

70   public void setVersion(String JavaDoc version)
71   {
72   }
73   
74   /**
75    * Sets the schema location
76    */

77   public void setSchemaLocation(String JavaDoc schema)
78   {
79   }
80
81   /**
82    * Sets the display name.
83    */

84   public void setDisplayName(String JavaDoc name)
85   {
86     _displayName = name;
87   }
88
89   /**
90    * Sets the description.
91    */

92   public void setDescription(String JavaDoc description)
93   {
94     _description = description;
95   }
96
97   /**
98    * Sets the icon.
99    */

100   public void setIcon(Icon icon)
101   {
102   }
103   
104   /**
105    * Adds a module.
106    */

107   public Module createModule()
108   {
109     return new Module();
110   }
111
112   /**
113    * Adds a security role.
114    */

115   public void addSecurityRole(SecurityRole role)
116   {
117   }
118
119   /**
120    * Returns the web modules.
121    */

122   ArrayList JavaDoc<WebModule> getWebModules()
123   {
124     return _webModules;
125   }
126
127   /**
128    * Returns the ejb modules.
129    */

130   ArrayList JavaDoc<Path> getEjbModules()
131   {
132     return _ejbModules;
133   }
134
135   /**
136    * Returns the application client module.
137    */

138   ArrayList JavaDoc<Path> getJavaModules()
139   {
140     return _javaModules;
141   }
142
143   public class Module {
144     private String JavaDoc _id;
145
146     /**
147      * Sets the module id.
148      */

149     public void setId(String JavaDoc id)
150     {
151       _id = id;
152     }
153     
154     /**
155      * Creates a new web module.
156      */

157     public void addWeb(WebModule web)
158     {
159       _webModules.add(web);
160
161     }
162     
163     /**
164      * Adds a new ejb module.
165      */

166     public void addEjb(Path path)
167     {
168       _ejbModules.add(path);
169     }
170     
171     /**
172      * Adds a new java module.
173      */

174     public void addJava(Path path)
175       throws ConfigException
176     {
177       if (! path.canRead())
178     throw new ConfigException(L.l("<java> module {0} must be a valid path.",
179                       path));
180       
181       _javaModules.add(path);
182     }
183     
184     /**
185      * Adds a new connector
186      */

187     public void addConnector(String JavaDoc path)
188     {
189       _connectorModules.add(path);
190     }
191     
192     /**
193      * Adds a new alt-dd module.
194      */

195     public void addAltDD(String JavaDoc path)
196     {
197       _altDDModules.add(path);
198     }
199   }
200 }
201
Popular Tags