ca.sqlpower.architect
Class CoreProject

java.lang.Object
  extended by ca.sqlpower.architect.CoreProject
Direct Known Subclasses:
SwingUIProject

public class CoreProject
extends java.lang.Object


Field Summary
protected  java.util.Map<java.lang.String,ca.sqlpower.sql.SPDataSource> dbcsLoadIdMap
          This map maps String ID codes to DBCS instances used in loading.
protected  java.util.Map<ca.sqlpower.sql.SPDataSource,java.lang.String> dbcsSaveIdMap
          This holds mappings from DBCS instance to String ID used in saving.
protected  java.io.File file
           
protected  boolean modified
          Tracks whether or not this project has been modified since last saved.
protected  java.util.Map<java.lang.String,OLAPObject> olapObjectLoadIdMap
          This map maps String ID codes to OLAPObject instances used in loading.
protected  java.util.Map<OLAPObject,java.lang.String> olapObjectSaveIdMap
          This holds mappings from OLAPObject instance to String ID used in saving.
protected  java.io.PrintWriter out
          Should be set to NULL unless we are currently saving the project, at which time it's writing to the project file.
protected  int progress
          The last value we sent to the progress monitor.
protected  boolean saveInProgress
          Don't let application exit while saving.
protected  ArchitectSession session
           
protected  java.util.Map<java.lang.String,SQLObject> sqlObjectLoadIdMap
          This map maps String ID codes to SQLObject instances used in loading.
protected  java.util.Map<SQLObject,java.lang.String> sqlObjectSaveIdMap
          This holds mappings from SQLObject instance to String ID used in saving.
 
Constructor Summary
CoreProject(ArchitectSession session)
           
 
Method Summary
 void addAllTablesFrom(SQLDatabase db)
          Adds all the tables in the given database into the playpen database.
 java.io.File getFile()
          Returns the file that this project was most recently saved to or loaded from.
protected  ArchitectSession getSession()
           
 boolean isModified()
          See modified.
 boolean isSaveInProgress()
           
 void load(java.io.InputStream in, ca.sqlpower.sql.DataSourceCollection dataSources)
          Loads the project data from the given input stream.
 void setFile(java.io.File argFile)
          Tells this project which file it was most recently saved to or loaded from.
 void setModified(boolean modified)
          See modified.
 void setSaveInProgress(boolean saveInProgress)
           
protected  org.apache.commons.digester.Digester setupDigester()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected java.io.File file

modified

protected boolean modified
Tracks whether or not this project has been modified since last saved.


saveInProgress

protected boolean saveInProgress
Don't let application exit while saving.


out

protected java.io.PrintWriter out
Should be set to NULL unless we are currently saving the project, at which time it's writing to the project file.


sqlObjectLoadIdMap

protected java.util.Map<java.lang.String,SQLObject> sqlObjectLoadIdMap
This map maps String ID codes to SQLObject instances used in loading.


sqlObjectSaveIdMap

protected java.util.Map<SQLObject,java.lang.String> sqlObjectSaveIdMap
This holds mappings from SQLObject instance to String ID used in saving.


olapObjectLoadIdMap

protected java.util.Map<java.lang.String,OLAPObject> olapObjectLoadIdMap
This map maps String ID codes to OLAPObject instances used in loading.


olapObjectSaveIdMap

protected java.util.Map<OLAPObject,java.lang.String> olapObjectSaveIdMap
This holds mappings from OLAPObject instance to String ID used in saving.


dbcsLoadIdMap

protected java.util.Map<java.lang.String,ca.sqlpower.sql.SPDataSource> dbcsLoadIdMap
This map maps String ID codes to DBCS instances used in loading.


dbcsSaveIdMap

protected java.util.Map<ca.sqlpower.sql.SPDataSource,java.lang.String> dbcsSaveIdMap
This holds mappings from DBCS instance to String ID used in saving.


progress

protected int progress
The last value we sent to the progress monitor.


session

protected ArchitectSession session
Constructor Detail

CoreProject

public CoreProject(ArchitectSession session)
Method Detail

isSaveInProgress

public boolean isSaveInProgress()
Returns:
Returns the saveInProgress.

setSaveInProgress

public void setSaveInProgress(boolean saveInProgress)
Parameters:
saveInProgress - The saveInProgress to set.

load

public void load(java.io.InputStream in,
                 ca.sqlpower.sql.DataSourceCollection dataSources)
          throws java.io.IOException,
                 ArchitectException
Loads the project data from the given input stream.

Note: the input stream is always closed afterwards.

Parameters:
in - Used to load in the project data, must support mark.
dataSources - Collection of the data sources used in the project
Throws:
java.io.IOException
ArchitectException

setupDigester

protected org.apache.commons.digester.Digester setupDigester()
                                                      throws javax.xml.parsers.ParserConfigurationException,
                                                             org.xml.sax.SAXException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

isModified

public boolean isModified()
See modified.


setModified

public void setModified(boolean modified)
See modified.


getSession

protected ArchitectSession getSession()

getFile

public java.io.File getFile()
Returns the file that this project was most recently saved to or loaded from.


setFile

public void setFile(java.io.File argFile)
Tells this project which file it was most recently saved to or loaded from.


addAllTablesFrom

public void addAllTablesFrom(SQLDatabase db)
                      throws ArchitectException
Adds all the tables in the given database into the playpen database. This is really only for loading projects, so please think twice about using it for other stuff.

Parameters:
db - The database to add tables from. The database must contain tables directly.
Throws:
ArchitectException - If adding the tables of db fails


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca