[JENKINS-32765] Perhaps it makes more sense to make this a property of the PluginManager rather than the classic strategy

- Also expose via servlet context parameter of same name to allow multiple instances of Jenkins in the same servlet container to have different directories
- As we are no longer a constant, change the system property to camelCase
This commit is contained in:
Stephen Connolly committed 2016-02-04 14:40:44 +00:00
1 parent d27cff8fd2
commit c0cbff7297
2 files changed
+21 -10

No files matched your search

@@ -149,6 +149,12 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
*/
public final File rootDir;
/**
* If non-null, the base directory for all exploded .hpi/.jpi plugins. Controlled by the system property / servlet
* context parameter {@literal hudson.PluginManager.workDir}.
*/
private final File workDir;
/**
* @deprecated as of 1.355
* {@link PluginManager} can now live longer than {@link jenkins.model.Jenkins} instance, so
@@ -199,6 +205,11 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
this.rootDir = rootDir;
if(!rootDir.exists())
rootDir.mkdirs();
String workDir = System.getProperty(PluginManager.class.getName()+".workDir");
if (workDir == null) {
workDir = context.getInitParameter(PluginManager.class.getName() + ".workDir");
}
this.workDir = workDir == null ? null : new File(workDir);
strategy = createPluginStrategy();
@@ -218,6 +229,14 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
return new Api(this);
}
/**
* If non-null, the base directory for all exploded .hpi/.jpi plugins.
* @return the base directory for all exploded .hpi/.jpi plugins or {@code null} to leave this up to the strategy.
*/
public File getWorkDir() {
return workDir;
}
/**
* Find all registered overrides (intended to allow overriding/adding views)
* @return List of extensions