ilog.cpl.datasource
Class IlpAbstractDataSource

java.lang.Object
  extended by ilog.cpl.datasource.IlpAbstractDataSource
All Implemented Interfaces:
IlpDataSource, ilog.cpl.storage.internal.IlpSAXDataHandlerFactory, IlvBatchable
Direct Known Subclasses:
IlpDefaultDataSource

public abstract class IlpAbstractDataSource
extends Object
implements IlpDataSource, IlvBatchable, ilog.cpl.storage.internal.IlpSAXDataHandlerFactory

Abstract implementation of data source that provides notification support.

Since:
JTGO 3.0

Constructor Summary
IlpAbstractDataSource()
          Default constructor.
IlpAbstractDataSource(IlpContext context)
          Constructor.
 
Method Summary
 void addDataSourceListener(DataSourceListener l)
          Adds a listener to the data source.
 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.
 void endBatch()
          Terminates a batch of modifications.
 void fireBatchEnded()
          Fires an batch ended event.
 void fireBatchStarted()
          Fires an batch started event.
 void fireObjectAdded(IlpObject object)
          Fires an object added event for one object.
 void fireObjectAttributeChanged(IlpObject object, IlpAttribute attribute)
          Fires an object attribute changed event.
 void fireObjectAttributeChanged(IlpObject object, IlpAttribute attribute, Object newValue, Object oldValue)
          Fires an object attribute changed event.
 void fireObjectRemoved(IlpObject object)
          Fires an object removed event for one object.
 void fireObjectsAdded(List objects)
          Fires an object added event for a list of objects.
 void fireObjectsRemoved(List objects)
          Fires an object removed event for a list of objects.
 void fireObjectStructureChanged(IlpObject object, Class structuralInterface)
          Fires an object structure changed event.
 IlpContext getContext()
          Returns the context used by this data source.
 int getDebugMask()
          Returns the debug mask configured for this datasource.
protected  Object getIdentifier(Object idOrIlpObject)
          Utility method that retrieves an object identifier from a parameter that can be either an identifier or an IlpObject instance.
protected  boolean logMessage(Logger logger, Level l)
          Indicates if a message shall be logged in the given logger.
 void removeDataSourceListener(DataSourceListener l)
          Removes a listener of the data source.
 void setContext(IlpContext context)
          Set the context used by this data source.
 void setDebugMask(int mask)
          Sets a new debug mask in this datasource.
 void startBatch()
          Starts a batch of modifications.
protected  boolean throwException()
          Indicates if an exception shall be thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.cpl.datasource.IlpDataSource
getChildInterface, getContainerInterface, getLinkExtremityInterface, getLinkInterface, getObject, getObjects
 

Constructor Detail

IlpAbstractDataSource

public IlpAbstractDataSource()
Default constructor. The data source is initialized using the default context.

See Also:
IlpSystem.GetDefaultContext()

IlpAbstractDataSource

public IlpAbstractDataSource(IlpContext context)
Constructor.

Parameters:
context - The context used by the data source.
Method Detail

getContext

public IlpContext getContext()
Returns the context used by this data source.

Specified by:
getContext in interface IlpDataSource

setContext

public void setContext(IlpContext context)
Set the context used by this data source.


startBatch

public void startBatch()
Starts a batch of modifications. The data source notifies its listeners of a batchStarted event.

Use this method if you plan to make changes to the content of a data source such as:

To optimize the changes in the graphic view, enclose your data source and business object changes between a call to this method and a call to endBatch.

Specified by:
startBatch in interface IlvBatchable
Since:
JTGO 4.0
See Also:
endBatch()

endBatch

public void endBatch()
Terminates a batch of modifications. The data source notifies its listeners of a batchEnded event.

Specified by:
endBatch in interface IlvBatchable
Since:
JTGO 4.0
See Also:
startBatch()

addDataSourceListener

public void addDataSourceListener(DataSourceListener l)
Adds a listener to the data source.

Specified by:
addDataSourceListener in interface IlpDataSource
Parameters:
l - The listener to add.

removeDataSourceListener

public void removeDataSourceListener(DataSourceListener l)
Removes a listener of the data source.

Specified by:
removeDataSourceListener in interface IlpDataSource
Parameters:
l - The listener to remove.

fireObjectAdded

public void fireObjectAdded(IlpObject object)
Fires an object added event for one object.

Parameters:
object - The object that has been added. Cannot be null.

fireObjectsAdded

public void fireObjectsAdded(List objects)
Fires an object added event for a list of objects.

Parameters:
objects - The objects that have been added. Cannot be null.

fireObjectRemoved

public void fireObjectRemoved(IlpObject object)
Fires an object removed event for one object.

Parameters:
object - The object that has been removed. Cannot be null.

fireObjectsRemoved

public void fireObjectsRemoved(List objects)
Fires an object removed event for a list of objects.

Parameters:
objects - The objects that have been removed. Cannot be null).

fireBatchStarted

public void fireBatchStarted()
Fires an batch started event.

Since:
JTGO 4.0

fireBatchEnded

public void fireBatchEnded()
Fires an batch ended event.

Since:
JTGO 4.0

fireObjectStructureChanged

public void fireObjectStructureChanged(IlpObject object,
                                       Class structuralInterface)
Fires an object structure changed event.

Parameters:
object - The object whose structure has changed. Cannot be null.
structuralInterface - The structural interface that has changed. Cannot be null.

fireObjectAttributeChanged

public void fireObjectAttributeChanged(IlpObject object,
                                       IlpAttribute attribute)
Fires an object attribute changed event. When the old value of the attribute is available use fireObjectAttributeChanged(IlpObject, IlpAttribute, Object, Object) instead.

Parameters:
object - The object whose attribute has changed. Cannot be null.
attribute - The attribute that has changed. Cannot be null.

fireObjectAttributeChanged

public void fireObjectAttributeChanged(IlpObject object,
                                       IlpAttribute attribute,
                                       Object newValue,
                                       Object oldValue)
Fires an object attribute changed event.

Parameters:
object - The object whose attribute has changed. Cannot be null.
attribute - The attribute that has changed. Cannot be null.
newValue - The new value of the attribute.
oldValue - The previous value of the attribute. When the old value is not available, use DataSourceObjectEvent.OLD_VALUE_UNAVAILABLE.
Since:
JTGO 4.0

getIdentifier

protected Object getIdentifier(Object idOrIlpObject)
Utility method that retrieves an object identifier from a parameter that can be either an identifier or an IlpObject instance.

Parameters:
idOrIlpObject - May be an IlpObject instance or an identifier (of any other Java class).
Returns:
The identifier corresponding to the parameter, that is either the parameter itself, if it is not an IlpObject instance, or the identifier of the parameter if it is an IlpObject instance.

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!

setDebugMask

public void setDebugMask(int mask)
Sets a new debug mask in this datasource.

The debug mask can be used by the datasource implementations to tell how the implementation should behave in case of errors. It is up to the datasource implementation to choose if the debug mask will be respected and when to use it to log a message and/or throw an exception.

Parameters:
mask - Debug mask
Since:
JViews 7.5
See Also:
IlpDataSourceDebugMask

getDebugMask

public int getDebugMask()
Returns the debug mask configured for this datasource.

Returns:
Debug mask
Since:
JViews 7.5
See Also:
IlpDataSourceDebugMask

logMessage

protected boolean logMessage(Logger logger,
                             Level l)
Indicates if a message shall be logged in the given logger.

Parameters:
logger - Logger
l - Log level
Returns:
true if this datasource is configured to log messages when performing operations that change the data source contents.
Since:
JViews 7.5

throwException

protected boolean throwException()
Indicates if an exception shall be thrown.

Returns:
true if this datasource is configured to throw exceptions when performing operations that change the data source contents.


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