public boolean dynamicLoad;
protected int run() throws Exception {
Jenkins h = Jenkins.getInstance();
h.checkPermission(Jenkins.ADMINISTER);
PluginManager pm = h.getPluginManager();
for (String source : sources) {
// is this a file?
if (channel!=null) {
FilePath f = new FilePath(channel, source);
if (f.exists()) {
stdout.println(Messages.InstallPluginCommand_InstallingPluginFromLocalFile(f));
if (name==null)
name = f.getBaseName();
f.copyTo(getTargetFilePath());
if (dynamicLoad)
pm.dynamicLoad(getTargetFile());
continue;
}
}
// is this an URL?
try {
URL u = new URL(source);
stdout.println(Messages.InstallPluginCommand_InstallingPluginFromUrl(u));
if (name==null) {
name = u.getPath();
name = name.substring(name.lastIndexOf('/')+1);
name = name.substring(name.lastIndexOf('\\')+1);
int idx = name.lastIndexOf('.');
if (idx>0) name = name.substring(0,idx);
}
getTargetFilePath().copyFrom(u);
if (dynamicLoad)
pm.dynamicLoad(getTargetFile());
continue;
} catch (MalformedURLException e) {
// not an URL
}