1 5 6 package org.joseki.server.source; 7 8 import java.util.* ; 9 import com.hp.hpl.jena.rdf.model.* ; 11 import org.joseki.server.SourceController ; 12 import org.joseki.util.cache.*; 13 14 15 22 23 public class ModelSourceFile extends ModelSourceCom 24 { 25 static FileModelFactory factory = new FileModelFactory() ; 26 27 static Cache cache = new Cache(25, factory, new CachePolicyLRU()) ; 29 30 33 36 static Map controllers = new HashMap() ; 37 38 39 public ModelSourceFile(SourceController controller, String serverURI) 40 { 41 super(controller, serverURI) ; 42 controllers.put(serverURI, controller) ; 43 } 44 45 public Model getModel() 46 { 47 return (Model)cache.get(getServerURI()) ; 48 } 49 50 static class FileModelFactory implements CacheItemFactory 51 { 52 54 56 59 public Object create(Object key) 60 { 61 return getSourceController(key).buildSource() ; 63 } 64 65 68 public void destroy(Object key, Object obj) 69 { 70 getSourceController(key).releaseSource() ; 71 } 72 73 SourceController getSourceController(Object key) 74 { 75 return (SourceController)controllers.get(key) ; 76 } 77 } 78 } 79 80 106 | Popular Tags |