Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
As shown in Figure 1, the operation method process flow diagram for a kind of J2ME in the embodiment of the invention uses may further comprise the steps:
Step 101 is transplanted to the Android platform with the J2ME application.
The embodiment of the invention realizes J2ME graft layers Porting Layer based on the Delvik VM of Android platform self, J2ME is used be transplanted to the Android platform.According to the difference of device hardware ability, and upper layer application is to the requirement difference of J2ME API, and J2ME Porting Layer can realize the difference in functionality set of J2ME, for example JTWI, MSA, MSA subclass Subset etc.But the minimum function of J2ME PortingLayer realizes comprising the function of CLDC and MIDP (Mobile Information DeviceProfile, mobile information apparatus configuration file).Function to Android Application Framework strengthens, and on the basis of J2ME Porting Layer, realizes J2ME API, finally provides support for J2ME Application.Different according to the function set that J2ME Porting Layer realizes, the J2ME API that Application Framework provides also can be different, but the minimal set of its J2ME API should comprise the API of CLDC and MIDP at least.
Step 102, J2ME uses in the operation of Android platform.
With J2ME use be transplanted to the Android platform after, when Android platform operation J2ME uses, do not need JVM integral transplanting with J2ME to the Android platform, but make full use of the function of the Application Framework of the Delvik VM of Android platform and Android, on this basis, realize the business interface of J2ME, for the application of J2ME provides support.
As shown in Figure 2, a kind of specific implementation process flow diagram for the operation J2ME in the embodiment of the invention uses may further comprise the steps:
Step 201 is called J2ME and is used corresponding JSR.
For supporting dissimilar application, J2ME has defined different JSR, each JSR standard one class J2ME business interface, JSR118 (MIDP) etc. for example.With gathering together of different JSR, some J2ME business interfaces commonly used set have been constituted, JTWI for example, MSA, and MSA Subset.Usually J2ME uses just be based on the corresponding business set of interfaces and makes up.Therefore, use, must realize corresponding JSR for supporting J2ME.
Step 202 judges whether the Android platform supports J2ME to use the interface among the corresponding JSR, if the Android platform supports J2ME to use the interface among the corresponding JSR, then execution in step 205; If the Android platform does not support J2ME to use the interface among the corresponding JSR, then execution in step 203.
Step 203 judges that can the interface among the JSR be converted into the interface that the Android platform is supported, if the interface among the JSR can be converted into the interface that the Android platform is supported, then execution in step 204; If the interface among the JSR can not be converted into the interface that the Android platform is supported, then execution in step 206.
Step 204, the interface that becomes the Android platform to support the interface conversion among the JSR.
Step 205 is called Android platform and Delvik VM and is realized JSR, and execution in step 215 afterwards.
Step 206 judges whether CLDC supports the interface among the JSR, if CLDC supports the interface among the JSR, then execution in step 207; If CLDC does not support the interface among the JSR, then execution in step 214.
Step 207 is called CLDC.
For supporting J2ME to use, need make amendment to the realization of JVM layer, to support the basic JSR:CLDC of J2ME JVM.
Step 208 judges whether Delvik VM supports the interface among the CLDC, if Delvik VM supports the interface among the CLDC, then execution in step 211; If Delvik VM does not support the interface among the CLDC, then execution in step 209.
Step 209, judge that can the interface among the CLDC be converted into the interface that Delvik VM supports, if the interface among the CLDC can be converted into the interface that Delvik VM supports, execution in step 210, if the interface among the CLDC can not be converted into the interface that Delvik VM supports, execution in step 212.
Step 210, the interface that becomes Delvik VM to support the interface conversion among the CLDC.
Step 211 is called Delvik VM and is realized CLDC.
Step 212, the interface that becomes Native Platform to support the interface conversion among the CLDC
Step 213 is called Native Platform and is realized CLDC.
According to analysis, the interface among the CLDC more than 90% can carry out simple package based on the interface of Delvik and obtain, even wherein part interface Delvik directly supports.Remaining 10% interface can not be based on realizing on the Delvik that this part interface can directly be realized based on Native Platform.
Step 214, the interface that becomes Native Platform to support the interface conversion among the JSR.
Step 215 is called Native Platform and is realized JSR.
Because the business interface of many JSR is overlapping with Android on function, therefore, the realization of this JSR interface can be based on the interface of Android, and remaining interface realizes being divided into the interface that can realize based on CLDC, and the interface that must realize based on Native Platform.
Step 216, J2ME uses in the operation of Android platform.
With J2ME use be transplanted to the Android platform after, when Android platform operation J2ME uses, do not need JVM integral transplanting with J2ME to the Android platform, but make full use of the function of the Application Framework of the Delvik VM of Android platform and Android, on this basis, realize the business interface of J2ME, for the application of J2ME provides support.
As shown in Figure 3, a kind of terminal structure figure that moves the J2ME application in the embodiment of the invention comprises:
Transplant module 301, be used for the Android platform is transplanted in the J2ME application.
The embodiment of the invention realizes J2ME graft layers Porting Layer based on the Delvik VM of Android platform self, J2ME is used be transplanted to the Android platform.According to the difference of device hardware ability, and upper layer application is to the requirement difference of J2ME API, and J2ME Porting Layer can realize the difference in functionality set of J2ME, for example JTWI, MSA, MSA subclass Subset etc.But the minimum function of J2ME PortingLayer realizes comprising the function of CLDC and MIDP (Mobile Information DeviceProfile, mobile information apparatus configuration file).Function to Android Application Framework strengthens, and on the basis of J2ME Porting Layer, realizes J2ME API, finally provides support for J2ME Application.Different according to the function set that J2ME Porting Layer realizes, the J2ME API that Application Framework provides also can be different, but the minimal set of its J2ME API should comprise the API of CLDC and MIDP at least.
Operation module 302 is used for transplanting the J2ME application that module 301 is transplanted in the operation of Android platform.
With J2ME use be transplanted to the Android platform after, when Android platform operation J2ME uses, do not need JVM integral transplanting with J2ME to the Android platform, but make full use of the function of the Application Framework of the Delvik VM of Android platform and Android, on this basis, realize the business interface of J2ME, for the application of J2ME provides support.
As shown in Figure 4, a kind of terminal concrete structure figure that moves the J2ME application in the embodiment of the invention comprises:
Transplant module 400, be used for the Android platform is transplanted in the J2ME application.
The embodiment of the invention realizes J2ME graft layers Porting Layer based on the Delvik VM of Android platform self, J2ME is used be transplanted to the Android platform.According to the difference of device hardware ability, and upper layer application is to the requirement difference of J2ME API, and J2ME Porting Layer can realize the difference in functionality set of J2ME, for example JTWI, MSA, MSA subclass Subset etc.But the minimum function of J2ME PortingLayer realizes comprising the function of CLDC and MIDP (Mobile Information DeviceProfile, mobile information apparatus configuration file).Function to Android Application Framework strengthens, and on the basis of J2ME Porting Layer, realizes J2ME API, finally provides support for J2ME Application.Different according to the function set that J2ME Porting Layer realizes, the J2ME API that Application Framework provides also can be different, but the minimal set of its J2ME API should comprise the API of CLDC and MIDP at least.
Operation module 500 is used for transplanting the J2ME application that module 400 is transplanted in the operation of Android platform.
With J2ME use be transplanted to the Android platform after, when Android platform operation J2ME uses, do not need JVM integral transplanting with J2ME to the Android platform, but make full use of the function of the Application Framework of the Delvik VM of Android platform and Android, on this basis, realize the business interface of J2ME, for the application of J2ME provides support.
Above-mentioned transplanting module 400 specifically comprises:
First judges submodule 401, is used for judging whether the Android platform supports J2ME to use the interface of corresponding JSR.
For supporting dissimilar application, J2ME has defined different JSR, each JSR standard one class J2ME business interface, JSR 118 (MIDP) etc. for example.With gathering together of different JSR, some J2ME business interfaces commonly used set have been constituted, JTWI for example, MSA, and MSA Subset.Usually J2ME uses just be based on the corresponding business set of interfaces and makes up.Therefore, use, must realize corresponding JSR for supporting J2ME.Because the business interface of many JSR is overlapping with Android on function, therefore, the realization of this JSR interface can be based on the interface of Android, and remaining interface realizes being divided into the interface that can realize based on CLDC, and the interface that must realize based on Native Platform.
Second judges submodule 402, does not support J2ME to use the interface of corresponding JSR if be used for the first judgement submodule, 401 judgement Android platforms, judges that can the interface among the JSR be converted into the interface of Android platform support.
The 3rd judges submodule 403, judges that the interface of submodule 402 judgement JSR can not be converted into the interface that the Android platform is supported, judges whether CLDC supports the interface among the JSR if be used for second.
First calls submodule 404, judges that submodule 403 judgement CLDC support the interface of JSR, call CLDC and Native Platform and realize JSR if be used for the 3rd.
For supporting J2ME to use, need make amendment to the realization of JVM layer, to support the basic JSR:CLDC of J2ME JVM.According to analysis, the interface among the CLDC more than 90% can carry out simple package based on the interface of Delvik and obtain, even wherein part interface Delvik directly supports.Remaining 10% interface can not be based on realizing on the Delvik that this part interface can directly be realized based on Native Platform.
Second calls submodule 405, judges that submodule 401 judgement Android platforms support J2ME use the interface of corresponding JSR, call Android platform, DelvikVM and NativePlatform and realize JSR if be used for first.
The first conversion submodule 406 judges that the interface of submodule 403 judgement JSR can be converted into the interface that the Android platform is supported, becomes the interface conversion among the JSR interface of Android platform support if be used for the described the 3rd.
The second conversion submodule 407 judges that submodule 403 judgement CLDC do not support the interface of JSR, become the interface conversion among the JSR interface of Native Platform support if be used for the 3rd.
The 4th judges submodule 408, is used for judging whether Delvik VM supports the interface of CLDC.
The 5th judges submodule 409, judges that submodule 408 judgement Delvik VM do not support the interface of CLDC, judge that can the interface among the CLDC be converted into the interface that Delvik VM supports if be used for the 4th.
The 3rd conversion submodule 410 judges that the interface of submodule 409 judgement CLDC can be converted into the interface that Delvik VM supports, becomes the interface conversion among the CLDC interface of Delvik VM support if be used for the 5th.
The 3rd calls submodule 411, judges that submodule 408 judgement Delvik VM support the interface of CLDC, call Delvik VM and Native Platform and realize CLDC if be used for the 4th.
The 4th conversion submodule 412 judges that submodule 409 judgement CLDC do not support the interface of JSR, become the interface conversion among the JSR interface of described Native Platform support if be used for the 5th.
The technical scheme of the embodiment of the invention has the following advantages, and is applied to the Android platform because transplant J2ME, can make full use of existing a large amount of J2ME and use; Need not to move two cover JVM, J2ME uses the Android platform JVM (being Delvik JVM) that places one's entire reliance upon and strengthen, and can effectively reduce taking of memory source; In UI (User Interface, user interface) design, J2ME uses and can be fully integratible among the UI of Android, need not to switch, and has strengthened user's experience; For J2ME application and providing alternately of Android application may; The JVM of J2ME and the realization of JSR make full use of Delvik and Android, have reduced the redundancy of code, have reduced the requirement of storage space.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better embodiment under a lot of situation.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium, comprise that some instructions are with so that a station terminal equipment (can be mobile phone, personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be looked protection scope of the present invention.