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 api



      Map<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 Details

    • newClient

      SaperionClient newClient(String userName, String password, com.lexmark.saperion.LicenseEnumeration licenseType, 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 user
      password - the password of the user
      licenseType - the saperion license to use for the session
      tenant - the name of the tenant
      Returns:
      a client in the context of the given credentials
      Throws:
      com.lexmark.saperion.exceptions.EcmException
    • newClient

      SaperionClient newClient(String userName, 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, use newClient(String, String, LicenseEnumeration, String) instead.
      Parameters:
      userName - the name of the user
      password - the password of the user
      licenseType - 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(String userName, String password, com.lexmark.saperion.LicenseEnumeration licenseType, String tenant, 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 user
      password - the password of the user
      licenseType - the saperion license to use for the session
      tenant - the name of the tenant
      impersonatedUser - 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(String token, com.lexmark.saperion.LicenseEnumeration licenseType, 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 service
      licenseType - the saperion license to use for the session
      tenant - the name of the tenant
      Returns:
      a client in the context of the given credentials
      Throws:
      com.lexmark.saperion.exceptions.EcmException
    • changePassword

      SaperionClient changePassword(String userName, String oldPassword, String newPassword, com.lexmark.saperion.LicenseEnumeration licenseType, 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 user
      oldPassword - the current (possibly expired) password of the user
      newPassword - the new password of the user
      licenseType - the saperion license to use for the session
      tenant - 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(Map<String,String> properties)
      This static factory method uses the connector 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(Map<String,String> properties, ConnectorFactory connectorFactory)
      This factory method creates a new saperion client factory given an implementation of ConnectorFactory.
      Parameters:
      properties - configuration properties depending on the concrete service implementation
      connectorFactory - an implementation of ConnectorFactory instantiating the underlying low level api
      Returns:
      a new client factory