ca.sqlpower.wabit
Interface WabitSession

All Known Subinterfaces:
WabitSwingSession
All Known Implementing Classes:
WabitServerSession, WabitSessionImpl, WabitSwingSessionImpl

public interface WabitSession

The basic interface for a Wabit session. This interface provides all the UI-independent state and behaviour of a Wabit session.


Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void addSessionLifecycleListener(ca.sqlpower.swingui.event.SessionLifecycleListener<WabitSession> l)
           
 boolean close()
          Ends this session, disposing its frame and releasing any system resources that were obtained explicitly by this session.
 WabitSessionContext getContext()
          Returns the context this session belongs to.
 ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> getDataSources()
          Returns a collection of all the data sources that are available to this session.
 WabitWorkspace getSystemWorkspace()
          This method might return a WabitWorkspace, the system one, located on the Wabit server, if the current session is backed by a remote server session.
 WabitWorkspace getWorkspace()
          Returns the workspace associated with this session.
 boolean isEnterpriseServerSession()
          Returns true if the current session is in fact a remote session with the wabit enterprise server.
 boolean isForegroundThread()
          Returns true if the current thread is the thread defined as the foreground thread.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void removeSessionLifecycleListener(ca.sqlpower.swingui.event.SessionLifecycleListener<WabitSession> l)
           
 void runInBackground(java.lang.Runnable runner)
          This will execute the runnable in a manner that will try to avoid blocking the user interface.
 void runInForeground(java.lang.Runnable runner)
          This will force the given runnable to execute in the 'foreground'.
 

Method Detail

addSessionLifecycleListener

void addSessionLifecycleListener(ca.sqlpower.swingui.event.SessionLifecycleListener<WabitSession> l)

removeSessionLifecycleListener

void removeSessionLifecycleListener(ca.sqlpower.swingui.event.SessionLifecycleListener<WabitSession> l)

getContext

WabitSessionContext getContext()
Returns the context this session belongs to.


close

boolean close()
Ends this session, disposing its frame and releasing any system resources that were obtained explicitly by this session. Also fires a sessionClosing lifecycle event, so any resources used up by subsystems dependent on this session can be freed by the appropriate parties.

Returns:
True if the session was successfully closed. False if the session did not close due to an error or user intervention.

getWorkspace

WabitWorkspace getWorkspace()
Returns the workspace associated with this session.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener l)

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener l)

getDataSources

ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> getDataSources()
Returns a collection of all the data sources that are available to this session. The data sources do not have to be in the session's workspace. All of the data sources in the session's workspace will be in this collection.


runInForeground

void runInForeground(java.lang.Runnable runner)
This will force the given runnable to execute in the 'foreground'. If something is executed in the foreground then the thread that called this method will pass the runner to the thread that updates the user interface. Once the Runnable has been passed to the UI thread this method will continue executing and the runner will be executed when the UI thread is able to run it.

In cases where there is no UI, the foreground thread will be the same thread as the one calling this method. If this is the case the runner will just have run() called on the same thread. Additionally, if this is called on the foreground thread then it will be run on this thread is they are the same.

If you are calling this from a WabitObject that extends AbstractWabitObject you should use the AbstractWabitObject.runInForeground(Runnable) method instead

Parameters:
runner - The runnable to run in the foreground.

isForegroundThread

boolean isForegroundThread()
Returns true if the current thread is the thread defined as the foreground thread.

See Also:
runInForeground(Runnable)

runInBackground

void runInBackground(java.lang.Runnable runner)
This will execute the runnable in a manner that will try to avoid blocking the user interface. This will be done by creating a new thread to execute the Runnable on.

In places where there is no UI this runnable will be executed on this thread.

If you are calling this from a WabitObject that extends AbstractWabitObject you should use the AbstractWabitObject.runInBackground(Runnable) method instead

Parameters:
runner - The runnable to run in the background.

isEnterpriseServerSession

boolean isEnterpriseServerSession()
Returns true if the current session is in fact a remote session with the wabit enterprise server.

Returns:

getSystemWorkspace

WabitWorkspace getSystemWorkspace()
This method might return a WabitWorkspace, the system one, located on the Wabit server, if the current session is backed by a remote server session. It will return null if it is not a server session or the user doesn't have access to the system workspace. One can also use isEnterpriseSession() to verify if this call will return null beforehand.

Returns:


Copyright © 2009. All Rights Reserved.