ReportMill 12 API

com.reportmill.datasource
Class RMFileDataSource

java.lang.Object
  extended by com.reportmill.base.RMObject
      extended by com.reportmill.datasource.RMDataSource
          extended by com.reportmill.datasource.RMFileDataSource
All Implemented Interfaces:
com.reportmill.base.RMPropertyChanger, java.beans.PropertyChangeListener, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
RMFTPDataSource, RMGAEDataSource, RMJSONDataSource

public class RMFileDataSource
extends RMDataSource

A datasource to read/write data and files to a file system.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.reportmill.datasource.RMDataSource
RMDataSource.EntityResolver
 
Constructor Summary
RMFileDataSource()
          Creates a new file data source.
RMFileDataSource(java.lang.String aName, java.lang.String aPath)
          Creates a new file data source at given path.
 
Method Summary
 RMEntity createEntityImpl(RMEntity anEntity)
          Creates a new entity.
 void delete()
          Deletes this data source, assuming it corresponds to something that can be deleted, like a database.
 void deleteFileImpl(RMFile aFile)
          Deletes file.
 void deleteRowImpl(RMRow aRow)
          Deletes a given row.
 RMFileDataSource fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
          XML unarchival.
 java.util.Map getDataset()
          Returns all data source data as a dataset.
 RMFile getEntityFile(java.lang.String aName, boolean doCreate)
          Returns the file for the given entity.
 java.util.List<RMRow> getEntityRows(RMEntity anEntity)
          Returns the list of rows for a given entity.
 java.util.List<RMFile> getFilesImpl(java.lang.String aPath)
          Returns files at path.
 java.lang.String getPath()
          Returns the path.
 java.util.List<RMRow> getRowsImpl(java.util.List<? extends RMProperty> theProperties, RMCondition aCondition, java.lang.Class<? extends RMRow> aClass)
          Returns a set of rows for the given properties and condition.
 RMSchema getSchema()
          Returns schema (loaded froms RMSchema.xml file).
 java.lang.String getTypeString()
          Returns the type string.
 void insertRowImpl(RMRow aRow)
          Inserts a given row.
 void readFileImpl(RMFile aFile)
          Gets file bytes.
 RMSchema readSchema()
          Reads schema from file.
 void saveRowsImmediately()
          Override to save CSV files.
 void saveSchema()
          Saves schema to file.
 void setPath(java.lang.String aPath)
          Sets the path.
 com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver, java.lang.Object anOwner)
          XML archival.
 void updateRowImpl(RMRow aRow)
          Updates a given row.
 void writeFileImpl(RMFile aFile)
          Writes file bytes.
 
Methods inherited from class com.reportmill.datasource.RMDataSource
create, createEntity, createObject, deleteEntity, deleteFile, deleteRow, equals, getAllRows, getDataset, getEntity, getEntityClass, getEntityResolver, getFile, getFile, getFile, getName, getRootDirectory, getRow, getRow, getRows, getSchemaVisible, getUniqueRow, insertRow, propertyChange, readFile, refresh, saveRows, setEntityResolver, setName, toString, updateRow, writeFile
 
Methods inherited from class com.reportmill.base.RMObject
addListener, addPropertyChangeListener, animUpdate, clone, firePropertyChange, firePropertyChange, getListener, getListenerCount, getListeners, isFirePropertyChangeEnabled, isUndoing, removeListener, removePropertyChangeListener, setFirePropertyChangeEnabled, setUndoing
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RMFileDataSource

public RMFileDataSource()
Creates a new file data source.


RMFileDataSource

public RMFileDataSource(java.lang.String aName,
                        java.lang.String aPath)
Creates a new file data source at given path.

Method Detail

getTypeString

public java.lang.String getTypeString()
Returns the type string.

Overrides:
getTypeString in class RMDataSource

getPath

public java.lang.String getPath()
Returns the path.


setPath

public void setPath(java.lang.String aPath)
Sets the path.


getSchema

public RMSchema getSchema()
Returns schema (loaded froms RMSchema.xml file).

Overrides:
getSchema in class RMDataSource

getDataset

public java.util.Map getDataset()
Returns all data source data as a dataset.

Overrides:
getDataset in class RMDataSource

getRowsImpl

public java.util.List<RMRow> getRowsImpl(java.util.List<? extends RMProperty> theProperties,
                                         RMCondition aCondition,
                                         java.lang.Class<? extends RMRow> aClass)
Returns a set of rows for the given properties and condition.


insertRowImpl

public void insertRowImpl(RMRow aRow)
Inserts a given row.


updateRowImpl

public void updateRowImpl(RMRow aRow)
Updates a given row.


deleteRowImpl

public void deleteRowImpl(RMRow aRow)
Deletes a given row.


saveRowsImmediately

public void saveRowsImmediately()
Override to save CSV files.

Overrides:
saveRowsImmediately in class RMDataSource

getEntityFile

public RMFile getEntityFile(java.lang.String aName,
                            boolean doCreate)
Returns the file for the given entity.


getEntityRows

public java.util.List<RMRow> getEntityRows(RMEntity anEntity)
Returns the list of rows for a given entity.


getFilesImpl

public java.util.List<RMFile> getFilesImpl(java.lang.String aPath)
Returns files at path.

Overrides:
getFilesImpl in class RMDataSource

readFileImpl

public void readFileImpl(RMFile aFile)
Gets file bytes.


writeFileImpl

public void writeFileImpl(RMFile aFile)
Writes file bytes.


deleteFileImpl

public void deleteFileImpl(RMFile aFile)
Deletes file.


createEntityImpl

public RMEntity createEntityImpl(RMEntity anEntity)
Creates a new entity.


readSchema

public RMSchema readSchema()
Reads schema from file.


saveSchema

public void saveSchema()
Saves schema to file.


delete

public void delete()
Deletes this data source, assuming it corresponds to something that can be deleted, like a database.

Overrides:
delete in class RMDataSource

toXML

public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver,
                                               java.lang.Object anOwner)
XML archival.

Overrides:
toXML in class RMDataSource

fromXML

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

Overrides:
fromXML in class RMDataSource

ReportMill 12 API