|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.wabit.WabitSessionImpl
ca.sqlpower.wabit.enterprise.client.WabitClientSession
public class WabitClientSession
A special kind of session that binds itself to a remote Wabit Enterprise Server. Provides database connection information and file storage capability based on the remote server.
| Constructor Summary | |
|---|---|
WabitClientSession(WorkspaceLocation workspaceLocation,
WabitSessionContext context)
|
|
| Method Summary | |
|---|---|
boolean |
close()
Ends this session, disposing its frame and releasing any system resources that were obtained explicitly by this session. |
static org.apache.http.client.HttpClient |
createHttpClient(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
|
static WorkspaceLocation |
createNewServerSession(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
Sends an HTTP request to a Wabit Enterprise Server to create a new remote Wabit Workspace on that server. |
void |
deleteServerWorkspace()
|
static org.apache.http.client.CookieStore |
getCookieStore()
Exposes the shared cookie store so we don't spawn useless sessions through the client. |
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> |
getDataSources()
Returns the server's data source list, retrieving it from the server if that has not already been done during this session. |
WabitWorkspace |
getSystemWorkspace()
Fetches the system workspace from the same server as this session. |
WorkspaceLocation |
getWorkspaceLocation()
Returns the location this workspace was loaded from. |
static java.util.List<WorkspaceLocation> |
getWorkspaceNames(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
List all the workspaces on this context's server. |
boolean |
isEnterpriseServerSession()
Returns true if the current session is in fact a remote session with the wabit enterprise server. |
static WabitClientSession |
openServerSession(WabitSessionContext context,
WorkspaceLocation workspaceLoc)
Finds and opens a specific Wabit Workspace from the given WorkspaceLocation. |
static java.util.List<WabitClientSession> |
openServerSessions(WabitSessionContext context,
ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
Finds and opens all visible Wabit workspaces on the given Wabit Enterprise Server. |
void |
persistWorkspaceToServer()
|
void |
runInForeground(java.lang.Runnable runner)
|
void |
startUpdaterThread()
|
| Methods inherited from class ca.sqlpower.wabit.WabitSessionImpl |
|---|
addPropertyChangeListener, addSessionLifecycleListener, createUserPrompter, getContext, getWorkspace, isForegroundThread, removePropertyChangeListener, removeSessionLifecycleListener, runInBackground |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WabitClientSession(@Nonnull
WorkspaceLocation workspaceLocation,
@Nonnull
WabitSessionContext context)
| Method Detail |
|---|
public static org.apache.http.client.HttpClient createHttpClient(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
public boolean close()
WabitSession
close in interface WabitSessionclose in class WabitSessionImplpublic WorkspaceLocation getWorkspaceLocation()
public ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> getDataSources()
Future plans: In the future, the server will probably be a proxy for all database operations, and we won't actually send the connection information to the client. This has the advantage that it can work over an HTTP firewall or proxy, where the present method would fail.
getDataSources in interface WabitSessiongetDataSources in class WabitSessionImpl
public static java.util.List<WorkspaceLocation> getWorkspaceNames(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
throws java.io.IOException,
java.net.URISyntaxException,
JSONException
serviceInfo -
java.io.IOException
java.net.URISyntaxException
JSONException
public static WorkspaceLocation createNewServerSession(ca.sqlpower.enterprise.client.SPServerInfo serviceInfo)
throws java.net.URISyntaxException,
org.apache.http.client.ClientProtocolException,
java.io.IOException,
JSONException
serviceInfo - A SPServerInfo containing the connection
information for that server
WorkspaceLocation of the newly created remote
WabitWorkspace
java.net.URISyntaxException
org.apache.http.client.ClientProtocolException
java.io.IOException
JSONException
public void deleteServerWorkspace()
throws java.net.URISyntaxException,
org.apache.http.client.ClientProtocolException,
java.io.IOException
java.net.URISyntaxException
org.apache.http.client.ClientProtocolException
java.io.IOException
public static WabitClientSession openServerSession(WabitSessionContext context,
WorkspaceLocation workspaceLoc)
WorkspaceLocation. The new session will keep itself up-to-date by
polling the server for new state. Likewise, local changes to the session will be pushed its own
updates back to the server.
context - The context to register the new remote WabitSession withworkspaceLoc - A WorkspaceLocation detailing the location of the
remote workspace to be opened
public static java.util.List<WabitClientSession> openServerSessions(WabitSessionContext context,
ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
throws java.io.IOException,
java.net.URISyntaxException,
JSONException
context - the context to add the newly-retrieved sessions toserverInfo - The server to contact.
JSONException
java.net.URISyntaxException
java.io.IOExceptionpublic void startUpdaterThread()
public void persistWorkspaceToServer()
throws ca.sqlpower.dao.SPPersistenceException
ca.sqlpower.dao.SPPersistenceExceptionpublic WabitWorkspace getSystemWorkspace()
getSystemWorkspace in interface WabitSessiongetSystemWorkspace in class WabitSessionImplpublic void runInForeground(java.lang.Runnable runner)
runInForeground in interface ca.sqlpower.util.SPSessionrunInForeground in class WabitSessionImplpublic boolean isEnterpriseServerSession()
WabitSession
isEnterpriseServerSession in interface WabitSessionisEnterpriseServerSession in class WabitSessionImplpublic static org.apache.http.client.CookieStore getCookieStore()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||