public class ServerImpl extends HandleChain implements Server, AsyncRequestCountAttribute, FirstLastProcedureAttribute, SslServerAttribute, SubTypeAttribute, ConnectableServer, SessionListener, AsyncRequestListener
Modifier and Type | Class and Description |
---|---|
private class |
ServerImpl.AsyncInvoker
Provides a mechanism of performing asynchronous requests, by hiding the operating state of
this server (State-free or State-managed).
|
private class |
ServerImpl.SessionFreeInvoker
Asynchronous invoker implementation for Session-free operating mode.
|
private class |
ServerImpl.SessionManagedInvoker
Asynchronous invoker implementation for Session-managed operating mode.
|
Modifier and Type | Field and Description |
---|---|
private long |
asyncRequestCount
Count the number of active async requests.
|
private java.lang.Thread |
cancelReqTimer
The currently active timer thread which will cancel the async requests.
|
private ProxyProcedureWrapper |
firstProcedure
The first procedure in this server's proxy procedure list.
|
private ServerHelper |
helper
The server helper for this server, set after the
connect(java.lang.String) method is called. |
private ServerImpl.AsyncInvoker |
invoker
An special instance used to perform async request.
|
private ProxyProcedureWrapper |
lastProcedure
The last procedure in this server's proxy procedure list.
|
private boolean |
valid
Flag indicating if the server is valid.
|
name, nextSibling, prevSibling
instProc
Constructor and Description |
---|
ServerImpl()
Default constructor which initializes Server specific settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
_connected()
Method declaration for the CONNECTED() method, supported by web-services and server handles.
|
logical |
cancelRequests()
Cancel all running or queued requests.
|
logical |
cancelRequestsAfter(int64 timeSec)
Calls the
cancelRequests() method when the specified number of seconds have passed. |
logical |
cancelRequestsAfter(integer timeSec)
Calls the
cancelRequests() method when the specified number of seconds have passed. |
logical |
cancelRequestsAfter(long timeSec)
Calls the
cancelRequests() method when the specified number of seconds have passed;
if another timer exists for this server, it will be terminated and a new timer will start. |
logical |
connect(character options)
Method declaration for the CONNECT() procedure supported by web-services and server handles.
|
logical |
connect(character options,
character user)
Method declaration for the CONNECT() procedure supported by web-services and server handles.
|
logical |
connect(character options,
character user,
character pwd)
Method declaration for the CONNECT() procedure supported by web-services and server handles.
|
logical |
connect(character options,
character user,
character pwd,
character serverInfo)
Method declaration for the CONNECT() procedure supported by web-services and server handles.
|
logical |
connect(java.lang.String options)
Method declaration for the CONNECT() procedure supported by web-services and server handles.
|
logical |
connected()
Method declaration for the CONNECTED() method, supported by web-services and server handles.
|
private boolean |
connectToAppServer(java.util.Map<java.lang.String,java.lang.String> parms,
character user,
character pwd,
character serverInfo)
Connect to an appserver using the specified parameters.
|
private boolean |
connectToWebService(java.util.Map<java.lang.String,java.lang.String> parms)
Connect to a web service, using the specified parameters.
|
logical |
disconnect()
Method declaration for the DISCONNECT() method supported by web-services and server handles.
|
private logical |
disconnectImpl(boolean disconnecting)
Method declaration for the DISCONNECT() method supported by web-services and server handles.
|
handle |
firstProcedure()
Returns the first entry in the list of persistent procedures or procedure objects.
|
private ServerImpl.AsyncInvoker |
getAsyncInvoker()
Get the
asynchronous invoker for this server; if invoker is null,
it will create a ServerImpl.SessionManagedInvoker if the server is in the Session-managed
operating mode or a ServerImpl.SessionFreeInvoker if the server is in the Session-free
operating mode. |
integer |
getAsyncRequestCount()
Returns the number of asynchronous requests.
|
character |
getClientConnectionId()
This returns the id for the AppServer connection to this handle.
|
handle |
getFirstAsyncRequest()
Returns a handle to the first asynchronous requests in the AppServer or WebService list of
asynchronous requests.
|
handle |
getLastAsyncRequest()
Returns a handle to the last asynchronous requests in the AppServer or WebService list of
asynchronous requests.
|
(package private) ServerHelper |
getServerHelper()
Get the
helper for this server resource. |
character |
getSslServerName()
Java implementation for getting the SSL-SERVER-NAME attribute which contains the SSL
server name if the connection is made as SSL.
|
character |
getSubType()
Returns the subtype of the handle.
|
(package private) boolean |
hasAsyncRequests()
Check if the server has running async requests.
|
void |
initialize(Session session)
This method is called when the session is starting, just after the context was created.
|
void |
invokeAsync(AsyncRequestImpl request)
Invoke the given request on this server.
|
static boolean |
isServer(handle h)
Check if the given handle refers a server resource.
|
(package private) boolean |
isWebService()
Check if this server is connected to a web-service.
|
handle |
lastProcedure()
Returns the first entry in the list of persistent procedures or procedure objects.
|
void |
notifyFinish()
Notification that a remote procedure invoked via this server is finished.
|
void |
notifyStart()
Notification that a remote procedure is invoked via this server.
|
private java.util.Map<java.lang.String,java.lang.String> |
parseOptions(character options)
Parse and validate the given options; a map is returned with each parameters's value.
|
protected boolean |
resourceDelete()
Delete the resource.
|
(package private) void |
setFirstProcedure(ProxyProcedureWrapper proc)
Set the first proxy procedure of this server's chain.
|
(package private) void |
setLastProcedure(ProxyProcedureWrapper proc)
Set the last proxy procedure of this server's chain.
|
void |
setSubType(character value)
Sets the the subtype of the object.
|
void |
setSubType(java.lang.String value)
Sets the the subtype of the object.
|
void |
terminate(Session session)
This method is called when the session is ending.
|
boolean |
valid()
Reports if this object is valid for use (has not been deleted).
|
delete, firstResource, firstResource, getHead, getNextSibling, getNextSibling, getPrevSibling, getPrevSibling, getPrivateData, getTail, hasName, hasNameReadOnly, hasNextSibling, hasParent, hasPrevSibling, hasPrivateData, interlink, isChained, lastResource, lastResource, name, name, name, readOnlyError, setHead, setNextSibling, setNextSibling, setPrevSibling, setPrevSibling, setPrivateData, setPrivateData, setPrivateData
getResourceType, id, id, implicitDeletion, instantiatingProcedure, invalidAttribute, setInstantiatingProcedure, type, unknown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNextSibling, getPrevSibling, getPrivateData, setPrivateData, setPrivateData
getResourceType, readOnlyError
id, id, unknown
private ServerHelper helper
connect(java.lang.String)
method is called.private ProxyProcedureWrapper firstProcedure
private ProxyProcedureWrapper lastProcedure
private boolean valid
private long asyncRequestCount
private java.lang.Thread cancelReqTimer
null
if no timer is active.private ServerImpl.AsyncInvoker invoker
public ServerImpl()
public static boolean isServer(handle h)
h
- true
if the handle's resource is a server
.public void invokeAsync(AsyncRequestImpl request)
request
- The async request to be executed.public boolean valid()
valid
in interface WrappedResource
true
if we are valid (can be used).public integer getAsyncRequestCount()
getAsyncRequestCount
in interface AsyncRequestCountAttribute
public character getSubType()
For SERVER handles this represents the type of server to which this is connected. The possible values are "APPSERVER" and "WEBSERVICE".
getSubType
in interface SubTypeAttribute
public void setSubType(character value)
setSubType
in interface SubTypeAttribute
value
- The new value of the subtype object attribute.public void setSubType(java.lang.String value)
setSubType
in interface SubTypeAttribute
value
- The new value of the subtype object attribute.public character getSslServerName()
getSslServerName
in interface SslServerAttribute
public handle firstProcedure()
firstProcedure
in interface FirstLastProcedureAttribute
public handle lastProcedure()
lastProcedure
in interface FirstLastProcedureAttribute
public character getClientConnectionId()
getClientConnectionId
in interface Server
public handle getFirstAsyncRequest()
getFirstAsyncRequest
in interface Server
public handle getLastAsyncRequest()
getLastAsyncRequest
in interface Server
public logical cancelRequests()
cancelRequests
in interface Server
true
if CANCEL-REQUESTS() method returns true
,
false
otherwise.public logical cancelRequestsAfter(integer timeSec)
cancelRequests()
method when the specified number of seconds have passed.cancelRequestsAfter
in interface Server
timeSec
- The time in seconds after the cancelRequests()
method will be called. 4GL
allows only integer or int64 values for this parameter.false
if timer cannot be set or cancelRequests()
's result
otherwisepublic logical cancelRequestsAfter(int64 timeSec)
cancelRequests()
method when the specified number of seconds have passed.cancelRequestsAfter
in interface Server
timeSec
- The time in seconds after the cancelRequests()
method will be called. 4GL
allows only integer or int64 values for this parameter.false
if timer cannot be set or cancelRequests()
's result
otherwisepublic logical cancelRequestsAfter(long timeSec)
cancelRequests()
method when the specified number of seconds have passed;
if another timer exists for this server, it will be terminated and a new timer will start.
If timeSec
is zero or negative, then the current timer
will be stopped.
cancelRequestsAfter
in interface Server
timeSec
- The time in seconds after the cancelRequests()
method will be called. 4GL
allows only integer or int64 values for this parameter.false
if timer cannot be set or cancelRequests()
's result
otherwisepublic logical connect(java.lang.String options)
connect
in interface Connectable
options
- The set of parameters to establish the connection. 4GL allows only
character
values for this parameter.true
if connection succeeded, or false
otherwisepublic logical connect(character options)
connect
in interface Connectable
options
- The set of parameters to establish the connection. 4GL allows only
character values for this parameter.true
if connection succeeded, or false
otherwisepublic logical connect(character options, character user)
connect
in interface ConnectableServer
options
- The set of parameters to establish the connection. 4GL allows only
character values for this parameter.user
- The user to send to the CONNECT procedure on the appserver side.true
if connection succeeded, or false
otherwisepublic logical connect(character options, character user, character pwd)
connect
in interface ConnectableServer
options
- The set of parameters to establish the connection. 4GL allows only
character values for this parameter.user
- The user to send to the CONNECT procedure on the appserver side.pwd
- The password to send to the CONNECT procedure on the appserver side.true
if connection succeeded, or false
otherwisepublic logical connect(character options, character user, character pwd, character serverInfo)
connect
in interface ConnectableServer
options
- The set of parameters to establish the connection. 4GL allows only
character values for this parameter.user
- The user to send to the CONNECT procedure on the appserver side.pwd
- The password to send to the CONNECT procedure on the appserver side.serverInfo
- Other info to send to the CONNECT procedure on the appserver side.true
if connection succeeded, or false
otherwisepublic logical connected()
true
if the web service is connected or false
otherwise.connected
in interface Connectable
true
if the server is connected or false
otherwise.public boolean _connected()
true
if the web service is connected or false
otherwise.true
if the server is connected or false
otherwise.public logical disconnect()
true
if succeeded or
false
otherwise.disconnect
in interface Connectable
true
if disconnect succeeded or false
otherwise.public void terminate(Session session)
terminate
in interface SessionListener
session
- The session that is ending.public void initialize(Session session)
initialize
in interface SessionListener
session
- The session that is starting.public void notifyStart()
notifyStart
in interface AsyncRequestListener
public void notifyFinish()
notifyFinish
in interface AsyncRequestListener
boolean hasAsyncRequests()
true
if the server has running async requests.ServerHelper getServerHelper()
helper
for this server resource.boolean isWebService()
void setFirstProcedure(ProxyProcedureWrapper proc)
proc
- The procedure instance.void setLastProcedure(ProxyProcedureWrapper proc)
proc
- The procedure instance.protected boolean resourceDelete()
resourceDelete
in class HandleChain
true
if the resource was deleted.private boolean connectToWebService(java.util.Map<java.lang.String,java.lang.String> parms)
parms
- The connection parameters.true
if the connection was possible.private boolean connectToAppServer(java.util.Map<java.lang.String,java.lang.String> parms, character user, character pwd, character serverInfo)
parms
- The set of parameters to establish the connection. 4GL allows only character
values for this parameter.user
- The user to send to the CONNECT procedure on the appserver side.pwd
- The password to send to the CONNECT procedure on the appserver side.serverInfo
- Other info to send to the CONNECT procedure on the appserver side.true
if the connection was possible.private logical disconnectImpl(boolean disconnecting)
true
if succeeded or
false
otherwise.true
if disconnect succeeded or false
otherwise.private java.util.Map<java.lang.String,java.lang.String> parseOptions(character options)
null
.options
- The options from which the parameters will be extracted.private ServerImpl.AsyncInvoker getAsyncInvoker()
asynchronous invoker
for this server; if invoker
is null,
it will create a ServerImpl.SessionManagedInvoker
if the server is in the Session-managed
operating mode or a ServerImpl.SessionFreeInvoker
if the server is in the Session-free
operating mode.