本文整理了Java中hudson.model.AbstractItem.getConfigFile()
方法的一些代码示例,展示了AbstractItem.getConfigFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractItem.getConfigFile()
方法的具体详情如下:
包路径:hudson.model.AbstractItem
类名称:AbstractItem
方法名:getConfigFile
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* 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: jenkinsci/jenkins
/**
* Does the real job of deleting the item.
*/
protected void performDelete() throws IOException, InterruptedException {
getConfigFile().delete();
Util.deleteRecursive(getRootDir());
}
代码示例来源: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
/**
* Reloads this job from the disk.
*
* Exposed through CLI as well.
*
* TODO: think about exposing this to UI
*
* @since 1.556
*/
@RequirePOST
public void doReload() throws IOException {
checkPermission(CONFIGURE);
// try to reflect the changes by reloading
getConfigFile().unmarshal(this);
Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
@Override
public Void call() throws IOException {
onLoad(getParent(), getRootDir().getName());
return null;
}
});
Jenkins.getInstance().rebuildDependencyGraphAsync();
SaveableListener.fireOnChange(this, getConfigFile());
}
代码示例来源:origin: jenkinsci/jenkins
XmlFile configXmlFile = getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
try {
SaveableListener.fireOnChange(this, getConfigFile());
代码示例来源:origin: org.jenkins-ci.main/jenkins-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: 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: 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.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: jenkinsci/jobConfigHistory-plugin
@Override
public void createNewItem(final Item item) {
final AbstractItem aItem = (AbstractItem) item;
createNewHistoryEntryAndCopyConfig(aItem.getConfigFile(),
Messages.ConfigHistoryListenerHelper_CREATED(), null, null);
}
代码示例来源: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 void deleteItem(final Item item) {
final AbstractItem aItem = (AbstractItem) item;
createNewHistoryEntry(aItem.getConfigFile(),
Messages.ConfigHistoryListenerHelper_DELETED(), null, null);
final File configFile = aItem.getConfigFile().getFile();
final File currentHistoryDir = getHistoryDir(configFile);
final SimpleDateFormat buildDateFormat = new SimpleDateFormat(
"yyyyMMdd_HHmmss_SSS");
final String timestamp = buildDateFormat.format(new Date());
final String deletedHistoryName = item.getName()
+ DeletedFileFilter.DELETED_MARKER + timestamp;
final File deletedHistoryDir = new File(
currentHistoryDir.getParentFile(), deletedHistoryName);
if (!currentHistoryDir.renameTo(deletedHistoryDir)) {
LOG.log(Level.WARNING,
"unable to rename deleted history dir to: {0}",
deletedHistoryDir);
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Does the real job of deleting the item.
*/
protected void performDelete() throws IOException, InterruptedException {
getConfigFile().delete();
Util.deleteRecursive(getRootDir());
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Does the real job of deleting the item.
*/
protected void performDelete() throws IOException, InterruptedException {
getConfigFile().delete();
Util.deleteRecursive(getRootDir());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Does the real job of deleting the item.
*/
protected void performDelete() throws IOException, InterruptedException {
getConfigFile().delete();
Util.deleteRecursive(getRootDir());
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Does the real job of deleting the item.
*/
protected void performDelete() throws IOException, InterruptedException {
getConfigFile().delete();
Util.deleteRecursive(getRootDir());
}
代码示例来源:origin: jenkinsci/jobConfigHistory-plugin
/**
* Used in the Difference jelly only. Returns the user that made the change
* in one of the Files shown in the Difference view(A or B). timestampNumber
* decides between File A and File B.
*
* @param timestampNumber
* 1 for File A and 2 for File B
* @return the user as String.
*/
public final String getUser(int timestampNumber) {
checkConfigurePermission();
return getHistoryDao().getRevisions(this.project.getConfigFile())
.get(getTimestamp(timestampNumber)).getUser();
}
代码示例来源: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/jobConfigHistory-plugin
/**
* Used in the Difference jelly only. Returns the operation made on one of
* the two Files A and B. timestampNumber decides which file exactly.
*
* @param timestampNumber
* 1 for File A, 2 for File B
* @return the operation as String.
*/
public final String getOperation(int timestampNumber) {
if (!hasConfigurePermission() && !hasReadExtensionPermission()) {
checkConfigurePermission();
return null;
}
return getHistoryDao().getRevisions(this.project.getConfigFile())
.get(getTimestamp(timestampNumber)).getOperation();
}
内容来源于网络,如有侵权,请联系作者删除!