CN103176781A - Method and device used for realizing customization of software product - Google Patents

Method and device used for realizing customization of software product Download PDF

Info

Publication number
CN103176781A
CN103176781A CN2011104360197A CN201110436019A CN103176781A CN 103176781 A CN103176781 A CN 103176781A CN 2011104360197 A CN2011104360197 A CN 2011104360197A CN 201110436019 A CN201110436019 A CN 201110436019A CN 103176781 A CN103176781 A CN 103176781A
Authority
CN
China
Prior art keywords
class
file
class file
client
bao nei
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.)
Granted
Application number
CN2011104360197A
Other languages
Chinese (zh)
Other versions
CN103176781B (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.)
Beijing Orient View Technology Co Ltd
Original Assignee
Beijing Orient View 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 Beijing Orient View Technology Co Ltd filed Critical Beijing Orient View Technology Co Ltd
Priority to CN201110436019.7A priority Critical patent/CN103176781B/en
Publication of CN103176781A publication Critical patent/CN103176781A/en
Application granted granted Critical
Publication of CN103176781B publication Critical patent/CN103176781B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method and a device used for realizing customization of a software product. The method comprises the steps of receiving a request for uploading of a class file in a first package, searching the class file in a client package, and executing at least one of the following steps: if the class file does not exist in the client package, then a class object is established by using the class file in the first package, and if the client contains the class file, whether the class file supports dynamic proxy is judged, if the class file supports the dynamic proxy, the class file is used for establishing a dynamic proxy file and the class object is established by using the dynamic proxy file, if the class file does not support the dynamic proxy, signature modification in bytecode level is carried out on the class file, and the class object is established by using the class file which is modified. According to the method and the device used for realizing the customization of the software product, dynamic loading of the customization class file is achieved in a zero-coupling mode.

Description

A kind of method and apparatus of realizing the software product customization
Technical field
The present invention relates to the JAVA technical field, particularly, relate to a kind of method and apparatus of realizing the software product customization.
Background technology
In software development process, software development company always tends to the development approach of commercialization, can effectively reduce like this time of development and testing, reduces cost of development, Speeding up development speed.But when software product is applied to concrete client, can not satisfy client's requirement fully, the client always can propose various Extraordinary demands.In order to realize the customization demand, following solution is arranged generally in general development plan:
(1) go out a plurality of versions for the partial replication that needs customization, then solve different clients' needs by configuration parameter, can also only safeguard a product serial simultaneously.This method is often along with client's increase is multiplied the complicacy of product code.
(2) by good Design Mode, consider as much as possible client's various demands when deisgn product, the guiding client adopts the mode of oneself to realize.This method requires software enterprise to possess very strong understanding to domain model.
In addition, based on the Development of Framework of similar HIBERNATE the time, the file of similar Database Mapping is not easy dynamically to be replaced.
Summary of the invention
The purpose of this invention is to provide a kind of method and apparatus of realizing the software product customization, it can realize software product zero coupling ground customization.
To achieve these goals, the invention provides a kind of method that realizes the software product customization, the method comprises: receive the request that the class file in the first bag is loaded; And at the described class file of client Bao Nei search, and at least one in operation below carrying out: if there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; There is described class file if reach described client Bao Nei, judges whether this class file supports dynamic proxy, if support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; Do not support if reach, this class file is carried out the signature modification of bytecode level, and use the class file establishment class object after revising.
Correspondingly, the present invention also provides a kind of equipment of realizing the software product customization, and this equipment comprises: receiving trap is used for receiving the request that the class file in the first bag is loaded; And Classloader, be used at the described class file of client Bao Nei search, and at least one in operation below carrying out: if there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; There is described class file if reach described client Bao Nei, judges whether this class file supports dynamic proxy, if support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; Do not support if reach, this class file is carried out the signature modification of bytecode level, and use the class file establishment class object after revising.
Pass through technique scheme, class file loading procedure to software product is monitored, when the loading classes file, check whether this class file exists corresponding customization class file, if exist, replace the class file of software product by dynamic proxy mechanism or the mode of dynamically changing the class bytecode, realize the loading of customization class file.By this, other classes in software product are not also known the introducing from other client's bags of certain class file, thereby have realized the dynamic load of zero coupling ground customization class file.
Other features and advantages of the present invention will partly be described in detail in embodiment subsequently.
Description of drawings
Accompanying drawing is to be used to provide a further understanding of the present invention, and consists of the part of instructions, is used from explanation the present invention with following embodiment one, but is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of realizing the method for software product customization provided by the invention; And
Fig. 2 is the process flow diagram of another embodiment of the method that realizes the software product customization provided by the invention.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is elaborated.Should be understood that, embodiment described herein only is used for description and interpretation the present invention, is not limited to the present invention.
Fig. 1 is the process flow diagram of realizing the method for software product customization provided by the invention.As shown in Figure 1, the invention provides a kind of method that realizes the software product customization, the method comprises: receive the request that the class file in the first bag is loaded; And at the described class file of client Bao Nei search, and at least one in operation below carrying out: if there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; There is described class file if reach described client Bao Nei, judges whether this class file supports dynamic proxy, if support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; Do not support if reach, this class file is carried out the signature modification of bytecode level, and use the class file establishment class object after revising.By this, can realize the dynamic load of zero coupling ground customization class file.
For ease of understanding, below describe as an example of concrete enforcement situation example.At first, JAVA virtual machine request Classloader loads the class file A1.class under the A bag.At first Classloader wraps the described class file A1.class of search under custom.A the client.If do not search element to class file A1.class under the client wraps custom.A, directly create class object with the class file A1.class under the A bag; If search class file A1.class under the client wraps custom.A, obtain the content of this class file A1.class, and judge whether this class file A1.class supports dynamic proxy.If support dynamic proxy, use this class file A1.class to create dynamic proxy class file (the method definition of this dynamic proxy class file is all directly called the client and wrapped method in class file A1.class under custom.A), use afterwards this dynamic proxy class file to create class object; If the class file A1.class that the client wraps under custom.A does not support dynamic proxy, the signature that this class file A1.class is carried out bytecode level is revised (this modification comprise the signature of the class in described class file, method, instance variable, local variable is modified), to meet the signature requirement of the class file A1.class under the A bag, use afterwards amended class file to create class object.
Fig. 2 is that the process flow diagram of another embodiment of the method that realizes the software product customization provided by the invention (is clear expression, Fig. 2 only shows the relevant flow process that loads as the resource file of non-class file, and and the flow process that loads of not shown class file shown in Figure 1).As shown in Figure 2, described method also comprises: receive the request that the resource file in the second bag is loaded; And in the described resource file of described client Bao Nei search, and at least one in operation below carrying out: if there is not described resource file in described client Bao Nei, load the resource file in described the second bag; And if there is described resource file in described client Bao Nei, load the resource file of described client Bao Nei.By this, can realize dynamic load to zero coupling ground customization resource file.
For ease of understanding, below describe as an example of concrete enforcement situation example.At first, JAVA virtual machine request Classloader loads the resource file B under the A bag.At first Classloader wraps the described resource file B of search under custom.A the client.If do not search resource file B under the client wraps custom.A, directly load the resource file B under the A bag; If search resource file B under the client wraps custom.A, obtain the content of this resource file B, and load this resource file B.
The general domain model of hotel management of having supposed a Hospitality management system Product Definition, the A of hotel requires to increase a special item of information in hotel's customer information after using this software product, and this special item of information is a special demand, can not comprise in product.At this moment, can create specially for this hotel the java project of customization.Suppose that the customization information model class in the Hospitality management system product is com.company.hotel.model.Customer.java, use com.company.hotel.model.Customer.hbm.xml Database Mapping file, needed to increase following two files under this project:
(1) custom.com.company.hotel.model.Customer.java, this file have increased described special item of information on the basis of com.company.hotel.model.Customer.java; And
(2) custom.com.company.hotel.model.Customer.hbm.xml Database Mapping file, this file have increased described special item of information on the basis of com.company.hotel.model.Customer.hbm.xml Database Mapping file.
Can realize the specific demand in this hotel by this simple expansion.And the process of this customization is not made any modification to the hotel management product, only need to be placed on the packing of the java project of customization under the class.path of product and can come into force.
Correspondingly, the present invention also provides a kind of equipment of realizing the software product customization, and this equipment comprises: receiving trap is used for receiving the request that the class file in the first bag is loaded; And Classloader, be used at the described class file of client Bao Nei search, and at least one in operation below carrying out: if there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; There is described class file if reach described client Bao Nei, judges whether this class file supports dynamic proxy, if support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; Do not support if reach, this class file is carried out the signature modification of bytecode level, and use the class file establishment class object after revising.
Wherein, the described signature that class file is carried out bytecode level is revised and to be comprised the signature of the class in described class file, method, instance variable, local variable is modified.
Wherein, described receiving trap also is used for receiving the request that the resource file in the second bag is loaded; And described Classloader is also in the described resource file of described client Bao Nei search, and carries out at least one in following operation: if there is not described resource file in described client Bao Nei, load the resource file in described the second bag; And if there is described resource file in described client Bao Nei, load the resource file of described client Bao Nei.
By technique scheme, other classes in software product are not also known certain class file or resource file introducing from other client's bags, thereby have realized the dynamic load of zero coupling ground customization class file or resource file.
Below describe by reference to the accompanying drawings the preferred embodiment of the present invention in detail; but; the present invention is not limited to the detail in above-mentioned embodiment; in technical conceive scope of the present invention; can carry out multiple simple variant to technical scheme of the present invention, these simple variant all belong to protection scope of the present invention.
Need to prove that in addition each the concrete technical characterictic described in above-mentioned embodiment in reconcilable situation, can make up by any suitable mode.For fear of unnecessary repetition, the present invention is to the explanation no longer separately of various possible array modes.
In addition, also can carry out combination in any between various embodiment of the present invention, as long as it is without prejudice to thought of the present invention, it should be considered as content disclosed in this invention equally.

Claims (6)

1. method that realizes the software product customization, the method comprises:
The request that reception loads the class file in the first bag; And
At the described class file of client Bao Nei search, and at least one in operation below carrying out:
If there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; And
If there is described class file in described client Bao Nei, judge whether this class file supports dynamic proxy,
If support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And
If do not support, this class file is carried out the signature modification of bytecode level, and use the class file after revising to create class object.
2. method according to claim 1, wherein, the described signature that class file is carried out bytecode level is revised and is comprised the signature of the class in described class file, method, instance variable, local variable is modified.
3. method according to claim 1 and 2, wherein, described method also comprises:
The request that reception loads the resource file in the second bag; And
At the described resource file of described client Bao Nei search, and at least one in operation below carrying out:
If there is not described resource file in described client Bao Nei, load the resource file in described the second bag; And
If there is described resource file in described client Bao Nei, load the resource file of described client Bao Nei.
4. equipment of realizing the software product customization, this equipment comprises:
Receiving trap is used for receiving the request that the class file in the first bag is loaded; And
Classloader is used at the described class file of client Bao Nei search, and carries out at least one in following operation:
If there is not described class file in described client Bao Nei, use the class file in described the first bag to create class object; And
If there is described class file in described client Bao Nei, judge whether this class file supports dynamic proxy,
If support, use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And
If do not support, this class file is carried out the signature modification of bytecode level, and use the class file after revising to create class object.
5. equipment according to claim 4, wherein, the described signature that class file is carried out bytecode level is revised and is comprised the signature of the class in described class file, method, instance variable, local variable is modified.
6. according to claim 4 or 5 described equipment, wherein,
Described receiving trap also is used for receiving the request that the resource file in the second bag is loaded; And
Described Classloader also is used at the described resource file of described client Bao Nei search, and carries out at least one in following operation:
If there is not described resource file in described client Bao Nei, load the resource file in described the second bag; And
If there is described resource file in described client Bao Nei, load the resource file of described client Bao Nei.
CN201110436019.7A 2011-12-22 2011-12-22 A kind of method and apparatus realizing software product customization Active CN103176781B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110436019.7A CN103176781B (en) 2011-12-22 2011-12-22 A kind of method and apparatus realizing software product customization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110436019.7A CN103176781B (en) 2011-12-22 2011-12-22 A kind of method and apparatus realizing software product customization

Publications (2)

Publication Number Publication Date
CN103176781A true CN103176781A (en) 2013-06-26
CN103176781B CN103176781B (en) 2016-03-16

Family

ID=48636688

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110436019.7A Active CN103176781B (en) 2011-12-22 2011-12-22 A kind of method and apparatus realizing software product customization

Country Status (1)

Country Link
CN (1) CN103176781B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6584612B1 (en) * 1999-07-15 2003-06-24 International Business Machines Corporation Transparent loading of resources from read-only memory for an application program
CN1781077A (en) * 2003-04-29 2006-05-31 索尼爱立信移动通讯股份有限公司 Selective loading of remote classes or resources for debugging a Java application in a Java micro device
CN101520733A (en) * 2008-02-27 2009-09-02 国际商业机器公司 Method and device for class loading and method for reorganizing class archived file

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6584612B1 (en) * 1999-07-15 2003-06-24 International Business Machines Corporation Transparent loading of resources from read-only memory for an application program
CN1781077A (en) * 2003-04-29 2006-05-31 索尼爱立信移动通讯股份有限公司 Selective loading of remote classes or resources for debugging a Java application in a Java micro device
CN101520733A (en) * 2008-02-27 2009-09-02 国际商业机器公司 Method and device for class loading and method for reorganizing class archived file

Also Published As

Publication number Publication date
CN103176781B (en) 2016-03-16

Similar Documents

Publication Publication Date Title
CN107102847A (en) Software development methodology, apparatus and system based on micro services
CN108123996B (en) Application management service instance
EP2593866B1 (en) Method and apparatus for distributing computation closures
US10223083B1 (en) System and method for pervasive software platform-based model driven architecture transaction aware application generator
US20130275958A1 (en) Automatic identification of services
WO2016011883A1 (en) Data resource acquisition method, device and system
WO2012091948A2 (en) Systems and methods for database proxy request switching
CN106339237B (en) For the plug-in unit loading frame and method of the field JavaEE WEB application
EP2778968A1 (en) Mobile telecommunication device remote access to cloud-based or virtualized database systems
Li et al. A dynamically scalable cloud data infrastructure for sensor networks
US20130275623A1 (en) Deployment of web application archives as a preprocessing step for provisioning
EP2619692A1 (en) Method and apparatus for process allocation within a mobile device
CN111339145A (en) Process integration method and platform, and computer-readable storage medium
CN105700877A (en) Application deployment method and apparatus
US20160028801A1 (en) Smart redirection and loop detection mechanism for live upgrade large-scale web clusters
CN109522042A (en) A kind of patch update method, system and associated component
CN103677983B (en) The dispatching method and device of application
US20100100894A1 (en) System and Method for Asynchronously Invoking Dynamic Proxy Interface Using Supplemental Interfaces
CN101183975B (en) Distributed heat dispositions method of cluster application server
CN104834534A (en) Application program function extension method, device and system
CN102479355A (en) Method and device for loading business documents and mobile terminal
US8972487B2 (en) Automated framework for testing enterprise services consumer technologies
O'Sullivan et al. The cloud personal assistant for providing services to mobile clients
CN104980464A (en) Network request processing method, network server and network system
CN103176781B (en) A kind of method and apparatus realizing software product customization

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