Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
0df91acf
Commit
0df91acf
authored
Jan 05, 2016
by
Jerome Locatelli
Browse files
Merge of branch Instrument_RC_174
parent
aef132ea
Changes
28
Hide whitespace changes
Inline
Side-by-side
build.xml
View file @
0df91acf
...
...
@@ -235,7 +235,7 @@
</exec>
</target>
<target
name=
"jar"
>
<target
name=
"jar"
depends=
"idl,proto"
>
<echo
message=
"Creating nomadCommandSystem.jar"
/>
<jar
destfile=
"nomadCommandSystem.jar"
basedir=
"${classes}"
>
...
...
@@ -247,7 +247,7 @@
</target>
<target
name=
"jar 64bits"
>
<target
name=
"jar 64bits"
depends=
"idl,proto"
>
<echo
message=
"Creating nomadCommandSystem.jar for 64bits system"
/>
<jar
destfile=
"nomadCommandSystem.jar"
basedir=
"${classes}"
>
...
...
lib64/jeromq-0.3.5.jar
0 → 100644
View file @
0df91acf
File added
lib64/nappli-java-api.jar
0 → 100644
View file @
0df91acf
File added
src/fr/ill/ics/bridge/Controller.java
View file @
0df91acf
...
...
@@ -49,4 +49,6 @@ public interface Controller {
public
Controller
getLinkedController
();
public
void
updateDynamicProperties
();
public
int
getDatabaseId
();
}
\ No newline at end of file
src/fr/ill/ics/bridge/ControllerManager.java
View file @
0df91acf
...
...
@@ -57,6 +57,9 @@ public abstract class ControllerManager {
public
abstract
Map
getInstalledCommands
();
public
abstract
Map
<
String
,
Map
<
String
,
List
<
String
>>>
getInstalledControllers
();
public
abstract
Set
<
String
>
getControllerTypes
();
//public abstract Map getInstalledControllers();
public
abstract
Set
<
String
>
getControllersOfType
(
String
type
,
boolean
onlyVisibleOnes
);
...
...
src/fr/ill/ics/bridge/command/AtomicCommandWrapper.java
View file @
0df91acf
...
...
@@ -30,10 +30,16 @@ import fr.ill.ics.nscclient.dataprovider.ServantDatabase;
public
class
AtomicCommandWrapper
extends
CommandWrapper
implements
Controller
{
private
ServerAtomicCommandBox
serverAtomicCommandBox
;
private
int
servantId
;
private
String
type
;
private
String
name
;
public
AtomicCommandWrapper
(
ServerAtomicCommandBox
serverAtomicCommandBox
)
{
super
(
serverAtomicCommandBox
);
this
.
serverAtomicCommandBox
=
serverAtomicCommandBox
;
servantId
=
CommandDatabase
.
getInstance
().
getServantIdForCommand
(
serverAtomicCommandBox
.
getCommandID
());
type
=
ServantDatabase
.
getInstance
().
getServantType
(
servantId
);
name
=
ServantDatabase
.
getInstance
().
getServantName
(
servantId
);
}
public
void
unregister
()
{
...
...
@@ -44,13 +50,11 @@ public class AtomicCommandWrapper extends CommandWrapper implements Controller {
}
public
String
getName
()
{
int
servantId
=
CommandDatabase
.
getInstance
().
getServantIdForCommand
(
serverAtomicCommandBox
.
getCommandID
());
return
ServantDatabase
.
getInstance
().
getServantName
(
servantId
);
return
name
;
}
public
String
getType
()
{
int
servantId
=
CommandDatabase
.
getInstance
().
getServantIdForCommand
(
serverAtomicCommandBox
.
getCommandID
());
return
ServantDatabase
.
getInstance
().
getServantType
(
servantId
);
return
type
;
}
public
Set
getCommandNames
()
{
...
...
@@ -77,7 +81,7 @@ public class AtomicCommandWrapper extends CommandWrapper implements Controller {
}
public
int
getServantId
()
{
return
CommandDatabase
.
getInstance
().
getServantIdForCommand
(
serverAtomicCommandBox
.
getCommandID
())
;
return
servantId
;
}
public
boolean
isSettings
()
{
...
...
@@ -108,7 +112,7 @@ public class AtomicCommandWrapper extends CommandWrapper implements Controller {
return
serverAtomicCommandBox
.
getSettingsFileName
();
}
public
int
getDatabaseI
D
()
{
public
int
getDatabaseI
d
()
{
return
serverAtomicCommandBox
.
getDatabaseID
();
}
...
...
src/fr/ill/ics/bridge/command/ControlCommandWrapper.java
View file @
0df91acf
...
...
@@ -116,7 +116,7 @@ public class ControlCommandWrapper extends CommandWrapper {
return
new
CommandZoneIteratorWrapper
(
serverControlCommandBox
.
getContent
(
thenBlock
));
}
public
int
getDatabaseI
D
()
{
public
int
getDatabaseI
d
()
{
return
serverControlCommandBox
.
getDatabaseID
();
}
...
...
src/fr/ill/ics/bridge/command/ForLoopCommandWrapper.java
View file @
0df91acf
...
...
@@ -199,7 +199,7 @@ public class ForLoopCommandWrapper extends CommandWrapper implements IForLoopEve
return
getCommandBoxID
();
}
public
int
getDatabaseI
D
()
{
public
int
getDatabaseI
d
()
{
return
serverForLoopCommandBox
.
getDatabaseID
();
}
...
...
src/fr/ill/ics/bridge/command/GenericCommandWrapper.java
View file @
0df91acf
...
...
@@ -86,7 +86,7 @@ public class GenericCommandWrapper extends CommandWrapper {
return
"generic"
;
}
public
int
getDatabaseI
D
()
{
public
int
getDatabaseI
d
()
{
return
serverGenericCommandBox
.
getDatabaseID
();
}
...
...
src/fr/ill/ics/bridge/command/ICommandBoxEventListener.java
View file @
0df91acf
...
...
@@ -25,7 +25,7 @@ public interface ICommandBoxEventListener {
void
commandTerminated
();
void
progressChanged
(
double
progress
);
int
getDatabaseI
D
();
int
getDatabaseI
d
();
int
getCommandBoxID
();
void
onReset
();
void
onExpressionChanged
();
...
...
src/fr/ill/ics/bridge/command/IForLoopEventListener.java
View file @
0df91acf
...
...
@@ -22,7 +22,7 @@ public interface IForLoopEventListener {
void
currentValueChanged
(
double
value
,
int
lineIndex
);
int
getDatabaseI
D
();
int
getDatabaseI
d
();
int
getForLoopCommandBoxID
();
}
\ No newline at end of file
src/fr/ill/ics/bridge/command/ScanCommandWrapper.java
View file @
0df91acf
...
...
@@ -80,7 +80,7 @@ public class ScanCommandWrapper extends CommandWrapper {
return
commandId
;
}
public
int
getDatabaseI
D
()
{
public
int
getDatabaseI
d
()
{
return
serverScanCommandBox
.
getDatabaseID
();
}
}
\ No newline at end of file
src/fr/ill/ics/core/command/Command.java
View file @
0df91acf
...
...
@@ -33,6 +33,7 @@ public class Command extends CommandAction implements ServerCommandStateChangeLi
private
int
id
;
private
int
databaseId
;
private
String
serverId
;
// package protected constructor (have to be created by CommandManager)
Command
(
int
databaseId
,
int
id
,
String
commandName
)
{
...
...
@@ -41,12 +42,13 @@ public class Command extends CommandAction implements ServerCommandStateChangeLi
this
.
databaseId
=
databaseId
;
DataNotificationClient
.
getInstance
().
addCommandStateChangeListener
(
this
);
DataNotificationClient
.
getInstance
().
addCommandProgressionChangeListener
(
this
);
this
.
isRunning
=
(
DataAccessor
.
getInstance
(
"real"
).
getCommandState
(
databaseId
,
id
)
==
ClientCommandState
.
ACTIVE
);
serverId
=
DataAccessor
.
getServerId
(
databaseId
);
this
.
isRunning
=
(
DataAccessor
.
getInstance
(
serverId
).
getCommandState
(
0
,
id
)
==
ClientCommandState
.
ACTIVE
);
}
public
ClientCommandState
getCommandState
()
{
return
DataAccessor
.
getInstance
(
"real"
).
getCommandState
(
databaseId
,
id
);
return
DataAccessor
.
getInstance
(
serverId
).
getCommandState
(
0
,
id
);
}
/**
...
...
@@ -60,7 +62,7 @@ public class Command extends CommandAction implements ServerCommandStateChangeLi
this
.
isRunning
=
false
;
try
{
DataAccessor
.
getInstance
(
"real"
).
execute
(
databaseId
,
id
);
DataAccessor
.
getInstance
(
serverId
).
execute
(
databaseId
,
id
);
showStartingCommandMessage
();
}
catch
(
UnknownCommandException
e
)
{
LOGGER
.
logp
(
Level
.
SEVERE
,
this
.
getClass
().
getName
(),
"execute"
,
"Unknown command: "
+
this
.
id
);
...
...
@@ -72,7 +74,7 @@ public class Command extends CommandAction implements ServerCommandStateChangeLi
*
*/
public
void
stop
()
{
DataAccessor
.
getInstance
(
"real"
).
stop
(
databaseId
,
id
);
DataAccessor
.
getInstance
(
serverId
).
stop
(
databaseId
,
id
);
showStoppingCommandMessage
();
}
...
...
src/fr/ill/ics/core/command/CommandManager.java
View file @
0df91acf
...
...
@@ -69,7 +69,7 @@ public class CommandManager {
}
else
{
int
id
=
CommandDatabase
.
getInstance
().
getCommandId
(
servantId
,
commandName
);
if
(
id
!=
-
1
)
{
command
=
new
Command
(
((
CorbaServant
)
controller
)
.
getDatabaseId
(),
id
,
commandName
);
command
=
new
Command
(
controller
.
getDatabaseId
(),
id
,
commandName
);
allCommands
.
put
(
commandName
,
command
);
}
}
...
...
src/fr/ill/ics/core/property/Property.java
View file @
0df91acf
...
...
@@ -73,6 +73,8 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
protected
boolean
showSettingPropertyMessage
=
true
;
private
String
name
;
/**
*
* @param id
...
...
@@ -83,6 +85,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
this
.
containerId
=
containerId
;
this
.
isCommandBox
=
isCommandBox
;
this
.
name
=
PropertyDatabase
.
getInstance
().
getPropertyName
(
id
);
maxLength
=
getDefaultMaxLength
();
...
...
@@ -206,7 +209,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
}
public
String
getName
()
{
return
PropertyDatabase
.
getInstance
().
getPropertyName
(
id
)
;
return
name
;
}
/**
...
...
src/fr/ill/ics/core/property/PropertyManager.java
View file @
0df91acf
...
...
@@ -151,7 +151,7 @@ public class PropertyManager {
* @return
*/
private
boolean
readPropertiesClientFilesFor
(
String
controllerType
)
{
if
(
clientFilesFoundPerControllerType
.
containsKey
(
controllerType
))
{
return
clientFilesFoundPerControllerType
.
get
(
controllerType
);
}
...
...
@@ -200,7 +200,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
())
{
...
...
@@ -344,11 +344,11 @@ public class PropertyManager {
return
property
;
}
public
void
getDynamicPropertyForCommandBox
(
AtomicCommandWrapper
controller
)
{
}
/**
*
...
...
@@ -358,10 +358,10 @@ public class PropertyManager {
// create dynamically a list of properties and create a new xml file
Map
propertyNamesAndTypes
=
servant
.
getPropertyNamesAndTypes
();
// Does controllerTypeProperties.xml file exist on client side ?
String
fileName
=
ConfigManager
.
CONTROLLERS_DIRECTORY
+
servant
.
getType
()
+
ConfigManager
.
FILE_SEPARATOR
+
servant
.
getType
()
+
ConfigManager
.
PROPERTIES_PATTERN
;
boolean
existsOnClientSide
=
new
File
(
fileName
).
exists
();
if
(!
existsOnClientSide
)
{
fileName
=
servant
.
getType
()
+
ConfigManager
.
PROPERTIES_PATTERN
;
...
...
@@ -377,7 +377,7 @@ public class PropertyManager {
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>
propertiesFromFile
=
new
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>(
propertyParser
.
getProperties
().
size
());
propertiesFromFile
.
putAll
(
propertyParser
.
getProperties
());
propertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
propertiesFromFile
);
Map
propertiesTypesFromFile
=
new
LinkedHashMap
<
String
,
String
>(
propertyParser
.
getPropertyTypes
().
size
());
propertiesTypesFromFile
.
putAll
(
propertyParser
.
getPropertyTypes
());
}
...
...
@@ -429,18 +429,18 @@ public class PropertyManager {
ConfigManager
.
CONFIGURATION_ERROR
=
true
;
return
null
;
}
if
(
propertyDescriptor
!=
null
)
{
Property
property
=
PropertyFactory
.
getInstance
().
createProperty
(
servant
.
getDatabaseId
(),
id
,
getPropertyDescriptor
(
servant
.
getType
(),
propertyName
),
false
);
properties
.
put
(
propertyName
,
property
);
return
property
;
}
// create the property from database
Property
property
=
PropertyFactory
.
getInstance
().
createProperty
(
servant
.
getDatabaseId
(),
id
,
"unknown"
,
false
);
properties
.
put
(
propertyName
,
property
);
return
property
;
}
...
...
@@ -463,7 +463,7 @@ public class PropertyManager {
ConfigManager
.
CONFIGURATION_ERROR
=
true
;
return
null
;
}
if
(
propertyDescriptor
!=
null
)
{
Property
property
=
PropertyFactory
.
getInstance
().
createProperty
(
command
.
getId
(),
propertyId
,
getPropertyDescriptor
(
command
.
getType
(),
propertyName
),
true
);
...
...
@@ -471,11 +471,11 @@ public class PropertyManager {
properties
.
put
(
propertyName
,
property
);
return
property
;
}
// create the property from database
Property
property
=
PropertyFactory
.
getInstance
().
createProperty
(
command
.
getId
(),
propertyId
,
"unknown"
,
true
);
properties
.
put
(
propertyName
,
property
);
return
property
;
}
...
...
@@ -507,7 +507,7 @@ public class PropertyManager {
List
<
Integer
>
ids
=
dynamicPropertyDescriptor
.
getIds
();
for
(
int
i
=
0
;
i
<
ids
.
size
();
i
++)
{
Property
childProperty
=
PropertyFactory
.
getInstance
().
createProperty
(
command
.
getId
(),
(
Integer
)
ids
.
get
(
i
),
xmlDynamicPropertyDescriptor
,
true
);
Property
childProperty
=
PropertyFactory
.
getInstance
().
createProperty
(
command
.
getId
(),
ids
.
get
(
i
),
xmlDynamicPropertyDescriptor
,
true
);
childProperty
.
setServerId
(
command
.
getServerId
());
childProperties
.
put
(
childProperty
.
getName
(),
childProperty
);
...
...
@@ -691,25 +691,28 @@ public class PropertyManager {
int
servantId
=
ServantDatabase
.
getInstance
().
getServantId
(
controllerName
);
return
PropertyDatabase
.
getInstance
().
getSpyPropertyDescriptors
(
servantId
);
}
public
boolean
spyHasContent
(
String
controllerName
)
{
Set
<
SpyPropertyDescriptor
>
setOfDescriptors
=
getListOfpropertyDescriptorForSpy
(
controllerName
);
if
(
setOfDescriptors
!=
null
&&
setOfDescriptors
.
size
()
>
0
)
{
if
(
setOfDescriptors
.
size
()
==
1
)
{
// Verify the only property loaded is not a commandStatus property
Iterator
<
SpyPropertyDescriptor
>
it
=
setOfDescriptors
.
iterator
();
SpyPropertyDescriptor
spyDescriptor
=
it
.
next
();
int
actualPropertyID
=
spyDescriptor
.
getActualID
();
String
actualPropertyName
=
PropertyDatabase
.
getInstance
().
getPropertyName
(
actualPropertyID
);
if
(
actualPropertyName
.
equals
(
"commandStatus"
))
{
return
false
;
}
return
true
;
//can this case happen? (that is: only one property & property != commandStatus)
if
(
setOfDescriptors
.
size
()
<=
2
)
{
return
false
;
}
// if (setOfDescriptors.size() == 1) {
// // Verify the only property loaded is not a commandStatus property
// Iterator<SpyPropertyDescriptor> it = setOfDescriptors.iterator();
// SpyPropertyDescriptor spyDescriptor = it.next();
//
// int actualPropertyID = spyDescriptor.getActualID();
// String actualPropertyName = PropertyDatabase.getInstance().getPropertyName(actualPropertyID);
// if (actualPropertyName.equals("commandStatus")) {
// return false;
// }
// return true; //can this case happen? (that is: only one property & property != commandStatus)
// }
return
true
;
}
return
false
;
...
...
@@ -782,7 +785,7 @@ public class PropertyManager {
* @return a set containing all property names for given controller type
*/
public
Set
getPropertiesForControllersType
(
String
controllerType
)
{
SortedSet
properties
=
new
TreeSet
();
if
(
propertiesByControllerType
.
get
(
controllerType
)
!=
null
)
{
properties
.
addAll
(
propertiesByControllerType
.
get
(
controllerType
).
keySet
());
...
...
@@ -797,10 +800,10 @@ public class PropertyManager {
*/
public
Set
<
String
>
getPropertiesForController
(
String
controllerName
)
{
int
servantId
=
ServantDatabase
.
getInstance
().
getServantId
(
controllerName
);
SortedSet
<
String
>
properties
=
new
TreeSet
<
String
>();
Map
<
String
,
String
>
namesAndTypes
=
PropertyDatabase
.
getInstance
().
getPropertyNamesAndTypes
(
servantId
);
if
(
namesAndTypes
!=
null
)
{
properties
.
addAll
(
namesAndTypes
.
keySet
());
}
else
{
...
...
@@ -816,10 +819,10 @@ public class PropertyManager {
*/
public
Set
<
String
>
getDynamicPropertiesForController
(
String
controllerName
)
{
int
servantId
=
ServantDatabase
.
getInstance
().
getServantId
(
controllerName
);
SortedSet
<
String
>
properties
=
new
TreeSet
<
String
>();
Map
<
String
,
String
>
namesAndTypes
=
PropertyDatabase
.
getInstance
().
getDynamicPropertyNamesAndTypes
(
servantId
);
if
(
namesAndTypes
!=
null
)
{
properties
.
addAll
(
namesAndTypes
.
keySet
());
}
else
{
...
...
@@ -848,20 +851,20 @@ public class PropertyManager {
* @return
*/
public
Property
getProperty
(
int
servantId
,
String
propertyName
)
{
Property
property
=
propertyMap
.
get
(
servantId
).
get
(
propertyName
);
if
(
property
==
null
)
{
int
propertyId
=
PropertyDatabase
.
getInstance
().
getPropertyIdForServant
(
servantId
,
propertyName
);
// create the property from database
// container id should not be important unless for properties of command box that should already have been created
// should we test is command box?
property
=
PropertyFactory
.
getInstance
().
createProperty
(
0
,
propertyId
,
"unknown"
,
false
);
propertyMap
.
get
(
servantId
).
put
(
propertyName
,
property
);
}
return
property
;
}
...
...
@@ -960,8 +963,8 @@ public class PropertyManager {
public
void
removePropertyDescriptor
(
String
controllerType
)
{
propertiesByControllerType
.
remove
(
controllerType
);
}
static
class
CommandBoxKey
{
private
String
serverId
;
private
int
commandBoxId
;
...
...
src/fr/ill/ics/core/property/array/Float32Array.java
View file @
0df91acf
...
...
@@ -114,6 +114,9 @@ public class Float32Array extends Array {
}
public
boolean
onlyContainsNegativeValues
()
{
if
(
array
==
null
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
array
[
i
]
>
0
)
{
return
false
;
...
...
src/fr/ill/ics/core/property/array/Float64Array.java
View file @
0df91acf
...
...
@@ -113,6 +113,9 @@ public class Float64Array extends Array {
}
public
boolean
onlyContainsNegativeValues
()
{
if
(
array
==
null
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
array
[
i
]
>
0
)
{
return
false
;
...
...
src/fr/ill/ics/core/property/array/Int16Array.java
View file @
0df91acf
...
...
@@ -122,6 +122,9 @@ public class Int16Array extends Array {
}
public
boolean
onlyContainsNegativeValues
()
{
if
(
array
==
null
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
array
[
i
]
>
0
)
{
return
false
;
...
...
src/fr/ill/ics/core/property/array/Int32Array.java
View file @
0df91acf
...
...
@@ -121,6 +121,9 @@ public class Int32Array extends Array {
}
public
boolean
onlyContainsNegativeValues
()
{
if
(
array
==
null
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
array
[
i
]
>
0
)
{
return
false
;
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment