Summary of the invention
Technical matters: the purpose of this invention is to provide a kind of decoupling zero grid upper layer application to avoiding the method for grid computing application to depend on bottom development tool box, make upper strata grid computing application not rely on concrete which or which tool box, and the service that can call the low layer tool box with uniform way by the interface of standard realizes, replace original tool box with new tool box smoothly, thus reach the purpose of simplifying the grid application exploitation and solve grid application develop in the problem of different tool boxes conversion.
Technical scheme: control inversion device of the present invention is a kind of method of the property improved, by adding one in the grid upper layer application with provide the middleware between the low layer tool box of grid support platform to propose.This middleware uses technology such as controlling counter-rotating that the low layer tool box is encapsulated, and the service in the low layer tool box of dynamically searching coupling realizes when upper strata grid application call is served, and finishes the level and smooth conversion between the different tool boxes.
In existing grid upper layer application, because invoked service realizes that title has write in service call person's the code, this makes service call person and ISP produce and is closely connected, and represents with relying on Dependency in UML.For fear of the dependence of grid application, must cut apart this dependence, so we have introduced control counter-rotating Ioc (Inversion of Control) pattern to the tool box.
The control counter-rotating is a kind of cooperation and organizational form of assembly, and the contact of its decoupling zero caller and callee has separated interface and specific implementation.Use this pattern, can be described and Technical Architecture at an abstraction hierarchy fully, therefore regardless of the specific implementation in future, the Ioc pattern can realize concrete realization means are provided for the software of container, framework and so on, belongs to a kind of important pattern application in the framework technology.The Ioc pattern is divided into polytypes such as structure injection, the value of establishing injection, interface injection, they are used to realize caller and callee decoupling zero respectively in frameworks such as EJB/J2EE, Avalon, SpringFramework, WebWork/Xwork, PicoContainer, HiveMind, reach the purpose of separation interface and specific implementation.For the decoupling zero of mesh services caller and ISP in the open grid environment, the Ioc pattern provides the means that realize preferably.
One, architecture
We are divided into the open grid service system from top to bottom application layer, use encapsulated layer, lower-level services layer and resource layer, and Ioc encapsulation middleware is positioned at the application encapsulated layer.It by the encapsulation to the lower-level services layer, provides unification, the standard interface of visiting the low layer mesh services to the upper strata between application layer and lower-level services layer, realize the dynamic adaptation that mesh services is called, and carries out interface coordination and management.
Lower-level services is traditional grid services layer, and lower-level services is mainly provided by the grid computing tool box that Globus, CSF and SRB etc. increase income, and is different with the middleware of using encapsulated layer, and they are general system-oriented middlewares.The lower-level services layer provides the grid computing service ability of core.Along with the continual renovation of mesh services system standard is perfect, various mesh services suppliers certainly will appear.And user's care is how better to use mesh services to solve problem, therefore by using of the dependence of encapsulated layer decoupling zero upper strata to these bottom architecture, avoided the user directly the low layer tool box to be operated dexterously, reached us and simplified the purpose of grid application exploitation.
Two, method flow
1. general grid service call flow process
Mesh services based on Web service is client/service end pattern at present, mesh services call flow shown in Figure 2 is by UDDI (Universal Description in client, Discovery andIntegration) Register obtains mesh services end address and obtains after GWSDL (Grid WSDL) mesh services describes from service end, and it comprises a series of mutual between grid clients and the service end:
Step1: user application calls client stub, by it the suitable SOAP request that converts to is called in this locality;
The step2:SOAP request uses http protocol to send to service end by network, and grid service container is given server stub with it after receiving the SOAP request, and server stub is converted to the form that server realizes that program can be understood to the SOAP request;
Step3: server is carried out the work of being asked after realizing that part is received the request that transfers from server stub;
Step4: the result who carries out request is the SOAP response by server stub treatment conversion;
The step5:SOAP response uses http protocol to send it back client by network.Client stub receives the SOAP response and is converted into the understandable form of client application;
Step6: the End-Customer end is used and is received the result who calls mesh services and use this result.
2. conventional mesh application and development flow process
Traditional grid application exploitation is directly based on existing grid base layer support platform, and we are that example illustrates traditional grid application development process with the current the most ripe Globus Toolkit mesh tool case of grid here.The official release of Globus Toolkit is GT3 (Glbus Toolkit 3) at present, and it has abideed by OGSA grid system framework and core OGSI standard realizes.That uses that GT3 exploitation grid application comprises that the mesh services of service end describes that GWSDL, service realization program, mesh services dispose the user application of describing WSDD (Web Service DeploymentDescriptor) file and client writes the generation of server stub and client stub.By using GT3 to write mesh services, with its basic execution flow process that is deployed to GT3 mesh services end and finishes service call by client.
Be the key step that example is set forth the grid application development process with the MathService mesh services that realizes mathematical operation on the grid platform below:
(1) grid service server end development process
Step1: write the mesh services interface routine with Java, convert thereof into the service interface description document of WSDL form, through the DecorateWSDL instrument it is modified into final WSDL service interface description document again by the Java2WSDL instrument;
Step2:, be compiled into the Stub file of class form again by JAVAC, and be packaged into Math-stub.jar by the Stub file of instrument GSDL2Java by WSDL service interface description document generation Java form.This bag will be used in the application program compiling of client;
Step3: write mesh services with Java and realize program, the service that is compiled into the class form by JAVAC realizes program, needs in the compilation process Stub file of the class form among the step2 is added as classpath.Service realization program with the class form is packaged into Math.jar then;
Step4: write the WSDD deployment descriptor file, and with its Math.jar that generates together with the Math-stub.jar and the step3 of step2 generation, and the WSDL service interface description document that step1 obtains is packaged into Math.gar grid files together.This document will be used for the MathService service is published to grid platform;
Step5: the instruction that operation GT3 provides is published to grid platform with Math.gar grid files;
Step6: after starting the GT3 grid service container, allow this MathService service of client call.
(2) grid clients development process
Step1: write the client-side program that calls mesh services with Java, the client-side program by JAVAC is compiled into the class form needs to use the above Math-stub.jar of step2 generation in the compilation process;
Step2: if the mesh services of being called is the Service Instance that need be created by factory, example is created by the factory that then need call the instruction request service end that GT3 provides;
Step3: carry out the client program calls mesh services that step1 obtains, the mesh services of calling
Step4:GSH (Grid Service Handler) provides the position at mesh services end address and service place as parameter;
Step5: if server end has corresponding mesh services to provide, then carry out user's request, and the result is returned to client, if not this service or call and make mistakes then provides an error messages.
Step6: if the Service Instance that does not need step2 and created, the instruction request that can carry out GT3 provides is destroyed this example.
3. service call and Platform Implementation Coupling point
The various piece of conventional mesh application and development flow process is called and Coupling point between realizing of the service of GT3 platform and as follows with the relation of OGSA/OGSI standard mesh services:
● mesh services interface routine: do not have coupling with the GT3 platform, inherited the GridService interface of OGSI standard.
● mesh services realizes program: be coupled with the GT3 platform, inherited the GridServiceImpl class of GT3, such has realized GridServiceBase and ServiceDataValueCallback interface, wherein the GridServiceBase interface inheritance GridService interface of OGSI standard and other two interfaces that GT3 provided.
● the WSDD deployment descriptor file: with the coupling of GT3 platform, baseClassName, handlerClass, factoryCallback, common parameters such as operationProviders are set at the realization class that GT3 provides.
● call the client-side program of mesh services:, depend on the ServiceGridLocator among the stub, and such has been inherited the ServiceLocator class that GT3 provided and has realized the GridLocator interface that GT3 provided with the coupling of GT3 platform.
● the establishment of factory's example instruction: called the CreateService class that GT3 provided, such depends on classes such as ServiceProperties, GridServiceFactory that GT3 provides, OGSIServiceGridLocator.Simultaneously such and GridServiceFactory class have all been used the interfaces such as Factory of OGSI standard.
4. the coupling of service call and Platform Implementation is peeled off
Avoid the mesh services application and development to depend on fixing grid base layer support platform for reaching, pragmatic these Coupling points now of service call kimonos must be peeled off, this work will encapsulate middleware by Ioc and finish.At different situations, middleware will take different modes to handle getting in touch between application and the low layer tool box.On the whole, for the interface relevant with the OGSI standard, because the user can call service according to the standard interface of existing standard definition, so we use each quasi-mode of Ioc getting in touch of caller and callee peeled off, and its interface that is packaged into compliant is offered upper layer application; And for the standard coupling of undefined interactive interface still, it is adaptive to reach the purpose of avoiding relying on the low layer tool box that we take effective and efficient manner to encapsulate as required.
Main methods to various couplings is as follows:
● realize the coupling of the GridServiceImpl class of program and GT3 for mesh services, adopt the value of the establishing method for implanting of Ioc to come decoupling zero: service realization program class changes a unified encapsulation class of inheriting in the middleware into, and should the encapsulation class externally announce a method setProvider, when being called, mesh services realization program passes to it by the container handle service realization base class relevant with platform.Because the user has stated the interface that it is realized in mesh services realizes class, container need extract the content relevant with standard from this interface, and according to standard for to the defined standard of interface, the realization class of searching and matches criteria in the service realization of platform.When the interface conformance with standard that platform service realizes, only need just simply mate and to obtain a result at the definition of each interface.The interface of realizing when platform service will be used the algorithm that hereinafter will state during not in full conformity with standard.
● baseClassName in the WSDD deployment descriptor file, handlerClass, factoryCallback, the coupling of common parameter values such as operationProviders and GT3, adopt the structure method for implanting of Ioc to come decoupling zero: the correspondence encapsulation class that these common parameter value unifications is set at middleware, when these classes are created, determine the corresponding class relevant with platform, and for the example of these classes is passed to the encapsulation class.
● call the ServiceGridLocator coupling of the client-side program and the GT3 of mesh services, employing comes decoupling zero towards the AOP method that tangent plane inweaves programming: client-side program adopts uniform way to call mesh services, promptly calls the client call class of middleware.Such is then handled the request of client according to different grid platforms and it is sent out according to the form that meets platform.The point of contact of the extraction here is the mesh services call method of each platform.Identical therewith mode decoupling zero is also taked in the instructions such as establishment of factory's example.
5. standard extracts and matching algorithm
OGSI defined the most basic mesh services the GridService portType that must realize, and other optional portType and specific to using or the portType combination in field.OGSI adopts WSDL as the mechanism of describing public grid service interface based on Web service, follows the grammer of XML Schema, is rendered as an ogsi.gwsdl document.The service that is provided when grid base layer support platform realizes that interface does not meet this standard, and we need know that these services realize and the matching degree and the corresponding relation of standard.With reference to the syntactic structure of XML Schema, according to ogsi.gwsdl each standard portType is resolved to ordering rooted tree (orderedrooted tree), be that sample mates each node with these trees then.
Provide concrete matching algorithm below:
Procedure postorder (T: the ordering rooted tree)
The root of r:=T
For from left to right travels through each child node r of r
i
begin
T (r
i) :=with r
iSubtree for root
postorder(T(r
i))
end
Ifr
iBe idol level node then
m:=match(r
i)
Ifr
iBe leaf then
Ifr
iBe the most left child node then of r
C
r:=0
C
r:=C
r+m*μ
rs....r,ri
Ifr
iBe the rightest child node then of r
C
r:=C
r*μ
rs....rp,r
else?C
ri:=C
ri+m*μ
rs....r,ri
Else ifr
iBe the most left child node then of r
C
r:=0
C
r:=C
r+C
ri
Tree root is designated 0, its son by from left to right sequence identification be 1,2,3 ..., the descendants's node under it with from tree root to this node the node of process identify, the most left son as 2 is designated 2.1.μ in the algorithm
R1.r2....rh, iBe r
1.r
2... .r
hThe usefulness coefficient (effect coefficient) of i child node, represent this node that the influence of whole tree coupling is renderd a service.The C that obtains at last
0It is exactly the matching rate of whole portType tree.Resulting intermediate result C in the computation process
rMatrix can obtain the service interface that this platform provides and the mapping relations of each key element of standard portType by setting a suitable threshold value.When calling service, the service that can directly call coupling with reference to the mapping of gained.
6.Ioc the grid application development process after the encapsulation
Still be divided into compiling, pack, issue and call four-stage through the grid application development process after the Ioc encapsulation.But encapsulation through middleware, the service interface program that the user need submit to, service realization program, deployment description document and service call program have all broken away from concrete grid computing underlying platform, originally and the coupling between the platform substitute by unified API that middleware provided, realized that getting in touch of caller and callee peel off.Thereby preceding two stages of development process: the compiling of the compiling of service end and packing and client can not rely on the mesh tool case fully.In latter two stage of development process, the dependence of being stripped from will be finished as required and refill:
● launch phase:, relate to different platform service interface is described the path setting in document, service implementing type storehouse and the configuration modification of service end because the issue of service is relevant with concrete grid underlying platform.Therefore this stage will be finished deployment and be described refilling of document and platform related content, and other parts still keep as the service realization and the irrelevance of platform.
● call the stage: the service of developing in this stage is used to be called and to carry out and is obtained the result, refills so this stage will be finished all dependences.According to the service of calling, different injection orders can be arranged: as if what call is the service that needs by factory's establishment, and what finish injection successively is client factory Service Instance request to create, and service realizes that client service is called, and Service Instance is cancelled request; If what call is temporary service, what finish injection successively is that client service is called, and service realizes.
Beneficial effect:
The inventive method has proposed a kind of new method of avoiding the grid computing application and development to rely on grid computing low level development tool box, is mainly used in solution grid computing application and can't breaks away from the problem that platform carries out, and facilitates for simplifying grid computing application and development flow process.The method grid computing application and development that the application of the invention proposes can be used unified API, has avoided the developer to be familiar with the duplication of labour and the complicacy that relies on platform development mesh services such as GT3 of different grid base layer support platforms.And the present invention makes each stage of grid computing application and development separate as much as possible, helps the simplification based on instruments such as ant of each phase process process, can improve the simplicity and the dirigibility of method for designing.Avoid the grid computing application and development to rely on the grid computing tool box and have following advantage:
1. the exploitation programming is simple and easy
The present invention is intended to simplify the grid computing application and development, has avoided its dependence to the bottom tool box, has made things convenient for the service of application developer to realize program and dispose writing of documents such as description largely.Middleware upwards provides unified API to call and the deployment parameters setting for user program, the developer needn't spended time energy removes to understand the interface and the programming mode in bottom tool box, more saved and changed bottom tool box repeated labor afterwards, the exploitation that grid computing is used is simple.
2. code reusability
Middleware groundwork of the present invention is to finish the encapsulation in bottom tool box and adaptive, for different grid underlying platforms, only need carry out once just can using, adopt the common application pattern of existing mesh tool case, can be used for multiple mesh tool case the pre-packaged of tool box.Based on API provided by the present invention, the grid computing application code need not be revised just can be submitted on the different grid underlying platforms and use, and good reusability is arranged equally.
3. the changeability of standard
XML has become the information representation form of Web technology main flow, though each class standard of grid is constantly weeded out the old and bring forth the new, its presentation format will keep the XML form in the long time.But the algorithm that the present invention proposes is the OGSI standard of parsing XML format not only, can resolve the new standard that substitutes OGSI in the future equally, as long as these standards employings is the XML form.The present invention fully takes into account Development of Grid Technology trend, makes the method that is proposed that the adaptability and the dirigibility of height can be arranged.
4. good extendability
With reference to Open Grid Service architectural model and five layers of hourglass architecture, the present invention presents with the form of grid application middleware, other middle unit developments person can further develop grid computing based on the encapsulation of this middleware, has embodied good extensibility.
5. further simplify for the grid exploitation and provide support
Can see that based in the common application framework of the present invention flow process is divided into four stages independently: compile, pack, issue and call.Preceding two flow processs of grid application exploitation all are totally independent of the grid underlying platform, and latter two flow process also is to finish step by step to rely on to inject.The user only need submit service interface, service realization, service call to and dispose and describe, and the process of back can be by finishing by batch processing instruments such as ant.In conjunction with parsing and code Generation that grid computing is used, application developer can only be submitted the service code the same with common applications to, obtain satisfactory service interface, service realization, service call and dispose description specifically by processing, finish compiling, pack, dispose and call by graphical interfaces then.Therefore the present invention provides support preferably for the further simplification of grid application exploitation.
Embodiment
For convenience of description, our supposition has following application example:
Grid application 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 and the client of GT3.0.2 grid underlying platform.
Then its embodiment is:
(1) application developer is write service interface program Math.java
Mathematical operation operation and parameter and rreturn value types such as statement MathService mesh services will realize adds, subtract, multiplication and division;
(2) application developer is write service realization program MathImpl.java
State that its base class is the general mesh services realization encapsulation class that middleware provided, and realize MathPortType interface (this interface will be generated by service interface program Math.java);
Realize that with writing generic interface program is the same, the developer writes the specific implementation code of all operations of stating in the previous step interface routine in program body;
(3) application developer is write to dispose and is described document Math.wsdd
Set the parameter of the title of describing the MathService mesh services, the title of Service Instance, the path of WSDL, the base class of Service Instance etc.;
BaseClassName in the common parameter, handlerClass, factoryCallback, operationProviders are set at the correspondence encapsulation class that middleware provides respectively;
(4) finish the compiling packing by ant
The required service interface compiling of carrying out is generated, serves work such as realizing compiling, document copying to be submitted to the form of build.xml, ant will be according to all programs and the document that given sequential processes user submitted to, and provide the feedback of every phase process information, will show the build success as inerrancy, directly obtain to be published to the Math.gar grid files on the platform service end.
(5) be published to the grid computing platform service end
Call the deployment analysis program that this middleware provides, this program will be handled to dispose according to the grid platform of being discerned automatically and describe document, and at the GT3.0.2 platform, it will be handled:
● will dispose and describe the corresponding realization class that correlation parameter in the document is revised as GT3.0.2;
● call ant and comprise the deploy document that the GT3.0.2 platform releases news and serve issue;
(6) client-requested is created factory's Service Instance
Call user's request that this middleware provides and install program additional, this program will discern grid platform and the request of the establishment factory Service Instance that proposes according to the user, according to concrete platform to the satisfactory example request to create of service end proposition form;
(7) service end is created factory's Service Instance
The request of service end container customer in response end, the work that establishment factory Service Instance is carried out is as follows:
● container is searched the lower-level services supplier of coupling according to service interface, obtains the service implementing type in GT3.0.2 tool box;
● container according to request with parameter (grid service handle GSH) find the MathService service factory class that is distributed on the platform service end, be its service implementing type of injecting the GT3.0.2 tool box;
● container is created the example of MathService, and it is added the container instance storehouse, and the notice client is created success and informed the GSH of the example of creating;
(8) the client call service example performs mathematical calculations
Program is installed in user's request that calling this middleware provides additional, this program with process user call and correlation parameter proposes the satisfactory service invocation request of form according to concrete platform to service end, and the form that consults return results according to user's setting and service end;
(9) service end is carried out the operation to Service Instance
The service end container receives the request of client, finds the example of corresponding GSH in case library, calls institute's requested operation, and result's form is by appointment returned to client;
(10) client obtain the result of the mathematical operation of asking operation, overall process finishes.