FreeHEP API
Version current

hep.aida.ref.remote
Class RemoteMutableStore

java.lang.Object
  extended byhep.aida.ref.remote.RemoteMutableStore
All Implemented Interfaces:
AidaUpdatable, IDevMutableStore, IMutableStore, IOnDemandStore, IStore
Direct Known Subclasses:
CorbaMutableStore, RmiMutableStore

public abstract class RemoteMutableStore
extends Object
implements AidaUpdatable, IDevMutableStore

This is Basic implementation of Read-Only IDevMutableStore. It has extra methods that allow to change state of the tree and to create IManagedObject in that tree and update its data. This implementation creates appropriate subclass of RemoteClient to connect to a remote server. All subclasses need to implement 3 methods: protected RemoteClient createClient(Map options); public IManagedObject createObject(String name, String type); public void updateData(String path, String type);

Author:
serbo
Source Code:
RemoteMutableStore.java

Nested Class Summary
 class RemoteMutableStore.ReadThread
           
 
Field Summary
protected  RemoteClient client
           
protected  RemoteUpdateEvent[] events
           
protected  boolean hurry
           
protected  boolean initDone
           
protected  boolean recursive
           
protected  Logger remoteLogger
           
protected  IDevTree tree
           
 
Constructor Summary
RemoteMutableStore()
          Creates a new instance of BasicMutableStore.
RemoteMutableStore(boolean hurry)
           
RemoteMutableStore(IDevTree tree)
           
RemoteMutableStore(IDevTree tree, boolean hurry)
           
 
Method Summary
 void close()
          Close Store and free all resources associated with it.
 void commit(IDevTree tree, Map options)
          Copy data from Tree to the Store.
protected abstract  RemoteClient createClient(Map options)
           
abstract  hep.aida.IManagedObject createObject(String name, String aidaType)
          Create an IManagedObject that can be later updated.
protected  void executeStateChanged(AidaUpdateEvent event)
           
protected  void executeStateChanged(int id, String path, String type, String xType)
           
 void handleDataUpdate(hep.aida.IManagedObject mo, String path, String type)
           
 void handleDataUpdate(hep.aida.IManagedObject mo, String path, String type, boolean hurryUp)
           
 void init()
           
 boolean isReadOnly()
          Returns true if the store only supports reading.
static void main(String[] args)
           
 void read(IDevTree tree, Map options, boolean readOnly, boolean createNew)
          Populate AIDA Tree: create appropriate AIDA objects in the Tree and fill them with data from the Store.
 void read(IDevTree tree, String path)
          Populate folder or create AIDA object in the tree.
 void reloadFolder(String path)
           
protected  void reloadWebPage()
           
 void setHurry(boolean hurry)
           
 void stateChanged(AidaUpdateEvent event)
          This method actually does the job of modifying the client tree.
abstract  void updateData(String path, String type)
          Initiates the process of updating content for an IManagedObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree

protected IDevTree tree

client

protected RemoteClient client

initDone

protected boolean initDone

recursive

protected boolean recursive

events

protected RemoteUpdateEvent[] events

remoteLogger

protected Logger remoteLogger

hurry

protected boolean hurry
Constructor Detail

RemoteMutableStore

public RemoteMutableStore()
Creates a new instance of BasicMutableStore.


RemoteMutableStore

public RemoteMutableStore(boolean hurry)

RemoteMutableStore

public RemoteMutableStore(IDevTree tree)

RemoteMutableStore

public RemoteMutableStore(IDevTree tree,
                          boolean hurry)
Method Detail

init

public void init()

setHurry

public void setHurry(boolean hurry)

handleDataUpdate

public void handleDataUpdate(hep.aida.IManagedObject mo,
                             String path,
                             String type)
                      throws IllegalArgumentException
Throws:
IllegalArgumentException

handleDataUpdate

public void handleDataUpdate(hep.aida.IManagedObject mo,
                             String path,
                             String type,
                             boolean hurryUp)
                      throws IllegalArgumentException
Throws:
IllegalArgumentException

createClient

protected abstract RemoteClient createClient(Map options)

updateData

public abstract void updateData(String path,
                                String type)
                         throws IllegalArgumentException
Description copied from interface: IDevMutableStore
Initiates the process of updating content for an IManagedObject. Can be done synchronously or can just schedule update in some queue. If validation mechanism is used for updates, servant's "setValid(path)" method should be called here after successfull date update.

Specified by:
updateData in interface IDevMutableStore
Parameters:
path - The path to the object which is to be updated.
type - Type of object (this parameter does not have to be used).
Throws:
IllegalArgumentException - If the path does not exist, or if it is a directory.

createObject

public abstract hep.aida.IManagedObject createObject(String name,
                                                     String aidaType)
                                              throws IllegalArgumentException
Description copied from interface: IDevMutableStore
Create an IManagedObject that can be later updated. If object already exist, do not overwrite it, just return with, maybe, a warning.

Specified by:
createObject in interface IDevMutableStore
Parameters:
name - Simple name of an object which is to be created, no directories.
aidaType - Type of object.
Throws:
IllegalArgumentException - If unknown type.

close

public void close()
           throws IOException
Description copied from interface: IStore
Close Store and free all resources associated with it. Should be called from ITree.close() method only. After the Store is closed, the Tree associated with it becomes unusable.

Specified by:
close in interface IStore
Throws:
IOException

commit

public void commit(IDevTree tree,
                   Map options)
            throws IOException
Description copied from interface: IStore
Copy data from Tree to the Store.

Specified by:
commit in interface IStore
Throws:
IOException - If there are problems writing to the Store or the Store is Read-Only.

isReadOnly

public boolean isReadOnly()
Description copied from interface: IStore
Returns true if the store only supports reading. If true, user can not change information in the Store and "commit()" method throws IOException if called.

Specified by:
isReadOnly in interface IStore

reloadFolder

public void reloadFolder(String path)
                  throws IllegalArgumentException,
                         IOException
Throws:
IllegalArgumentException
IOException

read

public void read(IDevTree tree,
                 String path)
          throws IllegalArgumentException,
                 IOException
Description copied from interface: IOnDemandStore
Populate folder or create AIDA object in the tree. If some folders along the path are missing, IOnDemandStore must create them using ITree "mkdirs(path)" method. Tree relies on Store calling IDevTree.hasBeenFilled(String path) method, to let Tree know that a particular folder has been filled.

Specified by:
read in interface IOnDemandStore
Parameters:
path - The path to the diretory which is to be filled.
Throws:
IllegalArgumentException - If the path does not exist, or if it is not a directory.
IOException - If there are problems reading from the Store

read

public void read(IDevTree tree,
                 Map options,
                 boolean readOnly,
                 boolean createNew)
          throws IOException
Description copied from interface: IStore
Populate AIDA Tree: create appropriate AIDA objects in the Tree and fill them with data from the Store. This method is called only once, during Tree-Store association, to populate the Tree. Tree relies on IStore calling IDevTree.hasBeenFilled(String path) method, to let Tree know that a particular folder has been filled.

Specified by:
read in interface IStore
Throws:
IOException - If there are problems reading from the Store

stateChanged

public void stateChanged(AidaUpdateEvent event)
This method actually does the job of modifying the client tree. If directory or node already does exist, it will not be overwritten. Synchronizes with Tree lock, if the Tree has lock object set.

Specified by:
stateChanged in interface AidaUpdatable

executeStateChanged

protected void executeStateChanged(AidaUpdateEvent event)

executeStateChanged

protected void executeStateChanged(int id,
                                   String path,
                                   String type,
                                   String xType)

reloadWebPage

protected void reloadWebPage()

main

public static void main(String[] args)

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.