@Override public boolean isRecoveryEnabled(final ApplicationUser user) { try { return serviceManager.getServiceWithName(IndexSnapshotService.getServiceName()) != null; } catch (Exception e) { return false; } }
public void doUpgrade() throws FishEyeUpgradeException { try { if (serviceManager.getServiceWithName(SERVICE_NAME) != null) { try { log.info("Removing old " + SERVICE_NAME); serviceManager.removeServiceByName(SERVICE_NAME); serviceManager.refreshAll(); } catch (Exception e) { log.error("Exception encountered whilst trying to remove service '" + SERVICE_NAME + "'", e); } } } catch (Exception e) { log.error("Error resolving service with name " + SERVICE_NAME, e); } }
/** * Creates a new IndexCleaning service if it doesn't exist. */ public void createIndexCleaningServiceIfNeeded(final I18nHelper i18n) { try { final String serviceName = i18n.getText(SERVICE_NAME_KEY); if (serviceManager.getServiceWithName(serviceName) == null) { final Map<String, String[]> params = new HashMap<String, String[]>(2); params.put(ReplicatedIndexCleaningService.RETENTION_PERIOD, new String[] { DEFAULT_RETENTION_MINS }); serviceManager.addService(serviceName, ReplicatedIndexCleaningService.class.getName(), DELAY, params); } } catch (final Exception e) // intentionally catching RuntimeException as well { LOG.error(i18nHelper.getText("admin.errors.setup.error.adding.service", e.toString())); } }
/** * Creates a new ClusterMessageCleaningCleaning service if it doesn't exist. */ public void createClusterMessageCleaningServiceIfNeeded(final I18nHelper i18n) { try { final String serviceName = i18n.getText(SERVICE_NAME_KEY); if (serviceManager.getServiceWithName(serviceName) == null) { final Map<String, String[]> params = new HashMap<String, String[]>(2); params.put(ClusterMessageCleaningService.RETENTION_PERIOD, new String[] { DEFAULT_RETENTION_MINS }); serviceManager.addService(serviceName, ClusterMessageCleaningService.class.getName(), DELAY, params); } } catch (final Exception e) // intentionally catching RuntimeException as well { LOG.error(i18nHelper.getText("admin.errors.setup.error.adding.service", e.toString())); } }
/** * Creates a new Node State Checker service if it doesn't exist. */ public void createNodeCheckerServiceIfNeeded(final I18nHelper i18n) { try { final String serviceName = i18n.getText(SERVICE_NAME_KEY); if (serviceManager.getServiceWithName(serviceName) == null) { final Map<String, String[]> params = new HashMap<String, String[]>(0); serviceManager.addService(serviceName, NodeStateCheckerService.class.getName(), DELAY, params); } } catch (final Exception e) // intentionally catching RuntimeException as well { LOG.error(i18nHelper.getText("admin.errors.setup.error.adding.service", e.toString())); } } }
public Collection<Message> doUpgrade() throws Exception { JiraServiceContainer serviceContainer; while ((serviceContainer = serviceManager.getServiceWithName(USER_COUNTER_SERVICE))!=null) { log.info("Removing " + serviceContainer.getName()); serviceManager.removeService(serviceContainer.getId()); } return null; }
public Collection<Message> doUpgrade() throws Exception { JiraServiceContainer dailyBackupsService; while ((dailyBackupsService = serviceManager.getServiceWithName(DAILY_BACKUPS))!=null) { log.info("Removing " + dailyBackupsService.getName()); serviceManager.removeService(dailyBackupsService.getId()); } return null; }
@Override public String getSnapshotCronExpression(final ApplicationUser user) { try { final JiraServiceContainer service = serviceManager.getServiceWithName(IndexSnapshotService.getServiceName()); if (service != null) { return service.getCronExpression(); } return null; } catch (Exception e) { return null; } } }
/** * Creates a new Backup service, or updates an already existing one with the parameters supplied. */ public void createOrUpdateBackupService(final I18nHelper i18n, final String backupPath) { try { final Map<String, String[]> params = new HashMap<String, String[]>(); params.put(ExportService.USE_DEFAULT_DIRECTORY, new String[] { "true" }); final String serviceName = geti18nTextWithDefault(i18n, SERVICE_NAME_KEY, "Backup Service"); if (serviceManager.getServiceWithName(serviceName) == null) { serviceManager.addService(serviceName, ExportService.class.getName(), DELAY, params); } else { serviceManager.editServiceByName(serviceName, DELAY, params); } getApplicationProperties().setString(APKeys.JIRA_PATH_BACKUP, backupPath); } catch (final Exception e) // intentionally catching RuntimeException as well { log.error("Error creating backup service", e); addErrorMessage(getText("admin.errors.setup.error.adding.service", e.toString())); } }
@Override public void updateRecoverySettings(final ApplicationUser user, final boolean recoveryEnabled, final String cronExpression) throws Exception { JiraServiceContainer service = serviceManager.getServiceWithName(IndexSnapshotService.getServiceName()); if (permissionManager.hasPermission(Permissions.SYSTEM_ADMIN, user)) { if (recoveryEnabled) { if (service == null) { serviceManager.addService(IndexSnapshotService.getServiceName(), IndexSnapshotService.class, cronExpression); } else { serviceManager.editService(service.getId(), cronExpression, Collections.<String, String[]>emptyMap()); } } else { if (service != null) { serviceManager.removeService(service.getId()); } } eventPublisher.publish(new IndexRecoveryEnabledEvent(recoveryEnabled)); } }