FreeHEP API
Version v1.2.2

hep.aida.ref.remote
Class RemoteMutableStore

java.lang.Object
  |
  +--hep.aida.ref.remote.RemoteMutableStore
All Implemented Interfaces:
AidaUpdatable, IDevMutableStore, IMutableStore, IOnDemandStore, IStore
Direct Known Subclasses:
CorbaMutableStore, RemoteMutableStoreTest, 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

Field Summary
protected  RemoteClient client
           
protected  RemoteUpdateEvent event
           
protected  boolean hurry
           
protected  boolean recursive
           
protected  IDevTree tree
           
 
Constructor Summary
RemoteMutableStore()
          Creates a new instance of BasicMutableStore.
RemoteMutableStore(IDevTree tree)
           
 
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.
 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 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

recursive

protected boolean recursive

event

protected RemoteUpdateEvent event

hurry

protected boolean hurry
Constructor Detail

RemoteMutableStore

public RemoteMutableStore()
Creates a new instance of BasicMutableStore.


RemoteMutableStore

public RemoteMutableStore(IDevTree tree)
Method Detail

init

public void init()

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
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

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:
IOException - If there are problems reading from the Store
IllegalArgumentException - If the path does not exist, or if it is not a directory.

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.

Specified by:
stateChanged in interface AidaUpdatable

main

public static void main(String[] args)

FreeHEP API
Version v1.2.2

Copyright © 2000-2003 FreeHEP, All Rights Reserved.