|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--amber.server.application.ApplicationHandler
This class handles the requirements for the manipulation of the pages. This is the overall intelligence for this particular page.
ApplicationHandler, Serialized Form| Field Summary | |
protected java.net.Socket |
connection
Handle to the socket connection to the remote browser. |
protected EventThread |
eventHandler
The thread handling reception of event packets from the remote components. |
protected java.io.InputStream |
input
Handle to the socket connection input stream. |
protected Log |
loggingFile
Logging file, set by the server. |
protected java.io.OutputStream |
output
Handle to the socket connection output stream. |
protected HandlePacketThread |
packetHandler
The thread handling transmission of packets from the remote component to the corresponding server component. |
protected int |
pageId
Numeric identifier for this specific instance of Page. |
protected int |
pageSubId
2nd Numeric identifier for this specific instance of Page. |
protected CoreInterface |
parentServer
The original server which started this ApplicationHandler. |
protected java.util.Vector |
receivedPackets
Vector which holds pending incoming packets. |
protected ReceiveThread |
receiver
The thread handling reception of packets from the remote components. |
protected SendThread |
sender
The thread handling transmission of packets to the remote components. |
protected java.lang.String |
sessionInfo
String which is defined by the server. |
protected Mutex |
waitForClientShutDown
Lock when waiting for the client shutdown response packet. |
protected Mutex |
waitForPacket
Lock when waiting for incoming packets. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ApplicationHandler()
Default constructor. |
|
ApplicationHandler(int pageIdentifier,
int pageSubIdentifier)
Initialising constructor. |
|
ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.net.Socket newConnection)
The initialising constructor. |
|
ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.net.Socket newConnection,
java.util.Vector components)
The initialising constructor. |
|
ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.util.Vector components)
The initialising constructor. |
|
| Method Summary | |
protected void |
activateChildren(boolean state)
Activates/deactivates all the clildren of this application. |
void |
add(ComponentHandler newComponent,
java.lang.Object constraints)
This function adds a specified component to this application. |
void |
addComponent(ComponentHandler newComponent)
Deprecated. This function is now replaced by add for consistency with standard Java. |
PanelComponentInfo |
addComponent(ComponentHandler newComponent,
int eventMask,
int x,
int y,
int width,
int height)
Deprecated. This function is now replaced by add for consistency with standard Java. |
void |
addInPostPacketListener(PacketListener l)
|
void |
addInPrePacketListener(PacketListener l)
|
void |
addOutPostPacketListener(PacketListener l)
|
void |
addOutPrePacketListener(PacketListener l)
|
void |
addReceivedPacket(Packet packet)
Called by the ReceiveThread when a packet has been received. |
protected void |
computeMaximumDimensions()
This function works out the maximum size of the application required to hold all the current controls. |
protected abstract void |
defineComponents()
Component Set up function. |
void |
directPacket(Packet packet)
Called by the ReceiveThread when a packet has been received. |
protected void |
encodeComponentState(AmberOutputStream dataEncoder)
This function encodes the basic state of the components understood by the application. |
protected boolean |
fireInPostPacketPerformed(Packet p)
|
protected boolean |
fireInPrePacketPerformed(Packet p)
|
protected boolean |
fireOutPostPacketPerformed(Packet p)
|
protected boolean |
fireOutPrePacketPerformed(Packet p)
|
void |
forwardEventPacket(Packet packet)
Called by the EventThread when a packet has been received. |
java.awt.Dimension |
getClientScreenSize()
This function returns the physical screen dimensions of the client screen. |
java.util.Vector |
getComponents()
Returns the component vector. |
java.net.Socket |
getConnection()
Returns the socket connection associated with this application. |
Log |
getLog()
Returns the Log object. |
ApplicationInterface |
getModalObject()
Returns the current object which is receiving all input packets. |
int |
getPageId()
Gets the unique ID for this instance of the page. |
int |
getPageSubId()
Gets the unique ID for this instance of the page. |
CoreInterface |
getParentServer()
Returns the original server which started this ApplicationHandler. |
PropertiesHandler |
getRemoteProperties()
This function returns the remote properties of the client. |
java.lang.String |
getSessionId()
Returns the unique identifier which is used to specify which session this application is associated with. |
int |
getValidId()
This function allocates a valid unused ID from a pool of ID's held within the Application. |
protected boolean |
isAlreadyCreated(ComponentHandler component,
java.util.Vector groups)
This function checks to see if the component has already been created. |
boolean |
isConnected()
This function returns the state of the application handler. |
boolean |
isMyPageId(int id)
Checks that the unique ID passed to this page is handled by this ApplicationHandler. |
boolean |
isMyPageId(int id,
int subId)
Checks that the unique IDs passed to this page is handled by this ApplicationHandler. |
void |
logComponentStructure()
This function dumps all the components that this page recognises. |
protected void |
processApplicationPacket(Packet packet)
|
void |
remove(ComponentHandler component)
This function removes the specified component to this application. |
void |
removeInPostPacketListener(PacketListener l)
This function removes an input post packet listener. |
void |
removeInPrePacketListener(PacketListener l)
This function removes an input pre packet listener. |
void |
removeOutPostPacketListener(PacketListener l)
This function removes an output post packet listener. |
void |
removeOutPrePacketListener(PacketListener l)
This function removes an output pre packet listener. |
void |
restart(java.net.Socket newConnection)
This function restarts the functioning of the ApplicationInterface. |
void |
run()
Main run function. |
void |
sendPacket(Packet packet)
Writes a packet to the output stream. |
void |
sendReconnectionState()
This function sends the session reconnection message which tells the client the reconnection was successful. |
void |
sendSessionInitialisationState()
This function sends the session initialisation which is stored in the master applet system. |
void |
setClientScreenSize(java.awt.Dimension screenSize)
This function sets the physical screen dimensions of the client screen. |
void |
setComponents(java.util.Vector newComponents)
Overrides the component vector. |
void |
setConnectedState(boolean state)
This function will force the application to go active/inactive. |
void |
setInitialValidId(int baseId)
This function sets the allocator ID so that the ID's will offset from a different value. |
void |
setLog(Log logFile)
Sets the Log for this ApplicationHandler. |
void |
setModalObject(ApplicationInterface object)
Sets the current object which is to receive all input packets. |
void |
setPageId(int newPageId)
Sets the unique ID for this instance of the page. |
void |
setPageSubId(int newPageId)
Sets the unique ID for this instance of the page. |
void |
setParentServer(CoreInterface server)
Sets the original server which started this ApplicationHandler. |
void |
setRemoteProperties(PropertiesHandler properties)
This function sets the remote properties of the client. |
void |
setSize(int width,
int height)
This sets the physical size of the required area to hold the entire application in the HTML page. |
void |
setUpComponent(ComponentHandler newComponent)
Deprecated. This function is now replaced by add for consistency with standard Java. |
PanelComponentInfo |
setUpComponent(ComponentHandler newComponent,
int eventMask,
int x,
int y,
int width,
int height)
Deprecated. This function is now replaced by add for consistency with standard Java. |
void |
shutDown()
This function attempts to shut down the page handler gracefully. |
void |
shutDownClient()
This function will force the client to shut down. |
void |
shutDownClient(java.lang.String message)
This function will force the client to shut down. |
protected boolean |
specialPacket(Packet packet)
This function checks the packet. |
void |
start()
This function initiates the functioning of the ApplicationHandler. |
void |
start(java.net.Socket newConnection)
This function initiates the functioning of the ApplicationHandler. |
protected void |
terminateThreads(boolean destroyThreads)
Terminates the messaging threads. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int pageId
protected int pageSubId
protected java.net.Socket connection
protected java.io.InputStream input
protected java.io.OutputStream output
protected ReceiveThread receiver
protected SendThread sender
protected EventThread eventHandler
protected HandlePacketThread packetHandler
protected java.util.Vector receivedPackets
protected Mutex waitForPacket
protected Mutex waitForClientShutDown
protected Log loggingFile
protected java.lang.String sessionInfo
protected CoreInterface parentServer
| Constructor Detail |
public ApplicationHandler()
throws java.io.IOException
public ApplicationHandler(int pageIdentifier,
int pageSubIdentifier)
throws java.io.IOException
pageIdentifier - An int uniquely identifying this instance of page.pageSubIdentifier - An int used for extra information.
public ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.util.Vector components)
throws java.io.IOException
pageIdentifier - An int uniquely identifying this instance of page.pageSubIdentifier - An int used for extra information.components - A Vector containing all the active components in use.
public ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.net.Socket newConnection)
throws java.io.IOException
pageIdentifier - An int uniquely identifying this instance of page.pageSubIdentifier - An int used for extra information.newConnection - The Socket which is connected to the page in operation.
public ApplicationHandler(int pageIdentifier,
int pageSubIdentifier,
java.net.Socket newConnection,
java.util.Vector components)
throws java.io.IOException
pageIdentifier - An int uniquely identifying this instance of page.pageSubIdentifier - An int used for extra information.newConnection - The Socket which is connected to the page in operation.components - A Vector containing all the active components in use.| Method Detail |
public void forwardEventPacket(Packet packet)
throws ApplicationHandlerException
forwardEventPacket in interface ApplicationInterfacepacket - Packet to forward to the specified component.
public void directPacket(Packet packet)
throws ApplicationHandlerException
directPacket in interface ApplicationInterfacepacket - Packet to forward to the specified component.protected boolean specialPacket(Packet packet)
packet - Packet sent to the application.protected void processApplicationPacket(Packet packet)
public void sendPacket(Packet packet)
throws ApplicationHandlerException
sendPacket in interface ApplicationInterfacepacket - Packet which will be written to the remote browser.amber.server.applicationException - containing error information
public void add(ComponentHandler newComponent,
java.lang.Object constraints)
newComponent - ComponentHandler for the created component.constraints - Object containing the constraints defining where the
component will be placed in the application screen.public void remove(ComponentHandler component)
component - ComponentHandler of the component to remove.public void addComponent(ComponentHandler newComponent)
newComponent - ComponentHandler for the new component.
public PanelComponentInfo addComponent(ComponentHandler newComponent,
int eventMask,
int x,
int y,
int width,
int height)
newComponent - ComponentHandler for the created component.eventMask - int containing the event mask.x - int x coordinate of top left point of component in page.y - int y coordinate of top left point of component in page.width - int width of component in panel.height - int height of component in panel.public void setUpComponent(ComponentHandler newComponent)
newComponent - ComponentHandler for the new component.
public PanelComponentInfo setUpComponent(ComponentHandler newComponent,
int eventMask,
int x,
int y,
int width,
int height)
newComponent - ComponentHandler for the created component.eventMask - int containing the event mask.x - int x coordinate of top left point of component in page.y - int y coordinate of top left point of component in page.width - int width of component in panel.height - int height of component in panel.public void setComponents(java.util.Vector newComponents)
newComponents - Vector which contains the new components.public java.util.Vector getComponents()
public java.net.Socket getConnection()
public boolean isConnected()
isConnected in interface ApplicationInterface
public void start(java.net.Socket newConnection)
throws java.lang.IllegalThreadStateException
start in interface ApplicationInterfacenewConnection - The Socket which is connected to the page in operation. If null uses the connection already set.java.lang.IllegalThreadStateException - containing any problems.
public void restart(java.net.Socket newConnection)
throws java.lang.IllegalThreadStateException
restart in interface ApplicationInterfacenewConnection - The Socket which is connected to the page in operation. If null uses the connection already set.java.lang.IllegalThreadStateException - containing any problems.
public void start()
throws java.lang.IllegalThreadStateException
start in class java.lang.Threadjava.lang.IllegalThreadStateException - containing any problems.public void sendSessionInitialisationState()
public void sendReconnectionState()
protected void computeMaximumDimensions()
protected void encodeComponentState(AmberOutputStream dataEncoder)
throws java.io.IOException
dataEncoder - AmberOutputStream to encode with this information.java.io.IOException - if the encoding fails.
protected boolean isAlreadyCreated(ComponentHandler component,
java.util.Vector groups)
component - ComponentHandler to check.groups - Vector containing current PanelTemplateGroupspublic void run()
run in class java.lang.Threadpublic void addReceivedPacket(Packet packet)
addReceivedPacket in interface ApplicationInterfacepacket - Packet to forward to the specified component.public void setPageId(int newPageId)
newPageId - int containing the new page identifier.public void setClientScreenSize(java.awt.Dimension screenSize)
screenSize - Dimension containing the client screen dimensions.public java.awt.Dimension getClientScreenSize()
public void setRemoteProperties(PropertiesHandler properties)
properties - PropertiesHandler with the remote properties.public PropertiesHandler getRemoteProperties()
public int getPageId()
public void setPageSubId(int newPageId)
newPageId - int containing the new page identifier.public int getPageSubId()
public boolean isMyPageId(int id)
id - int page handler ID.
public boolean isMyPageId(int id,
int subId)
id - int page handler ID.subId - int page handler Sub ID.
public int getValidId()
throws ApplicationHandlerException
getValidId in interface ApplicationInterfaceApplicationHandlerException - should
the component ID overflow the maximum allowed.public void setInitialValidId(int baseId)
baseId - int containing the first valid ID to allocate on next
request.public CoreInterface getParentServer()
getParentServer in interface ApplicationInterfacepublic void setParentServer(CoreInterface server)
setParentServer in interface ApplicationInterfaceserver - CoreInterface which is the parent server.public Log getLog()
getLog in interface ApplicationInterfacepublic void setLog(Log logFile)
setLog in interface ApplicationInterfacelogFile - Log object for logging.public void logComponentStructure()
public void setConnectedState(boolean state)
setConnectedState in interface ApplicationInterfacepublic java.lang.String getSessionId()
protected void activateChildren(boolean state)
state - boolean state to set. true is activate children.protected void terminateThreads(boolean destroyThreads)
destroyThreads - boolean flag when true the threads are also
destroyed.public void shutDown()
shutDown in interface ApplicationInterface
public void setSize(int width,
int height)
width - int width of the application.height - int height of the application.public ApplicationInterface getModalObject()
getModalObject in interface ApplicationInterfacepublic void setModalObject(ApplicationInterface object)
setModalObject in interface ApplicationInterfaceobject - ApplicationInterface which is the modal object.
public void shutDownClient()
throws ApplicationHandlerException
shutDownClient in interface ApplicationInterfaceApplicationHandlerException - should
there be a messaging error.
public void shutDownClient(java.lang.String message)
throws ApplicationHandlerException
shutDownClient in interface ApplicationInterfacemessage - String optional message which the client will display
in a message box when the client is closed. A null value sends no
message and silently shuts down the client.ApplicationHandlerException - should
there be a messaging error.public void removeInPrePacketListener(PacketListener l)
public void addInPrePacketListener(PacketListener l)
protected boolean fireInPrePacketPerformed(Packet p)
public void removeOutPrePacketListener(PacketListener l)
public void addOutPrePacketListener(PacketListener l)
protected boolean fireOutPrePacketPerformed(Packet p)
public void removeInPostPacketListener(PacketListener l)
public void addInPostPacketListener(PacketListener l)
protected boolean fireInPostPacketPerformed(Packet p)
public void removeOutPostPacketListener(PacketListener l)
public void addOutPostPacketListener(PacketListener l)
protected boolean fireOutPostPacketPerformed(Packet p)
protected abstract void defineComponents()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||