CN103176781B - A kind of method and apparatus realizing software product customization - Google Patents

A kind of method and apparatus realizing software product customization Download PDF

Info

Publication number
CN103176781B
CN103176781B CN201110436019.7A CN201110436019A CN103176781B CN 103176781 B CN103176781 B CN 103176781B CN 201110436019 A CN201110436019 A CN 201110436019A CN 103176781 B CN103176781 B CN 103176781B
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.)
Active
Application number
CN201110436019.7A
Other languages
Chinese (zh)
Other versions
CN103176781A (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

Abstract

The invention discloses a kind of method and apparatus realizing software product customization, the method comprises: receive the request loaded the class file in the first bag; And search for described class file at client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described class file, then use the class file in described first bag to create class object; And if described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy, if supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And if do not support, then to this class file carry out bytecode level signature amendment, and use amendment after class file create class object.By technique scheme, achieve the dynamic load of zero coupling ground customization class file.

Description

A kind of method and apparatus realizing software product customization
Technical field
The present invention relates to JAVA technical field, particularly, relate to a kind of method and apparatus realizing software product customization.
Background technology
In software development process, software development company always tends to the development approach of commercialization, effectively can reduce the time of development and testing like this, reduces cost of development, Speeding up development speed.But when software product is applied to concrete client, can not meet the requirement of client completely, client always can propose the demand of various personalization.In order to realize customization demand, in general development plan, generally there is following solution:
(1) for needing the partial replication of customization to go out multiple version, then being solved the needs of different client by configuration parameter, only can also safeguard a product serial simultaneously.This method is often along with the increase of client makes the complicacy of product code be multiplied.
(2) by good Design Mode, consider the various demands of client as much as possible when deisgn product, guide client to adopt the mode of oneself to realize.This method requires that software enterprise possesses very strong understanding to domain model.
In addition, when the Development of Framework based on similar HIBERNATE, the file of similar Database Mapping is not easy dynamically to be replaced.
Summary of the invention
The object of this invention is to provide a kind of method and apparatus realizing software product customization, it can realize software product zero coupling ground customization.
To achieve these goals, the invention provides a kind of method realizing software product customization, the method comprises: receive the request loaded the class file in the first bag; And search for described class file at client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described class file, then use the class file in described first bag to create class object; And if described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy, if supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And if do not support, then to this class file carry out bytecode level signature amendment, and use amendment after class file create class object.
Correspondingly, the present invention also provides a kind of equipment realizing software product customization, and this equipment comprises: receiving trap, for receiving the request loaded the class file in the first bag; And Classloader, for searching for described class file at client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described class file, then use the class file in described first bag to create class object; And if described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy, if supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And if do not support, then to this class file carry out bytecode level signature amendment, and use amendment after class file create class object.
Pass through technique scheme, the class file loading procedure of software product is monitored, when loading classes file, check whether this class file exists corresponding customization class file, if existed, then replaced the class file of software product by dynamic proxy mechanism or the dynamic mode changing class bytecode, realize the loading of customization class file.By this, other classes in software product also do not know that certain class file is introduced from other clients bag, thus achieve the dynamic load of zero coupling ground customization class file.
Other features and advantages of the present invention are described in detail in embodiment part subsequently.
Accompanying drawing explanation
Accompanying drawing is used to provide a further understanding of the present invention, and forms a part for instructions, is used from explanation the present invention, but is not construed as limiting the invention with embodiment one below.In the accompanying drawings:
Fig. 1 is the process flow diagram realizing the method for software product customization provided by the invention; And
Fig. 2 is the process flow diagram realizing another embodiment of the method for software product customization provided by the invention.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described in detail.Should be understood that, embodiment described herein, only for instruction and explanation of the present invention, is not limited to the present invention.
Fig. 1 is the process flow diagram realizing the method for software product customization provided by the invention.As shown in Figure 1, the invention provides a kind of method realizing software product customization, the method comprises: receive the request loaded the class file in the first bag; And search for described class file at client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described class file, then use the class file in described first bag to create class object; And if described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy, if supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And if do not support, then to this class file carry out bytecode level signature amendment, and use amendment after class file create class object.By this, the dynamic load of zero coupling ground customization class file can be realized.
For ease of understanding, be described specifically to implement situation below.First, the class file A1.class under JAVA virtual machine request Classloader loading A bag.First Classloader searches for described class file A1.class under client wraps custom.A.If do not search element to class file A1.class under client wraps custom.A, then the class file A1.class under A bag is directly used to create class object; If search class file A1.class under client wraps custom.A, then obtain the content of this class file A1.class, and judge whether this class file A1.class supports dynamic proxy.If support dynamic proxy, then use this class file A1.class create dynamic proxy class file (the method definition of this dynamic proxy class file all directly call client wrap custom.A under class file A1.class in method), use this dynamic proxy class file to create class object afterwards; If the class file A1.class that client wraps under custom.A does not support dynamic proxy, then this class file A1.class is carried out to signature amendment (this amendment comprise the signature of the class in described class file, method, instance variable, local variable is modified) of bytecode level, to meet the signature requirement of the class file A1.class under A bag, amended class file is used to create class object afterwards.
Fig. 2 is that the process flow diagram realizing another embodiment of the method for software product customization provided by the invention (represents for clear, Fig. 2 illustrate only the flow process about loading as the resource file of non-class files, and and the flow process that loads of class file shown in not shown Fig. 1).As shown in Figure 2, described method also comprises: receive the request loaded the resource file in the second bag; And search for described resource file in described client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described resource file, then load the resource file in described second bag; And if described client Bao Nei exists described resource file, then load the resource file of described client Bao Nei.By this, the dynamic load to zero coupling ground customization resource file can be realized.
For ease of understanding, be described specifically to implement situation below.First, the resource file B under JAVA virtual machine request Classloader loading A bag.First Classloader searches for described resource file B under client wraps custom.A.If do not search resource file B under client wraps custom.A, then directly load the resource file B under A bag; If search resource file B under client wraps custom.A, then obtain the content of this resource file B, and load this resource file B.
Suppose the general domain model of Hospitality management system Product Definition hotel management, hotel A requires the item of information that increase by is special in hotel's customer information after this software product of application, and this special item of information is a special demand, can not comprise in the product.Now, can be the java project that this hotel creates customization specially.Suppose that the customization information model class in Hospitality management system product is com.company.hotel.model.Customer.java, employ com.company.hotel.model.Customer.hbm.xml Database Mapping file, then need under this project to increase following two files:
(1) custom.com.company.hotel.model.Customer.java, this file adds 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 adds described special item of information on the basis of com.company.hotel.model.Customer.hbm.xml Database Mapping file.
The specific demand in this hotel can be achieved by this simple expansion.And the process of this customization does not make any amendment to hotel management product, can come into force under only needing that the packing of the java project of customization is placed on the class.path of product.
Correspondingly, present invention also offers a kind of equipment realizing software product customization, this equipment comprises: receiving trap, for receiving the request loaded the class file in the first bag; And Classloader, for searching for described class file at client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described class file, then use the class file in described first bag to create class object; And if described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy, if supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And if do not support, then to this class file carry out bytecode level signature amendment, and use amendment after class file create class object.
Wherein, described the signature amendment that class file carries out bytecode level is comprised and being modified to the signature of the class in described class file, method, instance variable, local variable.
Wherein, described receiving trap is also for receiving the request loaded the resource file in the second bag; And described Classloader also searches for described resource file in described client Bao Nei, and perform at least one in following operation: if described client Bao Nei does not exist described resource file, then load the resource file in described second bag; And if described client Bao Nei exists described resource file, then load the resource file of described client Bao Nei.
By technique scheme, other classes in software product also do not know that certain class file or resource file are introduced from other clients bag, thus achieve the dynamic load of zero coupling ground customization class file or resource file.
Below the preferred embodiment of the present invention is described in detail by reference to the accompanying drawings; but; the present invention is not limited to the detail in above-mentioned embodiment; within the scope of technical conceive 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.
It should be noted that in addition, each the concrete technical characteristic described in above-mentioned embodiment, in reconcilable situation, can be combined by any suitable mode.In order to avoid unnecessary repetition, the present invention illustrates no longer separately to various possible array mode.
In addition, also can carry out combination in any between various different 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. realize a method for software product customization, the method comprises:
Receive the request that the class file in the first bag is loaded; And
Search for described class file at client Bao Nei, and perform at least one in following operation:
If described client Bao Nei does not exist described class file, then the class file in described first bag is used to create class object; And
If described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy,
If supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And
If do not supported, then this class file is carried out to the signature amendment of bytecode level, and use the class file after amendment to create class object.
2. method according to claim 1, wherein, describedly comprises modifying to the signature of the class in described class file, method, instance variable, local variable to the signature amendment that class file carries out bytecode level.
3. method according to claim 1 and 2, wherein, described method also comprises:
Receive the request that the resource file in the second bag is loaded; And
Search for described resource file at described client Bao Nei, and perform at least one in following operation:
If described client Bao Nei does not exist described resource file, then load the resource file in described second bag; And
If described client Bao Nei exists described resource file, then load the resource file of described client Bao Nei.
4. realize an equipment for software product customization, this equipment comprises:
Receiving trap, for receiving the request loaded the class file in the first bag; And
Classloader, for searching for described class file at client Bao Nei, and performs at least one in following operation:
If described client Bao Nei does not exist described class file, then the class file in described first bag is used to create class object; And
If described client Bao Nei exists described class file, then judge whether this class file supports dynamic proxy,
If supported, then use such document creation dynamic proxy class file, and use this dynamic proxy class file to create class object; And
If do not supported, then this class file is carried out to the signature amendment of bytecode level, and use the class file after amendment to create class object.
5. equipment according to claim 4, wherein, describedly comprises modifying to the signature of the class in described class file, method, instance variable, local variable to the signature amendment that class file carries out bytecode level.
6. the equipment according to claim 4 or 5, wherein,
Described receiving trap is also for receiving the request loaded the resource file in the second bag; And
Described Classloader also for searching for described resource file at described client Bao Nei, and performs at least one in following operation:
If described client Bao Nei does not exist described resource file, then load the resource file in described second bag; And
If described client Bao Nei exists described resource file, then 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 CN103176781A (en) 2013-06-26
CN103176781B true 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
CN103176781A (en) 2013-06-26

Similar Documents

Publication Publication Date Title
CN103902696B (en) A kind of method and device for loading resource file
US10318318B2 (en) Extending user interface of a web console
CN107102847A (en) Software development methodology, apparatus and system based on micro services
CN102427480B (en) Application access method in a plurality of application service platform systems
US8407351B2 (en) Method and apparatus for ensuring transport of user agent information
US20130275958A1 (en) Automatic identification of services
WO2016011883A1 (en) Data resource acquisition method, device and system
US8972489B2 (en) Providing a client interface for a server-based web application programming interface
CN106339237B (en) For the plug-in unit loading frame and method of the field JavaEE WEB application
US20130103734A1 (en) Method and apparatus for providing standard information processing pipelines
WO2009043037A4 (en) Network operating system
EP2778968B1 (en) Mobile telecommunication device remote access to cloud-based or virtualized database systems
CN103077024B (en) A kind of device and method supporting the on-demand customization of SaaS application flow and operation
CN102393857A (en) Method and system for local call based on web page
US20170017669A1 (en) Database integration of originally decoupled components
WO2009069864A1 (en) System and method for operating domain profile using database in core framework for sdr mobile terminals
US20130275623A1 (en) Deployment of web application archives as a preprocessing step for provisioning
CN111638923B (en) Method and device for data routing based on Java annotation
CN110058864A (en) The dispositions method and device of micro services
CN109522042A (en) A kind of patch update method, system and associated component
US9154540B2 (en) Smart redirection and loop detection mechanism for live upgrade large-scale web clusters
CN103176781B (en) A kind of method and apparatus realizing software product customization
CN104980464A (en) Network request processing method, network server and network system
CN102156697A (en) Method and terminal equipment for realizing webpage application through widget
US9141411B2 (en) Model slicing and versioning

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