KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > server > ServerConfig


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: ServerConfig.java 1121 2006-09-27 08:51:06Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.server;
27
28 import java.io.File JavaDoc;
29 import java.util.ArrayList JavaDoc;
30 import java.util.List JavaDoc;
31
32 /**
33  * Defines a configuration class that can be used to start the embedded EJB3 server.
34  * @author Florent Benoit
35  */

36 public class ServerConfig {
37
38     /**
39      * Path where to lookup beans.
40      */

41     private File JavaDoc ejb3Directory = null;
42
43
44     /**
45      * Wait at the end of the start.
46      */

47     private boolean shouldWait = true;
48
49     /**
50      * Init JACC at startup ?
51      */

52     private boolean initJACC = true;
53
54
55     /**
56      * Use of MBeans.
57      */

58     private boolean useMBeans = true;
59
60     /**
61      * use EasyBeans naming mechanism or one of the embedded server.
62      */

63     private boolean useNaming = true;
64
65     /**
66      * {@link EasyBeansConfigurationExtension} classname list.
67      */

68     private List JavaDoc<String JavaDoc> extensionFactories = new ArrayList JavaDoc<String JavaDoc>();
69
70     /**
71      * Is the Directory scanning activated.
72      */

73     private boolean directoryScanningEnabled = true;
74
75
76     /**
77      * @return the path for loading/looking beans.
78      */

79     public File JavaDoc getEjb3Directory() {
80         return ejb3Directory;
81     }
82
83     /**
84      * Sets the path forloading/looking beans.
85      * @param ejb3Path the path for loading beans.
86      */

87     public void setEjb3Path(final String JavaDoc ejb3Path) {
88         this.ejb3Directory = new File JavaDoc(ejb3Path);
89         if (!ejb3Directory.exists()) {
90             throw new IllegalArgumentException JavaDoc("Path '" + ejb3Path + "' doesn't exists.");
91         }
92     }
93
94
95     /**
96      * @return true if the server should wait when starting embedded server.
97      */

98     public boolean shouldWait() {
99         return shouldWait;
100     }
101
102     /**
103      * Sets if the server will loop at the end of it's startup.
104      * @param shouldWait true/false
105      */

106     public void setShouldWait(final boolean shouldWait) {
107         this.shouldWait = shouldWait;
108     }
109
110
111     /**
112      * Use or not the MBeans.
113      * @return true if this is the case.
114      */

115     public boolean isUsingMBeans() {
116         return useMBeans;
117     }
118
119     /**
120      * Sets the value for using MBeans.
121      * @param useMBeans the boolean value.
122      */

123     public void setUseMBeans(final boolean useMBeans) {
124         this.useMBeans = useMBeans;
125     }
126
127     /**
128      * Use or not the EasyBeans naming system.
129      * @return true if this is the case.
130      */

131     public boolean isUsingNaming() {
132         return useNaming;
133     }
134
135     /**
136      * Sets the value for using the EasyBeans naming system.
137      * @param useNaming the boolean value.
138      */

139     public void setUseNaming(final boolean useNaming) {
140         this.useNaming = useNaming;
141     }
142
143     /**
144      * Adds an {@link EasyBeansConfigurationExtension} in the Facory list.
145      * @param extension the factory FQN.
146      */

147     public void addExtensionFactory(final String JavaDoc extension) {
148         this.extensionFactories.add(extension);
149     }
150
151     /**
152      * @return Returns the list of {@link EasyBeansConfigurationExtension}.
153      */

154     public List JavaDoc<String JavaDoc> getExtensionFactories() {
155         return this.extensionFactories;
156     }
157
158     /**
159      * @return the directoryScanningEnabled
160      */

161     public boolean isDirectoryScanningEnabled() {
162         return directoryScanningEnabled;
163     }
164
165     /**
166      * @param directoryScanningEnabled the directoryScanningEnabled to set
167      */

168     public void setDirectoryScanningEnabled(final boolean directoryScanningEnabled) {
169         this.directoryScanningEnabled = directoryScanningEnabled;
170     }
171
172     /**
173      * Init or not JACC at startup.
174      * @param initJACC initialization of JACC provider.
175      */

176     public void setInitJACC(final boolean initJACC) {
177         this.initJACC = initJACC;
178     }
179
180     /**
181      * @return true if JACC provider needs to be initialized at startup.
182      */

183     public boolean initJACC() {
184         return initJACC;
185     }
186 }
187
Popular Tags