Exemplo n.º 1
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();
  }
Exemplo n.º 2
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();
  }