Source Code Cross Referenced for StandardConfigContext.java in  » Net » Terracotta » com » tc » config » schema » context » 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 » Net » Terracotta » com.tc.config.schema.context 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tc.config.schema.context;
005:
006:        import org.apache.xmlbeans.XmlException;
007:        import org.apache.xmlbeans.XmlObject;
008:
009:        import com.tc.config.schema.IllegalConfigurationChangeHandler;
010:        import com.tc.config.schema.defaults.DefaultValueProvider;
011:        import com.tc.config.schema.dynamic.BooleanConfigItem;
012:        import com.tc.config.schema.dynamic.BooleanXPathBasedConfigItem;
013:        import com.tc.config.schema.dynamic.ConfigItem;
014:        import com.tc.config.schema.dynamic.FileConfigItem;
015:        import com.tc.config.schema.dynamic.FileXPathBasedConfigItem;
016:        import com.tc.config.schema.dynamic.IntConfigItem;
017:        import com.tc.config.schema.dynamic.IntXPathBasedConfigItem;
018:        import com.tc.config.schema.dynamic.StringArrayConfigItem;
019:        import com.tc.config.schema.dynamic.StringArrayXPathBasedConfigItem;
020:        import com.tc.config.schema.dynamic.StringConfigItem;
021:        import com.tc.config.schema.dynamic.StringXPathBasedConfigItem;
022:        import com.tc.config.schema.dynamic.SubstitutedFileXPathBasedConfigItem;
023:        import com.tc.config.schema.listen.ConfigurationChangeListener;
024:        import com.tc.config.schema.repository.BeanRepository;
025:        import com.tc.util.Assert;
026:
027:        import java.io.File;
028:
029:        /**
030:         * Binds together a {@link BeanRepository} and a {@link DefaultValueProvider}.
031:         */
032:        public class StandardConfigContext implements  ConfigContext {
033:
034:            private final BeanRepository beanRepository;
035:            private final DefaultValueProvider defaultValueProvider;
036:            private final IllegalConfigurationChangeHandler illegalConfigurationChangeHandler;
037:            private final File configDirectory;
038:
039:            public StandardConfigContext(
040:                    BeanRepository beanRepository,
041:                    DefaultValueProvider defaultValueProvider,
042:                    IllegalConfigurationChangeHandler illegalConfigurationChangeHandler,
043:                    File configDirectory) {
044:                Assert.assertNotNull(beanRepository);
045:                Assert.assertNotNull(defaultValueProvider);
046:                Assert.assertNotNull(illegalConfigurationChangeHandler);
047:
048:                this .beanRepository = beanRepository;
049:                this .defaultValueProvider = defaultValueProvider;
050:                this .illegalConfigurationChangeHandler = illegalConfigurationChangeHandler;
051:                this .configDirectory = configDirectory;
052:            }
053:
054:            public IllegalConfigurationChangeHandler illegalConfigurationChangeHandler() {
055:                return this .illegalConfigurationChangeHandler;
056:            }
057:
058:            public void ensureRepositoryProvides(Class theClass) {
059:                beanRepository.ensureBeanIsOfClass(theClass);
060:            }
061:
062:            public boolean hasDefaultFor(String xpath) throws XmlException {
063:                return this .defaultValueProvider
064:                        .possibleForXPathToHaveDefault(xpath)
065:                        && this .defaultValueProvider
066:                                .hasDefault(this .beanRepository
067:                                        .rootBeanSchemaType(), xpath);
068:            }
069:
070:            public XmlObject defaultFor(String xpath) throws XmlException {
071:                return this .defaultValueProvider.defaultFor(this .beanRepository
072:                        .rootBeanSchemaType(), xpath);
073:            }
074:
075:            public boolean isOptional(String xpath) throws XmlException {
076:                return this .defaultValueProvider.isOptional(this .beanRepository
077:                        .rootBeanSchemaType(), xpath);
078:            }
079:
080:            public XmlObject bean() {
081:                return this .beanRepository.bean();
082:            }
083:
084:            public Object syncLockForBean() {
085:                return this .beanRepository;
086:            }
087:
088:            public void itemCreated(ConfigItem item) {
089:                if (item instanceof  ConfigurationChangeListener)
090:                    this .beanRepository
091:                            .addListener((ConfigurationChangeListener) item);
092:            }
093:
094:            public IntConfigItem intItem(String xpath) {
095:                return new IntXPathBasedConfigItem(this , xpath);
096:            }
097:
098:            public StringConfigItem stringItem(String xpath) {
099:                return new StringXPathBasedConfigItem(this , xpath);
100:            }
101:
102:            public StringArrayConfigItem stringArrayItem(String xpath) {
103:                return new StringArrayXPathBasedConfigItem(this , xpath);
104:            }
105:
106:            public FileConfigItem fileItem(String xpath) {
107:                return new FileXPathBasedConfigItem(this , xpath);
108:            }
109:
110:            public FileConfigItem substitutedFileItem(String xpath) {
111:                return new SubstitutedFileXPathBasedConfigItem(this , xpath);
112:            }
113:
114:            public BooleanConfigItem booleanItem(String xpath) {
115:                return new BooleanXPathBasedConfigItem(this , xpath);
116:            }
117:
118:            public BooleanConfigItem booleanItem(String xpath,
119:                    boolean defaultValue) {
120:                return new BooleanXPathBasedConfigItem(this , xpath,
121:                        defaultValue);
122:            }
123:
124:            public FileConfigItem configRelativeSubstitutedFileItem(String xpath) {
125:                return new SubstitutedFileXPathBasedConfigItem(this , xpath,
126:                        configDirectory);
127:            }
128:
129:            public String toString() {
130:                return "<ConfigContext around repository: "
131:                        + this .beanRepository + ">";
132:            }
133:
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.