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
65cf55ca
Commit
65cf55ca
authored
Jan 12, 2016
by
yannick legoc
Browse files
src
parent
c14fe7b6
Changes
222
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/bridge/ChangeManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
fr.ill.ics.nscclient.log.LogSubcriberImpl
;
import
fr.ill.ics.nscclient.notification.DataNotificationClient
;
import
fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient
;
import
fr.ill.ics.nscclient.survey.SurveySubcriberImpl
;
public
class
ChangeManager
{
private
static
ChangeManager
instance
=
null
;
private
ChangeManager
()
{
}
public
static
ChangeManager
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
ChangeManager
();
}
return
instance
;
}
public
void
readAndDispatch
()
{
DataNotificationClient
.
getInstance
().
readAndDispatch
();
CommandZoneEventClient
.
getInstance
().
readAndDispatch
();
// Iterating the map of log subscribers
Map
<
String
,
LogSubcriberImpl
>
logSubscriberMap
=
LogSubcriberImpl
.
getInstances
();
Iterator
<
Entry
<
String
,
LogSubcriberImpl
>>
it
=
logSubscriberMap
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
LogSubcriberImpl
logSubscriber
=
it
.
next
().
getValue
();
logSubscriber
.
readAndDispatch
();
}
// Iterating the map of survey subscribers
Map
<
String
,
SurveySubcriberImpl
>
surveySubscriberMap
=
SurveySubcriberImpl
.
getInstances
();
Iterator
<
Entry
<
String
,
SurveySubcriberImpl
>>
it2
=
surveySubscriberMap
.
entrySet
().
iterator
();
while
(
it2
.
hasNext
())
{
SurveySubcriberImpl
surveySubscriber
=
it2
.
next
().
getValue
();
surveySubscriber
.
readAndDispatch
();
}
}
public
void
readAndDispatchALotOfEvents
()
{
}
}
\ No newline at end of file
src/fr/ill/ics/bridge/ClientCalculator.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
public
class
ClientCalculator
{
native
public
double
[]
multiGaussianFit
(
double
[]
yData
);
native
public
int
getNumberOfPeaks
();
native
public
double
[]
exponentialFit
(
double
[]
yData
,
double
[]
xData
);
native
public
double
[]
simpleGaussianFit
(
double
[]
yData
);
static
{
System
.
loadLibrary
(
"clientcalculator"
);
}
}
\ No newline at end of file
src/fr/ill/ics/bridge/Controller.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.Map
;
import
java.util.Set
;
import
fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerProgressChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerPropertyChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerResetCommandListener
;
public
interface
Controller
{
public
String
getName
();
public
String
getType
();
public
Set
getCommandNames
();
public
String
getControllerNameWithRole
(
String
role
);
public
Map
getPropertyNamesAndTypes
();
public
String
getPropertyType
(
String
propertyName
);
public
void
addServerPropertyChangeListener
(
ServerPropertyChangeListener
listener
);
public
void
removeServerPropertyChangeListener
(
ServerPropertyChangeListener
listener
);
public
void
addServerProgressChangeListener
(
ServerProgressChangeListener
listener
);
public
void
removeServerProgressChangeListener
(
ServerProgressChangeListener
listener
);
public
void
addServerCommandStateChangeListener
(
ServerCommandStateChangeListener
listener
);
public
void
removeServerCommandStateChangeListener
(
ServerCommandStateChangeListener
listener
);
public
void
addServerResetCommandListener
(
ServerResetCommandListener
listener
);
public
void
removeServerResetCommandListener
(
ServerResetCommandListener
listener
);
public
Controller
getLinkedController
();
public
void
updateDynamicProperties
();
public
int
getDatabaseId
();
}
\ No newline at end of file
src/fr/ill/ics/bridge/ControllerManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.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
;
import
fr.ill.ics.bridge.listeners.ServerConfigurationChangeListener
;
import
fr.ill.ics.nscclient.notification.DataNotificationClient
;
import
fr.ill.ics.nscclient.servant.CorbaControllerManager
;
public
abstract
class
ControllerManager
{
private
static
ControllerManager
instance
=
null
;
public
static
ControllerManager
getInstance
()
{
return
instance
;
}
public
static
void
initInstance
(
String
serverId
)
{
instance
=
new
CorbaControllerManager
(
serverId
);
instance
.
init
();
}
public
static
void
resetInstance
()
{
instance
=
null
;
}
protected
abstract
void
init
();
public
abstract
Set
getCommandsOfType
(
String
controllerType
);
public
abstract
String
getType
(
String
controllerName
);
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
);
public
abstract
boolean
controllerIsEnabled
(
String
controllerName
);
public
abstract
LinkedHashSet
<
String
>
getControllersOfTypeInDisplayOrder
(
String
controllerType
,
boolean
onlyVisibleOnes
);
public
abstract
Set
getStartedControllers
();
public
abstract
Controller
getController
(
String
controllerName
);
public
abstract
Controller
cloneController
(
String
controllerName
);
public
abstract
void
removeController
(
String
controllerName
);
public
abstract
String
getFamily
(
String
controllerName
);
public
abstract
String
getSubfamily
(
String
controllerName
);
public
void
addConfigurationChangeListener
(
ServerConfigurationChangeListener
listener
)
{
DataNotificationClient
.
getInstance
().
addConfigurationChangeListener
(
listener
);
}
public
abstract
HashMap
<
String
,
LinkedHashMap
<
String
,
String
>>
getPropertiesForGeneric
();
public
abstract
void
updateDynamicProperties
(
Controller
controller
);
public
abstract
void
reloadControllers
();
public
abstract
String
getControllerNameWithRole
(
Controller
controller
,
String
role
);
}
src/fr/ill/ics/bridge/DriverManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.Set
;
import
fr.ill.ics.nscclient.servant.CorbaDriverManager
;
public
abstract
class
DriverManager
{
private
static
DriverManager
instance
=
null
;
public
static
DriverManager
getInstance
()
{
return
instance
;
}
public
static
void
initInstance
(
String
serverId
)
{
instance
=
new
CorbaDriverManager
(
serverId
);
instance
.
init
();
}
public
static
void
resetInstance
()
{
instance
=
null
;
}
protected
abstract
void
init
();
public
abstract
String
getType
(
String
treeItemText
);
public
abstract
Map
getInstalledDrivers
();
public
abstract
void
setPaused
(
boolean
checked
);
public
abstract
Set
getStartedControllers
();
public
abstract
Controller
getDriver
(
String
driverName
);
public
abstract
Collection
getControllersOfType
(
String
controllerType
);
public
abstract
Long
getChannel
(
String
driverName
);
public
abstract
void
reconnectDriver
(
String
driverName
);
}
\ No newline at end of file
src/fr/ill/ics/bridge/ErrorManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
fr.ill.ics.bridge.events.ServerErrorEvent
;
import
fr.ill.ics.bridge.listeners.ServerErrorListener
;
/**
*
* @author ortizh
*
*/
public
class
ErrorManager
{
private
static
Map
<
String
,
ErrorManager
>
instances
=
new
HashMap
<
String
,
ErrorManager
>();
private
List
<
ServerErrorListener
>
serverErrorListeners
;
private
ErrorManager
()
{
serverErrorListeners
=
new
ArrayList
<
ServerErrorListener
>();
}
public
static
ErrorManager
getInstance
(
String
serverId
)
{
if
(!
instances
.
containsKey
(
serverId
))
{
ErrorManager
instance
=
new
ErrorManager
();
instances
.
put
(
serverId
,
instance
);
}
return
instances
.
get
(
serverId
);
}
/**
* Add new listener for server error events
* @param listener
*/
public
void
addServerErrorListener
(
ServerErrorListener
listener
)
{
synchronized
(
serverErrorListeners
)
{
if
(!
serverErrorListeners
.
contains
(
listener
))
{
serverErrorListeners
.
add
(
listener
);
}
}
}
/**
* Remove listener for server error events
* @param listener
*/
public
void
removeServerErrorListener
(
ServerErrorListener
listener
)
{
synchronized
(
serverErrorListeners
)
{
if
(
serverErrorListeners
.
contains
(
listener
))
{
serverErrorListeners
.
remove
(
listener
);
}
}
}
/**
* Notify all server error listeners
* @param anEvent
*/
public
void
notifyServerErrorListeners
(
ServerErrorEvent
anEvent
)
{
// Make a copy of the list to allow the client to do and add/remove during a notification
ArrayList
<
ServerErrorListener
>
changeListeners
;
synchronized
(
serverErrorListeners
)
{
changeListeners
=
new
ArrayList
(
serverErrorListeners
);
}
for
(
int
i
=
0
;
i
<
changeListeners
.
size
();
i
++)
{
ServerErrorListener
aListener
=
changeListeners
.
get
(
i
);
aListener
.
serverError
(
anEvent
);
}
}
}
\ No newline at end of file
src/fr/ill/ics/bridge/LogEventSender.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.HashMap
;
import
java.util.Map
;
import
fr.ill.ics.bridge.listeners.ServerLogEventListener
;
import
fr.ill.ics.bridge.listeners.ServerLogXMLListener
;
import
fr.ill.ics.nscclient.log.LogSubcriberImpl
;
public
class
LogEventSender
{
private
static
Map
<
String
,
LogEventSender
>
instances
=
new
HashMap
<
String
,
LogEventSender
>();
private
String
serverId
;
private
LogEventSender
(
String
serverId
)
{
this
.
serverId
=
serverId
;
}
public
static
LogEventSender
getInstance
(
String
serverId
)
{
if
(!
instances
.
containsKey
(
serverId
))
{
LogEventSender
instance
=
new
LogEventSender
(
serverId
);
instances
.
put
(
serverId
,
instance
);
}
return
instances
.
get
(
serverId
);
}
/**
* Add new listener for server log events
* @param listener
*/
public
void
addLogEventListener
(
ServerLogEventListener
listener
)
{
LogSubcriberImpl
.
getInstance
(
serverId
).
addLogEventListener
(
listener
);
}
public
void
removeLogEventListener
(
ServerLogEventListener
listener
)
{
LogSubcriberImpl
.
getInstance
(
serverId
).
removeLogEventListener
(
listener
);
}
public
void
addLogXMLListener
(
ServerLogXMLListener
listener
)
{
LogSubcriberImpl
.
getInstance
(
serverId
).
addLogXMLListener
(
listener
);
}
public
void
removeLogXMLListener
(
ServerLogXMLListener
listener
)
{
LogSubcriberImpl
.
getInstance
(
serverId
).
removeLogXMLListener
(
listener
);
}
}
\ No newline at end of file
src/fr/ill/ics/bridge/LoginManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*
* 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.bridge
;
import
java.util.Properties
;
import
fr.ill.ics.nscclient.corbabase.CorbaNamingService
;
import
fr.ill.ics.nscclient.corbabase.CorbaORB
;
import
fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure
;
import
fr.ill.ics.nscclient.serverconnection.ServerConnection
;
import
fr.ill.ics.nscclient.sessionmanagement.CorbaSessionManager
;
import
fr.ill.ics.nscclient.sessionmanagement.ServerSessionManager
;
public
class
LoginManager
{
private
static
LoginManager
instance
=
null
;
private
LoginManager
()
{
}
public
static
LoginManager
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
LoginManager
();
}
return
instance
;
}
public
class
LoginIncorrectException
extends
Exception
{}
public
class
ClientAlreadyLaunchedException
extends
Exception
{}
public
class
ConnectionFailure
extends
Exception
{};
public
void
initCommunication
()
throws
ConnectionFailure
{
initCommunication
(
null
);
}
/*
* Example of jacorb properties:
* Properties jacorbProperties = new Properties();
* ...
* jacorbProperties.setProperty("ORBInitRef.NameService", "corbaloc::localhost:2809/NameService");
*/
public
void
initCommunication
(
Properties
jacorbProperties
)
throws
ConnectionFailure
{
CorbaORB
.
getInstance
().
init
(
jacorbProperties
);
CorbaNamingService
.
getInstance
().
init
();
if
(!
CorbaNamingService
.
getInstance
().
isOk
())
{
throw
new
ConnectionFailure
();
}
}
public
void
login
(
String
login
,
String
password
,
boolean
standalone
,
String
serverId
)
throws
LoginIncorrectException
,
ClientAlreadyLaunchedException
,
ConnectionFailure
{
try
{
ServerSessionManager
.
getInstance
(
serverId
).
login
(
standalone
);
}
catch
(
CorbaSessionManager
.
ClientAlreadyLaunchedException
e
)
{
throw
new
ClientAlreadyLaunchedException
();
}
catch
(
ServerSessionManager
.
ConnectionFailure
e
)
{
throw
new
ConnectionFailure
();
}
catch
(
LoadFailure
e
)
{
throw
new
ConnectionFailure
();
}
}
public
void
logintab
(
String
login
,
String
password
,
boolean
standalone
,
String
serverId
)
throws
LoginIncorrectException
,
ClientAlreadyLaunchedException
,
ConnectionFailure
{
try
{
ServerSessionManager
.
getInstance
(
serverId
).
logintab
(
standalone
);
}
catch
(
CorbaSessionManager
.
ClientAlreadyLaunchedException
e
)
{
throw
new
ClientAlreadyLaunchedException
();
}
catch
(
ServerSessionManager
.
ConnectionFailure
e
)
{
throw
new
ConnectionFailure
();
}
catch
(
LoadFailure
e
)
{
throw
new
ConnectionFailure
();
}
}
public
String
getStatusMessage
()
{
return
ServerConnection
.
getInstance
(
"real"
).
getStatusMessage
();
}
public
boolean
makeConnection
(
String
serverId
)
{
return
ServerConnection
.
getInstance
(
serverId
).
makeConnection
();
}
public
boolean
makeConnection
()
{
return
makeConnection
(
"real"
);
}
public
boolean
checkConnection
(
String
serverId
)
{
return
ServerConnection
.
getInstance
(
serverId
).
checkConnection
();
}
public
boolean
checkConnection
()
{
return
checkConnection
(
"real"
);
}
public
void
logout
(
String
serverId
)
{
ServerSessionManager
.
getInstance
(
serverId
).
logoutAll
(
false
);
}
public
void
logout
()
{
logout
(
"real"
);
}
public
void
logoutAndStop
(
String
serverId
)
{
ServerSessionManager
.
getInstance
(
serverId
).
logoutAll
(
true
);
}
public
static
boolean
simulationServerIsLaunched
(
String
serverId
)
{
return
false
;
}
public
boolean
simulationServerIsReady
(
String
serverId
)
{
return
false
;
}
}
\ No newline at end of file
src/fr/ill/ics/bridge/ResourceManager.java
deleted
100644 → 0
View file @
c14fe7b6
/*