Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
61502640
Commit
61502640
authored
Dec 12, 2014
by
helene ortiz
Browse files
Nomad GUI conf files migration
parent
d2f34ec8
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/bridge/ControllerManager.java
View file @
61502640
...
...
@@ -83,4 +83,6 @@ public abstract class ControllerManager {
public
abstract
String
getControllerNameWithRole
(
Controller
controller
,
String
role
);
public
abstract
String
getFileContent
(
String
controllerType
,
String
fileName
);
public
abstract
void
setFileContent
(
String
controllerType
,
String
fileName
,
String
content
);
}
src/fr/ill/ics/bridge/DriverManager.java
View file @
61502640
...
...
@@ -60,4 +60,7 @@ public abstract class DriverManager {
public
abstract
Long
getChannel
(
String
driverName
);
public
abstract
void
reconnectDriver
(
String
driverName
);
public
abstract
String
getFileContent
(
String
controllerType
,
String
fileName
);
public
abstract
void
setFileContent
(
String
controllerType
,
String
fileName
,
String
content
);
}
\ No newline at end of file
src/fr/ill/ics/core/property/PropertyManager.java
View file @
61502640
...
...
@@ -59,7 +59,7 @@ public class PropertyManager {
// Logger
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PropertyManager
.
class
.
getName
());
private
Map
<
String
,
Boolean
>
clientFilesFoundPerControllerType
;
// Store controller types which client files have already been read
static
class
CommandBoxKey
{
...
...
@@ -92,7 +92,7 @@ public class PropertyManager {
return
this
.
toString
().
equals
(
content
);
}
}
private
PropertyParser
propertyParser
;
private
Map
<
Integer
,
Map
<
String
,
Property
>>
propertyMap
=
new
HashMap
<
Integer
,
Map
<
String
,
Property
>>(
NB_CONTROLLERS
);
// KEY=Servant id VALUE=Map(KEY=propertyName VALUE=Property instance)
...
...
@@ -174,43 +174,67 @@ public class PropertyManager {
* @return
*/
private
boolean
readPropertiesClientFilesFor
(
String
controllerType
)
{
if
(
clientFilesFoundPerControllerType
.
containsKey
(
controllerType
))
{
return
clientFilesFoundPerControllerType
.
get
(
controllerType
);
}
String
[]
files
=
FileHelper
.
getFilesListByExtension
(
ConfigManager
.
CONTROLLERS_DIRECTORY
+
controllerType
+
ConfigManager
.
FILE_SEPARATOR
,
"Properties.xml"
,
true
,
true
);
//changed
if
(
files
==
null
||
files
.
length
==
0
)
{
clientFilesFoundPerControllerType
.
put
(
controllerType
,
false
);
return
false
;
}
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
// We may have more than one "Properties.xml" file (see acquisition controller for example)
propertyParser
.
parseXmlFile
(
files
[
i
]);
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>
propertiesFromFile
=
new
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>(
propertyParser
.
getProperties
().
size
());
propertiesFromFile
.
putAll
(
propertyParser
.
getProperties
());
String
[]
files
=
FileHelper
.
getFilesListByExtension
(
ConfigManager
.
CONTROLLERS_DIRECTORY
+
controllerType
+
ConfigManager
.
FILE_SEPARATOR
,
ConfigManager
.
PROPERTIES_PATTERN
,
true
,
true
);
if
(
files
==
null
||
files
.
length
==
0
)
{
propertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
propertiesFromFile
);
// Search on server side
String
fileName
=
controllerType
+
ConfigManager
.
PROPERTIES_PATTERN
;
String
fileContent
=
DriverManager
.
getInstance
().
getFileContent
(
controllerType
,
fileName
);
if
(
fileContent
==
null
)
{
fileContent
=
ControllerManager
.
getInstance
().
getFileContent
(
controllerType
,
fileName
);
}
if
(
fileContent
!=
null
)
{
propertyParser
.
parseXmlString
(
fileContent
);
processParsedProperties
();
}
else
{
clientFilesFoundPerControllerType
.
put
(
controllerType
,
false
);
return
false
;
}
}
else
{
if
(!
propertyParser
.
getDynamicProperties
().
isEmpty
())
{
if
(
dynamicPropertiesByControllerType
==
null
)
{
dynamicPropertiesByControllerType
=
new
HashMap
(
NB_CONTROLLER_TYPES
);
}
Map
<
String
,
XMLDynamicPropertyDescriptor
>
dynamicPropertiesFromFile
=
new
LinkedHashMap
(
propertyParser
.
getDynamicProperties
().
size
());
dynamicPropertiesFromFile
.
putAll
(
propertyParser
.
getDynamicProperties
());
dynamicPropertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
dynamicPropertiesFromFile
);
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
// We may have more than one "Properties.xml" file (see acquisition controller for example)
propertyParser
.
parseXmlFile
(
files
[
i
]);
processParsedProperties
();
}
Map
propertiesTypesFromFile
=
new
LinkedHashMap
(
propertyParser
.
getProperties
().
size
());
propertiesTypesFromFile
.
putAll
(
propertyParser
.
getPropertyTypes
());
}
ConfigManager
.
getInstance
().
initControllerProperties
(
controllerType
);
clientFilesFoundPerControllerType
.
put
(
controllerType
,
true
);
return
true
;
}
/**
*
*/
private
void
processParsedProperties
()
{
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>
propertiesFromFile
=
new
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>(
propertyParser
.
getProperties
().
size
());
propertiesFromFile
.
putAll
(
propertyParser
.
getProperties
());
propertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
propertiesFromFile
);
if
(!
propertyParser
.
getDynamicProperties
().
isEmpty
())
{
if
(
dynamicPropertiesByControllerType
==
null
)
{
dynamicPropertiesByControllerType
=
new
HashMap
(
NB_CONTROLLER_TYPES
);
}
Map
<
String
,
XMLDynamicPropertyDescriptor
>
dynamicPropertiesFromFile
=
new
LinkedHashMap
(
propertyParser
.
getDynamicProperties
().
size
());
dynamicPropertiesFromFile
.
putAll
(
propertyParser
.
getDynamicProperties
());
dynamicPropertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
dynamicPropertiesFromFile
);
}
Map
propertiesTypesFromFile
=
new
LinkedHashMap
(
propertyParser
.
getProperties
().
size
());
propertiesTypesFromFile
.
putAll
(
propertyParser
.
getPropertyTypes
());
}
/**
...
...
@@ -375,7 +399,7 @@ public class PropertyManager {
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>
propertiesFromFile
=
new
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>(
propertyParser
.
getProperties
().
size
());
propertiesFromFile
.
putAll
(
propertyParser
.
getProperties
());
propertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
propertiesFromFile
);
if
(!
propertyParser
.
getDynamicProperties
().
isEmpty
())
{
if
(
dynamicPropertiesByControllerType
==
null
)
{
dynamicPropertiesByControllerType
=
new
HashMap
(
NB_CONTROLLER_TYPES
);
...
...
@@ -387,7 +411,7 @@ public class PropertyManager {
Map
propertiesTypesFromFile
=
new
LinkedHashMap
<
String
,
String
>(
propertyParser
.
getPropertyTypes
().
size
());
propertiesTypesFromFile
.
putAll
(
propertyParser
.
getPropertyTypes
());
}
/**
*
* @param servant
...
...
src/fr/ill/ics/core/property/parser/PropertyParser.java
View file @
61502640
...
...
@@ -243,8 +243,7 @@ public class PropertyParser extends GenericParser {
// then ignor the property
propertyTypeAttribute
=
(
String
)
entry
.
getValue
();
if
(!
propertyTypeAttribute
.
equals
(
""
))
{
out
.
write
(
"\t<"
+
TAG_PROPERTY
+
" "
+
ATTRIBUTE_PROPERTY_NAME
+
"=\""
+
entry
.
getKey
()
+
"\" "
+
ATTRIBUTE_PROPERTY_TYPE
+
"=\""
+
propertyTypeAttribute
+
"\">"
);
out
.
write
(
"\t<"
+
TAG_PROPERTY
+
" "
+
ATTRIBUTE_PROPERTY_NAME
+
"=\""
+
entry
.
getKey
()
+
"\" "
+
ATTRIBUTE_PROPERTY_TYPE
+
"=\""
+
propertyTypeAttribute
+
"\">"
);
out
.
write
(
LINE_SEPARATOR
);
out
.
write
(
"\t</"
+
TAG_PROPERTY
+
">"
);
out
.
write
(
LINE_SEPARATOR
);
...
...
src/fr/ill/ics/nscclient/dataprovider/PropertyDatabase.java
View file @
61502640
...
...
@@ -103,12 +103,12 @@ public class PropertyDatabase {
spyPropertiesByServant
.
put
(
servantId
,
set
);
}
spyPropertiesByServant
.
get
(
servantId
).
add
(
descriptor
);
/*
if (descriptor.getSetpointID() != 0) {
System.out.println("spy property for servant " + servantId);
System.out.println(descriptor);
}
*/
}
/**
...
...
src/fr/ill/ics/nscclient/servant/CorbaControllerManager.java
View file @
61502640
...
...
@@ -18,6 +18,10 @@
package
fr.ill.ics.nscclient.servant
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
...
...
@@ -47,7 +51,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
*/
public
CorbaControllerManager
(
String
serverId
)
{
this
.
serverId
=
serverId
;
addConfigurationChangeListener
(
this
);
}
...
...
@@ -58,14 +62,14 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
fillControllerNamesByTypeMaps
();
}
protected
void
reset
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
servantManager
.
updateWholeConfiguration
();
fillControllerNamesByTypeMaps
();
}
/**
*
*/
...
...
@@ -86,33 +90,33 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
}
return
null
;
}
public
void
removeController
(
String
controllerName
)
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getControllerDescriptor
(
controllerName
);
if
(
descriptor
!=
null
)
{
servantManager
.
removeController
(
descriptor
);
}
}
/**
*
*/
public
Set
<
String
>
getControllersOfType
(
String
type
,
boolean
onlyVisibleOnes
)
{
return
ServantDatabase
.
getInstance
().
getControllersOfType
(
type
,
onlyVisibleOnes
);
}
public
boolean
controllerIsEnabled
(
String
controllerName
)
{
return
ServantDatabase
.
getInstance
().
controllerIsEnabled
(
controllerName
);
}
public
HashMap
<
String
,
LinkedHashMap
<
String
,
String
>>
getPropertiesForGeneric
()
{
return
servantManager
.
getPropertiesForGeneric
();
}
public
String
getType
(
String
controllerName
)
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getControllerDescriptor
(
controllerName
);
...
...
@@ -124,7 +128,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
Map
getInstalledControllers
()
{
Map
<
String
,
List
<
String
>>
installedControllers
=
new
TreeMap
<
String
,
List
<
String
>>();
Iterator
<
ClientServantDescriptor
>
it
=
ServantDatabase
.
getInstance
().
getControllers
().
iterator
();
while
(
it
.
hasNext
())
{
ClientServantDescriptor
descriptor
=
it
.
next
();
...
...
@@ -138,18 +142,18 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
familyMembers
.
add
(
descriptor
.
getName
());
}
}
return
installedControllers
;
}
public
Map
getInstalledCommands
()
{
Map
<
String
,
List
<
String
>>
installedCommands
=
new
TreeMap
<
String
,
List
<
String
>>();
Iterator
<
ClientServantDescriptor
>
it
=
ServantDatabase
.
getInstance
().
getControllers
().
iterator
();
while
(
it
.
hasNext
())
{
ClientServantDescriptor
descriptor
=
it
.
next
();
if
(
descriptor
.
isCommand
()
&&
descriptor
.
isEnabled
()
&&
descriptor
.
isVisible
())
{
String
family
=
descriptor
.
getFamily
();
List
familyMembers
=
installedCommands
.
get
(
family
);
...
...
@@ -160,11 +164,11 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
familyMembers
.
add
(
descriptor
.
getName
());
}
}
return
installedCommands
;
}
/**
*
*/
...
...
@@ -174,7 +178,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
Iterator
<
ClientServantDescriptor
>
it
=
ServantDatabase
.
getInstance
().
getControllers
().
iterator
();
while
(
it
.
hasNext
())
{
ClientServantDescriptor
descriptor
=
it
.
next
();
/**
* H.ORTIZ Sept.2012: remove test on isCommand property because the map "controllerNamesByType" is
* also used for "for-all" plugins in Settings tab. Somehow, it may now result in a inconstistency
...
...
@@ -183,7 +187,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
*/
if
(
descriptor
.
isEnabled
())
{
String
controllerType
=
descriptor
.
getType
();
if
(!
allControllerNamesByType
.
containsKey
(
controllerType
))
{
allControllerNamesByType
.
put
(
controllerType
,
new
LinkedHashSet
<
String
>());
}
...
...
@@ -200,7 +204,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
}
}
}
public
Set
getStartedControllers
()
{
Set
startedCommands
=
new
HashSet
();
...
...
@@ -224,7 +228,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
commandsOfType
.
add
(
descriptor
.
getName
());
}
}
return
commandsOfType
;
}
...
...
@@ -237,7 +241,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
return
null
;
}
public
LinkedHashSet
<
String
>
getControllersOfTypeInDisplayOrder
(
String
controllerType
,
boolean
onlyVisibleOnes
)
{
if
(
onlyVisibleOnes
)
{
return
visibleControllerNamesByType
.
get
(
controllerType
);
...
...
@@ -269,6 +273,28 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
CorbaController
corbaController
=
(
CorbaController
)
controller
;
return
servantManager
.
getControllerNameWithRole
(
corbaController
.
getId
(),
role
);
}
public
String
getFileContent
(
String
controllerType
,
String
fileName
)
{
String
fullFilePath
=
"/home/dpt/ortizh/tmp/"
+
fileName
;
if
(
new
File
(
fullFilePath
).
exists
())
{
try
{
String
content
=
""
;
String
line
;
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
fullFilePath
));
while
((
line
=
in
.
readLine
())
!=
null
)
{
content
=
content
+
line
+
"\n"
;
}
in
.
close
();
return
content
;
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"IOException while getting content of file "
+
fullFilePath
);
e
.
printStackTrace
();
}
}
return
null
;
}
public
void
setFileContent
(
String
controllerType
,
String
fileName
,
String
content
)
{
}
}
\ No newline at end of file
src/fr/ill/ics/nscclient/servant/CorbaDriverManager.java
View file @
61502640
...
...
@@ -18,6 +18,10 @@
package
fr.ill.ics.nscclient.servant
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.Iterator
;
...
...
@@ -39,7 +43,7 @@ public class CorbaDriverManager extends DriverManager {
public
CorbaDriverManager
(
String
serverId
)
{
this
.
serverId
=
serverId
;
}
protected
void
init
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
}
...
...
@@ -63,29 +67,29 @@ public class CorbaDriverManager extends DriverManager {
public
Map
getInstalledDrivers
()
{
Map
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>
installedDrivers
=
new
TreeMap
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>();
Iterator
<
ClientServantDescriptor
>
it
=
ServantDatabase
.
getInstance
().
getDrivers
().
iterator
();
while
(
it
.
hasNext
())
{
ClientServantDescriptor
descriptor
=
it
.
next
();
if
(
descriptor
.
isEnabled
()
&&
descriptor
.
isRoot
())
{
Map
<
String
,
Map
<
String
,
String
>>
children
=
getChildren
(
descriptor
);
installedDrivers
.
put
(
descriptor
.
getName
(),
children
);
}
}
return
installedDrivers
;
}
private
Map
getChildren
(
ClientServantDescriptor
descriptor
)
{
Map
<
String
,
Map
<
String
,
String
>>
allChildren
=
new
LinkedHashMap
<
String
,
Map
<
String
,
String
>>();
List
<
String
>
children
=
servantManager
.
getChildServants
(
descriptor
.
getId
());
Iterator
<
String
>
it
=
children
.
iterator
();
while
(
it
.
hasNext
())
{
String
childName
=
it
.
next
();
ClientServantDescriptor
childDescriptor
=
ServantDatabase
.
getInstance
().
getDriverDescriptor
(
childName
);
...
...
@@ -93,15 +97,15 @@ public class CorbaDriverManager extends DriverManager {
allChildren
.
put
(
childName
,
getChildren
(
childDescriptor
));
}
}
return
allChildren
;
}
public
Collection
getControllersOfType
(
String
driverType
)
{
return
ServantDatabase
.
getInstance
().
getDriversOfType
(
driverType
,
false
);
}
public
Set
getStartedControllers
()
{
Set
startedCommands
=
new
HashSet
();
Iterator
<
ClientServantDescriptor
>
it
=
ServantDatabase
.
getInstance
().
getDrivers
().
iterator
();
...
...
@@ -118,22 +122,22 @@ public class CorbaDriverManager extends DriverManager {
public
void
setPaused
(
boolean
isPaused
)
{
servantManager
.
pauseSpies
(
isPaused
);
if
(!
isPaused
)
{
servantManager
.
initDriversAndProtocols
();
}
}
public
Long
getChannel
(
String
driverName
)
{
CorbaDriver
driver
=
getDriver
(
driverName
);
if
(
driver
!=
null
)
{
return
getDriver
(
driverName
).
getChannel
();
}
return
null
;
}
public
void
reconnectDriver
(
String
driverName
)
{
CorbaDriver
driver
=
getDriver
(
driverName
);
if
(
driver
!=
null
)
{
...
...
@@ -141,4 +145,26 @@ public class CorbaDriverManager extends DriverManager {
}
}
public
String
getFileContent
(
String
controllerType
,
String
fileName
)
{
String
fullFilePath
=
"/home/dpt/ortizh/tmp/"
+
controllerType
+
"/"
+
fileName
;
if
(
new
File
(
fullFilePath
).
exists
())
{
try
{
String
content
=
""
;
String
line
;
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
fullFilePath
));
while
((
line
=
in
.
readLine
())
!=
null
)
{
content
=
content
+
line
+
"\n"
;
}
in
.
close
();
return
content
;
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"IOException while getting content of file "
+
fullFilePath
);
e
.
printStackTrace
();
}
}
return
null
;
}
public
void
setFileContent
(
String
controllerType
,
String
fileName
,
String
content
)
{
}
}
\ No newline at end of file
src/fr/ill/ics/util/ConfigManager.java
View file @
61502640
...
...
@@ -18,12 +18,15 @@
package
fr.ill.ics.util
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
...
...
@@ -35,8 +38,6 @@ import java.util.StringTokenizer;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
*
* <p>This class manages the nomad configuration
...
...
@@ -48,6 +49,9 @@ import java.util.logging.Logger;
*/
public
class
ConfigManager
{
public
final
static
String
PROPERTIES_EXTENSION
=
".properties"
;
public
final
static
String
PROPERTIES_PATTERN
=
"Properties.xml"
;
public
final
static
String
NOMAD_CLIENT_FILES
=
System
.
getProperty
(
"user.home"
);
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
ConfigManager
.
class
.
getName
());
...
...
@@ -87,7 +91,7 @@ public class ConfigManager {
private
Set
<
String
>
instrumentsAllowingPALFiles
;
public
static
boolean
CONFIGURATION_ERROR
=
false
;
/**
* @return the unique instance of this class
*/
...
...
@@ -111,7 +115,7 @@ public class ConfigManager {
instance
.
init
();
}
}
public
static
void
initInstanceWithoutPropertyLoading
()
{
if
(
instance
==
null
)
{
instance
=
new
ConfigManager
();
...
...
@@ -145,8 +149,8 @@ public class ConfigManager {
properties
=
new
Properties
();
// Load all properties file from conf directory
List
<
String
>
propertiesFiles
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
FileHelper
.
getFilesListByExtension
(
CLIENT_CONF_DIRECTORY
,
".properties"
,
true
,
true
)));
//changed
propertiesFiles
.
addAll
(
new
ArrayList
<
String
>(
Arrays
.
asList
(
FileHelper
.
getFilesListByExtension
(
SERVER_CONF_DIRECTORY
,
".properties"
,
true
,
true
))));
//changed
List
<
String
>
propertiesFiles
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
FileHelper
.
getFilesListByExtension
(
CLIENT_CONF_DIRECTORY
,
PROPERTIES_EXTENSION
,
true
,
true
)));
propertiesFiles
.
addAll
(
new
ArrayList
<
String
>(
Arrays
.
asList
(
FileHelper
.
getFilesListByExtension
(
SERVER_CONF_DIRECTORY
,
PROPERTIES_EXTENSION
,
true
,
true
))));
Iterator
<
String
>
it
=
propertiesFiles
.
iterator
();
while
(
it
.
hasNext
())
{
...
...
@@ -179,9 +183,23 @@ public class ConfigManager {
}*/
}
}
}
public
void
addPropertiesFromServerFiles
(
String
propertiesAsString
)
{
try
{
InputStream
in
=
new
ByteArrayInputStream
(
propertiesAsString
.
getBytes
(
"UTF-8"
));
properties
.
load
(
in
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
/**
* Sets the properties. Used for Android system that cannot load files from the file system automatically.
* A better solution can be implemented by using strategies.
...
...
@@ -190,7 +208,7 @@ public class ConfigManager {
public
void
setProperties
(
Properties
properties
)
{
this
.
properties
=
properties
;
}
/**
* Sets the preferences. Used for Android system that cannot load files from the file system automatically.
* A better solution can be implemented by using strategies.
...
...
@@ -207,7 +225,7 @@ public class ConfigManager {
return
false
;
}
/*
/*
public void initControllersProperties() {
Set<String> subDirectories = FileHelper.getSubDirectories(CONTROLLERS_DIRECTORY);
...
...
@@ -218,7 +236,7 @@ public class ConfigManager {
String controllerType = it.next();
String[] files = FileHelper.getFilesListByExtension(ConfigManager.CONTROLLERS_DIRECTORY + controllerType + ConfigManager.FILE_SEPARATOR,
".properties"
, true, true);
//changed
String[] files = FileHelper.getFilesListByExtension(ConfigManager.CONTROLLERS_DIRECTORY + controllerType + ConfigManager.FILE_SEPARATOR,
PROPERTIES_EXTENSION
, true, true);
for (int i = 0; i < files.length; i++) {
// We may have more than one properties file (see acquisition controller for example)