コード例 #1
0
 /**
  * Returns the StatisticUpdateManager bean (created via spring)
  *
  * @return the StatisticUpdateManager bean (created via spring)
  */
 private StatisticUpdateService getStatisticUpdateManager() {
   if (CoreSpringFactory.containsBean(StatisticUpdateService.class)) {
     return (StatisticUpdateService) CoreSpringFactory.getBean(StatisticUpdateService.class);
   } else {
     return null;
   }
 }
コード例 #2
0
  private void refreshUIState() {
    boolean enabled = false;
    String cronExpression = "";
    if (CoreSpringFactory.containsBean("schedulerFactoryBean")) {
      log.info("refreshUIState: schedulerFactoryBean found");
      final Object schedulerFactoryBean = CoreSpringFactory.getBean("schedulerFactoryBean");
      if (schedulerFactoryBean != null && schedulerFactoryBean instanceof Scheduler) {
        final Scheduler schedulerBean = (Scheduler) schedulerFactoryBean;
        int triggerState;
        try {
          triggerState =
              schedulerBean.getTriggerState("updateStatisticsTrigger", null /* trigger group */);
          enabled = (triggerState != Trigger.STATE_NONE) && (triggerState != Trigger.STATE_ERROR);
          log.info(
              "refreshUIState: updateStatisticsTrigger state was "
                  + triggerState
                  + ", enabled now: "
                  + enabled);
        } catch (final SchedulerException e) {
          log.warn(
              "refreshUIState: Got a SchedulerException while asking for the updateStatisticsTrigger's state",
              e);
        }
      }
      final CronTriggerBean triggerBean =
          (CronTriggerBean) CoreSpringFactory.getBean("updateStatisticsTrigger");
      final JobDetail jobDetail = triggerBean.getJobDetail();
      enabled &= jobDetail.getName().equals("statistics.job.enabled");
      log.info("refreshUIState: statistics.job.enabled check, enabled now: " + enabled);
      cronExpression = triggerBean.getCronExpression();
      final StatisticUpdateService statisticUpdateManager = getStatisticUpdateManager();
      if (statisticUpdateManager == null) {
        log.info("refreshUIState: statisticUpdateManager not configured");
        enabled = false;
      } else {
        enabled &= statisticUpdateManager.isEnabled();
        log.info("refreshUIState: statisticUpdateManager configured, enabled now: " + enabled);
      }
    } else {
      log.info("refreshUIState: schedulerFactoryBean not found");
    }
    if (enabled) {
      content.contextPut(
          "status",
          getTranslator().translate("statistics.status.enabled", new String[] {cronExpression}));
    } else {
      content.contextPut("status", getTranslator().translate("statistics.status.disabled"));
    }
    content.contextPut("statisticEnabled", enabled);

    recalcLastUpdated();

    updateStatisticUpdateOngoingFlag();
  }
コード例 #3
0
ファイル: AuthBFWCParts.java プロジェクト: YaqubGhazi/olat
 @Override
 public Controller createHeaderController(final UserRequest ureq, final WindowControl wControl) {
   Controller headerCtr = null;
   // ----------- header, optional (e.g. for logo, advertising ) ------------------
   if (CoreSpringFactory.containsBean("fullWebApp.HeaderControllerCreator")) {
     final ControllerCreator headerControllerCreator =
         (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.HeaderControllerCreator");
     headerCtr = headerControllerCreator.createController(ureq, wControl);
   }
   return headerCtr;
 }
コード例 #4
0
ファイル: AuthBFWCParts.java プロジェクト: YaqubGhazi/olat
 @Override
 public Controller createTopNavController(final UserRequest ureq, final WindowControl wControl) {
   Controller topnavCtr = null;
   // ----------- topnav, optional (e.g. for imprint, logout) ------------------
   if (CoreSpringFactory.containsBean("fullWebApp.TopNavControllerCreator")) {
     final ControllerCreator topnavControllerCreator =
         (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.TopNavControllerCreator");
     topnavCtr = topnavControllerCreator.createController(ureq, wControl);
   }
   return topnavCtr;
 }
コード例 #5
0
ファイル: AuthBFWCParts.java プロジェクト: YaqubGhazi/olat
 @Override
 public Controller createFooterController(final UserRequest ureq, final WindowControl wControl) {
   Controller footerCtr = null;
   // ----------- footer, optional (e.g. for copyright, powerd by) ------------------
   if (CoreSpringFactory.containsBean("fullWebApp.FooterControllerCreator")) {
     final ControllerCreator footerCreator =
         (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.FooterControllerCreator");
     footerCtr = footerCreator.createController(ureq, wControl);
   }
   return footerCtr;
 }