|
jSyncManager Simple Java Server | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jSyncManager.SJS.ConnectionManager
class ConnectionManager
The ConnectionManager class. This class handles the incoming connections for a single port, and passes them off to the associated Adapter class. This class extends Runnable, in order to make it easily threadable (although it's not a requirement, which may be useful if one were to use this code to build a single-port server in the future).
| Field Summary | |
|---|---|
protected java.lang.Class |
adapterClass
A field to store the class name for the adapter class this connection manager is associated with. |
protected java.net.InetAddress |
bindAddress
A field to hold the IP address this connection manager should bind to. |
protected boolean |
listening
A field to denote whether or not this connection manager is listening to the specified port. |
protected int |
port
A field to store the TCP port to listen to for connections. |
protected java.util.Properties |
props
A field to store the properties associated with this connection manager. |
protected java.lang.String |
serviceName
A field to hold this connection managers service name. |
| Constructor Summary | |
|---|---|
ConnectionManager(org.w3c.dom.Element element)
Constructs a new instance of the ConnectionManager based on the data in the specified DOM Element. |
|
ConnectionManager(org.w3c.dom.Element element,
java.lang.ThreadGroup parentTG)
Constructs a new instance of the ConnectionManager based on the data in the specified DOM Element. |
|
ConnectionManager(java.lang.String serviceName,
java.lang.Class adapter,
java.net.InetAddress bindAddress,
int port,
java.util.Properties properties)
Constructs a new instance of the ConnectionManager for the specified adapter class and port. |
|
ConnectionManager(java.lang.String serviceName,
java.lang.Class adapter,
int port)
Constructs a new instance of the ConnectionManager for the specified adapter class and port, accepting connections from any/all adapters. |
|
ConnectionManager(java.lang.String serviceName,
java.lang.String adapter,
int port)
Constructs a new instance of the ConnectionManager for the specified adapter class and port, acceptiing connections from any/all adapters. |
|
ConnectionManager(java.lang.String serviceName,
java.lang.String adapter,
java.lang.String bindAddress,
int port,
java.util.Properties properties)
Constructs a new instance of the ConnectionManager for the specified adapter class and port. |
|
| Method Summary | |
|---|---|
void |
disconnectionAlert()
A method to inform the connection manager that a disconnection has occurred. |
java.net.SocketAddress |
getBindAddress()
Retrieves the socket address the ServerSocket is bound to. |
org.w3c.dom.Element |
getElement()
Retrieves the DOM Element that was used to create this object. |
java.lang.String |
getProperty(java.lang.String property)
Retrieves the specified property from this connection manager. |
java.lang.String |
getServiceName()
Returns this connection managers service name. |
java.lang.String |
getStatus()
Retrieves a string describing the state of this connection manager. |
boolean |
isListening()
Tests to see if this connection manager instance is listening on its port. |
void |
removeProperty(java.lang.String prop)
Removes the specified property. |
void |
run()
Runs this connection manager. |
void |
setProperty(java.lang.String property,
java.lang.String value)
Sets the specified property to the specified value. |
void |
stopListening()
Tells this connection manager to stop listening on its port. |
java.lang.String |
toString()
Returns this object as a human-readable descriptive String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Class adapterClass
protected java.net.InetAddress bindAddress
protected java.util.Properties props
protected java.lang.String serviceName
protected volatile boolean listening
protected int port
| Constructor Detail |
|---|
public ConnectionManager(java.lang.String serviceName,
java.lang.Class adapter,
java.net.InetAddress bindAddress,
int port,
java.util.Properties properties)
serviceName - the name of this service.adapter - the adapter class to use for communications.bindAddress - the address object to bind to.port - the port to listen to for incoming connections.properties - the properties to associate with this connection manager.
public ConnectionManager(java.lang.String serviceName,
java.lang.Class adapter,
int port)
serviceName - the name of this service.adapter - the adapter classname to use for communications.port - the port to listen to for incoming connections.
java.lang.ClassNotFoundException - thrown if the specified adapter class cannot be found.
public ConnectionManager(java.lang.String serviceName,
java.lang.String adapter,
java.lang.String bindAddress,
int port,
java.util.Properties properties)
throws java.lang.ClassNotFoundException,
java.net.UnknownHostException
serviceName - the name of this service.adapter - the adapter classname to use for communications.bindAddress - the address object to bind to.port - the port to listen to for incoming connections.properties - the properties to associate with this connection manager.
java.lang.ClassNotFoundException - thrown if the specified adapter class cannot be found.
java.net.UnknownHostException
public ConnectionManager(java.lang.String serviceName,
java.lang.String adapter,
int port)
throws java.lang.ClassNotFoundException
serviceName - the name of this service.adapter - the adapter classname to use for communications.port - the port to listen to for incoming connections.
java.lang.ClassNotFoundException - thrown if the specified adapter class cannot be found.
public ConnectionManager(org.w3c.dom.Element element)
throws java.lang.Exception
element - the element containing the service information.
java.lang.Exception
public ConnectionManager(org.w3c.dom.Element element,
java.lang.ThreadGroup parentTG)
throws java.lang.Exception
element - the element containing the service information.parentTG - the parent thread group for this object.
java.lang.Exception| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablepublic boolean isListening()
public void stopListening()
public java.lang.String getServiceName()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getProperty(java.lang.String property)
property - the property name to retrieve.
public void setProperty(java.lang.String property,
java.lang.String value)
property - the property to set.value - the value to set the property to.public void removeProperty(java.lang.String prop)
prop - the property to be removed.public java.net.SocketAddress getBindAddress()
public java.lang.String getStatus()
public org.w3c.dom.Element getElement()
public void disconnectionAlert()
disconnectionAlert in interface ConnectionManagerInterface
|
jSyncManager Simple Java Server | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||