Summary of the invention
For solving the problems of the technologies described above, the embodiment of the present application provides and a kind ofly extracts the method for Java network application AKU and the device of correspondence thereof, to reduce " volume " of AKU, save storage resources and transfer resource, thus improve the efficiency extracting Java network application on the whole.
The method of the extraction Java network application AKU that the embodiment of the present application provides comprises:
Determine AKU catalogue and realize Java network application to upgrade the source files of program be modified;
The filename of the source files of program be modified is written to relative path form and is modified source files of program list;
According to the relative path of the source files of program be modified assembled go out compiling after file path;
Search under the file path after compiling be modified source files of program file of the same name;
Described file of the same name is write under described AKU catalogue to realize the extraction of Java network application AKU.
Preferably, after the filename of the source files of program be modified be written to relative path form be modified source files of program list, described method also comprises: whether the source files of program be modified described in checking exists, if existed, then the assembled step in execute file path.
Preferably, if the source files of program be modified comprise java class file and compiling after embedded class in there is file of the same name, under file path then after searching compiling and before being modified source files of program file of the same name, the filename of java class file is distinguished according to preset rules.
Preferably, described method also comprises: the quantity of the file under statistics AKU catalogue.
The embodiment of the present application additionally provides a kind of device extracting Java network application AKU.This device comprises: catalogue file determining unit, filename writing unit, the assembled unit of file path, ff unit of the same name and File write unit of the same name, wherein:
Described catalogue file determining unit, to upgrade the source files of program be modified for determining AKU catalogue and realizing Java network application;
Described filename writing unit, is modified source files of program list for being written to relative path form by the filename of the source files of program be modified;
The assembled unit of described file path, for according to the relative path of source files of program be modified assembled go out file path after compiling;
Described ff unit of the same name, for search under the file path after compiling be modified source files of program file of the same name;
Described File write unit of the same name, for writing described file of the same name under described AKU catalogue to realize the extraction of Java network application AKU.
Preferably, described device also comprises file verification unit, and for after being written to relative path form by the filename of the source files of program be modified and being modified source files of program list, whether the source files of program be modified described in checking exists, if existed, then the assembled unit in trigger file path.
Preferably, if the source files of program be modified comprise java class file and compiling after embedded class in there is file of the same name, described device also comprises file name area subdivision, for under the file path after searching compiling and before being modified source files of program file of the same name, the filename of java class file is distinguished according to preset rules.
Preferably, described device also comprises quantity of documents statistic unit, for adding up the quantity of the file under AKU catalogue.
The embodiment of the present application is after determining AKU catalogue and the source files of program that is modified, by the filename of source files of program that is modified with the list of relative path writing in files, then by relative path assembled go out file path, under this path, search file of the same name again, file write AKU catalogue of the same name is realized the extraction of Java network application AKU.Compared with prior art, the embodiment of the present application only records the relative file path being modified source files of program, file of the same name is obtained by this relative file path, under file copy of the same name to AKU catalogue, avoid the source file introduced in compiler test process and be not modified, thus have compressed " volume " of AKU, save storage resources and transfer resource, improve the efficiency extracting Java network application on the whole.
Embodiment
Technical scheme in the application is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
See Fig. 1, the figure shows the flow process of the embodiment of the method for the extraction Java network application AKU of the application.This embodiment comprises:
Step S101: determine AKU catalogue and realize Java network application to upgrade the source files of program be modified;
AKU catalogue is for placing the program file needing to upgrade upgrading, this catalogue should be pre-determined in extraction Java network application AKU, it should be noted that " upgrading " of the present embodiment indication not only comprises the edition upgrading (namely releasing the Java network application of a new generation) of Java network application, and comprise the leak of Java network application or the supplementary and perfect of defect; The source files of program be modified realizes Java network application to upgrade perfect program code, and namely make AKU is these program codes of compiling.Determine that AKU catalogue is a lot of with the mode being modified source files of program, both artificial setting can be adopted, also can be configured according to preset rules by automation equipment, such as, the source files of program configuring AKU catalogue by special configuration file config.xml and be modified.In some cases, if project source program catalogue changes, also need according to actual conditions configuration project source program catalogue.By configuration file configuration project source program catalogue, AKU catalogue and the exemplary program code of source file that is modified as:
This program segment project source program catalogue is configured to D: ProgramFiles SoTowerStudio1.5.1_07 eclipse workspace jjjc, AKU catalogue is configured to E: a, setting is modified source files of program list readme.txt and records the source files of program be modified, and realizes recording with txt file form.
Step S102: the filename of the source files of program be modified is written to relative path form and is modified source files of program list;
After determining AKU catalogue and the source files of program that is modified, the filename of the source files of program be modified is written to relative path form and is modified source files of program list, here " relative path ", for absolute path, the root directory of " relative path " is determined by the root directory of Java network application.The source files of program that is modified that normal conditions relate in Java network application escalation process comprises multiple, and for this reason, the present embodiment arranges one and is modified source files of program list to record the path of this multiple file.See following code segment, this code segment is written with two source files of program to being modified listed files readme.txt, be respectively TaskInfoStub.java, main.jsp, it should be noted that: filename here should be the full name of file determined according to technical know-how belonging to this area, i.e. include file real name (file name) part, also include file extension name, the source files of program with expansion name just can be identified:
src\com\portal\task\shandong\TaskInfoStub.java/
WebContent\jjjc\lzjs\main.jsp
Step S103: according to the relative path of the source files of program be modified assembled go out compiling after file path;
Namely file path after compiling is absolute path, this absolute path is determined by the relative path of the program file be modified and project source program catalogue (project development catalogue), normal conditions, project source program catalogue can adopt the catalogue of acquiescence, like this can directly according to the project source program catalogue of relative path and acquiescence is assembled go out to compile after file path.But in some cases, project source program catalogue changes, at this moment install beforehand project source program catalogue, project development catalogue as shown in the previous example: D: ProgramFiles SoTowerStudio1.5.1_07 eclipse workspace jjjc.When the source files of program be modified relative path for " src com portal task shandong TaskInfoStub.java " time, the absolute path after assembled is: " D: ProgramFiles SoTowerStudio1.5.1_07 eclipse workspace jjjc src com portal task shandong TaskInfoStub.java ".
Step S104: search under the file path after compiling be modified source files of program file of the same name;
Step S105: described file of the same name is write under described AKU catalogue to realize the extraction of Java network application AKU;
After finding file of the same name by abovementioned steps, illustrate that this file is the file needing to upgrade upgrading, under being written into AKU target directory, thus realize the extraction of Java network application AKU.Specifically the function (method) fileCopyToSourceFile () of Java can be adopted to realize file write AKU catalogue of the same name.For the aforementioned AKU catalogue mentioned, file of the same name is written to the effect after under AKU catalogue as shown in Figure 2: under E: a, comprise an another file, one is src file, and one is WebContent file.
The present embodiment is after determining AKU catalogue and the source files of program that is modified, by the filename of source files of program that is modified with the list of relative path writing in files, then by relative path assembled go out file path, under this path, search file of the same name again, file write AKU catalogue of the same name is realized the extraction of Java network application AKU.Compared with prior art, the present embodiment only records the relative file path being modified source files of program, file of the same name is obtained by this relative file path, under file copy of the same name to AKU catalogue, avoid the source file introduced in compiler test process and be not modified, thus have compressed " volume " of AKU, save storage resources and transfer resource, improve the efficiency extracting Java network application on the whole.
Above-described embodiment can realize the goal of the invention of the application preferably, but in some cases, can be further improved distortion based on some special needs to above-described embodiment.Such as, after the filename of the source files of program be modified is modified source files of program list with the write of relative path form, above-described embodiment can also comprise the step whether existed according to these files of the file name verification in listed files, if there is these files through checking, then perform the steps such as the extraction of AKU, if there is no then can point out relevant error information.Proof procedure can adopt the File.exists () function (method) of Java to judge whether the source file be modified exists.See Fig. 3, the figure shows the result that above-described embodiment performs verification step.
Also such as, above-described embodiment, being written to by file of the same name after under ROMPaq bag catalogue, can also add up the quantity of documents under AKU catalogue, whether successfully to audit the extraction of this AKU, whether there is the file fallen.See Fig. 4, the figure shows the schematic diagram after statistics AKU catalogue file.
Above-described embodiment in actual applications, the source files of program be modified may be run into and comprise java class file, expansion .class by name after the compiling of java class file, in this case, if there is file of the same name in the embedded class after compiling, must distinguish this file of the same name, otherwise the extraction mistake of AKU may be caused.The mode distinguishing file of the same name is a lot, the preset rules that can first set, after execution to this step, carries out differentiation of the same name by automated information treatment facility according to preset rules automatically, this rule can be add the character such as numeral, letter after class file name, also can be other symbols.
Previous embodiment has described the embodiment of the method for the extraction Java network application AKU of the application in detail, correspondingly, present invention also provides the device embodiment extracting Java network application AKU.See Fig. 4, the figure shows the composition frame chart of this embodiment.This device embodiment comprises: catalogue file determining unit 401, filename writing unit 402, the assembled unit of file path 403, ff unit 404 of the same name and File write unit of the same name 405, wherein:
Catalogue file determining unit 401, to upgrade the source files of program be modified for determining AKU catalogue and realizing Java network application;
Filename writing unit 402, is modified source files of program list for being written to relative path form by the filename of the source files of program be modified;
The assembled unit 403 of file path, for according to the relative path of source files of program be modified assembled go out file path after compiling;
Ff unit 404 of the same name, for search under the file path after compiling be modified source files of program file of the same name;
File write unit 405 of the same name, for writing described file of the same name under described AKU catalogue to realize the extraction of Java network application AKU.
The course of work of this device embodiment is: catalogue file determining unit 401 is determined AKU catalogue and realize Java network application to upgrade after the source files of program that is modified, by filename writing unit 402 filename of the source files of program be modified is written to relative path form and is modified source files of program list, then the assembled unit of file path 403 according to the relative path of the source files of program be modified in listed files assembled go out compiling after file path, by ff unit 404 of the same name search under the file path after compiling be modified source files of program file of the same name, described file of the same name writes under described AKU catalogue to realize the extraction of Java network application AKU by File write unit 405 of the same name.
This device embodiment is after determining AKU catalogue and the source files of program that is modified, by the filename of source files of program that is modified with the list of relative path writing in files, then by relative path assembled go out file path, under this path, search file of the same name again, file write AKU catalogue of the same name is realized the extraction of Java network application AKU.Compared with prior art, this device embodiment only records the relative file path being modified source files of program, file of the same name is obtained by this relative file path, under file copy of the same name to AKU catalogue, avoid the source file introduced in compiler test process and be not modified, thus have compressed " volume " of AKU, save storage resources and transfer resource, improve the efficiency extracting Java network application on the whole.
In order to adapt to some special requirement, aforementioned means embodiment can increase some corresponding functional architecture unit.Such as, after the filename of the source files of program be modified be written to relative path form be modified source files of program list, file verification unit 406 can be increased, whether the source files of program for being modified described in verifying exists, if deposit in case, the just assembled unit in trigger file path, and then the functional unit of triggering following, if there is no, then false alarm can be provided.
Also such as, after described file of the same name is write under described AKU catalogue, said apparatus embodiment can increase quantity of documents statistic unit 407, for adding up the quantity of documents under AKU catalogue, so that whether the extraction auditing this AKU according to statistics is successful, whether there is the file fallen.Also such as, when there is file of the same name in the embedded class after the source files of program be modified comprises java class file and compiles, said apparatus embodiment can also comprise file name area subdivision 408, for under the file path after searching compiling and before being modified source files of program file of the same name, the filename of java class file is distinguished according to preset rules, here preset rules can be presented as multiple concrete form, such as after class file name, increases numeral.
Easy in order to what describe, what the different embodiments of this instructions stressed is all the difference with other embodiments, between each embodiment identical similar part mutually see.Especially, for device embodiment, because it is substantially similar to embodiment of the method, so describe fairly simple, relevant part illustrates see the part of embodiment of the method.Each unit of device embodiment described above or can may not be and physically separates, and both can be positioned at a place, or under also can being distributed to multiple network environment.In actual application, some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme, and those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
The above is only the embodiment of the application; it should be pointed out that for those skilled in the art, under the prerequisite not departing from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the protection domain of the application.