Source Code Cross Referenced for Configuration.java in  » Cache » ehcache » net » sf » ehcache » config » 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 » Cache » ehcache » net.sf.ehcache.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Copyright 2003-2007 Luck Consulting Pty Ltd
003:         *
004:         *  Licensed under the Apache License, Version 2.0 (the "License");
005:         *  you may not use this file except in compliance with the License.
006:         *  You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         *  Unless required by applicable law or agreed to in writing, software
011:         *  distributed under the License is distributed on an "AS IS" BASIS,
012:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         *  See the License for the specific language governing permissions and
014:         *  limitations under the License.
015:         */package net.sf.ehcache.config;
016:
017:        import net.sf.ehcache.ObjectExistsException;
018:
019:        import java.util.HashMap;
020:        import java.util.Map;
021:        import java.util.Set;
022:
023:        /**
024:         * A bean, used by BeanUtils, to set configuration from an XML configuration file.
025:         * @author <a href="mailto:gluck@thoughtworks.com">Greg Luck</a>
026:         * @version $Id: Configuration.java 519 2007-07-27 07:11:45Z gregluck $
027:         */
028:        public final class Configuration {
029:
030:            private DiskStoreConfiguration diskStoreConfiguration;
031:            private CacheConfiguration defaultCacheConfiguration;
032:            private FactoryConfiguration cacheManagerPeerProviderFactoryConfiguration;
033:            private FactoryConfiguration cacheManagerPeerListenerFactoryConfiguration;
034:            private FactoryConfiguration cacheManagerEventListenerFactoryConfiguration;
035:            private final Map cacheConfigurations = new HashMap();
036:            private String configurationSource;
037:
038:            /**
039:             * Empty constructor, which is used by {@link ConfigurationFactory}, and can be also sued programmatically.
040:             * <p/>
041:             * If you are using it programmtically you need to call the relevant add and setter methods in this class to
042:             * populate everything.
043:             */
044:            public Configuration() {
045:            }
046:
047:            /**
048:             * Allows {@link BeanHandler} to add disk store location to the configuration.
049:             */
050:            public final void addDiskStore(
051:                    DiskStoreConfiguration diskStoreConfigurationParameter)
052:                    throws ObjectExistsException {
053:                if (diskStoreConfiguration != null) {
054:                    throw new ObjectExistsException(
055:                            "The Disk Store has already been configured");
056:                }
057:                diskStoreConfiguration = diskStoreConfigurationParameter;
058:            }
059:
060:            /**
061:             * Allows {@link BeanHandler} to add the CacheManagerEventListener to the configuration.
062:             */
063:            public final void addCacheManagerEventListenerFactory(
064:                    FactoryConfiguration cacheManagerEventListenerFactoryConfiguration)
065:                    throws ObjectExistsException {
066:                if (this .cacheManagerEventListenerFactoryConfiguration == null) {
067:                    this .cacheManagerEventListenerFactoryConfiguration = cacheManagerEventListenerFactoryConfiguration;
068:                }
069:            }
070:
071:            /**
072:             * Adds a CachePeerProviderFactoryConfiguration.
073:             */
074:            public final void addCacheManagerPeerProviderFactory(
075:                    FactoryConfiguration factory) {
076:                if (cacheManagerPeerProviderFactoryConfiguration == null) {
077:                    cacheManagerPeerProviderFactoryConfiguration = factory;
078:                }
079:            }
080:
081:            /**
082:             * Adds a CachePeerProviderFactoryConfiguration.
083:             * cachePeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
084:             * properties="hostName=localhost, port=5000"
085:             */
086:            public final void addCacheManagerPeerListenerFactory(
087:                    FactoryConfiguration factory) {
088:                if (cacheManagerPeerListenerFactoryConfiguration == null) {
089:                    cacheManagerPeerListenerFactoryConfiguration = factory;
090:                }
091:            }
092:
093:            /**
094:             * Allows {@link BeanHandler} to add a default configuration to the configuration.
095:             */
096:            public final void addDefaultCache(
097:                    CacheConfiguration defaultCacheConfiguration)
098:                    throws ObjectExistsException {
099:                if (this .defaultCacheConfiguration != null) {
100:                    throw new ObjectExistsException(
101:                            "The Default Cache has already been configured");
102:                }
103:                this .defaultCacheConfiguration = defaultCacheConfiguration;
104:            }
105:
106:            /**
107:             * Allows {@link BeanHandler} to add Cache Configurations to the configuration.
108:             */
109:            public final void addCache(CacheConfiguration cacheConfiguration)
110:                    throws ObjectExistsException {
111:                if (cacheConfigurations.get(cacheConfiguration.name) != null) {
112:                    throw new ObjectExistsException("Cannot create cache: "
113:                            + cacheConfiguration.name
114:                            + " with the same name as an existing one.");
115:                }
116:                if (cacheConfiguration.name
117:                        .equalsIgnoreCase(net.sf.ehcache.Cache.DEFAULT_CACHE_NAME)) {
118:                    throw new ObjectExistsException(
119:                            "The Default Cache has already been configured");
120:                }
121:
122:                cacheConfigurations.put(cacheConfiguration.name,
123:                        cacheConfiguration);
124:            }
125:
126:            /**
127:             * Gets a Map of cacheConfigurations.
128:             */
129:            public final Set getCacheConfigurationsKeySet() {
130:                return cacheConfigurations.keySet();
131:            }
132:
133:            /**
134:             * @return the configuration's default cache configuration
135:             */
136:            public final CacheConfiguration getDefaultCacheConfiguration() {
137:                return defaultCacheConfiguration;
138:            }
139:
140:            /**
141:             *
142:             * @param defaultCacheConfiguration
143:             */
144:            public final void setDefaultCacheConfiguration(
145:                    CacheConfiguration defaultCacheConfiguration) {
146:                this .defaultCacheConfiguration = defaultCacheConfiguration;
147:            }
148:
149:            /**
150:             * Gets the disk store configuration.
151:             */
152:            public final DiskStoreConfiguration getDiskStoreConfiguration() {
153:                return diskStoreConfiguration;
154:            }
155:
156:            /**
157:             * Gets the CacheManagerPeerProvider factory configuration.
158:             */
159:            public final FactoryConfiguration getCacheManagerPeerProviderFactoryConfiguration() {
160:                return cacheManagerPeerProviderFactoryConfiguration;
161:            }
162:
163:            /**
164:             * Gets the CacheManagerPeerListener factory configuration.
165:             */
166:            public final FactoryConfiguration getCacheManagerPeerListenerFactoryConfiguration() {
167:                return cacheManagerPeerListenerFactoryConfiguration;
168:            }
169:
170:            /**
171:             * Gets the CacheManagerEventListener factory configuration.
172:             */
173:            public final FactoryConfiguration getCacheManagerEventListenerFactoryConfiguration() {
174:                return cacheManagerEventListenerFactoryConfiguration;
175:            }
176:
177:            /**
178:             * Gets a Map of cache configurations, keyed by name.
179:             */
180:            public final Map getCacheConfigurations() {
181:                return cacheConfigurations;
182:            }
183:
184:            /**
185:             * Sets the configuration source.
186:             * @param configurationSource  an informative description of the source, preferably
187:             * including the resource name and location.
188:             */
189:            public final void setSource(String configurationSource) {
190:                this .configurationSource = configurationSource;
191:            }
192:
193:            /**
194:             * Gets a description of the source from which this configuration was created.
195:             */
196:            public final String getConfigurationSource() {
197:                return configurationSource;
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.