CN101504609B - Method and apparatus for generating object package type - Google Patents
Method and apparatus for generating object package type Download PDFInfo
- Publication number
- CN101504609B CN101504609B CN2009100802711A CN200910080271A CN101504609B CN 101504609 B CN101504609 B CN 101504609B CN 2009100802711 A CN2009100802711 A CN 2009100802711A CN 200910080271 A CN200910080271 A CN 200910080271A CN 101504609 B CN101504609 B CN 101504609B
- Authority
- CN
- China
- Prior art keywords
- type
- encapsulation type
- attribute information
- object encapsulation
- amending method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention provides a method and a device for generating an object packing type to solve the problem that an executable modified file corresponding to a primary object cannot be acquired under the condition that decompiling is limited in the prior art. In the embodiment, the method comprises the following steps: acquiring type information and public interface information of the primary object from an executable program comprising the primary object; establishing a first object packing type according to the type information and the public interface information of the primary object; and acquiring the object packing type according to the first object packing type and set object packing type attribute information. According to the technical proposal, the executable file corresponding to the primary object is acquired under the condition that the decompiling is limited.
Description
Technical field
The present invention relates to computing machine object based programming technology, relate to a kind of method and apparatus of formation object packaging type especially.
Background technology
In computing machine object-oriented programming field,, logic more and more huger along with the scale of software systems becomes increasingly complex, programming AOP (Aspect Oriented Programming) method towards characteristic comes into one's own day by day, because this method is intended to separate the focus (Concern) of crosscut (Crosscut), here be often referred to functional requirement, thereby avoid or alleviate their design and influencing each other of realizing.
AOP thought is applied to the program implementation phase, normally call at present or message realizes by intercepting and capturing, its general way is: at first the executable program that comprises the primary object that will intercept and capture is carried out the source program that decompiling obtains primary object, to intercept and capture the source program that calling program adds this primary object afterwards, obtain new object source program, compile this program at last, obtain new executable file.
A problem of the method is: the source program of primary object is in case change, the executable program of primary object also changes thereupon, call the application person of primary object for intercepting and capturing, need re-execute once above-mentioned decompiling process by the primary object executable program after changing, in some cases, as copyright, encryption, band digital signature etc., decompiling is difficult to even can't carries out, so be difficult to obtain the pairing executable file of amended primary object.
Summary of the invention
Fundamental purpose of the present invention provides a kind of method and apparatus of formation object packaging type, to solve the problem that can't obtain the pairing executable file of amended primary object in the prior art under the limited situation of decompiling.
For addressing the above problem, the invention provides following technical scheme:
A kind of method of formation object packaging type comprises:
From the executable program that comprises primary object, obtain the publicly-owned interface message of the type information and the primary object of primary object;
Create the first object encapsulation type according to the type information of primary object and the publicly-owned interface message of primary object, specifically comprise: create the type data member identical in the first object encapsulation type, create in the first object encapsulation type and the identical interface of described publicly-owned interface with the type of primary object;
Object encapsulation type attribute information according to the first object encapsulation type and setting obtains the object encapsulation type, specifically comprise: call an amending method, judge as if described object encapsulation type attribute information then corresponding to the amending method that calls, then obtain the object encapsulation type according to amending method and the described first object encapsulation type of described object encapsulation type attribute information correction called, or according to amending method that calls and described object encapsulation type attribute information formation object packaging type; If described object encapsulation type attribute information is then called next amending method not corresponding to the amending method that calls.
A kind of device of formation object packaging type comprises acquisition module, creation module and object encapsulation type generation module, wherein,
Described acquisition module is used for obtaining from the executable program of primary object the data member information and the publicly-owned interface message of primary object type;
Described creation module, be used for creating the first object encapsulation type according to described data member information and publicly-owned interface message, specifically comprise: create the type data member identical in the first object encapsulation type, create in the first object encapsulation type and the identical interface of described publicly-owned interface with the type of primary object;
Described object encapsulation type generation module, be used for obtaining the object encapsulation type according to the object encapsulation type attribute information of described first object encapsulation type and setting, specifically comprise: call an amending method, judge as if described object encapsulation type attribute information then corresponding to the amending method that calls, then obtain the object encapsulation type according to amending method and the described first object encapsulation type of described object encapsulation type attribute information correction called, or according to amending method that calls and described object encapsulation type attribute information formation object packaging type; If described object encapsulation type attribute information is then called next amending method not corresponding to the amending method that calls.
According to technical scheme of the present invention, in embodiments of the present invention, created the first object encapsulation type according to the type information of the primary object that from the executable program that comprises primary object, obtains and the publicly-owned interface message of primary object, the attribute information of the object encapsulation type that this first object encapsulation type is obtained is as required made amendment or is generated new object encapsulation type and replenishes again, obtains the desired object packaging type thus.Like this, in the technical scheme of the embodiment of the invention, primary object type compiling assembly is not carried out decompiling, so under the limited situation of decompiling, still the group of objects piece installing of amended primary object correspondence can be obtained, the pairing executable file of amended primary object can be further obtained thus.
Description of drawings
Fig. 1 is the method flow diagram of the embodiment of the invention;
Fig. 2 is the apparatus structure synoptic diagram of the embodiment of the invention.
Embodiment
When primary object changes, in order under the limited situation of decompiling process, to obtain the object encapsulation type, in embodiments of the present invention, according to step formation object packaging type as shown in Figure 1:
Step S1: data member information and the publicly-owned interface message of from the executable program of primary object, obtaining the primary object type.
Primary object can be to use the CodeDOM object to describe in this step, then the executable program of primary object can be the .NET assembly, and use the .NET reflection technology, can obtain the data member information and the publicly-owned interface message of primary object from the .NET assembly.
Step S2: data member information and publicly-owned interface message according to primary object are created the first object encapsulation type.
The first object encapsulation type in this step can adopt the CodeDOM object to be described equally.Creating the first object encapsulation type carries out according to following mode: the first object encapsulation type comprises a data member that type is identical with the primary object type, and the first object encapsulation type has consistent publicly-owned interface with described primary object type.Each packing method of first packaging type when realizing, is called publicly-owned interface in the corresponding primary object type by above-mentioned data member.So comprise what data members in the primary object, in this step, just should create what first object encapsulation types.
Step S3: obtain expecting the object encapsulation type that obtains according to the first object encapsulation type and object encapsulation type attribute information.
Comprised the attribute information of the object encapsulation type of expectation acquisition in the object encapsulation type attribute information, this attribute information can be the information of an attribute, also can be the information of multinomial attribute.Usually, the attribute information of the object encapsulation type of multinomial expectation acquisition is arranged in this attribute information, describe according to this situation below.For the object encapsulation type that an expectation obtains, its some attribute information requires to obtain required object encapsulation type by primary object through revising, and its other attribute informations then require to generate new object encapsulation type.Requirement for the object encapsulation type of expecting to obtain, only need to revise the first object encapsulation type, in some cases, the attribute information of the object encapsulation type that process is revised and the new object encapsulation type of generation just has the attribute information of the object encapsulation type of expectation acquisition altogether, when compiling, the object encapsulation type that above-mentioned process need be revised and the new object encapsulation type of generation compile together and obtain executable file, for example compiling becomes the .NET assembly, and this assembly has the function of the assembly of the object encapsulation type correspondence that above-mentioned expectation obtains.
For the modification or the formation object packaging type of the first object encapsulation type of creating among the step S2, be to be undertaken by the amending method that calls in the amending method set, each amending method is corresponding to a kind of object encapsulation type attribute.So in this step, for one first object encapsulation type, handle according to following mode: from the amending method set, call a kind of amending method earlier, in the ensemble of communication of object encapsulation type attribute, search then, obtain the object encapsulation type attribute information corresponding if search, then use this amending method that the first object encapsulation type is made amendment or the formation object packaging type with the amending method that calls; If the amending method object encapsulation type attribute information that does not find and call in the ensemble of communication of object encapsulation type attribute is then called next amending method, the next amending method that calls should not repeat with the amending method that had before called.If various amending methods implement in logic priority, for example a kind of amending method must carry out before or after another kind of amending method, just should set priority to them, called successively according to this priority when calling next amending method.Through as upper type, promptly finished processing for one first object encapsulation type.
Because in the ordinary course of things, the first object encapsulation type that is obtained by primary object may be a plurality of, so can be according to above-mentioned processing mode for one first object encapsulation type, other first object encapsulation types are handled, obtain the object encapsulation type, finish up to the first all object encapsulation type of process, obtain the object encapsulation type that one group of expectation obtains.Compile this group objects packaging type this moment, can be to use the .NET Compilation Method, generates the .NET assembly, and in the process of follow-up programming, call each object encapsulation type in this .NET assembly.Because these object encapsulation types have the publicly-owned interface identical with primary object, it is constant therefore to intercept and capture calling program method of calling when calling these object encapsulation types, is still undertaken by original mode of promptly calling primary object.Needn't make amendment to intercepting and capturing calling program thus, for the realization of application program provides convenience.
According to above-mentioned method, the embodiment of the invention provides corresponding device thereof, is used for the formation object packaging type.As shown in Figure 2, object encapsulation type maker 30 comprises acquisition module 31, creation module 32 and object encapsulation type generation module 33.Acquisition module 31 is used for obtaining from the executable program of primary object the data member information and the publicly-owned interface message of primary object type.Creation module 32 is used for creating the first object encapsulation type according to described data member information and publicly-owned interface message.Object encapsulation type generation module 33 is used for obtaining the object encapsulation type according to the object encapsulation type attribute information of the first object encapsulation type and setting.
A kind of structure of object encapsulation type generation module 33 is to comprise sub module stored and call submodule, and comprises the modification submodule and/or generate submodule.Sub module stored is used for storage object packaging type attribute information.Call submodule and be used to call amending method.Revise submodule and be used for, use and call amending method that submodule calls and revise the first object encapsulation type and obtain the object encapsulation type according to described object encapsulation type attribute information.Generate submodule and be used for, use and call the amending method formation object packaging type that submodule calls according to object encapsulation type attribute information.
A kind of structure of revising submodule is to comprise judging unit and revise the unit.Judging unit is used to judge that whether object encapsulation type attribute information is corresponding to the amending method that calls.The modification unit is used for if whether object encapsulation type attribute information corresponding to the amending method that calls, then according to this object encapsulation type attribute information, is used this amending method that calls to revise the described first object encapsulation type and obtained the object encapsulation type.
A kind of structure that generates submodule is to comprise judging unit and generation unit.Judging unit is used to judge that whether object encapsulation type attribute information is corresponding to the amending method that calls.Generation unit be used for if object encapsulation type attribute information whether corresponding to the amending method that calls, then according to this object encapsulation type attribute information, the amending method formation object packaging type that uses this to call.
The structure of object encapsulation type generation module 33 can be to comprise calling submodule, judgement submodule and implementation sub-module.Calling submodule is used for calling amending method from the amending method set.Judge that submodule is used at the primary object type, judge the object encapsulation type attribute information that whether comprises in the object encapsulation type attribute ensemble of communication corresponding corresponding to the amending method that calls with this primary object type.Implementation sub-module is used for if the object encapsulation type attribute ensemble of communication corresponding with the primary object type comprises the object encapsulation type attribute information corresponding to the amending method that calls, then according to this object encapsulation type attribute information, use this amending method that calls to revise the corresponding first object encapsulation type of this primary object type and obtain the object encapsulation type, or according to this object encapsulation type attribute information, the amending method formation object packaging type that uses this to call.If do not comprise object encapsulation type attribute information in the object encapsulation type attribute ensemble of communication corresponding, then call submodule and repeatedly do not call other amending methods in the amending method set corresponding to the amending method that calls with the primary object type.Calling submodule can be to call amending method according to the order of setting from the amending method set.
The another kind of structure of object encapsulation type generation module 33 can be to comprise extracting submodule and calling implementation sub-module.Extracting submodule is used for extracting object encapsulation type attribute information from the object encapsulation type attribute ensemble of communication of primary object type correspondence.Calling implementation sub-module is used for gathering the amending method that calls corresponding to the object encapsulation type attribute information of extracting from amending method, according to the object encapsulation type attribute information of extracting, use this amending method to revise the corresponding first object encapsulation type of this primary object type and obtain the object encapsulation type, or, use this amending method formation object packaging type according to the object encapsulation type attribute information of extracting.When the extraction submodule extracts object encapsulation type attribute information in dependency set submodule, can extract successively according to the order of setting.
In embodiments of the present invention, created the first object encapsulation type according to the type information of the primary object that from the executable program that comprises primary object, obtains and the publicly-owned interface message of primary object, the attribute information of the object encapsulation type that this first object encapsulation type is obtained is as required made amendment or is generated new object encapsulation type and replenishes again, obtains the desired object packaging type thus.Therefore, in the technical scheme of the embodiment of the invention, primary object type compiling assembly is not carried out decompiling, so under the limited situation of decompiling, still can obtain to be applicable to the group of objects piece installing of new application scenarios.
Claims (8)
1. the method for a formation object packaging type is characterized in that, comprising:
From the executable program that comprises primary object, obtain the publicly-owned interface message of the type information and the primary object of primary object;
Create the first object encapsulation type according to the type information of primary object and the publicly-owned interface message of primary object, specifically comprise: create the type data member identical in the first object encapsulation type, create in the first object encapsulation type and the identical interface of described publicly-owned interface with the type of primary object;
Object encapsulation type attribute information according to the first object encapsulation type and setting obtains the object encapsulation type, specifically comprise: call an amending method, judge as if described object encapsulation type attribute information then corresponding to the amending method that calls, then obtain the object encapsulation type according to amending method and the described first object encapsulation type of described object encapsulation type attribute information correction called, or according to amending method that calls and described object encapsulation type attribute information formation object packaging type; If described object encapsulation type attribute information is then called next amending method not corresponding to the amending method that calls.
2. method according to claim 1 is characterized in that, the described executable program that comprises primary object comprises the assembly that uses the compiling of .NET technology to obtain;
Then describedly from the executable program that comprises primary object, obtain the type information of primary object and the publicly-owned interface message of primary object comprises: use the .NET reflection technology from described assembly, to obtain the publicly-owned interface message of the type information and the primary object of primary object.
3. method according to claim 1 is characterized in that, describedly obtains the type information of primary object and the publicly-owned interface message of primary object comprises from the executable program that comprises primary object:
From the executable program that comprises primary object, obtain the publicly-owned interface message of type information and one or more primary objects of one or more primary objects;
The then described type information and the publicly-owned interface message of primary object according to described primary object created the first object encapsulation type and comprised:
At each primary object, create the first object encapsulation type according to the type information of primary object and the publicly-owned interface message of primary object.
4. method according to claim 1 is characterized in that, describedly calls next amending method and comprises: call amending method successively according to default priority.
5. the device of a formation object packaging type is characterized in that, comprises acquisition module, creation module and object encapsulation type generation module, wherein,
Described acquisition module is used for obtaining from the executable program of primary object the data member information and the publicly-owned interface message of primary object type;
Described creation module, be used for creating the first object encapsulation type according to described data member information and publicly-owned interface message, specifically comprise: create the type data member identical in the first object encapsulation type, create in the first object encapsulation type and the identical interface of described publicly-owned interface with the type of primary object;
Described object encapsulation type generation module, be used for obtaining the object encapsulation type according to the object encapsulation type attribute information of described first object encapsulation type and setting, specifically comprise: call an amending method, judge as if described object encapsulation type attribute information then corresponding to the amending method that calls, then obtain the object encapsulation type according to amending method and the described first object encapsulation type of described object encapsulation type attribute information correction called, or according to amending method that calls and described object encapsulation type attribute information formation object packaging type; If described object encapsulation type attribute information is then called next amending method not corresponding to the amending method that calls.
6. as device as described in the claim 5, it is characterized in that described object encapsulation type generation module comprises sub module stored and call submodule, and comprise and revise submodule and/or generate submodule, wherein,
Described sub module stored is used for storage object packaging type attribute information;
The described submodule that calls is used to call amending method;
Described modification submodule is used for according to described object encapsulation type attribute information, uses to call amending method that submodule calls and revise the described first object encapsulation type and obtain the object encapsulation type;
Described generation submodule is used for according to described object encapsulation type attribute information, uses and calls the amending method formation object packaging type that submodule calls.
7. as device as described in the claim 6, it is characterized in that described modification submodule comprises judging unit and revise the unit, wherein,
Described judging unit is used to judge that whether object encapsulation type attribute information is corresponding to the amending method that calls;
Described modification unit is used for if whether object encapsulation type attribute information corresponding to the amending method that calls, then according to this object encapsulation type attribute information, is used this amending method that calls to revise the described first object encapsulation type and obtained the object encapsulation type.
8. as device as described in the claim 6, it is characterized in that described generation submodule comprises judging unit and generation unit, wherein,
Described judging unit is used to judge that whether object encapsulation type attribute information is corresponding to the amending method that calls;
Described generation unit, be used for if object encapsulation type attribute information whether corresponding to the amending method that calls, then according to this object encapsulation type attribute information, the amending method formation object packaging type that uses this to call.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100802711A CN101504609B (en) | 2009-03-17 | 2009-03-17 | Method and apparatus for generating object package type |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100802711A CN101504609B (en) | 2009-03-17 | 2009-03-17 | Method and apparatus for generating object package type |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101504609A CN101504609A (en) | 2009-08-12 |
CN101504609B true CN101504609B (en) | 2011-11-30 |
Family
ID=40976864
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009100802711A Expired - Fee Related CN101504609B (en) | 2009-03-17 | 2009-03-17 | Method and apparatus for generating object package type |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101504609B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105761007B (en) * | 2016-02-23 | 2020-04-03 | 湖南新邦软件股份有限公司 | Auxiliary method and system for information management software design |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1514361A (en) * | 2002-12-31 | 2004-07-21 | 北京科泰世纪科技有限公司 | Construction member self description packaging method and method of operation |
CN1916842A (en) * | 2006-09-06 | 2007-02-21 | 上海科泰世纪科技有限公司 | Method of packaging component for implementing reflection mechanism in structurized software system |
-
2009
- 2009-03-17 CN CN2009100802711A patent/CN101504609B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1514361A (en) * | 2002-12-31 | 2004-07-21 | 北京科泰世纪科技有限公司 | Construction member self description packaging method and method of operation |
CN1916842A (en) * | 2006-09-06 | 2007-02-21 | 上海科泰世纪科技有限公司 | Method of packaging component for implementing reflection mechanism in structurized software system |
Also Published As
Publication number | Publication date |
---|---|
CN101504609A (en) | 2009-08-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109729149A (en) | A kind of micro services framework implementation method based on note | |
CN107450972A (en) | A kind of dispatching method, device and electronic equipment | |
CN107092475B (en) | Calling method and device of interactive control | |
CN106569880B (en) | Method and system for dynamically sharing resources between Android applications | |
JP6412276B2 (en) | Virtual machine creation method and apparatus | |
CN111782675B (en) | Method, apparatus and computer readable storage medium for generating database script | |
CN102622237B (en) | A kind of collocation method of business function procedure and system | |
CN110764752A (en) | System and method for realizing graphical service arrangement of Restful service based on micro-service architecture | |
CN107402792B (en) | Integration method, device, equipment and storage medium of application software installation package | |
CN107133064A (en) | The hot update method of the page and device of native applications | |
CN103092583A (en) | Method and device for dynamically generating setting item list views | |
CN104793954A (en) | Compiling-free graphical combined element encapsulating and reusing method | |
CN107301347A (en) | A kind of method that Hbuilder App calling figures are obtained based on static analysis | |
Kim | Challenges and future directions of cyber-physical system software | |
CN101196812A (en) | Method for script language calling multiple output parameter interface by component software system | |
CN111596951A (en) | Method and device for configuring engineering file | |
CN103514026A (en) | Method for directly calling java api through javascript | |
CN101504609B (en) | Method and apparatus for generating object package type | |
CN110046052A (en) | A kind of service calling method and device | |
CN106293658A (en) | A kind of interface assembly generates method and equipment thereof | |
CN104503776A (en) | Method for rapidly packaging android application on APP development platform | |
CN108804088B (en) | Protocol processing method and device | |
CN111078435A (en) | Service processing method and device and electronic equipment | |
CN106599156B (en) | A kind of dynamic interceptor management method based on struts2 blocker | |
CN103186388B (en) | Software installation method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20111130 Termination date: 20190317 |
|
CF01 | Termination of patent right due to non-payment of annual fee |