public Collection<JiraServiceContainer> getServices() { return manager.getServices(); }
public Collection<JiraServiceContainer> getServices() { final Collection<JiraServiceContainer> services = new TreeSet<>(JiraService.NAME_COMPARATOR); services.addAll(serviceManager.getServices()); return services; }
/** * Gets all the currently registered services with JIRA. * * @return Unmodifiable collection of {@link com.atlassian.jira.service.JiraServiceContainer} * @see com.atlassian.jira.service.ServiceManager#getServices() */ protected Collection<JiraServiceContainer> getServices() { return ComponentAccessor.getComponent(ServiceManager.class).getServices(); }
/** * Only call AFTER JIRA is fully up! */ public void obtainServices() { final ServiceManager serviceManager = ComponentAccessor.getComponentOfType(ServiceManager.class); final Collection<JiraServiceContainer> services = new TreeSet<>(JiraService.NAME_COMPARATOR); services.addAll(serviceManager.getServices()); logMsg.outputHeader("Services"); logMsg.outputProperty("Instance Count", String.valueOf(services.size())); logMsg.add(""); services.forEach(this::printServiceInfo); }
public void unscheduleJob(final String name) { // Remove the service if it exists. We use getServices() rather than // getServiceWithName() because there was // a bug where multiple services with the same name were being // created. getServiceWithName() will throw an // exception in that circumstance, so we'll just iterate through // them all and delete all the ones that have // a matching name. Collection<JiraServiceContainer> services = serviceManager.getServices(); // We have to copy the services into a second map, otherwise after // deleting one, we get a // ConcurrentModificationException services = new HashSet<JiraServiceContainer>(services); for (final JiraServiceContainer service : services) { if (name.equals(service.getName())) { try { serviceManager.removeService(service.getId()); } catch (final Exception e) { log.error("Error removing service to jira", e); } } } }
public void removeServicesByName(final String name) { // We use getServices() rather than getServiceWithName() because there was // a bug where multiple services with the same name were being created. getServiceWithName() will throw an // exception in that circumstance, so we'll just iterate through them all and delete all the ones that have // a matching name. final Collection<JiraServiceContainer> servicesToRemove = new ArrayList<JiraServiceContainer>(); final Collection<JiraServiceContainer> services = serviceManager.getServices(); for (final JiraServiceContainer service : services) { if (name.equals(service.getName())) { servicesToRemove.add(service); } } // remove services for (final JiraServiceContainer service : servicesToRemove) { try { serviceManager.removeService(service.getId()); } catch (final Exception e) { log.error("Error removing service "+service.getName()+" ("+service.getId()+") from jira", e); } } } }
Collection<JiraServiceContainer> services = serviceManager.getServices();
/** * Also refresh when the plugin is enabled, installed or updated. * @param event */ @EventListener public void onPluginEnabled(PluginEnabledEvent event) { if (event.getPlugin().getKey().equals("com.atlassian.jirafisheyeplugin")) { // when this event occurs during startup, we can't init the plugin, because JIRA isn't started yet, // which is OK, because we'll get a JiraStatedEvent later. If the plugin has been manually installed, // the init has to happen here, because there won't be a JiraStartedEvent, so we check to see if JIRA // has been started. try { serviceManager.getServices(); } catch (IllegalStateException e) { // expected if JIRA is not started return; } eventPublisher.publish(new JiraFisheyeStartRefreshEvent()); refreshAll(); } }
for (final JiraServiceContainer service : serviceManager.getServices())