public boolean hasExistingConfigFile(){ return getConfigFile().exists(); }
@VisibleForTesting static @CheckForNull ApiTokenStats internalLoad(@Nonnull File userFolder) { ApiTokenStats apiTokenStats = null; XmlFile statsFile = getConfigFile(userFolder); if (statsFile.exists()) { try { apiTokenStats = (ApiTokenStats) statsFile.unmarshal(ApiTokenStats.class); apiTokenStats.parent = userFolder; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load " + statsFile, e); } } return apiTokenStats; }
private void loadFromUserConfigFile(String userId) { XmlFile config = getConfigFile(); try { if ( config != null && config.exists()) { config.unmarshal(this); this.id = userId; } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to load " + config, e); } }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
/** * Loads serializable fields of this instance from the persisted storage. * * <p> * If there was no previously persisted state, this method is no-op. * * @since 1.245 */ protected void load() throws IOException { XmlFile xml = getConfigXml(); if(xml.exists()) xml.unmarshal(this); }
/** * Loads the data from the disk into this object. * * <p> * The constructor of the derived class must call this method. * (If we do that in the base class, the derived class won't * get a chance to set default values.) */ public synchronized void load() { XmlFile file = getConfigFile(); if(!file.exists()) return; try { file.unmarshal(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } }
public void run(Reactor session) throws Exception { if(!Items.getConfigFile(subdir).exists()) { //Does not have job config file, so it is not a jenkins job hence skip it return; } TopLevelItem item = (TopLevelItem) Items.load(Jenkins.this, subdir); items.put(item.getName(), item); loadedNames.add(item.getName()); } }));
/*package*/ static @CheckForNull Fingerprint load(@Nonnull File file) throws IOException { XmlFile configFile = getConfigFile(file); if(!configFile.exists()) return null;
public void load() { XmlFile file = getConfigFile(); if(file.exists()) { try { file.unmarshal(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } } properties.setOwner(this); updateTransientActions(); }
private void loadConfig() throws IOException { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Jenkins.this); } try { checkRawBuildsDir(buildsDir); setBuildsAndWorkspacesDir(); } catch (InvalidBuildsDir invalidBuildsDir) { throw new IOException(invalidBuildsDir); } }
try { XmlFile xmlFile = new XmlFile(Jenkins.XSTREAM, new File(subdir, "config.xml")); if (xmlFile.exists()) { Node node = (Node) xmlFile.read(); newNodes.put(node.getNodeName(), node);
if (item == null) { XmlFile xmlFile = Items.getConfigFile(subdir); if (xmlFile.exists()) { item = (V) Items.load(parent, subdir); } else {
@Override public synchronized void load() { // for backward compatibility, if we don't have our own data yet, then // load from Mailer. XmlFile file = getConfigFile(); if(!file.exists()) { XStream2 xs = new XStream2(); xs.addCompatibilityAlias("hudson.tasks.Mailer$DescriptorImpl",JenkinsLocationConfiguration.class); file = new XmlFile(xs,new File(Jenkins.get().getRootDir(),"hudson.tasks.Mailer.xml")); if (file.exists()) { try { file.unmarshal(this); if (jenkinsUrl==null) jenkinsUrl = hudsonUrl; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } } } else { super.load(); } updateSecureSessionFlag(); }
if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList());
@Override public boolean accept(File child) { if (!initializingTeam && !jobNames.contains(child.getName())) { return false; } return child.isDirectory() && Items.getConfigFile(child).exists(); } });
private void loadConfig() throws IOException { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Jenkins.this); } }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
public void run(Reactor session) throws Exception { if(!Items.getConfigFile(subdir).exists()) { //Does not have job config file, so it is not a jenkins job hence skip it return; } TopLevelItem item = (TopLevelItem) Items.load(Jenkins.this, subdir); items.put(item.getName(), item); loadedNames.add(item.getName()); } });
public void load() throws IOException { XmlFile xml = getConfigXml(trigger.getActualProject()); if (xml.exists()) { xml.unmarshal(this); } save(); }