FreeHEP API
Version current

hep.aida.ref.remote.corba
Class CorbaTreeClientImpl

java.lang.Object
  extended byorg.omg.PortableServer.Servant
      extended byhep.aida.ref.remote.corba.generated.TreeClientPOA
          extended byhep.aida.ref.remote.corba.CorbaTreeClientImpl
All Implemented Interfaces:
AidaTreeClient, InvokeHandler, Runnable, TreeClientOperations

public class CorbaTreeClientImpl
extends TreeClientPOA
implements AidaTreeClient, Runnable

This is Basic implementation of AidaTreeClient that support both "Duplex" and "non-Duplex" modes of communication with the AIDA Tree server. In "Duplex" mode AidaTreeServant call stateChanged() method to notify BasicTreeClient about updates/changes in the server-side AIDA tree. In "non-Duplex" mode BasicTreeClient runs as a separate thread and periodically calls updates() method of AidaTreeServant to get information about updates/changes in the server-side AIDA tree. BasicTreeClient also implements IMutableStore, so it can be used as a Store for any IDevTree.

Author:
serbo
Source Code:
CorbaTreeClientImpl.java

Field Summary
protected  String clientID
           
protected  boolean duplex
           
protected  String ior
           
protected  boolean isConnected
           
protected  boolean keepUpdating
           
protected  String nsName
           
protected  ORB orb
           
protected  RemoteUpdatableQueue queue
           
protected  POA rootPOA
           
protected  TreeServant servant
           
protected  TreeServer server
           
protected  IDevMutableStore store
           
protected  TreeClient treeClient
           
protected  long updateInterval
           
 
Constructor Summary
CorbaTreeClientImpl()
          Creates a new instance of CorbaTreeClient Duplex is default to "true".
CorbaTreeClientImpl(IDevMutableStore store, String ior)
           
CorbaTreeClientImpl(IDevMutableStore store, String ior, String nsName)
           
 
Method Summary
 boolean connect()
           
protected  void connectDuplex()
          Retrieves Duplex AidaTreeServant from the AidaTreeServer.
protected  void connectNonDuplex()
          Retrieves non-Duplex AidaTreeServant from the AidaTreeServer.
 boolean disconnect()
           
 Object find(String path)
           
protected  TreeServer getServer()
          Retrieves reference to the TreeServer.
protected  void init()
           
 boolean isConnected()
           
 String[] listObjectNames(String path)
           
 String[] listObjectTypes(String path)
           
static void main(String[] args)
           
 void run()
           
 void setDuplex(boolean duplex)
          Set duplex mode.
 void setUpdateTime(long updateInterval)
          Set time interval (in milliseconds) for AidaTreeClient to check for updates.
 void setValid(String path)
           
 void stateChanged(AidaUpdateEvent[] events)
          This method can be called by AidaTreeServant to notify AidaTreeClient about updates in the server-side ITree.
 void stateChanged(EventStruct[] events)
          In this implementation stateChanged(UpdateEvent[] events) method simply schedules updates in the UpdatableQueue.
 
Methods inherited from class hep.aida.ref.remote.corba.generated.TreeClientPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected TreeServer server

servant

protected TreeServant servant

store

protected IDevMutableStore store

queue

protected RemoteUpdatableQueue queue

duplex

protected boolean duplex

isConnected

protected boolean isConnected

updateInterval

protected long updateInterval

keepUpdating

protected boolean keepUpdating

clientID

protected String clientID

orb

protected ORB orb

rootPOA

protected POA rootPOA

treeClient

protected TreeClient treeClient

ior

protected String ior

nsName

protected String nsName
Constructor Detail

CorbaTreeClientImpl

public CorbaTreeClientImpl()
Creates a new instance of CorbaTreeClient Duplex is default to "true". If TreeServer does not support Duplex mode, try to connect in non-Duplex.


CorbaTreeClientImpl

public CorbaTreeClientImpl(IDevMutableStore store,
                           String ior)

CorbaTreeClientImpl

public CorbaTreeClientImpl(IDevMutableStore store,
                           String ior,
                           String nsName)
Method Detail

init

protected void init()

getServer

protected TreeServer getServer()
Retrieves reference to the TreeServer.


setUpdateTime

public void setUpdateTime(long updateInterval)
Set time interval (in milliseconds) for AidaTreeClient to check for updates. Relevant only for non-Duplex Mode, as in Duplex Mode updates are "pushed" into AidaTreeClient by AidaTreeServer calling "stateChanged()" method. Default value: updateInterval=2000 milliseconds.


setDuplex

public void setDuplex(boolean duplex)
Set duplex mode. Default is "true".


connectDuplex

protected void connectDuplex()
                      throws RemoteConnectionException
Retrieves Duplex AidaTreeServant from the AidaTreeServer.

Throws:
RemoteConnectionException

connectNonDuplex

protected void connectNonDuplex()
                         throws RemoteConnectionException
Retrieves non-Duplex AidaTreeServant from the AidaTreeServer.

Throws:
RemoteConnectionException

setValid

public void setValid(String path)

listObjectNames

public String[] listObjectNames(String path)
                         throws IllegalArgumentException
Throws:
IllegalArgumentException

listObjectTypes

public String[] listObjectTypes(String path)
                         throws IllegalArgumentException
Throws:
IllegalArgumentException

find

public Object find(String path)
            throws IllegalArgumentException
Throws:
IllegalArgumentException

stateChanged

public void stateChanged(EventStruct[] events)
In this implementation stateChanged(UpdateEvent[] events) method simply schedules updates in the UpdatableQueue. Later queue invokes stateChanged(UpdateEvent event) method on a separate thread to process updates.

Specified by:
stateChanged in interface TreeClientOperations

stateChanged

public void stateChanged(AidaUpdateEvent[] events)
Description copied from interface: AidaTreeClient
This method can be called by AidaTreeServant to notify AidaTreeClient about updates in the server-side ITree. If "Duplex Mode" is not used, AideTreeClient has to call updates() method of AideTreeServant to get a list of current updates.

Specified by:
stateChanged in interface AidaTreeClient

isConnected

public boolean isConnected()
Specified by:
isConnected in interface TreeClientOperations

connect

public boolean connect()
Specified by:
connect in interface TreeClientOperations

disconnect

public boolean disconnect()
Specified by:
disconnect in interface TreeClientOperations

run

public void run()
Specified by:
run in interface Runnable

main

public static void main(String[] args)

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.