Interface SaperionClientFactory
-
- All Known Implementing Classes:
SaperionClientFactoryImpl
public interface SaperionClientFactory
Ths saperion client factory works as an entry point for saperion functionality. It is bound to one specific saperion system.For an application SaperionClientFactory is the entry point for connecting to saperion. Such an application will typically call
newInstance
with configured properties to obtain an instance of this interface.Map<String, String> properties = loadConfiguration(); SaperionClientFactory factory = SaperionClientFactory.newInstance(properties);
The required configuration parameters depend on the kind of communication layer (HTTP or RMI) in use.
For HTTP:
- ecm.server.url=URL of the ECM REST Service. Default: "http://127.0.0.1:8080/ecms-webapp-tomcat/api"
For RMI:
- rmi.server.port: Port the Java Core Server is listening on. Default: "1099"
- rmi.server.host: IP or name of the host of the Java Core Server. Default: "127.0.0.1"
- rmi.server.ssl: Enable SSL encryption of RMI communication. Default: "false"
Which kind of communication (HTTP or RMI) is used depends on the available libraries. The Saperion Client API is available in three different packaging options:
- saperion-client-http: Libraries for HTTP communication
- saperion-client-rmi: Libraries for RMI communication
- saperion-client-complete: Libraries for HTTP and RMI communication
When the complete version is used, the communication kind can be defined by setting an additional configuration parameter:
- saperion.connection.type: Kind of communication. "HTTP" or "RMI". Default: "HTTP"
An application may as well specify the implementation of
ConnectorFactory
directly to specify the underlying low level apiMap<String, String> properties = loadConfiguration(); SaperionClientFactory factory = SaperionClientFactory.newInstance(properties, new MyFancyConnectorFactory());
With a saperion client factory one can create instances of
SaperionClient
by authenticating:SaperionClientFactory factory = ... SaperionClient client = factory.newClient("user", "password", LicenseEnumeration.ADMIN, "System");
- Author:
- jschwarz
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description SaperionClient
changePassword(java.lang.String userName, java.lang.String oldPassword, java.lang.String newPassword, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant)
This method creates a new saperion client with a new session in the context of the given user credentials.static SaperionClientFactory
getSaperionClientFactory(java.util.Map<java.lang.String,java.lang.String> properties, ConnectorFactory connectorFactory)
This factory method creates a new saperion client factory given an implementation ofConnectorFactory
.SaperionClient
newClient(java.lang.String token, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant)
This method creates a new saperion client with a new session in the context of the given user credentials.SaperionClient
newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType)
This method creates a new saperion client with a new session in the context of the given user credentials.SaperionClient
newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant)
This method creates a new saperion client with a new session in the context of the given user credentials.SaperionClient
newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant, java.lang.String impersonatedUser)
This method creates a new saperion client with a new session in the context of the given user credentials.static SaperionClientFactory
newInstance(java.util.Map<java.lang.String,java.lang.String> properties)
This static factory method uses theconnector factory spi
to create a new client factory.
-
-
-
Method Detail
-
newClient
SaperionClient newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant) throws com.lexmark.saperion.exceptions.EcmException
This method creates a new saperion client with a new session in the context of the given user credentials.- Parameters:
userName
- the name of the userpassword
- the password of the userlicenseType
- the saperion license to use for the sessiontenant
- the name of the tenant- Returns:
- a client in the context of the given credentials
- Throws:
com.lexmark.saperion.exceptions.EcmException
-
newClient
SaperionClient newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType) throws com.lexmark.saperion.exceptions.EcmException
This method creates a new saperion client with a new session in the context of the given user credentials. On multi-tenant-systems, usenewClient(String, String, LicenseEnumeration, String)
instead.- Parameters:
userName
- the name of the userpassword
- the password of the userlicenseType
- the saperion license to use for the session- Returns:
- a client in the context of the given credentials
- Throws:
com.lexmark.saperion.exceptions.EcmException
-
newClient
SaperionClient newClient(java.lang.String userName, java.lang.String password, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant, java.lang.String impersonatedUser) throws com.lexmark.saperion.exceptions.EcmException
This method creates a new saperion client with a new session in the context of the given user credentials.- Parameters:
userName
- the name of the userpassword
- the password of the userlicenseType
- the saperion license to use for the sessiontenant
- the name of the tenantimpersonatedUser
- the name of the impersonated user- Returns:
- a client in the context of the given credentials
- Throws:
com.lexmark.saperion.exceptions.EcmException
-
newClient
SaperionClient newClient(java.lang.String token, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant) throws com.lexmark.saperion.exceptions.EcmException
This method creates a new saperion client with a new session in the context of the given user credentials.- Parameters:
token
- a token retrieved from an authorization servicelicenseType
- the saperion license to use for the sessiontenant
- the name of the tenant- Returns:
- a client in the context of the given credentials
- Throws:
com.lexmark.saperion.exceptions.EcmException
-
changePassword
SaperionClient changePassword(java.lang.String userName, java.lang.String oldPassword, java.lang.String newPassword, com.lexmark.saperion.LicenseEnumeration licenseType, java.lang.String tenant) throws com.lexmark.saperion.exceptions.EcmException
This method creates a new saperion client with a new session in the context of the given user credentials. It also changes the users password. This is the only possibility a user whose password is expired has to log in and change his password.- Parameters:
userName
- the name of the useroldPassword
- the current (possibly expired) password of the usernewPassword
- the new password of the userlicenseType
- the saperion license to use for the sessiontenant
- the name of the tenant- Returns:
- a client in the context of the given credentials
- Throws:
com.lexmark.saperion.exceptions.EcmException
-
newInstance
static SaperionClientFactory newInstance(java.util.Map<java.lang.String,java.lang.String> properties)
This static factory method uses theconnector factory spi
to create a new client factory. Note that an implementation of ConnectorFactory must be registered as a java service for this to work. Note that depending on the service implementation different properties may be required.- Parameters:
properties
- configuration properties depending on the concrete service implementation- Returns:
- a new client factory
-
getSaperionClientFactory
static SaperionClientFactory getSaperionClientFactory(java.util.Map<java.lang.String,java.lang.String> properties, ConnectorFactory connectorFactory)
This factory method creates a new saperion client factory given an implementation ofConnectorFactory
.- Parameters:
properties
- configuration properties depending on the concrete service implementationconnectorFactory
- an implementation of ConnectorFactory instantiating the underlying low level api- Returns:
- a new client factory
-
-