|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.protocol.AbstractChannel
com.genesyslab.platform.commons.protocol.DuplexChannel
com.genesyslab.platform.commons.protocol.ClientChannel
com.genesyslab.platform.configuration.protocol.ConfServerProtocol
@ProtocolDescription.Tag(sdkName="Configuration", protocolName="ConfServer") public class ConfServerProtocol
Use a ConfServerProtocol
object to establish
communication between application and Genesys Configuration Server.
ConfServerProtocol confProtocol =
new ConfServerProtocol(
new Endpoint(csEPName, host, port));
confProtocol.setClientApplicationType(CfgAppType.CFGGenericClient.ordinal());
confProtocol.setClientName(myGenericClientAppName);
confProtocol.setUserName(username);
confProtocol.setUserPassword(password);
confProtocol.open();
When you are finished communicating with the server, you can close the
channel like this:
confProtocol.close();
The session can be restored after the connection lost if the UseSession flag was assigned
to 'true' before reopening the configuration server protocol channel
confProtocol.setUseSession(true);
//...
confProtocol.open();
After session will be restored confProtocol.getContext().isSessionRestored() will return true
and no needs repeat to send RequestRegisterNotification, you will receive automatically all changes
for registered objects.
Samples for using SSO authentication with Configuration Server:
Connecting with KERBEROS authorization as current logining user
(using default authentication ticket acquirer)
// You can change default ticket acquirer using next code: // System.setProperty("com.genesys.protocol.auth.ticket.acquirer", // "com.genesyslab.platform.commons.protocol.auth.KerberosTicketAcquirer"); // Set Kerberos configuration file location: System.setProperty("java.security.krb5.conf ", "c:/windows/system32/krb5.conf"); // Service Principal Name String SPN = "ConfigServerMT64/srv-1.t8.local@CAPITAL_DOMAIN_NAME"; Endpoint endpoint = new Endpoint("default", CONFIG_SERVER_HOST, CONFIG_SERVER_PORT).setSPN(SPN); ConfServerProtocol protocol = new ConfServerProtocol(endpoint); protocol.setClientName("default"); protocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal()); protocol.open();
Connecting with KERBEROS authorization
(using custom authentication ticket acquirer)
// Set Kerberos configuration file location: System.setProperty("java.security.krb5.conf ", "c:/windows/system32/krb5.conf"); Endpoint endpoint = new Endpoint("default", CONFIG_SERVER_HOST, CONFIG_SERVER_PORT); ConfServerProtocol protocol = new ConfServerProtocol(endpoint); protocol.setClientName("default"); protocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal()); // You can use your custom implementation instead our ones (KerberosTicketAcquirer, RawDataTicketAcquirer) byte[] GSS_KERBEROS_TICKET_BYTES = ... AuthTicketAcquirer ticketAcquirer = new RawDataTicketAcquirer(GSS_KERBEROS_TICKET_BYTES); protocol.setTicketAcquirer(ticketAcquirer); protocol.open();
Connecting with KERBEROS authorization using user name (UPN) and password
// Service Principal Name String SPN = "ConfigServerMT64/srv-1.t8.local@CAPITAL_DOMAIN_NAME"; // Set Kerberos configuration file location: System.setProperty("java.security.krb5.conf ", "c:/windows/system32/krb5.conf"); Endpoint endpoint = new Endpoint("default", CONFIG_SERVER_HOST, CONFIG_SERVER_PORT).setSPN(SPN); ConfServerProtocol protocol = new ConfServerProtocol(endpoint); protocol.setClientName("default"); protocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal()); String UPN = "TheUserName@CAPITAL_DOMAIN_NAME"; char[] PWD = {'x', 'x', 'x'}; CallbackHandler ch = new LoginCallbackHandler(UPN, PWD); AuthTicketAcquirer ticketAcquirer = new KerberosTicketAcquirer(UPN,ch); protocol.setTicketAcquirer(ticketAcquirer); protocol.open();Note: Starting from Platform SDK 8.5.0 version, main protocol channel classes (including
ConfServerProtocol
) are no longer "final
".
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.ClientChannel |
---|
ClientChannel.BasicClientHandshakeStep, ClientChannel.ClientHandshakeStep, ClientChannel.RegistrationHandler, ClientChannel.SimpleRegistrationHandler |
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
---|
AbstractChannel.AsyncErrorNotifier |
Field Summary | |
---|---|
static java.lang.String |
CONF_OBJECTS_NAMESPACE
Deprecated. |
static ProtocolDescription |
PROTOCOL_DESCRIPTION
Protocol signature (sdk and name) for this Channel. |
Fields inherited from class com.genesyslab.platform.commons.protocol.DuplexChannel |
---|
messageFilter |
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
DEF_INPUT_SIZE |
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
DEFAULT_TIMEOUT, INFINITE_TIMEOUT |
Constructor Summary | |
---|---|
ConfServerProtocol()
Creates a new ConfServerProtocol object. |
|
ConfServerProtocol(Endpoint endpoint)
Creates a new ConfServerProtocol object. |
|
ConfServerProtocol(Endpoint endpoint,
boolean initCrypto)
Creates a new ConfServerProtocol object. |
|
ConfServerProtocol(Endpoint endpoint,
long timeout,
boolean initCrypto)
Please note that initializing cryptoengine can take some time, so if you are absolutely sure your server doesn't (and won't) support AES encrypting set the initCrypt parameter to false. |
Method Summary | |
---|---|
int |
getClientApplicationType()
Returns type of the client application as defined in CfgAppType enumeration. |
java.lang.String |
getClientName()
Returns client applications' name. |
ConfServerContext |
getServerContext()
ConfServerContext property gets protocol context of Configuration Server ConfServerProtocol opened connection with. |
AuthTicketAcquirer |
getTicketAcquirer()
Gets custom Kerberos ticket acquirer. |
boolean |
getUseConfDataNs()
Deprecated. |
boolean |
getUseDeltaOptimization()
Deprecated. The method has been deprecated. |
boolean |
getUseForwardCompatibility()
Deprecated. The method has been deprecated. |
java.lang.String |
getUserName()
Returns the name of a user in the Genesys Configuration Layer. |
java.lang.String |
getUserPassword()
Deprecated. The getter behaviour has been changed. Now it returns only empty string or null. |
boolean |
getUseSession()
Gets session usage flag. |
static void |
initCrypto()
Usually initializing of cryptoengine takes a lot of time and can cause timeouts if will be performed during open procedure. |
CfgMetadata |
loadLocalization(java.lang.Integer lcId)
Requests localization settings from configuration server and initializes protocol meta data with its response. It uses RequestReadLocale /EventLocaleRead for this. |
protected void |
onClose(ConnectionClosedEvent event)
|
protected void |
onOpen()
This method is called when channel is opened and just about to call event handler. |
protected void |
onReceiveMessage(Message message)
Gives to subclass a chance to perform some operations on incoming message arrival before delivering it to connection user code. |
protected void |
onSend(Message message)
Gives to subclass a chance to modify message before sending it to remote party. |
void |
setClientApplicationType(int clientType)
Sets type of the client application as defined in CfgAppType enumeration. |
void |
setClientName(java.lang.String clientName)
Sets client applications' name. |
void |
setTicketAcquirer(AuthTicketAcquirer ticketAcquirer)
Sets custom Kerberos ticket acquirer. |
void |
setTKVPrinter(KeyValuePrinter printer)
|
void |
setUseConfDataNs(boolean useConfDataNs)
Deprecated. |
void |
setUseDeltaOptimization(boolean value)
Deprecated. The method has been deprecated. |
void |
setUseForwardCompatibility(boolean value)
Deprecated. The method has been deprecated. |
void |
setUseLocalization(boolean value)
Sets flag for retrieving and adding the information from data resource repository corresponding to the default localization settings. If this value is set to true, the handshake procedure will use specific configuration server protocol request to retrieve localization information ( RequestReadLocale ). |
void |
setUserName(java.lang.String userName)
Sets the name of a user in the Genesys Configuration Layer. |
void |
setUserPassword(java.lang.String userPassword)
Sets the password of a user in the Genesys Configuration Layer. |
void |
setUseSession(boolean useSession)
Sets session usage flag. |
void |
useChangePasswordRegistration(java.lang.String newUserPassword)
UseChangePasswordRegistration(String newUserPassword) method is used when the protocol's user is marked for password change in the CME environment. |
boolean |
useLocalization()
Returns flag for retrieving and adding the information from data resource repository corresponding to the default localization settings. If this value is set to true, the handshake procedure will use specific configuration server protocol request to retrieve localization information (RequestReadLocale). |
Methods inherited from class com.genesyslab.platform.commons.protocol.ClientChannel |
---|
beginClose, beginOpen, beginRequest, close, close, closeAsync, closeAsync, disableConnectionOperations, doBeginRequest, doBeginRequest, doRequest, endRequest, endRequest, fireUnsolicitedEvents, getCopyResponse, getInvoker, getOpenTimeoutException, getReferenceBuilder, onUnexpectedHandshakeMessage, open, openAsync, openAsync, request, request, requestAsync, requestAsync, setAddressResolver, setAddressResolverParams, setAddressResolverParams, setCopyResponse, setEndpoint, setHandshakeFinished, setHandshakePhase, setHandshakeUnsolicitedEventsPassLimit, setRegistrationHandler, setState, submitRegMessage, throwOnUnReferenceableRequest |
Methods inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
---|
addChannelListener, configure, connectionContext, copyTLSSettings, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getListenerHelper, getState, getStateMods, getTimeout, internal, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setInvoker, setServerContext, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Protocol |
---|
getProtocolId |
Methods inherited from interface com.genesyslab.platform.commons.protocol.InputChannel |
---|
setMessageHandler |
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiver |
---|
receive, receive |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
clearInput, getInputSize, releaseReceivers, setInputSize |
Methods inherited from interface com.genesyslab.platform.commons.protocol.OutputChannel |
---|
addListener, removeListener, send |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
close, getTimeout, open, setTimeout |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel |
---|
getState |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport |
---|
addChannelListener, removeChannelListener |
Methods inherited from interface com.genesyslab.platform.commons.protocol.InterceptorSupport |
---|
getInterceptor |
Methods inherited from interface com.genesyslab.platform.commons.protocol.MessageReceiverManagement |
---|
setReceiver |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ReceiverManagement |
---|
resetReceiver |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConfigurationSupport |
---|
configure, getConfiguration |
Methods inherited from interface com.genesyslab.platform.commons.protocol.EndpointSupport |
---|
getEndpoint |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ProtocolDescriptionSupport |
---|
getProtocolDescription |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncInvokerSupport |
---|
setInvoker |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConnectionInvokerSupport |
---|
setConnectionInvoker |
Field Detail |
---|
@Deprecated public static final java.lang.String CONF_OBJECTS_NAMESPACE
public static final ProtocolDescription PROTOCOL_DESCRIPTION
Constructor Detail |
---|
public ConfServerProtocol()
ConfServerProtocol
object.
public ConfServerProtocol(Endpoint endpoint)
ConfServerProtocol
object.
endpoint
- The endpoint (server) you wish to connect topublic ConfServerProtocol(Endpoint endpoint, boolean initCrypto)
ConfServerProtocol
object.
endpoint
- The endpoint (server) you wish to connect toinitCrypto
- whether to initialize cryptographic engine during construction.public ConfServerProtocol(Endpoint endpoint, long timeout, boolean initCrypto)
initCrypt
parameter to false.
Alternatively you can increase the timeout needed for open and let
registration procedure to initialize cryptographic engine on-demand.
endpoint
- server to connect totimeout
- timeout for protocol operationsinitCrypto
- whether to initialize cryptoengine during constructionMethod Detail |
---|
public void useChangePasswordRegistration(java.lang.String newUserPassword)
DuplexChannel.open()
method will throw ChangePasswordException
.
When user application get
ChangePasswordException
,
it may use useChangePasswordRegistration(String)
method before the channel opening (before calling the
DuplexChannel.open()
again).
The protocol will use a different registration request changing the user password
to the new value during the channel opening handshake.
If the client/user registration is successful,
the UserPassword
is changed to the new user password value.
useChangePasswordRegistration
in interface ConfServerProtocolHandshakeOptions
newUserPassword
- new password for the user/person
ChannelNotClosedException
- when channel isn't closedChangePasswordException
,
DuplexChannel.open()
public ConfServerContext getServerContext()
getServerContext
in class AbstractChannel
public static void initCrypto()
@Deprecated public boolean getUseConfDataNs()
@Deprecated public void setUseConfDataNs(boolean useConfDataNs)
useConfDataNs
- parameter is ignored.public int getClientApplicationType()
CfgAppType
enumeration.
getClientApplicationType
in interface ConfServerProtocolHandshakeOptions
CfgAppType
,
setClientApplicationType(int)
public void setClientApplicationType(int clientType)
CfgAppType
enumeration.
setClientApplicationType
in interface ConfServerProtocolHandshakeOptions
clientType
- integer representation of type of the client applicationCfgAppType
,
CfgAppType.ordinal()
public java.lang.String getClientName()
getClientName
in interface ConfServerProtocolHandshakeOptions
setClientName(String)
public void setClientName(java.lang.String clientName)
setClientName
in interface ConfServerProtocolHandshakeOptions
clientName
- client application namepublic java.lang.String getUserName()
getUserName
in interface ConfServerProtocolHandshakeOptions
setUserName(String)
public void setUserName(java.lang.String userName)
setUserName
in interface ConfServerProtocolHandshakeOptions
userName
- name of a user@Deprecated public java.lang.String getUserPassword()
getUserPassword
in interface ConfServerProtocolHandshakeOptions
setUserPassword(String)
public void setUserPassword(java.lang.String userPassword)
setUserPassword
in interface ConfServerProtocolHandshakeOptions
userPassword
- the password of a user@Deprecated public boolean getUseForwardCompatibility()
@Deprecated public void setUseForwardCompatibility(boolean value)
value
- forward compatibility algorithm allowing flag@Deprecated public boolean getUseDeltaOptimization()
@Deprecated public void setUseDeltaOptimization(boolean value)
value
- new value for delta optimization usage propertypublic boolean getUseSession()
getUseSession
in interface ConfServerProtocolHandshakeOptions
setUseSession(boolean)
,
getServerContext()
,
ConfServerContext.getSessionId()
,
ConfServerContext.isSessionRestored()
,
ConfServerContext.getLastUpdateId()
public void setUseSession(boolean useSession)
setUseSession
in interface ConfServerProtocolHandshakeOptions
useSession
- whether session is usedgetServerContext()
,
ConfServerContext.getSessionId()
,
ConfServerContext.isSessionRestored()
,
ConfServerContext.getLastUpdateId()
public boolean useLocalization()
useLocalization
in interface ConfServerProtocolHandshakeOptions
setUseLocalization(boolean)
public void setUseLocalization(boolean value)
RequestReadLocale
).
Localization read request will be sent for server default Language ID.RequestReadLocale
/EventLocaleRead
.RequestGetLocaleSets
/EventLocaleSets
.
setUseLocalization
in interface ConfServerProtocolHandshakeOptions
value
- localization information usage flag
ChannelNotClosedException
- when protocol connection is not closedgetServerContext()
,
ConfServerContext.getMetadata()
,
CfgDescription.getLocalizedName()
,
loadLocalization(Integer)
public CfgMetadata loadLocalization(java.lang.Integer lcId) throws ProtocolException
RequestReadLocale
/EventLocaleRead
for this.
To read list of configured Localization IDs on a configuration server,
it is possible to use RequestGetLocaleSets
/EventLocaleSets
.
lcId
- locale ID. Zero is for server default localization settings,
and null is to clear localization values.
ProtocolTimeoutException
- in case of no server response on localization read request.
ProtocolException
- in case of problem with handling of the protocol request.
ChannelNotOpenedException
- when protocol connection is not opened.CfgLanguageLCID
,
getServerContext()
,
ConfServerContext.getMetadata()
,
CfgDescription.getLocalizedName()
public void setTKVPrinter(KeyValuePrinter printer)
protected void onOpen() throws ProtocolException
DuplexChannel
onOpen
in class ClientChannel
ProtocolException
- if there are problems during
post open operations (e.g. registration)protected void onClose(ConnectionClosedEvent event)
onClose
in class DuplexChannel
protected void onReceiveMessage(Message message)
DuplexChannel
onReceiveMessage
in class ClientChannel
message
- received messageprotected void onSend(Message message) throws ProtocolException
DuplexChannel
onSend
in class ClientChannel
message
- Message to modify
ProtocolException
- In the case of an unrecoverable protocol error. Client applications should not
try to deal with these exceptions, except for logging or displaying to users or technical administrators.
Check the exception cause for more details.public AuthTicketAcquirer getTicketAcquirer()
public void setTicketAcquirer(AuthTicketAcquirer ticketAcquirer)
ticketAcquirer
- custom Kerberos ticket acquirer.
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |