Package org.ejbca.core.ejb.log

Examples of org.ejbca.core.ejb.log.LogConfigurationData


    public LogConfiguration loadLogConfiguration(final int caid) {
        // Try loading log configuration from cache
        LogConfiguration ret = logConfCache.get(Integer.valueOf(caid));
      if (ret == null) {
            // Try loading log configuration from database
        final LogConfigurationData logconfigdata = LogConfigurationData.findByPK(entityManager, Integer.valueOf(caid));
        if (logconfigdata != null) {
          ret = logconfigdata.loadLogConfiguration();
          logConfCache.put(Integer.valueOf(caid), ret);
        }
      }
    if (ret == null) {
      // Use the default object if nothing is configured
View Full Code Here


    public int getAndIncrementRowCount() {
      // Read current value from LogConfigurationData with id=0
      final int currentLogEntryRowNumber = LogConfigurationData.findCurrentLogEntryRowNumber(entityManager);
      if (currentLogEntryRowNumber == -1) {
          // No such LogConfigurationData exists, so we create a new one with an updated logEntryRowNumber...
        final LogConfigurationData logConfigurationDataNew = new LogConfigurationData(0, new LogConfiguration());
        logConfigurationDataNew.setLogEntryRowNumber(1);
        entityManager.persist(logConfigurationDataNew);
        // ...and return 0, since we know that this is the first anyone has asked for.
        return 0;
      } else {
          // Try an atomic UPDATE of the logEntryRowNumber based on what we just read
View Full Code Here

     */
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  @Override
  public void saveLogConfiguration(int caid, LogConfiguration logConfiguration, boolean updateCache) {
    try {
          final LogConfigurationData lcd = LogConfigurationData.findByPK(entityManager, Integer.valueOf(caid));
          if (lcd == null) {
            LOG.info(INTRES.getLocalizedMessage("log.createconf", Integer.valueOf(caid)));
            entityManager.persist(new LogConfigurationData(caid, logConfiguration));
          } else {
            lcd.saveLogConfiguration(logConfiguration);
          }
          if (updateCache) {
          logConfCache.put(Integer.valueOf(caid), logConfiguration);
          }
    } catch (Exception e) {
View Full Code Here

  }

  public void testLogConfigurationData() {
    LOG.trace(">testLogConfigurationData");
    logMemStats();
    LogConfigurationData entity = new LogConfigurationData();
    entity.setId(BOGUS_INTEGER);
    entity.setLogConfigurationUnsafe(new LogConfiguration(false, false, HASHMAP_200K));
    entity.setLogEntryRowNumber(0);
    entity.setRowProtection(CLOB_10KiB);
    entity.setRowVersion(0);
    storeAndRemoveEntity(entity);
    LOG.trace("<testLogConfigurationData");
  }
View Full Code Here

TOP

Related Classes of org.ejbca.core.ejb.log.LogConfigurationData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.