コード例 #1
0
  /** {@inheritDoc} */
  public void init(String id, NamespaceResolver resolver) throws JournalException {

    super.init(id, resolver);

    init();

    try {
      conHelper = createConnectionHelper(getDataSource());

      // make sure schemaObjectPrefix consists of legal name characters only
      schemaObjectPrefix = conHelper.prepareDbIdentifier(schemaObjectPrefix);

      // check if schema objects exist and create them if necessary
      if (isSchemaCheckEnabled()) {
        createCheckSchemaOperation().run();
      }

      // Make sure that the LOCAL_REVISIONS table exists (see JCR-1087)
      if (isSchemaCheckEnabled()) {
        checkLocalRevisionSchema();
      }

      buildSQLStatements();
      initInstanceRevisionAndJanitor();
    } catch (Exception e) {
      String msg = "Unable to create connection.";
      throw new JournalException(msg, e);
    }
    log.info("DatabaseJournal initialized.");
  }