DESY ACOP Beans Home

com.cosylab.application.state.impl
Class XMLStateStorage

java.lang.Object
  extended by com.cosylab.application.state.impl.DefaultStateStorage
      extended by com.cosylab.application.state.impl.XMLStateStorage
All Implemented Interfaces:
StateStorage
Direct Known Subclasses:
CDBStateStorage

public class XMLStateStorage
extends DefaultStateStorage

This class is an implementation of the StateStorage that uses a XML file to store the array of the State objects. Use the csl.XMLStateStorage.useNew=true system property to switch to the new implementation of the state storage (faster, with nicer output, uses SAX instead of DOM).

Author:
dvitas, mkadunc

Field Summary
 
Fields inherited from class com.cosylab.application.state.impl.DefaultStateStorage
delegate, states
 
Constructor Summary
XMLStateStorage()
           
XMLStateStorage(StateStorage ss)
          Creates a new XMLStateStorage object.
 
Method Summary
 void add(State state)
          Adds new state to storage.
 void addAll(java.util.List states)
          DOCUMENT ME!
 boolean contains(State st)
          DOCUMENT ME!
 boolean equals(java.lang.Object obj)
           
 java.util.List getStates()
          DOCUMENT ME!
 int hashCode()
           
 java.util.Iterator iterator()
          Rerurns iterator over states.
 void load(java.io.InputStream stream)
          DOCUMENT ME!
 void load(java.lang.String filePath, java.lang.String applicationName)
          DOCUMENT ME! TODO: Add load(InputStream, String) to support loading from non-file sources!
static State[] loadStates(org.xml.sax.InputSource is)
          DOCUMENT ME!
 void remove(State st)
          DOCUMENT ME!
 void store(java.io.OutputStream stream)
          DOCUMENT ME!
 void store(java.lang.String filePath, java.lang.String applicationName)
          DOCUMENT ME!
static void storeStates(State[] outStates, java.io.OutputStream os)
          DOCUMENT ME!
 java.lang.String toString()
           
 
Methods inherited from class com.cosylab.application.state.impl.DefaultStateStorage
getInputStream, getOutputStream
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLStateStorage

public XMLStateStorage()

XMLStateStorage

public XMLStateStorage(StateStorage ss)
Creates a new XMLStateStorage object.

Parameters:
ss - DOCUMENT ME!
Method Detail

loadStates

public static final State[] loadStates(org.xml.sax.InputSource is)
                                throws java.io.IOException
DOCUMENT ME!

Parameters:
is - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

storeStates

public static final void storeStates(State[] outStates,
                                     java.io.OutputStream os)
                              throws java.io.IOException
DOCUMENT ME!

Parameters:
outStates - DOCUMENT ME!
os - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

add

public void add(State state)
Description copied from interface: StateStorage
Adds new state to storage.

Specified by:
add in interface StateStorage
Overrides:
add in class DefaultStateStorage
Parameters:
state - the state to be added

addAll

public void addAll(java.util.List states)
Description copied from interface: StateStorage
DOCUMENT ME!

Specified by:
addAll in interface StateStorage
Overrides:
addAll in class DefaultStateStorage
Parameters:
states - DOCUMENT ME!

contains

public boolean contains(State st)
Description copied from interface: StateStorage
DOCUMENT ME!

Specified by:
contains in interface StateStorage
Overrides:
contains in class DefaultStateStorage
Parameters:
st - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getStates

public java.util.List getStates()
Description copied from interface: StateStorage
DOCUMENT ME!

Specified by:
getStates in interface StateStorage
Overrides:
getStates in class DefaultStateStorage
Returns:
DOCUMENT ME!

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

iterator

public java.util.Iterator iterator()
Description copied from interface: StateStorage
Rerurns iterator over states.

Specified by:
iterator in interface StateStorage
Overrides:
iterator in class DefaultStateStorage
Returns:
iterator over states

load

public void load(java.io.InputStream stream)
          throws java.io.IOException
Description copied from interface: StateStorage
DOCUMENT ME!

Parameters:
stream - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

load

public void load(java.lang.String filePath,
                 java.lang.String applicationName)
          throws java.io.IOException
Description copied from interface: StateStorage
DOCUMENT ME! TODO: Add load(InputStream, String) to support loading from non-file sources!

Specified by:
load in interface StateStorage
Specified by:
load in class DefaultStateStorage
Parameters:
filePath - DOCUMENT ME!
applicationName - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

remove

public void remove(State st)
Description copied from interface: StateStorage
DOCUMENT ME!

Specified by:
remove in interface StateStorage
Overrides:
remove in class DefaultStateStorage
Parameters:
st - DOCUMENT ME!

store

public void store(java.io.OutputStream stream)
           throws java.io.IOException
Description copied from interface: StateStorage
DOCUMENT ME!

Throws:
java.io.IOException - DOCUMENT ME!

store

public void store(java.lang.String filePath,
                  java.lang.String applicationName)
           throws java.io.IOException
Description copied from class: DefaultStateStorage
DOCUMENT ME!

Specified by:
store in interface StateStorage
Specified by:
store in class DefaultStateStorage
Parameters:
filePath - DOCUMENT ME!
applicationName - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.