1 19 20 package org.netbeans.core.startup.layers; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.net.URL ; 25 import java.util.List ; 26 import java.util.logging.Logger ; 27 import org.openide.filesystems.FileSystem; 28 import org.openide.filesystems.XMLFileSystem; 29 import org.openide.util.NotImplementedException; 30 31 35 public abstract class LayerCacheManager { 36 37 39 static final Logger err = Logger.getLogger("org.netbeans.core.projects.cache"); 41 private final File cacheDir; 42 43 private static LayerCacheManager emptyManager = null; 44 47 public static LayerCacheManager emptyManager() { 48 if (emptyManager == null) { 49 emptyManager = new NonCacheManager(); 50 } 51 return emptyManager; 52 } 53 54 56 protected LayerCacheManager(File cacheDir) { 57 this.cacheDir = cacheDir; 58 } 59 60 64 public final File getCacheDirectory() { 65 return cacheDir; 66 } 67 68 70 public abstract boolean cacheExists(); 71 72 75 public abstract void cleanupCache() throws IOException ; 76 77 84 public boolean supportsLoad() { 85 return true; 86 } 87 88 93 public FileSystem createEmptyFileSystem() throws IOException { 94 if (supportsLoad()) { 95 throw new NotImplementedException(); 96 } else { 97 return new XMLFileSystem(); 98 } 99 } 100 101 107 public FileSystem createLoadedFileSystem() throws IOException { 108 if (!supportsLoad()) throw new IOException ("Does not support loading!"); FileSystem fs = createEmptyFileSystem(); 110 load(fs); 111 return fs; 112 } 113 114 122 public void load(FileSystem fs) throws IOException { 123 throw new NotImplementedException(); 124 } 125 126 137 public void store(FileSystem fs, List <URL > urls) throws IOException { 138 throw new NotImplementedException(); 139 } 140 141 148 public FileSystem store(List <URL > urls) throws IOException { 149 throw new NotImplementedException(); 150 } 151 152 } 153 | Popular Tags |