|
||||||||||
| 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.WabitServerSession
public class WabitServerSession
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 | |
|---|---|
WabitServerSession(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(WabitServerInfo serviceInfo)
|
static WorkspaceLocation |
createNewServerSession(WabitServerInfo serviceInfo)
Sends an HTTP request to a Wabit Enterprise Server to create a new remote Wabit Workspace on that server. |
void |
deleteServerWorkspace()
|
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> |
getDataSources()
Retrieves the data source list from the server. |
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(WabitServerInfo 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 WabitServerSession |
openServerSession(WabitSessionContext context,
WorkspaceLocation workspaceLoc)
Finds and opens a specific Wabit Workspace from the given WorkspaceLocation. |
static java.util.List<WabitServerSession> |
openServerSessions(WabitSessionContext context,
WabitServerInfo serverInfo)
Finds and opens all visible Wabit workspaces on the given Wabit Enterprise Server. |
void |
persistWorkspaceToServer()
|
void |
runInForeground(java.lang.Runnable runner)
This will force the given runnable to execute in the 'foreground'. |
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 WabitServerSession(@Nonnull
WorkspaceLocation workspaceLocation,
@Nonnull
WabitSessionContext context)
| Method Detail |
|---|
public static org.apache.http.client.HttpClient createHttpClient(WabitServerInfo 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(WabitServerInfo serviceInfo)
throws java.io.IOException,
java.net.URISyntaxException,
JSONException
serviceInfo -
java.io.IOException
java.net.URISyntaxException
JSONException
public static WorkspaceLocation createNewServerSession(WabitServerInfo serviceInfo)
throws java.net.URISyntaxException,
org.apache.http.client.ClientProtocolException,
java.io.IOException,
JSONException
serviceInfo - A WabitServerInfo 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 WabitServerSession 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<WabitServerSession> openServerSessions(WabitSessionContext context,
WabitServerInfo 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 WabitPersistenceException
WabitPersistenceExceptionpublic WabitWorkspace getSystemWorkspace()
getSystemWorkspace in interface WabitSessiongetSystemWorkspace in class WabitSessionImplpublic void runInForeground(java.lang.Runnable runner)
WabitSessionIn 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
runInForeground in interface WabitSessionrunInForeground in class WabitSessionImplrunner - The runnable to run in the foreground.public boolean isEnterpriseServerSession()
WabitSession
isEnterpriseServerSession in interface WabitSessionisEnterpriseServerSession in class WabitSessionImpl
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||