jmri.configurexml
Class BlockManagerXml

java.lang.Object
  extended by jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML
      extended by jmri.managers.configurexml.AbstractMemoryManagerConfigXML
          extended by jmri.configurexml.BlockManagerXml
All Implemented Interfaces:
XmlAdapter

public class BlockManagerXml
extends AbstractMemoryManagerConfigXML

Persistency implementation for BlockManager persistance.

The Block objects are not yet read in, pending a reliable write out!

Every block is written twice. First, the list of blocks is written without contents, so that we're sure they're all created on read-back. Then, they're written out again with contents, including the block references in the path elements.

Since:
2.1.2
Author:
Bob Jacobsen Copyright: Copyright (c) 2008

Constructor Summary
BlockManagerXml()
           
 
Method Summary
 boolean load(Element blocks)
          Load Blocks into the existing BlockManager.
 void loadBeanSetting(Path path, Element element)
          Load BeanSetting into an existing Path.
 void loadBlock(Element element)
          Utility method to load the individual Block objects.
 void loadPath(Block block, Element element)
          Load path into an existing Block.
 void setStoreElementClass(Element memories)
          Subclass provides implementation to create the correct top element, including the type information.
 Element store(Object o)
          Store the contents of a BlockManager.
 
Methods inherited from class jmri.managers.configurexml.AbstractMemoryManagerConfigXML
load, loadMemories
 
Methods inherited from class jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML
loadCommon, storeCommon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockManagerXml

public BlockManagerXml()
Method Detail

setStoreElementClass

public void setStoreElementClass(Element memories)
Subclass provides implementation to create the correct top element, including the type information. Default implementation is to use the local class here.

Specified by:
setStoreElementClass in class AbstractMemoryManagerConfigXML
Parameters:
memories - The top-level element being created

store

public Element store(Object o)
Store the contents of a BlockManager.

Specified by:
store in interface XmlAdapter
Overrides:
store in class AbstractMemoryManagerConfigXML
Parameters:
o - Object to store, of type BlockManager
Returns:
Element containing the complete info

load

public boolean load(Element blocks)
Load Blocks into the existing BlockManager.

The BlockManager in the InstanceManager is created automatically.

Specified by:
load in interface XmlAdapter
Specified by:
load in class AbstractMemoryManagerConfigXML
Parameters:
blocks - Element containing the block elements to load.
Returns:
true if successful

loadBlock

public void loadBlock(Element element)
Utility method to load the individual Block objects.

Parameters:
element - Element holding one block

loadPath

public void loadPath(Block block,
                     Element element)
Load path into an existing Block.

Parameters:
block - Block to receive path
element - Element containing path information

loadBeanSetting

public void loadBeanSetting(Path path,
                            Element element)
Load BeanSetting into an existing Path.

Parameters:
path - Path to receive BeanSetting
element - Element containing beansetting information


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads