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
93beaf9b
Commit
93beaf9b
authored
May 07, 2015
by
Jerome Locatelli
Browse files
merge branch Instrument_RC_174 to trunk
parents
1c7cfa58
3eb48b17
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/bridge/ControllerManager.java
View file @
93beaf9b
...
...
@@ -21,6 +21,7 @@ package fr.ill.ics.bridge;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -55,7 +56,8 @@ public abstract class ControllerManager {
public
abstract
Map
getInstalledCommands
();
public
abstract
Map
getInstalledControllers
();
public
abstract
Map
<
String
,
Map
<
String
,
List
<
String
>>>
getInstalledControllers
();
//public abstract Map getInstalledControllers();
public
abstract
Set
<
String
>
getControllersOfType
(
String
type
,
boolean
onlyVisibleOnes
);
...
...
src/fr/ill/ics/core/command/CommandManager.java
View file @
93beaf9b
...
...
@@ -22,6 +22,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
fr.ill.ics.bridge.Controller
;
import
fr.ill.ics.bridge.command.AtomicCommandWrapper
;
import
fr.ill.ics.nscclient.dataprovider.CommandDatabase
;
import
fr.ill.ics.nscclient.servant.CorbaServant
;
...
...
@@ -52,7 +53,13 @@ public class CommandManager {
controllerCommands
.
put
(
controller
,
new
HashMap
());
}
int
servantId
=
((
CorbaServant
)
controller
).
getId
();
int
servantId
;
if
(
controller
instanceof
CorbaServant
)
{
servantId
=
((
CorbaServant
)
controller
).
getId
();
}
else
{
servantId
=
((
AtomicCommandWrapper
)
controller
).
getId
();
}
// Create a new command if it doesn't already exist or just retrieve it from the Map
Map
allCommands
=
(
HashMap
)
controllerCommands
.
get
(
controller
);
...
...
src/fr/ill/ics/core/property/PropertyManager.java
View file @
93beaf9b
...
...
@@ -682,18 +682,22 @@ public class PropertyManager {
}
public
boolean
isAnAutogeneratedSpy
(
String
controllerName
)
{
public
boolean
spyHasContent
(
String
controllerName
)
{
Set
<
SpyPropertyDescriptor
>
setOfDescriptors
=
getListOfpropertyDescriptorForSpy
(
controllerName
);
if
(
setOfDescriptors
!=
null
&&
setOfDescriptors
.
size
()
==
1
)
{
// Verify the only property loaded is not a commandStatus property (maybe this situation never takes place)
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
;
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)
}
return
true
;
}
...
...
src/fr/ill/ics/nscclient/dataprovider/PropertyDatabase.java
View file @
93beaf9b
...
...
@@ -25,9 +25,11 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
fr.ill.ics.nscclient.servant.DynamicPropertyDescriptor
;
import
fr.ill.ics.nscclient.servant.SpyPropertyDescriptor
;
import
fr.ill.ics.nscclient.servant.SpyPropertyDescriptorComparator
;
import
fr.ill.ics.nscclient.servant.StandardPropertyDescriptor
;
public
class
PropertyDatabase
{
...
...
@@ -102,16 +104,17 @@ public class PropertyDatabase {
public
void
addSpyPropertyDescriptor
(
int
servantId
,
SpyPropertyDescriptor
descriptor
)
{
if
(!
spyPropertiesByServant
.
containsKey
(
servantId
))
{
Set
<
SpyPropertyDescriptor
>
set
=
new
HashSet
<
SpyPropertyDescriptor
>();
// we chose to display:
// - properties with setpoint in the order of ID
// - properties without setpoint in the order of ID
Set
<
SpyPropertyDescriptor
>
set
=
new
TreeSet
<
SpyPropertyDescriptor
>(
new
SpyPropertyDescriptorComparator
());
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);
}
*/
// System.out.println("spy property for servant " + servantId);
// System.out.println(descriptor);
}
/**
...
...
src/fr/ill/ics/nscclient/servant/CorbaControllerManager.java
View file @
93beaf9b
...
...
@@ -121,7 +121,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
return
null
;
}
private
Map
getInstalledControllers
(
boolean
testCommand
)
{
private
Map
<
String
,
Map
<
String
,
List
<
String
>>>
getInstalledControllers
(
boolean
testCommand
)
{
Map
<
String
,
Map
<
String
,
List
<
String
>>>
installedControllers
=
new
TreeMap
<
String
,
Map
<
String
,
List
<
String
>>>();
...
...
@@ -168,11 +168,11 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
}
public
Map
getInstalledControllers
()
{
public
Map
<
String
,
Map
<
String
,
List
<
String
>>>
getInstalledControllers
()
{
return
getInstalledControllers
(
false
);
}
public
Map
getInstalledCommands
()
{
public
Map
<
String
,
Map
<
String
,
List
<
String
>>>
getInstalledCommands
()
{
return
getInstalledControllers
(
true
);
}
...
...
src/fr/ill/ics/nscclient/servant/SpyPropertyDescriptorComparator.java
0 → 100644
View file @
93beaf9b
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package
fr.ill.ics.nscclient.servant
;
import
java.util.Comparator
;
public
class
SpyPropertyDescriptorComparator
implements
Comparator
<
SpyPropertyDescriptor
>
{
@Override
public
int
compare
(
SpyPropertyDescriptor
d1
,
SpyPropertyDescriptor
d2
)
{
// first comparing set point ID before actual ID
if
(
d1
.
getSetpointID
()
==
d2
.
getSetpointID
())
{
return
Integer
.
compare
(
d1
.
getActualID
(),
d2
.
getActualID
());
}
if
(
d2
.
getSetpointID
()
==
0
)
{
// d1.setpointID > 0
// so d1 is considered smaller than d2
return
-
1
;
}
if
(
d1
.
getSetpointID
()
==
0
)
{
// d2.setpointID > 0
// so d1 is considered greater than d2
return
1
;
}
return
Integer
.
compare
(
d1
.
getSetpointID
(),
d2
.
getSetpointID
());
}
}
\ No newline at end of file
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