Class 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 Detail

      • 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_CREATE_ORIGINS

        public static final String COMMAND_CREATE_ORIGINS
        The Constant COMMAND_CREATE_ORIGINS.
        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
      • 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
      • exoBayeux

        protected final org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux
        The exo bayeux.
      • organization

        protected final org.exoplatform.services.organization.OrganizationService organization
        The organization.
      • identityRegistry

        protected final org.exoplatform.services.security.IdentityRegistry identityRegistry
        The identity registry.
      • callHandlers

        protected final ExecutorService callHandlers
        The call handlers.
    • 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 registry
        organization - the organization
        webConferencing - the web conferencing
        exoBayeux - the exo bayeux
        cacheService - the cache service
        callLogs - the call logs
    • Method Detail

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