热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

hudson.XmlFile.getFile()方法的使用及代码示例

本文整理了Java中hudson.XmlFile.getFile()方法的一些代码示例,展示了XmlFile.getFile()的具体用法。这

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

XmlFile.getFile介绍

暂无

代码示例

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

/**
* Writes {@code config.xml} to the specified output stream.
* The user must have at least {@link #EXTENDED_READ}.
* If he lacks {@link #CONFIGURE}, then any {@link Secret}s detected will be masked out.
*/
@Restricted(NoExternalUse.class)
public void writeConfigDotXml(OutputStream os) throws IOException {
checkPermission(EXTENDED_READ);
XmlFile cOnfigFile= getConfigFile();
if (hasPermission(CONFIGURE)) {
IOUtils.copy(configFile.getFile(), os);
} else {
String encoding = configFile.sniffEncoding();
String xml = FileUtils.readFileToString(configFile.getFile(), encoding);
Matcher matcher = SECRET_PATTERN.matcher(xml);
StringBuffer cleanXml = new StringBuffer();
while (matcher.find()) {
if (Secret.decrypt(matcher.group(1)) != null) {
matcher.appendReplacement(cleanXml, ">********<");
}
}
matcher.appendTail(cleanXml);
org.apache.commons.io.IOUtils.write(cleanXml.toString(), os, encoding);
}
}

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

item = (V) Items.load(parent, subdir);
} else {
Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not find file " + xmlFile.getFile());
continue;

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

checkPermission(CONFIGURE);
XmlFile cOnfigXmlFile= getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
try {
try {

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

File cOnfigXml= Items.getConfigFile(getRootDirFor(name)).getFile();
final File dir = configXml.getParentFile();
dir.mkdirs();

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

Files.copy(Util.fileToPath(srcConfigFile.getFile()), Util.fileToPath(Items.getConfigFile(result).getFile()),
StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

@Override
public boolean hasOldRevision(final XmlFile xmlFile,
final String identifier) {
final File cOnfigFile= xmlFile.getFile();
final XmlFile oldRevision = getOldRevision(configFile, identifier);
return oldRevision.getFile() != null && oldRevision.getFile().exists();
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

@Override
public boolean hasOldRevision(final Node node, final String identifier) {
final XmlFile oldRevision = getOldRevision(node, identifier);
return oldRevision.getFile() != null && oldRevision.getFile().exists();
}
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

/**
* Check whether config file should not be saved because of regex pattern.
*
* @param xmlFile
* The config file
* @return True if it should be saved
*/
private boolean checkRegex(final XmlFile xmlFile) {
if (excludeRegexpPattern != null) {
final Matcher matcher = excludeRegexpPattern
.matcher(xmlFile.getFile().getName());
return !matcher.find();
} else {
return true;
}
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

@Override
public XmlFile getOldRevision(final XmlFile xmlFile,
final String identifier) {
final File cOnfigFile= xmlFile.getFile();
return getOldRevision(configFile, identifier);
}

代码示例来源:origin: org.jenkins-ci.plugins/config-file-provider

public void clearOldDataStorage() {
if (configs != null && !configs.isEmpty()) {
cOnfigs= Collections.emptyMap();
File file = getConfigXml().getFile();
if (!file.delete()) {
LOGGER.info("Unable to delete " + file.getAbsolutePath());
}
}
}
}

代码示例来源:origin: com.marvelution.jira.plugins/hudson-apiv2-plugin

/**
* Getter for a {@link File} by name
*
* @param filename the file name to get
* @return the {@link File}
*/
public File getFile(String filename) {
File dir = new File(getConfigXml().getFile().getParent(), APIV2_DIRECTORY_NAME);
if (!dir.exists()) {
dir.mkdirs();
}
return new File(dir, filename);
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

@Override
public SortedMap getRevisions(final XmlFile xmlFile) {
return getRevisions(xmlFile.getFile());
}

代码示例来源:origin: JoelJ/ez-templates

private static AbstractProject synchronizeConfigFiles(AbstractProject implementationProject, AbstractProject templateProject) throws IOException {
File templateCOnfigFile= templateProject.getConfigFile().getFile();
BufferedReader reader = new BufferedReader(new FileReader(templateConfigFile));
try {
Source source = new StreamSource(reader);
implementatiOnProject= ProjectUtils.updateProjectWithXmlSource(implementationProject, source);
} finally {
reader.close();
}
return implementationProject;
}

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

public boolean needsInitSetup() throws IOException {
if (initSetupFile.exists()) {
String str = FileUtils.readFileToString(initSetupFile.getFile());
return !str.trim().contains("Hudson 3.3");
} else {
if (Boolean.getBoolean("skipInitSetup")) {
try {
initSetupFile.write("Hudson 3.3 Initial Setup Done");
} catch (IOException ex) {
logger.error(ex.getLocalizedMessage());
}
return false;
} else {
return true;
}
}
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

public synchronized void load(){
XmlFile file = getConfigFile();
if(!file.getFile().exists()){
return;
}
try {
file.unmarshal(this);
} catch (IOException e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to load "+file, e);
}
// if(buildDiskUsage==null){
// //seems like it needs load old data
// loadOldData();
// }
// removeDeletedBuilds();
}

代码示例来源:origin: jenkinsci/github-plugin

/**
* Uses global xstream to enable migration alias used in
* {@link Migrator#enableCompatibilityAliases()}
*/
@Override
protected XmlFile getConfigFile() {
return new XmlFile(Jenkins.XSTREAM2, super.getConfigFile().getFile());
}

代码示例来源:origin: jenkinsci/github-plugin

/**
* @return config file with global {@link com.thoughtworks.xstream.XStream} instance
* with enabled aliases in {@link Migrator#enableAliases()}
*/
@Override
protected XmlFile getConfigFile() {
return new XmlFile(Jenkins.XSTREAM2, super.getConfigFile().getFile());
}

代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin

@Override
public boolean matches(Saveable saveable, File file) {
// The file may be null, indicating a deletion!
if (saveable instanceof AbstractItem) {
// Both jobs and folders are AbstractItems, which are Saveables.
if (file == null) {
// Deleted.
file = ((AbstractItem) saveable).getConfigFile().getFile();
} else if (file.isDirectory()) {
file = new File(file, CONFIG_FILE_NAME);
}
return matches(saveable, JenkinsFilesHelper.buildPathRelativeToHudsonRoot(file), false);
}
return false;
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

@Override
public XmlFile getOldRevision(final AbstractItem item,
final String identifier) {
final File cOnfigFile= item.getConfigFile().getFile();
final File historyDir = new File(getHistoryDir(configFile), identifier);
if (PluginUtils.isMavenPluginAvailable()
&& item instanceof MavenModule) {
final String path = historyDir
+ ((MavenModule) item).getParent().getFullName()
.replace("/", "/jobs/")
+ "/modules/"
+ ((MavenModule) item).getModuleName().toFileSystemName()
+ "/" + identifier;
return new XmlFile(getConfigFile(new File(path)));
} else {
return new XmlFile(getConfigFile(historyDir));
}
}

代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin

@Override
public void onChange(Saveable o, XmlFile file) {
super.onChange(o, file);
ScmSyncConfigurationPlugin plugin = ScmSyncConfigurationPlugin.getInstance();
if(plugin != null){
ScmSyncStrategy strategy = plugin.getStrategyForSaveable(o, file.getFile());
if(strategy != null){
WeightedMessage message = strategy.getCommitMessageFactory().getMessageWhenSaveableUpdated(o, file);
plugin.getTransaction().defineCommitMessage(message);
String path = JenkinsFilesHelper.buildPathRelativeToHudsonRoot(file.getFile());
plugin.getTransaction().registerPath(path);
}
}
}
}

推荐阅读
author-avatar
俊铭心怡雅琪
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有