|
@@ -1,56 +1,55 @@ |
1 |
|
- |
package org.litesoft.nasvideo.server; |
2 |
|
- |
|
3 |
|
- |
import org.litesoft.core.typeutils.Objects; |
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
|
- |
import org.litesoft.configuration.*; |
7 |
|
- |
|
8 |
|
- |
public class NasVideo_Configuration |
9 |
|
- |
{ |
10 |
|
- |
private static final String SYSTEM_PROP_CONFIG_FILE = "CONFIG_FILE"; |
11 |
|
- |
|
12 |
|
- |
private static String makeConfigFileName() |
13 |
|
- |
{ |
14 |
|
- |
String zProperty = System.getProperty( SYSTEM_PROP_CONFIG_FILE ); |
15 |
|
- |
return (zProperty != null) ? zProperty : "NasVideo.properties"; |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
// Set up the Search Path |
19 |
|
- |
private static List<String> createConfigSearchPath( String... pAdditionalPaths ) |
20 |
|
- |
{ |
21 |
|
- |
List<String> zSearchPath = new ArrayList<String>(); |
22 |
|
- |
|
23 |
|
- |
zSearchPath.add( System.getProperty( "CONFIG_DIR" ) ); |
24 |
|
- |
if ( pAdditionalPaths != null ) |
25 |
|
- |
{ |
26 |
|
- |
for ( String zAdditionalPath : pAdditionalPaths ) |
27 |
|
- |
{ |
28 |
|
- |
if ( zAdditionalPath != null ) |
29 |
|
- |
{ |
30 |
|
- |
zSearchPath.add( zAdditionalPath ); |
31 |
|
- |
} |
32 |
|
- |
} |
33 |
|
- |
} |
34 |
|
- |
zSearchPath.add( System.getenv( "CONFIG_DIR" ) ); |
35 |
|
- |
|
36 |
|
- |
return zSearchPath; |
37 |
|
- |
} |
38 |
|
- |
|
39 |
|
- |
public static synchronized void initialize( String... pAdditionalPaths ) |
40 |
|
- |
{ |
41 |
|
- |
if ( !Configuration.isInstantiated() ) |
42 |
|
- |
{ |
43 |
|
- |
new ServerConfiguration( makeConfigAccessorLocator( pAdditionalPaths ) ); // force creation & self registration |
44 |
|
- |
|
45 |
|
- |
// LoggerFactory.init( new ConfigurationLoggerLevel(), getLoggerProxy() ); |
46 |
|
- |
} |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
private static ConfigAccessorLocator makeConfigAccessorLocator( String... pAdditionalPaths ) |
50 |
|
- |
{ |
51 |
|
- |
String configFileName = makeConfigFileName(); |
52 |
|
- |
List<String> zSearchPath = createConfigSearchPath( pAdditionalPaths ); |
53 |
|
- |
|
54 |
|
- |
return new ConfigAccessorLocator( configFileName, ConfigAccessorFactoryProperties.INSTANCE, zSearchPath ); |
55 |
|
- |
} |
56 |
|
- |
} |
|
1 |
+ |
package org.litesoft.nasvideo.server; |
|
2 |
+ |
|
|
3 |
+ |
import java.util.*; |
|
4 |
+ |
|
|
5 |
+ |
import org.litesoft.configuration.*; |
|
6 |
+ |
|
|
7 |
+ |
public class NasVideo_Configuration |
|
8 |
+ |
{ |
|
9 |
+ |
private static final String SYSTEM_PROP_CONFIG_FILE = "CONFIG_FILE"; |
|
10 |
+ |
|
|
11 |
+ |
private static String makeConfigFileName() |
|
12 |
+ |
{ |
|
13 |
+ |
String zProperty = System.getProperty( SYSTEM_PROP_CONFIG_FILE ); |
|
14 |
+ |
return (zProperty != null) ? zProperty : "NasVideo.properties"; |
|
15 |
+ |
} |
|
16 |
+ |
|
|
17 |
+ |
// Set up the Search Path |
|
18 |
+ |
private static List<String> createConfigSearchPath( String... pAdditionalPaths ) |
|
19 |
+ |
{ |
|
20 |
+ |
List<String> zSearchPath = new ArrayList<String>(); |
|
21 |
+ |
|
|
22 |
+ |
zSearchPath.add( System.getProperty( "CONFIG_DIR" ) ); |
|
23 |
+ |
if ( pAdditionalPaths != null ) |
|
24 |
+ |
{ |
|
25 |
+ |
for ( String zAdditionalPath : pAdditionalPaths ) |
|
26 |
+ |
{ |
|
27 |
+ |
if ( zAdditionalPath != null ) |
|
28 |
+ |
{ |
|
29 |
+ |
zSearchPath.add( zAdditionalPath ); |
|
30 |
+ |
} |
|
31 |
+ |
} |
|
32 |
+ |
} |
|
33 |
+ |
zSearchPath.add( System.getenv( "CONFIG_DIR" ) ); |
|
34 |
+ |
|
|
35 |
+ |
return zSearchPath; |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
public static synchronized void initialize( String... pAdditionalPaths ) |
|
39 |
+ |
{ |
|
40 |
+ |
if ( !Configuration.isInstantiated() ) |
|
41 |
+ |
{ |
|
42 |
+ |
new ServerConfiguration( makeConfigAccessorLocator( pAdditionalPaths ) ); // force creation & self registration |
|
43 |
+ |
|
|
44 |
+ |
// LoggerFactory.init( new ConfigurationLoggerLevel(), getLoggerProxy() ); |
|
45 |
+ |
} |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
private static ConfigAccessorLocator makeConfigAccessorLocator( String... pAdditionalPaths ) |
|
49 |
+ |
{ |
|
50 |
+ |
String configFileName = makeConfigFileName(); |
|
51 |
+ |
List<String> zSearchPath = createConfigSearchPath( pAdditionalPaths ); |
|
52 |
+ |
|
|
53 |
+ |
return new ConfigAccessorLocator( configFileName, ConfigAccessorFactoryProperties.INSTANCE, zSearchPath ); |
|
54 |
+ |
} |
|
55 |
+ |
} |