public class Server
extends java.lang.Object
This class is used for accessing Extended Server components.
For examples on invoking server operations and working with records, see the Foundation1 Development Guide.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
debugMode |
protected Statistics |
stats |
| Constructor and Description |
|---|
Server()
Default constructor.
|
Server(RetryStrategy retryStrategy)
Constructor where the server retry strategy is supplied.
|
Server(RetryStrategy retryStrategy,
int retryCount)
Constructor setting the retry strategy & retry count.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addManualDecisionListener(ManualDecisionListener listener)
Register a
ManualDecisionListener with this object. |
void |
disconnect()
Disconnects all cached connections to servers.
|
java.lang.String |
getAllMessages()
Returns all user info messages in one String with a line separator in between.
|
java.lang.String |
getAllMessages(java.lang.String separator)
Gets all user info messages separated by
separator. |
BodyType |
getBodyType()
Returns the type of the last response's body content.
|
CallRouter |
getCallRouter()
Returns a reference to the
CallRouter object for this class. |
java.lang.String |
getClientId()
Gets the client ID for the current request.
|
java.lang.String |
getConnectionString()
Gets the current connection string used for server communication.
|
java.io.OutputStream |
getDebugOut()
Returns the
OutputStream where debug traces are printed on when
running in debug mode. |
RequestContext |
getDefaultRequestContext()
Returns the default request context used.
|
byte[] |
getLastRequestBody()
Returns the last request's body content, when running in debug mode.
|
java.lang.String |
getLastRequestHeader()
Returns the last request's header information, when running in debug mode.
|
byte[] |
getLastResponseBody()
Returns the last response's body content, when running in debug mode.
|
java.lang.String |
getLastResponseHeader()
Returns the response's header information, when running in debug mode.
|
java.util.Locale |
getLocale()
Returns the
Locale set. |
java.lang.String[] |
getMessages()
Gets all user info messages that was generated during the last call.
|
RetryStrategy |
getRetryStrategy()
Returns the retry strategy used in this object.
|
Statistics |
getStatistics()
Returns a
Statistics object where some statistics on invoke
calls are held. |
Trace |
getTrace()
Returns a reference to a Trace object.
|
ifs.fnd.buffer.Buffer |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody)
Minimum info-version of
invoke. |
ifs.fnd.buffer.Buffer |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
RequestContext requestContext) |
ifs.fnd.buffer.Buffer |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
RequestContext requestContext,
java.lang.String connectionString)
Invokes a server call with a
Buffer as input data. |
ifs.fnd.buffer.Buffer |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
java.lang.String connectionString) |
byte[] |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
byte[] requestBody,
BodyType bodyType,
RequestContext requestContext,
java.lang.String connectionString)
Invokes a server operation with a byte array as the request body.
|
Record |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
Record rec)
Invoke-method with a minimum of information supplied to make the call.
|
Record |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
Record rec,
RequestContext requestContext) |
Record |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
Record rec,
RequestContext requestContext,
java.lang.String connectionString)
Invokes a server operation according to given data.
|
Record |
invoke(java.lang.String interfaceName,
java.lang.String operationName,
Record rec,
java.lang.String connectionString) |
RecordCollection |
invokePLSQL(java.lang.String stmt)
Invokes a PLSQL command through the AccessPlsql interface.
|
RecordCollection |
invokePLSQL(java.lang.String stmt,
Record bindVariables)
Invokes a PLSQL command through the AccessPlsql interface.
|
RecordCollection |
invokePLSQL(java.lang.String stmt,
Record bindVariables,
long maxRows,
long skipRows)
Invokes a PLSQL command through the PL/SQL Gateway interface for client
applications (AccessPlsql).
|
boolean |
isClientStatisticsOn()
Returns the flag controlling SQL trace statistics in database.
|
boolean |
isClientTracingOn()
Returns the flag controlling SQL tracing in database.
|
boolean |
isDebugMode()
Returns whether this object is running in debug mode or not.
|
boolean |
isInteractiveMode()
Returns whether interactive mode is used or not.
|
protected void |
log(java.lang.String msg)
Prints an event to the debug log.
|
protected void |
log(java.lang.String msg,
java.lang.String msg2)
Prints an event to the debug log.
|
void |
removeManualDecisionListener(ManualDecisionListener listener)
Unregisters a
ManualDecisionListener from this object. |
void |
saveToThread()
Saves a reference to this object in the currently executing thread.
|
void |
setClientId(java.lang.String clientId)
Sets the client ID for the current request.
|
void |
setClientStatistics(boolean flag)
Sets the flag controlling SQL trace statistics in database.
|
void |
setClientTracing(boolean flag)
Sets the flag controlling SQL tracing in database.
|
void |
setConnectionString(java.lang.String cs)
Sets the connection string to use for server communication.
|
void |
setCredentials(java.lang.String identification,
java.lang.String password)
Sets the credentials used to authenticate the user.
|
void |
setDebugMode(boolean on)
Sets wheter to run this object in debug mode or not.
|
void |
setDebugOut(java.io.OutputStream out)
Sets the
OutputStream where debug traces are printed on when
running in debug mode. |
void |
setDebugOut(java.io.PrintStream out)
Sets the
PrintStream where debug traces are printed on when
running in debug mode.System.out is the default. |
void |
setDecisions(ManualDecisionCollection decisions)
Sets the collection of manual decisions to be included in the next
(and the next only) server call.
|
void |
setDefaultRequestContext(RequestContext ctx)
Sets the default request context.
|
void |
setIntegrationUrl(boolean isIntUrl)
Set/unset usage of client gateway URL at Integration cluster (default Main)
|
void |
setInteractiveMode(boolean on)
Sets wheter to use interactive mode or not.
|
void |
setLegacyUrl(boolean isLegacyUrl)
Set/unset usage of client gateway URL in backward compatibility mode (default false)
|
void |
setLocale(java.util.Locale locale)
Sets the
Locale to use. |
void |
setLocale(java.lang.String locale)
Sets the locale to use (language actually, an IFS specific language code).
|
void |
setRetryStrategy(RetryStrategy retryStrategy)
Sets the retry strategy for this object.
|
void |
setRunAs(java.lang.String directoryId)
Sets the directory id of an alternative user to run the server calls as.
|
void |
setSqlTrace(boolean enable)
Sets whether SQL Trace is enabled or not.
|
void |
setUseCompression(boolean on)
Sets whether data compression is used or not.
|
boolean |
sqlTrace()
Returns whether SQL Trace is enabled or not.
|
boolean |
useCompression()
Returns whether data compression is used or not.
|
protected boolean debugMode
protected Statistics stats
public Server()
public Server(RetryStrategy retryStrategy)
retryStrategy - public Server(RetryStrategy retryStrategy, int retryCount)
retryStrategy - retryCount - public void disconnect()
public java.io.OutputStream getDebugOut()
OutputStream where debug traces are printed on when
running in debug mode.
Default is System.out.public RequestContext getDefaultRequestContext()
public CallRouter getCallRouter()
CallRouter object for this class.public java.util.Locale getLocale()
Locale set.public byte[] getLastRequestBody()
public java.lang.String getLastRequestHeader()
public byte[] getLastResponseBody()
public java.lang.String getLastResponseHeader()
public java.lang.String[] getMessages()
public java.lang.String getAllMessages()
public java.lang.String getAllMessages(java.lang.String separator)
separator.separator - public BodyType getBodyType()
public RetryStrategy getRetryStrategy()
public Statistics getStatistics()
Statistics object where some statistics on invoke
calls are held. It includes among other things a performance evaluation.Statisticspublic boolean isDebugMode()
public boolean isInteractiveMode()
setInteractiveMode(boolean)public boolean sqlTrace()
setSqlTrace(boolean)public void setSqlTrace(boolean enable)
enable - if true Enable SQL Trace.public void setClientId(java.lang.String clientId)
clientId - String identifying the clientsetClientTracing(boolean),
setClientStatistics(boolean)public void setClientTracing(boolean flag)
flag - true if SQL trace statistics should be generated, false otherwisesetClientId(String)public void setClientStatistics(boolean flag)
flag - true if SQL trace statistics should be generated, false otherwisesetClientId(String)public java.lang.String getClientId()
isClientTracingOn(),
isClientStatisticsOn()public boolean isClientTracingOn()
setClientTracing(boolean)public boolean isClientStatisticsOn()
setClientStatistics(boolean)public void setUseCompression(boolean on)
on - if true compression is used.public boolean useCompression()
true if compression is used.public void setIntegrationUrl(boolean isIntUrl)
isIntUrl - public void setLegacyUrl(boolean isLegacyUrl)
isLegacyUrl - public Record invoke(java.lang.String interfaceName, java.lang.String operationName, Record rec) throws APException
null).interfaceName - operationName - rec - APExceptioninvoke(java.lang.String,java.lang.String,ifs.fnd.ap.Record,ifs.fnd.ap.RequestContext,java.lang.String)public Record invoke(java.lang.String interfaceName, java.lang.String operationName, Record rec, RequestContext requestContext) throws APException
interfaceName - operationName - rec - requestContext - APExceptioninvoke(java.lang.String,java.lang.String,ifs.fnd.ap.Record,ifs.fnd.ap.RequestContext ,java.lang.String)public Record invoke(java.lang.String interfaceName, java.lang.String operationName, Record rec, java.lang.String connectionString) throws APException
interfaceName - operationName - rec - connectionString - APExceptioninvoke(java.lang.String,java.lang.String,ifs.fnd.ap.Record,ifs.fnd.ap.RequestContext ,java.lang.String)public Record invoke(java.lang.String interfaceName, java.lang.String operationName, Record rec, RequestContext requestContext, java.lang.String connectionString) throws APException
interfaceName - The name of the interface to be called.operationName - The name of the operation to be called.rec - The record containing the input data for the call.requestContext - the request context in which the call is made. Default is null.connectionString - a connection string to use for this invokation.
Default is null (=use the one set on this Server object).APException - when server calls fails of various reasons. If it's caused
by a standard exception, then the original exception is wrapped and
accessible via APException.getRootCause().public ifs.fnd.buffer.Buffer invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody)
throws APException,
ifs.fnd.service.FndException
invoke.interfaceName - operationName - requestBody - APExceptionifs.fnd.service.FndExceptioninvoke(java.lang.String, java.lang.String, ifs.fnd.buffer.Buffer, ifs.fnd.ap.RequestContext, java.lang.String)public ifs.fnd.buffer.Buffer invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
RequestContext requestContext)
throws APException,
ifs.fnd.service.FndException
interfaceName - operationName - requestBody - requestContext - APExceptionifs.fnd.service.FndExceptioninvoke(java.lang.String, java.lang.String, ifs.fnd.buffer.Buffer, ifs.fnd.ap.RequestContext, java.lang.String)public ifs.fnd.buffer.Buffer invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
java.lang.String connectionString)
throws APException,
ifs.fnd.service.FndException
interfaceName - operationName - requestBody - connectionString - APExceptionifs.fnd.service.FndExceptioninvoke(java.lang.String, java.lang.String, ifs.fnd.buffer.Buffer, ifs.fnd.ap.RequestContext, java.lang.String)public ifs.fnd.buffer.Buffer invoke(java.lang.String interfaceName,
java.lang.String operationName,
ifs.fnd.buffer.Buffer requestBody,
RequestContext requestContext,
java.lang.String connectionString)
throws APException,
ifs.fnd.service.FndException
Buffer as input data.interfaceName - The interface to bind to.operationName - The operation to invoke.requestBody - A buffer containing the input data for the server call.requestContext - the request context in which the call is made. Default is null.connectionString - a connection string to use for this invokation.
Default is null (=use the one set on this Server object).ifs.fnd.service.FndExceptionAPExceptionpublic byte[] invoke(java.lang.String interfaceName,
java.lang.String operationName,
byte[] requestBody,
BodyType bodyType,
RequestContext requestContext,
java.lang.String connectionString)
throws APException,
ifs.fnd.service.FndException
interfaceName - the interface to bind to.operationName - the operation to invoke.requestBody - the request's body to send to the operation. Must be an
IFS Buffer or XML document.bodyType - the type of the body content.requestContext - the request context in which the call is made. Default is null.connectionString - a connection string to use for this invokation.
Default is null (=use the one set on this Server object).APExceptionifs.fnd.service.FndExceptionpublic RecordCollection invokePLSQL(java.lang.String stmt) throws APException
PL/SQL Command Block functionality.
That functionality also allows for executing multiple commands in one call.stmt - APExceptioninvokePLSQL(String, ifs.fnd.ap.Record, long, long)public RecordCollection invokePLSQL(java.lang.String stmt, Record bindVariables) throws APException
PL/SQL Command Block functionality.
That functionality also allows for executing multiple commands in one call.stmt - bindVariables - APExceptioninvokePLSQL(String, ifs.fnd.ap.Record, long, long)public RecordCollection invokePLSQL(java.lang.String stmt, Record bindVariables, long maxRows, long skipRows) throws APException
Invokes a PLSQL command through the PL/SQL Gateway interface for client applications (AccessPlsql). Default parameter info below states the values used by overloaded versions of this method.
A more convenient and flexible way to invoke PL/SQL code and do queries is
to use the PL/SQL Command Block functionality.
That functionality also allows for executing multiple commands in one call.
stmt - the SQL statement to run.bindVariables - A record containing the bind variables, if any
(default is null).maxRows - the maximum number of rows to return for the statement
(default is 100).skipRows - if set to n, then the n first rows the result is not returned
in the result set (default is 0).null is returned.APException - if the call does not go well.public void saveToThread()
FndClientAccessHandlerpublic void setLocale(java.lang.String locale)
locale - setLocale(java.util.Locale)public void setLocale(java.util.Locale locale)
Locale to use.locale - public void setCredentials(java.lang.String identification,
java.lang.String password)
identification - the user's identification.password - the user's password.public void setRunAs(java.lang.String directoryId)
setCredentials()
call. This directory id is used for security- and authorization-related
checks on the server-side. Normal user authentication is still peformed
and only a pre-defined set of users may use an alternative directory id.directoryId - the directory id of a user to run as.public void setDebugOut(java.io.OutputStream out)
OutputStream where debug traces are printed on when
running in debug mode. System.out is the default.out - public void setDebugOut(java.io.PrintStream out)
PrintStream where debug traces are printed on when
running in debug mode.System.out is the default.out - public void setDebugMode(boolean on)
ifs.fnd.ap.debug to "true" before creating this
object. By default, debug traces are produced to System.out.on - setDebugOut(java.io.PrintStream)public void setDecisions(ManualDecisionCollection decisions)
decisions - ManualDecisionExceptionpublic void setDefaultRequestContext(RequestContext ctx)
ctx - the requst context to set. May not be null.public java.lang.String getConnectionString()
public void setConnectionString(java.lang.String cs)
cs - public void setInteractiveMode(boolean on)
on - public void setRetryStrategy(RetryStrategy retryStrategy)
retryStrategy - protected void log(java.lang.String msg)
msg - protected void log(java.lang.String msg,
java.lang.String msg2)
msg - msg2 - public void addManualDecisionListener(ManualDecisionListener listener)
ManualDecisionListener with this object. The
listeners are invoked when a server requests a manual decision.
One listener can only be added once. If more than one listener is registered,
the first listener will recieve all decision requests and if not all decisions
have been answered, the next listner will recieve an event for the remaining
decisions to be made. listener - ManualDecisionListener,
setInteractiveMode(boolean)public void removeManualDecisionListener(ManualDecisionListener listener)
ManualDecisionListener from this object.listener - ManualDecisionListener