コード例 #1
0
  /** 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;
    }
  }
コード例 #2
0
  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;
    }
  }
コード例 #3
0
  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());
  }
コード例 #4
0
ファイル: EnhancerManager.java プロジェクト: dlitz/resin
  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;
  }
コード例 #5
0
  /** Returns a path for the current directory. */
  public static Path getPwd() {
    Path pwd = ENV_PWD.get();

    if (pwd == null) {
      if (PWD == null) {
        /* JNI set later
        PWD = JniFilePath.create();

        if (PWD == null)
          PWD = new FilePath(null);
        */
        PWD = new FilePath(null);
      }
      pwd = PWD;
      ENV_PWD.setGlobal(pwd);
    }

    return pwd;
  }
コード例 #6
0
  /** Initialize the JNI. */
  public static void initJNI() {
    if (_isInitJNI.getAndSet(true)) return;

    // order matters because of static init and license checking
    FilesystemPath jniFilePath = JniFilePath.create();

    if (jniFilePath != null) {
      DEFAULT_SCHEME_MAP.put("file", jniFilePath);

      SchemeMap localMap = _localSchemeMap.get();
      if (localMap != null) localMap.put("file", jniFilePath);

      localMap = _localSchemeMap.get(ClassLoader.getSystemClassLoader());
      if (localMap != null) localMap.put("file", jniFilePath);

      Vfs.PWD = jniFilePath;
      Vfs.setPwd(jniFilePath);
    }
  }
コード例 #7
0
 /** Sets a path for the current directory in the current environment. */
 public static void setPwd(Path pwd, ClassLoader loader) {
   ENV_PWD.set(pwd, loader);
 }
コード例 #8
0
 /** Returns a path for the current directory. */
 public static Path getPwd(ClassLoader loader) {
   return ENV_PWD.get(loader);
 }
コード例 #9
0
ファイル: EnhancerManager.java プロジェクト: dlitz/resin
 public static EnhancerManager getLocalEnhancer(ClassLoader loader) {
   return _localEnhancer.get(loader);
 }