hudson.util
Class SecretRewriter

java.lang.Object
  extended by hudson.util.SecretRewriter

public class SecretRewriter
extends Object

Rewrites XML files by looking for Secrets that are stored with the old key and replaces them by the new encrypted values.

Author:
Kohsuke Kawaguchi

Constructor Summary
SecretRewriter(File backupDirectory)
           
 
Method Summary
protected  boolean isIgnoredDir(File dir)
          Decides if this directory is worth visiting or not.
 boolean rewrite(File f, File backup)
           
 int rewriteRecursive(File dir, TaskListener listener)
          Recursively scans and rewrites a directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecretRewriter

public SecretRewriter(File backupDirectory)
               throws GeneralSecurityException
Throws:
GeneralSecurityException
Method Detail

rewrite

public boolean rewrite(File f,
                       File backup)
                throws InvalidKeyException,
                       IOException
Parameters:
backup - if non-null, the original file will be copied here before rewriting. if the rewrite doesn't happen, no copying.
Throws:
InvalidKeyException
IOException

rewriteRecursive

public int rewriteRecursive(File dir,
                            TaskListener listener)
                     throws InvalidKeyException
Recursively scans and rewrites a directory. This method shouldn't abort just because one file fails to rewrite.

Returns:
Number of files that were actually rewritten.
Throws:
InvalidKeyException

isIgnoredDir

protected boolean isIgnoredDir(File dir)
Decides if this directory is worth visiting or not.



Copyright © 2004-2013. All Rights Reserved.