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
58124022
Commit
58124022
authored
Feb 14, 2017
by
yannick legoc
Browse files
Reimplemented ServantManager with Cameo.
parent
3f754319
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
58124022
...
...
@@ -193,11 +193,6 @@
<arg
line=
"${idlFlags} ${idlCoreDir}/SessionGateway.idl"
/>
</exec>
<echo
message=
"Generating ServantManager.java"
/>
<exec
executable=
"idl"
>
<arg
line=
"${idlFlags} ${idlCoreDir}/ServantManager.idl"
/>
</exec>
<echo
message=
"Generating CommandZoneAccessor.java"
/>
<exec
executable=
"idl"
>
<arg
line=
"${idlFlags} ${idlCoreDir}/commandzone/CommandZoneAccessor.idl"
/>
...
...
@@ -356,6 +351,11 @@
<exec
executable=
"protoc"
>
<arg
line=
"${protoFlags} ${protoDir}/DatabaseRequests.proto"
/>
</exec>
<echo
message=
"Generating ServantManagerRequests.java"
/>
<exec
executable=
"protoc"
>
<arg
line=
"${protoFlags} ${protoDir}/ServantManagerRequests.proto"
/>
</exec>
</target>
</configuration>
...
...
src/main/java/fr/ill/ics/nscclient/dataprovider/DataAccessor.java
View file @
58124022
...
...
@@ -76,7 +76,7 @@ public class DataAccessor {
databaseRequester
=
Application
.
Requester
.
create
(
nomad
,
"database"
);
}
catch
(
RequesterCreationException
e
)
{
System
.
err
.
println
(
"Problem to connect to the database responder
"
);
System
.
err
.
println
(
"Problem to connect to the database responder
: "
+
e
.
getMessage
()
);
return
;
}
...
...
src/main/java/fr/ill/ics/nscclient/
servant/Corba
ServantManager.java
→
src/main/java/fr/ill/ics/nscclient/
dataprovider/
ServantManager
Accessor
.java
View file @
58124022
This diff is collapsed.
Click to expand it.
src/main/java/fr/ill/ics/nscclient/log/LogSubscriber.java
View file @
58124022
...
...
@@ -150,13 +150,6 @@ public class LogSubscriber {
// Define the log publisher.
String
logPublisherName
=
"log_publisher"
;
// Do not connect to the same application if it is simulated.
if
(!
serverId
.
equals
(
CommandZoneWrapper
.
SERVER_ID
))
{
// Add the server id to the publisher name.
logPublisherName
+=
serverId
;
}
System
.
out
.
println
(
"Trying to connect log subscriber to "
+
logPublisherName
);
// Create the subscriber.
...
...
src/main/java/fr/ill/ics/nscclient/servant/ConfigurationManager.java
View file @
58124022
...
...
@@ -18,14 +18,14 @@
package
fr.ill.ics.nscclient.servant
;
import
fr.ill.ics.nscclient.
servant.Corba
ServantManager
.LoadConfigurationFailure
;
import
fr.ill.ics.nscclient.
sessionmanagement.ServerSessionManager
;
import
fr.ill.ics.nscclient.
dataprovider.
ServantManager
Accessor
;
import
fr.ill.ics.nscclient.
dataprovider.ServantManagerAccessor.LoadConfigurationFailure
;
public
class
ConfigurationManager
{
private
static
ConfigurationManager
instance
=
null
;
private
String
serverId
;
private
Corba
ServantManager
servantManager
;
private
ServantManager
Accessor
servantManager
Accessor
;
public
class
LoadFailure
extends
Exception
{}
...
...
@@ -54,14 +54,15 @@ public class ConfigurationManager {
*
*/
protected
void
init
()
throws
LoadFailure
{
this
.
servantManager
=
ServerSessionManage
r
.
getInstance
(
serverId
)
.
getServantManager
()
;
this
.
servantManager
Accessor
=
ServantManagerAccesso
r
.
getInstance
(
serverId
);
loadWholeConfiguration
();
}
public
void
loadWholeConfiguration
()
throws
LoadFailure
{
try
{
servantManager
.
loadWholeConfiguration
();
servantManagerAccessor
.
loadWholeConfiguration
();
}
catch
(
LoadConfigurationFailure
e
)
{
throw
new
LoadFailure
();
}
...
...
src/main/java/fr/ill/ics/nscclient/servant/CorbaControllerManager.java
View file @
58124022
...
...
@@ -33,6 +33,8 @@ import fr.ill.ics.bridge.Controller;
import
fr.ill.ics.bridge.ControllerManager
;
import
fr.ill.ics.bridge.listeners.ServerConfigurationChangeListener
;
import
fr.ill.ics.nscclient.dataprovider.ServantDatabase
;
import
fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor
;
import
fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor.LoadConfigurationFailure
;
import
fr.ill.ics.nscclient.sessionmanagement.ServerSessionManager
;
import
fr.ill.ics.util.exception.ControllerNotFoundException
;
...
...
@@ -41,7 +43,6 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
private
String
serverId
;
private
HashMap
<
String
,
LinkedHashSet
<
String
>>
visibleControllerNamesByType
;
// KEY=controller type VALUE=list of matching controller names
private
HashMap
<
String
,
LinkedHashSet
<
String
>>
allControllerNamesByType
;
// KEY=controller type VALUE=list of matching controller names
private
CorbaServantManager
servantManager
;
/**
*
...
...
@@ -56,13 +57,16 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
*
*/
protected
void
init
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
fillControllerNamesByTypeMaps
();
}
protected
void
reset
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
servantManager
.
updateWholeConfiguration
();
try
{
ServantManagerAccessor
.
getInstance
(
serverId
).
updateWholeConfiguration
();
}
catch
(
LoadConfigurationFailure
e
)
{
System
.
err
.
println
(
"Unable to update the whole configuration"
);
}
fillControllerNamesByTypeMaps
();
}
...
...
@@ -73,7 +77,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
CorbaController
getController
(
String
controllerName
)
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getControllerDescriptor
(
controllerName
);
if
(
descriptor
!=
null
)
{
CorbaController
controller
=
s
ervantManager
.
getController
(
descriptor
);
CorbaController
controller
=
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getController
(
descriptor
);
return
controller
;
}
ControllerNotFoundException
cnfe
=
new
ControllerNotFoundException
(
controllerName
,
""
,
getClass
().
getCanonicalName
(),
"getController"
);
...
...
@@ -83,7 +87,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
CorbaController
cloneController
(
String
controllerName
)
throws
ControllerNotFoundException
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getControllerDescriptor
(
controllerName
);
if
(
descriptor
!=
null
)
{
CorbaController
controller
=
s
ervantManager
.
cloneController
(
descriptor
);
CorbaController
controller
=
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
cloneController
(
descriptor
);
return
controller
;
}
ControllerNotFoundException
cnfe
=
new
ControllerNotFoundException
(
controllerName
,
""
,
getClass
().
getCanonicalName
(),
"cloneController"
);
...
...
@@ -93,7 +97,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
void
removeController
(
String
controllerName
)
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getControllerDescriptor
(
controllerName
);
if
(
descriptor
!=
null
)
{
s
ervantManager
.
removeController
(
descriptor
);
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
removeController
(
descriptor
);
}
}
...
...
@@ -117,7 +121,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
HashMap
<
String
,
LinkedHashMap
<
String
,
String
>>
getPropertiesForGeneric
()
{
return
s
ervantManager
.
getPropertiesForGeneric
();
return
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getPropertiesForGeneric
();
}
...
...
@@ -276,14 +280,14 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
void
updateDynamicProperties
(
Controller
controller
)
{
CorbaController
corbaController
=
(
CorbaController
)
controller
;
s
ervantManager
.
updateDynamicProperties
(
corbaController
.
getId
());
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
updateDynamicProperties
(
corbaController
.
getId
());
}
public
void
configurationChanged
(
int
servantID
,
ClientEnableState
enable
)
{
// the reload of controllers is not made here but in the CommandsSelectionPlugin
// and SettingsSelectionPlugin classes
s
ervantManager
.
updateDynamicProperties
(
servantID
);
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
updateDynamicProperties
(
servantID
);
}
...
...
@@ -295,6 +299,6 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
public
String
getControllerNameWithRole
(
Controller
controller
,
String
role
)
{
CorbaController
corbaController
=
(
CorbaController
)
controller
;
return
s
ervantManager
.
getControllerNameWithRole
(
corbaController
.
getId
(),
role
);
return
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getControllerNameWithRole
(
corbaController
.
getId
(),
role
);
}
}
\ No newline at end of file
src/main/java/fr/ill/ics/nscclient/servant/CorbaDriverManager.java
View file @
58124022
...
...
@@ -29,25 +29,24 @@ import java.util.TreeMap;
import
fr.ill.ics.bridge.DriverManager
;
import
fr.ill.ics.nscclient.dataprovider.ServantDatabase
;
import
fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor
;
import
fr.ill.ics.nscclient.sessionmanagement.ServerSessionManager
;
public
class
CorbaDriverManager
extends
DriverManager
{
private
String
serverId
;
private
CorbaServantManager
servantManager
;
public
CorbaDriverManager
(
String
serverId
)
{
this
.
serverId
=
serverId
;
}
protected
void
init
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
}
public
CorbaDriver
getDriver
(
String
driverName
)
{
ClientServantDescriptor
descriptor
=
ServantDatabase
.
getInstance
().
getDriverDescriptor
(
driverName
);
if
(
descriptor
!=
null
)
{
CorbaDriver
driver
=
s
ervantManager
.
getDriver
(
descriptor
);
CorbaDriver
driver
=
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getDriver
(
descriptor
);
return
driver
;
}
return
null
;
...
...
@@ -83,7 +82,7 @@ public class CorbaDriverManager extends DriverManager {
Map
<
String
,
Map
<
String
,
String
>>
allChildren
=
new
LinkedHashMap
<
String
,
Map
<
String
,
String
>>();
List
<
String
>
children
=
s
ervantManager
.
getChildServants
(
descriptor
.
getId
());
List
<
String
>
children
=
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getChildServants
(
descriptor
.
getId
());
Iterator
<
String
>
it
=
children
.
iterator
();
while
(
it
.
hasNext
())
{
...
...
@@ -117,11 +116,7 @@ public class CorbaDriverManager extends DriverManager {
public
void
setPaused
(
boolean
isPaused
)
{
servantManager
.
pauseSpies
(
isPaused
);
if
(!
isPaused
)
{
servantManager
.
initDriversAndProtocols
();
}
ServantManagerAccessor
.
getInstance
(
serverId
).
pauseSpies
(
isPaused
);
}
...
...
@@ -137,7 +132,7 @@ public class CorbaDriverManager extends DriverManager {
public
void
reconnectDriver
(
String
driverName
)
{
CorbaDriver
driver
=
getDriver
(
driverName
);
if
(
driver
!=
null
)
{
s
ervantManager
.
reconnectDriver
(
driver
.
getDatabaseId
(),
driver
.
getId
());
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
reconnectDriver
(
driver
.
getDatabaseId
(),
driver
.
getId
());
}
}
...
...
src/main/java/fr/ill/ics/nscclient/servant/CorbaResourceManager.java
View file @
58124022
...
...
@@ -19,12 +19,11 @@
package
fr.ill.ics.nscclient.servant
;
import
fr.ill.ics.bridge.ResourceManager
;
import
fr.ill.ics.nscclient.
sessionmanagement.ServerSessionManage
r
;
import
fr.ill.ics.nscclient.
dataprovider.ServantManagerAccesso
r
;
public
class
CorbaResourceManager
extends
ResourceManager
{
private
String
serverId
;
private
CorbaServantManager
servantManager
;
/**
*
...
...
@@ -37,23 +36,21 @@ public class CorbaResourceManager extends ResourceManager {
*
*/
protected
void
init
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
}
protected
void
reset
()
{
this
.
servantManager
=
ServerSessionManager
.
getInstance
(
serverId
).
getServantManager
();
}
public
String
[]
getResourceFilesByExtension
(
String
extension
)
{
return
s
ervantManager
.
getResourceFilesByExtension
(
extension
);
return
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
getResourceFilesByExtension
(
extension
);
}
public
byte
[]
getBinaryFileContent
(
String
controllerType
,
String
fileName
)
throws
ResourceNotFoundException
{
return
s
ervantManager
.
readBinaryResourceFile
(
controllerType
,
fileName
);
return
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
readBinaryResourceFile
(
controllerType
,
fileName
);
}
public
String
getFileContent
(
String
controllerType
,
String
fileName
)
throws
ResourceNotFoundException
{
return
s
ervantManager
.
readResourceFile
(
controllerType
,
fileName
);
return
S
ervantManager
Accessor
.
getInstance
(
serverId
)
.
readResourceFile
(
controllerType
,
fileName
);
/*
String fullFilePath = "/home/dpt/ortizh/tmp/" + fileName;
...
...
@@ -82,8 +79,7 @@ public class CorbaResourceManager extends ResourceManager {
System
.
out
.
println
(
"H.ORTIZ: call to writeResourceFile commented .................................................."
+
fileName
);
// servantManager.writeResourceFile(controllerType, fileName, content);
//ServantManagerAccessor.getInstance(serverId).writeResourceFile(controllerType, fileName, content);
/*
...
...
src/main/java/fr/ill/ics/nscclient/serverconnection/ServerInstance.java
View file @
58124022
...
...
@@ -56,7 +56,7 @@ public class ServerInstance {
}
}
else
{
// Find the real instance.
String
[]
nomadAppNames
=
{
"ns"
,
"nsd"
,
"nsv"
};
String
[]
nomadAppNames
=
{
"ns"
,
"nsd"
,
"nsg"
,
"nsv"
};
try
{
for
(
String
appName
:
nomadAppNames
)
{
nomad
=
server
.
connect
(
appName
);
...
...
src/main/java/fr/ill/ics/nscclient/sessionmanagement/CorbaSessionGateway.java
View file @
58124022
...
...
@@ -24,23 +24,22 @@ import org.omg.PortableServer.POAPackage.ServantNotActive;
import
org.omg.PortableServer.POAPackage.WrongAdapter
;
import
org.omg.PortableServer.POAPackage.WrongPolicy
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.nomadserver.common.DataChangeSubscriber
;
import
fr.ill.ics.nomadserver.common.DataChangeSubscriberHelper
;
import
fr.ill.ics.nomadserver.core.SessionGateway
;
import
fr.ill.ics.nscclient.corbabase.CorbaORB
;
import
fr.ill.ics.nscclient.notification.DataChangeSubscriberImpl
;
import
fr.ill.ics.nscclient.servant.CorbaServantManager
;
public
class
CorbaSessionGateway
{
private
CorbaServantManager
servantManager
;
private
Application
.
Requester
servantManagerRequester
;
private
SessionGateway
sessionGateway
;
private
DataChangeSubscriberImpl
dataChangeSubscriberImpl
;
public
CorbaSessionGateway
(
SessionGateway
sessionGateway
)
{
this
.
sessionGateway
=
sessionGateway
;
this
.
servantManager
=
new
CorbaServantManager
(
sessionGateway
.
getServantManager
());
subscribeToDataChangePublisher
();
}
...
...
@@ -54,11 +53,6 @@ public class CorbaSessionGateway {
System
.
err
.
println
(
"unable to logout from session gateway"
);
}
}
public
CorbaServantManager
getServantManager
()
{
return
servantManager
;
}
private
void
subscribeToDataChangePublisher
()
{
try
{
...
...
src/main/java/fr/ill/ics/nscclient/sessionmanagement/ServerSessionManager.java
View file @
58124022
...
...
@@ -35,11 +35,11 @@ import fr.ill.ics.nscclient.command.ScanCommandBoxAccessorProxy;
import
fr.ill.ics.nscclient.commandline.CommandLineProxyImpl
;
import
fr.ill.ics.nscclient.condition.ConditionManagerProxy
;
import
fr.ill.ics.nscclient.dataprovider.DataAccessor
;
import
fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor
;
import
fr.ill.ics.nscclient.log.LogSubscriber
;
import
fr.ill.ics.nscclient.notification.commandzone.ServerCommandZoneEventManager
;
import
fr.ill.ics.nscclient.servant.ConfigurationManager
;
import
fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure
;
import
fr.ill.ics.nscclient.servant.CorbaServantManager
;
import
fr.ill.ics.nscclient.serverconnection.ServerInstance
;
import
fr.ill.ics.nscclient.survey.SurveySubcriberImpl
;
...
...
@@ -68,10 +68,9 @@ public class ServerSessionManager {
throw
new
ConnectionFailure
();
}
// initialise DataAccessor
DataAccessor
.
getInstance
(
serverId
).
init
();
ServantManagerAccessor
.
getInstance
(
serverId
).
init
();
// initialise all commandzone accessors
CommandZoneAccessorProxy
.
getInstance
(
serverId
).
init
();
CommandBoxAccessorProxy
.
getInstance
(
serverId
).
init
();
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
init
();
...
...
@@ -129,6 +128,7 @@ public class ServerSessionManager {
// initialise DataAccessor
DataAccessor
.
getInstance
(
serverId
).
init
();
ServantManagerAccessor
.
getInstance
(
serverId
).
init
();
if
(
currentSession
!=
null
)
{
currentSession
.
logout
();
...
...
@@ -155,6 +155,7 @@ public class ServerSessionManager {
SurveySubcriberImpl
.
getInstance
(
serverId
).
unsubscribe
();
DataAccessor
.
getInstance
(
serverId
).
reset
();
ServantManagerAccessor
.
getInstance
(
serverId
).
reset
();
currentSession
.
logout
();
currentSession
=
null
;
...
...
@@ -180,9 +181,9 @@ public class ServerSessionManager {
currentSession
=
null
;
}
}
public
Corba
ServantManager
getServantManager
()
{
return
currentSession
.
getServantManager
(
);
public
ServantManager
Accessor
getServantManager
Accessor
()
{
return
ServantManagerAccessor
.
getInstance
(
serverId
);
}
public
boolean
isLogged
()
{
...
...
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