ca.sqlpower.architect
Class ArchitectSessionImpl

java.lang.Object
  extended by ca.sqlpower.architect.ArchitectSessionImpl
All Implemented Interfaces:
ArchitectSession, UserPrompterFactory

public class ArchitectSessionImpl
extends java.lang.Object
implements ArchitectSession

The ArchitectSession class represents a single user's session with the architect. If using the Swing UI (currently this is the only option, but that is subject to change), the ArchitectFrame has a 1:1 relationship with an ArchitectSession.

Version:
$Id: ArchitectSessionImpl.java 2491 2008-08-12 21:29:05Z jfuerth $
Author:
fuerth

Field Summary
 
Fields inherited from interface ca.sqlpower.architect.ArchitectSession
PREFS_PL_INI_PATH
 
Constructor Summary
ArchitectSessionImpl(ArchitectSessionContext context, java.lang.String name)
           
 
Method Summary
 UserPrompter createUserPrompter(java.lang.String question, java.lang.String okText, java.lang.String notOkText, java.lang.String cancelText)
          Creates a new user prompter instance with the given settings.
 ArchitectSessionContext getContext()
          Returns the context that created this session.
 DDLGenerator getDDLGenerator()
          The DDL Generator currently in use for this session.
 java.lang.String getName()
          Gets the value of name
 OLAPRootObject getOLAPRootObject()
          Returns the OLAP root object, which contains all the OLAP sessions that are part of this Architect session.
 ProfileManagerImpl getProfileManager()
           
 CoreProject getProject()
          Returns the project associated with this session.
 SQLObjectRoot getRootObject()
          Returns the top level object in the SQLObject hierarchy.
 SQLDatabase getTargetDatabase()
          Returns the database in use for this session.
 void setDDLGenerator(DDLGenerator generator)
          Sets the new DDL Generator currently in use for this session.
 void setName(java.lang.String argName)
          Sets the value of name
 void setProfileManager(ProfileManagerImpl manager)
           
 void setProject(CoreProject project)
          This method is only used to create the correct type of project for an ArchitectSwingSessionImpl and should not be called anywhere else.
 void setSourceDatabaseList(java.util.List<SQLDatabase> databases)
          Replaces the entire list of source databases for this session.
 void setUserPrompterFactory(UserPrompterFactory upFactory)
          Changes the user prompter factory in use on this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArchitectSessionImpl

public ArchitectSessionImpl(ArchitectSessionContext context,
                            java.lang.String name)
                     throws ArchitectException
Throws:
ArchitectException
Method Detail

getName

public java.lang.String getName()
Gets the value of name

Specified by:
getName in interface ArchitectSession
Returns:
the value of name

setName

public void setName(java.lang.String argName)
Sets the value of name

Specified by:
setName in interface ArchitectSession
Parameters:
argName - Value to assign to this.name

getProfileManager

public ProfileManagerImpl getProfileManager()
Specified by:
getProfileManager in interface ArchitectSession

getTargetDatabase

public SQLDatabase getTargetDatabase()
Description copied from interface: ArchitectSession
Returns the database in use for this session. In a gui session, this would be the playpen database.

Specified by:
getTargetDatabase in interface ArchitectSession

getProject

public CoreProject getProject()
Description copied from interface: ArchitectSession
Returns the project associated with this session. The project holds the playpen objects, and can save and load itself in an XML format.

Specified by:
getProject in interface ArchitectSession

setProject

public void setProject(CoreProject project)
Description copied from interface: ArchitectSession
This method is only used to create the correct type of project for an ArchitectSwingSessionImpl and should not be called anywhere else.

Specified by:
setProject in interface ArchitectSession

getRootObject

public SQLObjectRoot getRootObject()
Description copied from interface: ArchitectSession
Returns the top level object in the SQLObject hierarchy. It has no parent and its children are SQLDatabase's.

Specified by:
getRootObject in interface ArchitectSession

getContext

public ArchitectSessionContext getContext()
Description copied from interface: ArchitectSession
Returns the context that created this session.

Specified by:
getContext in interface ArchitectSession

setSourceDatabaseList

public void setSourceDatabaseList(java.util.List<SQLDatabase> databases)
                           throws ArchitectException
Description copied from interface: ArchitectSession
Replaces the entire list of source databases for this session. This method is used reflectively by the code that does loading and saving, so DON'T DELETE THIS METHOD even if it looks like it's unused.

Specified by:
setSourceDatabaseList in interface ArchitectSession
Throws:
ArchitectException

getDDLGenerator

public DDLGenerator getDDLGenerator()
Description copied from interface: ArchitectSession
The DDL Generator currently in use for this session.

Specified by:
getDDLGenerator in interface ArchitectSession

setDDLGenerator

public void setDDLGenerator(DDLGenerator generator)
Description copied from interface: ArchitectSession
Sets the new DDL Generator currently in use for this session.

Specified by:
setDDLGenerator in interface ArchitectSession

setProfileManager

public void setProfileManager(ProfileManagerImpl manager)

createUserPrompter

public UserPrompter createUserPrompter(java.lang.String question,
                                       java.lang.String okText,
                                       java.lang.String notOkText,
                                       java.lang.String cancelText)
Description copied from interface: UserPrompterFactory
Creates a new user prompter instance with the given settings. User prompter instances can be stateful (for example, an "always accept" button will cause that prompter to continue returning "OK" forever), so it is important to obtain a new user prompter from this factory for every overall operation.

Specified by:
createUserPrompter in interface ArchitectSession
Specified by:
createUserPrompter in interface UserPrompterFactory
Parameters:
question - The question the new prompter will pose when solociting a response from the user. This question string is not exactly plain text: it is formatted according to to rules laid out in the MessageFormat class. The most important implications are that the single quote (') character and the open curly brace ({) characters are special and have to be escaped in order to appear in the message. The other important thing (the benefit, that is) is that constructions of the form {0} are placeholders that will be substituted every time the question is asked via the UserPrompter.promptUser(Object[]) method is called. See MessageFormat for details.

Also, UserPrompter implementations will ensure that newline characters (\n) show up as new lines when the question is presented to the user.

okText - The text to associate with the OK response. Try to use a word or phrase from the question instead of a generic word like "OK" or "Yes".
notOkText - The text to associate with the "not OK" response. Try to use a word or phrase from the question instead of a generic word like "No".
cancelText - The text to associate with response that cancels the whole operation.

setUserPrompterFactory

public void setUserPrompterFactory(UserPrompterFactory upFactory)
Changes the user prompter factory in use on this session.

Parameters:
upFactory - The new user prompter factory to use. Must not be null.

getOLAPRootObject

public OLAPRootObject getOLAPRootObject()
Description copied from interface: ArchitectSession
Returns the OLAP root object, which contains all the OLAP sessions that are part of this Architect session.

Note: We would prefer not to let ArchitectSession reference anything in the OLAP editor, since we do not want the core Architect API to include OLAP support. We are currently trying to come up with a way to put this somewhere else.

Specified by:
getOLAPRootObject in interface ArchitectSession


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