Class EssServerImpl

java.lang.Object
com.appliedolap.essbase.AbstractEssObject
com.appliedolap.essbase.impl.EssServerImpl
All Implemented Interfaces:
EssObject, EssServer

public class EssServerImpl extends AbstractEssObject implements EssServer
Server connection. This object is the general starting point for working with the Essbase REST API client library. See the main constructor EssServerImpl(String, String, String) for information on instantiating.
  • Constructor Details

    • EssServerImpl

      public EssServerImpl(String server, String username, String password)
      Creates a new server connection object. At present, the server path is assumed to be in the exact format such as: .... In other words, this class will currently not try to prepend or append any information such as the protocol, port, or REST path. Note that if using HTTPS without a valid cert, you may encounter PKIX errors. Note: SSL verification is currently turned off.
      Parameters:
      server - the server REST API path
      username - the username
      password - the password
    • EssServerImpl

      public EssServerImpl(String server, EssAuthentication authentication)
      Connects using the given authentication strategy, which need not be a username and password - see EssAuthentication. The way in for a session established elsewhere, such as by a user signing in through an external identity provider.
      Parameters:
      server - the server REST API path
      authentication - how to authenticate
    • EssServerImpl

      public EssServerImpl(EssServerConnectionDetailsImpl connectionDetails)
  • Method Details

    • getApiSpec

      public EssApiSpec getApiSpec()
      Description copied from interface: EssServer
      The server's own OpenAPI/Swagger definition of its REST API.

      Where it lives depends on the release, which is the reason this exists rather than callers building the URL themselves: 21.7 serves a Swagger 2.0 document at /rest/v1/swagger.json and answers 404 for openapi.json, while 26.1 serves an OpenAPI 3.0.1 document at /rest/v1/openapi.json and answers 404 for swagger.json. Asking for the wrong one is not a soft failure - it is a 404 - so the candidates are tried in turn.

      Specified by:
      getApiSpec in interface EssServer
    • getInstanceDetails

      public Map<String,Object> getInstanceDetails()
      Description copied from interface: EssServer
      Everything the server reports about this deployment, exactly as it reports it.

      Deliberately untyped, unlike EssServer.getAboutInstance(). This endpoint is a bag of capability flags describing one deployment, and which flags exist varies by version: 21.7 answers with idcs and provisioningSupported, while 26.1 answers with ten fields including a split of that one into service- and application-role provisioning, several AI feature flags, and a logout URL. A generated model pins the field names at whatever the spec said when it was generated and silently discards the rest, so against a newer server the typed view goes empty precisely when the server has more to say. A map cannot go out of date that way.

      Values are left as the server sent them - booleans stay booleans - so a caller can test a flag as well as display it. idcs is the interesting one: it says the deployment authenticates through Oracle's identity service, which is what makes a username and password useless for a federated user.

      Specified by:
      getInstanceDetails in interface EssServer
      Returns:
      the fields the server returned, in the order it returned them
    • getAuthentication

      public EssAuthentication getAuthentication()
      Description copied from interface: EssServer
      How this connection authenticates, so that code outside the generated client can present the same identity - a download bypass, or a local proxy standing in front of the server's own web pages.

      Returns the live strategy rather than a snapshot: ask it for headers at the moment of the request, because a session-based strategy's answer changes once a session is established, and again once it is signed off.

      Specified by:
      getAuthentication in interface EssServer
    • signOff

      public void signOff()
      Description copied from interface: EssServer
      Ends this client's own session on the server.

      Distinct from EssServer.killSessions(boolean), which ends other people's. This is signing off: the session this client established stops being valid, and the server stops holding it.

      What happens next depends on how this connection authenticates. With a username and password, the next call simply authenticates again and gets a fresh session. With a session supplied from outside - a federated sign-in, say - there is nothing to fall back to and subsequent calls will be rejected, which is precisely what signing off means in that case.

      Specified by:
      signOff in interface EssServer
    • getSessionExpiry

      public Optional<Instant> getSessionExpiry()
      Description copied from interface: EssServer
      When this client's session expires, if the server has said. Empty when there is no session, or when the session was supplied from outside rather than established here - the expiry is reported alongside the session, so only the client that established it hears about it.
      Specified by:
      getSessionExpiry in interface EssServer
    • getName

      public String getName()
      Description copied from interface: EssObject
      Gets the name of this object. This will generally be the "nice" and "unique" name of this object, such as the application name, cube, member, variable, or whatever.
      Specified by:
      getName in interface EssObject
      Specified by:
      getName in interface EssServer
      Returns:
      the simple name of this object
    • getType

      public EssObject.Type getType()
      Description copied from interface: EssObject
      Gets the type of this object.
      Specified by:
      getType in interface EssObject
      Specified by:
      getType in interface EssServer
      Returns:
      the object type
    • getApplications

      public List<EssApplication> getApplications()
      Description copied from interface: EssServer
      Fetch the list of applications available on the server for the currently connected user. The number of returned applications is limited to 1000 (the value of EssServer.MAX_APPLICATIONS).
      Specified by:
      getApplications in interface EssServer
      Returns:
      a list of applications
    • getApplication

      public EssApplicationImpl getApplication(String applicationName)
      Description copied from interface: EssServer
      Gets an application with the given name
      Specified by:
      getApplication in interface EssServer
      Parameters:
      applicationName - the application name
      Returns:
      an application object for the application
    • getFiles

      public List<EssFile> getFiles()
      Description copied from interface: EssServer
      Gets the list of files available through the files API. The returned files may include folders.
      Specified by:
      getFiles in interface EssServer
      Returns:
      the list of files on this server
    • getFile

      public EssFile getFile(String path, String filename)
      Description copied from interface: EssServer
      Gets a file using the specified path and name.
      Specified by:
      getFile in interface EssServer
      Parameters:
      path - the path to the file, such as gallery/Applications/Demo Samples/Block Storage
      filename - the name of the file, such as Sample_Basic.xlsx
      Returns:
      the file if it exists, null otherwise
    • getSessions

      public List<EssSession> getSessions()
      Specified by:
      getSessions in interface EssServer
    • killSessions

      public void killSessions(boolean logoff)
      Description copied from interface: EssServer
      Kill all sessions on the server.
      Specified by:
      killSessions in interface EssServer
      Parameters:
      logoff - true to also log them off
    • killSessions

      public void killSessions(String userId, boolean logoff)
      Description copied from interface: EssServer
      Kill all sessions on the server for the given user.
      Specified by:
      killSessions in interface EssServer
      Parameters:
      userId - the user ID
      logoff - true to also log them off
    • getHomePath

      public EssFolder getHomePath()
      Description copied from interface: EssServer
      Gets the home path of the currently connected user. The value of the home path is returned by a REST API call (curiously, one that returns plaintext instead of JSON but whatever). The value is ostensibly /users/ followed by the name of the connected user (e.g. /users/admin).
      Specified by:
      getHomePath in interface EssServer
      Returns:
      a folder object for the user's home path
    • getUtilities

      public List<EssUtility> getUtilities()
      Description copied from interface: EssServer
      Gets the list of utilities on this server.
      Specified by:
      getUtilities in interface EssServer
      Returns:
      the server utilities
    • getJobs

      public List<EssJob> getJobs()
      Description copied from interface: EssServer
      Gets the list of jobs on this server.
      Specified by:
      getJobs in interface EssServer
      Returns:
      the list of jobs
    • getGroups

      public List<EssGroup> getGroups()
      Description copied from interface: EssServer
      Gets a list of groups on this server
      Specified by:
      getGroups in interface EssServer
      Returns:
      the list of groups
    • getVariables

      public List<EssVariable> getVariables()
      Description copied from interface: EssServer
      Gets server-scoped variables.
      Specified by:
      getVariables in interface EssServer
      Returns:
      the server-wide variables
    • createVariable

      public void createVariable(String name, String value)
      Description copied from interface: EssServer
      Creates a new server-wide variable with the given name and value.
      Specified by:
      createVariable in interface EssServer
      Parameters:
      name - the name of the variable
      value - the value of the variable
    • getAbout

      public EssServerImpl.About getAbout()
      Description copied from interface: EssServer
      Gets the "about" information for this server.
      Specified by:
      getAbout in interface EssServer
      Returns:
      the server about info
    • getAboutInstance

      public EssServerImpl.AboutInstance getAboutInstance()
      Specified by:
      getAboutInstance in interface EssServer
    • createApplication

      public void createApplication(String applicationName, String databaseName)
      Description copied from interface: EssServer
      Creates an application (and a database) with the given names. While we tend to historically think of Essbase as employing the concept of an application containing one or more databases/cubes, most of the operations in the REST API are centered around actions you do on a particular cube, and in cases like these where you are creating a cube, there is no separate application creation step, it just gets created or re-used as the case may be.

      The default database creation options will be BSO cube with scenarios and duplicates turned off. For more granular control of the created database type, use EssServer.createApplication(String, String, EssServerImpl.DatabaseCreateOptions).

      Specified by:
      createApplication in interface EssServer
      Parameters:
      applicationName - the application name
      databaseName - the database name
    • createApplication

      public void createApplication(String applicationName, String databaseName, EssServerImpl.DatabaseCreateOptions databaseCreateOptions)
      Description copied from interface: EssServer
      Create an application/database with the given name and options.
      Specified by:
      createApplication in interface EssServer
      Parameters:
      applicationName - the name of the application
      databaseName - the name of the database/cube
      databaseCreateOptions - the database creation options
    • createApplicationFromWorkbook

      public EssJob createApplicationFromWorkbook(String application, String database, EssFile file)
      Description copied from interface: EssServer
      Creates or updates an application from an uploaded workbook.
      Specified by:
      createApplicationFromWorkbook in interface EssServer
      Parameters:
      application - the application
      database - the cube/database
      file - the XLSX file
      Returns:
      a new job for the creation process
    • getURLs

      public List<EssURL> getURLs()
      Description copied from interface: EssServer
      Returns the list of URLs known to this server. Generally speaking this seems to be the URL for the Jet UI, REST API, XMLA provider, and some others.
      Specified by:
      getURLs in interface EssServer
      Returns:
      list of URLs from the corresponding API
    • getDataSources

      public List<EssDataSource> getDataSources()
      Description copied from interface: EssServer
      Get the list of global data sources defined on the server.
      Specified by:
      getDataSources in interface EssServer
      Returns:
      list of global data sources
    • getDataSource

      public EssDataSource getDataSource(String dataSourceName)
      Description copied from interface: EssServer
      Get the data source with the given name. Will throw NoSuchEssbaseObjectException if there is no data source with that name.
      Specified by:
      getDataSource in interface EssServer
      Parameters:
      dataSourceName - the data source name
      Returns:
      the data source with that name
    • streamDataSource

      public void streamDataSource(String query, boolean includeHeaders, String delimiter, Map<String,Object> params, OutputStream outputStream)
      Description copied from interface: EssServer
      Calls the global data source endpoint to execute a query against a data source with the given parameters.
      Specified by:
      streamDataSource in interface EssServer
      Parameters:
      query - the query
      includeHeaders - whether to include headers in the result
      delimiter - the delimiter (currently only space and tab are supported by the server, you can use constants in EssDataSourceImpl for convenience)
      params - the parameters, if any. If none, supply an empty map
      outputStream - the output stream to write results to