You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(111) |
Jul
(258) |
Aug
(21) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <cry...@us...> - 2002-07-29 02:58:42
|
Update of /cvsroot/cdchamber/CDChamber/script In directory usw-pr-cvs1:/tmp/cvs-serv22836 Modified Files: continuousintegrate.sh Log Message: delete cdchamber.xsd if cvs update occurs, then castor and ajc will regenerate everything from scratch Index: continuousintegrate.sh =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/script/continuousintegrate.sh,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** continuousintegrate.sh 3 Jul 2002 09:38:05 -0000 1.6 --- continuousintegrate.sh 29 Jul 2002 02:58:38 -0000 1.7 *************** *** 12,15 **** --- 12,17 ---- then >${BUILD_DIR}/log/build.log + # delete one original files to make castor_gen and ajc_gen regenerate + rm -f $BUILD_DIR/CDChamber/src/cdchamber.xsd #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file |
From: <sim...@us...> - 2002-07-29 02:47:22
|
Update of /cvsroot/cdchamber/CDChamber/test/testcase In directory usw-pr-cvs1:/tmp/cvs-serv20846 Modified Files: testcase.jar testcase.zip Log Message: Let the testcase.jar and zip contains the files should be ignore. So that we can test the filefilters. Index: testcase.jar =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/testcase/testcase.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsARCirq and /tmp/cvsUXzzEG differ Index: testcase.zip =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/testcase/testcase.zip,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsxt3bIp and /tmp/cvsmPkjjF differ |
From: <sim...@us...> - 2002-07-29 02:43:35
|
Update of /cvsroot/cdchamber/CDChamber/test/testcase In directory usw-pr-cvs1:/tmp/cvs-serv20188/test/testcase Added Files: nullFile.bak nullFile.ignore~ Log Message: Add more file filters. --- NEW FILE: nullFile.bak --- --- NEW FILE: nullFile.ignore~ --- |
From: <sim...@us...> - 2002-07-29 02:43:35
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv20188/aspect/gen/org/cdchamber/elements Modified Files: FileFilters.java Added Files: BakFileFilter.java SwungDashFileFilter.java Log Message: Add more file filters. --- NEW FILE: BakFileFilter.java --- /* * User: Simon * $Id: BakFileFilter.java,v 1.1 2002/07/29 02:43:32 simon_lei Exp $ */ package org.cdchamber.elements; import java.io.File; public class BakFileFilter implements IFileFilter { public boolean accept(File file) { return accept( file.isDirectory(), file.getName()); } public boolean accept(boolean isDirectory, String fileName) { if ( isDirectory) return true; if ( fileName.toLowerCase().endsWith(".bak")) return false; return true; } } --- NEW FILE: SwungDashFileFilter.java --- /* * User: Simon * $Id: SwungDashFileFilter.java,v 1.1 2002/07/29 02:43:32 simon_lei Exp $ */ package org.cdchamber.elements; import java.io.File; public class SwungDashFileFilter implements IFileFilter { public boolean accept(File file) { return accept( file.isDirectory(), file.getName()); } public boolean accept(boolean isDirectory, String fileName) { if ( isDirectory) return true; if ( fileName.endsWith("~")) return false; return true; } } Index: FileFilters.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/FileFilters.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileFilters.java 27 Jul 2002 07:55:05 -0000 1.3 --- FileFilters.java 29 Jul 2002 02:43:32 -0000 1.4 *************** *** 13,16 **** --- 13,18 ---- static { addFilter( new CVSFileFilter()); + addFilter( new BakFileFilter()); + addFilter( new SwungDashFileFilter()); } public static synchronized void addFilter( IFileFilter filter) { |
From: <sim...@us...> - 2002-07-29 02:28:13
|
Update of /cvsroot/cdchamber/CDChamber/test/testcase In directory usw-pr-cvs1:/tmp/cvs-serv17528/test/testcase Added Files: testcase.zip Log Message: Add the testcase zip file. --- NEW FILE: testcase.zip --- (This appears to be a binary file; contents omitted.) |
From: <cry...@us...> - 2002-07-29 02:22:11
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv16607 Modified Files: build.xml Log Message: add classpath to ajc_gen Index: build.xml =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/build.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** build.xml 22 Jul 2002 08:32:46 -0000 1.30 --- build.xml 29 Jul 2002 02:22:08 -0000 1.31 *************** *** 82,85 **** --- 82,88 ---- <target name="ajc_gen" depends="castor_gen" unless="ajc_gen.notRequired"> <ajc preprocess="yes" workingdir="${src.dir}" nocomments="yes"> + <classpath> + <path refid="classpath" /> + </classpath> <src> <pathelement path="${aspect.gen}"/> |
From: <sim...@us...> - 2002-07-28 13:58:38
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv3242/test/src/org/cdchamber/elements Modified Files: JarEntryParserTest.java Log Message: Add testcase to EntryParser. Should add the testcases to acceptance test. Index: JarEntryParserTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements/JarEntryParserTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JarEntryParserTest.java 28 Jul 2002 13:41:27 -0000 1.3 --- JarEntryParserTest.java 28 Jul 2002 13:58:35 -0000 1.4 *************** *** 8,14 **** --- 8,18 ---- import java.util.jar.JarFile; + import java.io.FileWriter; + import java.io.FileReader; import org.cdchamber.util.DirPath; + import org.cdchamber.util.testtools.FileComparator; import org.cdchamber.elements.EntryParser; + import org.cdchamber.elements.DirectoryType; public class JarEntryParserTest extends TestCase { *************** *** 26,30 **** } ! public void testParser() throws Exception { JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); --- 30,34 ---- } ! public void testJarParser() throws Exception { JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); *************** *** 32,36 **** --- 36,61 ---- parser.parseEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); + /* + dir.marshal( new FileWriter( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar.xml")); + FileComparator.diff( + new FileReader( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar.xml"), + new FileReader( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar.result.xml") + ); + */ } + public void testZipParser() throws Exception { + JarFile zipFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.zip"); + DirectoryType dir = new DirectoryType(); + EntryParser parser = new EntryParser( dir, EntryWrapper.getEntryWrapper(zipFile)); + parser.parseEntries(); + assertEquals( "Should have 3 filetypes", 3, dir.getFilesCount()); + /* + dir.marshal( new FileWriter( DirPath.TestCaseDir + DirPath.SEP + "testcase.zip.xml")); + FileComparator.diff( + new FileReader( DirPath.TestCaseDir + DirPath.SEP + "testcase.zip.xml"), + new FileReader( DirPath.TestCaseDir + DirPath.SEP + "testcase.zip.result.xml") + ); + */ + } } |
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv29478/aspect/gen/org/cdchamber/elements Modified Files: CompressedFileTypeWrapper.java Added Files: EntryParser.java EntryWrapper.java Removed Files: ZipEntryParser.java Log Message: Solve the chinese problem. --- NEW FILE: EntryParser.java --- /* * User: Simon * $Id: EntryParser.java,v 1.1 2002/07/28 13:41:27 simon_lei Exp $ */ package org.cdchamber.elements; import java.util.*; import java.io.IOException; public class EntryParser { private DirectoryType root; private Hashtable nodes = new Hashtable(); EntryWrapper entryWrapper; public EntryParser( DirectoryType root, EntryWrapper entryWrapper) { this.root = root; this.entryWrapper = entryWrapper; } public void close() throws IOException { entryWrapper.close(); } public void parseEntries() { while ( entryWrapper.hasMoreElements()) { entryWrapper.nextElement(); String entryName = entryWrapper.getName(); //System.out.println( entryName ); // Get the directory part if there is one String dir = null; // Get the position of the last '/' int cutIndex = entryName.lastIndexOf('/'); if (cutIndex != -1) { dir = entryName.substring(0, cutIndex); // Separate the file part entryName = entryName.substring(cutIndex + 1); } if (!entryName.equals("")) { FileType node = new FileType(); setFileBasicInfo(node, entryName); // This is not a directory entry, e.g. a class DirectoryType lastParent = getLastParent(dir, node.getSize()); if ( lastParent == null) continue; // judge the file if ( !FileFilters.accept(false, entryName)) continue; // Add the entry to the directory node lastParent.addFiles(node); } else { DirectoryType dirType = (DirectoryType)nodes.get( dir); if ( dirType == null) { dirType = new DirectoryType(); dirType.setDate( entryWrapper.getTime()); entryName = dir; String newDir = null; cutIndex = dir.lastIndexOf( '/'); if (cutIndex != -1) { newDir = dir.substring(0, cutIndex); entryName = dir.substring(cutIndex + 1); } if ( !FileFilters.accept( true, entryName)) continue; dirType.setName( entryName); DirectoryType parent = getLastParent( newDir, dirType.getSize()); if ( parent == null) continue; nodes.put( dir, dirType); parent.addFiles( dirType); } else dirType.setDate( entryWrapper.getTime()); } } } private void setFileBasicInfo(FileType node, String entryName) { node.setName( entryName); node.setSize( entryWrapper.getSize()); node.setDate( entryWrapper.getTime()); } private DirectoryType getLastParent(String dir, long size) { DirectoryType parent = null; DirectoryType lastParent = root; if (dir == null) parent = lastParent; else { StringTokenizer tokenizer = new StringTokenizer(dir, "/"); String dirpath = ""; while (tokenizer.hasMoreTokens()) { String dirName = tokenizer.nextToken(); //judge the dir if ( !FileFilters.accept( true, dirName)) return null; dirpath += dirName; parent = (DirectoryType) nodes.get(dirpath); // Is the directory in our hash table already? if (parent == null) { parent = new DirectoryType(); parent.setName( dirName); //setFileBasicInfo( parent, dirName, zipFile.getEntry( dirpath)); lastParent.addFiles(parent); nodes.put(dirpath, parent); } parent.setSize( parent.getSize() + size); lastParent = parent; dirpath += "/"; } } return lastParent; } public static void main( String[] args) throws Exception { /* DirectoryType dir = new DirectoryType(); JarFile jarFile = new JarFile( "D:/work/CDChamber/test/testcase/testcase.jar"); EntryParser parse = new EntryParser( dir, jarFile); parse.parseEntries(); dir.marshal( new FileWriter( "D:/work/CDChamber/data/a.xml")); */ } } --- NEW FILE: EntryWrapper.java --- /* * User: Simon * $Id: EntryWrapper.java,v 1.1 2002/07/28 13:41:27 simon_lei Exp $ */ package org.cdchamber.elements; import net.sf.jazzlib.ZipFile; import net.sf.jazzlib.ZipEntry; import java.util.jar.JarFile; import java.util.jar.JarEntry; import java.util.Enumeration; import java.io.IOException; public abstract class EntryWrapper { public static EntryWrapper getEntryWrapper( Object obj) { if ( obj instanceof JarFile ) { return new JarFileWrapper( (JarFile)obj); } return new ZipFileWrapper( (ZipFile)obj); } public abstract void close() throws IOException; public abstract void nextElement(); public abstract boolean hasMoreElements(); public abstract String getName(); public abstract long getSize(); public abstract long getTime(); } class ZipFileWrapper extends EntryWrapper { private ZipFile zipFile; private Enumeration enu; private ZipEntry entry; public ZipFileWrapper( ZipFile zipFile) { this.zipFile = zipFile; enu = zipFile.entries(); } public void close() throws IOException { zipFile.close(); } public String getName() { return entry.getName(); } public long getSize() { return entry.getSize(); } public long getTime() { return entry.getTime(); } public boolean hasMoreElements() { return enu.hasMoreElements(); } public void nextElement() { entry = (ZipEntry)enu.nextElement(); } } class JarFileWrapper extends EntryWrapper { private JarFile jarFile; private Enumeration enu; private JarEntry entry; public JarFileWrapper( JarFile jarFile) { this.jarFile = jarFile; enu = jarFile.entries(); } public void close() throws IOException { jarFile.close(); } public String getName() { return entry.getName(); } public long getSize() { return entry.getSize(); } public long getTime() { return entry.getTime(); } public boolean hasMoreElements() { return enu.hasMoreElements(); } public void nextElement() { entry = (JarEntry)enu.nextElement(); } } Index: CompressedFileTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileTypeWrapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CompressedFileTypeWrapper.java 28 Jul 2002 06:26:49 -0000 1.4 --- CompressedFileTypeWrapper.java 28 Jul 2002 13:41:27 -0000 1.5 *************** *** 12,16 **** import java.io.IOException; import java.io.File; ! import java.util.zip.ZipFile; public aspect CompressedFileTypeWrapper{ --- 12,17 ---- import java.io.IOException; import java.io.File; ! import net.sf.jazzlib.ZipFile; ! import net.sf.jazzlib.ZipEntry; public aspect CompressedFileTypeWrapper{ *************** *** 26,36 **** setBasicInfo( file); ! ZipFile zipFile; ! if ( fileName.endsWith(".jar")) zipFile = new JarFile( fileName); ! else zipFile = new ZipFile( fileName); ! ZipEntryParser jarParser= new ZipEntryParser(this, zipFile); ! jarParser.parseEntries(); ! zipFile.close(); } catch (IOException e) { throw new FileParseException( "Can't parse jar file"); --- 27,37 ---- setBasicInfo( file); ! EntryWrapper entryWrapper; ! if ( fileName.endsWith(".jar")) entryWrapper = EntryWrapper.getEntryWrapper(new JarFile( fileName)); ! else entryWrapper = EntryWrapper.getEntryWrapper(new ZipFile( fileName)); ! EntryParser entryParser= new EntryParser(this, entryWrapper); ! entryParser.parseEntries(); ! entryParser.close(); } catch (IOException e) { throw new FileParseException( "Can't parse jar file"); --- ZipEntryParser.java DELETED --- |
From: <sim...@us...> - 2002-07-28 13:41:33
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv29478 Modified Files: TODO.txt Log Message: Solve the chinese problem. Index: TODO.txt =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/TODO.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TODO.txt 27 Jul 2002 07:55:05 -0000 1.12 --- TODO.txt 28 Jul 2002 13:41:27 -0000 1.13 *************** *** 9,13 **** x : write FileType testcases x : Add GUI Testcases + : Add filter to ignore files/dirs like CVS, *.bak, *~, etc. + : GUI codes need refactored. - + : Solve the chinese problem of Jar files. \ No newline at end of file --- 9,13 ---- x : write FileType testcases x : Add GUI Testcases + x : Solve the chinese problem of Jar files. + : Add filter to ignore files/dirs like CVS, *.bak, *~, etc. + : GUI codes need refactored. |
From: <sim...@us...> - 2002-07-28 13:41:33
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv29478/test/src/org/cdchamber/elements Modified Files: JarEntryParserTest.java Log Message: Solve the chinese problem. Index: JarEntryParserTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements/JarEntryParserTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JarEntryParserTest.java 28 Jul 2002 06:26:49 -0000 1.2 --- JarEntryParserTest.java 28 Jul 2002 13:41:27 -0000 1.3 *************** *** 10,14 **** import org.cdchamber.util.DirPath; ! import org.cdchamber.elements.ZipEntryParser; public class JarEntryParserTest extends TestCase { --- 10,14 ---- import org.cdchamber.util.DirPath; ! import org.cdchamber.elements.EntryParser; public class JarEntryParserTest extends TestCase { *************** *** 29,33 **** JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); ! ZipEntryParser parser = new ZipEntryParser( dir, jarFile); parser.parseEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); --- 29,33 ---- JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); ! EntryParser parser = new EntryParser( dir, EntryWrapper.getEntryWrapper(jarFile)); parser.parseEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); |
From: <sim...@us...> - 2002-07-28 13:41:33
|
Update of /cvsroot/cdchamber/CDChamber/lib In directory usw-pr-cvs1:/tmp/cvs-serv29478/lib Added Files: jazzlib0.04.jar Log Message: Solve the chinese problem. --- NEW FILE: jazzlib0.04.jar --- (This appears to be a binary file; contents omitted.) |
From: <sim...@us...> - 2002-07-28 06:26:52
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv16243/aspect/gen/org/cdchamber/elements Modified Files: CompressedFileTypeWrapper.java Added Files: ZipEntryParser.java Removed Files: JarEntryParser.java Log Message: Refactoring ZipEntryParser's name --- NEW FILE: ZipEntryParser.java --- /* * User: Simon * $Id: ZipEntryParser.java,v 1.1 2002/07/28 06:26:49 simon_lei Exp $ */ package org.cdchamber.elements; import java.util.*; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.io.FileWriter; import java.io.UnsupportedEncodingException; public class ZipEntryParser { private DirectoryType root; private ZipFile zipFile; private Hashtable nodes = new Hashtable(); public ZipEntryParser( DirectoryType root, ZipFile zipFile) { this.root = root; this.zipFile = zipFile; } public void parseEntries() { Enumeration enu = zipFile.entries(); while (enu.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry) enu.nextElement(); String entryName = zipEntry.getName(); //System.out.println( entryName ); // Get the directory part if there is one String dir = null; // Get the position of the last '/' int cutIndex = entryName.lastIndexOf('/'); if (cutIndex != -1) { dir = entryName.substring(0, cutIndex); // Separate the file part entryName = entryName.substring(cutIndex + 1); } if (!entryName.equals("")) { FileType node = new FileType(); setFileBasicInfo(node, entryName, zipEntry); // This is not a directory entry, e.g. a class DirectoryType lastParent = getLastParent(dir, node.getSize()); if ( lastParent == null) continue; // judge the file if ( !FileFilters.accept(false, entryName)) continue; // Add the entry to the directory node lastParent.addFiles(node); } else { DirectoryType dirType = (DirectoryType)nodes.get( dir); if ( dirType == null) { dirType = new DirectoryType(); dirType.setDate( zipEntry.getTime()); entryName = dir; String newDir = null; cutIndex = dir.lastIndexOf( '/'); if (cutIndex != -1) { newDir = dir.substring(0, cutIndex); entryName = dir.substring(cutIndex + 1); } if ( !FileFilters.accept( true, entryName)) continue; dirType.setName( convert(entryName)); DirectoryType parent = getLastParent( newDir, dirType.getSize()); if ( parent == null) continue; nodes.put( dir, dirType); parent.addFiles( dirType); } else dirType.setDate( zipEntry.getTime()); } } } private String convert( String str) { try { return new String( str.getBytes(), "GB2312"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return str; } } private void setFileBasicInfo(FileType node, String entryName, ZipEntry zipEntry) { node.setName( convert(entryName)); node.setSize( zipEntry.getSize()); node.setDate( zipEntry.getTime()); } private DirectoryType getLastParent(String dir, long size) { DirectoryType parent = null; DirectoryType lastParent = root; if (dir == null) parent = lastParent; else { StringTokenizer tokenizer = new StringTokenizer(dir, "/"); String dirpath = ""; while (tokenizer.hasMoreTokens()) { String dirName = tokenizer.nextToken(); //judge the dir if ( !FileFilters.accept( true, dirName)) return null; dirpath += dirName; parent = (DirectoryType) nodes.get(dirpath); // Is the directory in our hash table already? if (parent == null) { parent = new DirectoryType(); parent.setName( convert(dirName)); //setFileBasicInfo( parent, dirName, zipFile.getEntry( dirpath)); lastParent.addFiles(parent); nodes.put(dirpath, parent); } parent.setSize( parent.getSize() + size); lastParent = parent; dirpath += "/"; } } return lastParent; } public static void main( String[] args) throws Exception { DirectoryType dir = new DirectoryType(); JarFile jarFile = new JarFile( "D:/work/CDChamber/test/testcase/testcase.jar"); ZipEntryParser parse = new ZipEntryParser( dir, jarFile); parse.parseEntries(); dir.marshal( new FileWriter( "D:/work/CDChamber/data/a.xml")); } } Index: CompressedFileTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileTypeWrapper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CompressedFileTypeWrapper.java 28 Jul 2002 06:17:46 -0000 1.3 --- CompressedFileTypeWrapper.java 28 Jul 2002 06:26:49 -0000 1.4 *************** *** 29,34 **** if ( fileName.endsWith(".jar")) zipFile = new JarFile( fileName); else zipFile = new ZipFile( fileName); ! JarEntryParser jarParser= new JarEntryParser(this, zipFile); ! jarParser.parseJarEntries(); zipFile.close(); --- 29,34 ---- if ( fileName.endsWith(".jar")) zipFile = new JarFile( fileName); else zipFile = new ZipFile( fileName); ! ZipEntryParser jarParser= new ZipEntryParser(this, zipFile); ! jarParser.parseEntries(); zipFile.close(); --- JarEntryParser.java DELETED --- |
From: <sim...@us...> - 2002-07-28 06:26:52
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv16243/test/src/org/cdchamber/elements Modified Files: JarEntryParserTest.java Log Message: Refactoring ZipEntryParser's name Index: JarEntryParserTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements/JarEntryParserTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JarEntryParserTest.java 27 Jul 2002 07:55:05 -0000 1.1 --- JarEntryParserTest.java 28 Jul 2002 06:26:49 -0000 1.2 *************** *** 10,14 **** import org.cdchamber.util.DirPath; ! import org.cdchamber.elements.JarEntryParser; public class JarEntryParserTest extends TestCase { --- 10,14 ---- import org.cdchamber.util.DirPath; ! import org.cdchamber.elements.ZipEntryParser; public class JarEntryParserTest extends TestCase { *************** *** 29,34 **** JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); ! JarEntryParser parser = new JarEntryParser( dir, jarFile); ! parser.parseJarEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); } --- 29,34 ---- JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); ! ZipEntryParser parser = new ZipEntryParser( dir, jarFile); ! parser.parseEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); } |
From: <sim...@us...> - 2002-07-28 06:17:50
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv14742/aspect/gen/org/cdchamber/elements Modified Files: CompressedFileTypeWrapper.java JarEntryParser.java Log Message: Bug Fix. The chinese problem still can't solve for zip file. Index: CompressedFileTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileTypeWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CompressedFileTypeWrapper.java 27 Jul 2002 07:55:05 -0000 1.2 --- CompressedFileTypeWrapper.java 28 Jul 2002 06:17:46 -0000 1.3 *************** *** 12,15 **** --- 12,16 ---- import java.io.IOException; import java.io.File; + import java.util.zip.ZipFile; public aspect CompressedFileTypeWrapper{ *************** *** 25,46 **** setBasicInfo( file); ! JarFile jarFile = new JarFile( fileName); ! JarEntryParser jarParser= new JarEntryParser(this, jarFile); jarParser.parseJarEntries(); - /* - while (enu.hasMoreElements()) { - JarEntry jarEntry = (JarEntry) enu.nextElement(); - - if ( !FileFilters.accept( jarEntry.isDirectory(), jarEntry.getName())) continue; - - FileType fileType = new FileType(); - fileType.setName( jarEntry.getName()); - fileType.setDate( jarEntry.getTime()); - fileType.setSize( jarEntry.getSize()); ! addFiles( fileType); ! } ! */ } catch (IOException e) { } --- 26,38 ---- setBasicInfo( file); ! ZipFile zipFile; ! if ( fileName.endsWith(".jar")) zipFile = new JarFile( fileName); ! else zipFile = new ZipFile( fileName); ! JarEntryParser jarParser= new JarEntryParser(this, zipFile); jarParser.parseJarEntries(); ! zipFile.close(); } catch (IOException e) { + throw new FileParseException( "Can't parse jar file"); } Index: JarEntryParser.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/JarEntryParser.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JarEntryParser.java 27 Jul 2002 07:55:05 -0000 1.1 --- JarEntryParser.java 28 Jul 2002 06:17:46 -0000 1.2 *************** *** 6,12 **** import java.util.*; - import java.util.zip.ZipEntry; - import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.io.FileWriter; import java.io.UnsupportedEncodingException; --- 6,12 ---- import java.util.*; import java.util.jar.JarFile; + import java.util.zip.ZipEntry; + import java.util.zip.ZipFile; import java.io.FileWriter; import java.io.UnsupportedEncodingException; *************** *** 15,32 **** private DirectoryType root; ! private JarFile jarFile; private Hashtable nodes = new Hashtable(); ! public JarEntryParser( DirectoryType root, JarFile jarFile) { this.root = root; ! this.jarFile = jarFile; } public void parseJarEntries() { ! Enumeration enu = jarFile.entries(); while (enu.hasMoreElements()) { ! JarEntry jarEntry = (JarEntry) enu.nextElement(); ! String entryName = jarEntry.getName(); ! // Get the directory part if there is one --- 15,32 ---- private DirectoryType root; ! private ZipFile zipFile; private Hashtable nodes = new Hashtable(); ! public JarEntryParser( DirectoryType root, ZipFile zipFile) { this.root = root; ! this.zipFile = zipFile; } public void parseJarEntries() { ! Enumeration enu = zipFile.entries(); while (enu.hasMoreElements()) { ! ZipEntry zipEntry = (ZipEntry) enu.nextElement(); ! String entryName = zipEntry.getName(); ! System.out.println( entryName ); // Get the directory part if there is one *************** *** 43,47 **** if (!entryName.equals("")) { FileType node = new FileType(); ! setFileBasicInfo(node, entryName, jarEntry); // This is not a directory entry, e.g. a class --- 43,47 ---- if (!entryName.equals("")) { FileType node = new FileType(); ! setFileBasicInfo(node, entryName, zipEntry); // This is not a directory entry, e.g. a class *************** *** 57,61 **** if ( dirType == null) { dirType = new DirectoryType(); ! dirType.setDate( jarEntry.getTime()); entryName = dir; --- 57,61 ---- if ( dirType == null) { dirType = new DirectoryType(); ! dirType.setDate( zipEntry.getTime()); entryName = dir; *************** *** 73,77 **** nodes.put( dir, dirType); parent.addFiles( dirType); ! } else dirType.setDate( jarEntry.getTime()); } } --- 73,77 ---- nodes.put( dir, dirType); parent.addFiles( dirType); ! } else dirType.setDate( zipEntry.getTime()); } } *************** *** 87,94 **** } ! private void setFileBasicInfo(FileType node, String entryName, ZipEntry jarEntry) { node.setName( convert(entryName)); ! node.setSize( jarEntry.getSize()); ! node.setDate( jarEntry.getTime()); } --- 87,94 ---- } ! private void setFileBasicInfo(FileType node, String entryName, ZipEntry zipEntry) { node.setName( convert(entryName)); ! node.setSize( zipEntry.getSize()); ! node.setDate( zipEntry.getTime()); } *************** *** 111,115 **** parent = new DirectoryType(); parent.setName( convert(dirName)); ! //setFileBasicInfo( parent, dirName, jarFile.getEntry( dirpath)); lastParent.addFiles(parent); nodes.put(dirpath, parent); --- 111,115 ---- parent = new DirectoryType(); parent.setName( convert(dirName)); ! //setFileBasicInfo( parent, dirName, zipFile.getEntry( dirpath)); lastParent.addFiles(parent); nodes.put(dirpath, parent); |
From: <sim...@us...> - 2002-07-27 07:55:10
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv24900 Modified Files: TODO.txt Log Message: Can parse zip/jar files now. Index: TODO.txt =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/TODO.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TODO.txt 26 Jul 2002 06:56:57 -0000 1.11 --- TODO.txt 27 Jul 2002 07:55:05 -0000 1.12 *************** *** 10,12 **** x : Add GUI Testcases + : Add filter to ignore files/dirs like CVS, *.bak, *~, etc. ! + : GUI codes need refactored. \ No newline at end of file --- 10,13 ---- x : Add GUI Testcases + : Add filter to ignore files/dirs like CVS, *.bak, *~, etc. ! + : GUI codes need refactored. ! + : Solve the chinese problem of Jar files. \ No newline at end of file |
From: <sim...@us...> - 2002-07-27 07:55:10
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv24900/test/src/org/cdchamber/elements Added Files: FileFiltersTest.java JarEntryParserTest.java Log Message: Can parse zip/jar files now. --- NEW FILE: FileFiltersTest.java --- /* * User: Simon * $Id: FileFiltersTest.java,v 1.1 2002/07/27 07:55:05 simon_lei Exp $ */ package org.cdchamber.elements; import junit.framework.TestCase; public class FileFiltersTest extends TestCase { protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } public FileFiltersTest(String s) { super(s); } public void testFileFilters() { assertTrue( "Should not be 0", FileFilters.filters.size() != 0); FileFilters.removeAllFilters(); assertEquals( "Should be 0 now", 0, FileFilters.filters.size()); FileFilters.addFilter( new CVSFileFilter()); assertEquals( "Should be 1 now", 1, FileFilters.filters.size()); } } --- NEW FILE: JarEntryParserTest.java --- /* * User: Simon * $Id: JarEntryParserTest.java,v 1.1 2002/07/27 07:55:05 simon_lei Exp $ */ package org.cdchamber.elements; import junit.framework.TestCase; import java.util.jar.JarFile; import org.cdchamber.util.DirPath; import org.cdchamber.elements.JarEntryParser; public class JarEntryParserTest extends TestCase { protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } public JarEntryParserTest(String s) { super(s); } public void testParser() throws Exception { JarFile jarFile = new JarFile( DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); DirectoryType dir = new DirectoryType(); JarEntryParser parser = new JarEntryParser( dir, jarFile); parser.parseJarEntries(); assertEquals( "Should have 4 filetypes", 4, dir.getFilesCount()); } } |
From: <sim...@us...> - 2002-07-27 07:55:10
|
Update of /cvsroot/cdchamber/CDChamber/test/testcase In directory usw-pr-cvs1:/tmp/cvs-serv24900/test/testcase Added Files: testcase.jar Log Message: Can parse zip/jar files now. --- NEW FILE: testcase.jar --- (This appears to be a binary file; contents omitted.) |
From: <sim...@us...> - 2002-07-27 07:55:10
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv24900/aspect/gen/org/cdchamber/elements Modified Files: CompressedFileTypeWrapper.java FileFilters.java Added Files: JarEntryParser.java Log Message: Can parse zip/jar files now. --- NEW FILE: JarEntryParser.java --- /* * User: Simon * $Id: JarEntryParser.java,v 1.1 2002/07/27 07:55:05 simon_lei Exp $ */ package org.cdchamber.elements; import java.util.*; import java.util.zip.ZipEntry; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.io.FileWriter; import java.io.UnsupportedEncodingException; public class JarEntryParser { private DirectoryType root; private JarFile jarFile; private Hashtable nodes = new Hashtable(); public JarEntryParser( DirectoryType root, JarFile jarFile) { this.root = root; this.jarFile = jarFile; } public void parseJarEntries() { Enumeration enu = jarFile.entries(); while (enu.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enu.nextElement(); String entryName = jarEntry.getName(); // Get the directory part if there is one String dir = null; // Get the position of the last '/' int cutIndex = entryName.lastIndexOf('/'); if (cutIndex != -1) { dir = entryName.substring(0, cutIndex); // Separate the file part entryName = entryName.substring(cutIndex + 1); } if (!entryName.equals("")) { FileType node = new FileType(); setFileBasicInfo(node, entryName, jarEntry); // This is not a directory entry, e.g. a class DirectoryType lastParent = getLastParent(dir, node.getSize()); if ( lastParent == null) continue; // judge the file if ( !FileFilters.accept(false, entryName)) continue; // Add the entry to the directory node lastParent.addFiles(node); } else { DirectoryType dirType = (DirectoryType)nodes.get( dir); if ( dirType == null) { dirType = new DirectoryType(); dirType.setDate( jarEntry.getTime()); entryName = dir; String newDir = null; cutIndex = dir.lastIndexOf( '/'); if (cutIndex != -1) { newDir = dir.substring(0, cutIndex); entryName = dir.substring(cutIndex + 1); } if ( !FileFilters.accept( true, entryName)) continue; dirType.setName( convert(entryName)); DirectoryType parent = getLastParent( newDir, dirType.getSize()); if ( parent == null) continue; nodes.put( dir, dirType); parent.addFiles( dirType); } else dirType.setDate( jarEntry.getTime()); } } } private String convert( String str) { try { return new String( str.getBytes(), "GB2312"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return str; } } private void setFileBasicInfo(FileType node, String entryName, ZipEntry jarEntry) { node.setName( convert(entryName)); node.setSize( jarEntry.getSize()); node.setDate( jarEntry.getTime()); } private DirectoryType getLastParent(String dir, long size) { DirectoryType parent = null; DirectoryType lastParent = root; if (dir == null) parent = lastParent; else { StringTokenizer tokenizer = new StringTokenizer(dir, "/"); String dirpath = ""; while (tokenizer.hasMoreTokens()) { String dirName = tokenizer.nextToken(); //judge the dir if ( !FileFilters.accept( true, dirName)) return null; dirpath += dirName; parent = (DirectoryType) nodes.get(dirpath); // Is the directory in our hash table already? if (parent == null) { parent = new DirectoryType(); parent.setName( convert(dirName)); //setFileBasicInfo( parent, dirName, jarFile.getEntry( dirpath)); lastParent.addFiles(parent); nodes.put(dirpath, parent); } parent.setSize( parent.getSize() + size); lastParent = parent; dirpath += "/"; } } return lastParent; } public static void main( String[] args) throws Exception { DirectoryType dir = new DirectoryType(); JarFile jarFile = new JarFile( "D:/work/CDChamber/test/testcase/testcase.jar"); JarEntryParser parse = new JarEntryParser( dir, jarFile); parse.parseJarEntries(); dir.marshal( new FileWriter( "D:/work/CDChamber/data/a.xml")); } } Index: CompressedFileTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileTypeWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompressedFileTypeWrapper.java 26 Jul 2002 14:00:47 -0000 1.1 --- CompressedFileTypeWrapper.java 27 Jul 2002 07:55:05 -0000 1.2 *************** *** 26,30 **** JarFile jarFile = new JarFile( fileName); ! Enumeration enu = jarFile.entries(); while (enu.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enu.nextElement(); --- 26,32 ---- JarFile jarFile = new JarFile( fileName); ! JarEntryParser jarParser= new JarEntryParser(this, jarFile); ! jarParser.parseJarEntries(); ! /* while (enu.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enu.nextElement(); *************** *** 39,42 **** --- 41,45 ---- addFiles( fileType); } + */ } catch (IOException e) { } Index: FileFilters.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/FileFilters.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileFilters.java 26 Jul 2002 13:17:20 -0000 1.2 --- FileFilters.java 27 Jul 2002 07:55:05 -0000 1.3 *************** *** 10,14 **** public class FileFilters { ! private static Vector filters = new Vector(); static { addFilter( new CVSFileFilter()); --- 10,14 ---- public class FileFilters { ! static Vector filters = new Vector(); static { addFilter( new CVSFileFilter()); |
From: <sim...@us...> - 2002-07-26 14:00:54
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv23223/aspect/gen/org/cdchamber/elements Added Files: CompressedFileTypeWrapper.java Removed Files: CompressedFileType.java Log Message: Add the compressed file type into the xsd file. --- NEW FILE: CompressedFileTypeWrapper.java --- /* * User: Simon * $Id: CompressedFileTypeWrapper.java,v 1.1 2002/07/26 14:00:47 simon_lei Exp $ */ package org.cdchamber.elements; import org.cdchamber.parser.FileParseException; import java.util.jar.JarFile; import java.util.jar.JarEntry; import java.util.Enumeration; import java.io.IOException; import java.io.File; public aspect CompressedFileTypeWrapper{ public CompressedFileType.new( String fileName) throws FileParseException { super(); this.parse( fileName); } public void CompressedFileType.parse( String fileName) throws FileParseException { try { File file = new File( fileName); setBasicInfo( file); JarFile jarFile = new JarFile( fileName); Enumeration enu = jarFile.entries(); while (enu.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enu.nextElement(); if ( !FileFilters.accept( jarEntry.isDirectory(), jarEntry.getName())) continue; FileType fileType = new FileType(); fileType.setName( jarEntry.getName()); fileType.setDate( jarEntry.getTime()); fileType.setSize( jarEntry.getSize()); addFiles( fileType); } } catch (IOException e) { } } } --- CompressedFileType.java DELETED --- |
From: <sim...@us...> - 2002-07-26 14:00:54
|
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv23223/src/org/cdchamber/gui Modified Files: CDCMainFrameController.java Log Message: Add the compressed file type into the xsd file. Index: CDCMainFrameController.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrameController.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CDCMainFrameController.java 26 Jul 2002 07:54:33 -0000 1.14 --- CDCMainFrameController.java 26 Jul 2002 14:00:47 -0000 1.15 *************** *** 41,44 **** --- 41,45 ---- File[] rootFiles = dataDir.listFiles(); for ( int i=0; i<rootFiles.length; i++) { + if ( rootFiles[i].isDirectory()) continue; try { DirectoryType vFiles = DirectoryType.unmarshalDirectoryType( new FileReader( rootFiles[i])); *************** *** 47,52 **** --- 48,56 ---- root.addFiles( cdrom); } catch (org.exolab.castor.xml.MarshalException e) { + e.printStackTrace(); } catch (org.exolab.castor.xml.ValidationException e) { + e.printStackTrace(); } catch (FileNotFoundException e) { + e.printStackTrace(); } } |
From: <sim...@us...> - 2002-07-26 14:00:53
|
Update of /cvsroot/cdchamber/CDChamber/src In directory usw-pr-cvs1:/tmp/cvs-serv23223/src Modified Files: cdchamber.xsd Log Message: Add the compressed file type into the xsd file. Index: cdchamber.xsd =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/cdchamber.xsd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cdchamber.xsd 23 Jun 2002 10:07:59 -0000 1.3 --- cdchamber.xsd 26 Jul 2002 14:00:47 -0000 1.4 *************** *** 18,20 **** --- 18,25 ---- </xs:complexContent> </xs:complexType> + <xs:complexType name="CompressedFileType" mixed="true"> + <xs:complexContent mixed="true"> + <xs:extension base="DirectoryType"/> + </xs:complexContent> + </xs:complexType> </xs:schema> |
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv8974/aspect/gen/org/cdchamber/elements Modified Files: CVSFileFilter.java CompressedFileType.java DirectoryTypeWrapper.java FileFilters.java IFileFilter.java Log Message: Add the file filter. Index: CVSFileFilter.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CVSFileFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CVSFileFilter.java 26 Jul 2002 12:53:23 -0000 1.1 --- CVSFileFilter.java 26 Jul 2002 13:17:20 -0000 1.2 *************** *** 10,14 **** public boolean accept(File file) { ! if ( file.isDirectory() && file.getName().equals( "CVS")) return false; return true; } --- 10,18 ---- public boolean accept(File file) { ! return accept( file.isDirectory(), file.getName()); ! } ! ! public boolean accept(boolean isDirectory, String fileName) { ! if ( isDirectory && fileName.equals( "CVS")) return false; return true; } Index: CompressedFileType.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileType.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CompressedFileType.java 26 Jul 2002 12:53:23 -0000 1.3 --- CompressedFileType.java 26 Jul 2002 13:17:20 -0000 1.4 *************** *** 30,34 **** JarEntry jarEntry = (JarEntry) enu.nextElement(); ! if ( jarEntry.getName().equals( "CVS")) continue; FileType fileType = new FileType(); --- 30,34 ---- JarEntry jarEntry = (JarEntry) enu.nextElement(); ! if ( !FileFilters.accept( jarEntry.isDirectory(), jarEntry.getName())) continue; FileType fileType = new FileType(); Index: DirectoryTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/DirectoryTypeWrapper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DirectoryTypeWrapper.java 26 Jul 2002 10:10:51 -0000 1.3 --- DirectoryTypeWrapper.java 26 Jul 2002 13:17:20 -0000 1.4 *************** *** 19,24 **** int sumSize = 0; for ( int i=0; i<files.length; i++) { ! /* TODO: ignore some type files */ ! if ( files[i].getName().equals( "CVS")) continue; FileType fileType = FileTypeFactory.createFileType( files[i]); this.addFiles( fileType); --- 19,23 ---- int sumSize = 0; for ( int i=0; i<files.length; i++) { ! if ( !FileFilters.accept( files[i])) continue; FileType fileType = FileTypeFactory.createFileType( files[i]); this.addFiles( fileType); Index: FileFilters.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/FileFilters.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileFilters.java 26 Jul 2002 12:53:23 -0000 1.1 --- FileFilters.java 26 Jul 2002 13:17:20 -0000 1.2 *************** *** 11,15 **** public class FileFilters { private static Vector filters = new Vector(); ! public static synchronized void addFilter( IFileFilter filter) { filters.add( filter); --- 11,17 ---- public class FileFilters { private static Vector filters = new Vector(); ! static { ! addFilter( new CVSFileFilter()); ! } public static synchronized void addFilter( IFileFilter filter) { filters.add( filter); *************** *** 21,30 **** public static boolean accept( File file) { Enumeration enu = filters.elements(); while (enu.hasMoreElements()) { IFileFilter filter = (IFileFilter) enu.nextElement(); ! if ( !filter.accept( file)) return false; } return true; } } --- 23,38 ---- public static boolean accept( File file) { + return accept( file.isDirectory(), file.getName()); + } + + public static boolean accept( boolean isDirectory, String fileName) { Enumeration enu = filters.elements(); while (enu.hasMoreElements()) { IFileFilter filter = (IFileFilter) enu.nextElement(); ! if ( !filter.accept( isDirectory, fileName)) return false; } return true; } + + } Index: IFileFilter.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/IFileFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IFileFilter.java 26 Jul 2002 12:53:23 -0000 1.1 --- IFileFilter.java 26 Jul 2002 13:17:20 -0000 1.2 *************** *** 14,16 **** --- 14,24 ---- */ public boolean accept( File file); + + /** + * Can the file be accept and add into the cdrom chamber + * @param isDirectory Is the file a directory + * @param fileName The file's name + * @return true if the file is accept. + */ + public boolean accept( boolean isDirectory, String fileName); } |
From: <sim...@us...> - 2002-07-26 13:17:23
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv8974/test/src/org/cdchamber/elements Modified Files: CVSFileFilterTest.java Log Message: Add the file filter. Index: CVSFileFilterTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements/CVSFileFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CVSFileFilterTest.java 26 Jul 2002 12:53:24 -0000 1.1 --- CVSFileFilterTest.java 26 Jul 2002 13:17:20 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- CVSFileFilter filter = new CVSFileFilter(); assertTrue( "Not CVS", filter.accept( file)); + assertTrue( "Not CVS", filter.accept( file.isDirectory(), file.getName())); } *************** *** 34,37 **** --- 35,39 ---- CVSFileFilter filter = new CVSFileFilter(); assertTrue( "CVS", !filter.accept( file)); + assertTrue( "CVS", !filter.accept( file.isDirectory(), file.getName())); } } |
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv2111/aspect/gen/org/cdchamber/elements Modified Files: CompressedFileType.java FileTypeFactory.java Added Files: CVSFileFilter.java FileFilters.java IFileFilter.java Log Message: Add file filters --- NEW FILE: CVSFileFilter.java --- /* * User: Simon * $Id: CVSFileFilter.java,v 1.1 2002/07/26 12:53:23 simon_lei Exp $ */ package org.cdchamber.elements; import java.io.File; public class CVSFileFilter implements IFileFilter { public boolean accept(File file) { if ( file.isDirectory() && file.getName().equals( "CVS")) return false; return true; } } --- NEW FILE: FileFilters.java --- /* * User: Simon * $Id: FileFilters.java,v 1.1 2002/07/26 12:53:23 simon_lei Exp $ */ package org.cdchamber.elements; import java.util.Vector; import java.util.Enumeration; import java.io.File; public class FileFilters { private static Vector filters = new Vector(); public static synchronized void addFilter( IFileFilter filter) { filters.add( filter); } public static synchronized void removeAllFilters() { filters.removeAllElements(); } public static boolean accept( File file) { Enumeration enu = filters.elements(); while (enu.hasMoreElements()) { IFileFilter filter = (IFileFilter) enu.nextElement(); if ( !filter.accept( file)) return false; } return true; } } --- NEW FILE: IFileFilter.java --- /* * User: Simon * $Id: IFileFilter.java,v 1.1 2002/07/26 12:53:23 simon_lei Exp $ */ package org.cdchamber.elements; import java.io.File; public interface IFileFilter { /** * Can the file be accept and add into the cdrom chamber. * @param file the file to be judged. * @return true if the file is accept. */ public boolean accept( File file); } Index: CompressedFileType.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/CompressedFileType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CompressedFileType.java 26 Jul 2002 10:10:51 -0000 1.2 --- CompressedFileType.java 26 Jul 2002 12:53:23 -0000 1.3 *************** *** 8,11 **** --- 8,13 ---- import java.util.jar.JarFile; + import java.util.jar.JarEntry; + import java.util.Enumeration; import java.io.IOException; import java.io.File; *************** *** 13,18 **** public class CompressedFileType extends DirectoryType { ! public CompressedFileType( String fileName) { ! } --- 15,21 ---- public class CompressedFileType extends DirectoryType { ! public CompressedFileType( String fileName) throws FileParseException { ! super(); ! this.parse( fileName); } *************** *** 23,29 **** JarFile jarFile = new JarFile( fileName); ! } catch (IOException e) { } --- 26,40 ---- JarFile jarFile = new JarFile( fileName); + Enumeration enu = jarFile.entries(); + while (enu.hasMoreElements()) { + JarEntry jarEntry = (JarEntry) enu.nextElement(); + if ( jarEntry.getName().equals( "CVS")) continue; ! FileType fileType = new FileType(); ! fileType.setName( jarEntry.getName()); ! fileType.setDate( jarEntry.getTime()); ! fileType.setSize( jarEntry.getSize()); ! } } catch (IOException e) { } Index: FileTypeFactory.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/FileTypeFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileTypeFactory.java 26 Jul 2002 10:10:51 -0000 1.3 --- FileTypeFactory.java 26 Jul 2002 12:53:23 -0000 1.4 *************** *** 15,30 **** public static FileType createFileType( File file) throws FileParseException { if ( file.isDirectory()) return new DirectoryType( file.getAbsolutePath()); ! if ( isCompressedFile( file.getName())) return new CompressedFileType( file.getAbsolutePath()); return new FileType( file.getAbsolutePath()); } private static boolean isCompressedFile( String fileName) { - return false; - /* String lowerName = fileName.toLowerCase(); if ( lowerName.endsWith( ".zip")) return true; if ( lowerName.endsWith( ".jar")) return true; return false; - */ } } --- 15,30 ---- public static FileType createFileType( File file) throws FileParseException { if ( file.isDirectory()) return new DirectoryType( file.getAbsolutePath()); ! try { ! if ( isCompressedFile( file.getName())) return new CompressedFileType( file.getAbsolutePath()); ! } catch (FileParseException e) { ! } return new FileType( file.getAbsolutePath()); } private static boolean isCompressedFile( String fileName) { String lowerName = fileName.toLowerCase(); if ( lowerName.endsWith( ".zip")) return true; if ( lowerName.endsWith( ".jar")) return true; return false; } } |
From: <sim...@us...> - 2002-07-26 12:53:29
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv2111/test/src/org/cdchamber/elements Added Files: CVSFileFilterTest.java Log Message: Add file filters --- NEW FILE: CVSFileFilterTest.java --- /* * User: Simon * $Id: CVSFileFilterTest.java,v 1.1 2002/07/26 12:53:24 simon_lei Exp $ */ package org.cdchamber.elements; import junit.framework.TestCase; import java.io.File; import org.cdchamber.util.DirPath; public class CVSFileFilterTest extends TestCase { protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } public CVSFileFilterTest(String s) { super(s); } public void testNotCVS() { File file = new File( DirPath.TestCaseDir); CVSFileFilter filter = new CVSFileFilter(); assertTrue( "Not CVS", filter.accept( file)); } public void testCVS() { File file = new File( DirPath.TestCaseDir + DirPath.SEP + "CVS"); CVSFileFilter filter = new CVSFileFilter(); assertTrue( "CVS", !filter.accept( file)); } } |