当前位置: 首页>>代码示例>>Java>>正文


Java FormException类代码示例

本文整理汇总了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;
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:18,代码来源:EC2OndemandSlave.java

示例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
    }
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:20,代码来源:SlaveTemplate.java

示例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();
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:21,代码来源:EC2AbstractSlave.java

示例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());
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:18,代码来源:YamlProject.java

示例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);
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:18,代码来源:Binder.java

示例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();
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:17,代码来源:ConfigurationProject.java

示例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");
        }
    }
}
 
开发者ID:jan-molak,项目名称:jenkins-build-monitor-plugin,代码行数:22,代码来源:BuildMonitorView.java

示例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
    );
}
 
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:17,代码来源:MesosSlaveInfo.java

示例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());
}
 
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:20,代码来源:MesosSlave.java

示例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(".");
}
 
开发者ID:jenkinsci,项目名称:ssh2easy-plugin,代码行数:8,代码来源:ProjectStrategyConfig.java

示例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(".");
}
 
开发者ID:jenkinsci,项目名称:ssh2easy-plugin,代码行数:8,代码来源:ProjectStrategyConfig.java

示例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);
			}
		}
	}
}
 
开发者ID:bombardier-transportation,项目名称:distributed-test-job,代码行数:44,代码来源:DTJob.java

示例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");
    }
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:10,代码来源:DockerSlaveTemplate.java

示例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;
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:9,代码来源:EC2OndemandSlave.java

示例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;
}
 
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:11,代码来源:EC2AbstractSlave.java


注:本文中的hudson.model.Descriptor.FormException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。