hudson.model.User.getConfigFile()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中hudson.model.User.getConfigFile()方法的一些代码示例,展示了User.getConfigFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。User.getConfigFile()方法的具体详情如下:
包路径:hudson.model.User
类名称:User
方法名:getConfigFile

User.getConfigFile介绍

[英]The file we save our configuration.
[中]我们保存配置的文件。

代码示例

代码示例来源:origin: jenkinsci/jenkins

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);
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Save the settings to a file.
 */
public synchronized void save() throws IOException {
  if(BulkChange.contains(this))   return;
  getConfigFile().write(this);
  SaveableListener.fireOnChange(this, getConfigFile());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Save the settings to a file.
 */
public synchronized void save() throws IOException {
  if(BulkChange.contains(this))   return;
  getConfigFile().write(this);
  SaveableListener.fireOnChange(this, getConfigFile());
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Save the settings to a file.
 */
public synchronized void save() throws IOException {
  if(BulkChange.contains(this))   return;
  getConfigFile().write(this);
  SaveableListener.fireOnChange(this, getConfigFile());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Save the settings to a file.
 */
public synchronized void save() throws IOException {
  if (BulkChange.contains(this)) {
    return;
  }
  getConfigFile().write(this);
  SaveableListener.fireOnChange(this, getConfigFile());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the {@link User} object by its id or full name.
 *
 * @param create If true, this method will never return null for valid input
 * (by creating a new {@link User} object if none exists.) If false, this
 * method will return null if {@link User} object with the given name
 * doesn't exist.
 */
public static User get(String idOrFullName, boolean create) {
  if (idOrFullName == null) {
    return null;
  }
  String id = idOrFullName.replace('\\', '_').replace('/', '_').replace('<', '_')
      .replace('>', '_');  // 4 replace() still faster than regex
  if (Functions.isWindows()) {
    id = id.replace(':', '_');
  }
  synchronized (byName) {
    User u = byName.get(id);
    if (null == u) {
      User tmp = new User(id, idOrFullName);
      if (create || tmp.getConfigFile().exists()) {
        byName.put(id, u = tmp);
      }
    }
    return u;
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the {@link User} object by its id or full name.
 *
 * @param create
 *      If true, this method will never return null for valid input
 *      (by creating a new {@link User} object if none exists.)
 *      If false, this method will return null if {@link User} object
 *      with the given name doesn't exist.
 */
public static User get(String idOrFullName, boolean create) {
  if(idOrFullName==null)
    return null;
  String id = idOrFullName.replace('\\', '_').replace('/', '_').replace('<','_')
              .replace('>','_');  // 4 replace() still faster than regex
  if (Functions.isWindows()) id = id.replace(':','_');
  synchronized (byName) {
    User u = byName.get(id);
    if (null == u) {
      User tmp = new User(id, idOrFullName);
      if (create || tmp.getConfigFile().exists()) {
        byName.put(id, u = tmp);
      }
    }
    return u;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the {@link User} object by its id or full name.
 *
 * @param create
 *      If true, this method will never return null for valid input
 *      (by creating a new {@link User} object if none exists.)
 *      If false, this method will return null if {@link User} object
 *      with the given name doesn't exist.
 */
public static User get(String idOrFullName, boolean create) {
  if(idOrFullName==null)
    return null;
  String id = idOrFullName.replace('\\', '_').replace('/', '_').replace('<','_')
              .replace('>','_');  // 4 replace() still faster than regex
  if (Functions.isWindows()) id = id.replace(':','_');
  synchronized (byName) {
    User u = byName.get(id);
    if (null == u) {
      User tmp = new User(id, idOrFullName);
      if (create || tmp.getConfigFile().exists()) {
        byName.put(id, u = tmp);
      }
    }
    return u;
  }
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the {@link User} object by its id or full name.
 *
 * @param create
 *      If true, this method will never return null for valid input
 *      (by creating a new {@link User} object if none exists.)
 *      If false, this method will return null if {@link User} object
 *      with the given name doesn't exist.
 */
public static User get(String idOrFullName, boolean create) {
  if(idOrFullName==null)
    return null;
  String id = idOrFullName.replace('\\', '_').replace('/', '_').replace('<','_')
              .replace('>','_');  // 4 replace() still faster than regex
  if (Functions.isWindows()) id = id.replace(':','_');
  synchronized (byName) {
    User u = byName.get(id);
    if (null == u) {
      User tmp = new User(id, idOrFullName);
      if (create || tmp.getConfigFile().exists()) {
        byName.put(id, u = tmp);
      }
    }
    return u;
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Save the settings to a file.
 */
public synchronized void save() throws IOException, FormValidation {
  if (! isIdOrFullnameAllowed(id)) {
    throw FormValidation.error(Messages.User_IllegalUsername(id));
  }
  if (! isIdOrFullnameAllowed(fullName)) {
    throw FormValidation.error(Messages.User_IllegalFullname(fullName));
  }
  if(BulkChange.contains(this))   return;
  getConfigFile().write(this);
  SaveableListener.fireOnChange(this, getConfigFile());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Loads the other data from disk if it's available.
 */
private synchronized void load() {
  properties.clear();
  XmlFile config = getConfigFile();
  try {
    if(config.exists())
      config.unmarshal(this);
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
  }
  // remove nulls that have failed to load
  for (Iterator<UserProperty> itr = properties.iterator(); itr.hasNext();) {
    if(itr.next()==null)
      itr.remove();            
  }
  // allocate default instances if needed.
  // doing so after load makes sure that newly added user properties do get reflected
  for (UserPropertyDescriptor d : UserProperty.all()) {
    if(getProperty(d.clazz)==null) {
      UserProperty up = d.newInstance(this);
      if(up!=null)
        properties.add(up);
    }
  }
  for (UserProperty p : properties)
    p.setUser(this);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Loads the other data from disk if it's available.
 */
private synchronized void load() {
  properties.clear();
  XmlFile config = getConfigFile();
  try {
    if(config.exists())
      config.unmarshal(this);
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
  }
  // remove nulls that have failed to load
  for (Iterator<UserProperty> itr = properties.iterator(); itr.hasNext();) {
    if(itr.next()==null)
      itr.remove();            
  }
  // allocate default instances if needed.
  // doing so after load makes sure that newly added user properties do get reflected
  for (UserPropertyDescriptor d : UserProperty.all()) {
    if(getProperty(d.clazz)==null) {
      UserProperty up = d.newInstance(this);
      if(up!=null)
        properties.add(up);
    }
  }
  for (UserProperty p : properties)
    p.setUser(this);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Loads the other data from disk if it's available.
 */
private synchronized void load() {
  properties.clear();
  XmlFile config = getConfigFile();
  try {
    if(config.exists())
      config.unmarshal(this);
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
  }
  // remove nulls that have failed to load
  for (Iterator<UserProperty> itr = properties.iterator(); itr.hasNext();) {
    if(itr.next()==null)
      itr.remove();            
  }
  // allocate default instances if needed.
  // doing so after load makes sure that newly added user properties do get reflected
  for (UserPropertyDescriptor d : UserProperty.all()) {
    if(getProperty(d.clazz)==null) {
      UserProperty up = d.newInstance(this);
      if(up!=null)
        properties.add(up);
    }
  }
  for (UserProperty p : properties)
    p.setUser(this);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Loads the other data from disk if it's available.
 */
private synchronized void load() {
  properties.clear();
  XmlFile config = getConfigFile();
  try {
    if(config.exists())
      config.unmarshal(this);
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
  }
  // remove nulls that have failed to load
  for (Iterator<UserProperty> itr = properties.iterator(); itr.hasNext();) {
    if(itr.next()==null)
      itr.remove();            
  }
  // allocate default instances if needed.
  // doing so after load makes sure that newly added user properties do get reflected
  for (UserPropertyDescriptor d : UserProperty.all()) {
    if(getProperty(d.clazz)==null) {
      UserProperty up = d.newInstance(this);
      if(up!=null)
        properties.add(up);
    }
  }
  for (UserProperty p : properties)
    p.setUser(this);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

properties.clear();
XmlFile config = getConfigFile();
try {
  if (config.exists()) {

相关文章