/** Returns the database manager for the local environment. */ private static DatabaseManager getLocalManager() { synchronized (_localManager) { DatabaseManager manager = _localManager.getLevel(); if (manager == null) { manager = new DatabaseManager(); _localManager.set(manager); } return manager; } }
public static SchemeMap getLocalScheme() { synchronized (_localSchemeMap) { SchemeMap map = _localSchemeMap.getLevel(); if (map == null) { map = _localSchemeMap.get().copy(); if (map == null) map = DEFAULT_SCHEME_MAP.copy(); _localSchemeMap.set(map); } return map; } }
static { DEFAULT_SCHEME_MAP = new SchemeMap(); Path.setDefaultSchemeMap(DEFAULT_SCHEME_MAP); FilePath pwd = new FilePath(null); PWD = pwd; setPwd(pwd); ENV_PWD.setGlobal(pwd); ENV_PWD.set(pwd); _localSchemeMap.setGlobal(DEFAULT_SCHEME_MAP); DEFAULT_SCHEME_MAP.put("file", pwd); DEFAULT_SCHEME_MAP.put("memory", new MemoryScheme()); DEFAULT_SCHEME_MAP.put("jar", new JarScheme(null)); /* XXX: DEFAULT_SCHEME_MAP.put("mailto", new MailtoPath(null, null, null, null)); */ DEFAULT_SCHEME_MAP.put("classpath", new ClasspathPath(null, "", "")); DEFAULT_SCHEME_MAP.put("http", new HttpPath("127.0.0.1", 0)); DEFAULT_SCHEME_MAP.put("https", new HttpsPath("127.0.0.1", 0)); // DEFAULT_SCHEME_MAP.put("hmux", new HmuxPath("127.0.0.1", 0)); DEFAULT_SCHEME_MAP.put("tcp", new TcpPath(null, null, null, "127.0.0.1", 0)); DEFAULT_SCHEME_MAP.put("tcps", new TcpsPath(null, null, null, "127.0.0.1", 0)); // DEFAULT_SCHEME_MAP.put("log", new LogPath(null, "/", null, "/")); DEFAULT_SCHEME_MAP.put("merge", new MergePath()); StreamImpl stdout = StdoutStream.create(); StreamImpl stderr = StderrStream.create(); DEFAULT_SCHEME_MAP.put("stdout", stdout.getPath()); DEFAULT_SCHEME_MAP.put("stderr", stderr.getPath()); VfsStream nullStream = new VfsStream(null, null); DEFAULT_SCHEME_MAP.put("null", new ConstPath(null, nullStream)); DEFAULT_SCHEME_MAP.put("jndi", new JndiPath()); DEFAULT_SCHEME_MAP.put("datastore", new DatastorePath("/")); /* DEFAULT_SCHEME_MAP.put("config", new ConfigPath()); */ DEFAULT_SCHEME_MAP.put("spy", new SpyScheme()); }
public static EnhancerManager create(ClassLoader loader) { EnhancerManager enhancer = _localEnhancer.getLevel(loader); if (enhancer == null) { enhancer = new EnhancerManager(loader); _localEnhancer.set(enhancer, loader); for (; loader != null; loader = loader.getParent()) { if (loader instanceof DynamicClassLoader) { ((DynamicClassLoader) loader).addTransformer(enhancer); break; } } } return enhancer; }
/** Sets a path for the current directory in the current environment. */ public static void setPwd(Path pwd, ClassLoader loader) { ENV_PWD.set(pwd, loader); }