Abstract: This article detailed the definition of description files on scalable web framework structures. And to create the Java model of the frame. The framework is characterized by: forms, form nested, view configurable, views are defined, built on the Struts framework. Pure personal idea, there may be a lot of childish, please give pointers and promotion. How to define: I have been thinking about how to define the description file of the frame structure. I will consider from the following aspects:
Integrity. Any case in the allowable range of the frame can be described. Semantic. All descriptions must be unique, clear. consistency. All descriptions must be unified and cannot conflict with each other. Can reference. All description elements must be up to access, and they must be easy to access. Maintainability. Description files are configurable, scalable, regenerable. readability. All descriptions must be easy to understand.
Now I need such a description file: describe the framework web page, which is the web page of Frame. I analyzed the eclipse plugin description file. It is defined as:
XML Version = "1.0" encoding = "UTF-8"?>
ID = "com.nidapeng.eclipse.plugin" Name = "Welcome to Eclipse" Version = "1.0" Provider-name = "ni Dapeng"> requires> runtime> Point = "org.eclipse.ui.views"> Name = "Welcome" ID = "com.nidapeng.eclipse.plugin.category1"> category> Name = "Welcome to Eclipse" Category = "com.nidapeng.eclipse.plugin.category1" Class = "com.nidapeng.eclipse.plugin.welcome" ID = "com.nidapeng.eclipse.plugin.View1"> view> extension> plugin> There are four main tags in Plugin.xml: Plugin, Requires, Runtime, Extension. Where the Plugin tag provides basic information for the Welcome plug-in we have to develop, in addition to Name, Version, Provider-name, the most important thing is ID, we can index to this element by it. The Requires tab is listed in the needed plugin, here we want to use the Eclipse Workbench and SWT API, thus import the org.eclipse.ui plugin. The Runtime label is specified in the file name of the JAR package where we developed the plugin. The Extension tag is the information of the plugin extension point. Org.eclipse.ui.views is the observation window extension provided by the Eclipse system. Our example is a view window (this shows that we are going to further development in org.eclipse.ui.views extension. EXTension also includes two tags of Category and View, and declare the class name of the Welcome plugin in the properties of the View. I thought I found the baby, I was very excited! You look, how wonderful structure. The declaration of the external package, the runtime library, the extension point setting, the definition of the view. The most shining is the extension point. This means that all plugins can have the capacity of the container, and the plugin can be inserted into another plugin. The plugin itself is scalable. Frame demand: When I started to build such a Java model, I met a problem. How can I insert the plug-in view into the frame view? How can I achieve communication between the framework and the plugin, including the delivery of an event. First, explain the specific application of this framework and the techniques used. This framework is a web application. The form is configurable, it may be that the upper and lower divided are two, or the left and right is divided into two, and the form is nested. The specific views of each region of the form can also be configured, which may be a navigation bar or may be a list box. Techniques are intended to use Struts architecture, retain action, bean, view. They can help us complete some of these cumbersome work. So the container management can only be the ActionServlet container of the Struts itself or its subclass. Struts is a highly configurable, highly scalable MVC framework, which can be used to develop any web applications that can be thought of with Java technology. Each portion of the MVC mode has a correlation part in Structs. In Struts, Action is a control layer, bean is a model layer, and View is a view layer. Now let's consolidate the framework requirements so we better analyze and define the description file of the framework. Forms Configurable Forms Nested View Configurable View Define Build on Struts Framework Analysis results: Ok, now I know what we need to do. We need to include the following elements in our description documents: Form Description Extension Point Description ANtion Association There is no view description here because the Struts has associated the action. So we only need to manage Action. The definition of the view is handed over to Struts. The description file formed is as follows: XML Version = "1.0" encoding = "UTF-8"?> / * Begin plugin definition * / ID = "com.useeasy.plugin" Name = "Welcome to Frame" Version = "1.0" Provider-name = "dojava"> / * Begin extension area definition * / DESC = "Web Framework for Extensible Plugin" Extension = "com.useeasy.frame">
ID = "com.useeasy.header" Scrolling = "no" NORESIZE = "True" Action = "/ headaction" DESC = "The first extension area" frame>
ID = "com.useeasy.main Action = "/ listage" DESC = "Second Extension Area"> frame> frameset> // Define two extensions / * END extension area definition plugin> / * END plugin definition * / There are three main tags in Frame.xml: Plugin, Frameset, Frame. The properties of the Plugin tag provide basic information for the frame plug-in we have to develop, in addition to Name, Version, Provider-name, etc., the most important thing is ID, we can index to this collection. The Frameset tag is the area division of the plug-in view, and the ROWS property refers to a few areas. This example divides the window into two regions. The extension property indicates which area of our plug-in view is to be displayed. This example specifies the plug-in view inserted above the com.useeasy.frame view. com.useeasy.frame It is an abstract view provided by the system, equivalent to blank browser window, and com.useeasy.frame is responsible for managing, managing our extended plug-in view. Frame label indicates the style and controller of this area. The scrolling property indicates whether the area has a scroll bar. The NORSIZE property indicates whether the area size can be changed. The Action property indicates the controller of this view. The controller is responsible for the display of the view data and the response of the event. The specific controller implementation is defined in Struts-Config.xml. Frame's order and number must be consistent with the ROW attribute of the FreameSet tag.