Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ojb.broker.metadata
Class RepositoryPersistor  view RepositoryPersistor download RepositoryPersistor.java

java.lang.Object
  extended byorg.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,v 1.15 2003/01/31 17:55:55 arminw Exp $

Field Summary
private static org.apache.ojb.broker.util.logging.Logger log
           
private static java.lang.String SER_FILE_PERFIX
           
private static java.lang.String SER_FILE_SUFFIX
           
private static java.io.File serFile
           
private  boolean useSerializedRepository
           
 
Constructor Summary
RepositoryPersistor()
           
 
Method Summary
private  java.lang.Object buildRepository(java.lang.String repositoryFileName, java.lang.Class targetRepository)
           
private  java.net.URL buildURL(java.lang.String repositoryFileName)
           
 void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
          configure an object using the Configuration pConfig
protected  DescriptorRepository deserialize(java.io.File serFile)
           
 ConnectionRepository readConnectionRepository(java.lang.String filename)
          Read the repository configuration file and extract connection handling information.
 DescriptorRepository readDescriptorRepository(java.lang.String filename)
          Read the repository configuration file.
protected  void serialize(DescriptorRepository repository, java.io.File file)
           
 void writeToFile(DescriptorRepository repository, ConnectionRepository conRepository, java.io.OutputStream out)
          Write the DescriptorRepository to the given file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.ojb.broker.util.logging.Logger log

SER_FILE_PERFIX

private static final java.lang.String SER_FILE_PERFIX
See Also:
Constant Field Values

SER_FILE_SUFFIX

private static final java.lang.String SER_FILE_SUFFIX
See Also:
Constant Field Values

serFile

private static java.io.File serFile

useSerializedRepository

private boolean useSerializedRepository
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

writeToFile

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


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 was true all subsequent calls read a serialized version of the repository from the system tmp dir (the filename argument will be ignored).


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.


deserialize

protected DescriptorRepository deserialize(java.io.File serFile)

serialize

protected void serialize(DescriptorRepository repository,
                         java.io.File file)

buildRepository

private java.lang.Object buildRepository(java.lang.String repositoryFileName,
                                         java.lang.Class targetRepository)
                                  throws java.net.MalformedURLException,
                                         javax.xml.parsers.ParserConfigurationException,
                                         org.xml.sax.SAXException,
                                         java.io.IOException

buildURL

private java.net.URL buildURL(java.lang.String repositoryFileName)
                       throws java.net.MalformedURLException