ReportMill 10 API

com.reportmill.datasource
Class RMXMLDataSource

java.lang.Object
  extended by com.reportmill.datasource.RMDataSource
      extended by com.reportmill.datasource.RMXMLDataSource
All Implemented Interfaces:
RMBindSource, java.lang.Cloneable

public class RMXMLDataSource
extends RMDataSource

This class is used as a proxy for objects passed to document's generateReport() method. It provides schema information of the object graph (in the form of RMEntity and RMProperty objects) and it provides sample data (probably in the form of Java Collections and core types: List, Map, String, Number, Date).


Constructor Summary
RMXMLDataSource()
          Creates a plain datasource.
RMXMLDataSource(java.lang.Object aSource, java.lang.String aName)
          Creates a datasource from a given source with a given name (can be null).
 
Method Summary
 java.lang.Object clone()
          Standard clone implementation.
 RMDatum createDatum(RMEntity anEntity)
          Creates and returns a new datum for a given entity.
 RMResource createResource(java.lang.String aName, java.lang.Object theBytes)
          Creates a new resource for given name and bytes.
 void dataAdd(RMDatum aDatum)
          Notifies datasource that a datum will be added.
 boolean equals(java.lang.Object anObj)
          Standard equals implementation.
 java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement)
          XML unarchival.
 boolean getCustomSchema()
          Returns a schema that may differ from the one stored in an XML file.
 java.util.Map getDataset()
          Returns a sample dataset of objects associated with the datasource.
 RMDataSet getDataSet(RMFetch aFetch)
          Gets the dataset for an entity.
 RMEntity getEntity(java.lang.String aKeyPath)
          Returns the entity at the given key path.
 java.lang.String getError()
          Returns the last error encountered when loading a datasource.
 RMProperty getRelation(java.lang.String aKeyPath)
          Returns the relation at the given key path.
 RMResource getResource(int anIndex)
          Returns the specific resource at the given index.
 RMResource getResource(java.lang.String aName)
          Returns the resource for given name.
 int getResourceCount()
          Returns the number of resources in this datasource.
 java.lang.String[] getResourceNames(java.lang.String aType)
          Returns the resource names for a given type.
 RMSchema getSchema()
          Returns the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.
 java.lang.Object getSource()
          Returns the source for the datasource.
 boolean isReadOnly()
          Returns whether datasource is read-only.
 void refresh()
          Invalidates any cached data.
 void saveChanges()
          Saves changes.
 void setCustomSchema(boolean customSchema)
          Sets a schema that may differ from the one stored in an XML file.
 void setSchema(RMSchema aSchema)
          Sets the schema.
 void setSource(java.lang.Object aSource)
          Sets the source for the datasource.
static void setSourceContext(java.lang.Object aSource)
          Sets possible context for aSource.
 java.lang.String toString()
          Returns a string representation of the datasource (just its name).
 com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
          XML archival.
 
Methods inherited from class com.reportmill.datasource.RMDataSource
dataChange, dataRemove, getData, getDataSet, getName, hasChanges, initFromDataSource, setName
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RMXMLDataSource

public RMXMLDataSource()
Creates a plain datasource.


RMXMLDataSource

public RMXMLDataSource(java.lang.Object aSource,
                       java.lang.String aName)
Creates a datasource from a given source with a given name (can be null).

Method Detail

getSource

public java.lang.Object getSource()
Returns the source for the datasource.


setSource

public void setSource(java.lang.Object aSource)
Sets the source for the datasource.


getSchema

public RMSchema getSchema()
Returns the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.

Overrides:
getSchema in class RMDataSource

setSchema

public void setSchema(RMSchema aSchema)
Sets the schema.

Overrides:
setSchema in class RMDataSource

getCustomSchema

public boolean getCustomSchema()
Returns a schema that may differ from the one stored in an XML file.


setCustomSchema

public void setCustomSchema(boolean customSchema)
Sets a schema that may differ from the one stored in an XML file.


getEntity

public RMEntity getEntity(java.lang.String aKeyPath)
Returns the entity at the given key path.

Overrides:
getEntity in class RMDataSource

getRelation

public RMProperty getRelation(java.lang.String aKeyPath)
Returns the relation at the given key path.

Overrides:
getRelation in class RMDataSource

getDataset

public java.util.Map getDataset()
Returns a sample dataset of objects associated with the datasource.

Overrides:
getDataset in class RMDataSource

getDataSet

public RMDataSet getDataSet(RMFetch aFetch)
Gets the dataset for an entity.

Specified by:
getDataSet in interface RMBindSource
Overrides:
getDataSet in class RMDataSource

dataAdd

public void dataAdd(RMDatum aDatum)
Notifies datasource that a datum will be added.

Overrides:
dataAdd in class RMDataSource

saveChanges

public void saveChanges()
Saves changes.

Overrides:
saveChanges in class RMDataSource

createDatum

public RMDatum createDatum(RMEntity anEntity)
Creates and returns a new datum for a given entity.

Overrides:
createDatum in class RMDataSource

refresh

public void refresh()
Invalidates any cached data.

Overrides:
refresh in class RMDataSource

getError

public java.lang.String getError()
Returns the last error encountered when loading a datasource.

Overrides:
getError in class RMDataSource

setSourceContext

public static void setSourceContext(java.lang.Object aSource)
Sets possible context for aSource.


getResourceCount

public int getResourceCount()
Returns the number of resources in this datasource.


getResource

public RMResource getResource(int anIndex)
Returns the specific resource at the given index.


getResourceNames

public java.lang.String[] getResourceNames(java.lang.String aType)
Returns the resource names for a given type.

Overrides:
getResourceNames in class RMDataSource

createResource

public RMResource createResource(java.lang.String aName,
                                 java.lang.Object theBytes)
Creates a new resource for given name and bytes.

Overrides:
createResource in class RMDataSource

getResource

public RMResource getResource(java.lang.String aName)
Returns the resource for given name.

Overrides:
getResource in class RMDataSource

isReadOnly

public boolean isReadOnly()
Returns whether datasource is read-only.

Overrides:
isReadOnly in class RMDataSource

equals

public boolean equals(java.lang.Object anObj)
Standard equals implementation.

Overrides:
equals in class RMDataSource

clone

public java.lang.Object clone()
Standard clone implementation.

Overrides:
clone in class RMDataSource

toXML

public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
XML archival.

Overrides:
toXML in class RMDataSource

fromXML

public java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver,
                                com.reportmill.archiver.RXElement anElement)
XML unarchival.

Overrides:
fromXML in class RMDataSource

toString

public java.lang.String toString()
Returns a string representation of the datasource (just its name).

Overrides:
toString in class RMDataSource

ReportMill 10 API