1 23 package com.sun.enterprise.deployment.archivist; 24 25 import java.io.IOException ; 26 import java.io.File ; 27 import java.io.FileNotFoundException ; 28 import java.util.logging.Level ; 29 import javax.enterprise.deploy.shared.ModuleType ; 30 31 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive; 32 import com.sun.enterprise.deployment.util.DOLUtils; 33 34 40 public class ArchivistFactory { 41 42 private static PluggableArchivistsHelper defaultArchivists; 43 44 45 private ArchivistFactory() { 46 } 47 48 49 private static void init() { 50 51 if (defaultArchivists!=null) 52 return; 53 54 defaultArchivists = new PluggableArchivistsHelper(); 57 defaultArchivists.registerArchivist(new ApplicationArchivist()); 58 defaultArchivists.registerArchivist(new WebArchivist()); 59 defaultArchivists.registerArchivist(new ConnectorArchivist()); 60 defaultArchivists.registerArchivist(new AppClientArchivist()); 61 defaultArchivists.registerArchivist(new EjbArchivist()); 62 } 63 64 public static PluggableArchivists getPluggableArchivists() { 65 init(); 66 return defaultArchivists; 67 } 68 69 73 public static Archivist getArchivistForType(ModuleType type) { 74 init(); 75 return defaultArchivists.getArchivistForType(type); 76 } 77 78 82 public static Archivist getArchivistForArchive(File jarFileOrDirectory) throws IOException { 83 init(); 84 return defaultArchivists.getArchivistForArchive(jarFileOrDirectory); 85 } 86 87 91 public static Archivist getArchivistForArchive(String path) throws IOException { 92 init(); 93 return defaultArchivists.getArchivistForArchive(path); 94 } 95 96 100 public static Archivist getArchivistForArchive(AbstractArchive archive) throws IOException { 101 init(); 102 return defaultArchivists.getArchivistForArchive(archive); 103 } 104 105 109 public static void registerArchivist(Archivist archivist) { 110 init(); 111 defaultArchivists.registerArchivist(archivist); 112 } 113 } 114 | Popular Tags |