本文整理了Java中hudson.model.User.getRootDir()
方法的一些代码示例,展示了User.getRootDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。User.getRootDir()
方法的具体详情如下:
包路径:hudson.model.User
类名称:User
方法名:getRootDir
[英]Gets the directory where Hudson stores user information.
[中]获取Hudson存储用户信息的目录。
代码示例来源:origin: jenkinsci/jenkins
protected File getUsersDirectory() {
return User.getRootDir();
}
代码示例来源:origin: jenkinsci/jenkins
private static File getUserFolderFor(String id){
return new File(getRootDir(), idStrategy().filenameOf(id));
}
/**
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private static final File[] getLegacyConfigFilesFor(final String id) {
return getRootDir().listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && new File(pathname, "config.xml").isFile() && idStrategy().equals(
pathname.getName(), id);
}
});
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Deletes the data directory and removes this user from Hudson.
*
* @throws IOException if we fail to delete.
*/
public synchronized void delete() throws IOException {
synchronized (byName) {
byName.remove(id);
Util.deleteRecursive(new File(getRootDir(), id));
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Deletes the data directory and removes this user from Hudson.
*
* @throws IOException
* if we fail to delete.
*/
public synchronized void delete() throws IOException {
synchronized (byName) {
byName.remove(id);
Util.deleteRecursive(new File(getRootDir(), id));
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* The file we save our configuration.
*/
protected final XmlFile getConfigFile() {
return new XmlFile(XSTREAM,new File(getRootDir(),id +"/config.xml"));
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* The file we save our configuration.
*/
protected final XmlFile getConfigFile() {
return new XmlFile(XSTREAM,new File(getRootDir(),id +"/config.xml"));
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Deletes the data directory and removes this user from Hudson.
*
* @throws IOException
* if we fail to delete.
*/
public synchronized void delete() throws IOException {
synchronized (byName) {
byName.remove(id);
Util.deleteRecursive(new File(getRootDir(), id));
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Deletes the data directory and removes this user from Hudson.
*
* @throws IOException
* if we fail to delete.
*/
public synchronized void delete() throws IOException {
synchronized (byName) {
byName.remove(id);
Util.deleteRecursive(new File(getRootDir(), id));
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* The file we save our configuration.
*/
protected final XmlFile getConfigFile() {
return new XmlFile(XSTREAM, new File(getRootDir(), id + "/config.xml"));
}
代码示例来源:origin: hudson/hudson-2.x
/**
* The file we save our configuration.
*/
protected final XmlFile getConfigFile() {
return new XmlFile(XSTREAM,new File(getRootDir(),id +"/config.xml"));
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* With ADMINISTER permission, can delete users with persisted data but
* can't delete self.
*/
public boolean canDelete() {
return hasPermission(Hudson.ADMINISTER) && !id.equals(HudsonSecurityManager.getAuthentication().getName())
&& new File(getRootDir(), id).exists();
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Gets all the users.
*/
public static Collection<User> getAll() {
if(System.currentTimeMillis() -lastScanned>10000) {
// occasionally scan the file system to check new users
// whether we should do this only once at start up or not is debatable.
// set this right away to avoid another thread from doing the same thing while we do this.
// having two threads doing the work won't cause race condition, but it's waste of time.
lastScanned = System.currentTimeMillis();
File[] subdirs = getRootDir().listFiles((FileFilter)DirectoryFileFilter.INSTANCE);
if(subdirs==null) return Collections.emptyList(); // shall never happen
for (File subdir : subdirs)
if(new File(subdir,"config.xml").exists())
User.get(subdir.getName());
lastScanned = System.currentTimeMillis();
}
synchronized (byName) {
return new ArrayList<User>(byName.values());
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Gets all the users.
*/
public static Collection<User> getAll() {
if(System.currentTimeMillis() -lastScanned>10000) {
// occasionally scan the file system to check new users
// whether we should do this only once at start up or not is debatable.
// set this right away to avoid another thread from doing the same thing while we do this.
// having two threads doing the work won't cause race condition, but it's waste of time.
lastScanned = System.currentTimeMillis();
File[] subdirs = getRootDir().listFiles((FileFilter)DirectoryFileFilter.INSTANCE);
if(subdirs==null) return Collections.emptyList(); // shall never happen
for (File subdir : subdirs)
if(new File(subdir,"config.xml").exists())
User.get(subdir.getName());
lastScanned = System.currentTimeMillis();
}
synchronized (byName) {
return new ArrayList<User>(byName.values());
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* With ADMINISTER permission, can delete users with persisted data but can't delete self.
*/
public boolean canDelete() {
return hasPermission(Hudson.ADMINISTER) && !id.equals(Hudson.getAuthentication().getName())
&& new File(getRootDir(), id).exists();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* With ADMINISTER permission, can delete users with persisted data but can't delete self.
*/
public boolean canDelete() {
return hasPermission(Hudson.ADMINISTER) && !id.equals(Hudson.getAuthentication().getName())
&& new File(getRootDir(), id).exists();
}
代码示例来源:origin: hudson/hudson-2.x
/**
* With ADMINISTER permission, can delete users with persisted data but can't delete self.
*/
public boolean canDelete() {
return hasPermission(Hudson.ADMINISTER) && !id.equals(Hudson.getAuthentication().getName())
&& new File(getRootDir(), id).exists();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private static final File getConfigFileFor(String id) {
return new File(getRootDir(), idStrategy().filenameOf(id) +"/config.xml");
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Deletes the data directory and removes this user from Hudson.
*
* @throws IOException
* if we fail to delete.
*/
public synchronized void delete() throws IOException {
final IdStrategy strategy = idStrategy();
byNameLock.readLock().lock();
try {
AllUsers.byName().remove(strategy.keyFor(id));
} finally {
byNameLock.readLock().unlock();
}
Util.deleteRecursive(new File(getRootDir(), strategy.filenameOf(id)));
UserDetailsCache.get().invalidate(strategy.keyFor(id));
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* With ADMINISTER permission, can delete users with persisted data but can't delete self.
*/
public boolean canDelete() {
final IdStrategy strategy = idStrategy();
return hasPermission(Jenkins.ADMINISTER) && !strategy.equals(id, Jenkins.getAuthentication().getName())
&& new File(getRootDir(), strategy.filenameOf(id)).exists();
}
内容来源于网络,如有侵权,请联系作者删除!