ca.sqlpower.architect
Class ArchitectSessionContextImpl

java.lang.Object
  extended by ca.sqlpower.architect.ArchitectSessionContextImpl
All Implemented Interfaces:
ArchitectSessionContext

public class ArchitectSessionContextImpl
extends java.lang.Object
implements ArchitectSessionContext


Field Summary
 
Fields inherited from interface ca.sqlpower.architect.ArchitectSessionContext
DRIVERS_URL
 
Constructor Summary
ArchitectSessionContextImpl()
          Creates a new session context.
ArchitectSessionContextImpl(java.lang.String PlDotIniPath)
          Similar to the default constructor, but we can specify a pl.ini path ourselves.
 
Method Summary
 ArchitectSession createSession()
          Creates a new session within this parent context.
 ArchitectSession createSession(java.io.InputStream in)
          Creates a new session by loading the Architect XML project description from the given input stream.
 java.util.List<ca.sqlpower.sql.SPDataSource> getConnections()
           
 ca.sqlpower.sql.DataSourceCollection getPlDotIni()
          Tries to read the plDotIni if it hasn't been done already.
 java.lang.String getPlDotIniPath()
          See plDotIniPath.
 java.util.prefs.Preferences getPrefs()
          Returns the user preferences node associated with this context.
 java.util.Collection<ArchitectSession> getSessions()
          Returns a collection containing all the sessions from this context.
 void setPlDotIniPath(java.lang.String plDotIniPath)
          Sets the plDotIniPath property, and nulls out the current plDotIni if the given value differs from the existing one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArchitectSessionContextImpl

public ArchitectSessionContextImpl()
                            throws ArchitectException
Creates a new session context. You will normally only need one of these per JVM, but there is no technical barrier to creating multiple contexts.

Important note: This constructor must be called on the Swing Event Dispatch Thread. See SwingUtilities.invokeLater() for a way of ensuring this method is called on the proper thread.

Throws:
ArchitectException

ArchitectSessionContextImpl

public ArchitectSessionContextImpl(java.lang.String PlDotIniPath)
                            throws ArchitectException
Similar to the default constructor, but we can specify a pl.ini path ourselves. (This has been created in order to fully automate the JUnit test).

Throws:
ArchitectException
Method Detail

createSession

public ArchitectSession createSession()
                               throws ArchitectException
Description copied from interface: ArchitectSessionContext
Creates a new session within this parent context.

Specified by:
createSession in interface ArchitectSessionContext
Throws:
ArchitectException

createSession

public ArchitectSession createSession(java.io.InputStream in)
                               throws ArchitectException,
                                      java.io.IOException
Description copied from interface: ArchitectSessionContext
Creates a new session by loading the Architect XML project description from the given input stream.

Specified by:
createSession in interface ArchitectSessionContext
Parameters:
in - The input stream to read the XML data from
Returns:
The new session
Throws:
ArchitectException
java.io.IOException

getPrefs

public java.util.prefs.Preferences getPrefs()
Description copied from interface: ArchitectSessionContext
Returns the user preferences node associated with this context.

Specified by:
getPrefs in interface ArchitectSessionContext

getSessions

public java.util.Collection<ArchitectSession> getSessions()
Description copied from interface: ArchitectSessionContext
Returns a collection containing all the sessions from this context.

Specified by:
getSessions in interface ArchitectSessionContext

getPlDotIni

public ca.sqlpower.sql.DataSourceCollection getPlDotIni()
Tries to read the plDotIni if it hasn't been done already. If it can't be read, returns null and leaves the plDotIni property as null as well. See plDotIni.

Specified by:
getPlDotIni in interface ArchitectSessionContext

getPlDotIniPath

public java.lang.String getPlDotIniPath()
See plDotIniPath.

Specified by:
getPlDotIniPath in interface ArchitectSessionContext

setPlDotIniPath

public void setPlDotIniPath(java.lang.String plDotIniPath)
Sets the plDotIniPath property, and nulls out the current plDotIni if the given value differs from the existing one. See plDotIniPath.

Specified by:
setPlDotIniPath in interface ArchitectSessionContext

getConnections

public java.util.List<ca.sqlpower.sql.SPDataSource> getConnections()
Specified by:
getConnections in interface ArchitectSessionContext


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