|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface WabitSessionContext
A WabitSessionContext provides the basic non-session-specific services that all Wabit code can depend upon. Each live session belongs to exactly one session context, which is where the non-session-specific preferences are stored. The session context manages the lifecycle of the sessions that belong to it.
The session context is also a UserPrompterFactory (as are each of the sessions it owns). The session context should be used as a user prompter factory for alerts and questions that are not directly related to a live session, such as questions and warnings that arise during application startup as well as when in the process of opening a Wabit workspace file.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface ca.sqlpower.util.UserPrompterFactory |
|---|
ca.sqlpower.util.UserPrompterFactory.UserPromptType |
| Field Summary | |
|---|---|
static java.lang.String |
DISABLE_QUERY_AUTO_EXECUTE
A constant for storing the global preference for disabling automatic execution of queries |
static java.lang.String |
NEW_WORKSPACE_URL
|
static java.lang.String |
WABIT_ENTERPRISE_SERVER_MDNS_TYPE
The service type to look for when discovering enterprise servers on the local network. |
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
|
void |
addServer(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
Adds a new user-configured server specification to this context. |
void |
addServerListListener(ServerListListener l)
This listener will be notified when server information is added or removed from the server list. |
java.sql.Connection |
borrowConnection(ca.sqlpower.sql.JDBCDataSource dataSource)
Borrows a connection to the given data source from this session's connection pool. |
void |
close()
This will attempt to close all of the currently opened sessions and stop the app. |
WabitSession |
createServerSession(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
This will create an appropriate server session for the current context. |
WabitSession |
createSession()
This will create an appropriate local session for the current context. |
void |
endLoading()
The DAO can tell this context that it's no longer being configured based on a workspace file being loaded. |
WabitSession |
getActiveSession()
Returns the session that the user is currently viewing or editing. |
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> |
getDataSources()
|
java.util.List<ca.sqlpower.enterprise.client.SPServerInfo> |
getEnterpriseServers(boolean includeDiscoveredServers)
Returns the list of currently-known enterprise servers. |
javax.jmdns.JmDNS |
getJmDNS()
Returns this context's JmDNS client instance. |
java.lang.String |
getName()
Returns the name for this session context. |
java.util.prefs.Preferences |
getPrefs()
Returns the preferences node used by this session context. |
int |
getRowLimit()
Returns the number of rows that should be retrieved from the database for any result set. |
int |
getSessionCount()
Returns the number of active sessions in the context. |
java.util.List<WabitSession> |
getSessions()
Returns an unmodifiable list of the active sessions in the context. |
boolean |
isLoading()
Tells whether or not this session is currently being configured by a DAO. |
boolean |
isMacOSX()
returns true if the OS is Mac |
void |
registerChildSession(WabitSession child)
Adds the given Wabit session to the list of child sessions for this context. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
|
void |
removeServer(ca.sqlpower.enterprise.client.SPServerInfo si)
Removes a new user-configured server specification from this context. |
void |
removeServerListListener(ServerListListener l)
This listener will stop being notified when server information is added or removed from the server list. |
void |
setActiveSession(WabitSession session)
Sets the active session that is being viewed or modified. |
void |
startLoading()
The DAO can tell this context that it's currently being configured based on a workspace file being loaded. |
| Methods inherited from interface ca.sqlpower.util.UserPrompterFactory |
|---|
createDatabaseUserPrompter, createUserPrompter |
| Methods inherited from interface ca.sqlpower.sqlobject.SQLDatabaseMapping |
|---|
getDatabase |
| Methods inherited from interface ca.sqlpower.wabit.OlapConnectionMapping |
|---|
createConnection |
| Field Detail |
|---|
static final java.lang.String WABIT_ENTERPRISE_SERVER_MDNS_TYPE
_wabitenterprise._tcp.local..
static final java.lang.String DISABLE_QUERY_AUTO_EXECUTE
static final java.lang.String NEW_WORKSPACE_URL
| Method Detail |
|---|
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> getDataSources()
void registerChildSession(WabitSession child)
A given session should only be registered with one context at a time. The
context a session is registered with should generally be the one returned
by the session's getContext() method.
There is no "deregsiter" method to remove a session from its context. Sessions fire a lifecycle event when they close down; the context listens to all its registered sessions and removes its references to them when they send a sessionClosing event.
boolean isMacOSX()
WabitSession createSession()
WabitSession createServerSession(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
int getSessionCount()
java.util.List<WabitSession> getSessions()
javax.jmdns.JmDNS getJmDNS()
java.util.List<ca.sqlpower.enterprise.client.SPServerInfo> getEnterpriseServers(boolean includeDiscoveredServers)
includeDiscoveredServers - if true, all known servers will be returned whether they were
configured explicitly or discovered dynamically. If false, only
the explicitly configured servers will be listed.
void addServer(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
getEnterpriseServers(boolean)
list immediately, and also stored persistently so it will be included in
the enterprise server list in future incarnations of WabitSessionContext.
serverInfo - The serverInfo object to add.void removeServer(ca.sqlpower.enterprise.client.SPServerInfo si)
serverInfo - The serverInfo object to remove. If this does not specify a
manually-configured serverInfo (one that was returned by
getEnterpriseServers(boolean) with an argument of
true), this method will have no effect.java.util.prefs.Preferences getPrefs()
void close()
java.lang.String getName()
java.sql.Connection borrowConnection(ca.sqlpower.sql.JDBCDataSource dataSource)
throws ca.sqlpower.sqlobject.SQLObjectException
Connection.close() on the returned
object as soon as you are finished with it.
Design note: Equivalent to #getDatabase(SPDataSource)
.getConnection(). Normally we discourage adding convenience methods to an
interface, and this is indeed a convenience method on an interface. The
reason for this method is to reinforce the idea that connections to data
sources must be obtained via the SQLDatabase object held in the session.
dataSource - The data source this connection comes from.
ca.sqlpower.sqlobject.SQLObjectException - if it is not currently possible to connect to the given data
source. This could be due to the remote database being
unavailable, or an incorrect username or password, a missing
JDBC driver, or many other things.boolean isLoading()
void startLoading()
void endLoading()
int getRowLimit()
void addServerListListener(ServerListListener l)
void removeServerListListener(ServerListListener l)
void setActiveSession(WabitSession session)
WabitSession getActiveSession()
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||