CN100478879C - Method for service logic mapping onto applied language discribed by XML language - Google Patents

Method for service logic mapping onto applied language discribed by XML language Download PDF

Info

Publication number
CN100478879C
CN100478879C CNB2006101652633A CN200610165263A CN100478879C CN 100478879 C CN100478879 C CN 100478879C CN B2006101652633 A CNB2006101652633 A CN B2006101652633A CN 200610165263 A CN200610165263 A CN 200610165263A CN 100478879 C CN100478879 C CN 100478879C
Authority
CN
China
Prior art keywords
code
xml
language
service logic
label
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2006101652633A
Other languages
Chinese (zh)
Other versions
CN1975669A (en
Inventor
寿玉星
张强
袁瑞宏
姜磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNB2006101652633A priority Critical patent/CN100478879C/en
Publication of CN1975669A publication Critical patent/CN1975669A/en
Application granted granted Critical
Publication of CN100478879C publication Critical patent/CN100478879C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

The invention is a method to map the business logic described by XML language to application language, which refers to a technique to generate executable machine language code from parsing description language which is with text format. The method consists of steps as follow: develop framework code according to all the labels used in the XML language description of business logic, and common part of those labels; based on each label in XML language description of business logic, develop the corresponding construction class; the code parser which includes mentioned frame loads the classes to generate code for business processing.

Description

The service logic of XML language description is mapped to the method for applicational language
Technical field
The present invention relates to resolve the technology that the text formatting descriptive language generates the machine language code that can be carried out by computing machine, relate in particular to the method that is mapped to applicational language with the service logic of XML language description.
Background technology
When using a computer processing miscellaneous service logic, often need to carry out modeling analysis, generate business model according to model then and describe.Because the plain text of XML language, powerful label are described characteristic, it more and more is widely used relating to the network application field.The service logic of use XML language description can be more easily in the application server deploy.
Use XML Language Processing complex logic according to the mode of handling at present, have two types:
The one, traditional hard coded mode.That is to say, only use the data of XML language description service logic,, finish service logic by real these data of business processing code analysis.This mode just becomes the XML language format to deposit data, if service logic has anything to change, can only revise the business processing code usually, needs to recompilate a large amount of codes under the general situation, and the code after the compiling need redeploy, very flexible.And complicated along with service logic, then the business processing code also become increasingly complex, more and more huger, the maintainable variation of code.
The 2nd, XML is to the mapping of applicational language.Because XML is the simplification of SGML, so it also belongs to meta-language, can be defined voluntarily by the user, and then produce the applicational language that meets user's demand fully.And applicational language more can be handled various more complicated logics.Complex process logic by XML describes can generate corresponding applicational language by the XML resolver.And the process of this parsing, compiling, processing can be made of one, as is both the XML linguistic interpretation is carried out, and also can separate, and only disposes applicational language after resolving or the target language after the compiling, improves the speed of handling, and brings very big dirigibility.
But the instrument of this processing mode of current popular is just when considering XML to the mapping of object oriented language, each label among the XML all is used as an object to be handled, though dirigibility height, but aggravated the complexity on the room and time, for the system of service logic more complicated, the time of its parsing and processing all sharply rises.
So, must seek a kind of method, can in dirigibility, trade off, optimize the time of resolving and handling, just can be with practical value in the processing of carrying out complex logic is used.
Summary of the invention
The service logic that technical matters to be solved by this invention provides a kind of XML language description is mapped to the method for applicational language, makes the processing speed of code fast, occupation space is few, reduces the complexity on the room and time of resolving.
For solving the problems of the technologies described above, the technical solution adopted in the present invention uses the service logic of XML language description to be mapped to the method for applicational language, comprises step:
(1) according to all labels in the XML language description of service logic, and the public part of these labels, skeleton code write;
(2), write corresponding tag identification code and generate the realization class according to each label in the XML language description of service logic;
(3) comprise the code parser of described skeleton code, load described tag identification code and generate and realize class generating the business processing category code.
Wherein, the tag identification code of writing in the described step (2) generates realizes that the class succession is from public parent.
Described step (3) is specially:
(31) comprise the code parser of described skeleton code, the code that loads each label correspondence generates realizes class;
(32) described code parser generates the realization class according to the code of each label correspondence, generates the described code of each label;
The described code combination of each label that (32) will generate generates the business processing category code.
Compared with prior art, use technical solutions according to the invention, improved analysis mode to the service logic of the expression of XML language, the time of resolving and handling is short, each XML file only generates a code file, i.e. OO class is when instantiation, the corresponding object of XML file makes the processing speed of code fast, occupation space is few; Owing to provide skeleton code in the compiler, can be optimized common logic in the code that generates, and different labels only understands correspondence and goes out diverse ways or code segment, improved the speed that becomes code file from the XML document analysis; For the label of redetermination, the general code that only need write this type of label generates realizes that class is just passable, needn't change the main frame of code, safeguards fairly simple.Make and utilize XML Language Processing complex logic that actual operability is more arranged.
Description of drawings
Fig. 1 makes up the service logic process flow diagram.
Fig. 2 generates business processing category code process flow diagram.
Fig. 3 dynamically disposes the service logic process flow diagram.
Fig. 4 incidence relation overall construction drawing.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
The invention provides when a kind of XML is mapped to applicational language is not simply to convert label to class, but label converts the method for class methods and code to, thereby improved analysis mode to the service logic of the expression of XML language, reduced the quantity of generating code, made and utilize XML Language Processing complex logic that actual operability is more arranged.The method of deployment and maintenance service logic is provided simultaneously.
The service logic of use XML language description is mapped to the method for applicational language, comprises the steps:
The first step, according to all labels in the XML language description of service logic, and the public part of these labels is write skeleton code.
As shown in Figure 1, use the first step of XML Language Processing service logic to be the service logic modeling.By analyzing the logic of concrete application, put out the transaction module of application in order, the label that may occur in the Analysis of X ML language (Tag), and the interface that need externally provide.Write out the XML language description of object then according to this model, again the label that is occurred is put in order out, write out the skeleton code that needs in conjunction with their public part.
Second step, according to each label in the XML language description of service logic, write corresponding tag identification code and generate and realize class.
Write corresponding code according to each label and generate the realization class.These realize the generic request succession from public parent, thereby can obtain the context that generating code needs by the definition of parent.
The 3rd goes on foot, comprises the code parser of described skeleton code, loads described tag identification code and generates the realization class, generates the business processing category code.
Load tag identification code by code parser and realize the class generating code.In code parser, comprise the necessary skeleton code that generates in the first step, when resolving different labels, can use the code of each label correspondence to generate the realization class automatically, generated the code that this label is described.Then these code combinations are got up, generate the business processing category code, see Fig. 2.
For the OO code that generates by this programme can be worked in the business processing process, need a deployment, just reuse above-mentioned the 3rd step, the compilation of source code that the analyzing XML file is generated becomes object code to be deployed in the business processing program.Can have any different for this step of different object oriented languages.If C++, then generally direct other source codes that the source code and the service logic of the generation of the 3rd step are realized of meeting compile together, and generation DLL supplies and uses server calls; If JAVA, then except take with C++ class like static the deployment, can also support dynamic deployment, promptly behind the source code that generates in the 3rd step, directly use the JAVA compiler to be compiled into the CLASS file, realize directly use by service logic, see Fig. 3.
If variation has taken place in service logic, just need be to the expansion of label.All labels can be divided into two classes: method level label and code level label.Method level label is when producing code, can generate calling of interface method, and the tissue of responsible internal resource, so there is considerable code to be integrated in the skeleton code, additions and deletions to this class label need the corresponding modification skeleton code, and generally do not allow nested between this class label; For the code level label, when generating code, mainly be that internalist methodology calls or code snippet, the content of these labels the inside even can be object code does not need to revise skeleton code to the additions and deletions of this type of label.Allow nestedly between the code level label, method level label allows to comprise the code level label.
Associating policy with the CMIS in telecommunication network management field operation is an example below, and the enforcement of technical scheme is described in further detail.
1, service logic framework:
The TMN of telecommunication management network (Telecommunications Management Network) is the solution about the telecommunication apparatus management that ITU-T puts forward, and has described to standardization hierarchical structure, functional structure, the logical organization of a telecommunication management network.The management end of TMN (Manager) is by CMIS operation agent end (Agent).The Agent of TMN be the managed object that is abstracted into of some real network resources (Managed Object, MO).Managed object is described by GDMO.The logical relation that between these managed objects, has more complicated usually, when certain MO of operation, need judge whether to satisfy condition precedent, trigger some operation of other MO according to the difference of action type, even whether the judgment data condition for consistence satisfies after operation is finished, and usually these relations is referred to as associating policy.
The incidence relation processing block shelf structure that utilizes the present invention to make up is seen Fig. 4.The core of association process is the analyzing XML configuration file, and called side input operation order is by resolving the XML of corresponding MOC, checking of being correlated with and related processing.Wherein:
Correlation model---receive the CMIS operational order of input, call checking and related processing that this resolver of ordering corresponding MOC carries out operational order.Because it is related that the CMIS operational order of related generation can continue to produce, thus carry out recursive call by correlation model once more, up to handling all related results.
Resolver---relating module is when initialization, and the configuration file of platform scanner MOC changes into the JAVA object with XML, and this JAVA object is exactly to carry out the logical process function that defines in the XML configuration file.
The access control device---in fact also be controller, it comprises three types checking to " checking between field validation, table, self-defined checking ".Resolver is according to order these identifying objects to be joined in the access control device when handling, and is concentrated by the access control device these identifying objects are focused on again.Such benefit is to be optimized raising place efficient when handling.
Related processor---according to the source record of initiating, be combined in the logic script function that XML is provided with, generate the object run record.Because the operation of a MOC may cause the related operation of multiple MOC, so in the processing procedure of an operational order, may call repeatedly related processor and carry out related.
The value of counter---calculation expression.
MIF---carry out the functional module of CMIS operation.
This shows that externally provide the calling interface of service logic by correlation model, resolver is responsible for the parsing of XML file to the JAVA file, other module then is the skeleton code of service logic.
2, generate incidence relation XML file by the GDMO model:
The behavior of certain class MOC has been described in the GDMO model:
NB1CONFIGSETPreCreate?BEHAVIOUR
DEFINED AS " if 1 increase main with cover number, then must guarantee unique, i.e. following permission of a network element
The main data of using of one cover are arranged; "
BSCEquipmentPostCreate?BEHAVIOUR
DEFINED AS " 1, database (insert database table CONFIGSET)
This is a priori conditions, and implication herein is to guarantee main uniqueness with data when creating a MO.
Its corresponding XML file is:
<mocSourceOperate?operate=″create″>
<mocValid>
<!--isMain=master,then?it?must?be?unique*******-->
<mocIftest=″new?Boolean($S{ISMAIN}.intValue()==0)″>
<mocTable name=″isMainValid″ targetVar=″isMainCount″ scope=″1″
targetMoc=″NB1CONFIGSET″where=″%ISMAIN=0″/>
<mocCompare name=″isMainValidTest″test=″new
Boolean($V{isMainCount}.intValue()&lt;=0)″
errorCode=″ERR_NB1DEV_NB1CONFIGSET_INVALIDISMAIN+0″/>
</mocIf>
</mocValid>
<!--******write?the?DB*******-->
<mocMif/>
</mocSourceOperate>
<mocSourceOperate?operate=″delete″>
<mocMif/>
</mocSourceOperate>
<mocSourceOperate?operate=″set″>
<mocMif/>
</mocSourceOperate>
Comprising two information partly:
(1) priori conditions (seeing mocValid) that defines among the checking GDMO.Its processing logic is, if the MO that creates leads to use data, then wants Query Database, sees whether to exist the master to use data that if exist, it is unusual just to dish out, otherwise proceeds.
(2) the MO data are write database (seeing mocMif).
The label that comprises in this XML file has:
Total framework that a class is handled is represented in mocSourceOperate---expression source MOC operation to be processed, is the root label of all other labels.It is unique method level label.It must have the operate attribute: its value is the CMIS operation types, and three kinds of values are arranged, and (create, delete set), correspond to three interface methods respectively.Provided the create method in the generating code in the analysis result of described in the back MocSourceOperate and MocValid label.
MocValid---represent a proof mark.Here be to describe " will guarantee main uniqueness when creating a MO " constraint with data.
MocMif---the source operation is put in storage.This label can trigger and call the CMIS operation that defines in the MIF module initiation mocSourceOperate label.
MocIf---executive condition is judged.Its test attribute is the condition judgment expression formula, and its result is necessary for the boolean type.It has used the JAVA code that embeds, “ $S{ISMAIN} as can be seen " represent ISMAIN attribute in the creation operation input parameter.
MocTable---carry out a CMIS inquiry, Query Result is stored in objective result concentrates.
MocCompare---verify comparison according to expression formula.When the result of expression formula is a true time, this checking is passed through.
3, realize class according to XML file edit tag identification code:
All there is corresponding tag identification code to realize class to each label, for example the mocSourceOperate label realized class
MocSourceOperateTag:
public?class?MocSourceOperateTag?extends?ErrorTag
{
public?void?setOperate(String?operate)
{
this.operate=operate;
}
public?void?doTag(XMLOutput?output)
{
... (summary)
}
}
And to the realization class MocValidTag of mocValid label:
public?class?MocValidTag?extends?ErrorTag
{
public?void?doTag(XMLOutput?output)
{
super.doTag(output);
// preparation context (code slightly)
// the code block that embed
Element.addPreviosText (0, " // corresponding access control label ");
element.addPreviosText(0,″vc=(ValidControl)valids.get(\″″+script.getName()+″\″);″);
Element.addPreviosText (0, " // because its base class is ExcuteGetMois ");
element.addPreviosText(0,″execute=vc;″);
Element.addPreviosText (0, " // carry out data source to reset points to article one record (source operation).″);
element.addPreviosText(0,″sf.reset();\n″);
Element.addPreviosText (0, " // operand is composed to counter, at this moment, counter just can be handled expression
The processing of various types of variablees in the formula.″);
element.addPreviosText(0,″calculator.setSource(sf.getSource());″);
element.addPreviosText(0,″calculator.setAncestor(sf.getAncestor());″);
element.addPreviosText(0,″calculator.setVarible(varibles);″);
Element.addPreviosText (0, " each the bar source record of // circular treatment ");
element.addPreviosText(0,″while(sf.next()){\n″);
element.addLastText(0,″}″);
element.addLastText(0,″vc.validExtends();\n″);
// preparation context (code slightly)
}
}
All realization classes are all inherited the ErrorTag class, have not only preserved the context of skeleton code in this parent, and insert the prompting when makeing mistakes automatically in the code that generates.
The setOperate method is that the operate attribute is set automatically in the MocSourceOperateTag class.The doTag method is the code that definition will be inserted.Owing to allow to comprise all labels except that mocSourceOperate below the mocSourceOperate label, statement wherein all is by the nested label generation of inside.It only is responsible for the create method frame that needs is set up, and comprises the warming-up exercise of access control device, related processor, counter.
Have only the doTag method in the MocValidTag class, wherein definition will be verified the code that needs insertion.AddPreviosText method by the invoke code unit can be inserted the forward part statement block, and the addLastText method can be inserted the rear section statement block, can just constitute a before/after statement framework like this, can in the statement block of front and back, insert the code of its inner label definition, realize the nested of label.
Code in Fig. 9 is exactly the analysis result of MocSourceOperate and MocValid label.
4, code parser resolves to corresponding JAVA code according to tag identification code realization class and is deployed in the Service Process Server:
The analysis result of MocSourceOperate and MocValid label is:
protected?void?create(MocDataSource?date,RelationModel?model)throws
RelationException{
... (slightly, contextual preparation)
Prompting when // tag processes is made mistakes
tagErrorInfo=″file:/D:/shouyuxing_view/ZXWOMC_VOB/CODE/deploy/output/zxwomc/ums-svr/
zxwomc/RNS/NODEB/zxwomc-osf-cm-nodeb.par/conf/n1?conf/n1dev/mocrelation/3.00.030e/NB1
CONFIGSET.relation:5:-1:<z:mocValid>″;
// corresponding access control label
vc=(ValidControl)valids.get(″vc_0″);
// because its base class is ExcuteGetMois
execute=vc;
// carry out data source to reset, point to article one record (source operation).
sf.reset();
// operand is composed to counter, at this moment, counter just can have been handled the processing of various types of variablees in the expression formula.
calculator.setSource(sf.getSource());
calculator.setAncestor(sf.getAncestor());
calculator.setVarible(varibles);
Each the bar source record of // circular treatment
while(sf.next()){
... (slightly, other nested tag identification code)
}
vc.validExtends();
... (slightly, other processing and contextual release)
}
Dynamic deployment when having used startup of server in actual applications.In server, only need to dispose the XML file, when startup of server, just by these XML files of resolver resolves, generate corresponding JAVA file, the JAVA compiler that re-uses JDK compiles these JAVA files, object code---CLASS file with generating is loaded in the whole service logical process program automatically by Classloader.

Claims (3)

1, a kind of service logic of the XML of use language description is mapped to the method for applicational language, it is characterized in that, comprises step:
(1) when managed object in the establishment telecommunication management network, guarantees main uniqueness with data, and the managed object data are preserved with the XML document form, according to all labels in the XML language description of service logic, and the public part of these labels, write skeleton code, be deployed in the server;
(2) when startup of server,, write corresponding tag identification code and generate the realization class according to each label in the XML language description of service logic;
(3) comprise the code parser of described skeleton code, load described tag identification code and generate and realize class, resolve and generate the business processing category code, and be loaded in the service logic by Classloader;
Wherein, in resolving generation business processing category code, each XML file only generates a code file.
2, the service logic of use XML according to claim 1 language description is mapped to the method for applicational language, it is characterized in that, the tag identification code of writing in the described step (2) generates realizes that the class succession is from public parent.
3, the service logic of use XML according to claim 1 and 2 language description is mapped to the method for applicational language, it is characterized in that described step (3) is specially:
(31) comprise the code parser of described skeleton code, the code that loads each label correspondence generates realizes class;
(32) described code parser generates the realization class according to the code of each label correspondence, generates the described code of each label;
The described code combination of each label that (32) will generate generates the business processing category code, and is loaded in the service logic by Classloader.
CNB2006101652633A 2006-12-15 2006-12-15 Method for service logic mapping onto applied language discribed by XML language Expired - Fee Related CN100478879C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101652633A CN100478879C (en) 2006-12-15 2006-12-15 Method for service logic mapping onto applied language discribed by XML language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101652633A CN100478879C (en) 2006-12-15 2006-12-15 Method for service logic mapping onto applied language discribed by XML language

Publications (2)

Publication Number Publication Date
CN1975669A CN1975669A (en) 2007-06-06
CN100478879C true CN100478879C (en) 2009-04-15

Family

ID=38125760

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101652633A Expired - Fee Related CN100478879C (en) 2006-12-15 2006-12-15 Method for service logic mapping onto applied language discribed by XML language

Country Status (1)

Country Link
CN (1) CN100478879C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455316A (en) * 2012-07-27 2013-12-18 安徽工业大学 Class-based code generator
CN109445890A (en) * 2018-10-09 2019-03-08 北京达佳互联信息技术有限公司 A kind of method for showing interface, device, terminal device and storage medium

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101415026B (en) * 2008-11-28 2012-06-27 闻泰通讯股份有限公司 Method for analyzing XML formatted data of dynamic content distribution client terminal
CN102868717A (en) * 2011-07-08 2013-01-09 华为软件技术有限公司 Method, device and system for editing and debugging voice extensible markup language script
CN104572894A (en) * 2014-12-24 2015-04-29 天津南大通用数据技术股份有限公司 Method for describing service model by utilizing XML (Extensible Markup Language) in business intelligence and business intelligence system
CN107463421B (en) * 2017-07-14 2020-03-31 清华大学 Compiling and executing method and system of static flow model
CN116126304B (en) * 2023-02-21 2023-12-22 北京计算机技术及应用研究所 XML-based extended Lustre code generation method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455316A (en) * 2012-07-27 2013-12-18 安徽工业大学 Class-based code generator
CN109445890A (en) * 2018-10-09 2019-03-08 北京达佳互联信息技术有限公司 A kind of method for showing interface, device, terminal device and storage medium

Also Published As

Publication number Publication date
CN1975669A (en) 2007-06-06

Similar Documents

Publication Publication Date Title
KR100995199B1 (en) Reflection-based processing of input parameters for commands
JP4365142B2 (en) Computer-readable medium, system, and method for associating properties with objects
CN100478879C (en) Method for service logic mapping onto applied language discribed by XML language
US8042091B2 (en) Automatic composition of model transformations
US8869098B2 (en) Computer method and apparatus for providing model to model transformation using an MDA approach
CN100492290C (en) Method for acquiring and converting the state of component in the time of operation during software dynamic evolvement
US20050066050A1 (en) Data conveyance management
US20090144703A1 (en) Method and system for versioning a software system
US8676808B2 (en) Data store interface that facilitates distribution of application functionality across a multi-tier client-server architecture
Arcelli et al. Performance-driven software model refactoring
US8464213B1 (en) Customized control building
KR20060111363A (en) Mechanism for obtaining and applying constraints to constructs within an interactive environment
EP1452962B1 (en) System and method for defining and using subclasses declaratively within markup
Bottoni et al. Specifying integrated refactoring with distributed graph transformations
US20080127128A1 (en) Type Validation for Applications Incorporating A Weakly-Typed Language
Voelter A family of languages for architecture description
Åkesson et al. Jatte: A tunable tree editor for integrated DSLs
Garcés et al. Adaptation of models to evolving metamodels
US20190244151A1 (en) Just in time compilation (jit) for business process execution
Ahmed et al. Extending unified modeling language to support aspect-oriented software development
Mügge et al. Integrating aspect-orientation and structural annotations to support adaptive middleware
Kraas Towards an extensible modeling and validation framework for SDL-UML
CA2566025C (en) Type validation for applications incorporating a weakly-typed language
Li et al. Automated transformations from UML behavior models to contracts
Clark et al. Transformation language design: A metamodelling foundation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090415

Termination date: 20151215

EXPY Termination of patent right or utility model