ilog.cpl.storage
Class IlpDataSourceLoader

java.lang.Object
  extended by ilog.cpl.storage.IlpDataSourceLoader
All Implemented Interfaces:
ilog.cpl.storage.internal.IlpSAXDataHandlerFactory

public class IlpDataSourceLoader
extends Object
implements ilog.cpl.storage.internal.IlpSAXDataHandlerFactory

This class can load an XML document into an IlpMutableDataSource. The behavior of this loader can be customized by setting properties, such as the identifier factory, prior to calling the parse method.

This class has its own logger.

Since:
JTGO 3.0
See Also:
IlpMutableDataSource

Constructor Summary
IlpDataSourceLoader(InputSource inputSource, IlpMutableDataSource dataSource)
          Creates a data source loader to load data from an XML document.
IlpDataSourceLoader(InputSource inputSource, IlpMutableDataSource dataSource, boolean validate)
          Creates a data source loader to load data from an XML document.
IlpDataSourceLoader(String uri, IlpMutableDataSource dataSource)
          Creates a data source loader to load data from an XML document.
IlpDataSourceLoader(String uri, IlpMutableDataSource dataSource, boolean validate)
          Creates a data source loader to load data from an XML document.
 
Method Summary
 ilog.cpl.storage.internal.IlpSAXDataHandler createDataHandler(IlpMutableDataSource dataSource, XMLReader parser, IlpIdentifierFactory identifierFactory, IlpFilter pfilter, Object parentIdOfRootObjects, boolean buffering, Logger logger)
          Creates a new datasource data handler.
 boolean getBuffering()
          Returns the buffering.
 IlpIdentifierFactory getIdentifierFactory()
          Returns the identifier factory.
 InputSource getInputSource()
          Returns the input source.
 Object getParentIdOfRootObjects()
          Returns the parent identifier of the root objects.
 XMLReader getXMLReader()
          Returns the XMLReader.
 void parse()
          Parses an XML document containing a model.
 void parse(IlpFilter filter)
          Parses an XML document containing a model.
 void setBuffering(boolean buffering)
          Sets the buffering.
 void setIdentifierFactory(IlpIdentifierFactory identifierFactory)
          Sets the identifier factory to be used when loading data.
 void setParentIdOfRootObjects(Object parentIdOfRootObjects)
          Sets the parent identifier of the root objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpDataSourceLoader

public IlpDataSourceLoader(String uri,
                           IlpMutableDataSource dataSource)
                    throws FileNotFoundException
Creates a data source loader to load data from an XML document.

Parameters:
uri - The URI. It does not have to be fully resolved by the application before it is passed.
dataSource - The data source. It cannot be null
Throws:
FileNotFoundException

IlpDataSourceLoader

public IlpDataSourceLoader(String uri,
                           IlpMutableDataSource dataSource,
                           boolean validate)
                    throws FileNotFoundException
Creates a data source loader to load data from an XML document.

Parameters:
uri - The URI. It does not have to be fully resolved by the application before it is passed.
dataSource - The data source. It cannot be null
validate - Validates or not the datasource file
Throws:
FileNotFoundException
Since:
JViews 8.0

IlpDataSourceLoader

public IlpDataSourceLoader(InputSource inputSource,
                           IlpMutableDataSource dataSource)
Creates a data source loader to load data from an XML document.

Parameters:
inputSource - The URI. It does not have to be fully resolved by the application before it is passed.
dataSource - The data source. It cannot be null

IlpDataSourceLoader

public IlpDataSourceLoader(InputSource inputSource,
                           IlpMutableDataSource dataSource,
                           boolean validate)
Creates a data source loader to load data from an XML document.

Parameters:
inputSource - The URI. It does not have to be fully resolved by the application before it is passed.
dataSource - The data source. It cannot be null
validate - Validates or not the datasource file.
Since:
JViews 8.0
Method Detail

getXMLReader

public XMLReader getXMLReader()
                       throws SAXException,
                              ParserConfigurationException
Returns the XMLReader.

Throws:
SAXException
ParserConfigurationException

setIdentifierFactory

public void setIdentifierFactory(IlpIdentifierFactory identifierFactory)
Sets the identifier factory to be used when loading data.

By default, it is null.

Parameters:
identifierFactory - The identifier factory used to change the identifiers during loading. It can be null, which means that the identifiers do not change.

getIdentifierFactory

public IlpIdentifierFactory getIdentifierFactory()
Returns the identifier factory.

See Also:
setIdentifierFactory(IlpIdentifierFactory)

setParentIdOfRootObjects

public void setParentIdOfRootObjects(Object parentIdOfRootObjects)
Sets the parent identifier of the root objects.

By default, it is null.

Parameters:
parentIdOfRootObjects - Used as the parent identifier for objects having no parent in the file. Keep this parameter null if you do not want to force the objects without a parent to have one.

getParentIdOfRootObjects

public Object getParentIdOfRootObjects()
Returns the parent identifier of the root objects.

See Also:
setParentIdOfRootObjects(Object)

setBuffering

public void setBuffering(boolean buffering)
Sets the buffering.

By default, the buffering is on (true).

XML elements such as addObject or removeObject are buffered. For example, a sequence of addObject elements will result in only one call to IlpMutableDataSource.addObjects(List).


getBuffering

public boolean getBuffering()
Returns the buffering.

See Also:
setBuffering(boolean)

getInputSource

public InputSource getInputSource()
Returns the input source.


parse

public void parse()
           throws IOException,
                  SAXException
Parses an XML document containing a model.

Throws:
SAXException - which is any SAX exception, possibly wrapping another exception.
IOException - which is an IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

parse

public void parse(IlpFilter filter)
           throws IOException,
                  SAXException
Parses an XML document containing a model.

Parameters:
filter - The filter applied to the business objects being parsed. A business object must be accepted by the filter in order to be added to the data source.
Throws:
SAXException - which is any SAX exception, possibly wrapping another exception.
IOException - which is an IO exception from the parser, possibly from a byte stream or a character stream supplied by the application.
Since:
JTGO 4.0

createDataHandler

public ilog.cpl.storage.internal.IlpSAXDataHandler createDataHandler(IlpMutableDataSource dataSource,
                                                                     XMLReader parser,
                                                                     IlpIdentifierFactory identifierFactory,
                                                                     IlpFilter pfilter,
                                                                     Object parentIdOfRootObjects,
                                                                     boolean buffering,
                                                                     Logger logger)
Creates a new datasource data handler.

Specified by:
createDataHandler in interface ilog.cpl.storage.internal.IlpSAXDataHandlerFactory
Parameters:
dataSource - Datasource
parser - Parse
identifierFactory - Identifier factory
pfilter - Filter
parentIdOfRootObjects -
buffering - Buffering events or not
logger - Logger
Returns:
New SAX Data Handler
Since:
JTGO 4.5
Internal method or field: do not use!


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.