001package org.nuxeo.ecm.core.scheduler; 002 003import java.util.Collection; 004 005import org.nuxeo.runtime.model.SimpleContributionRegistry; 006 007public class ScheduleExtensionRegistry extends SimpleContributionRegistry<Schedule> { 008 009 @Override 010 public String getContributionId(Schedule contrib) { 011 return contrib.getId(); 012 } 013 014 @Override 015 public void contributionUpdated(String id, Schedule contrib, Schedule newOrigContrib) { 016 if (contrib.isEnabled()) { 017 currentContribs.put(id, contrib); 018 } else { 019 currentContribs.remove(id); 020 } 021 } 022 023 protected Collection<Schedule> getSchedules() { 024 return currentContribs.values(); 025 } 026 027 protected Schedule getSchedule(Schedule schedule) { 028 return currentContribs.get(getContributionId(schedule)); 029 } 030 031 protected Schedule getSchedule(String id) { 032 return currentContribs.get(id); 033 } 034}