示例#1
0
  /** 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));
  }
  /** Initialization. */
  @PostConstruct
  public void init() throws ConfigException {
    if (getClassType() != null) {
      super.init();
    }

    Environment.addEnvironmentListener(new StartListener());
  }
  /** Creates the database. */
  public Database(Path dir) {
    Environment.addClassLoaderListener(new CloseListener(this));

    _lifecycle.setName(toString());

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

    _blockManager = BlockManager.create();
  }
  /** 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
  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
 /** Returns the current application scope */
 public SingletonScope() {
   Environment.addCloseListener(_context);
 }
  protected AbstractRolloverLog() {
    _rolloverListener = new RolloverAlarm();
    _rolloverAlarm = new WeakAlarm(_rolloverListener);

    Environment.addCloseListener(this);
  }
示例#9
0
  /** Sets the access log. */
  public void setAccessLog(AbstractAccessLog log) {
    _accessLog = log;

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