The method and open platform system of open platform Run Script
Technical field
The present invention relates to information technology field more particularly to the methods and open platform system of open platform Run Script.
Background technique
Open platform can pass through the application programming interface (Application of open software systems
Programming Interface, API) or function (function) increase external program by the software systems
Function or the resource for using the software systems, the source code without changing the software systems.Open platform is referred to as
Ability open platform.
Open platform is connect on the basis of integrating and using existing software systems resource using the opening of unified multi-layer
Mouth carrys out the ability of Freeware system, assembles potential, creative developer on internet, allows developer that can utilize these
Ability constantly creates better business application and service, realizes the unlimited creativity of developer, is formed large quantities of new
Mobile Internet application and service.
Use the process of the ability of open platform are as follows: developer develops script, is deployed to open platform;Terminal user calls
The uniform resource locator (Uniform Resource Locator, URL) of script;Open platform Run Script.
But developer may dispose the script including run time error on an open platform, this will lead to open platform
When perform script, the stability of open platform is influenced.
Summary of the invention
The present invention provides the method and open platform system of a kind of open platform Run Script, can be improved open platform
System stability, avoid open platform because operation have run time error script and caused by business service ability decline.
In a first aspect, providing a kind of method of open platform Run Script, comprising: the open platform obtains script;Institute
It states open platform and precompile is carried out to the script, obtain the binary file of the script;Described in the open platform determines
With the presence or absence of the run time error in script error pattern base in binary file, the script error pattern base includes at least one
A run time error;If the open platform determines that there are the operations in the script error pattern base in the binary file
When mistake, then do not execute the binary file.
In the embodiment of the present invention, open platform is according to script error pattern base, to the operation in script before perform script
When mistake checked, do not need to provide the detection that independent test server can be achieved with run time error in script, to mention
The system stability of high open platform, avoid open platform because operation have run time error script and caused by business service
Ability decline.
In one possible implementation, the script error pattern base includes the error characteristic of endless loop mistake;Its
In, the open platform determines in the binary file with the presence or absence of the run time error in script error pattern base, comprising:
The open platform according to, there are the error characteristic, determined in the binary file in the binary file exist it is described
Endless loop mistake.
In the embodiment of the present invention, judge that there are endless loops for script before script execution, to forbid endless loop script
Operation, avoids resource from being otherwise fully engaged, to avoid influencing other script program operations.
In one possible implementation, the error characteristic of the endless loop mistake includes circulation mark, cycling condition
Value is in true and loop body without exit statement;Wherein, there are the mistakes according in the binary file for the open platform
Feature determines that there are the endless loop mistakes in the binary file, comprising: the open platform checks the binary system text
It is identified in part with the presence or absence of the circulation;When being identified in the open platform inspection binary file there are the circulation,
Whether the cycling condition value for checking that circulation identifies corresponding circulation described in the binary file is true;The open platform inspection
When to look into the cycling condition value of circulation described in the binary file be true, check in the loop body of the circulation whether exit
The sentence of circulation;The open platform check in the loop body of the circulation without exit circulation sentence when, determine described two into
There are the endless loop mistakes in file processed.
In one possible implementation, the method also includes: the open platform determines the binary file
When the middle run time error there are in the script error pattern base, generation error prompt information.
In the embodiment of the present invention, open platform detects to prompt the mistake there are when run time error in script, so as to
So that the reason of developer or terminal user understand not perform script, improves the satisfaction of developer or terminal user.
In one possible implementation, the method also includes: if the open platform determines binary system text
There is no the run time error in the script error pattern base in part, then the binary file is executed.
In the embodiment of the present invention, the script that run time error is not present is executed, to guarantee that the function of correct script can be real
It is existing, meet the needs of developer or terminal user.
In one possible implementation, the script is the script write using MVEL.
Second aspect provides a kind of open platform system, comprising: module is obtained, for obtaining script;Precompile module,
For carrying out precompile to the script, the binary file of the script is obtained;Determining module, for determining the binary system
With the presence or absence of the run time error in script error pattern base in file, the script error pattern base includes at least one operation
When mistake;Execution module, for determining that there are the script error pattern bases in the binary file in the determining module
In run time error when, do not execute the binary file.
In the embodiment of the present invention, open platform system is according to script error pattern base, in script before perform script
Run time error is checked, does not need to provide the detection for the run time error that independent test server can be achieved in script,
To improve the stability of open platform system, avoid open platform system because operation have run time error script and caused by
The decline of business service ability.
In one possible implementation, the script error pattern base includes the error characteristic of endless loop mistake;Its
In, the determining module determines the binary system text specifically for there are the error characteristics according in the binary file
There are the endless loop mistakes in part;The execution module is specifically used for determining in the binary file in the determining module
There are when the endless loop mistake, the binary file is not executed.
In the embodiment of the present invention, judge that there are endless loops for script before script execution, to forbid endless loop script
Operation, avoids resource from being otherwise fully engaged, to avoid influencing other script program operations.
In one possible implementation, the error characteristic of the endless loop mistake includes circulation mark, cycling condition
Value is in true and loop body without exit statement;Wherein, the determining module is specifically used for: check in the binary file whether
There are circulation marks;When identifying in the binary file there are the circulation, institute in the binary file is checked
It states circulation and identifies whether the cycling condition value of corresponding circulation is true;The cycling condition of the circulation described in the binary file
Whether when value is true, checking has the sentence for exiting circulation in the loop body of the circulation;Nothing is moved back in the loop body of the circulation
When the sentence recycled out, determine that there are the endless loop mistakes in the binary file.
In one possible implementation, the open platform system further includes miscue module, for described
Determining module determines that generation error mentions there are when the run time error in the script error pattern base in the binary file
Show information.
In the embodiment of the present invention, open platform detects to prompt the mistake there are when run time error in script, so as to
So that the reason of developer or terminal user understand not perform script, improves the satisfaction of developer or terminal user.
In one possible implementation, the execution module is also used to determine the binary system in the determining module
There is no when the run time error in the script error pattern base in file, the binary file is executed.
In the embodiment of the present invention, the script that run time error is not present is executed, to guarantee that the function of correct script can be real
It is existing, meet the needs of developer or terminal user.
In one possible implementation, the script is the script write using MVEL.
The third aspect, provides a kind of open platform system, including input interface, output interface, at least one processor,
Memory, the processor are used to execute the code in the memory, and when the code is performed, the processor is realized
Method in first aspect.
Fourth aspect, provides a kind of computer-readable medium, and the computer-readable medium storage is used for open flat
The program code of Run Script in platform, said program code include the instruction for executing the method in first aspect.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, will make below to required in the embodiment of the present invention
Attached drawing is briefly described, it should be apparent that, drawings described below is only some embodiments of the present invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing.
Fig. 1 is the schematic flow chart of the method for open platform Run Script in the prior art.
Fig. 2 is the schematic flow chart of the method for the open platform Run Script of the embodiment of the present invention.
Fig. 3 is the schematic flow chart of the method for the open platform Run Script of the embodiment of the present invention.
Fig. 4 is the schematic diagram of the open platform system of the embodiment of the present invention.
Fig. 5 is the schematic diagram of the open platform system of the embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
Embodiment for a better understanding of the present invention first introduces some terms in the embodiment of the present invention below.
Script is the extension of autoexec, is a kind of program that plain text saves, computer script journey in general
Sequence is the combination that a series of determining control computers carry out arithmetic operation movement, and certain logic branch wherein may be implemented
Deng.
Briefly, script is exactly the written order of a rule, these written orders be it can be seen that (can such as use note
This opening of thing is checked, is edited), shell script when being executed, is an interpreter by system, the one rule is translated into machine
The identifiable instruction of device, and executed by program sequence.Because of the script processes of translation together more when being executed, it is than two
Binary program execution efficiency wants more slightly lower.
Run time error is different from syntax error, is possible to lead to the problem of when referring to operation, and these problems
It can be handled, thus avoidance breakout program, generation is bad to obtain user experience.
Embodiment is in the difference of the method for open platform Run Script in the prior art for a better understanding of the present invention,
The method for first Fig. 1 being combined to introduce open platform Run Script in the prior art below.
Fig. 1 is the schematic diagram of the method for open platform Run Script in the prior art.
S102, open platform obtain script.
S104, open platform carry out precompile to script, obtain binary file.
S106, open platform execute the binary file that precompile obtains, obtain implementing result.
There are above-mentioned steps to can be seen that open platform to script precompile success, i.e. execution should after obtaining binary file
Binary file causes resource to be otherwise fully engaged, influences it when will lead to the mistake that there is such as endless loop etc in script in this way
His script program operation, that is, cause the resource of open platform by unreasonable use.
Solution to the problems described above is to run the script on independent testing service device in the prior art, confirms the foot
This without such as endless loop run time error when, then script is deployed on open platform, run by open platform.But this solution
Certainly method needs to provide the extra resources such as running environment identical with open platform.
In view of the above-mentioned problems, the embodiment of the present invention proposes a kind of method of open platform Run Script, both do not need to mention
For additional independent resource, and it can ensure that open platform will not run the script there are run time error.
Fig. 2 is the schematic flow chart of the method for the open platform Run Script of the embodiment of the present invention.It should be understood that Fig. 2 shows
Detailed step or the operation of the method for open platform Run Script are gone out, but these steps or operation are only examples, the present invention is real
Apply the deformation that other operations or each operation in Fig. 2 can also be performed in example.In addition, part steps in Fig. 2 can be by
It is executed according to the different sequences presented from Fig. 1, and it is possible to not really want to execute all operationss in Fig. 2.
S202, open platform obtain script.Open platform in the embodiment of the present invention is the composition in open platform system
Part, the open platform system further include the physical unit for running the open platform, and the open platform in the embodiment of the present invention is equal
It is that the step and subsequent step are completed on the physical unit of open platform system.The script that open platform obtains can be
The script that developer is write using the language that open platform is supported on an open platform, is also possible to developer on other platforms
After writing, the script that is deployed on open platform.
In the embodiment of the present invention, the logic interfacing that terminal user calls the script can be, triggering open platform obtains should
Script, in order to execute subsequent operation.
S204, open platform carry out precompile to script, obtain the binary file of script.Open platform carries out script
When precompile, the syntax error etc. in script can be checked.
S206, open platform determine in binary file with the presence or absence of the run time error in script error pattern base, institute
Stating script error pattern base includes at least one run time error.
Open platform (does not check syntax error such as) after carrying out precompile success to script, can be according to script error
Pattern base checks the resulting binary file of precompile, whether there is script error mould in the binary file to determine
The one or more run time error for including in formula library.
Open platform is unsuccessful to script progress precompile, then does not continue to execute step S206 and subsequent step.This
When, open platform can exit the operational process of script.
S208, open platform determines in binary file there is no when the run time error in script error pattern base, transports
The row binary file.At this point, determining since the binary file of open platform operation passes through the inspection of step S206 without operation
When mistake, therefore open platform operation binary file during be not in such as endless loop etc mistake.
S210, open platform determines in binary file there are when the run time error in script error pattern base, does not transport
The row binary file.
Open platform determines in binary file there are when the run time error in script error pattern base, does not rerun this
Binary file, to avoid there is mistake.At this point, open platform can exit the operational process of script, mistake also can be generated
Prompt information prompts the mistake to developer or terminal user, in order to which developer's change mistake or terminal user terminate the foot
This operation.
In the embodiment of the present invention, open platform is according to script error pattern base, to the operation in script before perform script
When mistake checked, do not need to provide the detection that independent test server can be achieved with run time error in script, to mention
The system stability of high open platform, avoid open platform because operation have run time error script and caused by business service
Ability decline.
In the embodiment of the present invention, the error characteristic of run time error can specifically include in script error pattern base.Such as foot
It may include the error characteristic of endless loop mistake in this error pattern library.At this point, open platform determine in binary file whether
There are the specific embodiments of the run time error in script error pattern base are as follows: open platform exists according in binary file
Error characteristic in script error pattern base determines that there are endless loop mistakes in binary file.
During the present invention is implemented, the error characteristic in script error pattern base for indicating endless loop mistake may include circulation
Mark (such as " while "), cycling condition value are in true (such as " true ") and loop body without exit statement, i.e., including circulation mark
In script, if the circulation identifies the condition value of corresponding circulation when being true, sentence is not urged out in loop body, then illustrates that this is followed
Ring is endless loop.
At this point, open platform is according to there are error characteristic, determining that there are endless loops in binary file in binary file
The specific embodiment of mistake are as follows: open platform checks in binary file with the presence or absence of circulation mark;Open platform checks two
When there is circulation mark in binary file, the cycling condition that circulation described in binary file identifies corresponding circulation is continued checking
Whether value is true;When open platform checks that the cycling condition value of circulation described in binary file is true, circulation is continued checking
Whether the sentence that exits circulation is had in loop body;Open platform checks in the loop body of the circulation without the sentence for exiting circulation
When, determine that there are endless loop mistakes in binary file.
Introducing below according to a specific script example, which whether there is in determining script in the embodiment of the present invention, extremely follows
The method of ring mistake.
Such as the feature for the endless loop mistake for including in script error pattern base are as follows: schema name (endless loop detection), circulation mark
Know (while), condition is constant (true) and loop body without exit statement.
Include following sentence in the script of developer's deployment on an open platform:
Then after open platform successfully obtains binary file to script precompile, take out dead in script error pattern base
" the circulation mark (while) " of cycle detection, and matched in binary file.It is matched in binary file
After " while ", continues taking-up " condition is constant (true) " and matched in binary file, in the above-mentioned of binary file
Match whether its condition is " true " in " while " circulation;It is matched in above-mentioned " while " circulation in binary file
Whether there is or not exit statements to be searched after " true " in above-mentioned " while " circulation in binary file for condition;
If illustrating that the circulation is endless loop without exit statement in above-mentioned " while " circulation, i.e., being deposited in the binary file
In endless loop mistake;If having exit statement in above-mentioned " while " circulation, illustrating the circulation not is circulation, i.e. binary system text
Endless loop mistake is not present in part.
In the embodiment of the present invention, the script of open platform operation can be MVFLEX expression language (MVFLEX
Expression Language, MVEL) write.MVEL is the powerful expression formula based on java application
Language, the language of (Runtime) when being a kind of embeddable expression language of dynamic/static state and providing operation for Java platform
Speech.
Fig. 3 is the schematic flow chart of the method for the open platform Run Script of the embodiment of the present invention.In Fig. 3 and in Fig. 1
The meaning that identical label indicates is identical, and details are not described herein again.But according to label S103 Fig. 1 different from Fig. 3 it is found that originally
The method of the open platform Run Script of inventive embodiments it is different from the method for open platform Run Script in the prior art it
It is in after: open platform carries out precompile to script, before perform script, is checked in script according to script error pattern base
Run time error, and there is no the binary files of ability perform script when run time error in determining script.
Therefore, the method for the open platform Run Script of the embodiment of the present invention does not need to provide independent test server energy
It realizes the detection of the run time error in script, to improve the system stability of open platform, avoids open platform because of operation
Have a script of run time error and caused by business service ability decline.
Fig. 4 is the schematic diagram of the open platform system of the embodiment of the present invention.It should be understood that the open platform in Fig. 4
Modules in system 400 can be deployed on the same physical equipment, can also be deployed on different physical equipments.Figure
The open platform in method in 2 is the component part of open platform system 400.
Module 410 is obtained, for obtaining script.
Precompile module 420 obtains the binary file of the script for carrying out precompile to the script.
Determining module 430, when for determining in the binary file with the presence or absence of the operation in script error pattern base
Mistake, the script error pattern base include at least one run time error.
Execution module 440, for determining that there are the script errors in the binary file in the determining module 430
When run time error in pattern base, the binary file is not executed.
In the embodiment of the present invention, open platform system is according to script error pattern base, in script before perform script
Run time error is checked, does not need to provide the detection for the run time error that independent test server can be achieved in script,
To improve the stability of open platform system, avoid open platform because operation have run time error script and caused by business
Service ability decline.
Optionally, the script error pattern base includes the error characteristic of endless loop mistake;Wherein, the determining module tool
Body is used for according to there are the error characteristic, determining that there are the endless loops in the binary file in the binary file
Mistake;The execution module is specifically used for determining that there are the endless loop mistakes in the binary file in the determining module
When, the binary file is not executed.
In the embodiment of the present invention, judge that there are endless loops for script before script execution, to forbid endless loop script
Operation, avoids resource from being otherwise fully engaged, to avoid influencing other script program operations.
Optionally, the error characteristic of the endless loop mistake include circulation mark, cycling condition value be true and loop body in
Without exit statement;Wherein, the determining module is specifically used for: checking in the binary file and marks with the presence or absence of the circulation
Know;When identifying in the binary file there are the circulation, check that circulation mark described in the binary file corresponds to
The cycling condition value of circulation whether be true;When the cycling condition value of the circulation described in the binary file is true, check
Whether the sentence that exits circulation is had in the loop body of the circulation;Without the sentence for exiting circulation in the loop body of the circulation
When, determine that there are the endless loop mistakes in the binary file.
Optionally, the open platform system further includes miscue module, for determining institute in the determining module 430
It states in binary file there are when the run time error in the script error pattern base, generation error prompt information.
In the embodiment of the present invention, open platform detects to prompt the mistake there are when run time error in script, so as to
So that the reason of developer or terminal user understand not perform script, improves the satisfaction of developer or terminal user.
Optionally, the execution module is also used to determine that there is no described in the binary file in the open platform
When run time error in script error pattern base, the binary file is executed.
In the embodiment of the present invention, the script that run time error is not present is executed, to guarantee that the function of correct script can be real
It is existing, meet the needs of developer or terminal user.
Optionally, the script is the script write using MVEL.
Fig. 5 is the schematic diagram of the open platform system of the embodiment of the present invention.The open platform system 500 of Fig. 5 is wrapped
Include input interface 510, at least one processor 520, memory 530 and output interface 540.
Input interface 510, the information of the instruction open platform system Run Script for receiving terminal user's transmission.
At least one processor 520 obtains the binary file of the script for carrying out precompile to the script.
Memory 530, for storing script error pattern base, when the script error pattern base includes at least one operation
Mistake.
At least one processor 520 is also used to determine in the binary file with the presence or absence of in script error pattern base
Run time error.
At least one processor 520 is also used in determining the binary file that there are in the script error pattern base
Run time error when, do not execute the binary file.
In the embodiment of the present invention, open platform system is according to script error pattern base, in script before perform script
Run time error is checked, does not need to provide the detection for the run time error that independent test server can be achieved in script,
To improve the stability of open platform system, avoid open platform because operation have run time error script and caused by business
Service ability decline.
Optionally, the script error pattern base includes the error characteristic of endless loop mistake;Wherein, at least one processor
520 be specifically used for according to, there are the error characteristic, determined in the binary file in the binary file exist it is described
Endless loop mistake;And determine in the binary file in the determining module there are when the endless loop mistake, it does not execute
The binary file.
In the embodiment of the present invention, judge that there are endless loops for script before script execution, to forbid endless loop script
Operation, avoids resource from being otherwise fully engaged, to avoid influencing other script program operations.
Optionally, the error characteristic of the endless loop mistake include circulation mark, cycling condition value be true and loop body in
Without exit statement;Wherein, at least one processor 520 is specifically used for: checking in the binary file and follows with the presence or absence of described
Ring mark;When being identified in the binary file there are the circulation, checks and recycle mark described in the binary file
Whether the cycling condition value of corresponding circulation is true;When the cycling condition value of the circulation described in the binary file is true,
Whether check has the sentence for exiting circulation in the loop body of the circulation;Without the language for exiting circulation in the loop body of the circulation
When sentence, determine that there are the endless loop mistakes in the binary file.
Optionally, at least one processor 520 is also used to determine in the binary file exist in the determining module
When run time error in the script error pattern base, generation error prompt information.At this point, output interface 540 was used for end
End subscriber exports the prompt information.
In the embodiment of the present invention, open platform system detection goes out in script there are when run time error, prompts the mistake, from
And the reason of developer or terminal user can be made to understand not perform script, improve the satisfaction of developer or terminal user.
Optionally, at least one processor 520 is also used to that the script is not present in determining the binary file wrong
When missing the run time error in pattern base, the binary file is executed.
In the embodiment of the present invention, the script that run time error is not present is executed, to guarantee that the function of correct script can be real
It is existing, meet the needs of developer or terminal user.
Optionally, the script is the script write using MVEL.
In the embodiment of the present invention, open platform system is according to script error pattern base, in script before perform script
Run time error is checked, does not need to provide the detection for the run time error that independent test server can be achieved in script,
To improve the system stability of open platform, avoid open platform because operation have run time error script and caused by business
Service ability decline.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a
People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.