Skip to content

Commit

Permalink
Update libext dir location to be configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Apr 7, 2011
1 parent 46fbf52 commit 7082254
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
30 changes: 30 additions & 0 deletions core/src/java/com/dtolabs/rundeck/core/common/Framework.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public class Framework extends FrameworkResourceParent {
static final String CENTRALDISPATCHER_CLS_DEFAULT = NoCentralDispatcher.class.getName();

static final String PROJECTMGR_NAME = "projectResourceMgr";
public static final String FRAMEWORK_LIBEXT_DIR = "framework.libext.dir";
public static final String FRAMEWORK_LIBEXT_CACHE_DIR = "framework.libext.cache.dir";
public static final String DEFAULT_LIBEXT_DIR_NAME = "libext";
public static final String DEFAULT_LIBEXT_CACHE_DIR_NAME = "cache";
public static final String SYSTEM_PROP_LIBEXT = "rdeck.libext";
public static final String SYSTEM_PROP_LIBEXT_CACHE = "rdeck.libext.cache";

private final IPropertyLookup lookup;
private final File projectsBase;
Expand Down Expand Up @@ -674,6 +680,30 @@ public Collection<INodeEntry> filterNodes(final NodeSet nodeset, final String pr
public File getConfigDir() {
return new File(Constants.getFrameworkConfigDir(getBaseDir().getAbsolutePath()));
}
/**
* Return the directory containing plugins/extensions for the framework.
*/
public File getLibextDir(){
if(null!=System.getProperty(SYSTEM_PROP_LIBEXT)) {
return new File(System.getProperty(SYSTEM_PROP_LIBEXT));
}else if (hasProperty(FRAMEWORK_LIBEXT_DIR)) {
return new File(getProperty(FRAMEWORK_LIBEXT_DIR));
}else {
return new File(getBaseDir(), DEFAULT_LIBEXT_DIR_NAME);
}
}
/**
* Return the cache directory used by the plugin system
*/
public File getLibextCacheDir(){
if (null != System.getProperty(SYSTEM_PROP_LIBEXT_CACHE)) {
return new File(System.getProperty(SYSTEM_PROP_LIBEXT_CACHE));
}else if (hasProperty(FRAMEWORK_LIBEXT_CACHE_DIR)) {
return new File(getProperty(FRAMEWORK_LIBEXT_CACHE_DIR));
}else {
return new File(getLibextDir(), DEFAULT_LIBEXT_CACHE_DIR_NAME);
}
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void loadPlugins() {
* Load any jars in the libext dir of RDECK_BASE and look for jar metadata to load classes as plugins
*/
private void scanAndLoadJarPlugins() {
final File libext = new File(framework.getBaseDir(), "libext");
final File libext = framework.getLibextDir();
debug("scanAndLoadJarPlugins dir: " + libext.getAbsolutePath());
if (!libext.exists() || !libext.isDirectory()) {
return;
Expand Down Expand Up @@ -133,7 +133,7 @@ private void debug(String msg) {
* Load any jars in the libext dir of RDECK_BASE and look for jar metadata to load classes as plugins
*/
private void scanAndLoadZipScriptPlugins() {
final File libext = new File(framework.getBaseDir(), "libext");
final File libext = framework.getLibextDir();
debug("scanAndLoadZipScriptPlugins dir: " + libext.getAbsolutePath());
if (!libext.exists() || !libext.isDirectory()) {
return;
Expand Down Expand Up @@ -248,7 +248,7 @@ private void loadScriptPlugins(final Map<File, loadedMeta> scriptPlugins) {
* @return cache dir for the contents of the plugin zip
*/
private File expandScriptPlugin(final File file, final loadedMeta meta) throws IOException {
File basedir = new File(framework.getBaseDir(), "libext/cache");
File basedir = framework.getLibextCacheDir();
if (!basedir.exists()) {
basedir.mkdirs();
}
Expand Down

0 comments on commit 7082254

Please sign in to comment.