如何在J2EE中为大规模应用创建基于模块的应用程序?

时间:2014-06-05 03:35:02

标签: java java-ee module large-scale

我们将使用J2EE开发大规模应用程序。应用程序包含许多模块,很少有模块不直接与客户端通信(即它将在​​单独的线程中处理,如SNMP侦听器,作业调度,轮询等)。

因此,我们计划将应用程序拆分为基于模块的应用程序,并在不同的服务器上运行,并与主j2ee应用程序集成,以向用户显示结果。

任何人都可以帮助我创建如何创建基于模块的应用程序并运行可以在不同服务器上运行它的应用程序吗?

1 个答案:

答案 0 :(得分:1)

First thing you have to do is you should have a clear logical idea about hierarchical view of the modules. For example consider you will be having a security based module which should be always on top, other core featuring module will depend on the higher level modules.In such a way you must have a clear view about the level of modules. 

Have a building script like ANT for each module separately to build/jar that module, have a global level ANT to call all the individual modules as per the order.

Here, we have a similar architecture which has more than 10o different modules (both dependent on others and independent). Having these kind of structure you can able to skip any module that you don't wish, in a very simple manner.

Sample Global Ant script
--------------------------

<target name="build.projects">
    <ant dir="${security.module}" antfile="build.xml" target="build.project" />
    <ant dir="${core.module}" antfile="build.xml" target="build.project" />
    <ant dir="${Resource.module}" antfile="build.xml" target="build.project" />
    <ant dir="${SNMP.module}" antfile="build.xml" target="build.project" />
    <ant dir="${util.module}" antfile="build.xml" target="build.project" />
</target>

and the Individual one..

<project name="security.module" default="all" basedir=".">
    <target name="build.project" depends="-Properties, create.output, compile, jars" />
</project>