1 5 package org.exoplatform.portlets.backup.component.model; 6 7 import java.util.* ; 8 import java.util.jar.*; 9 import java.io.File ; 10 16 public class ImportData { 17 private String name_ ; 18 private Date createdDate_ ; 19 private Date modifiedDate_ ; 20 private String resourceURL_ ; 21 private List dataEntries_ ; 22 private JarFile jarFile_ ; 23 24 public ImportData(File file) { 25 name_ = file.getName() ; 26 Date date = new Date(file.lastModified()) ; 27 createdDate_ = date ; 28 modifiedDate_ = date ; 29 resourceURL_ = file.getAbsolutePath() ; 30 } 31 32 public String getName() { return name_ ; } 33 public Date getCreatedDate() { return createdDate_ ; } 34 public Date getModifiedDate() { return modifiedDate_ ; } 35 36 public String getResourceURL() { return resourceURL_ ; } 37 38 public List getDataEntries() { 39 if(dataEntries_ == null) { 40 41 } 42 return dataEntries_ ; 43 } 44 45 public Enumeration getEntries() { 46 try { 47 JarFile jar = getJarFile() ; 48 return jar.entries() ; 49 } catch (Exception ex) { 50 ex.printStackTrace() ; 51 } 52 return null ; 53 } 54 55 private JarFile getJarFile() throws Exception { 56 if(jarFile_ == null) { 57 jarFile_ = new JarFile(new File (resourceURL_)) ; 58 } 59 return jarFile_ ; 60 } 61 } | Popular Tags |