Class CommonRestService

java.lang.Object
io.antmedia.console.rest.CommonRestService
Direct Known Subclasses:
RestServiceV2, SupportRestService

public class CommonRestService extends Object
  • Field Details

  • Constructor Details

    • CommonRestService

      public CommonRestService()
  • Method Details

    • getAllowedLoginAttempts

      public int getAllowedLoginAttempts()
    • addUser

      public Result addUser(User user)
      Add user account on db. Username must be unique, if there is a user with the same name, user will not be created userType = 0 means ready only account userType = 1 means read-write account Post method should be used. application/json form parameters - case sensitive "userName", "password", "userType
      Parameters:
      user - : The user to be added
      Returns:
      JSON data if user is added success will be true if user is not added success will be false if user is not added, errorId = 1 means username already exist
    • addInitialUser

      public Result addInitialUser(User user)
    • getHttpClient

      public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
    • sendUserInfo

      public boolean sendUserInfo(String email, String firstname, String lastname, String scope, String userType, Map<String,String> appNameUserTypeMap)
    • getWebAppsDirectory

      protected static String getWebAppsDirectory()
    • getTmpDirectory

      protected static String getTmpDirectory()
    • isFirstLogin

      public Result isFirstLogin()
    • authenticateUser

      public Result authenticateUser(User user)
      Authenticates user with userName and password
      Parameters:
      user - : The User object to be authenticated
      Returns:
      json that shows user is authenticated or not
    • deleteSession

      public Result deleteSession()
    • setRequestForTest

      public void setRequestForTest(jakarta.servlet.http.HttpServletRequest testRequest)
    • isAdmin

      public Result isAdmin()
    • editUser

      public Result editUser(User user)
    • deleteUser

      public Result deleteUser(String userName)
    • getUserList

      public List<User> getUserList()
    • changeUserPassword

      public Result changeUserPassword(User user)
    • changeUserPasswordInternal

      public Result changeUserPasswordInternal(String userMail, User user)
    • isAuthenticatedRest

      public Result isAuthenticatedRest()
    • isAuthenticated

      public static boolean isAuthenticated(jakarta.servlet.http.HttpSession session)
    • getSystemInfo

      public String getSystemInfo()
    • getJVMMemoryInfo

      public String getJVMMemoryInfo()
    • getSystemMemoryInfo

      public String getSystemMemoryInfo()
    • getFileSystemInfo

      public String getFileSystemInfo()
    • getCPUInfo

      public String getCPUInfo()
      getProcessCpuTime: microseconds CPU time used by the process getSystemCpuLoad: "% recent cpu usage" for the whole system. getProcessCpuLoad: "% recent cpu usage" for the Java Virtual Machine process.
      Returns:
      the CPU load info
    • getThreadDump

      public String getThreadDump()
    • getThreadDumpJSON

      public String getThreadDumpJSON()
    • getThreadsInfo

      public String getThreadsInfo()
    • getHeapDump

      public jakarta.ws.rs.core.Response getHeapDump()
    • getServerTime

      public String getServerTime()
      Return server uptime and startime in milliseconds
      Returns:
      JSON object contains the server uptime and start time
    • getSystemResourcesInfo

      public String getSystemResourcesInfo()
    • getGPUInfo

      public String getGPUInfo()
    • getVersion

      public String getVersion()
    • getApplications

      public String getApplications()
    • getLiveClientsSize

      public String getLiveClientsSize()
      Refactor name getTotalLiveStreamSize only return totalLiveStreamSize
      Returns:
      the number of live clients
    • getApplicationInfo

      public String getApplicationInfo()
    • getAppLiveStreams

      public String getAppLiveStreams(@PathParam("appname") String name)
      Refactor remove this function and use ProxyServlet to get this info Before deleting check web panel does not use it
      Parameters:
      name - : application name
      Returns:
      live streams in the application
    • deleteVoDStream

      public String deleteVoDStream(@PathParam("appname") String name, @FormParam("streamName") String streamName)
      Refactor remove this function and use ProxyServlet to get this info Before deleting check web panel does not use it
      Parameters:
      name - application name
      streamName - the stream name to be deleted
      Returns:
      operation value
    • changeSettings

      public String changeSettings(@PathParam("appname") String appname, AppSettings newSettings)
    • getShutdownStatus

      public boolean getShutdownStatus(@QueryParam("appNames") String appNamesArray)
    • getAppAdaptor

      public AntMediaApplicationAdapter getAppAdaptor(String appName)
    • isShutdownProperly

      public jakarta.ws.rs.core.Response isShutdownProperly(@QueryParam("appNames") String appNamesArray)
    • setShutdownStatus

      public boolean setShutdownStatus(@QueryParam("appNames") String appNamesArray)
    • extractFQDN

      public static String extractFQDN(String domainName)
    • configureSsl

      public Result configureSsl(String domainName, String type, InputStream fullChainFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition fullChainFileDetail, InputStream privateKeyFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition privateKeyFileDetail, InputStream chainFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition chainFileDetail)
    • getSSLConfigurationType

      private SslConfigurationType getSSLConfigurationType(String type)
    • isCustomCertificateParamsValid

      private boolean isCustomCertificateParamsValid(InputStream fullChainFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition fullChainFileDetail, InputStream privateKeyFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition privateKeyFileDetail, InputStream chainFile, org.glassfish.jersey.media.multipart.FormDataContentDisposition chainFileDetail)
    • prepareCertificateFiles

      private Result prepareCertificateFiles(InputStream fullChainFile, File fullChainOutputFile, InputStream privateKeyFile, File privateKeyOutputFile, InputStream chainFile, File chainOutputFile)
    • deleteSSLTempDirIfExists

      private void deleteSSLTempDirIfExists(File sslTempDir)
    • changeServerSettings

      public String changeServerSettings(ServerSettings serverSettings)
    • isEnterpriseEdition

      public Result isEnterpriseEdition()
    • getSettings

      public AppSettings getSettings(String appname)
    • getStatsCollector

      public IStatsCollector getStatsCollector()
    • getServerSettings

      public ServerSettings getServerSettings()
    • getLicenceStatus

      public Licence getLicenceStatus(@QueryParam("key") String key)
    • getLicenceStatus

      public Licence getLicenceStatus()
    • resetBroadcast

      public Result resetBroadcast(@PathParam("appname") String appname)
      This method resets the viewers counts and broadcast status in the db. This should be used to recover db after server crashes. It's not intended to use to ignore the crash
      Parameters:
      appname - the application name that broadcasts will be reset
      Returns:
    • setDataStore

      public void setDataStore(AbstractConsoleDataStore dataStore)
    • getDataStore

      public AbstractConsoleDataStore getDataStore()
    • getContext

      public WebApplicationContext getContext()
    • getServerSettingsInternal

      public ServerSettings getServerSettingsInternal()
    • getLicenceServiceInstance

      public ILicenceService getLicenceServiceInstance()
    • getApplication

      public AdminApplication getApplication()
    • getDataStoreFactory

      public ConsoleDataStoreFactory getDataStoreFactory()
    • setDataStoreFactory

      public void setDataStoreFactory(ConsoleDataStoreFactory dataStoreFactory)
    • isInClusterMode

      public Result isInClusterMode()
    • changeLogSettings

      public String changeLogSettings(@PathParam("level") String logLevel)
    • currentLevelDetect

      public ch.qos.logback.classic.Level currentLevelDetect(String logLevel)
    • getLogFile

      public String getLogFile(@PathParam("charSize") int charSize, @QueryParam("logType") String logType, @PathParam("offsetSize") long offsetSize) throws IOException
      Throws:
      IOException
    • getMD5Hash

      public String getMD5Hash(String pass)
    • createApplication

      public Result createApplication(String appName, InputStream inputStream)
    • updateAppStatus

      private void updateAppStatus(String appName, String status)
    • deleteApplication

      public Result deleteApplication(String appName, boolean deleteDB)
    • isClusterMode

      public boolean isClusterMode()
    • getBlockedStatus

      public Result getBlockedStatus(String usermail)