public class IlpDataSourceLoader extends Object implements ilog.cpl.storage.internal.IlpSAXDataHandlerFactory
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.
IlpMutableDataSource
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public IlpDataSourceLoader(String uri, IlpMutableDataSource dataSource) throws FileNotFoundException
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
FileNotFoundException
public IlpDataSourceLoader(String uri, IlpMutableDataSource dataSource, boolean validate) throws FileNotFoundException
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 fileFileNotFoundException
public IlpDataSourceLoader(InputSource inputSource, IlpMutableDataSource dataSource)
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
public IlpDataSourceLoader(InputSource inputSource, IlpMutableDataSource dataSource, boolean validate)
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.public XMLReader getXMLReader() throws SAXException, ParserConfigurationException
XMLReader
.public void setIdentifierFactory(IlpIdentifierFactory identifierFactory)
By default, it is null
.
identifierFactory
- The identifier factory used to change the
identifiers during loading. It can be
null
, which means that the
identifiers do not change.public IlpIdentifierFactory getIdentifierFactory()
public void setParentIdOfRootObjects(Object parentIdOfRootObjects)
By default, it is null
.
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.public Object getParentIdOfRootObjects()
setParentIdOfRootObjects(Object)
public void setBuffering(boolean 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)
.
public boolean getBuffering()
setBuffering(boolean)
public InputSource getInputSource()
public void parse() throws IOException, SAXException
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.public void parse(IlpFilter filter) throws IOException, SAXException
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.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.public ilog.cpl.storage.internal.IlpSAXDataHandler createDataHandler(IlpMutableDataSource dataSource, XMLReader parser, IlpIdentifierFactory identifierFactory, IlpFilter pfilter, Object parentIdOfRootObjects, boolean buffering, Logger logger)
createDataHandler
in interface ilog.cpl.storage.internal.IlpSAXDataHandlerFactory
dataSource
- Datasourceparser
- ParseidentifierFactory
- Identifier factorypfilter
- FilterparentIdOfRootObjects
- buffering
- Buffering events or notlogger
- Logger© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.