コード例 #1
0
ファイル: EntityGenerator.java プロジェクト: dlitz/resin
  /** Sets the bean info for the generator */
  public void setEntityType(EntityType entityType) {
    _entityType = entityType;

    _dependencies.addAll(entityType.getDependencies());

    for (int i = 0; i < _dependencies.size(); i++) Environment.addDependency(_dependencies.get(i));
  }
コード例 #2
0
  /** Initialization. */
  @PostConstruct
  public void init() throws ConfigException {
    if (getClassType() != null) {
      super.init();
    }

    Environment.addEnvironmentListener(new StartListener());
  }
コード例 #3
0
  /** Creates the database. */
  public Database(Path dir) {
    Environment.addClassLoaderListener(new CloseListener(this));

    _lifecycle.setName(toString());

    if (dir != null) setPath(dir);

    _blockManager = BlockManager.create();
  }
コード例 #4
0
  /** Initialize the resource. */
  @PostConstruct
  public void init() throws Exception {
    if (_name == null)
      throw new ConfigException(
          L.l(
              "<jndi-link> configuration needs a <name>.  The <name> is the JNDI name where the context will be linked."));

    Class factory = _factoryClass;

    if (factory == null)
      throw new ConfigException(
          L.l(
              "<jndi-link> configuration need a <factory>.  The <factory> is the class name of the InitialContextFactory bean."));

    Object obj = factory.newInstance();

    /*
    configure(obj);

    TypeBuilderFactory.init(obj);
    */

    if (obj instanceof ClassLoaderListener) {
      ClassLoaderListener listener = (ClassLoaderListener) obj;

      Environment.addClassLoaderListener(listener);
    }

    if (obj instanceof EnvironmentListener) {
      EnvironmentListener listener = (EnvironmentListener) obj;

      Environment.addEnvironmentListener(listener);
    }

    Object proxy = new LinkProxy((InitialContextFactory) obj, _properties, null);

    if (_name.startsWith("java:comp")) Jndi.bindDeep(_name, proxy);
    else {
      Jndi.bindDeep("java:comp/env/" + _name, proxy);
    }
  }
コード例 #5
0
  /** Creates the deploy. */
  public ExpandDeployGenerator(
      String id, DeployContainer<E> container, Path containerRootDirectory) {
    super(container);

    _id = id;

    _containerRootDirectory = containerRootDirectory;

    _alarm = new WeakAlarm(this);

    _checkInterval = Environment.getDependencyCheckInterval();

    _cronInterval = Environment.getDependencyCheckInterval();
    if (_cronInterval < MIN_CRON_INTERVAL) _cronInterval = MIN_CRON_INTERVAL;

    _loader = Thread.currentThread().getContextClassLoader();

    _deployService = DeployControllerService.getCurrent();
    _deployService.addUpdateListener(this);

    _repository = RepositorySystem.getCurrentRepository();
    _repository.addListener(id, this);
  }
コード例 #6
0
ファイル: SingletonScope.java プロジェクト: GEFFROY/Quercus
  public <T> void addDestructor(Contextual<T> comp, T value) {
    EnvironmentClassLoader loader = Environment.getEnvironmentClassLoader();

    if (loader != null) {
      DestructionListener listener = (DestructionListener) loader.getAttribute("caucho.destroy");

      if (listener == null) {
        listener = new DestructionListener();
        loader.setAttribute("caucho.destroy", listener);
        loader.addListener(listener);
      }

      listener.addValue(comp, value);
    }
  }
コード例 #7
0
ファイル: SingletonScope.java プロジェクト: GEFFROY/Quercus
 /** Returns the current application scope */
 public SingletonScope() {
   Environment.addCloseListener(_context);
 }
コード例 #8
0
  protected AbstractRolloverLog() {
    _rolloverListener = new RolloverAlarm();
    _rolloverAlarm = new WeakAlarm(_rolloverListener);

    Environment.addCloseListener(this);
  }
コード例 #9
0
ファイル: WebAppContainer.java プロジェクト: dlitz/resin
  /** Sets the access log. */
  public void setAccessLog(AbstractAccessLog log) {
    _accessLog = log;

    Environment.setAttribute("caucho.server.access-log", log);
  }