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
  • Field Details

    • CALLS_CHANNEL_NAME

      public static final String CALLS_CHANNEL_NAME
      The Constant CALLS_CHANNEL_NAME.
      See Also:
    • LOGS_CHANNEL_NAME

      public static final String LOGS_CHANNEL_NAME
      The Constant LOGS_CHANNEL_NAME.
      See Also:
    • CALL_SUBSCRIPTION_CHANNEL_NAME

      public static final String CALL_SUBSCRIPTION_CHANNEL_NAME
      The Constant CALL_SUBSCRIPTION_CHANNEL_NAME.
      See Also:
    • CALL_SUBSCRIPTION_CHANNEL_NAME_ALL

      public static final String CALL_SUBSCRIPTION_CHANNEL_NAME_ALL
      The Constant CALL_SUBSCRIPTION_CHANNEL_NAME_ALL.
      See Also:
    • CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN

      public static final String CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN
      The Constant CALL_SUBSCRIPTION_CHANNEL_NAME_PATTERN.
      See Also:
    • USER_SUBSCRIPTION_CHANNEL_NAME

      public static final String USER_SUBSCRIPTION_CHANNEL_NAME
      The Constant USER_SUBSCRIPTION_CHANNEL_NAME.
      See Also:
    • USER_SUBSCRIPTION_CHANNEL_PATTERN

      public static final String USER_SUBSCRIPTION_CHANNEL_PATTERN
      The Constant USER_SUBSCRIPTION_CHANNEL_PATTERN.
      See Also:
    • 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:
    • COMMAND_CREATE

      public static final String COMMAND_CREATE
      The Constant COMMAND_CREATE.
      See Also:
    • COMMAND_CREATE_ORIGINS

      public static final String COMMAND_CREATE_ORIGINS
      The Constant COMMAND_CREATE_ORIGINS.
      See Also:
    • COMMAND_UPDATE

      public static final String COMMAND_UPDATE
      The Constant COMMAND_UPDATE.
      See Also:
    • COMMAND_DELETE

      public static final String COMMAND_DELETE
      The Constant COMMAND_DELETE.
      See Also:
    • COMMAND_ADD_GUEST

      public static final String COMMAND_ADD_GUEST
      The Constant COMMAND_ADD_GUEST.
      See Also:
    • COMMAND_UPDATE_INVITES

      public static final String COMMAND_UPDATE_INVITES
      The Constant COMMAND_UPDATE_INVITES.
      See Also:
    • COMMAND_CHECK_INVITE

      public static final String COMMAND_CHECK_INVITE
      The Constant COMMAND_CHECK_INVITE.
      See Also:
    • COMMAND_GET_CALLS_STATE

      public static final String COMMAND_GET_CALLS_STATE
      The Constant COMMAND_GET_CALLS_STATE.
      See Also:
    • COMMAND_GET_ORG_IDENTITIES

      public static final String COMMAND_GET_ORG_IDENTITIES
      The Constant COMMAND_GET_ORG_IDENTITIES.
      See Also:
    • EVENT_CALL_LEAVED

      public static final String EVENT_CALL_LEAVED
      The Constant EVENT_CALL_LEAVED.
      See Also:
    • EVENT_CALL_JOINED

      public static final String EVENT_CALL_JOINED
      The Constant EVENT_CALL_JOINED.
      See Also:
    • EVENT_CALL_STATE

      public static final String EVENT_CALL_STATE
      The Constant EVENT_CALL_STATE.
      See Also:
    • LOG_OK

      public static final String LOG_OK
      The Constant LOG_OK.
      See Also:
    • MIN_THREADS

      public static final int MIN_THREADS
      Base minimum number of threads for remote calls' thread executors.
      See Also:
    • MIN_MAX_THREADS

      public static final int MIN_MAX_THREADS
      Minimal number of threads maximum possible for remote calls' thread executors.
      See Also:
    • THREAD_IDLE_TIME

      public static final int THREAD_IDLE_TIME
      Thread idle time for thread executors (in seconds).
      See Also:
    • CALL_MAX_FACTOR

      public static final int CALL_MAX_FACTOR
      Maximum threads per CPU for thread executors of user call channel.
      See Also:
    • CALL_QUEUE_FACTOR

      public static final int CALL_QUEUE_FACTOR
      Queue size per CPU for thread executors of user call channel.
      See Also:
    • CALL_THREAD_PREFIX

      public static final String CALL_THREAD_PREFIX
      Thread name used for calls executor.
      See Also:
    • webConferencing

      protected final WebConferencingService webConferencing
      The web conferencing.
    • exoBayeux

      protected final org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux
      The exo bayeux.
    • 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 Details

    • 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 registry
      organization - the organization
      webConferencing - the web conferencing
      exoBayeux - the exo bayeux
      cacheService - the cache service
      callLogs - the call logs
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface org.picocontainer.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.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 channel USER_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 type
      info - 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 obj
      type - 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 prefix
      maxFactor - - max processes per CPU core
      queueFactor - - queue size per CPU core
      Returns:
      the executor service