Java应用程序获得配置信息的方式可谓千奇百怪,配置文件的安排也毫无章法,每个人或许都有自己的一套读/写配置信息的习惯做法。“如果应用程序体系结构是巴别塔,配置就是让巴别塔项目陷于混乱的‘语言’。”
————————
If architecture were to be the tower of babel, configuration is its language
As the story goes God devised multiple languages so that men can't build sturctures that span to the heavens. In our small world of programming architectures the men and women of the world are quite busy (with out much help from any Overseer) constructing a confusion of their own. The name of this confusion is called "Configuration".
The larger and more complex an architecture is the simpler its constituents need be. That means the key for complex programs are pluggable parts or pluggable functionality at run time. Almost like a self-evolving system. The key to accomplishing such a composition is configuration. We seem to invent for every configuration need a different configuration api.
Sometimes configuration is read from properties files. Some times from XML files. Sometimes from System.properties. Sometimes passed in as a properties object. Sometimes read from multiple config files. Sometimes libraries use a different confgiuration than applications.
Such diversity of configurations exists because it is fairly easy to read configuration at run time. So it is left to the individual programs and components to determine their own needs.
But I am realizing more and more that it is the configuration that holds an architecture together. When there all the parts and containers use the same understanding of a configuration then it is lot more easier to integrate parts from varieties of sources and manage them well. The key to this understanding is to arrive at a unified abstraction for configuration that is based on the "structure" of the data rather than the form. This insight is as important as knowing the difference between XML and an InfoSet.
Once the configuration is perceived as a hierarchical set of data nodes that are not tied to implementation, then it offers a great flexibility to know that every component and part in an application can use the simplest of the APIs to realize their configuration needs. Having an interface to configuration is very important as all the components of an application, including the container can use the same api.
You might parallel this to a windows Registry. It is subtly diffrent from a windows Registry. Befor going there let me say the only good thing I can say about windows Registry. Registry allowed "COM" components to succeed and florish. With out this common understanding it would have been difficult to accomplish to interoperate. Now the problem with Registry is not because it is one big blog, but because it is not an interface. Had that been an interface, application would have been able to pick and choose where to keep their own configuration without interfering with the rest. The second improvement is that this interface needs to be small.
Some of these aspects are discussed in greater detail at the following article at the following O'Reilly link
A Simplified Configuration Service
分享到:
相关推荐
这个压缩包文件“《J2EE案例开发》源代码”包含的是一系列J2EE项目实践的源代码,是学习和理解J2EE技术体系及其实际应用的良好资源。 J2EE的核心在于它的分层架构,主要包括以下层次: 1. 客户端层(Client Layer...
【标题】"J2EE系列讲座之Hibernate.lesson1.rar" 提供的是关于J2EE开发中的一个重要组件——Hibernate的学习资源,这是一款强大的对象关系映射(ORM)框架,旨在简化Java应用程序与数据库之间的交互。在J2EE环境中,...
一旦所有必要的软件都安装到位,你就可以开始配置J2EE服务器,例如创建域、部署应用、配置数据源和连接池,以及设置安全性和性能参数。同时,确保MySQL服务器已配置为应用的数据存储,并通过JDBC连接从J2EE服务器...
它包含一系列配置和 profiles,如MIDP(Mobile Information Device Profile)和CDC(Connected Device Configuration),以适应不同设备的特性和需求。 而J2EE则是一个全面的、面向企业级应用的Java平台,用于构建...
1. 创建 Configuration 对象 2. 创建 SessionFactory 对象 3. 创建 Session 对象 4. 开始一个事务 5. 进行持久化操作 6. 结束事务 7. 关闭 Session 实现序列化的原因: 1. 序列化以某种存储形式使自定义对象持久化...
J2EE建立在J2SE之上,增加了大量用于构建分布式、多层架构的企业应用的服务和API,包括Servlet、JSP、EJB、JNDI、JMS、RMI-IIOP等。这些技术使得开发者能够构建复杂的B/S架构应用,同时提供对事务管理、持久化、远程...
### MIDlet与J2EE结合开发移动商务应用 #### 一、引言 随着移动互联网技术的迅速发展,移动商务成为了一个重要的商业领域。在众多移动应用开发技术中,Java平台因其良好的跨平台特性而备受青睐。Java 2 Platform, ...
它是J2EE项目中常用的ORM(Object Relational Mapping,对象关系映射)解决方案之一,可以将对象模型与关系型数据库模型之间的转换自动化处理,从而大大提高了开发效率。 ##### 2.1 Hibernate的优势 - **代码简洁*...
1. **启动Configuration Wizard**:通过开始菜单运行BEA Products -> Tools -> Configuration Wizard。 2. **创建新域**:选择Create a new WebLogic domain,然后点击Next。 3. **设置域源**:在Select Domain ...
在IT行业中,J2EE(Java 2 Platform, Enterprise Edition)是一个用于开发和部署企业级应用程序的框架。它提供了一套标准和规范,使得开发者能够构建可移植、可伸缩和安全的分布式应用。本篇将详细介绍如何配置一个...
学习J2ME需要了解KVM(K Virtual Machine)虚拟机、CLDC(Connected Limited Device Configuration)和CDC(Connected Device Configuration)等基础。开发者还需要掌握如何使用J2ME的图形用户界面(GUI)库,如WTK...
22. Hibernate核心接口:Hibernate的五大核心接口包括SessionFactory、Session、Query、configuration和transaction。 23. IOC概念:IOC(Inversion of Control)指的是将对象的控制权从对象本身转移到外部容器,...
### Linux 下的 J2EE 遇到的问题及解决方案 #### 概述 本文主要针对在 Linux 环境下部署 Java 企业级应用程序(J2EE)时可能遇到的问题进行详细阐述,并给出相应的解决方法。该案例涉及的项目名称为“zjsys”,其...
J2SE 是构建于 Java 基础之上的,适用于开发一般的桌面应用软件和小型服务器端程序。 - **核心功能**: - 文件处理与网络编程。 - 图形用户界面(Swing/AWT)。 - 多线程支持。 - XML 处理。 - JDBC 支持。 -...
本资源"Android应用源码之Configuration_Configuration.zip"可能包含了深入解析Android Configuration类的源代码分析。 当我们谈论Android的Configuration时,首先要知道它是如何影响应用的。当设备的配置发生改变...
- **共享项目**:在项目菜单中选择“Team”->“Share Project”,然后选择“Vss Configuration Wizard”。在向导中指定VSS的路径和项目路径。 - **添加项目到VSS**:选择“Team”->“Add to VSS”将项目添加到VSS中...
J2ME通常由配置(Configurations)和 profilings(Profiles)组成,如MIDP(Mobile Information Device Profile)和CLDC(Connected Limited Device Configuration),用于定义设备的硬件和软件能力。 另一方面,...
Apache Commons Configuration 是一个Java库,它提供了一组高级配置接口和类,用于处理应用程序的配置文件。在这些接口中,`XMLConfiguration` 是一个重要的组件,专门设计用来处理XML格式的配置文件。在这个范例中...
赠送源代码:commons-configuration2-2.1.1-sources.jar; 赠送Maven依赖信息文件:commons-configuration2-2.1.1.pom; 包含翻译后的API文档:commons-configuration2-2.1.1-javadoc-API文档-中文(简体)版.zip; ...