Omaha #3356 fix apps_dir setting detection in viz/cave
Change-Id: If78a4ec84f6237450a6494c06b5a5271c66f10a3 Former-commit-id:e163ae0e5b
[formerlye163ae0e5b
[formerly ca8195c7835b9d96158d048fdd548cc744ba96bc]] Former-commit-id:e637963736
Former-commit-id:9c316ec38c
This commit is contained in:
parent
8ea5d99bf4
commit
6ff3a4435d
2 changed files with 38 additions and 3 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- this needs to be injected so AppsDefaults can properly initialize the apps_dir property in viz -->
|
||||||
|
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||||
|
<property name="targetClass" value="com.raytheon.uf.common.ohd.AppsDefaults" />
|
||||||
|
<property name="targetMethod" value="setDataDirClass" />
|
||||||
|
<property name="arguments">
|
||||||
|
<value type="java.lang.Class">com.raytheon.uf.viz.core.VizApp</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
|
@ -66,6 +66,8 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
* Sep 22, 2008 randerso Initial creation
|
* Sep 22, 2008 randerso Initial creation
|
||||||
* Apr 1, 2009 jelkins added getTokens
|
* Apr 1, 2009 jelkins added getTokens
|
||||||
* Oct 19, 2012 bgonzale App Context variable setup and token access.
|
* Oct 19, 2012 bgonzale App Context variable setup and token access.
|
||||||
|
* Sep 22, 2014 3356 njensen Fix constructor usage in viz finding VizApp class
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author randerso
|
* @author randerso
|
||||||
|
@ -95,6 +97,8 @@ public class AppsDefaults {
|
||||||
|
|
||||||
private static AppsDefaults instance;
|
private static AppsDefaults instance;
|
||||||
|
|
||||||
|
private static Class<?> dataDirClass;
|
||||||
|
|
||||||
private final Properties _envProperties;
|
private final Properties _envProperties;
|
||||||
|
|
||||||
private LocalizationFile _appsDefaultsUserFile;
|
private LocalizationFile _appsDefaultsUserFile;
|
||||||
|
@ -130,11 +134,16 @@ public class AppsDefaults {
|
||||||
_envProperties = new Properties();
|
_envProperties = new Properties();
|
||||||
_envProperties.putAll(System.getenv());
|
_envProperties.putAll(System.getenv());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO this is nearly unmaintainable, figure out a better way to do it
|
||||||
|
* that works in both CAVE and EDEX, perhaps through a combination of a
|
||||||
|
* properties file and Spring. It's not even clear if apps_dir should be
|
||||||
|
* coming from the data dir in CAVE or somewhere else, and it's not
|
||||||
|
* clear how much it's used in CAVE.
|
||||||
|
*/
|
||||||
if (_envProperties.get("EDEX_HOME") == null) {
|
if (_envProperties.get("EDEX_HOME") == null) {
|
||||||
try {
|
try {
|
||||||
Class<?> vizapp = Class
|
Method getDataDir = dataDirClass.getMethod("getDataDir");
|
||||||
.forName("com.raytheon.uf.viz.core.VizApp");
|
|
||||||
Method getDataDir = vizapp.getMethod("getDataDir");
|
|
||||||
String shareDir = (String) getDataDir.invoke(null);
|
String shareDir = (String) getDataDir.invoke(null);
|
||||||
_envProperties.put("apps_dir",
|
_envProperties.put("apps_dir",
|
||||||
FileUtil.join(shareDir, "hydroapps"));
|
FileUtil.join(shareDir, "hydroapps"));
|
||||||
|
@ -990,4 +999,15 @@ public class AppsDefaults {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the class used to determine the data dir, if necessary. See
|
||||||
|
* AppsDefaults's private constructor. At present only intended for use by
|
||||||
|
* CAVE since edex receives a corresponding environment variable.
|
||||||
|
*
|
||||||
|
* @param dataDirClass
|
||||||
|
*/
|
||||||
|
public static void setDataDirClass(Class<?> dataDirClass) {
|
||||||
|
AppsDefaults.dataDirClass = dataDirClass;
|
||||||
|
}
|
||||||
|
|
||||||
} // end class AppsDefaults
|
} // end class AppsDefaults
|
||||||
|
|
Loading…
Add table
Reference in a new issue