1 22 package org.objectweb.petals.classloader; 23 24 import java.io.IOException ; 25 import java.util.HashMap ; 26 import java.util.Map ; 27 28 34 class Loaders { 35 36 public static final String COMMON_LOADER = "common"; 37 38 private static Loaders singletonInstance; 39 40 private static SharedLibrariesClassLoader slClassLoader; 41 42 private Map <String ,PetalsClassLoader> classLoadersTable = 43 new HashMap <String ,PetalsClassLoader>(); 44 45 51 private Loaders() { 52 super(); 53 54 try { 55 slClassLoader = new SharedLibrariesClassLoader(); 56 } catch (IOException e) { 57 } 59 } 60 61 public static Loaders getInstance() { 62 if (singletonInstance == null) { 63 singletonInstance = new Loaders(); 64 } 65 return singletonInstance; 66 } 67 68 public boolean contains(String loaderName) { 69 return classLoadersTable.containsKey(loaderName); 70 } 71 72 public PetalsClassLoader get(String loaderName) { 73 return classLoadersTable.get(loaderName); 74 } 75 76 public ClassLoader put(String loaderName, PetalsClassLoader cl) { 77 return classLoadersTable.put(loaderName, cl); 78 } 79 80 public void remove(String loaderName) { 81 classLoadersTable.remove(loaderName); 82 } 83 84 public SharedLibrariesClassLoader getSharedLibrariesClassLoader() 85 { 86 return slClassLoader; 87 } 88 89 } 106 | Popular Tags |