@SuppressWarnings("deprecation") @Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server File local = File.createTempFile("jenkins","parameter"); String name; if (value.isEmpty()) { FileUtils.copyInputStreamToFile(command.stdin, local); name = "stdin"; } else { FilePath src = new FilePath(command.checkChannel(), value); src.copyTo(new FilePath(local)); name = src.getName(); } FileParameterValue p = new FileParameterValue(getName(), local, name); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(StaplerRequest req) { FileItem src; try { src = req.getFileItem( getName() ); } catch (ServletException | IOException e) { // Not sure what to do here. We might want to raise this // but that would involve changing the throws for this call return null; } if ( src == null ) { // the requested file parameter wasn't uploaded return null; } FileParameterValue p = new FileParameterValue(getName(), src, getFileName(src.getName())); p.setDescription(getDescription()); p.setLocation(getName()); return p; }
@Override public Action getAction(AbstractBuild<?, ?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException { assert f.getChannel() == null; // we copied files locally. This file must be local to the master FileParameterValue fv = new FileParameterValue(parameterBinding.parameterName, new File(f.getRemote()), f.getName()); return new ParametersAction(fv); } });
@Override public Action getAction(AbstractBuild<?,?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException { assert f.getChannel()==null; // we copied files locally. This file must be local to the master FileParameterValue fv = new FileParameterValue(parameterName, new File(f.getRemote()), f.getName()); if ($setLocation!=null) { try { $setLocation.invoke(fv,parameterName); } catch (IllegalAccessException e) { // be defensive as the core might change } catch (InvocationTargetException e) { // be defensive as the core might change } } return new ParametersAction(fv); } });
@SuppressWarnings("deprecation") @Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server File local = File.createTempFile("jenkins","parameter"); String name; if (value.isEmpty()) { FileUtils.copyInputStreamToFile(command.stdin, local); name = "stdin"; } else { FilePath src = new FilePath(command.checkChannel(), value); src.copyTo(new FilePath(local)); name = src.getName(); } FileParameterValue p = new FileParameterValue(getName(), local, name); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server FilePath src = new FilePath(command.channel,value); File local = File.createTempFile("hudson","parameter"); src.copyTo(new FilePath(local)); FileParameterValue p = new FileParameterValue(getName(), local, src.getName()); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server FilePath src = new FilePath(command.channel,value); File local = File.createTempFile("hudson","parameter"); src.copyTo(new FilePath(local)); FileParameterValue p = new FileParameterValue(getName(), local, src.getName()); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server FilePath src = new FilePath(command.channel, value); File local = File.createTempFile("hudson", "parameter"); src.copyTo(new FilePath(local)); FileParameterValue p = new FileParameterValue(getName(), local, src.getName()); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { // capture the file to the server FilePath src = new FilePath(command.channel,value); File local = File.createTempFile("hudson","parameter"); src.copyTo(new FilePath(local)); FileParameterValue p = new FileParameterValue(getName(), local, src.getName()); p.setDescription(getDescription()); p.setLocation(getName()); return p; } }
@Override public ParameterValue createValue(StaplerRequest req) { FileItem src; try { src = req.getFileItem( getName() ); } catch (ServletException | IOException e) { // Not sure what to do here. We might want to raise this // but that would involve changing the throws for this call return null; } if ( src == null ) { // the requested file parameter wasn't uploaded return null; } FileParameterValue p = new FileParameterValue(getName(), src, getFileName(src.getName())); p.setDescription(getDescription()); p.setLocation(getName()); return p; }