/** * Absolutizes this {@link FilePath} and returns the new one. */ public FilePath absolutize() throws IOException, InterruptedException { return new FilePath(channel, act(new Absolutize())); } private static class Absolutize extends SecureFileCallable<String> {
@Override public Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) throws IOException, InterruptedException { EnvVars e = new EnvVars(env); e.putAll(envVars); return outer.launchChannel(cmd,out,workDir,e); }
/** * Deletes this directory, including all its contents recursively. */ public void deleteRecursive() throws IOException, InterruptedException { act(new DeleteRecursive()); } private class DeleteRecursive extends SecureFileCallable<Void> {
/** * Deletes all the contents of this directory, but not the directory itself */ public void deleteContents() throws IOException, InterruptedException { act(new DeleteContents()); } private class DeleteContents extends SecureFileCallable<Void> {
/** * Gets the last modified time stamp of this file, by using the clock * of the machine where this file actually resides. * * @see File#lastModified() * @see #touch(long) */ public long lastModified() throws IOException, InterruptedException { return act(new LastModified()); } private class LastModified extends SecureFileCallable<Long> {
/** * Checks if the file is a directory. */ public boolean isDirectory() throws IOException, InterruptedException { return act(new IsDirectory()); } private final class IsDirectory extends SecureFileCallable<Boolean> {
/** * Reads this file into a string, by using the current system encoding on the remote machine. */ public String readToString() throws IOException, InterruptedException { return act(new ReadToString()); } private final class ReadToString extends SecureFileCallable<String> {
/** * Returns the number of usable bytes in the partition of that file. * @since 1.542 */ public long getUsableDiskSpace() throws IOException, InterruptedException { return act(new GetUsableDiskSpace()); } private static class GetUsableDiskSpace extends SecureFileCallable<Long> {
/** * Overwrites this file by placing the given String as the content. * * @param encoding * Null to use the platform default encoding on the remote machine. * @since 1.105 */ public void write(final String content, final String encoding) throws IOException, InterruptedException { act(new Write(encoding, content)); } private class Write extends SecureFileCallable<Void> {
public static ProxyConfiguration load() throws IOException { XmlFile f = getXmlFile(); if(f.exists()) return (ProxyConfiguration) f.read(); else return null; }
@Override public boolean remove(Object o) { getDescriptorExtensionList().remove(o); return super.remove(o); }
/** * {@link #load()} in the descriptor is not a real load activity, so locking against "this" is enough. */ @Override protected Object getLoadLock() { // Get a lock for the singleton extension list to prevent deadlocks (JENKINS-55361) return getDescriptorExtensionList().getLoadLock(); }