org.apache.ojb.broker.metadata
Class RepositoryPersistor

java.lang.Object
  extended by org.apache.ojb.broker.metadata.RepositoryPersistor
All Implemented Interfaces:
org.apache.ojb.broker.util.configuration.Configurable

public class RepositoryPersistor
extends java.lang.Object
implements org.apache.ojb.broker.util.configuration.Configurable

This class is responsible for reading and writing DescriptorRepository objects from and to persistent media. Currently only XML file based persistence is supported.

Version:
$Id: RepositoryPersistor.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Thomas Mahler, Armin Waibel

Constructor Summary
RepositoryPersistor()
           
 
Method Summary
 void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
          configure an object using the Configuration pConfig
 ConnectionRepository readConnectionRepository(java.io.InputStream inst)
          Read the repository configuration file and extract connection handling information.
 ConnectionRepository readConnectionRepository(java.lang.String filename)
          Read the repository configuration file and extract connection handling information.
 DescriptorRepository readDescriptorRepository(java.io.InputStream inst)
           
 DescriptorRepository readDescriptorRepository(java.lang.String filename)
          Read the repository configuration file.
 void writeToFile(DescriptorRepository repository, ConnectionRepository conRepository, java.io.OutputStream out)
          Write the DescriptorRepository to the given output object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryPersistor

public RepositoryPersistor()
Method Detail

configure

public void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
               throws org.apache.ojb.broker.util.configuration.ConfigurationException
Description copied from interface: org.apache.ojb.broker.util.configuration.Configurable
configure an object using the Configuration pConfig

Specified by:
configure in interface org.apache.ojb.broker.util.configuration.Configurable
Parameters:
pConfig - the Configuration object used to configure current instance
Throws:
org.apache.ojb.broker.util.configuration.ConfigurationException

writeToFile

public void writeToFile(DescriptorRepository repository,
                        ConnectionRepository conRepository,
                        java.io.OutputStream out)
Write the DescriptorRepository to the given output object.


readDescriptorRepository

public DescriptorRepository readDescriptorRepository(java.lang.String filename)
                                              throws java.net.MalformedURLException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException,
                                                     java.io.IOException
Read the repository configuration file.
If configuration property useSerializedRepository is true all subsequent calls read a serialized version of the repository. The directory where the serialized repository is stored can be specified with the serializedRepositoryPath entry in OJB.properties. Once a serialized repository is found changes to repository.xml will be ignored. To force consideration of these changes the serialized repository must be deleted manually.

Throws:
java.net.MalformedURLException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

readDescriptorRepository

public DescriptorRepository readDescriptorRepository(java.io.InputStream inst)
                                              throws java.net.MalformedURLException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException,
                                                     java.io.IOException
Throws:
java.net.MalformedURLException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

readConnectionRepository

public ConnectionRepository readConnectionRepository(java.lang.String filename)
                                              throws java.net.MalformedURLException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException,
                                                     java.io.IOException
Read the repository configuration file and extract connection handling information.

Throws:
java.net.MalformedURLException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

readConnectionRepository

public ConnectionRepository readConnectionRepository(java.io.InputStream inst)
                                              throws java.net.MalformedURLException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException,
                                                     java.io.IOException
Read the repository configuration file and extract connection handling information.

Throws:
java.net.MalformedURLException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30