本文整理汇总了Java中hudson.model.Descriptor.FormException类的典型用法代码示例。如果您正苦于以下问题:Java FormException类的具体用法?Java FormException怎么用?Java FormException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FormException类属于hudson.model.Descriptor包,在下文中一共展示了FormException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newInstance
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@Override
public Node newInstance(StaplerRequest req, JSONObject formData) throws FormException {
EC2OndemandSlave ec2AbstractSlave = (EC2OndemandSlave) super.newInstance(req, formData);
if (!ec2AbstractSlave.isAlive(true)) {
LOGGER.info("EC2 instance terminated externally: " + ec2AbstractSlave.getInstanceId());
try {
Hudson.getInstance().removeNode(ec2AbstractSlave);
} catch (IOException ioe) {
LOGGER.log(Level.WARNING, "Attempt to reconfigure EC2 instance which has been externally terminated: " + ec2AbstractSlave.getInstanceId(), ioe);
}
return null;
}
return ec2AbstractSlave;
}
示例2: attach
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
/**
* Provisions a new EC2 slave based on the currently running instance on EC2,
* instead of starting a new one.
*/
public EC2AbstractSlave attach(String instanceId, TaskListener listener) throws AmazonClientException, IOException {
PrintStream logger = listener.getLogger();
AmazonEC2 ec2 = getParent().connect();
try {
logger.println("Attaching to "+instanceId);
LOGGER.info("Attaching to "+instanceId);
DescribeInstancesRequest request = new DescribeInstancesRequest();
request.setInstanceIds(Collections.singletonList(instanceId));
Instance inst = ec2.describeInstances(request).getReservations().get(0).getInstances().get(0);
return newOndemandSlave(inst);
} catch (FormException e) {
throw new AssertionError(); // we should have discovered all configuration issues upfront
}
}
示例3: EC2AbstractSlave
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@DataBoundConstructor
public EC2AbstractSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy<EC2Computer> retentionStrategy, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, List<EC2Tag> tags, String cloudName, boolean usePrivateDnsName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException {
super(name, "", remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, nodeProperties);
this.instanceId = instanceId;
this.initScript = initScript;
this.tmpDir = tmpDir;
this.remoteAdmin = remoteAdmin;
this.jvmopts = jvmopts;
this.stopOnTerminate = stopOnTerminate;
this.idleTerminationMinutes = idleTerminationMinutes;
this.tags = tags;
this.usePrivateDnsName = usePrivateDnsName;
this.useDedicatedTenancy = useDedicatedTenancy;
this.cloudName = cloudName;
this.launchTimeout = launchTimeout;
this.amiType = amiType;
readResolve();
}
示例4: submit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void submit(StaplerRequest req, StaplerResponse rsp)
throws IOException, ServletException, FormException {
super.submit(req, rsp);
final JSONObject json = req.getSubmittedForm();
setYamlPath(json.optString("yamlPath"));
if (json.containsKey("restriction")) {
setRestriction(req.bindJSON(AbstractRestriction.class,
json.getJSONObject("restriction")));
} else {
setRestriction(new NoRestriction());
}
}
示例5: bind
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public <T extends Describable> T bind(JSONObject json)
throws IOException, FormException {
final String clazz = checkNotNull(json.optString("$class", null));
final Descriptor descriptor = getDescriptor(clazz);
final Stapler stapler = getStapler();
final StaplerRequest request = getRequest(stapler, json);
// We do this instead of 'request.bindJson' because this doesn't
// require a DataBoundConstructor.
// TODO(mattmoor): Should we do the rewrite of describable lists
// here as well?
return (T) descriptor.newInstance(request, json);
}
示例6: doConfigSubmit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@Override
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, Descriptor.FormException {
super.doConfigSubmit(req, rsp);
// set assigned node
JSONObject json = req.getSubmittedForm();
String jsonStr = json.toString();
String leroyBuilderJson = JsonUtils.getLeroyConfigurationBuilderJSON(jsonStr);
String leroyNode = JsonPath.read(leroyBuilderJson, "$.leroyNode");
String assignedNodeName = leroyNode == null ? "" : leroyNode;
Node n = LeroyUtils.findNodeByName(assignedNodeName);
if (n != null) {
setAssignedNode(n);
}
save();
}
示例7: submit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@Override
protected void submit(StaplerRequest req) throws ServletException, IOException, FormException {
super.submit(req);
JSONObject json = req.getSubmittedForm();
synchronized (this) {
String requestedOrdering = req.getParameter("order");
title = req.getParameter("title");
currentConfig().setDisplayCommitters(json.optBoolean("displayCommitters", true));
currentConfig().setBuildFailureAnalyzerDisplayedField(req.getParameter("buildFailureAnalyzerDisplayedField"));
try {
currentConfig().setOrder(orderIn(requestedOrdering));
} catch (Exception e) {
throw new FormException("Can't order projects by " + requestedOrdering, "order");
}
}
}
示例8: copyWithDockerImage
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
public ContainerInfo copyWithDockerImage(String dockerImage) throws FormException {
return new ContainerInfo(
type,
dockerImage, // custom docker image
dockerPrivilegedMode,
dockerForcePullImage,
dockerImageCustomizable,
useCustomDockerCommandShell,
customDockerCommandShell,
volumes,
parameters,
networking,
portMappings,
networkInfos
);
}
示例9: MesosSlave
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
public MesosSlave(MesosCloud cloud, String name, int numExecutors, MesosSlaveInfo slaveInfo) throws IOException, FormException {
super(name,
slaveInfo.getLabelString(), // node description.
StringUtils.isBlank(slaveInfo.getRemoteFSRoot()) ? "jenkins" : slaveInfo.getRemoteFSRoot().trim(), // remoteFS.
"" + numExecutors,
slaveInfo.getMode(),
slaveInfo.getLabelString(), // Label.
new MesosComputerLauncher(cloud, name),
new MesosRetentionStrategy(slaveInfo.getIdleTerminationMinutes()),
slaveInfo.getNodeProperties());
this.cloud = cloud;
this.cloudName = cloud.getDisplayName();
this.slaveInfo = slaveInfo;
this.idleTerminationMinutes = slaveInfo.getIdleTerminationMinutes();
this.cpus = slaveInfo.getSlaveCpus() + (numExecutors * slaveInfo.getExecutorCpus());
this.mem = slaveInfo.getSlaveMem() + (numExecutors * slaveInfo.getExecutorMem());
this.diskNeeded = slaveInfo.getdiskNeeded();
LOGGER.fine("Constructing Mesos slave " + name + " from cloud " + cloud.getDescription());
}
示例10: doProjectsSubmit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
public void doProjectsSubmit(StaplerRequest req, StaplerResponse rsp)
throws IOException, UnsupportedEncodingException, ServletException,
FormException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
CloudCIAuthorizationStrategy.DESCRIPTOR.doProjectsSubmit(req, rsp);
rsp.sendRedirect(".");
}
示例11: doAssignSubmit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
public void doAssignSubmit(StaplerRequest req, StaplerResponse rsp)
throws IOException, UnsupportedEncodingException, ServletException,
FormException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
CloudCIAuthorizationStrategy.DESCRIPTOR.doAssignSubmit(req, rsp);
rsp.sendRedirect(".");
}
示例12: submit
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
/**
* Used to persist the configuration form upon submission.
*
* @since 1.0
*/
@Override
protected void submit(StaplerRequest req, StaplerResponse rsp)
throws IOException, ServletException, FormException {
super.submit(req, rsp);
JSONObject json = req.getSubmittedForm();
String key = "preTestConfig";
JSONObject viewObject;
if (json.has(key)) {
viewObject = json.getJSONObject(key);
if (viewObject != null) {
key = "testCaseList";
if (viewObject.has(key)) {
this.testCaseList = viewObject.getString(key);
}
key = "testTargetScript";
if (viewObject.has(key)) {
this.testTargetScript = viewObject.getString(key);
}
key = "testListIsRelOrAbs";
if (viewObject.has(key)) {
this.testListIsRelOrAbs = viewObject.getString(key);
}
key = "targetScrIsRelOrAbs";
if (viewObject.has(key)) {
this.targetScrIsRelOrAbs = viewObject.getString(key);
}
key = "slaveTestEnv";
if (viewObject.has(key)) {
this.slaveTestEnv = viewObject.getString(key);
}
key = "statisticsFile";
if (viewObject.has(key)) {
this.statisticsFile = viewObject.getString(key);
}
}
}
}
示例13: DockerSlaveTemplate
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
/**
* Custom specified ID. When editing existed UI entry, UI sends it back.
*/
public DockerSlaveTemplate(@Nonnull String id) throws FormException {
super(id);
if (isNull(id)) {
throw new FormException("Hidden id must not be null", "id");
}
}
示例14: EC2OndemandSlave
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@DataBoundConstructor
public EC2OndemandSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, String labelString, Mode mode, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, String publicDNS, String privateDNS, List<EC2Tag> tags, String cloudName, boolean usePrivateDnsName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException {
super(name, instanceId, description, remoteFS, numExecutors, mode, labelString, amiType.isWindows() ? new EC2WindowsLauncher() : new EC2UnixLauncher(), new EC2RetentionStrategy(idleTerminationMinutes), initScript, tmpDir, nodeProperties, remoteAdmin, jvmopts, stopOnTerminate, idleTerminationMinutes, tags, cloudName, usePrivateDnsName, useDedicatedTenancy, launchTimeout, amiType);
this.publicDNS = publicDNS;
this.privateDNS = privateDNS;
}
示例15: newInstance
import hudson.model.Descriptor.FormException; //导入依赖的package包/类
@Override
public Node newInstance(StaplerRequest req, JSONObject formData) throws FormException {
EC2AbstractSlave ec2AbstractSlave = (EC2AbstractSlave) super.newInstance(req, formData);
/* Get rid of the old tags, as represented by ourselves. */
ec2AbstractSlave.clearLiveInstancedata();
/* Set the new tags, as represented by our successor */
ec2AbstractSlave.pushLiveInstancedata();
return ec2AbstractSlave;
}