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 ClientType[] |
clientTypes
The client types associated with this server handle.
|
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 static CentralLogger |
LOG
Logger
|
private object<? extends OerequestInfo> |
requestInfo
The reference to the REQUEST-INFO attribute.
|
private object<? extends OerequestInfo> |
responseInfo
The reference to the RESPONSE-INFO attribute.
|
private boolean |
valid
Flag indicating if the server is valid.
|
name, nextSibling, prevSibling, wainstProc, pm| 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.
|
ClientType[] |
getClientTypes()
Returns the client types associated with this server 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.
|
object<? extends OerequestInfo> |
getRequestInfo()
Get the REQUEST-INFO legacy attribute.
|
object<? extends OerequestInfo> |
getResponseInfo()
Get the RESPONSe-INFO legacy attribute.
|
(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.
|
protected boolean |
hasNameReadOnly()
Check if this resource supports the NAME attribute in read-only mode.
|
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).
|
_name, delete, firstResource, firstResource, getHead, getNextSibling, getNextSibling, getPrevSibling, getPrevSibling, getPrivateData, getTail, hasName, hasNameConstraints, hasNextSibling, hasParent, hasPrevSibling, hasPrivateData, interlink, isChained, lastResource, lastResource, moveInChain, name, name, name, readOnlyError, readOnlyError, resolveChainType, setHead, setNextSibling, setNextSibling, setPrevSibling, setPrevSibling, setPrivateData, setPrivateData, setPrivateData, validateName_instantiatingProcedure, addToPool, doDelete, equals, hashCode, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, processResource, registerResource, resourceType, setInstantiatingProcedure, toString, type, unableToAssignUnknown, unknownclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetNextSibling, getPrevSibling, getPrivateData, setPrivateData, setPrivateDatareadOnlyError, readOnlyError, resourceTypeid, id, unknownallowDeleteprivate static final CentralLogger LOG
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
private object<? extends OerequestInfo> requestInfo
private object<? extends OerequestInfo> responseInfo
private ClientType[] clientTypes
public ServerImpl()
public static boolean isServer(handle h)
h - true if the handle's resource is a server.public ClientType[] getClientTypes()
public void invokeAsync(AsyncRequestImpl request)
request - The async request to be executed.public boolean valid()
valid in interface WrappedResourcetrue if we are valid (can be used).public object<? extends OerequestInfo> getRequestInfo()
getRequestInfo in interface RequestResponseInfopublic object<? extends OerequestInfo> getResponseInfo()
getResponseInfo in interface RequestResponseInfopublic integer getAsyncRequestCount()
getAsyncRequestCount in interface AsyncRequestCountAttributepublic 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 SubTypeAttributepublic void setSubType(character value)
setSubType in interface SubTypeAttributevalue - The new value of the subtype object attribute.public void setSubType(java.lang.String value)
setSubType in interface SubTypeAttributevalue - The new value of the subtype object attribute.public character getSslServerName()
getSslServerName in interface SslServerAttributepublic handle firstProcedure()
firstProcedure in interface FirstLastProcedureAttributepublic handle lastProcedure()
lastProcedure in interface FirstLastProcedureAttributepublic character getClientConnectionId()
getClientConnectionId in interface Serverpublic handle getFirstAsyncRequest()
getFirstAsyncRequest in interface Serverpublic handle getLastAsyncRequest()
getLastAsyncRequest in interface Serverpublic logical cancelRequests()
cancelRequests in interface Servertrue 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 ServertimeSec - 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 ServertimeSec - 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 ServertimeSec - 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 Connectableoptions - 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 Connectableoptions - 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 ConnectableServeroptions - 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 ConnectableServeroptions - 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 ConnectableServeroptions - 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 Connectabletrue 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 Connectabletrue if disconnect succeeded or false otherwise.public void terminate(Session session)
terminate in interface SessionListenersession - The session that is ending.public void initialize(Session session)
initialize in interface SessionListenersession - The session that is starting.public void notifyStart()
notifyStart in interface AsyncRequestListenerpublic void notifyFinish()
notifyFinish in interface AsyncRequestListenerprotected boolean hasNameReadOnly()
hasNameReadOnly in class HandleChainfalse.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 HandleResourcetrue 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.disconnecting - Flag indicating if the session is being terminated.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.