|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--amber.server.manager.application.ApplicationManager
This class handles multiple ConnectionController classes. This allows multiple types of connections to be handled in a normalised manner. The class contains multiple different profiles of connections which reflect the type of connection ie. normal, secure, administration. The class instantiates one connection controller for each type of connection and passes the connection information to the correct controller.
Core,
ListenerThread,
ConnectionManager| Field Summary | |
protected AmberInputStream |
dataDecoder
The data decoding data stream that is used by all components to send information. |
protected AmberOutputStream |
dataEncoder
|
protected java.io.ByteArrayOutputStream |
encoderBytes
The data encoding data stream that is used by all components to send information. |
| Constructor Summary | |
ApplicationManager()
Default constructor |
|
ApplicationManager(Core parentServer,
int port,
DatabaseManager manager,
ConnectionPool connectionPool,
PropertiesHandler properties,
Log logFile)
Initialising constructor for this manager. |
|
| Method Summary | |
void |
addActiveConnection(ServerConnectionInfo handler,
int type)
This function adds the input ServerConnectionInfo into the list of active connections. |
void |
addApplicationHandler(ServerConnectionInfo handler,
int type)
This function adds the specified ServerConnectionInfo to the manager. |
void |
addToCache(ServerConnectionInfo info,
int type)
This function adds a cache connection entry to the specified controller. |
void |
addToCache(java.util.Vector items,
int type)
This function adds multiple cache connection entries to the specified controller. |
ServerConnectionInfo |
checkLicense(int pageId,
int pageSubId,
int type)
Checks license conditions. |
protected void |
connectApplication(java.net.Socket socket,
Packet initPacket,
AmberInputStream dataDecoder,
int type)
This function handles the connection requirements for the specified incoming connection. |
protected void |
connectBrowser(java.net.Socket socket,
Packet initPacket,
AmberInputStream dataDecoder,
int type)
This function handles the connection requirements for the specified incoming connection. |
protected void |
createControllers()
This function starts the socket listener threads. |
protected AmberInputStream |
createDataInput(Packet packet)
This function creates a data input stream from the data in the packet. |
ServerConnectionInfo |
findHandler(int pageId,
int pageSubId,
int type)
Checks the system available handlers to determine if there is a matching ApplicationHandler. |
ServerConnectionInfo |
findInactiveHandler(java.lang.String sessionId,
int type)
Checks the system available inactive handlers to determine if there is a matching ApplicationHandler. |
java.util.Vector |
getActiveApplicationHandlers(int type)
This returns a Vector of all active ApplicationHandlers in the manager. |
java.util.Vector |
getAllApplicationHandlers(int type)
This returns a Vector of all ApplicationHandlers in the manager. |
ConnectionPool |
getConnectionPool()
Returns the current connection pool for the amber server. |
ApplicationController |
getController(int type)
Returns the controller which matches the specified type. |
DatabaseManager |
getDatabaseManager()
Returns the current database manager. |
protected AmberInputStream |
getDataInput()
This function returns the current data input stream. |
java.util.Vector |
getInactiveApplicationHandlers(int type)
This returns a Vector of all inactive ApplicationHandlers in the manager. |
Log |
getLogger()
This function returns the logging object. |
Core |
getParentServer()
Returns the parent server object for this manager. |
java.util.Vector |
getPendingApplicationHandlers(int type)
This returns a Vector of all pending ApplicationHandlers in the manager. |
protected java.lang.String |
getTableName(int type)
Returns the table name corresponding to the type of connection received. |
void |
handleNewConnection(java.net.Socket socket,
Packet initPacket,
int systemType,
int type)
This function matches the incomimg packet to the corresponding page handler in the pendingPages variable. |
void |
init(Core parentServer,
int port,
DatabaseManager manager,
ConnectionPool connectionPool,
PropertiesHandler properties,
Log logFile)
This function is used to initialise the handler. |
boolean |
isDatabaseAvailable()
This function returns whether the database is available for use. |
void |
reactivateConnection(ServerConnectionInfo handler,
int type)
This function takes the specified ServerConnectionInfo from the list of inactive connections and places it back on the list of active connections. |
void |
removeAllPendingApplicationHandlers(int type)
This function removes all pending ApplicationHandlers in the manager. |
void |
removeApplicationHandler(ApplicationHandler handler)
This function removes the specified ApplicationHandler from the manager. |
void |
removeApplicationHandler(ApplicationHandler handler,
boolean callShutDown)
This function removes the specified ApplicationHandler from the manager. |
void |
removeApplicationHandler(int pageId,
int pageSubId,
int type)
This function removes the specified ApplicationHandler from the manager. |
void |
setApplicationInactive(ApplicationHandler handler)
This function tells the controller to set the specified ApplicationHandler as inactive. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected AmberInputStream dataDecoder
protected java.io.ByteArrayOutputStream encoderBytes
protected AmberOutputStream dataEncoder
| Constructor Detail |
public ApplicationManager()
public ApplicationManager(Core parentServer,
int port,
DatabaseManager manager,
ConnectionPool connectionPool,
PropertiesHandler properties,
Log logFile)
| Method Detail |
public void init(Core parentServer,
int port,
DatabaseManager manager,
ConnectionPool connectionPool,
PropertiesHandler properties,
Log logFile)
init in interface ConnectionHandlerparentServer - Core base server object.port - The port number to use for incoming normal connections.securePort - The port number to use for incoming secure connections.adminPort - The port number to use for incoming administration connections.manager - Database manager class which handles database requirements.connectionPool - The connection pool object which relates to the amber database tables.properties - PropertiesHandler for the server properties file.logFile - Log object which is used to log messages.
public void handleNewConnection(java.net.Socket socket,
Packet initPacket,
int systemType,
int type)
throws java.io.IOException,
ApplicationException
handleNewConnection in interface ConnectionHandlersocket - Socket of the incoming connection.initPacket - The Packet which is first sent by the page when the connection is opened.systemType - The type of remote system which is attempting to connect.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.java.io.IOException - containing decoding errors.ApplicationException - containing application errors.
public void addActiveConnection(ServerConnectionInfo handler,
int type)
handler - ServerConnectionInfo containing the details on the new
connection.
int type. The type of connection to look for a corresponding application
for. The types must match the constants in ListenerThread.
connection.
public void reactivateConnection(ServerConnectionInfo handler,
int type)
handler - ServerConnectionInfo containing the details on the
connection being reactivated.
int type. The type of connection to look for a corresponding application
for. The types must match the constants in ListenerThread.
connection.
public ServerConnectionInfo findHandler(int pageId,
int pageSubId,
int type)
public ServerConnectionInfo findInactiveHandler(java.lang.String sessionId,
int type)
public ServerConnectionInfo checkLicense(int pageId,
int pageSubId,
int type)
throws java.io.IOException
protected java.lang.String getTableName(int type)
protected void connectBrowser(java.net.Socket socket,
Packet initPacket,
AmberInputStream dataDecoder,
int type)
throws java.io.IOException
socket - Socket of the incoming connection.initPacket - The Packet which is first sent by the page when the connection is opened.dataDecoder - AmberInputStream with the packet parameters.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.java.io.IOException - containing decoding errors.
protected void connectApplication(java.net.Socket socket,
Packet initPacket,
AmberInputStream dataDecoder,
int type)
throws java.io.IOException
socket - Socket of the incoming connection.initPacket - The Packet which is first sent by the page when the connection is opened.dataDecoder - AmberInputStream with the packet parameters.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.java.io.IOException - containing decoding errors.public ApplicationController getController(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.
public void addToCache(java.util.Vector items,
int type)
items - Vector of ServerConnectionInfo containing the information to cache.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.
public void addToCache(ServerConnectionInfo info,
int type)
info - ServerConnectionInfo containing the information of the connection
to cache.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public void removeAllPendingApplicationHandlers(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.
public void addApplicationHandler(ServerConnectionInfo handler,
int type)
throws ManagerException
handler - ServerConnectionInfo handle of the page to add.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.ManagerException - containing any errors.public void removeApplicationHandler(ApplicationHandler handler)
handler - ApplicationHandler handle of the page to remove.
public void removeApplicationHandler(ApplicationHandler handler,
boolean callShutDown)
handler - ApplicationHandler handle of the page to remove.callShutDown - boolean true if the shut down function on the ApplicationHandler
is to be called first.
public void removeApplicationHandler(int pageId,
int pageSubId,
int type)
pageId - int containing the Page identifier of the page to terminate.pageSubId - int containing the Page Sub identifier of the page to terminate.type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public void setApplicationInactive(ApplicationHandler handler)
handler - ApplicationHandler handle of the page to set inactive.ApplicationController.setApplicationInactive(amber.server.application.ApplicationHandler)public java.util.Vector getActiveApplicationHandlers(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public java.util.Vector getInactiveApplicationHandlers(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public java.util.Vector getPendingApplicationHandlers(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public java.util.Vector getAllApplicationHandlers(int type)
type - The type of connection that is attempting to match the packet.
This matches the constants in ListenerThread.public boolean isDatabaseAvailable()
public DatabaseManager getDatabaseManager()
public ConnectionPool getConnectionPool()
public Core getParentServer()
public Log getLogger()
protected void createControllers()
protected AmberInputStream createDataInput(Packet packet)
packet - Packet containing the data to decode.protected AmberInputStream getDataInput()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||