1 package org.hibernate.ejb.packaging; 3 4 import java.io.IOException ; 5 import java.net.URL ; 6 import java.util.Enumeration ; 7 import java.util.jar.JarFile ; 8 import java.util.zip.ZipEntry ; 9 10 13 public class ZippedJarVisitor extends JarVisitor { 14 public ZippedJarVisitor(String jarFileName, boolean detectClasses, boolean detectHbm) { 15 super( jarFileName, detectClasses, detectHbm ); 16 } 17 18 public ZippedJarVisitor(URL url, boolean detectClasses, boolean detectHbm) { 19 this.detectClasses = detectClasses; 20 this.detectHbm = detectHbm; 21 String file = url.getFile(); 22 jarFileName = file.substring( "file:/".length(), file.length() - "!/META-INF/persistence.xml".length() ); 23 unqualify(); 24 } 25 26 protected void doProcessElements() { 27 JarFile jarFile; 28 try { 29 jarFile = new JarFile ( jarFileName ); 30 } 31 catch (IOException ze) { 32 log.warn( "Unable to find file (ignored): " + jarFileName, ze ); 33 return; 34 } 35 Enumeration <? extends ZipEntry > entries = jarFile.entries(); 36 while ( entries.hasMoreElements() ) { 37 ZipEntry entry = entries.nextElement(); 38 if ( !entry.isDirectory() ) { 39 addElement( entry.getName() ); 40 } 41 } 42 } 43 } 44 | Popular Tags |