|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mssm.crover.scentral.ServletCentral
Central location where the servlets can find the services they need in order to work in a smoother way inside the web server. This class provides services as a enhanced log system, a url repository that allows to move the URLs allocated to specific documents without recompiling the servlets that generate documents that reference them. ServletCentral also provides the basis for document templates (header of the pages, footer, containers to group related materials on the page). It gives access to a user directory that contains user records and allow authentified sessions. It provides a access to the PersistenceScheme implementation.
URLRepository,
UserDirectory,
PersistenceScheme| Field Summary | |
static java.lang.String |
footerBackgroundColor
|
static java.lang.String |
GUEST_LOGIN
Returned by the login prompt form as the value of the GUEST_REQUEST_SUBMIT_NAME attribute when the user pressed the guest login submit button. |
static java.lang.String |
GUEST_REQUEST_SUBMIT_NAME
Name of the submit button for the guest login action. |
static java.lang.String |
LOGIN_NAME
Name of the login input field for the login. |
static java.lang.String |
PASSWORD_NAME
Name of the login input field for the password. |
static java.lang.String |
REGISTERED_SUBMIT_NAME
Name of the submit button for the registered login action. |
static java.lang.String |
RELATIVE_REDIRECT_URL
The dest parameter for SessionLogin |
static java.lang.String |
SERVICE_MANAGER_VALUE
|
static java.lang.String |
USER_SESSION_VALUE
|
| Method Summary | |
void |
appendServiceFooter(java.lang.String webservice,
UserSession us,
org.apache.ecs.html.Body body)
Append a service dependant footer to the body. |
org.apache.ecs.html.TD |
createBodyCell(org.apache.ecs.Element body)
|
org.apache.ecs.html.TD |
createBodyCell(org.apache.ecs.Element body,
boolean wrap)
|
org.apache.ecs.html.TD |
createTitleCell(java.lang.String title)
|
org.apache.ecs.html.TD |
createTitleCell(java.lang.String title,
boolean wrap)
|
void |
destroy()
Free ressources used by this service. |
org.apache.ecs.html.Body |
getBody(org.apache.ecs.Document doc)
Returns body of a document with background and link colors set |
java.sql.Connection |
getConnection()
Obtain a connection from the pool. |
org.apache.ecs.Document |
getDefaultDocument(javax.servlet.http.HttpSession session,
java.lang.String title)
Returns a document with a title. |
org.apache.ecs.Element |
getDefaultFooter()
Returns the footer of a document. |
org.apache.ecs.Element |
getDefaultFooter(java.lang.String info1,
java.lang.String authors)
Returns the footer of a document. |
org.apache.ecs.Element |
getDefaultFooter(java.lang.String info1,
java.lang.String info2,
java.lang.String authors)
Returns the footer of a document. |
org.apache.ecs.xml.XMLDocument |
getDefaultXmlDocument(javax.servlet.http.HttpSession session,
java.lang.String title)
Deprecated. |
org.apache.ecs.Element |
getEditorContainer(java.lang.String title,
org.apache.ecs.Element content)
|
org.apache.ecs.Element |
getEditorContainer(java.lang.String title,
org.apache.ecs.Element content,
java.lang.String width)
Returns a pretty container. |
org.apache.ecs.Element |
getEditorContainer(java.lang.String title,
org.apache.ecs.Element content,
java.lang.String width,
boolean wrap)
Returns a pretty container. |
org.apache.ecs.html.Head |
getHead(javax.servlet.http.HttpSession session,
java.lang.String title)
Deprecated. Use getDefaultDocument instead |
static ServletCentral |
getInstance()
Must not be used in cases when the session might be expired! In such cases the getInstance(String requestURI) must be used! Returns the only instance of ServletCentral available in the system. |
static ServletCentral |
getInstance(javax.servlet.http.HttpServlet client)
Returns the only instance of ServletCentral available in the system (one per zone). |
java.lang.String |
getLayoutDir()
Returns the directory where the XML layouts required by RbDg are stored. |
Log |
getLog()
Returns the log system. |
org.apache.ecs.Element |
getLoginPrompt(javax.servlet.http.HttpServletResponse response,
java.lang.String login_label,
java.lang.String initial_login,
java.lang.String passwd_label,
boolean allow_guest_login,
boolean allow_login_creation,
java.lang.String action,
java.lang.String destination)
Returns an element to present the form that prompts for login. |
org.apache.ecs.html.Table |
getMetalContainer(java.lang.String title,
org.apache.ecs.Element content)
|
PersistenceScheme |
getPersistenceScheme(javax.servlet.http.HttpServletRequest request)
Returns the persistence scheme current implementation. |
UserRecord |
getRecord(java.lang.String recordID)
Returns the user record associated with this recordID. |
UserRecord |
getRecord(java.lang.String userID,
java.lang.String password)
Returns the user record associated with this userID. |
ServiceManager |
getServiceManager(javax.servlet.http.HttpServletRequest request)
Returns the ServiceManager associated with this request. |
java.lang.String |
getTitle(javax.servlet.http.HttpSession session,
java.lang.String title)
Returns a string to insert in the title of a document. |
org.apache.ecs.Element |
getTitle(java.lang.String title)
Returns the title of a document. |
URLRepository |
getURLRepository()
Returns the URL repository. |
UserDirectory |
getUserDirectory()
Returns the current user directory. |
boolean |
hasServiceManager(javax.servlet.http.HttpServletRequest request)
Returns whether there is a service manager associated with this request. |
boolean |
isRegistered(java.lang.String userID,
java.lang.String password)
Checks wether the couple (userID, password) is registered or not. |
static boolean |
isUserLoggedIn(javax.servlet.http.HttpServletRequest request)
Determines whether the user that makes the request is logged in. |
void |
log(int level,
java.lang.String message)
Log a message and an exception. |
void |
log(int level,
java.lang.String message,
java.lang.Exception e)
Logs a message and an exception. |
static void |
main(java.lang.String[] args)
Tests and demonstrates this class behaviour. |
void |
register(java.lang.String userID,
UserRecord record)
|
void |
returnConnection(java.sql.Connection con)
Returns a connection to the pool. |
void |
sendMail(UserRecord recipient,
java.lang.String subject,
java.lang.String message)
Sends an email to the user defined by a user record. |
org.apache.ecs.Element |
sideBySide(java.lang.String title_left,
org.apache.ecs.Element body_left,
java.lang.String title_right,
org.apache.ecs.Element body_right)
Layout the two elements side by side. |
org.apache.ecs.Element |
upAndDown(java.lang.String title_up,
org.apache.ecs.Element body_up,
java.lang.String title_down,
org.apache.ecs.Element body_down)
Layout the two editor elements up and down. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String footerBackgroundColor
public static final java.lang.String GUEST_LOGIN
public static final java.lang.String GUEST_REQUEST_SUBMIT_NAME
public static final java.lang.String REGISTERED_SUBMIT_NAME
public static final java.lang.String LOGIN_NAME
public static final java.lang.String PASSWORD_NAME
public static final java.lang.String RELATIVE_REDIRECT_URL
public static final java.lang.String SERVICE_MANAGER_VALUE
public static final java.lang.String USER_SESSION_VALUE
| Method Detail |
public static ServletCentral getInstance()
public java.lang.String getLayoutDir()
public java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void returnConnection(java.sql.Connection con)
public static ServletCentral getInstance(javax.servlet.http.HttpServlet client)
client - Could be any servlet which init parameter include
scentral.zone (this sets the zone for the URLRepository).public URLRepository getURLRepository()
public void log(int level,
java.lang.String message,
java.lang.Exception e)
Log
public void log(int level,
java.lang.String message)
Logpublic Log getLog()
public org.apache.ecs.Element getDefaultFooter()
public org.apache.ecs.Element getDefaultFooter(java.lang.String info1,
java.lang.String authors)
public org.apache.ecs.Element getDefaultFooter(java.lang.String info1,
java.lang.String info2,
java.lang.String authors)
public org.apache.ecs.html.Head getHead(javax.servlet.http.HttpSession session,
java.lang.String title)
public void appendServiceFooter(java.lang.String webservice,
UserSession us,
org.apache.ecs.html.Body body)
webservice - The classname of the WebService implementation
we help now. We use the classname to append the appropriate
footer to the body (appropriate footer = footer the content of which
depends on the web service we represent here).
A number of things can go wrong which are logged.
public java.lang.String getTitle(javax.servlet.http.HttpSession session,
java.lang.String title)
public org.apache.ecs.Document getDefaultDocument(javax.servlet.http.HttpSession session,
java.lang.String title)
public org.apache.ecs.xml.XMLDocument getDefaultXmlDocument(javax.servlet.http.HttpSession session,
java.lang.String title)
public org.apache.ecs.html.Body getBody(org.apache.ecs.Document doc)
public org.apache.ecs.html.Table getMetalContainer(java.lang.String title,
org.apache.ecs.Element content)
public org.apache.ecs.Element getEditorContainer(java.lang.String title,
org.apache.ecs.Element content,
java.lang.String width)
getEditorContainer(String title, Element content,
String width, boolean wrap)
public org.apache.ecs.Element getEditorContainer(java.lang.String title,
org.apache.ecs.Element content,
java.lang.String width,
boolean wrap)
wrap - When false, the cells have the nowrap attribute
(text will not be wrapper into these cells, so they will expand
their size to match the size of the content).
public org.apache.ecs.Element getEditorContainer(java.lang.String title,
org.apache.ecs.Element content)
public org.apache.ecs.Element getLoginPrompt(javax.servlet.http.HttpServletResponse response,
java.lang.String login_label,
java.lang.String initial_login,
java.lang.String passwd_label,
boolean allow_guest_login,
boolean allow_login_creation,
java.lang.String action,
java.lang.String destination)
destination - Relative URL, the dest parameter for the SessionLogin servlet.public org.apache.ecs.Element getTitle(java.lang.String title)
public org.apache.ecs.Element sideBySide(java.lang.String title_left,
org.apache.ecs.Element body_left,
java.lang.String title_right,
org.apache.ecs.Element body_right)
public org.apache.ecs.Element upAndDown(java.lang.String title_up,
org.apache.ecs.Element body_up,
java.lang.String title_down,
org.apache.ecs.Element body_down)
public org.apache.ecs.html.TD createTitleCell(java.lang.String title)
public org.apache.ecs.html.TD createTitleCell(java.lang.String title,
boolean wrap)
public org.apache.ecs.html.TD createBodyCell(org.apache.ecs.Element body)
public org.apache.ecs.html.TD createBodyCell(org.apache.ecs.Element body,
boolean wrap)
public UserRecord getRecord(java.lang.String userID,
java.lang.String password)
public UserRecord getRecord(java.lang.String recordID)
recordID - The ID for a valid record or "guest"
to get the guest record.
public boolean isRegistered(java.lang.String userID,
java.lang.String password)
public void register(java.lang.String userID,
UserRecord record)
throws BadUserID,
RegistrationFailure
BadUserID
RegistrationFailurepublic UserDirectory getUserDirectory()
public void sendMail(UserRecord recipient,
java.lang.String subject,
java.lang.String message)
sendMail in interface SimpleMailerpublic PersistenceScheme getPersistenceScheme(javax.servlet.http.HttpServletRequest request)
public static void main(java.lang.String[] args)
public void destroy()
public static boolean isUserLoggedIn(javax.servlet.http.HttpServletRequest request)
#getServicepublic ServiceManager getServiceManager(javax.servlet.http.HttpServletRequest request)
public boolean hasServiceManager(javax.servlet.http.HttpServletRequest request)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||