这两天在sourceforge开了个项目——GOMP(http://sourceforge.net/projects/gomp)
全称:Jetter's Generic Object Mapping Project
四个字母的简写,而且还挺朗朗上口,没想到申请得到,强啊~~~
至于这是个什么东西,see below....
这个东西就是以前所写的《基于iBatis的通用持久层对象》的实现,想不到拖了那么久。
=============================================================================
GOMP项目介绍
GOMP是一个基于XML配置文件的对象影射框架,它不是一个完整的ORM框架,而是建立在各种ORM框架、JDBC以及其他数据源之上的映射框架。它以一种通用的文件配置方式完成从数据源到Java对象的映射工作,因此你几乎不用写任何代码就可以完成这一映射,这时一条从数据层到显示层的快速通道。
GOMP的数据源是多种多样的,可以是JDBC数据源、iBatis、Hibernate、XML文件等等,甚至你可以按照你的需求自己实现数据源,你可以把它看作一个用于封装各种数据源的包装器。GOMP除了映射一般的Java对象以外,允许你把数据映射到通用的Map、List中(通过IbatisObjectCreator、JDBCObjectCreator)。
从实际应用来看,GOMP不是一个高运行效率的对象影射框架,它的运行效率取决于底层调用何种数据源。它确实可以解决某些应用需求,当你面对大量凌乱而复杂的数据(可能来自多个DBMS或者XML),需要把这些数据按照要求呈现到界面上,这时GOMP会是一个极好的选择。你不需要在JDBC基础上写任何代码,也不需要创建任何Java对象进行映射,只需要配置XML文件就可以产生通用的Map、List对象。
GOMP有两种部署环境可以选择:Spring Framework以及GOMFramework。Spring是基于依赖注入的方式初始化GOM的各种类,而GOMFramework是基于自定义的配置文件使用传统的方式初始化,Spring与GOMFramework在使用上的差别在于配置文件的存在较大的差异。如果你不想部属庞大的Spring类包,那么轻便的GOMFramework非常适合你。如果你的应用已经部署在Spring之上或者打算以后使用Spring,那么通用的Spring环境将会更好。因此,GOMP更趋向于使用Spring部署,因为可以使用很多Spring优秀的特性。
另外,GOMP遵循完整的接口机制,你可以实现数据源、对象创建器等接口来扩展GOMP。
下面是E文翻译,可能有些语法错误,望大家斧正。
=======================================================================
Introduction of Jetter's Generic Object Mapping Project
GOMP is a object mapping framework based on XML file configuration. It is not a integrated ORM framework. It is builded upon various ORM framework, JDBC and other kinds of datasources. It maps kinds of data from various datasources to Java objects by doing a generic XML file configuration, so you even don't need to write any code. It is a fast way from data layer to viewer layer.
There are many kinds of GOMP datasources, like JDBC, iBatis, Hibernate, XML file, etc. You can even create your own datasource for your requirement. You can look on GOMP as a wrapper to wrap and to map datasources. GOMP can map data to a general Java object, and further more, It lets you to map data to a kind of generic Java object, Java Collection Object, like Map and List.
In practical use, GOMP may be not a efficient mapping framework. Its efficiency depends on what kind of datasource it uses. But in fact, it can solve some kinds of requirements. When you are in the face of a large numbers and different kinds of data, they may come from more than one DBMS or XML file. You must set these data to UI by demand. At this time, GOMP is the best choice. You don't need to write any codes based on JDBC, and don't need to create any Java bean to map data. All that you need to do is to configure the XML file.
There are two runtime framework environments to deploy GOMP, Spring Framework and GOMFramework. Spring, which is widely used in many projects, initializes GOM beans based on IoC pattern. GOMFramework, which is designed as a light weight GOM bean container, initializes GOM beans in its own way, by configuring its own XML files. So the biggest difference of these two GOM frameworks is XML file configuration. If you don't like to deploy the giant Spring library, the light weight GOMFramework is suitable for you. But if your application has been developed upon Spring, you may continue using Spring. So we recommend you to use Spring as the GOM framework. Because Spring do have much more advantages than GOMFramework.