Merge "Omaha #3356 fix apps_dir setting detection in viz/cave" into omaha_14.4.1
Former-commit-id:69d77c36b3
[formerly3e82c0f768
] [formerly39f330b583
] [formerly69d77c36b3
[formerly3e82c0f768
] [formerly39f330b583
] [formerly29ee81f50c
[formerly39f330b583
[formerly 39c26499805dc23b232397a2f9349ed17564ae13]]]] Former-commit-id:29ee81f50c
Former-commit-id:85f93c43ae
[formerly991276ab34
] [formerly 1dd7f791470b7e049c7809659e2c71e1daedb283 [formerly45e8f476ed
]] Former-commit-id: 47e70d58e2322d22aad6e25365f8fe9c080aeb90 [formerly30f1398f14
] Former-commit-id:bdf1411f78
This commit is contained in:
commit
b7914e42b3
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
|
||||
* Apr 1, 2009 jelkins added getTokens
|
||||
* 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>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -95,6 +97,8 @@ public class AppsDefaults {
|
|||
|
||||
private static AppsDefaults instance;
|
||||
|
||||
private static Class<?> dataDirClass;
|
||||
|
||||
private final Properties _envProperties;
|
||||
|
||||
private LocalizationFile _appsDefaultsUserFile;
|
||||
|
@ -130,11 +134,16 @@ public class AppsDefaults {
|
|||
_envProperties = new Properties();
|
||||
_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) {
|
||||
try {
|
||||
Class<?> vizapp = Class
|
||||
.forName("com.raytheon.uf.viz.core.VizApp");
|
||||
Method getDataDir = vizapp.getMethod("getDataDir");
|
||||
Method getDataDir = dataDirClass.getMethod("getDataDir");
|
||||
String shareDir = (String) getDataDir.invoke(null);
|
||||
_envProperties.put("apps_dir",
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue