Skip to content

Commit

Permalink
#10370 load defualt props first, then load custom props and pass them…
Browse files Browse the repository at this point in the history
… all to felix
  • Loading branch information
wezell committed May 2, 2017
1 parent e883579 commit bc70e34
Showing 1 changed file with 6 additions and 38 deletions.
44 changes: 6 additions & 38 deletions dotCMS/src/main/java/com/dotmarketing/util/OSGIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ public synchronized Framework initializeFramework(ServletContextEvent context) {
Properties felixProps = loadConfig();

// fetch the 'felix.base.dir' property and check if exists. On the props file the prop needs to

for(String key :FELIX_DIRECTORIES ){

if( new File(felixProps.getProperty(key)).mkdirs()){
Logger.info(this.getClass(), "Building Directory:" +felixProps.getProperty(key) );
}
Expand Down Expand Up @@ -270,16 +268,12 @@ private Properties loadConfig() {
Properties properties = defaultProperties();
Iterator<String> it = Config.getKeys();
while (it.hasNext()) {
String key = it.next();
if (key == null)
continue;
if (key.startsWith("felix.felix.")) {
properties.put(key.substring(6), Config.getStringProperty(key));
Logger.info(this, "Loading property " + key + "=" + properties.getProperty(key));
} else if (key.startsWith("felix.")) {
// Allow the property in the file to be felix.base.dir
properties.put(key, Config.getStringProperty(key));
Logger.info(this, "Loading property " + key + "=" + properties.getProperty(key));
final String key = it.next();
if(key != null && key.startsWith("felix.")) {
String value = (UtilMethods.isSet(Config.getStringProperty(key, null))) ? Config.getStringProperty(key) : null;
String felixKey = key.substring(6) ;
properties.put(felixKey, value);
Logger.info(OSGIUtil.class, "Found property " + felixKey + "=" + value);
}
}
return properties;
Expand Down Expand Up @@ -361,24 +355,7 @@ public String getExtraOSGIPackages() throws IOException {
return extraPackages;
}

/**
* Transform a given Properties object into a Map
*
* @param props
* @return
*/
private Map<String, String> propertiesToMap(Properties props) {

HashMap<String, String> propertiesMap = new HashMap<String, String>();

Enumeration<Object> e = props.keys();
while (e.hasMoreElements()) {
String s = (String) e.nextElement();
propertiesMap.put(s, props.getProperty(s));
}

return propertiesMap;
}

/**
* Fetches the Felix Path based on the input param property value. If property is not found, then
Expand Down Expand Up @@ -424,15 +401,6 @@ private String getFelixPath(String felixDirProperty, String manualDefaultPath) {
return felixPath;
}

/**
* Verifies the folder exists. If it does not exists then tries to create it
*
* @param path The path to verify
* @return boolean true when path exists or it was created successfully
*/
private boolean verifyOrCreateFelixFolder(String path) {
return new File(path).exists() || createFolder(path);
}

/**
* Create the path if it does not exist. Required for felix install and undeploy folder
Expand Down

0 comments on commit bc70e34

Please sign in to comment.