org.tango.server
Class ServerManager

java.lang.Object
  extended by org.tango.server.ServerManager

public final class ServerManager
extends java.lang.Object

Manage a tango server.

Author:
ABEILLE

Field Summary
static int SERVER_NAME_MAX_LENGTH
          maximun length for device server name (255 characters)
 
Method Summary
 void addClass(java.lang.String tangoClass, java.lang.Class<?> deviceClass)
          Add a class to the server.
 java.lang.String getAdminDeviceName()
           
 java.lang.String[] getDevicesOfClass(java.lang.String tangoClass)
          Get the started devices of this server.
 java.lang.String getExecName()
          execName/instanceName
 java.lang.String getHostName()
          The host on which this server is running
static ServerManager getInstance()
          Get a ServerManager
 java.lang.String getInstanceName()
          The instance name
 java.lang.String getPid()
          The pid of this server
 java.lang.String getServerName()
          The server name
 TransactionType getTransactionType()
           
 boolean isStarted()
           
 void setTransactionType(TransactionType transactionType)
          Set the transaction type for all server.
 void start(java.lang.String[] args, java.lang.Class<?> deviceClass)
          Starts a Tango server.
 void start(java.lang.String[] args, java.lang.String execName)
          Starts a Tango server.
 void startDevice(java.lang.String deviceName, java.lang.Class<?> deviceClass)
           
 void startError(java.lang.String[] args, java.lang.String execName)
          Idem as start but throw exceptions.
 void stop()
          Stop the server and clear all
 void stopDevice(java.lang.String deviceName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_NAME_MAX_LENGTH

public static final int SERVER_NAME_MAX_LENGTH
maximun length for device server name (255 characters)

See Also:
Constant Field Values
Method Detail

getInstance

public static ServerManager getInstance()
Get a ServerManager

Returns:
the server manager

addClass

public void addClass(java.lang.String tangoClass,
                     java.lang.Class<?> deviceClass)
Add a class to the server.

Parameters:
tangoClass - The class name as defined in the tango database
deviceClass - The class that define a device with Device

startDevice

public void startDevice(java.lang.String deviceName,
                        java.lang.Class<?> deviceClass)
                 throws fr.esrf.Tango.DevFailed
Throws:
fr.esrf.Tango.DevFailed

stopDevice

public void stopDevice(java.lang.String deviceName)
                throws fr.esrf.Tango.DevFailed
Throws:
fr.esrf.Tango.DevFailed

start

public void start(java.lang.String[] args,
                  java.lang.String execName)
Starts a Tango server. The system property TANGO_HOST is mandatory if using the tango database. If the tango db is not used, the system property OAPort(for jacorb) must be set. The errors occurred will be only logged.
 ServerManager.getInstance().addClass(JTangoTest.class.getCanonicalName(), JTangoTest.class);
 ServerManager.getInstance().start(new String[] { "1" }, "JTangoTest");
 

Parameters:
args - The arguments to pass. instanceName [-v[trace level]] [-nodb [-dlist ]]
execName - The name of the server as defined by Tango.
See Also:
addClass(String, Class)

startError

public void startError(java.lang.String[] args,
                       java.lang.String execName)
                throws fr.esrf.Tango.DevFailed
Idem as start but throw exceptions. @see ServerManager#start(String[], String)

Parameters:
args -
execName -
Throws:
fr.esrf.Tango.DevFailed

start

public void start(java.lang.String[] args,
                  java.lang.Class<?> deviceClass)
Starts a Tango server. The system property TANGO_HOST is mandatory if using the tango database. If the tango db is not used the system property OAPort(for jacorb) must be set. The errors occurred will be only logged.
 ServerManager.getInstance().start(new String[] { "1" }, JTangoTest.class);
 

Parameters:
args - The arguments to pass. instanceName [-v[trace level]] [-nodb [-dlist ]]
deviceClass - The class of the device. The server name and class name must be defined in tango db with deviceClass.getSimpleName to be started with this method.
See Also:
addClass(String, Class)

stop

public void stop()
          throws fr.esrf.Tango.DevFailed
Stop the server and clear all

Throws:
fr.esrf.Tango.DevFailed

setTransactionType

public void setTransactionType(TransactionType transactionType)
Set the transaction type for all server. Overrides Device.transactionType()

Parameters:
transactionType -

getTransactionType

public TransactionType getTransactionType()

getHostName

public java.lang.String getHostName()
The host on which this server is running

Returns:
the host name

getPid

public java.lang.String getPid()
The pid of this server

Returns:
the pid

getExecName

public java.lang.String getExecName()
execName/instanceName

Returns:
execName/instanceName

getInstanceName

public java.lang.String getInstanceName()
The instance name

Returns:
The instance name

getServerName

public java.lang.String getServerName()
The server name

Returns:
The server name

getDevicesOfClass

public java.lang.String[] getDevicesOfClass(java.lang.String tangoClass)
                                     throws fr.esrf.Tango.DevFailed
Get the started devices of this server. WARNING: result is filled after server has been started

Parameters:
tangoClass -
Returns:
The devices
Throws:
fr.esrf.Tango.DevFailed

getAdminDeviceName

public java.lang.String getAdminDeviceName()

isStarted

public boolean isStarted()
Returns:
true is the server is running


Copyright © 2012-2015. All Rights Reserved.