Summary of the invention
Technical matters: the purpose of this invention is to provide a kind ofly, solve the complexity problem of mesh services exploitation based on micro-compile grid service constructor.The method that the application of the invention proposes can be developed easily on the basis of grid development kit GT3 and dispose gridding service system.
Technical scheme: method of the present invention is on the basis that meets OGSA (Open Grid Services Architecture) standard grid middleware GT3, utilize code Generation to quicken the development progress of software greatly, improve a kind of method of quality of software, mesh services make up device and general code automatic generator different, because grid computing itself is the process of a complexity, therefore grid computing is used automatic generator except top key element, has also comprised " disposing automatically " part.This method has shielded middleware GT3, imports structure mesh services parameters needed from close friend's human-computer interaction interface according to prompting, disposes mesh services automatically, for the universal of gridding technique facilitates.
Structure device of the present invention is by the X analytics engine of self-defining little compiler, customization and generate automatically to dispose and make up file and form, and imports the defined file of little compiler by graphical interfaces, selects suitable template, carries out process of analysis; File after the parsing is disposed the task of making up file by automatic generation and is disposed mesh services automatically as the input of X analytics engine; Wherein, mesh services structure device is that a kind of compound code generates engine automatically and grid is disposed the code generic frame that combines automatically; Its method is as follows:
1). the user selects suitable template by graphic interface, obtains template file, fills in the graphic interface grid computing parameters needed then and submits to background program, produces defined file;
La). template file is formed by 4, and the content of class file piece is used for describing mesh services; The content that the property file piece is comprised is the mapped file piece; The content that the note piece is comprised is a comment section; Every part all comprises static content and dynamic content; The label of dynamic content has “ ${} " label, between a pair of brace " { } " after the $ parameter name that needs replacement, realize parameter replacement function; " judgement label " realizes arbitration functions; " circulation label " realizes circulatory function;
1b). the grammar rule of definition book is as follows: morphology by reference symbol, left side symbol, right symbol, rise symbol, etc. symbol, knot accord with and non-mark is formed.Reference symbol is represented the character string that begins with letter or space; Left side symbol " { " expression the right begin symbol; Right symbol " } " expression the right terminating symbol; Play symbol " @ " expression left side begin symbol; Connect left side expression formula and the right expression formula Deng symbol "=" expression; The knot symbol "; " expression expression formula end.Non-mark comprises note, space, redirect and carriage return.Syntactic definition is as follows: this grammer is made up of a plurality of expression formulas; Each expression formula by the expression formula left side, etc. symbol, expression formula the right, knot symbol form; The expression formula left side accords with by rising, reference symbol is formed; Expression formula the right is made up of left side symbol, reference symbol, right symbol.To play symbol " @ " symbol symbol to start with, rise symbol " reference symbol behind the @ is to need the part of replacing in the template file, the value that will replace be the left side symbol that waits symbol "=" the right with right the symbol between reference symbol; " ## " part is afterwards represented notes content;
2). the processing of little compiler is made up of the parsing of definition book and the parsing of template file, the definition book and the template file that meet grammar rule are resolved, definition book is resolved the input that resolve as template file the back, generates the original source code that meets the grid standard that contains X analytics engine label;
3). adjust original source code;
4). the X analytics engine of the customization that drives with source file is modified source code, generates various needed files, and these files comprise " Java " source code file, service interface description document, deployment descriptor file; The X analytics engine of customization is expanded customization to the automatic Core Generator XDoclet of the code of increasing income, customized mesh services descriptive language template file, Web service deployment descriptor template file, generated and dispose the needed mesh services descriptive language of mesh services file, Web service deployment descriptor file;
4a). custom mesh service description language (sdl) file template, needed content tab in the template is expanded, add the content tab processor, write startup mesh services descriptive language file template task;
4b). customizing Web service arrangement describer template, the Web service deployment descriptor tells how Web server issues mesh services, deployment descriptor template in the project that is used for realizing Simple Object Access Protocol among the automatic Core Generator XDoclet of the code of increasing income is made amendment, write and start Web service deployment descriptor template task;
5). automatically generate to dispose make up file step 1) and step 2) process combine customized task with the automatic deployment of mesh services; Automatically generation deployment structure file combines automatic generative process of grid computing code and the automatic deployment of grid, makes up file and is made up of following task: generate Stub file, generating mesh history file, deployment mesh services, structure mesh services task one, structure mesh services task two.
Beneficial effect:
The inventive method has proposed a kind of high-performance mesh services and has made up device automatically, be mainly used in the complexity problem that solves in the mesh services generation deployment, the method that the application of the invention proposes can be avoided over complicacy and the inefficiencies that makes up mesh services on the GT3 basis, good man computer interface reduces the requirement of user to professional knowledge, improved the speed that makes up mesh services, the user can be to template base, and being with good expansibility helps the extensive popularization of gridding technique.Below we provide specific description:
Good interactivity and simplification: under GT3, make up mesh services, need under command line mode, import a large amount of orders, the user need have at fingertips to each step, and much the order of steps can not be got wrong, thereby requires very high to user's professional knowledge.We have adopted the good man-machine interaction interface when actual design, shielded bottom operation, provided friendly prompting, make the user very fast grasp use this method to make up mesh services, abundant applying template storehouse, user even can not write any code easily makes up mesh services, even without the template file that is suitable for fully, the user also only needs to revise service method and gets final product.
High efficiency: introduced little compiler in the inventive method at mesh services.Utilize this method, (relevant with the running environment of program, as to comprise software environment such as operating system, hardware environment such as CPU, internal memory etc.) improves the formation efficiency of mesh services code to a certain extent.
Extensibility: this method provides template base to write interface, can write new template at any time and be kept in the template base, is with good expansibility.
The method that the application of the invention proposes can be developed easily on the basis of grid development kit GT3 and dispose gridding service system.
Embodiment
One, architecture
It is that a kind of code generates engine automatically and grid is disposed the code generic frame that combines automatically that mesh services makes up device, improves the dirigibility of data description, comprehensive multiple technologies.The generation of definition book and template file can also can be finished by the mode of visual edit by the mode of text editing.
Below we provide the explanation of several concrete parts:
Definition book: in defined file, specifying one group of feature that is used for describing mesh services character, is the input source of total system, and this language is very simple, but powerful, and the grammer of definition book is very simple, is defined as follows:
(1) morphology by reference symbol, left side symbol, right symbol, rise symbol, etc. symbol, knot accord with and non-mark is formed.Reference symbol is represented the character string that begins with letter or space; Left side symbol " { " expression the right begin symbol; Right symbol " } " expression the right terminating symbol; Play symbol " @ " expression left side begin symbol; Connect left side expression formula and the right expression formula Deng symbol "=" expression; The knot symbol "; " expression expression formula end.Non-mark comprises note, space, redirect and carriage return.
(2) syntactic definition is as follows: this grammer is made up of a plurality of expression formulas; Each expression formula by the expression formula left side, etc. symbol, expression formula the right, knot symbol form; The expression formula left side accords with by rising, reference symbol is formed; Expression formula the right is made up of left side symbol, reference symbol, right symbol.
The template file storehouse: the grammer more complicated of template file, according to mesh services, it mainly is divided into 4, separate with the piece label:
(1) class file piece, the content of class file piece is used for describing mesh services.
(2) content of property file piece is used for describing the needed property file of automatic structure mesh services.
(3) content of mapped file piece is used for describing the needed mapped file of deployment mesh services.
(4) content that contains of comment file is a comment section.
The content of each piece comprises static object and dynamic object:
● static object: static object is represented static content, and template just outputs to static content in the file destination when resolving.Should to as if java section source code after strictness test and property file, mapped file etc., be that all use this template to generate the public code of source code.
● dynamic object: data content in the dynamic object description template and flow process control section, introduce by special template label, when resolving, template need finish the conversion of dynamic object by definition book to source code.
Dynamic object control label has following several:
(1) ${} label is realized parameter replacement function, is the parameter name that needs replacement between a pair of brace " { } " after the $;
(2) IfElse ENDIf label (judgement label) is realized arbitration functions;
(3) For EndFor label (circulation label) is realized the cycle control function.
Little compiler engine: little compiler has complete morphology, syntax and semantics action, and little compiler is resolved the definition book and the template file that meet grammar rule, generates the source code that meets the grid standard that contains X analytics engine label.
The X analytics engine: the expansion to XDoclet (the automatic Core Generator of a kind of code of increasing income) meets the mesh services standard generates and disposes the needed All Files of mesh services, as WSDD, GWSDL (mesh services descriptive language) etc.
Automatically generate to dispose and make up file: the All Files that the X analytics engine produces is disposed automatically, realized mesh services.
Two, method flow
From graphical interfaces input parameter (generation meets the definition book file of little compiler syntax), resolve definition book, select suitable template, by the template process of analysis, read template file, carry out process of analysis.File after the parsing is disposed the task of making up file by automatic generation and is disposed mesh services automatically as the input of X analytics engine.
The template analysis program and the definition book analysis program of little compiler are used, and its effect is that to read the template file of appointment be input parameter with the definition book, mark in the processing template document and variable, thus produce source code output.Little compiler processes flow process is as follows:
(1) the template analysis program reads the template file of appointment, and template file is imported to the character string buffer zone,
(2) the definition book analysis program carries out lexical analysis to the definition book of input, and grammatical analysis is determined that definition book is the definition book that meets grammatical standard, and its parameter is extracted, and obtains the useful parameter of definition book,
(3) carry out the processing that the template dynamic object is controlled label, Dui ${} label is handled earlier, carries out parameter and replaces, respectively IfElse ENDIf label and For EndFor label are handled then,
(5) carry out the processing of template piece label, finish template analysis and handle.Piece tag processes flow process is: the pre-service buffer zone is used for depositing the template content after the processing between piece control label opening flag and the end mark, is deposited in the corresponding file according to the type of the identifier content with buffer zone, finishes the processing of template label,
(6) can adjust original source code, as the input of X analytics engine.
Various files after little compiler processes enter into the X analytics engine, dispose the task deployment mesh services that makes up file by automatic generation.The X analytics engine is the customization of XDoclet being carried out the mesh services aspect.The built-in task function of XDoclet is very simple and powerful, comprises current development field various aspects, as EJB (the commercial application component technology among the Java), Web exploitation or the like.But for the real world applications exploitation of complexity, the built-in task that XDoclet provides is far from being enough.Fortunately, XDoclet provides stable, ripe code generic frame to satisfy the task of customization.In order to satisfy the requirement of grid computing, we have customized GWSDL template, WSDD template file, generate to dispose the needed GWSDL file of grid computing, WSDD file.In order to generate these files that satisfy grid computing, must create own template tag (template label).Because the Method method that XDoclet provides can not satisfy our needs, so will increase a content tag (content tab) newly.This content tag called after methodUpperName obtains the name of the method for capitalization beginning by it.In order to start the template of customization, must start with Ant (a kind of automatic the build tool of increasing income) the build tool.The X analytics engine is with good expansibility, along with the increase of function, and correspondingly expansion templates, expansion task, customized tag.
The automatic the build tool of Ant is powerful, finds out from above, not only needs Ant the build tool in the automatic deployment of grid, and in the automatic generative process of grid computing code, Ant the build tool also is absolutely necessary.To combine automatic generative process of grid computing code and the automatic deployment of grid for this reason.Automatically generate to dispose and make up consisting of of file:
(1) obtains property file after little compiler processes;
(2) judge whether directly to write wsdl document by property file;
(3) if directly write, call " starting the GWSDL template " task, produce wsdl document by the GWSDL template; If directly do not write, then produce wsdl document by interface document;
(4) modify wsdl document;
(5) produce the Stub file; Compiling Stub file; Be packaged into jar file;
(6) obtain source code after little compiler processes;
(7) judge whether to provide the WSDD file;
(8) if the WSDD file is not provided, call " starting WSDD template task ", produce the WSDD file; Otherwise, directly obtain given WSDD file;
(9) source file is compiled, be packaged into jar file;
(10) jar file that generates of the wsdl document that (4) are produced, (5), WSDD file that (8) obtain,
(9) jar file of Sheng Chenging is packaged into the GAR file;
(11) dispose mesh services.
Top flow process is very complicated, and we are grouped into several tasks to it:
(1) generates the Stub file;
(2) generating mesh history file;
(3) dispose mesh services;
(4) make up mesh services task one (if user oneself editor WSDD file is then selected this task);
(5) make up mesh services task two (generate the WSDD file if desired automatically, then select this task).
For convenience of description, our supposition has following application example:
Mesh services developer will develop a MathService mesh services.This service provides factory's service at the mesh services end, but the customer in response end is created the request of Service Instance.Two parameters that the Service Instance of creating is submitted to client add, subtract, multiplication and division mathematical computations and return result of calculation.Now adopt the service end of GT3.0.2 grid underlying platform.
The embodiment that the user uses this structure device structure mesh services is:
(1) creates a new mesh services, select factory's service moulding plate;
(2) according to prompting input corresponding information:
The for example name of this mesh services project storing path, bag name, mesh services, mesh services
Description, the description of grid example, GWSDL name, object naming space, PortType (port
Type) name, class names etc. produce defined file;
(3) little compiler is resolved defined file and template file, has generated mesh services automatically and has realized required Java code, mapped file, property file;
(4) realize that with writing generic interface program is the same, the developer revises the specific implementation code basis of writing all operations in the java applet body that generates;
(5) utilize X template analytics engine, generate and dispose the needed All Files of mesh services.If user oneself editor WSDD file then selects to dispose automatically gridding task " structure mesh services task one " task,, then select " structure mesh services task two " task if the user needs to generate automatically the WSDD file.
(6) select to dispose automatically gridding task " generation Stub file " task, " generating Gar " task, " deployment mesh services " task is published to Math.gar grid files on the platform service end, finishes mesh services and makes up.Overall process finishes.