Package de.elo.ix.client
Class IXConnFactory
java.lang.Object
de.elo.ix.client.IXConnFactory
- Direct Known Subclasses:
IXConnFactoryEventHandler
This class is used to create IXConnection objects that represent sessions to Indexserver. Use one
of the create methods to instanciate an IXConnection object.
The connection to the Indexserver is internally hold by an IXClient object. Its initial
parameters are supplied by a Properties collection given in the constructor of IXConnFactory. A
reference to the IXClient object is passed to each IXConnection object created by one of the
create functions.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Properties
Connection properties.protected IXServicePortC
Constantsprotected AtomicBoolean
Remember to create a new IXClient object for the next IXConnection object.static final String
Number of reverse connections.static final String
Property name for the number of connections to Indexserver used in the connection pool: "connection.nbOfCnns".static final String
Property name for a temporary directory: "connection.tempDir".static final String
Property name for connection timeout: "connection.timeoutSeconds" in seconds.static final String
Property name for Indexserver URL: "connection.url".protected Properties
Session options.protected ExecutorService
Thread pool for HTTP requests. -
Constructor Summary
ConstructorsConstructorDescriptionIXConnFactory
(String url, String appName, String appVersion) Constructor.IXConnFactory
(Properties props, Properties sessOpts) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(ClientInfo ciAdmin, String runAs) Create a connection for the given Run-As-user for an existent ticketCreate aconnection for the given user.Create a connection for the given user.createAdmin
(ClientInfo ci, String userName, String userPwd, String computerName, String reportAs) Create aconnection for the given user.createAdmin
(String userName, String userPwd, String computerName, String reportAs) Create a connection for the given user.static Properties
createConnProps
(String url) Create a connection properties object.static Properties
createConnProps
(String url, int nbOfCnns, int timeoutSeconds) Create a connection properties object.protected IXConnection
createFromCookie
(ClientInfo ci, HttpCookie sessionCookie) Create a connection from a httpSession cookie supplied in the connection properties of IXConnFactory.Create a connection from any valid AM ticket.createFromTicketForRelogin
(Supplier<ClientInfo> clientInfoFnct) Create a connection from any valid AM ticket provided by a supplier function.Create a session for the current Windows OS user via Kerberos authentication.RESERVED.static Properties
createSessionOptions
(String appName, String appVersion) Creates a property collection that contains session options.createSso
(ClientInfo ci, String computerName) Create connection for the current user of the operating system.Create connection for the current user of the operating system.void
done()
Get connection properties.getCONST()
Returns the constants object.int
Deprecated.Get session options.protected byps.http.HTransportFactoryClient
getTransportFactory
(int nbOfReverseConnections, IXConnFactory.MyWireClient wire) Deprecated.protected void
init()
Initialize this object.protected void
internalCreateConnection
(IXAuthentication auth, HttpCookie sessionCookie, byps.BAsyncResult<IXConnection> asyncResult) Create a connection with the given authentication object and optional HTTP session cookie.protected IXConnection
internalCreateIXConnectionObject
(IXConnFactory connFact, de.elo.ix.client.BClient_Indexserver bclient, IXAuthentication auth, String url, Properties connProps, Properties sessOpts) Create IXConnection object.protected IXConnection
internalCreateWithPassword
(ClientInfo ci, String userName, String userPwd, String computerName, String runAs, EAuthenticationType authType) Create a connection for name/password authentication.Creates a ClientInfo object and assigns the language, country from the default values of the Java VM.static Properties
readStatusPageProperties
(String ixUrl) Deprecated.static String
readStatusPageProperty
(String ixUrl, String propertyName) Deprecated.toString()
-
Field Details
-
PROP_URL
Property name for Indexserver URL: "connection.url". This value is required. Example:http://server:8080/ix-Archive/ix
.- See Also:
-
PROP_NB_OF_CNNS
Property name for the number of connections to Indexserver used in the connection pool: "connection.nbOfCnns". This value should be 2 for applications that use only one session to Indexserver. It should be set to the estimated number of concurrent calls for applications that use more sessions simultanously. This value is optional and defaults to 10.- See Also:
-
PROP_TIMEOUT_SECONDS
Property name for connection timeout: "connection.timeoutSeconds" in seconds. This value is optional and defaults to 120 seconds.- See Also:
-
PROP_TEMP_DIR
Property name for a temporary directory: "connection.tempDir". This value is optional and is currently not used.- See Also:
-
NB_OF_REVERSE_CNNS
Number of reverse connections. This is the number of long-polls opened to the server in order to receive events.- See Also:
-
connProps
Connection properties. -
createNewIxClient
Remember to create a new IXClient object for the next IXConnection object. Each IXConnection object gets its own IXClient object. When the first IXConnection is created, it gets the IXClient object created in the constructor of the IXConnFactory. For the following IXConnection objects, new IXClient objects have to be created. This member is true, if the first IXConnection object has been created and the current IXClient object must be cloned for the next IXConnection. -
sessOpts
Session options.- See Also:
-
tpool
Thread pool for HTTP requests. -
CONST
Constants
-
-
Constructor Details
-
IXConnFactory
Constructor. The supplied connection properties are used to create the internal IXClient object. They are passed to each IXConnection object created by one of the create function. The given session options are passed to the IXConnLogin objects instanciated in the create functions. The functionscreateConnProperties
andcreateSessionOptions
can help to create the properties collections.- Parameters:
props
- Connection properties.sessOpts
- Session options.- Throws:
byps.RemoteException
- E.g. if the connection cannot be established.- See Also:
-
IXConnFactory
Constructor.- Parameters:
url
- Indexserver URLappName
- Application nameappVersion
- Application version- Throws:
IllegalStateException
- E.g. if the connection cannot be established.
-
-
Method Details
-
createConnProps
Create a connection properties object.- Parameters:
url
- URL to Indexserver- Returns:
- Properties object.
- See Also:
-
createConnProps
Create a connection properties object.- Parameters:
url
- URL to IndexservernbOfCnns
- Size of connection pool with connections to Indexserver.timeoutSeconds
-- Returns:
- Properties object.
- See Also:
-
createSessionOptions
Creates a property collection that contains session options. The client application type property (SessionOptionsC.CLIENT_APP_TYPE
) is set toSessionOptionsC.TYPE_PARTNER_APPLICATION
.- Parameters:
appName
- Application name.appVersion
- Application version.- Returns:
- Properties object.
- See Also:
-
getConnProperties
Get connection properties.- Returns:
- Connection properties.
-
getSessionOptions
Get session options.- Returns:
- Session options.
-
getCONST
Returns the constants object.- Returns:
- Constants object.
- Throws:
byps.RemoteException
-
makeDefaultClientInfo
Creates a ClientInfo object and assigns the language, country from the default values of the Java VM. The timezone member is initialized with UTC.- Returns:
- ClientInfo object.
-
createOffline
RESERVED.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
create
public IXConnection create(String userName, String userPwd, String computerName, String runAs) throws byps.RemoteException Create a connection for the given user. The required ClientInfo object with language, country and timezone is created bymakeDefaultClientInfo
.- Parameters:
userName
- User name.userPwd
- Plain text user password.computerName
- Computer name.runAs
- User name or ID if this should be a run-as connection.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
create
public IXConnection create(ClientInfo ci, String userName, String userPwd, String computerName, String runAs) throws byps.RemoteException Create aconnection for the given user.- Parameters:
ci
- ClientInfo object with language, country and timezoneuserName
- User name.userPwd
- Plain text user password.computerName
- Computer name.runAs
- User name or ID if this should be a run-as connection.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
internalCreateWithPassword
protected IXConnection internalCreateWithPassword(ClientInfo ci, String userName, String userPwd, String computerName, String runAs, EAuthenticationType authType) throws byps.RemoteException Create a connection for name/password authentication.- Parameters:
ci
- ClientInfo object with language, country and timezoneuserName
- User name.userPwd
- Plain text user password.computerName
- Computer name.runAs
- User name or ID if this should be a run-as connection.authType
- Authentication type- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
internalCreateConnection
protected void internalCreateConnection(IXAuthentication auth, HttpCookie sessionCookie, byps.BAsyncResult<IXConnection> asyncResult) Create a connection with the given authentication object and optional HTTP session cookie.- Parameters:
auth
- Authentication handlersessionCookie
- Optional HTTP session cookie. At least domain, path, secure and httpOnly should be set in the given cookie.asyncResult
- Result handler
-
getTransportFactory
protected byps.http.HTransportFactoryClient getTransportFactory(int nbOfReverseConnections, IXConnFactory.MyWireClient wire) -
internalCreateIXConnectionObject
protected IXConnection internalCreateIXConnectionObject(IXConnFactory connFact, de.elo.ix.client.BClient_Indexserver bclient, IXAuthentication auth, String url, Properties connProps, Properties sessOpts) Create IXConnection object. Can be overloaded in subclasses to create a customized connection object.- Parameters:
connFact
-bclient
-auth
-url
-connProps
-sessOpts
-- Returns:
- IXConnection object
-
create
Create a connection for the given Run-As-user for an existent ticket- Parameters:
ciAdmin
- ClientInfo object with language, country and timezone with valid ticket of an administrator.runAs
- User name or ID if this should be a run-as connection.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
createKrb
public IXConnection createKrb(ClientInfo ci, String realm, String kdc, String servicePrincipal, String computerName) throws byps.RemoteException Create a session for the current Windows OS user via Kerberos authentication. Note: Function is not supported by API calls anymore, but might sill be needed for support (EIX-1195)- Parameters:
ci
- ClientInfo object with language, country and timezone.realm
- Kerberos Realm, Windows Domain, e.g. ELO.local.kdc
- Key Distribution Center, Active Directory computer name, e.g. negril.elo.local.servicePrincipal
- Account name used to generate the keytab file for AM, e.g. krb_NEGRIL.computerName
- Client computer name for reporting.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
createAdmin
public IXConnection createAdmin(String userName, String userPwd, String computerName, String reportAs) throws byps.RemoteException Create a connection for the given user. The required ClientInfo object with language, country and timezone is created bymakeDefaultClientInfo
.- Parameters:
userName
- User name.userPwd
- Plain text user password.computerName
- Computer name.reportAs
- User name or ID used in reporting and as owner ID.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
createAdmin
public IXConnection createAdmin(ClientInfo ci, String userName, String userPwd, String computerName, String reportAs) throws byps.RemoteException Create aconnection for the given user.- Parameters:
ci
- ClientInfo object with language, country and timezoneuserName
- User name.userPwd
- Plain text user password.computerName
- Computer name.reportAs
- User name or ID used in reporting and as owner ID.- Returns:
- IXConnection object.
- Throws:
byps.RemoteException
-
init
protected void init()Initialize this object. Extracts the connection properties from the properties collection an instanciates an IXClient object. -
done
public void done() -
createSso
Create connection for the current user of the operating system. A HTTP-GET request is sent to the server ixlogin. The current credentials from CredentialsCache are supplied to the request. The server has to check the credentials.- Parameters:
ci
- ClientInfocomputerName
- Client computer name- Returns:
- Connection
- Throws:
byps.RemoteException
-
createSso
Create connection for the current user of the operating system. A HTTP-GET request is sent to the server ixlogin. The current credentials from CredentialsCache are supplied to the request. The server has to check the credentials. The ClientInfo object is created by makeDefaultClientInfo.- Parameters:
computerName
- Client computer name- Returns:
- Connection
- Throws:
byps.RemoteException
-
createFromTicket
Create a connection from any valid AM ticket.- Parameters:
ci
- ci.ticket contains the AM ticket- Returns:
- IXConnection object
- Throws:
byps.RemoteException
-
createFromTicketForRelogin
public IXConnection createFromTicketForRelogin(Supplier<ClientInfo> clientInfoFnct) throws byps.RemoteException Create a connection from any valid AM ticket provided by a supplier function.- Parameters:
clientInfoFnct
- Function that provides a ClientInfo. Called on initial connect and subsequent re-connects.- Returns:
- IXConnection object
- Throws:
byps.RemoteException
-
createFromCookie
public IXConnection createFromCookie(ClientInfo ci, HttpCookie sessionCookie) throws byps.RemoteException Create a connection from a httpSession cookie supplied in the connection properties of IXConnFactory. To create a connection for an existing JSESSIONID known by Indexserver, do as follows:String jsessionId = ... String domain = ... server name or Internet address, e.g. localhost String path = ... cookie path, e.g. /ix-elo200 boolean secure = ... true if this cookie should be sent only over HTTPS. boolean httpOnly = true; Create a HttpCookie object for the JSESSION cookie. HttpCookie sessionCookie = new HttpCookie(HConstants.HTTP_COOKIE_JSESSIONID, jsessionId); sessionCookie.setDomain(domain); sessionCookie.setPath(path); sessionCookie.setSecure(secure); sessionCookie.setHttpOnly(httpOnly); IXConnFactory connFact = new IXConnFactory(...); try (IXConnection conn = connFact.createFromCookie(new ClientInfo(), sessionCookie)) { ... } connFact.done();
- Parameters:
ci
- ClientInfo object with language, country, timezone, etc.sessionCookie
- HTTP server session cookie. At least domain, path, secure and httpOnly should be set in the given cookie.- Returns:
- IXConnection object
- Throws:
byps.RemoteException
- Since:
- 20.00.000.009
-
createForConstants
- Throws:
byps.RemoteException
-
getVersion
Deprecated.Get Indexserver version.- Returns:
- Indexserver version (without build number) EIX-2519: Declared as deprecated to avoid to
show protected information on status page. Use
IXConnectionIF.getVersion()
. - See Also:
-
getMajorVersion
Deprecated.- Returns:
- MajorVersion as int EIX-2519: Declared as deprecated to avoid to show protected information on status page.
- See Also:
-
readStatusPageProperty
Deprecated.Helper function used to read the Indexserver version numbers.- Parameters:
ixUrl
- Indexserver URLpropertyName
- Property name- Returns:
- Property value EIX-2519: Declared as deprecated to avoid to show protected information on status page.
-
readStatusPageProperties
Deprecated.Helper function used retrieve all properties of the ix status page- Parameters:
ixUrl
- Indexserver URL- Returns:
- Properties EIX-2519: Declared as deprecated to avoid to show protected information on status page.
-
toString
-