net.sf.mpxj.primavera
Class PrimaveraDatabaseReader

java.lang.Object
  extended by net.sf.mpxj.primavera.PrimaveraDatabaseReader
All Implemented Interfaces:
ProjectReader

public final class PrimaveraDatabaseReader
extends Object
implements ProjectReader

This class provides a generic front end to read project data from a database.


Constructor Summary
PrimaveraDatabaseReader()
           
 
Method Summary
 void addProjectListener(ProjectListener listener)
          Add a listener to receive events as a project is being read.
 String getSchema()
          Retrieve the name of the schema containing the Primavera tables.
 Map<Integer,String> listProjects()
          Populates a Map instance representing the IDs and names of projects available in the current database.
 ProjectFile read()
          Read a project from the current data source.
 ProjectFile read(File file)
          Read a file where a File instance is supplied.
 ProjectFile read(InputStream inputStream)
          Read a file where the contents of the project file are supplied via an input stream.
 ProjectFile read(String fileName)
          Read a file where the file name is supplied.
 List<ProjectFile> readAll()
          Convenience method which allows all projects in the database to be read in a single operation.
 void setConnection(Connection connection)
          Sets the connection.
 void setDataSource(DataSource dataSource)
          Set the data source.
 void setProjectID(int projectID)
          Set the ID of the project to be read.
 void setSchema(String schema)
          Set the name of the schema containing the Primavera tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimaveraDatabaseReader

public PrimaveraDatabaseReader()
Method Detail

addProjectListener

public void addProjectListener(ProjectListener listener)
Add a listener to receive events as a project is being read.

Specified by:
addProjectListener in interface ProjectReader
Parameters:
listener - ProjectListener instance

listProjects

public Map<Integer,String> listProjects()
                                 throws MPXJException
Populates a Map instance representing the IDs and names of projects available in the current database.

Returns:
Map instance containing ID and name pairs
Throws:
MPXJException

read

public ProjectFile read()
                 throws MPXJException
Read a project from the current data source.

Returns:
ProjectFile instance
Throws:
MPXJException

readAll

public List<ProjectFile> readAll()
                          throws MPXJException
Convenience method which allows all projects in the database to be read in a single operation.

Returns:
list of ProjectFile instances
Throws:
MPXJException

setProjectID

public void setProjectID(int projectID)
Set the ID of the project to be read.

Parameters:
projectID - project ID

setDataSource

public void setDataSource(DataSource dataSource)
Set the data source. A DataSource or a Connection can be supplied to this class to allow connection to the database.

Parameters:
dataSource - data source

setConnection

public void setConnection(Connection connection)
Sets the connection. A DataSource or a Connection can be supplied to this class to allow connection to the database.

Parameters:
connection - database connection

read

public ProjectFile read(String fileName)
Read a file where the file name is supplied.

Specified by:
read in interface ProjectReader
Parameters:
fileName - file name
Returns:
ProjectFile instance

read

public ProjectFile read(File file)
Read a file where a File instance is supplied.

Specified by:
read in interface ProjectReader
Parameters:
file - File instance
Returns:
ProjectFile instance

read

public ProjectFile read(InputStream inputStream)
Read a file where the contents of the project file are supplied via an input stream.

Specified by:
read in interface ProjectReader
Parameters:
inputStream - InputStream instance
Returns:
ProjectFile instance

setSchema

public void setSchema(String schema)
Set the name of the schema containing the Primavera tables.

Parameters:
schema - schema name.

getSchema

public String getSchema()
Retrieve the name of the schema containing the Primavera tables.

Returns:
schema name


Copyright © 2012. All Rights Reserved.