@Override public void setValue(Owner target, Collection<Type> o) throws Exception { getValue(target).replaceBy(o); }
@Override public void setValue(Owner target, Collection<Type> o) throws Exception { getValue(target).replaceBy(o); }
if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e);
private UpdateCenter configureUpdateSites(Mapping map, Jenkins jenkins, ConfigurationContext context) throws ConfiguratorException { final CNode sites = map.get("sites"); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); if (sites != null) { Configurator<UpdateSite> usc = context.lookup(UpdateSite.class); List<UpdateSite> updateSites = new ArrayList<>(); for (CNode data : sites.asSequence()) { UpdateSite in = usc.configure(data, context); if (in.isDue()) { in.updateDirectly(DownloadService.signatureCheck); } updateSites.add(in); } try { updateCenter.getSites().replaceBy(updateSites); } catch (IOException e) { throw new ConfiguratorException("failed to reconfigure updateCenter.sites", e); } } return updateCenter; }
@Override public void setValue(Owner target, Collection<Type> o) throws Exception { getValue(target).replaceBy(o); }
@Override public void setValue(Owner target, Collection<Type> o) throws Exception { getValue(target).replaceBy(o); }
private UpdateCenter configureUpdateSites(Mapping map, Jenkins jenkins, ConfigurationContext context) throws ConfiguratorException { final CNode sites = map.get("sites"); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); if (sites != null) { Configurator<UpdateSite> usc = context.lookup(UpdateSite.class); List<UpdateSite> updateSites = new ArrayList<>(); for (CNode data : sites.asSequence()) { UpdateSite in = usc.configure(data, context); if (in.isDue()) { in.updateDirectly(DownloadService.signatureCheck); } updateSites.add(in); } try { updateCenter.getSites().replaceBy(updateSites); } catch (IOException e) { throw new ConfiguratorException("failed to reconfigure updateCenter.sites", e); } } return updateCenter; }
if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e);
/** * Loads the data from the disk into this object. */ public synchronized void load() throws IOException { UpdateSite defaultSite = new UpdateSite("default", config.getUpdateCenterUrl() + "update-center.json"); XmlFile file = getConfigFile(); if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } for (UpdateSite site : sites) { // replace the legacy site with the new site if (site.isLegacyDefault()) { sites.remove(site); sites.add(defaultSite); break; } } } else { if (sites.isEmpty()) { // If there aren't already any UpdateSources, add the default one. // to maintain compatibility with existing UpdateCenterConfiguration, create the default one as specified by UpdateCenterConfiguration sites.add(defaultSite); } } }
/** * Loads the data from the disk into this object. */ public synchronized void load() throws IOException { UpdateSite defaultSite = new UpdateSite("default", config.getUpdateCenterUrl() + "update-center.json"); XmlFile file = getConfigFile(); if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } for (UpdateSite site : sites) { // replace the legacy site with the new site if (site.isLegacyDefault()) { sites.remove(site); sites.add(defaultSite); break; } } } else { if (sites.isEmpty()) { // If there aren't already any UpdateSources, add the default one. // to maintain compatibility with existing UpdateCenterConfiguration, create the default one as specified by UpdateCenterConfiguration sites.add(defaultSite); } } }
/** * Loads the data from the disk into this object. */ public synchronized void load() throws IOException { UpdateSite defaultSite = new UpdateSite("default", config.getUpdateCenterUrl()); XmlFile file = getConfigFile(); if (file.exists()) { try { sites.replaceBy(((PersistedList) file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load " + file, e); } for (UpdateSite site : sites) { // replace the legacy site with the new site if (site.isLegacyDefault()) { sites.remove(site); sites.add(defaultSite); break; } } } else { if (sites.isEmpty()) { // If there aren't already any UpdateSources, add the default one. // to maintain compatibility with existing UpdateCenterConfiguration, create the default one as specified by UpdateCenterConfiguration sites.add(defaultSite); } } }
/** * Loads the data from the disk into this object. */ public synchronized void load() throws IOException { UpdateSite defaultSite = new UpdateSite("default", config.getUpdateCenterUrl() + "update-center.json"); XmlFile file = getConfigFile(); if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } for (UpdateSite site : sites) { // replace the legacy site with the new site if (site.isLegacyDefault()) { sites.remove(site); sites.add(defaultSite); break; } } } else { if (sites.isEmpty()) { // If there aren't already any UpdateSources, add the default one. // to maintain compatibility with existing UpdateCenterConfiguration, create the default one as specified by UpdateCenterConfiguration sites.add(defaultSite); } } }