Class CometdWebConferencingService
- java.lang.Object
-
- org.exoplatform.webconferencing.cometd.CometdWebConferencingService
-
- All Implemented Interfaces:
org.picocontainer.Startable
public class CometdWebConferencingService extends Object implements org.picocontainer.Startable
Created by The eXo Platform SAS.- Version:
- $Id: CometdWebConferencingService.java 00000 Aug 17, 2017 pnedonosko $
- Author:
- Peter Nedonosko
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCometdWebConferencingService.CallEventProxyThe Class CallEventProxy.static classCometdWebConferencingService.CallParticipantEventThe Class CallParticipantEvent (joined and leaved participant).classCometdWebConferencingService.CallServiceThe Class CallService.static classCometdWebConferencingService.CallStateEventThe Class CallStateEvent (started, stopped calls).static classCometdWebConferencingService.EventProxyThe Class CallEventProxy.static classCometdWebConferencingService.UserCallProxyThe Class UserCallProxy.
-
Field Summary
Fields Modifier and Type Field Description static intCALL_MAX_FACTORMaximum threads per CPU for thread executors of user call channel.static intCALL_QUEUE_FACTORQueue size per CPU for thread executors of user call channel.static StringCALL_SUBSCRIPTION_CHANNEL_NAMEThe Constant CALL_SUBSCRIPTION_CHANNEL_NAME.static StringCALL_SUBSCRIPTION_CHANNEL_NAME_ALLThe Constant CALL_SUBSCRIPTION_CHANNEL_NAME_ALL.static StringCALL_SUBSCRIPTION_CHANNEL_NAME_PATTERNThe Constant CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN.static StringCALL_THREAD_PREFIXThread name used for calls executor.protected ExecutorServicecallHandlersThe call handlers.protected CallLogServicecallLogsThe call logs.static StringCALLS_CHANNEL_NAMEThe Constant CALLS_CHANNEL_NAME.static StringCOMMAND_ADD_GUESTThe Constant COMMAND_ADD_GUEST.static StringCOMMAND_CHECK_INVITEThe Constant COMMAND_CHECK_INVITE.static StringCOMMAND_CREATEThe Constant COMMAND_CREATE.static StringCOMMAND_CREATE_ORIGINSThe Constant COMMAND_CREATE_ORIGINS.static StringCOMMAND_DELETEThe Constant COMMAND_DELETE.static StringCOMMAND_GETThe Constant COMMAND_GET.static StringCOMMAND_GET_CALLS_STATEThe Constant COMMAND_GET_CALLS_STATE.static StringCOMMAND_GET_ORG_IDENTITIESThe Constant COMMAND_GET_ORG_IDENTITIES.static StringCOMMAND_UPDATEThe Constant COMMAND_UPDATE.static StringCOMMAND_UPDATE_INVITESThe Constant COMMAND_UPDATE_INVITES.static StringEVENT_CALL_JOINEDThe Constant EVENT_CALL_JOINED.static StringEVENT_CALL_LEAVEDThe Constant EVENT_CALL_LEAVED.static StringEVENT_CALL_STATEThe Constant EVENT_CALL_STATE.protected org.mortbay.cometd.continuation.EXoContinuationBayeuxexoBayeuxThe exo bayeux.protected org.exoplatform.services.security.IdentityRegistryidentityRegistryThe identity registry.static StringLOG_OKThe Constant LOG_OK.static StringLOGS_CHANNEL_NAMEThe Constant LOGS_CHANNEL_NAME.static intMIN_MAX_THREADSMinimal number of threads maximum possible for remote calls' thread executors.static intMIN_THREADSBase minimum number of threads for remote calls' thread executors.protected org.exoplatform.services.organization.OrganizationServiceorganizationThe organization.protected CometdWebConferencingService.CallServiceserviceThe service.static intTHREAD_IDLE_TIMEThread idle time for thread executors (in seconds).static StringUSER_CACHE_NAMEThe Constant USER_CACHE_NAME.static StringUSER_SUBSCRIPTION_CHANNEL_NAMEThe Constant USER_SUBSCRIPTION_CHANNEL_NAME.static StringUSER_SUBSCRIPTION_CHANNEL_PATTERNThe Constant USER_SUBSCRIPTION_CHANNEL_PATTERN.protected org.exoplatform.services.cache.ExoCache<String,CometdWebConferencingService.UserCallProxy>usersCacheCache of connected users.protected WebConferencingServicewebConferencingThe web conferencing.
-
Constructor Summary
Constructors Constructor Description CometdWebConferencingService(org.exoplatform.services.security.IdentityRegistry identityRegistry, org.exoplatform.services.organization.OrganizationService organization, WebConferencingService webConferencing, org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux, org.exoplatform.services.cache.CacheService cacheService, CallLogService callLogs)Instantiates a new CometD interaction service for WebConferencing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanasBoolean(Object obj)Return true if it's Boolean instance of TRUE or false if it is not.protected <T> List<T>asList(Object obj, Class<T> type)As list.protected StringasString(Object obj)Return object if it's String instance or null if it is not.protected StringcallId(String type, String info)Call id.protected StringchannelsAsString(Set<org.cometd.bayeux.server.ServerChannel> channels)Channels as string.protected StringchannelUserId(String channelId)Channel user id.protected ExecutorServicecreateThreadExecutor(String threadNamePrefix, int maxFactor, int queueFactor)Create a new thread executor service.protected StringcurrentUserId(org.cometd.bayeux.server.ServerMessage message)Current user id.StringgetCometdServerPath()Gets the cometd server path.StringgetUserToken(String userId)Gets the user token.protected List<InvitedIdentity>invitedIdentitiesFromJson(Object obj)Invited identities list.voidstart()voidstop()
-
-
-
Field Detail
-
CALLS_CHANNEL_NAME
public static final String CALLS_CHANNEL_NAME
The Constant CALLS_CHANNEL_NAME.- See Also:
- Constant Field Values
-
LOGS_CHANNEL_NAME
public static final String LOGS_CHANNEL_NAME
The Constant LOGS_CHANNEL_NAME.- See Also:
- Constant Field Values
-
CALL_SUBSCRIPTION_CHANNEL_NAME
public static final String CALL_SUBSCRIPTION_CHANNEL_NAME
The Constant CALL_SUBSCRIPTION_CHANNEL_NAME.- See Also:
- Constant Field Values
-
CALL_SUBSCRIPTION_CHANNEL_NAME_ALL
public static final String CALL_SUBSCRIPTION_CHANNEL_NAME_ALL
The Constant CALL_SUBSCRIPTION_CHANNEL_NAME_ALL.- See Also:
- Constant Field Values
-
CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN
public static final String CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN
The Constant CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN.- See Also:
- Constant Field Values
-
USER_SUBSCRIPTION_CHANNEL_NAME
public static final String USER_SUBSCRIPTION_CHANNEL_NAME
The Constant USER_SUBSCRIPTION_CHANNEL_NAME.- See Also:
- Constant Field Values
-
USER_SUBSCRIPTION_CHANNEL_PATTERN
public static final String USER_SUBSCRIPTION_CHANNEL_PATTERN
The Constant USER_SUBSCRIPTION_CHANNEL_PATTERN.- See Also:
- Constant Field Values
-
USER_CACHE_NAME
public static final String USER_CACHE_NAME
The Constant USER_CACHE_NAME.
-
COMMAND_GET
public static final String COMMAND_GET
The Constant COMMAND_GET.- See Also:
- Constant Field Values
-
COMMAND_CREATE
public static final String COMMAND_CREATE
The Constant COMMAND_CREATE.- See Also:
- Constant Field Values
-
COMMAND_CREATE_ORIGINS
public static final String COMMAND_CREATE_ORIGINS
The Constant COMMAND_CREATE_ORIGINS.- See Also:
- Constant Field Values
-
COMMAND_UPDATE
public static final String COMMAND_UPDATE
The Constant COMMAND_UPDATE.- See Also:
- Constant Field Values
-
COMMAND_DELETE
public static final String COMMAND_DELETE
The Constant COMMAND_DELETE.- See Also:
- Constant Field Values
-
COMMAND_ADD_GUEST
public static final String COMMAND_ADD_GUEST
The Constant COMMAND_ADD_GUEST.- See Also:
- Constant Field Values
-
COMMAND_UPDATE_INVITES
public static final String COMMAND_UPDATE_INVITES
The Constant COMMAND_UPDATE_INVITES.- See Also:
- Constant Field Values
-
COMMAND_CHECK_INVITE
public static final String COMMAND_CHECK_INVITE
The Constant COMMAND_CHECK_INVITE.- See Also:
- Constant Field Values
-
COMMAND_GET_CALLS_STATE
public static final String COMMAND_GET_CALLS_STATE
The Constant COMMAND_GET_CALLS_STATE.- See Also:
- Constant Field Values
-
COMMAND_GET_ORG_IDENTITIES
public static final String COMMAND_GET_ORG_IDENTITIES
The Constant COMMAND_GET_ORG_IDENTITIES.- See Also:
- Constant Field Values
-
EVENT_CALL_LEAVED
public static final String EVENT_CALL_LEAVED
The Constant EVENT_CALL_LEAVED.- See Also:
- Constant Field Values
-
EVENT_CALL_JOINED
public static final String EVENT_CALL_JOINED
The Constant EVENT_CALL_JOINED.- See Also:
- Constant Field Values
-
EVENT_CALL_STATE
public static final String EVENT_CALL_STATE
The Constant EVENT_CALL_STATE.- See Also:
- Constant Field Values
-
LOG_OK
public static final String LOG_OK
The Constant LOG_OK.- See Also:
- Constant Field Values
-
MIN_THREADS
public static final int MIN_THREADS
Base minimum number of threads for remote calls' thread executors.- See Also:
- Constant Field Values
-
MIN_MAX_THREADS
public static final int MIN_MAX_THREADS
Minimal number of threads maximum possible for remote calls' thread executors.- See Also:
- Constant Field Values
-
THREAD_IDLE_TIME
public static final int THREAD_IDLE_TIME
Thread idle time for thread executors (in seconds).- See Also:
- Constant Field Values
-
CALL_MAX_FACTOR
public static final int CALL_MAX_FACTOR
Maximum threads per CPU for thread executors of user call channel.- See Also:
- Constant Field Values
-
CALL_QUEUE_FACTOR
public static final int CALL_QUEUE_FACTOR
Queue size per CPU for thread executors of user call channel.- See Also:
- Constant Field Values
-
CALL_THREAD_PREFIX
public static final String CALL_THREAD_PREFIX
Thread name used for calls executor.- See Also:
- Constant Field Values
-
webConferencing
protected final WebConferencingService webConferencing
The web conferencing.
-
exoBayeux
protected final org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux
The exo bayeux.
-
service
protected final CometdWebConferencingService.CallService service
The service.
-
organization
protected final org.exoplatform.services.organization.OrganizationService organization
The organization.
-
identityRegistry
protected final org.exoplatform.services.security.IdentityRegistry identityRegistry
The identity registry.
-
callLogs
protected final CallLogService callLogs
The call logs.
-
callHandlers
protected final ExecutorService callHandlers
The call handlers.
-
usersCache
protected final org.exoplatform.services.cache.ExoCache<String,CometdWebConferencingService.UserCallProxy> usersCache
Cache of connected users.
-
-
Constructor Detail
-
CometdWebConferencingService
public CometdWebConferencingService(org.exoplatform.services.security.IdentityRegistry identityRegistry, org.exoplatform.services.organization.OrganizationService organization, WebConferencingService webConferencing, org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux, org.exoplatform.services.cache.CacheService cacheService, CallLogService callLogs)Instantiates a new CometD interaction service for WebConferencing.- Parameters:
identityRegistry- the identity registryorganization- the organizationwebConferencing- the web conferencingexoBayeux- the exo bayeuxcacheService- the cache servicecallLogs- the call logs
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()
- Specified by:
stopin interfaceorg.picocontainer.Startable
-
getCometdServerPath
public String getCometdServerPath()
Gets the cometd server path.- Returns:
- the cometd server path
-
getUserToken
public String getUserToken(String userId)
Gets the user token.- Parameters:
userId- the user id- Returns:
- the user token
-
currentUserId
protected String currentUserId(org.cometd.bayeux.server.ServerMessage message)
Current user id.- Parameters:
message- the message- Returns:
- the string, if user cannot be defined it will be
IdentityConstants.ANONIM
-
channelUserId
protected String channelUserId(String channelId) throws IndexOutOfBoundsException
Channel user id. It's assumed an user channelUSER_SUBSCRIPTION_CHANNEL_NAME.- Parameters:
channelId- the channel id- Returns:
- the string
- Throws:
IndexOutOfBoundsException- if channel id doesn't look like an user channel
-
channelsAsString
protected String channelsAsString(Set<org.cometd.bayeux.server.ServerChannel> channels)
Channels as string.- Parameters:
channels- the channels- Returns:
- the string
-
callId
protected String callId(String type, String info)
Call id.- Parameters:
type- the typeinfo- the id- Returns:
- the string
-
asString
protected String asString(Object obj)
Return object if it's String instance or null if it is not.- Parameters:
obj- the obj- Returns:
- the string or null
-
asBoolean
protected boolean asBoolean(Object obj)
Return true if it's Boolean instance of TRUE or false if it is not.- Parameters:
obj- the obj- Returns:
- the boolean
-
asList
protected <T> List<T> asList(Object obj, Class<T> type)
As list.- Type Parameters:
T- the generic type- Parameters:
obj- the objtype- the type- Returns:
- the list
-
invitedIdentitiesFromJson
protected List<InvitedIdentity> invitedIdentitiesFromJson(Object obj)
Invited identities list.- Parameters:
obj- the obj- Returns:
- the list
-
createThreadExecutor
protected ExecutorService createThreadExecutor(String threadNamePrefix, int maxFactor, int queueFactor)
Create a new thread executor service.- Parameters:
threadNamePrefix- the thread name prefixmaxFactor- - max processes per CPU corequeueFactor- - queue size per CPU core- Returns:
- the executor service
-
-