@LifecycleHandlerType(LifecycleLevel.LOAD_CATALOG)
  public synchronized void loadConfig() throws ServiceException {
    if (!isConfigLoaded) {
      try {
        final URI u = new URI(properties.getConfigURI());
        overdueConfig = XMLLoader.getObjectFromUri(u, OverdueConfig.class);
        // File not found?
        if (overdueConfig == null) {
          log.warn("Unable to load the overdue config from " + properties.getConfigURI());
          overdueConfig = new OverdueConfig();
        }

        isConfigLoaded = true;
      } catch (final URISyntaxException e) {
        overdueConfig = new OverdueConfig();
      } catch (final IllegalArgumentException e) {
        overdueConfig = new OverdueConfig();
      } catch (final Exception e) {
        throw new ServiceException(e);
      }

      factory.setOverdueConfig(overdueConfig);
      ((DefaultOverdueUserApi) userApi).setOverdueConfig(overdueConfig);
    }
  }
Example #2
0
 public void processOverdue(final UUID blockableId) {
   try {
     factory.createOverdueWrapperFor(blockableId).refresh();
   } catch (OverdueError e) {
     log.error("Error processing Overdue for Blockable with id: " + blockableId.toString(), e);
   } catch (OverdueApiException e) {
     log.error("Error processing Overdue for Blockable with id: " + blockableId.toString(), e);
   }
 }