Summary of the invention
A kind of application and development method of offer and device are provided, it is intended to solve to be effectively ensured can completely, be accurately finished application and development so that the problem that the experience effect of application and development is relatively low.
For achieving the above object, the present invention provides a kind of application and development method, comprises the following steps:
After receiving the service request of application and development, call EJB packet, and obtain service context file according to described EJB packet and initialize the execution environment that described service request is corresponding;
According to described service context file under execution environment after described initialization, obtain Spring packet, and determine service corresponding to described service request and execution method corresponding to described service according to described Spring packet;
Complete described service according to described execution method, and back services completes result.
Preferably, according to described service context file under described execution environment after described initialization, before obtaining the step of Spring packet, also include:
Determining and complete relevant information with service, described information includes DAO and/or tool-class;
According to determined information architecture Spring packet.
Preferably, after the described step according to determined information architecture Spring packet, also include:
Described Spring packet is stored and obtains described store path;
Described store path is added in service context file.
Preferably, the step calling EJB packet described in includes:
Class method manes and the parameter relevant to class method manes is obtained by Java reflection;
According to described class method manes and the parameter call EJB packet relevant to class method manes.
Preferably, described complete described service according to described execution method, and back services complete result step after, also include:
When described service execution failure, carried out the rolling back action of business service by business application interface.
Additionally, for achieving the above object, the present invention furthermore provides a kind of application and development device, including:
Calling module, for, after receiving the service request of application and development, calling EJB packet;
Acquisition module, for obtaining service context file according to described EJB packet and initializing the execution environment that described service request is corresponding;It is additionally operable under the execution environment after described initialization according to described service context file, obtains Spring packet;
Processing module, for determining service corresponding to described service request and execution method corresponding to described service according to described Spring packet;
Performing module, for completing described service according to described execution method, and back services completes result.
Preferably, described application and development device also includes:
Determining module, complete relevant information for determining with service, described information includes DAO and/or tool-class;
Build module, for according to determined information architecture Spring packet.
Preferably, described application and development device also includes:
Memory module, for storing and obtain described store path by described Spring packet;
Described processing module, is additionally operable to be added in service context file described store path.
Preferably, described calling module includes obtaining unit and call unit,
Described obtain unit, for obtaining class method manes and the parameter relevant to class method manes by Java reflection;
Described call unit, for according to described class method manes and the parameter call EJB packet relevant to class method manes.
Preferably, described execution module, it is additionally operable to, when described service execution failure, be carried out the rolling back action of business service by business application interface.
The present invention by being combined together the business service of application and development by both EJB and Spring.By both EJB and Spring being combined together the business service of application and development.Realize being prevented effectively from IoC container under EJB mode, AOP ability, based on more weak in POJO integrated third party framework etc.;In concurrent processing under Spring mode, issued transaction, distributed capability, life cycle management etc. more weak;Cannot be effectively ensured can completely, be accurately finished application and development so that the problem that the experience effect of application and development is relatively low.Problem.Effectively guarantee complete, be accurately finished application and development, improve the experience effect of application and development.
Detailed description of the invention
Should be appreciated that specific embodiment described herein is only in order to explain the present invention, is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention is: after receiving the service request of application and development, calls EJB packet, and obtains service context file according to described EJB packet and initialize the execution environment that described service request is corresponding;According to described service context file under execution environment after described initialization, obtain Spring packet, and determine service corresponding to described service request and execution method corresponding to described service according to described Spring packet;Complete described service according to described execution method, and back services completes result.By both EJB and Spring being combined together the business service of application and development.Realize being prevented effectively from IoC container under EJB mode, AOP ability, based on more weak in POJO integrated third party framework etc.;In concurrent processing under Spring mode, issued transaction, distributed capability, life cycle management etc. more weak;Cannot be effectively ensured can completely, be accurately finished application and development so that the problem that the experience effect of application and development is relatively low.Effectively guarantee complete, be accurately finished application and development, improve the experience effect of application and development.
Owing to existing application and development can only use the one in EJB or Spring, IoC container under EJB mode, AOP ability, based on more weak in POJO integrated third party framework etc.;In concurrent processing under Spring mode, issued transaction, distributed capability, life cycle management etc. more weak.Therefore, under based on one of them mode above-mentioned, complete application and development, it is impossible to be effectively ensured can completely, be accurately finished application and development so that the experience effect of application and development is relatively low.
Based on the problems referred to above, the present invention provides a kind of application and development method.
Schematic flow sheet with reference to the first embodiment that Fig. 1, Fig. 1 are application and development method of the present invention.
In one embodiment, described application and development method includes:
Step S10, after receiving the service request of application and development, calls EJB packet, and obtains service context file according to described EJB packet and initialize the execution environment that described service request is corresponding;
Described EJB packet can be EJB assembly (such as, EJB example), described EJB assembly includes ServiceSkeletonBean (service framework object), it is similar to the pond of ServiceContext (service context file), specifies its ServiceContext comprised by published-services.xml.As the pond of ServiceContext, SkeletonBen is the container of Service naturally.Therefore, it becomes the operation of Service and disposes unit, provides the due service support of container such as life cycle, concurrent, practice for Service.The issue of Service and call to be obviously also and completed by SkeletonBen.ServiceClient (service client) to access Service and must flow through calling of SkeletonBen (service object).
User, when needs exploitation application, is sent the service request of application and development, after receiving the service request of application and development, calls EJB packet by ServiceClient.Described EJB packet includes the EJB example created, and when falling with EJB packet, calls EJB example.
Concrete, with reference to Fig. 2, described in call the process of EJB packet and include:
Step S11, obtains class method manes and the parameter relevant to class method manes by Java reflex mechanism;
After receiving service request, a stub (counterfoil) of ServiceClient is obtained by ServiceClientFactory (service client cluster), utilize Java reflex mechanism, obtain an agent object of Service, and obtain the relevant parameter of described agent object.
Step S12, according to described class method manes and the parameter call EJB packet relevant to class method manes.
After described class method manes and the parameter relevant to class method manes, it is determined that described class method manes and EJB packet corresponding to the parameter relevant to class method manes, according to described class method manes and the parameter call EJB packet relevant to class method manes.
After calling EJB packet, obtain service context file and initialize the execution environment that described service request is corresponding according to described EJB packet, namely according to EJB case-based system text file and initialize the execution environment that described service request is corresponding.
Building service context file in advance, concrete, with reference to Fig. 3, the process of described structure service context file may include that
Step S21, it is determined that completing relevant information with service, described information includes DAO and/or tool-class;
Step S22, according to determined information architecture Spring packet;
The objects such as Spring finishing service service dependence and DAO (DAO), various tool-class, by SpringIoC by these complicated dependences and initialization logic write Spring packet, namely write configuration file, be configured to expandable mark language XML text.Described Spring packet is SpringServiceBean.
Step S23, stores and obtains described store path by described Spring packet;
Step S24, is added into described store path in service context file.
Service context file is a base unit of distributed service framework, is responsible for Spring configuration file, and namely management Spring packet, utilizes its constructor, indicated in the path of described Spring datagram.Concrete, described Spring packet is stored and obtains described store path;Described store path is added in service context file.When completing to service, it is possible to the path of the Spring packet included by service context file gets Spring packet.
Step S20, according to described service context file under the execution environment after described initialization, obtains Spring packet, and determines service corresponding to described service request and execution method corresponding to described service according to described Spring packet;
Getting service context file, and after initializing the execution environment that described service request is corresponding, described service context file is called under execution environment after described initialization, according to described service context file acquisition Spring packet, further, store path according to the Spring packet that described service context file includes, gets Spring packet to described store path.Determine service corresponding to described service request and execution method corresponding to described service according to described Spring packet, which or which kind of the execution method that namely requires over completes the service that described service request is corresponding.
Step S30, completes described service according to described execution method, and back services completes result.
After determining the execution method that described service request is corresponding, complete, according to described execution method, the service that described service request is corresponding, and fed back result, namely fed back result by predetermined manner to described ServiceClient.Described predetermined manner can be voice, word, video, picture etc..The described result that completes includes execution information and performs result etc..
The present embodiment by being combined together the business service of application and development by both EJB and Spring.By both EJB and Spring being combined together the business service of application and development.Realize being prevented effectively from IoC container under EJB mode, AOP ability, based on more weak in POJO integrated third party framework etc.;In concurrent processing under Spring mode, issued transaction, distributed capability, life cycle management etc. more weak;Cannot be effectively ensured can completely, be accurately finished application and development so that the problem that the experience effect of application and development is relatively low.Effectively guarantee complete, be accurately finished application and development, improve the experience effect of application and development.
Schematic flow sheet with reference to the second embodiment that Fig. 4, Fig. 4 are application and development method of the present invention.Based on the first embodiment of above-mentioned application and development method, after described step S30, also include:
Step S40, when described service execution failure, carries out the rolling back action of business service by business application interface.
After completing described service according to described execution method, it is judged that whether described service runs succeeded, when running succeeded, the result that feedback runs succeeded;When performing unsuccessfully, feedback performs failed result.When described service execution failure, carried out the rolling back action of business service by service application interface JTA.Rolling back action includes being exactly arrange a point in the middle of operation somewhere to have then proceeded to operating process, if feeling problematic, just carrying out rollback and returning to the point of setting, deletes equal to that some operation below, again completes operation after that point.If certainly commit is just useless.Realize the business service that finishing service more efficient, rational request is corresponding.It is understood that go back a series of extendible cropper of carry, it is achieved the programming of AOP style, namely realize the orderly or random break-in operation in programming process and carry out the amendment adapted to.The process making application and development is more reasonable, and reduces the probability made mistakes in application development process, further increases the accuracy of application and development.
The executive agent of the application and development method of the first and second embodiments of above-mentioned application and development method can be all terminal.Further, the method can be realized by the client (the operation program etc. such as application and development) being arranged in terminal, wherein, this terminal can include but not limited to the electronic equipments such as notebook computer, mobile phone, panel computer or PDA (PersonalDigitalAssistant, personal digital assistant).
The present invention further provides a kind of application and development device.
High-level schematic functional block diagram with reference to the preferred embodiment that Fig. 5, Fig. 5 are application and development device of the present invention.
In one embodiment, described application and development device includes: calling module 10, acquisition module 20, determine module 40, build module 50, processing module 60 and perform module 70.
Described calling module 10, for, after receiving the service request of application and development, calling EJB packet;
Described acquisition module 20, for obtaining service context file according to described EJB packet and initializing the execution environment that described service request is corresponding;
Described EJB packet can be EJB assembly (such as, EJB example), described EJB assembly is ServiceSkeletonBean, is similar to the pond of ServiceContext, specifies its ServiceContext comprised by published-services.xml.As the pond of ServiceContext, SkeletonBen is the container of Service naturally.Therefore, it becomes the operation of Service and disposes unit, provides the due service support of container such as life cycle, concurrent, practice for Service.The issue of Service and call to be obviously also and completed by SkeletonBen.ServiceClient to access Service and must flow through calling of SkeletonBen.
User, when needs exploitation application, is sent the service request of application and development, after receiving the service request of application and development, calls EJB packet by ServiceClient.
Concrete, with reference to Fig. 6, described calling module 10 includes: obtain unit 11 and call unit 12,
Described obtain unit 11, for being obtained class method manes and the parameter relevant to class method manes by Java reflex mechanism;
After receiving service request, by the ServiceClientFactory stub (counterfoil) obtaining ServiceClient, utilize Java reflex mechanism, obtain an agent object of Service, and obtain the relevant parameter of described agent object.
Described call unit 12, for according to described class method manes and the parameter call EJB packet relevant to class method manes.
After described class method manes and the parameter relevant to class method manes, it is determined that described class method manes and EJB packet corresponding to the parameter relevant to class method manes, according to described class method manes and the parameter call EJB packet relevant to class method manes.Described EJB packet includes the EJB example created, and when falling with EJB packet, calls EJB example.
After calling EJB packet, obtain service context file and initialize the execution environment that described service request is corresponding according to described EJB packet, namely according to EJB case-based system text file and initialize the execution environment that described service request is corresponding.
Described determining module 30, complete relevant information for determining with service, described information includes DAO and/or tool-class;
Described structure module 40, for according to determined information architecture Spring packet;
The objects such as Spring finishing service service dependence and DAO (DAO), various tool-class, by SpringIoC by these complicated dependences and initialization logic write Spring packet, namely write configuration file, are configured to XML text.
Described memory module 50, for storing and obtain described store path by described Spring packet;
Described processing module 60, for being added into described store path in service context file.
During service context file, one base unit of distributed service framework, is responsible for Spring configuration file, and namely management Spring packet, utilizes its constructor, indicated in the path of described Spring datagram.Concrete, described Spring packet is stored and obtains described store path;Described store path is added in service context file.When completing to service, it is possible to the path of the Spring packet included by service context file gets Spring packet.
Described acquisition module 20, it is additionally operable under the execution environment after described initialization according to described service context file, obtain Spring packet, and determine service corresponding to described service request and execution method corresponding to described service according to described Spring packet;
Getting service context file, and after initializing the execution environment that described service request is corresponding, described service context file is called under execution environment after described initialization, according to described service context file acquisition Spring packet, further, store path according to the Spring packet that described service context file includes, gets Spring packet to described store path.Determine service corresponding to described service request and execution method corresponding to described service according to described Spring packet, which or which kind of the execution method that namely requires over completes the service that described service request is corresponding.
Described execution module 70, for completing described service according to described execution method, and back services completes result.
After determining the execution method that described service request is corresponding, complete, according to described execution method, the service that described service request is corresponding, and fed back result, namely fed back result by predetermined manner to described ServiceClient.Described predetermined manner can be voice, word, video, picture etc..The described result that completes includes execution information and performs result etc..
The present embodiment by being combined together the business service of application and development by both EJB and Spring.By both EJB and Spring being combined together the business service of application and development.Realize being prevented effectively from IoC container under EJB mode, AOP ability, based on more weak in POJO integrated third party framework etc.;In concurrent processing under Spring mode, issued transaction, distributed capability, life cycle management etc. more weak;Cannot be effectively ensured can completely, be accurately finished application and development so that the problem that the experience effect of application and development is relatively low.Effectively guarantee complete, be accurately finished application and development, improve the experience effect of application and development.
Further, described execution module 70, it is additionally operable to, when described service execution failure, be carried out the rolling back action of business service by business application interface.
After completing described service according to described execution method, it is judged that whether described service runs succeeded, when running succeeded, the result that feedback runs succeeded;When performing unsuccessfully, feedback performs failed result.When described service execution failure, carried out the rolling back action of business service by service application interface JTA.Rolling back action includes being exactly arrange a point in the middle of operation somewhere to have then proceeded to operating process, if feeling problematic, just carrying out rollback and returning to the point of setting, deletes equal to that some operation below, again completes operation after that point.Realize the business service that finishing service more efficient, rational request is corresponding.It is understood that go back a series of extendible cropper of carry, it is achieved the programming of AOP style, namely realize the orderly or random break-in operation in programming process and carry out the amendment adapted to.The process making application and development is more reasonable, and reduces the probability made mistakes in application development process, further increases the accuracy of application and development.
These are only the preferred embodiments of the present invention; not thereby the scope of the claims of the present invention is limited; every equivalent structure utilizing description of the present invention and accompanying drawing content to make or equivalence flow process conversion; or directly or indirectly it is used in other relevant technical fields, all in like manner include in the scope of patent protection of the present invention.