[go: up one dir, main page]

CN103019722B - A kind of method and device extracting Java network application AKU - Google Patents

A kind of method and device extracting Java network application AKU Download PDF

Info

Publication number
CN103019722B
CN103019722B CN201210546629.7A CN201210546629A CN103019722B CN 103019722 B CN103019722 B CN 103019722B CN 201210546629 A CN201210546629 A CN 201210546629A CN 103019722 B CN103019722 B CN 103019722B
Authority
CN
China
Prior art keywords
file
source program
name
modified source
upgrade package
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
CN201210546629.7A
Other languages
Chinese (zh)
Other versions
CN103019722A (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.)
State Grid Corp of China SGCC
Beijing Guodiantong Network Technology Co Ltd
Beijing China Power Information Technology Co Ltd
Original Assignee
State Grid Corp of China SGCC
Beijing China Power Information 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 State Grid Corp of China SGCC, Beijing China Power Information Technology Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN201210546629.7A priority Critical patent/CN103019722B/en
Publication of CN103019722A publication Critical patent/CN103019722A/en
Application granted granted Critical
Publication of CN103019722B publication Critical patent/CN103019722B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种抽取Java网络应用升级包的方法。该方法包括:确定升级包目录和实现Java网络应用升级被修改的源程序文件;将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;根据被修改的源程序文件的相对路径拼装出编译后的文件路径;查找编译后的文件路径下与被修改源程序文件同名的文件;将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。本申请实施例还公开了一种抽取Java网络应用升级包的装置。本申请实施例可以减小升级包“体积”,节约存储资源和传输资源。

The embodiment of the present application discloses a method for extracting a Java network application upgrade package. The method includes: determining the directory of the upgrade package and implementing the Java network application upgrade modified source program file; writing the file name of the modified source program file into the list of modified source program files in the form of a relative path; The relative path of the program file assembles the file path after compilation; Find the file with the same name as the modified source program file under the file path after compilation; Write the file with the same name under the upgrade package directory to realize the Java network application upgrade Package extraction. The embodiment of the present application also discloses a device for extracting a Java network application upgrade package. The embodiment of the present application can reduce the "volume" of the upgrade package, saving storage resources and transmission resources.

Description

一种抽取Java网络应用升级包的方法及装置Method and device for extracting Java network application upgrade package

技术领域technical field

本申请涉及信息处理技术领域,特别是涉及一种抽取Java网络应用升级包的方法及其对应的装置。The present application relates to the technical field of information processing, in particular to a method for extracting a Java network application upgrade package and a corresponding device.

背景技术Background technique

随着J2EE技术的广泛应用,基于Java的网络应用越来越多。比如,采用Eclipse平台开发的企业级信息管理系统。由于网络应用的开发需求不断变化或者开发时的相关技术能力受限等因素,网络应用可能存在程序漏洞或功能缺陷,需要通过开发完成后提供的补丁程序包实现升级完善,从而使基于Java的网络应用的适应性增强。With the wide application of J2EE technology, there are more and more Java-based network applications. For example, an enterprise-level information management system developed on the Eclipse platform. Due to factors such as constant changes in the development requirements of network applications or limited technical capabilities during development, network applications may have program loopholes or functional defects, which need to be upgraded and improved through the patch package provided after the development is completed, so that the Java-based network The adaptability of the application is enhanced.

现有技术的一种抽取Java网络应用升级包的方法是:将修改后完成单元测试的程序源文件打上版本标签,提交到开发库;新建立的空白项目从开发库中抽取需要的版本的文件,引入相关JAR包(预先编辑的类文件集合)进行测试环境调试,然后进行编译,将编译后的文件包作为网络应用升级包。这种抽取Java网络应用升级包的方法将升级包发布后能够实现Java网络应用的升级完善。然而,由于上述抽取升级包的方式需要引入JAR包进行环境测试,该过程将使部分不需要更新的文件同时增加到升级包之中,导致升级包过于臃肿,占用过多的存储资源和传输资源,不利于整体上改善抽取Java网络应用的效率。A method of extracting the Java network application upgrade package in the prior art is: put a version label on the program source file that has completed the unit test after modification, and submit it to the development library; the newly established blank project extracts the required version of the file from the development library , introduce the relevant JAR package (a collection of pre-edited class files) to debug the test environment, and then compile it, and use the compiled file package as the network application upgrade package. The method for extracting the Java network application upgrade package can realize the upgrade and perfection of the Java network application after the upgrade package is released. However, because the above method of extracting the upgrade package needs to introduce the JAR package for environmental testing, this process will add some files that do not need to be updated to the upgrade package at the same time, resulting in the upgrade package being too bloated and occupying too much storage and transmission resources. , which is not conducive to improving the efficiency of extracting Java network applications as a whole.

发明内容Contents of the invention

为解决上述技术问题,本申请实施例提供了一种抽取Java网络应用升级包的方法及其对应的装置,以减小升级包的“体积”,节约存储资源和传输资源,从而整体上改善抽取Java网络应用的效率。In order to solve the above technical problems, the embodiment of the present application provides a method for extracting the Java network application upgrade package and its corresponding device, so as to reduce the "volume" of the upgrade package, save storage resources and transmission resources, thereby improving the extraction as a whole Efficiency of Java web applications.

本申请实施例提供的抽取Java网络应用升级包的方法包括:The method for extracting the Java network application upgrade package provided by the embodiment of the present application includes:

确定升级包目录和实现Java网络应用升级被修改的源程序文件;Determine the directory of the upgrade package and the modified source program files to realize the upgrade of the Java network application;

将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;Write the file name of the modified source program file to the list of modified source program files in the form of a relative path;

根据被修改的源程序文件的相对路径拼装出编译后的文件路径;Assemble the compiled file path according to the relative path of the modified source program file;

查找编译后的文件路径下与被修改源程序文件同名的文件;Find the file with the same name as the modified source program file under the compiled file path;

将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The file with the same name is written into the upgrade package directory to realize the extraction of the Java network application upgrade package.

优选地,在将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表后,所述方法还包括:验证所述被修改的源程序文件是否存在,如果存在,则执行文件路径拼装步骤。Preferably, after the file name of the modified source program file is written in the list of modified source program files in the form of a relative path, the method further includes: verifying whether the modified source program file exists, and if so, Then execute the file path assembly step.

优选地,如果被修改的源程序文件包含Java类文件且编译后的内嵌类内具有同名文件,则在查找编译后的文件路径下与被修改源程序文件同名的文件之前,将Java类文件的文件名按照预设规则进行区别。Preferably, if the modified source program file includes a Java class file and the compiled embedded class has a file with the same name, before searching for a file with the same name as the modified source program file under the compiled file path, the Java class file The file names of the files are distinguished according to the preset rules.

优选地,所述方法还包括:统计升级包目录下的文件的数量。Preferably, the method further includes: counting the number of files in the upgrade package directory.

本申请实施例还提供了一种抽取Java网络应用升级包的装置。该装置包括:目录文件确定单元、文件名写入单元、文件路径拼装单元、同名文件查找单元和同名文件写入单元,其中:The embodiment of the present application also provides a device for extracting a Java network application upgrade package. The device includes: a directory file determining unit, a file name writing unit, a file path assembling unit, a file search unit with the same name and a file writing unit with the same name, wherein:

所述目录文件确定单元,用于确定升级包目录和实现Java网络应用升级被修改的源程序文件;The directory file determination unit is used to determine the upgrade package directory and realize the modified source program file of Java network application upgrade;

所述文件名写入单元,用于将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;The file name writing unit is used to write the file name of the modified source program file into the list of modified source program files in the form of a relative path;

所述文件路径拼装单元,用于根据被修改的源程序文件的相对路径拼装出编译后的文件路径;The file path assembling unit is used to assemble the compiled file path according to the relative path of the modified source program file;

所述同名文件查找单元,用于查找编译后的文件路径下与被修改源程序文件同名的文件;The same-name file search unit is used to search for files with the same name as the modified source program file under the compiled file path;

所述同名文件写入单元,用于将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The file writing unit with the same name is configured to write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package.

优选地,所述装置还包括文件验证单元,用于在将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表后,验证所述被修改的源程序文件是否存在,如果存在,则触发文件路径拼装单元。Preferably, the device further includes a file verification unit, configured to verify whether the modified source program file is Exists, if exists, triggers the file path assembly unit.

优选地,如果被修改的源程序文件包含Java类文件且编译后的内嵌类内具有同名文件,所述装置还包括文件名区分单元,用于在查找编译后的文件路径下与被修改源程序文件同名的文件之前,将Java类文件的文件名按照预设规则进行区分。Preferably, if the modified source program file contains a Java class file and the compiled embedded class has a file with the same name, the device also includes a file name distinguishing unit, which is used to search for the compiled file path with the modified source file. Before the file with the same name as the program file, the file name of the Java class file is distinguished according to the preset rules.

优选地,所述装置还包括文件数量统计单元,用于统计升级包目录下的文件的数量。Preferably, the device further includes a file quantity counting unit for counting the number of files in the upgrade package directory.

本申请实施例在确定升级包目录和被修改的源程序文件后,将被修改的源程序文件的文件名以相对路径写入文件列表,然后通过相对路径拼装出文件路径,再在该路径下查找同名文件,将同名文件写入升级包目录实现Java网络应用升级包的抽取。与现有技术相比,本申请实施例仅记载被修改源程序文件的相对文件路径,通过该相对文件路径得到同名文件,将同名文件拷贝到升级包目录之下,避免了在编译测试过程中引入没有被修改的源文件,从而压缩了升级包的“体积”,节约了存储资源和传输资源,整体上改善了抽取Java网络应用的效率。In the embodiment of the present application, after the upgrade package directory and the modified source program file are determined, the file name of the modified source program file is written into the file list with a relative path, and then the file path is assembled through the relative path, and then in the path Find the file with the same name, and write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package. Compared with the prior art, the embodiment of the present application only records the relative file path of the modified source program file, obtains the file with the same name through the relative file path, copies the file with the same name under the upgrade package directory, and avoids the The source files that have not been modified are introduced, thereby compressing the "volume" of the upgrade package, saving storage resources and transmission resources, and improving the efficiency of extracting Java network applications as a whole.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments described in this application. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1为本申请的抽取Java网络应用升级包的方法实施例的流程图;Fig. 1 is the flow chart of the method embodiment of extracting Java network application upgrade package of the present application;

图2为图1所述实施例的效果图;Fig. 2 is the rendering of the embodiment described in Fig. 1;

图3为本申请抽取Java网络应用升级包过程中执行验证步骤后的效果图;Fig. 3 is the rendering after performing the verification step in the process of extracting the Java network application upgrade package in the present application;

图4为本申请抽取Java网络应用升级包过程中执行统计步骤后的效果图;Fig. 4 is the effect diagram after performing statistical steps in the process of extracting the Java network application upgrade package in the present application;

图5为本申请抽取Java网络应用升级包的装置实施例的组成框图。FIG. 5 is a block diagram of an embodiment of an apparatus for extracting a Java network application upgrade package according to the present application.

具体实施方式detailed description

为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described The embodiments are only some of the embodiments of the present application, but not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.

参见图1,该图示出了本申请的抽取Java网络应用升级包的方法实施例的流程。该实施例包括:Referring to FIG. 1 , this figure shows the flow of an embodiment of the method for extracting a Java network application upgrade package according to the present application. This example includes:

步骤S101:确定升级包目录和实现Java网络应用升级被修改的源程序文件;Step S101: Determine the directory of the upgrade package and the modified source program file to realize the upgrade of the Java network application;

升级包目录用于放置需要更新升级的程序文件,在抽取Java网络应用升级包中应预先确定该目录,需要说明的是本实施例所指的“升级”不仅包括Java网络应用的版本升级(即推出新一代的Java网络应用),而且包括对Java网络应用的漏洞或缺陷的补充和完善;被修改的源程序文件是实现Java网络应用升级完善的程序代码,制作升级包即是编译这些程序代码。确定升级包目录和被修改源程序文件的方式很多,既可以采用人工设置,也可以通过自动化设备按照预设规则进行配置,比如,通过专门的配置文件config.xml配置升级包目录和被修改的源程序文件。在某些情况下,如果项目源程序目录发生变化,还需要根据实际情况配置项目源程序目录。通过配置文件配置项目源程序目录、升级包目录以及被修改的源文件的示例性程序代码如:The upgrade package directory is used to place the program files that need to be updated and upgraded. This directory should be predetermined in extracting the Java network application upgrade package. It should be noted that the "upgrade" referred to in this embodiment not only includes the version upgrade of the Java network application (i.e. Launch a new generation of Java network applications), and include supplements and improvements to the loopholes or defects of Java network applications; the modified source program files are program codes that realize the upgrade of Java network applications, and making upgrade packages means compiling these program codes . There are many ways to determine the upgrade package directory and the modified source program file. It can be manually set or configured according to preset rules through automated equipment. For example, the upgrade package directory and the modified source program file can be configured through a special configuration file config.xml. source program files. In some cases, if the project source program directory changes, it is also necessary to configure the project source program directory according to the actual situation. Exemplary program codes for configuring the project source program directory, upgrade package directory, and modified source files through configuration files are as follows:

本程序段将项目源程序目录配置为D:\\ProgramFiles\\SoTowerStudio1.5.1_07\\eclipse\\workspace\\jjjc,将升级包目录配置为E:\\a,设定被修改源程序文件列表readme.txt来记载被修改的源程序文件,以txt文件格式实现记载。This program section configures the project source program directory as D:\\ProgramFiles\\SoTowerStudio1.5.1_07\\eclipse\\workspace\\jjjc, configures the upgrade package directory as E:\\a, and sets the modified source program file List readme.txt to record the modified source program file, and realize the record in txt file format.

步骤S102:将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;Step S102: Write the file name of the modified source program file into the list of modified source program files in the form of a relative path;

确定升级包目录和被修改的源程序文件后,将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表,这里的“相对路径”是相对于绝对路径而言的,“相对路径”的根目录由Java网络应用的根目录确定。在Java网络应用升级过程中通常情况涉及到的被修改源程序文件包括多个,为此,本实施例设置一个被修改源程序文件列表来记载这多个文件的路径。参见如下的代码段,该代码段向被修改文件列表readme.txt写入了两个源程序文件,分别为TaskInfoStub.java、main.jsp,需要说明的是:这里的文件名应当是按照本领域所属技术知识确定的文件全名,即包含文件本名(文件名称)部分,也包含文件扩展名,具有扩张名的源程序文件才能被识别:After determining the upgrade package directory and the modified source program file, write the file name of the modified source program file into the list of modified source program files in the form of a relative path, where the "relative path" is relative to the absolute path Yes, the root directory of the "relative path" is determined by the root directory of the Java web application. Usually, there are multiple modified source program files involved in the Java network application upgrade process. Therefore, this embodiment sets a list of modified source program files to record the paths of these multiple files. Refer to the following code segment, which writes two source program files to the modified file list readme.txt, namely TaskInfoStub.java and main.jsp. It should be noted that the file names here should be according to the field The full name of the file determined by the technical knowledge it belongs to includes the part of the original name (file name) of the file and the extension of the file. Only the source program file with the extension can be recognized:

src\com\portal\task\shandong\TaskInfoStub.java/src\com\portal\task\shandong\TaskInfoStub.java/

WebContent\jjjc\lzjs\main.jspWebContent\jjjc\lzjs\main.jsp

步骤S103:根据被修改的源程序文件的相对路径拼装出编译后的文件路径;Step S103: assemble the compiled file path according to the relative path of the modified source program file;

编译后的文件路径即是绝对路径,该绝对路径由被修改的程序文件的相对路径与项目源程序目录(项目开发目录)确定,通常情况,项目源程序目录可以采用默认的目录,这样即可直接根据相对路径与默认的项目源程序目录拼装出编译后的文件路径。但在某些情况下,项目源程序目录发生变化,这时可预置项目源程序目录,如前例所示的项目开发目录:D:\\ProgramFiles\\SoTowerStudio1.5.1_07\\eclipse\\workspace\\jjjc。当被修改的源程序文件的相对路径为“src\com\portal\task\shandong\TaskInfoStub.java”时,拼装后的绝对路径为:“D:\ProgramFiles\SoTowerStudio1.5.1_07\eclipse\workspace\jjjc\src\com\portal\task\shandong\TaskInfoStub.java”。The compiled file path is the absolute path, which is determined by the relative path of the modified program file and the project source program directory (project development directory). Usually, the project source program directory can use the default directory, so that Directly assemble the compiled file path based on the relative path and the default project source program directory. However, in some cases, the project source program directory changes. At this time, the project source program directory can be preset, such as the project development directory shown in the previous example: D:\\ProgramFiles\\SoTowerStudio1.5.1_07\\eclipse\\workspace \\jjjc. When the relative path of the modified source program file is "src\com\portal\task\shandong\TaskInfoStub.java", the absolute path after assembly is: "D:\ProgramFiles\SoTowerStudio1.5.1_07\eclipse\workspace\ jjjc\src\com\portal\task\shandong\TaskInfoStub.java".

步骤S104:查找编译后的文件路径下与被修改源程序文件同名的文件;Step S104: Find the file with the same name as the modified source program file under the compiled file path;

步骤S105:将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取;Step S105: writing the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package;

通过前述步骤查找到同名文件后,说明该文件即为需要更新升级的文件,将其写入到升级包目标目录下,从而实现Java网络应用升级包的抽取。具体将同名文件写入升级包目录可以采用Java的函数(方法)fileCopyToSourceFile()实现。以前述提及的升级包目录为例,将同名文件写入到升级包目录下后的效果如图2所示:在E:\a之下包含另个文件夹,一个是src文件夹,一个是WebContent文件夹。After the file with the same name is found through the preceding steps, it means that the file needs to be updated and upgraded, and it is written into the upgrade package target directory, so as to realize the extraction of the Java network application upgrade package. Specifically, writing the file with the same name into the upgrade package directory can be implemented by using the Java function (method) fileCopyToSourceFile(). Taking the upgrade package directory mentioned above as an example, the effect after writing the file with the same name into the upgrade package directory is shown in Figure 2: there are another folders under E:\a, one is the src folder, and the other is the is the WebContent folder.

本实施例在确定升级包目录和被修改的源程序文件后,将被修改的源程序文件的文件名以相对路径写入文件列表,然后通过相对路径拼装出文件路径,再在该路径下查找同名文件,将同名文件写入升级包目录实现Java网络应用升级包的抽取。与现有技术相比,本实施例仅记载被修改源程序文件的相对文件路径,通过该相对文件路径得到同名文件,将同名文件拷贝到升级包目录之下,避免了在编译测试过程中引入没有被修改的源文件,从而压缩了升级包的“体积”,节约了存储资源和传输资源,整体上改善了抽取Java网络应用的效率。In this embodiment, after the upgrade package directory and the modified source program file are determined, the file name of the modified source program file is written into the file list with a relative path, and then the file path is assembled through the relative path, and then the file path is searched under the path. File with the same name, write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package. Compared with the prior art, this embodiment only records the relative file path of the modified source program file, obtains the file with the same name through the relative file path, copies the file with the same name under the upgrade package directory, and avoids introducing No source files have been modified, thereby compressing the "volume" of the upgrade package, saving storage resources and transmission resources, and improving the efficiency of extracting Java network applications as a whole.

上述实施例已能较好地实现本申请的发明目的,但在某些情况下,基于某些特殊的需要可以对上述实施例作进一步改进变形。比如,在将被修改的源程序文件的文件名以相对路径形式写入被修改源程序文件列表后,上述实施例还可以包括根据文件列表中的文件名验证这些文件是否存在的步骤,经过验证如果存在这些文件,则执行升级包的抽取等步骤,如果不存在则可以提示相关错误信息。验证过程可以采用Java的File.exists()函数(方法)判断被修改的源文件是否存在。参见图3,该图示出了上述实施例执行验证步骤的结果。The above-mentioned embodiments can better realize the purpose of the invention of the present application, but in some cases, the above-mentioned embodiments can be further improved and deformed based on some special needs. For example, after writing the file name of the modified source program file into the list of modified source program files in the form of a relative path, the above embodiment may also include the step of verifying whether these files exist according to the file name in the file list. If these files exist, steps such as extracting the upgrade package are performed, and if they do not exist, relevant error messages can be prompted. The verification process can use the File.exists() function (method) of Java to determine whether the modified source file exists. Referring to Fig. 3, this figure shows the result of the verification step performed by the above embodiment.

还比如,上述实施例在将同名文件写入到升级程序包目录下后,还可以统计升级包目录下的文件数量,以便审核对本次升级包的抽取是否成功,是否存在落下的文件。参见图4,该图示出了统计升级包目录文件后的示意图。For another example, after the above-mentioned embodiment writes the file with the same name into the upgrade package directory, it can also count the number of files in the upgrade package directory, so as to check whether the extraction of the upgrade package is successful and whether there are any missing files. Referring to FIG. 4 , this figure shows a schematic diagram after counting upgrade package directory files.

上述实施例在实际应用中,可能遇到被修改的源程序文件包含Java类文件,Java类文件编译后扩展名为.class,在这种情况下,如果编译后的内嵌类内具有同名文件,必须对该同名文件进行区分,否则将可能导致升级包的抽取错误。区分同名文件的方式很多,可以先设定的预设规则,在执行到该步骤后,由自动化信息处理设备按照预设规则自动进行同名区分,该规则可以是在类文件名后加数字、字母等字符,也可以是其他符号。In the actual application of the above-mentioned embodiment, it may be encountered that the modified source program file contains a Java class file, and the extension of the Java class file is .class after compilation. In this case, if the compiled embedded class has a file with the same name , the file with the same name must be distinguished, otherwise it may cause an error in extracting the upgrade package. There are many ways to distinguish files with the same name. Preset rules can be set first. After this step is executed, the automated information processing equipment will automatically distinguish files with the same name according to the preset rules. The rule can be to add numbers and letters after the class file name characters, or other symbols.

前述实施例详细叙述了本申请的抽取Java网络应用升级包的方法实施例,相应地,本申请还提供了抽取Java网络应用升级包的装置实施例。参见图4,该图示出了该实施例的组成框图。本装置实施例包括:目录文件确定单元401、文件名写入单元402、文件路径拼装单元403、同名文件查找单元404和同名文件写入单元405,其中:The aforementioned embodiments describe in detail the embodiment of the method for extracting the Java network application upgrade package of the present application, and accordingly, the present application also provides an embodiment of the device for extracting the Java network application upgrade package. Referring to Fig. 4, this figure shows a composition block diagram of this embodiment. This device embodiment comprises: directory file determination unit 401, file name writing unit 402, file path assembling unit 403, same-name file search unit 404 and same-name file writing unit 405, wherein:

目录文件确定单元401,用于确定升级包目录和实现Java网络应用升级被修改的源程序文件;The directory file determining unit 401 is used to determine the source program file of the upgraded package directory and realize the Java network application upgrade;

文件名写入单元402,用于将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;A file name writing unit 402, configured to write the file name of the modified source program file into the list of modified source program files in the form of a relative path;

文件路径拼装单元403,用于根据被修改的源程序文件的相对路径拼装出编译后的文件路径;The file path assembly unit 403 is used to assemble the compiled file path according to the relative path of the modified source program file;

同名文件查找单元404,用于查找编译后的文件路径下与被修改源程序文件同名的文件;A file with the same name search unit 404, used to search for files with the same name as the modified source program file under the compiled file path;

同名文件写入单元405,用于将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The file with the same name writing unit 405 is configured to write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package.

本装置实施例的工作过程是:目录文件确定单元401确定升级包目录和实现Java网络应用升级被修改的源程序文件后,由文件名写入单元402将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表,然后文件路径拼装单元403根据文件列表中被修改的源程序文件的相对路径拼装出编译后的文件路径,由同名文件查找单元404查找编译后的文件路径下与被修改源程序文件同名的文件;同名文件写入单元405将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The working process of this device embodiment is: after the directory file determination unit 401 determines the upgrade package directory and the modified source program file to realize Java network application upgrade, the file name of the modified source program file is written by the file name writing unit 402 as The relative path form is written into the modified source program file list, and then the file path assembly unit 403 assembles the compiled file path according to the relative path of the modified source program file in the file list, and the file with the same name search unit 404 searches for the compiled file path. A file with the same name as the modified source program file under the file path; the file with the same name writing unit 405 writes the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package.

本装置实施例在确定升级包目录和被修改的源程序文件后,将被修改的源程序文件的文件名以相对路径写入文件列表,然后通过相对路径拼装出文件路径,再在该路径下查找同名文件,将同名文件写入升级包目录实现Java网络应用升级包的抽取。与现有技术相比,本装置实施例仅记载被修改源程序文件的相对文件路径,通过该相对文件路径得到同名文件,将同名文件拷贝到升级包目录之下,避免了在编译测试过程中引入没有被修改的源文件,从而压缩了升级包的“体积”,节约了存储资源和传输资源,整体上改善了抽取Java网络应用的效率。In this device embodiment, after determining the upgrade package directory and the modified source program file, the file name of the modified source program file is written into the file list with a relative path, and then the file path is assembled through the relative path, and then the Find the file with the same name, and write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package. Compared with the prior art, this device embodiment only records the relative file path of the modified source program file, obtains the file with the same name through the relative file path, copies the file with the same name to the upgrade package directory, and avoids the The source files that have not been modified are introduced, thereby compressing the "volume" of the upgrade package, saving storage resources and transmission resources, and improving the efficiency of extracting Java network applications as a whole.

为了适应某些特殊需要,前述装置实施例可以增加某些相应的功能结构单元。比如,在将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表后,可以增加文件验证单元406,用于验证所述被修改的源程序文件是否存在,如果存在的情况下,才触发文件路径拼装单元,进而触发后续的功能单元,如果不存在,则可以提供错误报警。In order to meet some special needs, some corresponding functional structural units may be added to the aforementioned device embodiments. For example, after the file name of the modified source program file is written into the list of modified source program files in the form of a relative path, a file verification unit 406 can be added to verify whether the modified source program file exists, if If it exists, the file path assembly unit is triggered, and then the subsequent functional units are triggered. If it does not exist, an error alarm can be provided.

还比如,在将所述同名的文件写入所述升级包目录下之后,上述装置实施例可以增加文件数量统计单元407,用于统计升级包目录下的文件数量,以便根据统计结果审核本次升级包的抽取是否成功,是否存在落下的文件。还比如,在被修改的源程序文件包含Java类文件且编译后的内嵌类内具有同名文件的情况下,上述装置实施例还可以包括文件名区分单元408,用于在查找编译后的文件路径下与被修改源程序文件同名的文件之前,将Java类文件的文件名按照预设规则进行区分,这里的预设规则可以体现为多种具体形式,比如在类文件名后增加数字。Also for example, after the file with the same name is written into the upgrade package directory, the above-mentioned device embodiment may add a file quantity statistics unit 407 for counting the number of files in the upgrade package directory, so as to review the current update according to the statistical results. Whether the extraction of the upgrade package is successful, and whether there are any dropped files. Also for example, in the case that the modified source program file contains a Java class file and the compiled embedded class has a file with the same name, the above-mentioned device embodiment may also include a file name distinguishing unit 408, which is used to find the compiled file Before the file with the same name as the modified source program file under the path, the file name of the Java class file is distinguished according to the preset rules. The preset rules here can be embodied in various specific forms, such as adding numbers after the class file name.

为了叙述的简便,本说明书的不同实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例的各单元可以是或者也可以不是物理上分开的,既可以位于一个地方,或者也可以分布到多个网络环境下。在实际应用过程中,可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的,本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the sake of brevity, the different embodiments of this specification focus on the differences from other embodiments, and the same and similar parts of the various embodiments can be referred to each other. In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment. Each unit of the device embodiment described above may or may not be physically separated, and may be located in one place, or may be distributed in multiple network environments. During actual application, some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment, and those skilled in the art can understand and implement it without creative efforts.

以上所述仅是本申请的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above description is only the specific implementation of the present application. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present application, some improvements and modifications can also be made. It should be regarded as the protection scope of this application.

Claims (8)

1.一种抽取Java网络应用升级包的方法,其特征在于,该方法包括:1. A method for extracting a Java network application upgrade package, characterized in that the method comprises: 确定升级包目录和实现Java网络应用升级被修改的源程序文件;Determine the directory of the upgrade package and the modified source program files to realize the upgrade of the Java network application; 将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;Write the file name of the modified source program file to the list of modified source program files in the form of a relative path; 根据被修改的源程序文件的相对路径拼装出编译后的文件路径;Assemble the compiled file path according to the relative path of the modified source program file; 查找编译后的文件路径下与被修改源程序文件同名的文件;Find the file with the same name as the modified source program file under the compiled file path; 将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The file with the same name is written into the upgrade package directory to realize the extraction of the Java network application upgrade package. 2.根据权利要求1所述的方法,其特征在于,该方法还包括,在将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表后,所述方法还包括:验证所述被修改的源程序文件是否存在,如果存在,则执行文件路径拼装步骤。2. The method according to claim 1, further comprising: after writing the file name of the modified source program file into the list of modified source program files in the form of a relative path, the method further includes It includes: verifying whether the modified source program file exists, and if so, executing the file path assembling step. 3.根据权利要求1所述的方法,其特征在于,如果被修改的源程序文件包含Java类文件且编译后的内嵌类内具有同名文件,则在查找编译后的文件路径下与被修改源程序文件同名的文件之前,将Java类文件的文件名按照预设规则进行区别。3. method according to claim 1, it is characterized in that, if the source program file being modified comprises Java class file and has file with the same name in the built-in class after compiling, then under the file path after searching compiling and being modified Before files with the same name as source program files, the file names of Java class files are distinguished according to preset rules. 4.根据权利要求1至3中任何一项所述的方法,其特征在于,所述方法还包括:统计升级包目录下的文件的数量。4. The method according to any one of claims 1 to 3, further comprising: counting the number of files in the upgrade package directory. 5.一种抽取Java网络应用升级包的装置,其特征在于,该装置包括:目录文件确定单元、文件名写入单元、文件路径拼装单元、同名文件查找单元和同名文件写入单元,其中:5. A device for extracting a Java network application upgrade package, characterized in that the device comprises: directory file determination unit, file name writing unit, file path assembling unit, same-name file search unit and same-name file writing unit, wherein: 所述目录文件确定单元,用于确定升级包目录和实现Java网络应用升级被修改的源程序文件;The directory file determination unit is used to determine the upgrade package directory and realize the modified source program file of Java network application upgrade; 所述文件名写入单元,用于将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表;The file name writing unit is used to write the file name of the modified source program file into the list of modified source program files in the form of a relative path; 所述文件路径拼装单元,用于根据被修改的源程序文件的相对路径拼装出编译后的文件路径;The file path assembling unit is used to assemble the compiled file path according to the relative path of the modified source program file; 所述同名文件查找单元,用于查找编译后的文件路径下与被修改源程序文件同名的文件;The same-name file search unit is used to search for files with the same name as the modified source program file under the compiled file path; 所述同名文件写入单元,用于将所述同名的文件写入所述升级包目录下以实现Java网络应用升级包的抽取。The file writing unit with the same name is configured to write the file with the same name into the upgrade package directory to realize the extraction of the Java network application upgrade package. 6.根据权利要求5所述的装置,其特征在于,所述装置还包括文件验证单元,用于在将被修改的源程序文件的文件名以相对路径形式写入到被修改源程序文件列表后,验证所述被修改的源程序文件是否存在,如果存在,则触发文件路径拼装单元。6. The device according to claim 5, characterized in that, the device also includes a file verification unit for writing the file name of the source program file to be modified into the list of modified source program files in the form of a relative path Finally, verify whether the modified source program file exists, and if so, trigger the file path assembly unit. 7.根据权利要求5所述的装置,其特征在于,如果被修改的源程序文件包含Java类文件且编译后的内嵌类内具有同名文件,所述装置还包括文件名区分单元,用于在查找编译后的文件路径下与被修改源程序文件同名的文件之前,将Java类文件的文件名按照预设规则进行区分。7. The device according to claim 5, wherein if the modified source program file includes a Java class file and the compiled embedded class has a file with the same name, the device also includes a file name distinguishing unit for Before searching for a file with the same name as the modified source program file under the compiled file path, the file name of the Java class file is distinguished according to preset rules. 8.根据权利要求5至7中任何一项所述的装置,其特征在于,所述装置还包括文件数量统计单元,用于统计升级包目录下的文件的数量。8. The device according to any one of claims 5 to 7, characterized in that the device further comprises a file quantity counting unit for counting the number of files in the upgrade package directory.
CN201210546629.7A 2012-12-14 2012-12-14 A kind of method and device extracting Java network application AKU Active CN103019722B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210546629.7A CN103019722B (en) 2012-12-14 2012-12-14 A kind of method and device extracting Java network application AKU

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210546629.7A CN103019722B (en) 2012-12-14 2012-12-14 A kind of method and device extracting Java network application AKU

Publications (2)

Publication Number Publication Date
CN103019722A CN103019722A (en) 2013-04-03
CN103019722B true CN103019722B (en) 2016-03-30

Family

ID=47968360

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210546629.7A Active CN103019722B (en) 2012-12-14 2012-12-14 A kind of method and device extracting Java network application AKU

Country Status (1)

Country Link
CN (1) CN103019722B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105867953B (en) * 2015-01-21 2019-04-26 中国移动通信集团云南有限公司 Application upgrade package generation method, application upgrade method and corresponding device
CN104636172B (en) * 2015-03-09 2019-02-05 联想(北京)有限公司 A kind of application upgrade method and apparatus
CN105224317B (en) * 2015-09-14 2018-06-29 上海斐讯数据通信技术有限公司 A kind of APK is applied to the method and system in Android project source code
CN107291439B (en) * 2016-04-13 2020-06-16 阿里巴巴集团控股有限公司 Target incremental data construction method and device
CN106843855B (en) * 2016-12-29 2020-07-07 北京市天元网络技术股份有限公司 Method and device for packaging summarized files
CN107145351A (en) * 2017-05-02 2017-09-08 山东浪潮通软信息科技有限公司 A kind of method, device, computer-readable recording medium and storage control for changing Digital signature Java bag
CN113835717B (en) * 2020-06-23 2025-02-25 武汉斗鱼鱼乐网络科技有限公司 Installation package acquisition method, device, equipment and storage medium
CN113504931B (en) * 2021-07-29 2022-08-16 中国第一汽车股份有限公司 Controller testing method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984410A (en) * 2010-11-12 2011-03-09 中兴通讯股份有限公司 Method and device for generating and unloading software installation package
CN102541609A (en) * 2012-02-17 2012-07-04 北京星网锐捷网络技术有限公司 Installation program manufacturing method, device and network device
CN102799445A (en) * 2012-05-03 2012-11-28 陈昊 Application upgrading method based on Android platform and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984410A (en) * 2010-11-12 2011-03-09 中兴通讯股份有限公司 Method and device for generating and unloading software installation package
CN102541609A (en) * 2012-02-17 2012-07-04 北京星网锐捷网络技术有限公司 Installation program manufacturing method, device and network device
CN102799445A (en) * 2012-05-03 2012-11-28 陈昊 Application upgrading method based on Android platform and system

Also Published As

Publication number Publication date
CN103019722A (en) 2013-04-03

Similar Documents

Publication Publication Date Title
CN103019722B (en) A kind of method and device extracting Java network application AKU
CN108427646B (en) Android App automatic test framework construction method and device based on Apium
CN102819492B (en) Keyword driven automatic testing frame on basis of Android
US8839201B2 (en) Capturing test data associated with error conditions in software item testing
US10067858B2 (en) Cloud-based software testing
US9292416B2 (en) Software development kit testing
CN103744709B (en) patch loading method and device
US8839202B2 (en) Test environment managed within tests
US9684587B2 (en) Test creation with execution
US20100313185A1 (en) Access to test-ready virtual environments
CN102929600B (en) Monitoring system version recognition methods based on ELF
US9069902B2 (en) Software test automation
US8949794B2 (en) Binding a software item to a plain english control name
CN102799437B (en) A kind of compilation script automatic generation method and automatically generating device
WO2016196701A1 (en) Natural language engine for coding and debugging
CN109800005B (en) Client hot update method and device
US7827548B1 (en) Environment-neutral application build
US10387294B2 (en) Altering a test
CN106919612A (en) A kind of processing method and processing device of SQL script of reaching the standard grade
CN103970659A (en) Android application software automation testing method based on pile pitching technology
CN106681783A (en) Detection method and system for SVN code
CN108809755B (en) Automatic testing method and system for home gateway compatible with command line and WEB interface
CN106775602A (en) A code release method and device
CN105912460A (en) Software test method and system based on QTP
US20170371687A1 (en) Automated globalization enablement on development operations

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
CB03 Change of inventor or designer information

Inventor after: Chen Liang

Inventor after: Yan Chaoyuan

Inventor after: Yang Yanwen

Inventor after: Shen Han

Inventor before: Chen Liang

Inventor before: Yan Chaoyuan

COR Change of bibliographic data
CP01 Change in the name or title of a patent holder

Address after: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15

Co-patentee after: STATE GRID CORPORATION OF CHINA

Patentee after: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15

Co-patentee before: State Grid Corporation of China

Patentee before: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder
TR01 Transfer of patent right

Effective date of registration: 20190717

Address after: 100085 Building 32-3-4108-4109, Pioneer Road, Haidian District, Beijing

Co-patentee after: STATE GRID CORPORATION OF CHINA

Patentee after: BEIJING GUODIANTONG NETWORK TECHNOLOGY Co.,Ltd.

Address before: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15

Co-patentee before: State Grid Corporation of China

Patentee before: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right