[go: up one dir, main page]

CN111538492B - Method and device for calling policy implementation, electronic equipment and storage medium - Google Patents

Method and device for calling policy implementation, electronic equipment and storage medium Download PDF

Info

Publication number
CN111538492B
CN111538492B CN202010334043.9A CN202010334043A CN111538492B CN 111538492 B CN111538492 B CN 111538492B CN 202010334043 A CN202010334043 A CN 202010334043A CN 111538492 B CN111538492 B CN 111538492B
Authority
CN
China
Prior art keywords
policy implementation
target
provider
policy
implementation
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.)
Active
Application number
CN202010334043.9A
Other languages
Chinese (zh)
Other versions
CN111538492A (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.)
Zhejiang Dasou Vehicle Software Technology Co Ltd
Original Assignee
Zhejiang Dasou Vehicle Software Technology Co Ltd
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 Zhejiang Dasou Vehicle Software Technology Co Ltd filed Critical Zhejiang Dasou Vehicle Software Technology Co Ltd
Priority to CN202010334043.9A priority Critical patent/CN111538492B/en
Publication of CN111538492A publication Critical patent/CN111538492A/en
Application granted granted Critical
Publication of CN111538492B publication Critical patent/CN111538492B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a method and a device for calling policy realization, electronic equipment and a storage medium; the method is applied to a policy realization calling party, and comprises the following steps: when detecting a call operation of a user for realizing a target strategy, determining a strategy realization type of the target strategy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation; acquiring a provider of the target policy realization queried by a target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy realization type; and initiating a call for the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the expansion interface.

Description

Method and device for calling policy implementation, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software development, and in particular, to a method and apparatus for invoking policy implementation, an electronic device, and a storage medium.
Background
As the demands of users for application software become wider, developers pay more attention to the problem of how to reduce the difficulty of software development.
The Java language is an object-oriented programming language, and is favored by developers by virtue of the characteristics of strong function, simplicity and easiness in use. In order to improve the efficiency of developing software in the Java language, a Spring framework based on the Java language has been developed. The Spring framework enables developers to pay attention to general codes in programming in the process of software development, and only pay attention to codes related to business, so that the difficulty of software development is reduced, and the efficiency is improved.
Disclosure of Invention
In view of this, the application provides a method and a device for invoking policy implementation, an electronic device, and a storage medium, which can enable a developer to directly invoke by means of an expansion interface carried by himself without writing a corresponding expansion interface for implementing the policy to be invoked when invoking the policy.
In order to achieve the above purpose, the present application provides the following technical solutions:
according to a first aspect of the present application, a policy implementation calling method is provided, applied to a policy implementation caller, and the method includes:
when detecting a call operation of a user for realizing a target strategy, determining a strategy realization type of the target strategy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation;
acquiring a provider of the target policy realization queried by a target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy realization type;
and initiating a call for the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the expansion interface.
According to a second aspect of the present application, a policy implementation invoking device is provided, applied to a policy implementation caller, the device comprising:
the determining unit is used for determining the policy realization type of the target policy realization when detecting the calling operation of a user for the target policy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation;
the acquisition unit is used for acquiring a provider of the target policy implementation queried by the target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy implementation type;
and the calling unit initiates the calling of the target policy implementation to the provider of the target policy implementation so as to execute the target policy implementation through the expansion interface.
According to a third aspect of the present application, there is provided an electronic device comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the method according to any of the above embodiments by executing the executable instructions.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method as described in any of the above embodiments.
According to the technical scheme, the policy implementation provided by each provider is registered in the statistical center corresponding to the policy implementation type, so that the policy implementation calling party can inquire the provider needing to call the policy implementation from the corresponding statistical center under the condition that the policy implementation needs to be called, and then the policy implementation can be called from the inquired policy implementation provider.
Further, the logic of the policy implementation that can be called in the application is matched with an extension interface specified by a policy implementation calling party, for example, when developing each policy implementation, a developer writes the policy implementation by using the extension interface as a unified standard. When the developer calls the policy implementation, the developer does not need to create an expansion interface for calling the target policy implementation aiming at the target policy implementation, and can call the target policy implementation only through the existing expansion interface, so that the working efficiency of the developer is improved.
Drawings
FIG. 1 is a flow chart illustrating a method of invoking a policy implementation according to an exemplary embodiment of the present application.
FIG. 2 is a flow chart of a method of invoking another policy implementation as illustrated in an exemplary embodiment of the present application
FIG. 3 is a flow chart illustrating an implementation of invoking a local invocation class policy in accordance with an exemplary embodiment of the present application.
FIG. 4 is an interaction diagram illustrating an implementation of invoking a remote invocation class policy according to an exemplary embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present application.
FIG. 6 is a block diagram of a policy-implemented invocation apparatus as illustrated in an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
In the process of programming by using Java language, a Spring framework based on Java language is provided for solving the problems of repeated programming of Java language and the like. The Spring framework reserves a large amount of universal codes for programming, so that a developer does not need to pay attention to the universal codes used in the programming in the process of software development, but only needs to pay attention to codes related to the business to which the programming is aimed, namely business codes.
In the general Spring framework, a unique Spring container is contained. In order to avoid repeated writing of service codes, a developer usually pre-writes corresponding service codes for each service, namely, the policy implementation described in the application, and records the correspondence between the written identification of the policy implementation and the location of the written identification in the Spring container. By the method, when a certain policy implementation needs to be called, the position of the policy implementation is queried in the Spring container, and the policy implementation is called.
However, in the related art, invoking policy implementation is still a rather complex process. When a developer finds the position of the policy implementation to be called in the Spring container and calls the policy implementation from the corresponding position, the service type to which the policy implementation belongs needs to be judged first, then an expansion interface (also called an expansion point) for calling the policy implementation is created based on the determined service type, and the policy implementation can be called only after the creation of the expansion interface is completed. Secondly, the existing policy implementation calling method generally can only call the policy implementation stored locally, and can not call the non-local policy implementation.
For the above reasons, in the engineering practice of software, the developer is required to be very familiar with the callable policy implementation, and the corresponding expansion interface can be written based on the service type of the policy implementation. In the case of a large number of providers providing policy implementations, the software code in the policy implementation invoker typically needs to be adjusted multiple times to adapt to the policy implementations provided by different providers, which increases the workload of software development and thus reduces the efficiency of development.
In order to solve the above problems, the present application proposes a policy implementation invoking method. Referring to fig. 1, fig. 1 is a call method of a policy implementation according to an exemplary embodiment of the present application. As shown in fig. 1, the method is applied to a policy implementation caller, and the method may include the steps of:
102, when detecting a call operation of a user for realizing a target strategy, determining a strategy realization type of the target strategy realization; the logic of the target policy implementation is matched with an extension interface designated by the policy implementation caller, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation.
In the related art, the invocation of the policy implementation can only invoke the policy implementation stored locally to the caller of the policy implementation due to the limitation of the extension interface (also called extension point), and in the case of determining the policy type of the policy implementation, it is generally required to write a corresponding extension interface for the policy type to invoke the corresponding policy implementation. The calling process is tedious and policy implementation that is not stored locally cannot be called.
The policy implementation calling party in the application refers to: a main body of policy implementation needs to be invoked during software development. For convenience of description, the policy implementation caller will be hereinafter simply referred to as "caller". In different scenarios, the caller may be a different principal, for example, a programming device (such as a PC, a mobile terminal, etc.), or a JVM (Java virtual machine). The specific form of the calling party can be determined according to practical situations, and is not limited herein.
The provider of policy implementation in this application refers to: the main body of the written and finished strategy realization which can be called by the calling party is saved. For convenience of description, the policy implementation provider will be hereinafter simply referred to as "provider". Similar to the caller, the provider of policy implementation may be a different entity, for example, a programming device (such as a PC, a mobile terminal, etc.), a JVM (Java virtual machine), or an application. The specific form of the provider may be determined according to practical situations, and is not limited herein.
It is noted that, the target policy implementation in the present application is any one of the policy implementations provided by the provider of the policy implementation (remote provider or local provider), and these policy implementations are all based on the extension interface provided by the policy implementation caller, and the extension interface is adapted to be developed, so that development of the extension interface for the policy implementation to be invoked is not required in the process of subsequent invocation.
In this application, a principal that functions as a caller and a provider may be predetermined. For example, when there are 3 principals A, B, C, a may be set as the caller in advance, and A, B, C may be set as the provider. Where a may be considered a local provider and B and C may be considered remote providers.
In the process of calling the policy realization by the calling party, the policy realization type of the policy realization to be called, namely the policy realization type of the target policy realization, needs to be determined first. The policy implementation type is used for representing a calling mode of policy implementation, such as a local calling class or a remote calling class; the policy implementation type also reflects the identity type of the provider of the policy implementation, and the local invocation class specifies that the policy implementation is provided by the local provider; and the remote provider illustrates that the policy implementation is provided by the remote provider.
The policy implementation type for determining the policy implementation can be determined by looking up a registry in the caller, where the registry stores the correspondence between each policy implementation and the respective associated policy implementation type. For example, assume that there are 4 policy implementations: A. b, C, D, then the registry may be as shown in table 1:
policy implementation A B C D
Policy implementation type Remote invocation class Native call class Native call class Remote invocation class
TABLE 1
As can be seen from Table 1, policy implementation A and D in the table are remote call classes; policy implementations B and C are local calling classes. When a caller wants to invoke any policy implementation of A, B, C, D, the policy implementation type of the any policy implementation can be determined from the registry as described in table 1. It should be noted that, the record of the correspondence between the policy implementation and the policy implementation type in the registry does not mean that the source code of the policy implementation is recorded in the registry, and in fact, the mapping relationship recorded in the registry generally represents the policy implementation by using the identifier of the policy implementation, where the source code of the policy implementation needs to be invoked from the provider.
The corresponding relation between each policy implementation and each corresponding policy implementation type of the registry record in the calling party can be pushed by a predetermined configuration center. For example, the call direction configuration center may subscribe to the push of the correspondence. At this time, when the caller starts, the configuration center can record the corresponding relation between each policy implementation locally recorded in the call Fang Tuisong and each policy implementation type to which each policy implementation belongs in the registry by the caller. The correspondence between each policy implementation in the configuration center and the type of policy implementation to which each policy implementation belongs can be uploaded by each provider.
After the calling party starts, the calling party can monitor the change condition of the corresponding relation between the strategy realization and the strategy realization type in the configuration center so as to determine whether the corresponding relation to be updated exists; and under the condition that the corresponding relation to be updated exists, updating the registry according to the corresponding relation between the policy realization to be updated and the type of the policy realization. If a certain provider configuration center uploads the corresponding relation between the new policy implementation and the type of the affiliated policy implementation after the caller starts, at this time, the caller can acquire the corresponding relation between the new uploaded policy implementation and the type of the affiliated policy implementation, and record the corresponding relation between the new uploaded policy implementation and the type of the affiliated policy implementation into a registry.
In the application, the logic of the target policy implementation is matched with the expansion interface designated by the caller, so that the caller can execute the target policy implementation based on the existing expansion interface when calling the target policy implementation. In one case, the logic of policy implementation provided by each provider may be matched to the caller-specified extension interface. In actual operation, each provider may create a policy implementation according to the extension interface provided by the caller, such that the logic of the policy implementation created by each provider matches the specified extension interface.
In this application, the mapping relationship of any policy implementation to its provider is recorded in the statistics center corresponding to the policy implementation type of that any policy implementation. In other words, after determining the policy implementation type of the target policy implementation, the provider of the target policy implementation may be searched at the statistics center corresponding to the policy implementation type to invoke the target policy implementation from the searched provider. Taking table 1 as an example for explanation, if the target policy implementation at this time is policy implementation a, it can be seen from table 1 that the policy implementation type corresponding to policy implementation a is a remote call type; then, the provider of the policy implementation a may be determined according to the mapping relationship between each policy implementation recorded in the statistics center corresponding to the remote call class and the remote provider.
From the above, it can be seen that, by recording the mapping relationships between the providers with different identity types and the policy implementation in different statistical centers, it is possible to implement classification management for policy implementation of different policy implementation types.
Step 104, obtaining a provider of the target policy implementation queried by the target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy implementation type.
As described above, the caller may be a different principal; and the policy implementation type of the policy implementation is related to the identity type of the provider. In one case, the caller may include a Java virtual machine and the identity type of the provider may include a native application of the Java virtual machine and a remote provider that is distinct from the native application. The policy implementation provided by the local application program is recorded in a Spring container of the Java virtual machine, and the mapping relation between each remote provider and the policy implementation provided by each remote provider is recorded in a Dobbu registry. In other words, in this case, the statistical center is a Spring container or Dobbu registry.
In one case, the provider of the target policy implementation is the local application. In this case, it may be determined whether the target policy implementation is recorded in the Spring container, and if so, the local application may be used as the provider of the target policy implementation.
In another case, the provider of the target policy implementation is a remote provider. In this case, the mapping relationship between each remote provider recorded by the Dobbu registry and each policy implementation provided by each remote provider may be acquired, and the provider of the target policy implementation may be queried according to the acquired mapping relationship. In one case, a query request for the target policy implementation can be sent to the Dobbu registry in real time, so that the Dobbu registry queries a remote provider for providing the target policy implementation according to the recorded mapping relationship, and takes the query result of the Dobbu registry as the provider for the target policy implementation; in another case, the mapping relationship between each remote provider recorded in the Dobbu registry and each provided policy implementation may be cached locally in advance, and in the case that the provider of the target policy implementation is determined to be the remote provider, which remote provider the target policy implementation is provided by is determined according to the cached local mapping relationship.
The mapping relation recorded in the Dobbu registration center is registered in the Dobbu registration center after the providers realized by the policies determine that the providers belong to the remote providers; the identity types of the providers of each policy implementation are determined by the corresponding providers according to annotation information carried by each policy implementation in the starting process.
And step S106, initiating a call for the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the expansion interface.
In this application, the logic implemented by the target policy matches the caller-specified extension interface. Therefore, after the calling direction determined provider initiates the calling request, the target policy realization to be called can be executed through the expansion interface.
According to the technical scheme, under the condition that the calling request for the target policy implementation is detected, the provider of the target policy implementation can be determined from the corresponding statistical center based on the policy implementation type of the target policy implementation, and the target policy implementation can be called from the determined policy implementation provider. The scheme enables the calling party of the policy realization to accurately locate the provider of the policy realization, thereby realizing the calling of the policy realization provided by different providers.
Furthermore, the logic of the target policy implementation in the application is matched with the expansion interface appointed by the policy implementation calling party, so that the calling party does not need to create the expansion interface matched with the target policy implementation in real time based on the logic of the target policy implementation, and the efficiency of software development is improved
Still further, the application introduces a remote registry, and the logic of the policy implementation provided by the remote provider is also matched with the expansion interface designated by the policy implementation caller, so that the developer can directly call the policy implementation of the remote provider in the process of calling the policy implementation, and the number of the callable policy implementation is increased.
The functions of the roles in the technical scheme of the specification are described in detail below with reference to the accompanying drawings. FIG. 2 is a flow chart illustrating a method of invoking another policy implementation according to an example embodiment of the present application. The following describes a method for calling policy implementation by using a Java virtual machine as both a policy implementation caller and a provider in conjunction with FIG. 2.
In this embodiment, the Java virtual machine as the caller may publish its own extension interface, and then each Java virtual machine as the provider may create policy implementation according to the extension interface disclosed by the caller.
Referring to fig. 2, the scheme mainly includes the following steps:
and (1) subscribing the corresponding relation between each policy implementation and the calling mode (namely the policy implementation type) from the configuration center by the policy implementation calling party in advance.
Step (2), in the process of starting a policy realization calling party, the policy realization calling party receives the corresponding relation between each policy realization and the calling mode pushed by the configuration center and records the corresponding relation in a local registry; when detecting a call request for target policy realization, the policy realization calling party can search the call mode of the target policy realization in the registry according to the policy realization identifier contained in the call request.
When the target policy implementation determined in the step (3) is a local calling class, the policy implementation calling party queries the target policy implementation in the local Spring container, and after receiving the query result of the Spring container in the step (4), the target policy implementation is called from the local application program in the step (5). When the target policy implementation determined in the step (3) is a remote call class, the policy implementation caller searches which Java virtual machine provides the target policy implementation in the Dobbu registry, and after the query result is returned in the step (4), the target policy implementation is called from the determined Java virtual machine in the step (5).
For easy understanding, the steps (3), (4) and (5) will be described separately for the implementation of a policy that invokes a local invocation class and the implementation of a policy that invokes a remote invocation class.
1. Policy implementation to invoke native invocation classes
Referring to FIG. 3, FIG. 3 is a flow chart illustrating an implementation of invoking a native invocation class policy according to an exemplary embodiment of the present application. As shown in fig. 3, the method may include the steps of:
step 301, when it is determined that the target policy implementation is a local call class, querying an identifier of a policy implementation provided by a local application program and recorded in a local Spring container.
In this embodiment, the target policy implementation is determined to be a native calling class, i.e., it is explained that the target policy implementation is saved in a native Java virtual machine that is the caller of the policy implementation. In practice, the local policy implementation is typically stored in the local application and thus needs to be invoked from the local application.
In the Spring container, a policy realization identifier and an expansion interface corresponding to the policy realization identifier are stored. The local Java virtual machine can inquire a strategy realization identification corresponding to the target strategy realization from the local Java virtual machine, and then call the target strategy realization according to the strategy realization identification.
It should be noted that, although the Spring container shown in fig. 2 is independent from the policy implementation caller, in a practical case, the Spring container is a part of the policy implementation caller. Similarly, the native application in FIG. 2 is part of the policy implementation caller.
Step 302, determining an identifier corresponding to the target policy implementation, which is queried from Spring.
And step 303, calling the target policy implementation from the target local application program based on the determined identification, and executing the target policy implementation through the designated extension interface.
In this embodiment, the logic of the policy implementation stored locally matches the expansion interface specified by the native Java virtual machine. Thus, after a target policy implementation is invoked from a target application, the target policy implementation may be executed directly through a designated extension interface.
According to the scheme, the strategy identification corresponding to the target strategy implementation can be found in the Spring container, so that the strategy implementation stored locally can be called. Furthermore, because the logic of the policy implementation stored in the local application program is matched with the Java virtual machine serving as a calling party of the policy implementation, an expansion interface is not required to be created for the policy implementation in the calling process.
2. Policy implementation for invoking remote invocation classes
Referring to FIG. 4, FIG. 4 is an interaction diagram illustrating an implementation of invoking a remote invocation class policy according to an exemplary embodiment of the present application. As shown in fig. 4, the method may include the steps of:
in step 401, the caller determines that the target policy implementation is a remote policy implementation class.
Step 402, the call sends a provider query request to the Dobbu registry.
In this embodiment, java virtual machines other than the native Java virtual machine as the policy implementation caller all act as remote providers. In the starting process, the remote provider registers the mapping relation between the identification of the strategy implementation provided by the remote provider and the identity of the remote provider to the Dobbu registry. For example, the Java virtual machine 2 is a remote provider, and then the Java virtual machine 2 will upload policy implementation provided by itself and identity information of itself to the Dobbu registry during the starting process; similarly, the Java virtual machines 3, 4 as other remote providers perform the same operations. For example, the mapping relationship saved in Dobbu center may be as shown in table 2:
policy implementation A B C D
Remote provider Java virtual machine 2 Java virtual machine 2 Java virtual machine 3 Java virtual machine 4
TABLE 2
As can be seen from table 2, policy implementations a and B are provided by Java virtual machine 2; policy implementation C is provided by Java virtual machine 3; policy implementation D is provided by Java virtual machine 4.
In step 403, the dobbu registry queries the correspondence between each policy implementation of the local record and its provider.
As can be seen from the introduction in step 402, the Dobbu registry has recorded therein the correspondence between each policy implementation and its provider. And the registry can determine the corresponding remote provider according to the identification of the target policy implementation in the query request sent by the provider. Continuing taking table 2 as an example, if the target policy implementation to be invoked at this time is policy implementation a, the Dobbu registry may query that the policy implementation a is provided by the Java virtual machine 2 according to the identifier a of the policy implementation.
And step 404, after the dobbu registry queries the Java virtual machine for providing the target policy implementation, returning the result to the calling party.
In this embodiment, after receiving the query result returned by the Dobbu registry, the caller may determine the provider that provides the target policy implementation, and call the target policy implementation from the provider. With the above example in mind, it is determined in step 403 that policy implementation a is the target policy implementation, the provider of which is Java virtual machine 2. This step may send a call request to the Java virtual machine 2 to invoke policy implementation a.
And step 405, the caller receives the query result returned by the Dobbu registry and sends a policy realization call request to the target Java virtual machine in the query result.
In this step, the policy implementation call request sent to the target Java virtual machine includes the identifier of the target policy implementation.
In step 406, the target Java virtual machine returns the target policy implementation to the caller.
In step 407, the caller receives the target policy implementation returned by the target Java virtual machine, and executes the target policy implementation based on the designated extension interface.
In this embodiment, the logic of policy implementation created by each remote provider is matched with the expansion interface specified by the caller, so that after the target policy implementation returned by the received target Java virtual machine is implemented, the received target policy implementation can be executed through the expansion interface specified by the caller.
According to the technical scheme, the policy implementation provided by each remote provider is registered in the Dobbu registry in advance, so that a policy implementation calling party can inquire the provider needing to call the policy implementation from the Dobbu registry under the condition that the remote policy implementation needs to be called, and further, a call request can be initiated to the inquired policy implementation provider, and the call to the non-local policy implementation is realized.
Furthermore, because the logic of the policy implementation created by each remote provider is matched with the expansion interface appointed by the calling party, when the non-local policy implementation is called, the corresponding expansion interface does not need to be written according to the non-local policy implementation, and the efficiency of developing software by a developer is improved.
Fig. 5 shows a schematic block diagram of an electronic device according to an exemplary embodiment of the present application. Referring to fig. 5, at the hardware level, the electronic device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a nonvolatile memory 510, and may include hardware required by other services. The processor 502 reads the corresponding computer program from the non-volatile memory 510 into the memory 508 and then runs, forming a calling means for policy implementation at the logic level. Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present application, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
Referring to fig. 6, in a software implementation, the invoking means for implementing the policy may include:
a determining unit 601, configured to determine a policy implementation type of a target policy implementation when detecting a call operation of a user for the target policy implementation; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation;
the obtaining unit 602 obtains a provider of the target policy implementation queried by the target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy implementation type;
and a calling unit 603, configured to initiate a call to the target policy implementation to the provider of the target policy implementation, so as to execute the target policy implementation through the extension interface.
Optionally, the determining unit is specifically configured to:
and determining the policy realization type of the target policy realization according to a registry of the policy realization calling party, wherein the registry records the corresponding relation between each policy realization and the corresponding policy realization type.
Optionally, the corresponding relation between each policy implementation and each corresponding policy implementation type of the registry record is pushed by a configuration center; and the corresponding relation between each policy implementation recorded in the configuration center and each affiliated policy implementation type is uploaded by a provider of each policy implementation.
Optionally, the method further comprises:
an updating unit 604, configured to determine whether a corresponding relationship between the policy implementation and the corresponding policy implementation type to be updated exists in the configuration center; if yes, updating the registry according to the corresponding relation to be updated.
Optionally, the policy implementation caller includes a Java virtual machine, and the policy implementation type of each policy implementation is related to an identity type of a respective provider, where the identity type includes a native application of the Java virtual machine and a remote provider different from the native application.
Optionally, the mapping relation between each remote provider and each provided policy implementation is recorded in the Dobbu registry;
when the provider of the target policy implementation is the local application, the obtaining unit 502 is specifically configured to: taking the local application program as a provider of the target policy implementation;
when the provider of the target policy implementation is a remote provider, the obtaining unit 502 is specifically configured to: and acquiring mapping relations between each remote provider recorded by the Dobbu registry and policy implementation provided by each remote provider, and inquiring the provider of the target policy implementation according to the acquired mapping relations.
Optionally, the mapping relation recorded in the Dobbu registration center is registered in the Dobbu registration center after the provider realized by each policy determines that the provider belongs to the remote provider; the identity types of the providers of the policy implementation are determined by the corresponding providers according to annotation information carried by the policy implementation in the starting process.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium comprising instructions, e.g. a memory comprising instructions, executable by a processor of a policy-implemented invoking device to implement a method as described in any of the above embodiments, e.g. the method may comprise: when detecting a call operation of a user for realizing a target strategy, determining a strategy realization type of the target strategy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation; acquiring a provider of the target policy realization queried by a target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy realization type; and initiating a call for the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the expansion interface.
Wherein the non-transitory computer readable storage medium may be a ROM, random-access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc., which is not limited in this application.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (9)

1. A method for invoking a policy implementation, the method being applied to a policy implementation caller, the method comprising:
when detecting a call operation of a user for realizing a target strategy, determining a strategy realization type of the target strategy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation;
acquiring a provider of the target policy realization queried by a target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy realization type;
initiating a call to the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the expansion interface;
mapping relation between each remote provider and each provided strategy implementation is recorded in a Dobbu registry;
when the provider of the target policy implementation is a local application program, the obtaining the provider of the target policy implementation queried by the target statistics center according to the recorded mapping relation includes: taking the local application program as a provider of the target policy implementation;
when the provider of the target policy implementation is a remote provider, the obtaining the provider of the target policy implementation queried by the target statistics center according to the recorded mapping relationship includes: and acquiring mapping relations between each remote provider recorded by the Dobbu registry and policy implementation provided by each remote provider, and inquiring the provider of the target policy implementation according to the acquired mapping relations.
2. The method of claim 1, wherein determining a policy implementation type for a target policy implementation comprises:
and determining the policy realization type of the target policy realization according to a registry of the policy realization calling party, wherein the registry records the corresponding relation between each policy realization and the corresponding policy realization type.
3. The method according to claim 2, wherein the correspondence between each policy implementation of the registry record and the type of policy implementation to which each policy implementation belongs is pushed by a configuration center; and the corresponding relation between each policy implementation recorded in the configuration center and each affiliated policy implementation type is uploaded by a provider of each policy implementation.
4. A method according to claim 3, further comprising:
determining whether a corresponding relation to be updated exists between the strategy implementation and the corresponding strategy implementation type in the configuration center;
if yes, updating the registry according to the corresponding relation to be updated.
5. The method of claim 1, wherein the policy implementation invoker comprises a Java virtual machine, and wherein the policy implementation type of each policy implementation is associated with an identity type of the respective provider, the identity type comprising a native application of the Java virtual machine and a remote provider distinct from the native application.
6. The method according to claim 1, wherein the mapping relation recorded in the Dobbu registry is registered in the Dobbu registry after the provider implemented by each policy determines that the provider belongs to the remote provider; the identity types of the providers of the policy implementation are determined by the corresponding providers according to annotation information carried by the policy implementation in the starting process.
7. A policy-implemented calling device, for application to a policy-implemented caller, the device comprising:
the determining unit is used for determining the policy realization type of the target policy realization when detecting the calling operation of a user for the target policy realization; the logic of the target policy implementation is matched with an expansion interface designated by the policy implementation calling party, and the mapping relation between any policy implementation and the provider of any policy implementation is recorded in a statistics center corresponding to the policy implementation type of any policy implementation;
the acquisition unit is used for acquiring a provider of the target policy implementation queried by the target statistical center according to the recorded mapping relation, wherein the target statistical center is a statistical center corresponding to the determined policy implementation type;
a calling unit for initiating a call for the target policy implementation to a provider of the target policy implementation to execute the target policy implementation through the extension interface;
mapping relation between each remote provider and each provided strategy implementation is recorded in a Dobbu registry;
when the provider of the target policy implementation is a local application, the obtaining unit is specifically configured to: taking the local application program as a provider of the target policy implementation;
when the provider of the target policy implementation is a remote provider, the obtaining unit is specifically configured to: and acquiring mapping relations between each remote provider recorded by the Dobbu registry and policy implementation provided by each remote provider, and inquiring the provider of the target policy implementation according to the acquired mapping relations.
8. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the method of any of claims 1-6 by executing the executable instructions.
9. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method according to any of claims 1-6.
CN202010334043.9A 2020-04-24 2020-04-24 Method and device for calling policy implementation, electronic equipment and storage medium Active CN111538492B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010334043.9A CN111538492B (en) 2020-04-24 2020-04-24 Method and device for calling policy implementation, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010334043.9A CN111538492B (en) 2020-04-24 2020-04-24 Method and device for calling policy implementation, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111538492A CN111538492A (en) 2020-08-14
CN111538492B true CN111538492B (en) 2023-12-19

Family

ID=71978872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010334043.9A Active CN111538492B (en) 2020-04-24 2020-04-24 Method and device for calling policy implementation, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111538492B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101387956A (en) * 2007-09-14 2009-03-18 国际商业机器公司 Method and apparatus for expandably implementing non functional logic
CN101707788A (en) * 2009-10-27 2010-05-12 北京邮电大学 Differential pricing strategy based dynamic programming method of multilayer network services
CN110198313A (en) * 2019-05-23 2019-09-03 新华三信息安全技术有限公司 A kind of method and device of strategy generating
CN110928656A (en) * 2019-11-18 2020-03-27 浙江大搜车软件技术有限公司 Service processing method, device, computer equipment and storage medium
CN111045833A (en) * 2018-10-15 2020-04-21 北京京东尚科信息技术有限公司 Interface calling method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8683545B2 (en) * 2008-08-15 2014-03-25 International Business Machines Corporation Federating policies from multiple policy providers
US8484246B2 (en) * 2010-02-10 2013-07-09 International Business Machines Corporation Discoverable applicability of dynamically deployable software modules

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101387956A (en) * 2007-09-14 2009-03-18 国际商业机器公司 Method and apparatus for expandably implementing non functional logic
CN101707788A (en) * 2009-10-27 2010-05-12 北京邮电大学 Differential pricing strategy based dynamic programming method of multilayer network services
CN111045833A (en) * 2018-10-15 2020-04-21 北京京东尚科信息技术有限公司 Interface calling method and device
CN110198313A (en) * 2019-05-23 2019-09-03 新华三信息安全技术有限公司 A kind of method and device of strategy generating
CN110928656A (en) * 2019-11-18 2020-03-27 浙江大搜车软件技术有限公司 Service processing method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111538492A (en) 2020-08-14

Similar Documents

Publication Publication Date Title
CN108510389B (en) Blockchain-based smart contract calling method, device and readable storage medium
CN110109958B (en) Cache processing method, device, equipment and computer readable storage medium
WO2019136800A1 (en) Service processing method, apparatus and device, and computer-readable storage medium
CN112613993A (en) Transaction data processing method and device, computer equipment and storage medium
CN110677462A (en) Access processing method, system, device and storage medium for multi-block chain network
JP4040256B2 (en) Server system and recording medium
CN109831494A (en) User data management and equipment
CN113254470B (en) Data modification method, device, computer equipment and storage medium
CN111913764A (en) Service dependency analysis method, electronic device, and storage medium
CN109729121A (en) A kind of cloud storage system and the method for realizing self-defining data processing in cloud storage system
CN118193597A (en) Data acquisition method, apparatus, computing device, medium and computer program product
CN112752258A (en) eSIM card opening method, mobile phone terminal and service acceptance system
CN111190625A (en) APP version upgrading method, server, client and computer readable storage medium
CN111538492B (en) Method and device for calling policy implementation, electronic equipment and storage medium
CN109388558A (en) A kind of method, apparatus, equipment and storage medium managing electronic equipment
KR101888131B1 (en) Method for Performing Real-Time Changed Data Publish Service of DDS-DBMS Integration Tool
CN113360210A (en) Data reconciliation method and device, computer equipment and storage medium
CN109219051B (en) False number determination method, device, equipment and readable storage medium
CN115858466A (en) Operation log generation method, device, equipment and medium
CN109408547B (en) SAM registry reading method, reading system and related device
CN113872797A (en) Matching method, device, server and terminal device for distribution network strategy
CN108694219B (en) Data processing method and device
CN113326034A (en) Policy implementation calling method and device, electronic equipment and storage medium
WO2023005484A1 (en) User information registration method and apparatus
CN116501414B (en) Resource control method, device, medium and computing equipment based on cloud platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant