FreeHEP API
Version current

hep.aida.ref.remote.basic
Class BasicMutableStore

java.lang.Object
  extended byhep.aida.ref.remote.basic.BasicMutableStore
All Implemented Interfaces:
AidaUpdatable, IDevMutableStore, IMutableStore, IOnDemandStore, IStore

public abstract class BasicMutableStore
extends Object
implements AidaUpdatable, IDevMutableStore

This is Basic implementation of Read-Only IMutableStore. It has extra methods that allow to change state of the tree and to create IManagedObject in that tree and update its data.

Author:
serbo
Source Code:
BasicMutableStore.java

Field Summary
protected  boolean hurry
           
protected  UpdatableQueue queue
           
protected  IDevTree tree
           
 
Constructor Summary
BasicMutableStore()
          Creates a new instance of BasicMutableStore.
BasicMutableStore(boolean hurry)
           
BasicMutableStore(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.
 hep.aida.IManagedObject createObject(String name, String type)
          Create an IManagedObject that can be later updated.
 boolean isReadOnly()
          Returns true if the store only supports reading.
static void main(String[] args)
           
abstract  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.
abstract  void read(IDevTree tree, String path)
          Populate folder or create AIDA object in the tree.
 void stateChanged(UpdateEvent 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

queue

protected UpdatableQueue queue

hurry

protected boolean hurry
Constructor Detail

BasicMutableStore

public BasicMutableStore()
Creates a new instance of BasicMutableStore.


BasicMutableStore

public BasicMutableStore(boolean hurry)

BasicMutableStore

public BasicMutableStore(IDevTree tree,
                         boolean hurry)
Method Detail

createObject

public hep.aida.IManagedObject createObject(String name,
                                            String type)
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.
type - Type of object.

updateData

public abstract void updateData(String path,
                                String type)
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).

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

read

public abstract 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 abstract 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(UpdateEvent 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 current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.