Source Code Cross Referenced for OjbConfiguration.java in  » Database-ORM » db-ojb » org » apache » ojb » broker » util » configuration » impl » 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 » Database ORM » db ojb » org.apache.ojb.broker.util.configuration.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.broker.util.configuration.impl;
002:
003:        /* Copyright 2002-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import org.apache.ojb.broker.ManageableCollection;
019:        import org.apache.ojb.broker.PersistenceBroker;
020:        import org.apache.ojb.broker.cache.ObjectCache;
021:        import org.apache.ojb.broker.cache.ObjectCacheDefaultImpl;
022:        import org.apache.ojb.broker.core.PBPoolConfiguration;
023:        import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
024:        import org.apache.ojb.broker.core.PersistenceBrokerImpl;
025:        import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
026:        import org.apache.ojb.broker.core.proxy.IndirectionHandler;
027:        import org.apache.ojb.broker.core.proxy.IndirectionHandlerJDKImpl;
028:        import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl;
029:        import org.apache.ojb.broker.core.proxy.ProxyConfiguration;
030:        import org.apache.ojb.broker.core.proxy.ProxyFactory;
031:        import org.apache.ojb.broker.core.proxy.ProxyFactoryJDKImpl;
032:        import org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl;
033:        import org.apache.ojb.broker.metadata.MetadataConfiguration;
034:        import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
035:        import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl;
036:        import org.apache.ojb.broker.util.pooling.PoolConfiguration;
037:        import org.apache.ojb.odmg.OdmgConfiguration;
038:        import org.apache.ojb.odmg.collections.DListImpl;
039:
040:        /**
041:         * This class contains the runtime configuration of the OJB
042:         * system. This Configuration is read in only once at application startup.
043:         * Changes to the OJB.properties file during execution are <b>not</b>
044:         * reflected back into the application!
045:         *
046:         * @author Thomas Mahler
047:         * @version $Id: OjbConfiguration.java,v 1.35.2.6 2005/12/21 22:28:15 tomdz Exp $
048:         */
049:        public class OjbConfiguration extends ConfigurationAbstractImpl
050:                implements  OdmgConfiguration, PersistenceBrokerConfiguration,
051:                ProxyConfiguration, PBPoolConfiguration, MetadataConfiguration {
052:            /** Default filename of the OJB properties file */
053:            public static final String OJB_PROPERTIES_FILE = "OJB.properties";
054:            /** Default filename of the OJB repository metadata file */
055:            public static final String OJB_METADATA_FILE = "repository.xml";
056:
057:            /** the repository file keeping the O/R Metadata*/
058:            private String repositoryFilename;
059:            private Class objectCacheClass;
060:            private Class persistentFieldClass;
061:            private Class persistenceBrokerClass;
062:
063:            // proxy related classes
064:            private Class listProxyClass;
065:            private Class setProxyClass;
066:            private Class collectionProxyClass;
067:            private Class indirectionHandlerClass;
068:            private Class proxyFactoryClass;
069:
070:            // limit for number of values in SQL IN Statement
071:            private int sqlInLimit;
072:
073:            // PB pooling configuration
074:            private int maxActive;
075:            private int maxIdle;
076:            private long maxWait;
077:            private long timeBetweenEvictionRunsMillis;
078:            private long minEvictableIdleTimeMillis;
079:            private byte whenExhaustedAction;
080:
081:            // ODMG configuration
082:            private boolean useImplicitLocking;
083:            private boolean lockAssociationAsWrites;
084:            private Class oqlCollectionClass;
085:
086:            // Metadata configuration
087:            private boolean useSerializedRepository;
088:
089:            public OjbConfiguration() {
090:                super ();
091:            }
092:
093:            public boolean useSerializedRepository() {
094:                return useSerializedRepository;
095:            }
096:
097:            public boolean lockAssociationAsWrites() {
098:                return lockAssociationAsWrites;
099:            }
100:
101:            public String getRepositoryFilename() {
102:                return repositoryFilename;
103:            }
104:
105:            //*************************************************************
106:            //PBPoolConfiguration methods
107:            public int getMaxActive() {
108:                return maxActive;
109:            }
110:
111:            public int getMaxIdle() {
112:                return maxIdle;
113:            }
114:
115:            public long getMaxWaitMillis() {
116:                return maxWait;
117:            }
118:
119:            public long getTimeBetweenEvictionRunsMilli() {
120:                return timeBetweenEvictionRunsMillis;
121:            }
122:
123:            public long getMinEvictableIdleTimeMillis() {
124:                return minEvictableIdleTimeMillis;
125:            }
126:
127:            public byte getWhenExhaustedAction() {
128:                return whenExhaustedAction;
129:            }
130:
131:            //*************************************************************
132:
133:            //*************************************************************
134:
135:            public Class getObjectCacheClass() {
136:                return objectCacheClass;
137:            }
138:
139:            public Class getOqlCollectionClass() {
140:                return oqlCollectionClass;
141:            }
142:
143:            public Class getPersistentFieldClass() {
144:                return persistentFieldClass;
145:            }
146:
147:            public Class getPersistenceBrokerClass() {
148:                return persistenceBrokerClass;
149:            }
150:
151:            /**
152:             * Returns the indirection handler implementation class.
153:             * 
154:             * @return The indirection handler class
155:             * @see org.apache.ojb.broker.core.proxy.IndirectionHandler
156:             */
157:            public Class getIndirectionHandlerClass() {
158:                return indirectionHandlerClass;
159:            }
160:
161:            /**
162:             * Returns the proxy class used for that implement the {@link java.util.List} interface.
163:             * 
164:             * @return The proxy class 
165:             * @see org.apache.ojb.broker.core.proxy.ProxyFactory#setListProxyClass(Class)
166:             */
167:            public Class getListProxyClass() {
168:                return listProxyClass;
169:            }
170:
171:            /**
172:             * Returns the proxy class used for that implement the {@link java.util.Set} interface.
173:             * 
174:             * @return The proxy class 
175:             * @see org.apache.ojb.broker.core.proxy.ProxyFactory#setSetProxyClass(Class)
176:             */
177:            public Class getSetProxyClass() {
178:                return setProxyClass;
179:            }
180:
181:            /**
182:             * Returns the proxy class used for that implement the {@link java.util.Collection} interface.
183:             * 
184:             * @return The proxy class 
185:             * @see org.apache.ojb.broker.core.proxy.ProxyFactory#setCollectionProxyClass(Class)
186:             */
187:            public Class getCollectionProxyClass() {
188:                return collectionProxyClass;
189:            }
190:
191:            /**
192:             * Returns the class that will be used as the proxy factory.
193:             * 
194:             * @return The proxy factory class 
195:             */
196:            public Class getProxyFactoryClass() {
197:                return proxyFactoryClass;
198:            }
199:
200:            /**
201:             * Loads the configuration from file "OBJ.properties". If the system
202:             * property "OJB.properties" is set, then the configuration in that file is
203:             * loaded. Otherwise, the file "OJB.properties" is tried. If that is also
204:             * unsuccessful, then the configuration is filled with default values.
205:             */
206:            protected void load() {
207:                // properties file may be set as a System property.
208:                // if no property is set take default name.
209:                String fn = System.getProperty(OJB_PROPERTIES_FILE,
210:                        OJB_PROPERTIES_FILE);
211:                setFilename(fn);
212:                super .load();
213:
214:                // default repository & connection descriptor file
215:                repositoryFilename = getString("repositoryFile",
216:                        OJB_METADATA_FILE);
217:
218:                // object cache class
219:                objectCacheClass = getClass("ObjectCacheClass",
220:                        ObjectCacheDefaultImpl.class, ObjectCache.class);
221:
222:                // load PersistentField Class
223:                persistentFieldClass = getClass("PersistentFieldClass",
224:                        PersistentFieldDirectImpl.class, PersistentField.class);
225:
226:                // load PersistenceBroker Class
227:                persistenceBrokerClass = getClass("PersistenceBrokerClass",
228:                        PersistenceBrokerImpl.class, PersistenceBroker.class);
229:
230:                // load ListProxy Class
231:                listProxyClass = getClass("ListProxyClass",
232:                        ListProxyDefaultImpl.class);
233:
234:                // load SetProxy Class
235:                setProxyClass = getClass("SetProxyClass",
236:                        SetProxyDefaultImpl.class);
237:
238:                // load CollectionProxy Class
239:                collectionProxyClass = getClass("CollectionProxyClass",
240:                        CollectionProxyDefaultImpl.class);
241:
242:                // load IndirectionHandler Class
243:                indirectionHandlerClass = getClass("IndirectionHandlerClass",
244:                        IndirectionHandlerJDKImpl.class,
245:                        IndirectionHandler.class);
246:
247:                // load ProxyFactory Class
248:                proxyFactoryClass = getClass("ProxyFactoryClass",
249:                        ProxyFactoryJDKImpl.class, ProxyFactory.class);
250:
251:                // load configuration for ImplicitLocking parameter:
252:                useImplicitLocking = getBoolean("ImplicitLocking", false);
253:
254:                // load configuration for LockAssociations parameter:
255:                lockAssociationAsWrites = (getString("LockAssociations",
256:                        "WRITE").equalsIgnoreCase("WRITE"));
257:
258:                // load OQL Collection Class
259:                oqlCollectionClass = getClass("OqlCollectionClass",
260:                        DListImpl.class, ManageableCollection.class);
261:
262:                // set the limit for IN-sql , -1 for no limits
263:                sqlInLimit = getInteger("SqlInLimit", -1);
264:
265:                //load configuration for PB pool
266:                maxActive = getInteger(PoolConfiguration.MAX_ACTIVE,
267:                        PoolConfiguration.DEFAULT_MAX_ACTIVE);
268:                maxIdle = getInteger(PoolConfiguration.MAX_IDLE,
269:                        PoolConfiguration.DEFAULT_MAX_IDLE);
270:                maxWait = getLong(PoolConfiguration.MAX_WAIT,
271:                        PoolConfiguration.DEFAULT_MAX_WAIT);
272:                timeBetweenEvictionRunsMillis = getLong(
273:                        PoolConfiguration.TIME_BETWEEN_EVICTION_RUNS_MILLIS,
274:                        PoolConfiguration.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
275:                minEvictableIdleTimeMillis = getLong(
276:                        PoolConfiguration.MIN_EVICTABLE_IDLE_TIME_MILLIS,
277:                        PoolConfiguration.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
278:                whenExhaustedAction = getByte(
279:                        PoolConfiguration.WHEN_EXHAUSTED_ACTION,
280:                        PoolConfiguration.DEFAULT_WHEN_EXHAUSTED_ACTION);
281:
282:                useSerializedRepository = getBoolean("useSerializedRepository",
283:                        false);
284:            }
285:
286:            /**
287:             * Returns the SQLInLimit.
288:             * @return int
289:             */
290:            public int getSqlInLimit() {
291:                return sqlInLimit;
292:            }
293:
294:            /**
295:             * Sets the persistentFieldClass.
296:             * @param persistentFieldClass The persistentFieldClass to set
297:             */
298:            public void setPersistentFieldClass(Class persistentFieldClass) {
299:                this .persistentFieldClass = persistentFieldClass;
300:            }
301:
302:            /**
303:             * @see org.apache.ojb.odmg.OdmgConfiguration#useImplicitLocking()
304:             */
305:            public boolean useImplicitLocking() {
306:                return useImplicitLocking;
307:            }
308:
309:            public void setUseImplicitLocking(boolean implicitLocking) {
310:                this.useImplicitLocking = implicitLocking;
311:            }
312:
313:        }
w__ww.__j_a__v_a___2__s__._c___om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.