
hudson.plugins.scm_sync_configuration.strategies.model.ClassAndFileConfigurationEntityMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scm-sync-configuration Show documentation
Show all versions of scm-sync-configuration Show documentation
SCM Sync Configuration Hudson plugin is aimed at 2 main features : First, keep sync'ed your config.xml (and other ressources) hudson files with a SCM repository (backup), Secondly, track changes (and author) made on every file with commit messages.
The newest version!
package hudson.plugins.scm_sync_configuration.strategies.model;
import hudson.model.Saveable;
import hudson.plugins.scm_sync_configuration.HudsonFilesHelper;
import java.io.File;
import java.util.regex.Pattern;
public class ClassAndFileConfigurationEntityMatcher implements
ConfigurationEntityMatcher {
private Class extends Saveable> saveableClazz;
private Pattern filePathRegex;
public ClassAndFileConfigurationEntityMatcher(Class extends Saveable> clazz, String _filePathRegex){
this.saveableClazz = clazz;
this.filePathRegex = Pattern.compile(_filePathRegex);
}
public boolean matches(Saveable saveable, File file) {
if(saveableClazz.isAssignableFrom(saveable.getClass())){
if(file == null){
return true;
} else {
String filePathRelativeToHudsonRoot = HudsonFilesHelper.buildPathRelativeToHudsonRoot(file);
return this.filePathRegex.matcher(filePathRelativeToHudsonRoot).matches();
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy