Package io.antmedia.console.rest
Class CommonRestService
java.lang.Object
io.antmedia.console.rest.CommonRestService
- Direct Known Subclasses:
RestServiceV2
,SupportRestService
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
protected ApplicationContext
private static final int
private AbstractConsoleDataStore
private ConsoleDataStoreFactory
private static final String
private static final String
(package private) com.google.gson.Gson
static final String
private ILicenceService
static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
protected static final org.slf4j.Logger
static final String
private static final int
static final String
private static final String
static final String
private static final String
static final String
private ServerSettings
private jakarta.servlet.ServletContext
private jakarta.servlet.http.HttpServletRequest
static final String
private IStatsCollector
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInitialUser
(User user) Add user account on db.authenticateUser
(User user) Authenticates user with userName and passwordchangeLogSettings
(String logLevel) changeServerSettings
(ServerSettings serverSettings) changeSettings
(String appname, AppSettings newSettings) changeUserPassword
(User user) changeUserPasswordInternal
(String userMail, User user) 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) createApplication
(String appName, InputStream inputStream) ch.qos.logback.classic.Level
currentLevelDetect
(String logLevel) deleteApplication
(String appName, boolean deleteDB) private void
deleteSSLTempDirIfExists
(File sslTempDir) deleteUser
(String userName) deleteVoDStream
(String name, String streamName) Refactor remove this function and use ProxyServlet to get this info Before deleting check web panel does not use itstatic String
extractFQDN
(String domainName) int
getAppAdaptor
(String appName) getAppLiveStreams
(String name) Refactor remove this function and use ProxyServlet to get this info Before deleting check web panel does not use itgetBlockedStatus
(String usermail) getProcessCpuTime: microseconds CPU time used by the process getSystemCpuLoad: "% recent cpu usage" for the whole system.jakarta.ws.rs.core.Response
org.apache.http.impl.client.CloseableHttpClient
getLicenceStatus
(String key) Refactor name getTotalLiveStreamSize only return totalLiveStreamSizegetLogFile
(int charSize, String logType, long offsetSize) getMD5Hash
(String pass) Return server uptime and startime in millisecondsgetSettings
(String appname) boolean
getShutdownStatus
(String appNamesArray) private SslConfigurationType
protected static String
protected static String
isAdmin()
static boolean
isAuthenticated
(jakarta.servlet.http.HttpSession session) boolean
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) jakarta.ws.rs.core.Response
isShutdownProperly
(String appNamesArray) private Result
prepareCertificateFiles
(InputStream fullChainFile, File fullChainOutputFile, InputStream privateKeyFile, File privateKeyOutputFile, InputStream chainFile, File chainOutputFile) resetBroadcast
(String appname) This method resets the viewers counts and broadcast status in the db.boolean
sendUserInfo
(String email, String firstname, String lastname, String scope, String userType, Map<String, String> appNameUserTypeMap) void
setDataStore
(AbstractConsoleDataStore dataStore) void
setDataStoreFactory
(ConsoleDataStoreFactory dataStoreFactory) void
setRequestForTest
(jakarta.servlet.http.HttpServletRequest testRequest) boolean
setShutdownStatus
(String appNamesArray) private void
updateAppStatus
(String appName, String status)
-
Field Details
-
LOG_TYPE_ERROR
- See Also:
-
FILE_NOT_EXIST
- See Also:
-
ERROR_LOG_LOCATION
- See Also:
-
SERVER_LOG_LOCATION
- See Also:
-
LOG_CONTENT
- See Also:
-
LOG_CONTENT_SIZE
- See Also:
-
LOG_FILE_SIZE
- See Also:
-
MAX_CHAR_SIZE
private static final int MAX_CHAR_SIZE- See Also:
-
LOG_LEVEL_ALL
- See Also:
-
LOG_LEVEL_TRACE
- See Also:
-
LOG_LEVEL_DEBUG
- See Also:
-
LOG_LEVEL_INFO
- See Also:
-
LOG_LEVEL_WARN
- See Also:
-
LOG_LEVEL_ERROR
- See Also:
-
LOG_LEVEL_OFF
- See Also:
-
USER_PASSWORD
- See Also:
-
USER_EMAIL
- See Also:
-
IS_AUTHENTICATED
- See Also:
-
SERVER_NAME
- See Also:
-
LICENSE_KEY
- See Also:
-
MARKET_BUILD
- See Also:
-
NODE_GROUP
- See Also:
-
gson
com.google.gson.Gson gson -
dataStore
-
LOG_LEVEL
- See Also:
-
RED5_PROPERTIES_PATH
- See Also:
-
logger
protected static final org.slf4j.Logger logger -
LICENSE_STATUS
- See Also:
-
applicationContext
-
servletContext
@Context private jakarta.servlet.ServletContext servletContext -
servletRequest
@Context private jakarta.servlet.http.HttpServletRequest servletRequest -
dataStoreFactory
-
serverSettings
-
licenceService
-
statsCollector
-
BLOCKED_LOGIN_TIMEOUT_SECS
private static final int BLOCKED_LOGIN_TIMEOUT_SECS- See Also:
-
ALLOWED_LOGIN_ATTEMPTS
private static final int ALLOWED_LOGIN_ATTEMPTS- See Also:
-
SESSION_SCOPE_KEY
- See Also:
-
USER_TYPE
- See Also:
-
SCOPE_SYSTEM
- See Also:
-
-
Constructor Details
-
CommonRestService
public CommonRestService()
-
-
Method Details
-
getAllowedLoginAttempts
public int getAllowedLoginAttempts() -
addUser
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
-
getHttpClient
public org.apache.http.impl.client.CloseableHttpClient getHttpClient() -
sendUserInfo
-
getWebAppsDirectory
-
getTmpDirectory
-
isFirstLogin
-
authenticateUser
Authenticates user with userName and password- Parameters:
user
- : The User object to be authenticated- Returns:
- json that shows user is authenticated or not
-
deleteSession
-
setRequestForTest
public void setRequestForTest(jakarta.servlet.http.HttpServletRequest testRequest) -
isAdmin
-
editUser
-
deleteUser
-
getUserList
-
changeUserPassword
-
changeUserPasswordInternal
-
isAuthenticatedRest
-
isAuthenticated
public static boolean isAuthenticated(jakarta.servlet.http.HttpSession session) -
getSystemInfo
-
getJVMMemoryInfo
-
getSystemMemoryInfo
-
getFileSystemInfo
-
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
-
getThreadDumpJSON
-
getThreadsInfo
-
getHeapDump
public jakarta.ws.rs.core.Response getHeapDump() -
getServerTime
Return server uptime and startime in milliseconds- Returns:
- JSON object contains the server uptime and start time
-
getSystemResourcesInfo
-
getGPUInfo
-
getVersion
-
getApplications
-
getLiveClientsSize
Refactor name getTotalLiveStreamSize only return totalLiveStreamSize- Returns:
- the number of live clients
-
getApplicationInfo
-
getAppLiveStreams
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 namestreamName
- the stream name to be deleted- Returns:
- operation value
-
changeSettings
-
getShutdownStatus
-
getAppAdaptor
-
isShutdownProperly
-
setShutdownStatus
-
extractFQDN
-
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
-
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
-
changeServerSettings
-
isEnterpriseEdition
-
getSettings
-
getStatsCollector
-
getServerSettings
-
getLicenceStatus
-
getLicenceStatus
-
resetBroadcast
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
-
getDataStore
-
getContext
-
getServerSettingsInternal
-
getLicenceServiceInstance
-
getApplication
-
getDataStoreFactory
-
setDataStoreFactory
-
isInClusterMode
-
changeLogSettings
-
currentLevelDetect
-
getLogFile
public String getLogFile(@PathParam("charSize") int charSize, @QueryParam("logType") String logType, @PathParam("offsetSize") long offsetSize) throws IOException - Throws:
IOException
-
getMD5Hash
-
createApplication
-
updateAppStatus
-
deleteApplication
-
isClusterMode
public boolean isClusterMode() -
getBlockedStatus
-