
org.zeroturnaround.jenkins.util.ArtifactAndMetadataDescriptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liverebel-deploy Show documentation
Show all versions of liverebel-deploy Show documentation
LiveRebel Plugin helps to run updates to your JEE containers faster. LiveRebel is a tool for hot updates without downtime,
lost sessions and OutOfMemoryErrors. You have to have a running LiveRebel Command Center to use this plugin.
The newest version!
package org.zeroturnaround.jenkins.util;
import java.io.IOException;
import javax.servlet.ServletException;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.QueryParameter;
import com.zeroturnaround.liverebel.api.CommandCenter;
import hudson.FilePath;
import hudson.model.AbstractProject;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.util.FormValidation;
import static org.zeroturnaround.jenkins.LiveRebelDeployBuilder.DescriptorImpl.newCommandCenter;
public class ArtifactAndMetadataDescriptor> extends Descriptor {
public FormValidation doCheckArtifact(@AncestorInPath AbstractProject project, @QueryParameter String value)
throws IOException, ServletException {
if (StringUtils.trimToNull(value) == null || value.length() == 0) {
return FormValidation.error("Please provide an artifact.");
} else if (value.contains(",")) {
return FormValidation.error("Please provide only one artifact.");
}
else {
return FilePath.validateFileMask(project.getSomeWorkspace(), value);
}
}
public FormValidation doCheckTrace(@AncestorInPath AbstractProject project, @QueryParameter String value)
throws IOException, ServletException {
if (StringUtils.trimToNull(value) != null) {
if (value.contains(",")) {
return FormValidation.error("Please provide only one trace file.");
}
String fileExtension = null;
try {
fileExtension = value.substring(value.lastIndexOf('.') + 1);
}
catch (Exception e) {
return FormValidation.error("Trace must be a text file!");
}
if (!fileExtension.equals("txt"))
return FormValidation.error("Trace must be a text file!");
return FilePath.validateFileMask(project.getSomeWorkspace(), value);
}
else {
return FormValidation.ok();
}
}
public boolean isMetadataSupported() {
CommandCenter cc = newCommandCenter();
return cc != null && !cc.getVersion().equals("2.0");
}
@Override
public String getDisplayName() {
throw new UnsupportedOperationException("getDisplayName() should be overridden");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy