Пример #1
0
  /**
   * Gracefully shut down active use of the public methods of this Component.
   *
   * @throws LifecycleException if this component detects a fatal error that needs to be reported
   */
  public void stop() throws LifecycleException {

    // Perform normal superclass finalization
    super.stop();

    // Close any open DB connection
    close(this.dbConnection);
  }
Пример #2
0
  /**
   * Gracefully shut down active use of the public methods of this Component.
   *
   * @exception LifecycleException if this component detects a fatal error that needs to be reported
   */
  public synchronized void stop() throws LifecycleException {

    // Perform normal superclass finalization
    super.stop();

    // No shutdown activities required

  }
  /**
   * Gracefully terminate the active use of the public methods of this component and implement the
   * requirements of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
   *
   * @throws LifecycleException if this component detects a fatal error that needs to be reported
   */
  @Override
  protected void stopInternal() throws LifecycleException {

    // Perform normal superclass finalization
    super.stopInternal();

    // Release reference to our sentry impl
    realm = null;
  }
Пример #4
0
  /**
   * Prepare for active use of the public methods of this Component.
   *
   * @throws LifecycleException if this component detects a fatal error that prevents it from being
   *     started
   */
  public void start() throws LifecycleException {

    // Validate that we can open our connection
    try {
      open();
    } catch (SQLException e) {
      throw new LifecycleException(sm.getString("jdbcRealm.open"), e);
    }

    // Perform normal superclass initialization
    super.start();
  }
  /**
   * Prepare for the beginning of active use of the public methods of this component and implement
   * the requirements of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
   *
   * @throws LifecycleException if this component detects a fatal error that prevents this component
   *     from being used
   */
  @Override
  protected void startInternal() throws LifecycleException {
    try {
      initialize();
    } catch (Exception e) {
      String error = CLS_NM + ".startInternal caught Exception=" + e;
      LOG.severe(error);
      e.printStackTrace();
      throw new LifecycleException(error);
    }

    super.startInternal();
  }
Пример #6
0
  /**
   * Prepare for active use of the public methods of this Component.
   *
   * @exception LifecycleException if this component detects a fatal error that prevents it from
   *     being started
   */
  public synchronized void start() throws LifecycleException {

    // Validate the existence of our database file
    File file = new File(pathname);
    if (!file.isAbsolute()) file = new File(System.getProperty("catalina.base"), pathname);
    if (!file.exists() || !file.canRead())
      throw new LifecycleException(sm.getString("memoryRealm.loadExist", file.getAbsolutePath()));

    // Load the contents of the database file
    if (debug >= 1) log(sm.getString("memoryRealm.loadPath", file.getAbsolutePath()));
    Digester digester = getDigester();
    try {
      synchronized (digester) {
        digester.push(this);
        digester.parse(file);
      }
    } catch (Exception e) {
      throw new LifecycleException("memoryRealm.readXml", e);
    }

    // Perform normal superclass initialization
    super.start();
  }