Class OMAGServerPlatformInstanceMap

java.lang.Object
org.odpi.openmetadata.commonservices.multitenant.OMAGServerPlatformInstanceMap

public class OMAGServerPlatformInstanceMap extends Object
OMAGServerPlatformInstanceMap provides part of the mapping for inbound REST requests to the appropriate service instances for the requested server. It manages the server name to server instance mapping. The map is maintained in a static, so it is scoped to the class loader.

Instances of this class call the synchronized static methods to work with the map.
  • Constructor Details

    • OMAGServerPlatformInstanceMap

      public OMAGServerPlatformInstanceMap()
      Constructor for instances - used by service instances to get access to the platform map
  • Method Details

    • getPlatformOrigin

      public static String getPlatformOrigin(String userId) throws UserNotAuthorizedException
      Return the platform origin string
      Parameters:
      userId - calling user
      Throws:
      UserNotAuthorizedException - calling user not allowed to use these services
    • getPlatformOrigin

      public static String getPlatformOrigin()
      Return the platform origin string
    • getOrganizationName

      public static String getOrganizationName(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the organization name
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Throws:
      UserNotAuthorizedException - calling user not allowed to use these services
    • setOrganizationName

      public static void setOrganizationName(String serverPlatformOrganizationName)
      Set up the organization name
    • validateUserAsInvestigatorForPlatform

      public static void validateUserAsInvestigatorForPlatform(String userId) throws UserNotAuthorizedException
      Verify that the calling user is allowed to query the platform services.
      Parameters:
      userId - calling user
      Throws:
      UserNotAuthorizedException - calling user not allowed to use these services
    • validateUserAsOperatorForPlatform

      public static void validateUserAsOperatorForPlatform(String userId) throws UserNotAuthorizedException
      Check that the calling user is authorized to issue operator requests to the OMAG Server Platform.
      Parameters:
      userId - calling user
      Throws:
      UserNotAuthorizedException - the user is not authorized to issue operator commands to this platform
    • getServerPlatformOrigin

      public String getServerPlatformOrigin() throws UserNotAuthorizedException
      Return the origin of this server platform implementation.
      Returns:
      String description
      Throws:
      UserNotAuthorizedException
    • getServerPlatformOrganizationName

      public String getServerPlatformOrganizationName(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the name of the organization running this platform.
      Parameters:
      userId - name of the user making the request
      delegatingUserId - external userId making request
      Returns:
      String description
      Throws:
      UserNotAuthorizedException
    • setServerPlatformOrganizationName

      public void setServerPlatformOrganizationName(String organizationName)
      Set up the name of the organization running this platform.
      Parameters:
      organizationName - name of the owning organization
    • getRegisteredAccessServices

      public List<RegisteredOMAGService> getRegisteredAccessServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of access services that are registered (supported) in this OMAG Server Platform and can be configured in a metadata access point or metadata server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of access service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getRegisteredEngineServices

      public List<RegisteredOMAGService> getRegisteredEngineServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of engine services that are registered (supported) in this OMAG Server Platform and can be configured in an engine hosting OMAG server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of engine service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getRegisteredViewServices

      public List<RegisteredOMAGService> getRegisteredViewServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of view services that are registered (supported) in this OMAG Server Platform and can be configured in a view server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of view service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getRegisteredGovernanceServices

      public List<RegisteredOMAGService> getRegisteredGovernanceServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of governance services that are registered (supported) in this OMAG Server Platform and can be configured as part of a governance server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of governance service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getRegisteredCommonServices

      public List<RegisteredOMAGService> getRegisteredCommonServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of common services that are registered (supported) in this OMAG Server Platform and can be configured as part of a server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getAllRegisteredServices

      public List<RegisteredOMAGService> getAllRegisteredServices(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of services that are registered (supported) in this OMAG Server Platform and can be configured as part of a server.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of service descriptions
      Throws:
      UserNotAuthorizedException - user not authorized
    • getServerType

      public String getServerType(String userId, String serverName, String serviceOperationName) throws InvalidParameterException, UserNotAuthorizedException
      Return the type of server.
      Parameters:
      userId - calling user or null if it is an anonymous request
      serverName - name of the server
      serviceOperationName - name of the calling method/request
      Returns:
      string name
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getServerStatus

      public ServerStatus getServerStatus(String userId, String delegatingUserId, String serverName, String serviceOperationName) throws InvalidParameterException, UserNotAuthorizedException
      Return the type of server.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      serviceOperationName - name of the calling method/request
      Returns:
      server status
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • isServerActive

      public boolean isServerActive(String userId, String delegatingUserId, String serverName) throws UserNotAuthorizedException
      Return whether a particular server is active (running) in the platform. This is used by the admin services when no instance is not an error.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      boolean
      Throws:
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • isServerKnown

      public boolean isServerKnown(String userId, String delegatingUserId, String serverName) throws UserNotAuthorizedException
      Return whether a particular server is registered with the platform. This is used by the admin services when no instance is not an error.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      boolean
      Throws:
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getPlatformStartTime

      public Date getPlatformStartTime(String userId, String delegatingUserId) throws InvalidParameterException, UserNotAuthorizedException
      Return the time this platform started.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      Returns:
      start time
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getServerStartTime

      public Date getServerStartTime(String userId, String delegatingUserId, String serverName) throws InvalidParameterException, UserNotAuthorizedException
      Return the time this server instance last started.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      start time
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getServerEndTime

      public Date getServerEndTime(String userId, String delegatingUserId, String serverName) throws InvalidParameterException, UserNotAuthorizedException
      Return the time this server instance last ended (or null if it is still running).
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      end time or null
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getServerHistory

      public List<OMAGServerInstanceHistory> getServerHistory(String userId, String delegatingUserId, String serverName) throws InvalidParameterException, UserNotAuthorizedException
      Return the time this server instance last started.
      Parameters:
      userId - calling user or null if it is an anonymous request
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      start time
      Throws:
      InvalidParameterException - the serverName is not known.
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • startUpServerInstance

      public OpenMetadataServerSecurityVerifier startUpServerInstance(String localServerUserId, String serverName, AuditLog auditLog, Connection connection) throws InvalidParameterException
      Start up the server with the requested security.
      Parameters:
      localServerUserId - userId for local server
      serverName - name of the server
      auditLog - logging destination
      connection - connection properties for open metadata security connector for server (can be null for no security)
      Returns:
      OpenMetadataServerSecurityVerifier object
      Throws:
      InvalidParameterException - the connection is invalid
    • shutdownServerInstance

      public void shutdownServerInstance(String userId, String serverName, String methodName) throws InvalidParameterException, PropertyServerException
      Shutdown the server instance. This is called once all services have been shutdown.
      Parameters:
      userId - calling user
      serverName - name of the unknown server
      methodName - calling method
      Throws:
      InvalidParameterException - server name is not known
      PropertyServerException - server still has active services - logic error
    • getActiveServerList

      public List<String> getActiveServerList(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of OMAG Servers running in this OMAG Server Platform.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of OMAG server names
      Throws:
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getKnownServerList

      public List<String> getKnownServerList(String userId, String delegatingUserId) throws UserNotAuthorizedException
      Return the list of OMAG Servers that have run or are running in this OMAG Server Platform.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      Returns:
      list of OMAG server names
      Throws:
      UserNotAuthorizedException - the user is not authorized to issue the request.
    • getActiveServicesForServer

      public List<String> getActiveServicesForServer(String userId, String delegatingUserId, String serverName) throws InvalidParameterException, UserNotAuthorizedException
      Return the list of services running in an OMAG Server that is running on this OMAG Server Platform.
      Parameters:
      userId - calling user
      delegatingUserId - external userId making request
      serverName - name of the server
      Returns:
      list on OMAG Services
      Throws:
      InvalidParameterException - the server name is not known
      UserNotAuthorizedException - the user is not authorized to issue the request.