Source Code Cross Referenced for BaseTVSConfigurationSetupManager.java in  » Net » Terracotta » com » tc » config » schema » setup » 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.setup 
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.setup;
005:
006:        import org.apache.xmlbeans.XmlObject;
007:
008:        import com.tc.config.schema.IllegalConfigurationChangeHandler;
009:        import com.tc.config.schema.context.ConfigContext;
010:        import com.tc.config.schema.context.StandardConfigContext;
011:        import com.tc.config.schema.defaults.DefaultValueProvider;
012:        import com.tc.config.schema.repository.ApplicationsRepository;
013:        import com.tc.config.schema.repository.BeanRepository;
014:        import com.tc.config.schema.repository.ChildBeanFetcher;
015:        import com.tc.config.schema.repository.ChildBeanRepository;
016:        import com.tc.config.schema.repository.MutableBeanRepository;
017:        import com.tc.config.schema.repository.StandardApplicationsRepository;
018:        import com.tc.config.schema.repository.StandardBeanRepository;
019:        import com.tc.config.schema.utils.XmlObjectComparator;
020:        import com.tc.object.config.schema.NewDSOApplicationConfig;
021:        import com.tc.object.config.schema.NewDSOApplicationConfigObject;
022:        import com.tc.object.config.schema.NewSpringApplicationConfig;
023:        import com.tc.object.config.schema.NewSpringApplicationConfigObject;
024:        import com.tc.util.Assert;
025:        import com.terracottatech.config.Application;
026:        import com.terracottatech.config.Client;
027:        import com.terracottatech.config.DsoApplication;
028:        import com.terracottatech.config.Servers;
029:        import com.terracottatech.config.SpringApplication;
030:        import com.terracottatech.config.System;
031:
032:        import java.io.File;
033:        import java.util.HashMap;
034:        import java.util.HashSet;
035:        import java.util.Map;
036:        import java.util.Set;
037:
038:        /**
039:         * A base class for all TVS configuration setup managers.
040:         */
041:        public class BaseTVSConfigurationSetupManager {
042:
043:            private final MutableBeanRepository clientBeanRepository;
044:            private final MutableBeanRepository serversBeanRepository;
045:            private final MutableBeanRepository systemBeanRepository;
046:            private final ApplicationsRepository applicationsRepository;
047:
048:            private final DefaultValueProvider defaultValueProvider;
049:            private final XmlObjectComparator xmlObjectComparator;
050:            private final IllegalConfigurationChangeHandler illegalConfigurationChangeHandler;
051:
052:            private final Map dsoApplicationConfigs;
053:            private final Map springApplicationConfigs;
054:
055:            public BaseTVSConfigurationSetupManager(
056:                    DefaultValueProvider defaultValueProvider,
057:                    XmlObjectComparator xmlObjectComparator,
058:                    IllegalConfigurationChangeHandler illegalConfigurationChangeHandler) {
059:                Assert.assertNotNull(defaultValueProvider);
060:                Assert.assertNotNull(xmlObjectComparator);
061:                Assert.assertNotNull(illegalConfigurationChangeHandler);
062:
063:                this .systemBeanRepository = new StandardBeanRepository(
064:                        System.class);
065:                this .clientBeanRepository = new StandardBeanRepository(
066:                        Client.class);
067:                this .serversBeanRepository = new StandardBeanRepository(
068:                        Servers.class);
069:                this .applicationsRepository = new StandardApplicationsRepository();
070:
071:                this .defaultValueProvider = defaultValueProvider;
072:                this .xmlObjectComparator = xmlObjectComparator;
073:                this .illegalConfigurationChangeHandler = illegalConfigurationChangeHandler;
074:
075:                this .dsoApplicationConfigs = new HashMap();
076:                this .springApplicationConfigs = new HashMap();
077:            }
078:
079:            protected final MutableBeanRepository clientBeanRepository() {
080:                return this .clientBeanRepository;
081:            }
082:
083:            protected final MutableBeanRepository serversBeanRepository() {
084:                return this .serversBeanRepository;
085:            }
086:
087:            protected final MutableBeanRepository systemBeanRepository() {
088:                return this .systemBeanRepository;
089:            }
090:
091:            protected final ApplicationsRepository applicationsRepository() {
092:                return this .applicationsRepository;
093:            }
094:
095:            protected final XmlObjectComparator xmlObjectComparator() {
096:                return this .xmlObjectComparator;
097:            }
098:
099:            protected final void runConfigurationCreator(
100:                    ConfigurationCreator configurationCreator)
101:                    throws ConfigurationSetupException {
102:                configurationCreator.createConfigurationIntoRepositories(
103:                        clientBeanRepository, serversBeanRepository,
104:                        systemBeanRepository, applicationsRepository);
105:            }
106:
107:            public String[] applicationNames() {
108:                Set names = new HashSet();
109:
110:                names.addAll(this .dsoApplicationConfigs.keySet());
111:                names.addAll(this .springApplicationConfigs.keySet());
112:
113:                return (String[]) names.toArray(new String[names.size()]);
114:            }
115:
116:            protected final ConfigContext createContext(
117:                    BeanRepository beanRepository, File configFilePath) {
118:                Assert.assertNotNull(beanRepository);
119:                return new StandardConfigContext(beanRepository,
120:                        this .defaultValueProvider,
121:                        this .illegalConfigurationChangeHandler, configFilePath);
122:            }
123:
124:            public synchronized NewDSOApplicationConfig dsoApplicationConfigFor(
125:                    String applicationName) {
126:                // When we support multiple applications, just take this assertion out.
127:                Assert
128:                        .eval(applicationName
129:                                .equals(TVSConfigurationSetupManagerFactory.DEFAULT_APPLICATION_NAME));
130:
131:                NewDSOApplicationConfig out = (NewDSOApplicationConfig) this .dsoApplicationConfigs
132:                        .get(applicationName);
133:                if (out == null) {
134:                    out = createNewDSOApplicationConfig(applicationName);
135:                    this .dsoApplicationConfigs.put(applicationName, out);
136:                }
137:
138:                return out;
139:            }
140:
141:            public synchronized NewSpringApplicationConfig springApplicationConfigFor(
142:                    String applicationName) {
143:                // When we support multiple applications, just take this assertion out.
144:                Assert
145:                        .eval(applicationName
146:                                .equals(TVSConfigurationSetupManagerFactory.DEFAULT_APPLICATION_NAME));
147:
148:                NewSpringApplicationConfig out = (NewSpringApplicationConfig) this .springApplicationConfigs
149:                        .get(applicationName);
150:                if (out == null) {
151:                    out = createNewSpringApplicationConfig(applicationName);
152:                    this .springApplicationConfigs.put(applicationName, out);
153:                }
154:
155:                return out;
156:            }
157:
158:            protected NewDSOApplicationConfig createNewDSOApplicationConfig(
159:                    String applicationName) {
160:                return new NewDSOApplicationConfigObject(createContext(
161:                        new ChildBeanRepository(this .applicationsRepository
162:                                .repositoryFor(applicationName),
163:                                DsoApplication.class, new ChildBeanFetcher() {
164:                                    public XmlObject getChild(XmlObject parent) {
165:                                        return ((Application) parent).getDso();
166:                                    }
167:                                }), null));
168:            }
169:
170:            protected NewSpringApplicationConfig createNewSpringApplicationConfig(
171:                    String applicationName) {
172:                return new NewSpringApplicationConfigObject(createContext(
173:                        new ChildBeanRepository(this .applicationsRepository
174:                                .repositoryFor(applicationName),
175:                                SpringApplication.class,
176:                                new ChildBeanFetcher() {
177:                                    public XmlObject getChild(XmlObject parent) {
178:                                        return ((Application) parent)
179:                                                .getSpring();
180:                                    }
181:                                }), null));
182:            }
183:
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.