|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.upc.dama.dex.io.Loader
public abstract class Loader
Loads data in a node or edge type.
It allows for store data structured as rows in a node or edge type
of a Graph.
Since data is structured as rows (CSV files, etc), it uses a
RowReader to get all the data.
When the load is running a Loader.LoaderEvent is sent
to their listeners with a given frequency.
| Nested Class Summary | |
|---|---|
class |
Loader.LoaderEvent
Constains information of the running Loader. |
static class |
Loader.Mode
Load can work in different ways. |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_DATEFORMAT
Default date format. |
protected long |
headAttr
Attribute identifier in the Graph to find head nodes
when loading data for an edge type. |
protected int |
headPos
Column index in the RowReader which stores the heads
when loading data for an edge type. |
protected int |
headType
Type of the attribute head (edge only) |
protected long |
tailAttr
Attribute identifier in the Graph to find tail nodes
when loading data for an edge type. |
protected int |
tailPos
Column index in the RowReader which stores the tails
when loading data for an edge type. |
protected int |
tailType
Type of the attribute tail (edge only) |
| Constructor Summary | |
|---|---|
protected |
Loader(RowReader rowReader,
Graph graph,
int objectType)
Creates a new instance of Loader. |
| Method Summary | |
|---|---|
int |
getFrequency()
Gets the frequency when Loader.LoaderEvents are sent
to their LoaderListener. |
java.io.File |
getLogFile()
Gets the File used to save the errors while loading. |
void |
registerLoaderListener(LoaderListener ll)
Adds a new LoaderListener. |
void |
run(Loader.Mode phases,
int partitions)
Starts the load process. |
void |
setAttribute(long attributeId,
int column)
Sets information to load a column, that is an attribute. |
void |
setDateFormat(java.lang.String dateformat)
Sets the date format to parse Value.TIMESTAMP values. |
void |
setDeleteTemporalFiles(boolean delete)
Sets the delete temporary files policy. |
void |
setFrequency(int frequency)
Updates the frequency of the Loader.LoaderEvents. |
void |
setLogFile(java.io.File file)
Sets the file used to save the errors while loading. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_DATEFORMAT
By default, date format parses values with the following
format: yyyy-MM-dd hh:mm:ss.
protected int tailPos
RowReader which stores the tails
when loading data for an edge type.
protected int headPos
RowReader which stores the heads
when loading data for an edge type.
protected long headAttr
Graph to find head nodes
when loading data for an edge type.
protected long tailAttr
Graph to find tail nodes
when loading data for an edge type.
protected int tailType
protected int headType
| Constructor Detail |
|---|
protected Loader(RowReader rowReader,
Graph graph,
int objectType)
Loader.
rowReader - RowReader to get the data from.graph - Graph to load the data to.objectType - Node or edge type to load the data to.| Method Detail |
|---|
public void registerLoaderListener(LoaderListener ll)
LoaderListener.
ll - A LoaderListener to be registered.public void setFrequency(int frequency)
Loader.LoaderEvents.
frequency - New frequency value.public int getFrequency()
Loader.LoaderEvents are sent
to their LoaderListener.
public void setDateFormat(java.lang.String dateformat)
Value.TIMESTAMP values.
dateformat - String with the new date format.SimpleDateFormat
public void setAttribute(long attributeId,
int column)
If the RowReader has N columns, then
0 <= column < N.
attributeId - Attribute identifier in the Graph.column - Column index in the RowReader where values for
the attributeId are stored.public void setDeleteTemporalFiles(boolean delete)
delete - If true, all temporary files are
deleted when the execution finishes, otherwise they will not
be deleted.
public void setLogFile(java.io.File file)
throws java.io.IOException
file - File used to write the errors. If file == null,
errors creating or setting objects will generate Exceptions. If not,
errors generate a report to the given file.
java.io.IOException - If bad things happen with the given file.public java.io.File getLogFile()
public void run(Loader.Mode phases,
int partitions)
throws java.io.IOException
Only when working in mode Loader.Mode.N_PHASES, load can be
partitioned horizontally.
phases - Number of phases to perform the load.partitions - Number of horizontal partitions to perform the load.
java.io.IOExceptionLoader.Mode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||