Package org.exoplatform.webconferencing
Class WebConferencingService
java.lang.Object
org.exoplatform.webconferencing.WebConferencingService
- All Implemented Interfaces:
org.picocontainer.Startable
Created by The eXo Platform SAS.
- Version:
- $Id: SkypeService.java 00000 Feb 22, 2017 pnedonosko $
- Author:
- Peter Nedonosko
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresent Chat room in calls.classRepresent Space event call.classRepresent Space in calls. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe Constant ALL_USERS.static final intThe Constant ARG_MAX_LENGTH.protected final org.exoplatform.services.security.AuthenticatorThe authenticator.protected static final StringThe Constant CALL_ID_SCOPE_NAME.protected static final StringThe Constant CALL_OWNER_SCOPE_NAME.protected final CallDAOThe calls storage.static final StringThe Constant CMS_GROUPS_PATH.static final intThe Constant DATA_MAX_LENGTH.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringThe Constant EXO_RSS_ENABLE_PROP.static final StringThe Constant EXO_TITLE_PROP.static final StringThe Constant GROUP.static final intThe Constant ID_MAX_LENGTH.protected final org.exoplatform.services.security.IdentityRegistryThe identity registry.protected final InviteDAOThe invite storage.static final StringThe Constant JCR_CONTENT.static final StringThe Constant JCR_DATA.static final StringThe Constant JCR_LAST_MODIFIED_PROP.static final StringThe Constant JCR_MIME_TYPE.protected static final StringThe Constant JWT_CONFIGURATION_PROPERTIES.protected final org.exoplatform.services.cms.link.LinkManagerThe Link manager.protected final org.exoplatform.services.listener.ListenerServiceThe listener service.protected static final org.exoplatform.services.log.LogThe Constant LOG.static final intThe Constant MAX_RESULT_SIZE.static final StringThe Constant MIX_PRIVILEGEABLE.protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreatorThe node creator.static final StringThe Constant NT_FILE.static final StringThe Constant NT_RESOURCE.static final StringThe operation call added.static final StringThe operation call deleted.static final StringThe operation call joined.static final StringThe operation call leaved.static final StringThe operation call recorded.static final StringThe operation call started.static final StringThe operation call stopped.protected final org.exoplatform.services.organization.OrganizationServiceThe organization.protected final OriginDAOThe call origins storage.static final StringThe Constant OWNER_TYPE_CHATROOM.static final StringThe Constant OWNER_TYPE_SPACE.static final StringThe Constant OWNER_TYPE_SPACEEVENT.static final StringThe Constant OWNER_TYPE_USER.protected final ParticipantDAOThe participants storage.protected static final StringThe Constant PROVIDER_SCOPE_NAME.protected final Map<String,CallProvider> The providers.protected final org.exoplatform.services.jcr.RepositoryServiceThe repository service.static final Stringprotected static final StringThe Constant SECRET_KEY.protected final StringThe secret key.static final StringThe Constant SESSION_TOKEN_COOKIE.protected final org.exoplatform.services.jcr.ext.app.SessionProviderServiceThe session providers.protected final org.exoplatform.commons.api.settings.SettingServiceThe settings service.protected org.exoplatform.wcm.ext.component.document.service.ShareDocumentServiceThe share service.protected final org.exoplatform.social.core.manager.IdentityManagerThe social identity manager.protected org.exoplatform.social.core.space.spi.SpaceServiceThe space service.static final StringThe status not ok.static final StringThe status ok.static final intThe Constant TEXT_MAX_LENGTH.protected final org.exoplatform.upload.UploadServiceThe upload service.static final StringThe Constant USER.protected static final StringThe Constant USER_CALLS_SCOPE_NAME.protected final Map<String,Set<UserCallListener>> The user listeners. -
Constructor Summary
ConstructorsConstructorDescriptionWebConferencingService(org.exoplatform.services.organization.OrganizationService organization, org.exoplatform.social.core.manager.IdentityManager socialIdentityManager, org.exoplatform.services.listener.ListenerService listenerService, org.exoplatform.commons.api.settings.SettingService settingService, CallDAO callStorage, ParticipantDAO participantsStorage, OriginDAO originsStorage, InviteDAO inviteStorage, org.exoplatform.upload.UploadService uploadService, org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeCreator, org.exoplatform.services.security.IdentityRegistry identityRegistry, org.exoplatform.services.security.Authenticator authenticator, org.exoplatform.wcm.ext.component.document.service.ShareDocumentService shareService, org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.cms.link.LinkManager linkManager, org.exoplatform.web.security.codec.CodecInitializer codecInitializer) Instantiates a new web conferencing service. -
Method Summary
Modifier and TypeMethodDescriptionaddCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> partIds) Adds the call to list of active and fires STARTED event.Adds the guest to call.voidaddParticipant(String callId, String partId) Adds the participant to existing call.voidaddPlugin(org.exoplatform.container.component.ComponentPlugin plugin) Adds a provider plugin.voidaddProvider(CallProvider provider) Adds the provider.voidaddUserCallListener(UserCallListener listener) Adds the user listener.booleancheckInvite(String callId, String inviteId, String identity) Check invite.protected voidDeprecated.createCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> partIds, Collection<String> spaces, boolean start, Date startDate, Date endDate) Create the call and add it to list of the existing in storage, optionally start the call and notify its participants.protected voidcreateCall(CallInfo call) Create the call in storage with all its participants.protected CallEntitycreateCallEntity(CallInfo call) Creates the call entity.protected OriginEntitycreateOriginEntity(String callId, OriginInfo origin) Creates the origin entity.protected Set<OriginInfo>createOrigins(String providerType, Collection<String> partIds, Collection<String> spacePrettyNames) Creates the origins.protected IdentityInfocreateOwner(String ownerId, String ownerType, String title, boolean isUser, boolean isSpace, boolean isSpaceEvent, boolean isRoom) Creates call owner.protected ParticipantEntitycreateParticipantEntity(String callId, UserInfo user) Creates the participant entity.createParticipants(String providerType, Collection<String> partIds) Make call's direct participants from its IDs.protected StringCurrent user id.protected intDelete all user calls.protected voiddeleteCall(String id) Delete call.protected <C extends SQLException>
CexceptionCause(javax.persistence.PersistenceException pe, Class<C> causeClass) Find cause exception of given type.protected CallInfofindCallById(String id, boolean withParticipants) Find call in storage by its ID.protected StringfindChatRoomCallId(String roomId) Find a call, owned by a space with given ID, in calls storage.protected StringfindGroupCallId(String ownerId) Find a call, owned by group with given ID, in calls storage.protected List<IdentityData>findGroups(String name, int count) Find groups.findGroupsAndUsers(String name) Find groups and users.protected StringfindLastSpaceEventCallId(String ownerId) Find last space event call id.protected StringfindSpaceCallId(String spaceId) Find a call, owned by a space with given ID, in calls storage.protected Collection<CallInfo>findUserGroupCalls(String userId) Find user group calls in calls storage.protected List<IdentityData>Find users.protected voidfireUserCallJoined(String callId, String providerType, String ownerId, String ownerType, String partId, String userId) Fire user call joined a new part.protected voidfireUserCallLeaved(String callId, String providerType, String ownerId, String ownerType, String partId, String userId) Fire user call part leaved.protected voidfireUserCallStateChanged(String userId, String callId, String providerType, String callState, String ownerId, String ownerType) Fire user call state.Gets an active call info.protected StringgetInviteId(String callId) Gets the invite id.getProvider(String type) Gets the provider.getProviderConfiguration(String providerType, Locale locale) Gets the provider configuration.Gets the provider configurations.getProviderConfigurations(Locale locale) Gets the provider configurations.getRecordingUrl(String identity, String fileName, String type) getRoomInfo(String id, String title, String[] members) Gets the room info.Gets the JWT secret key.getSpaceEventInfo(String spaceIdentityId, String[] partIds, String[] spacesPrettyName) Gets the space event info, it will return actual event participants at the moment of invocation.getSpaceInfo(String spacePrettyName) Gets the space info, it will return actual space members at the moment of invocation.getSpaceMembers(String spacePrettyName) Gets the space members.getUserCalls(String userId) Gets the user calls.protected List<UserInfo.IMInfo>getUserIMs(org.exoplatform.social.core.identity.model.Profile profile) Gets the user IM accounts.getUserInfo(String id) Gets the user info.voidinitialize all saved started calls state.protected voidinvalidateCall(String id, boolean isGroup) Invalidate a call by an ID.static booleanisNotNullArg(String arg) Checks if argument not null (also not empty and not longer of 32 chars).protected booleanisSpaceMember(String userName, String spacePrettyName) Checks if is space member.static booleanisValidArg(String arg) Checks if argument valid (null or not empty and not longer of 32 chars).static booleanisValidData(String data) Checks if data valid (null or not empty and not longer of 2000 bytes in UTF8 encoding).static booleanChecks is ID valid (not null, not empty and not longer of 255 chars).static booleanisValidText(String text) Checks if is valid text (null, not empty and not longer of 255 chars).Join a call if it is started or start already stopped one.protected CallProviderConfigurationjsonToProviderConfig(org.json.JSONObject json) Json to provider config.If call started, then notify all its parties that given participant leaved.protected StringmetricMessage(String userId, CallInfo call, String operation, String status, Long duration, String error, Double fileSize) Metric message for reporting to the stats logger.protected voidnotifyUserCallStateChanged(CallInfo call, String initiatorId, String state) Notify user call state changed.protected org.json.JSONObjectProvider config to json.protected CallInforeadCallEntity(CallEntity savedCall, boolean withParticipants) Read call entity.protected CallProviderConfigurationreadProviderConfig(String type) Read saved call provider configuration.protected voidremoveParticipant(String callId, UserInfo participant) Remove call participant (for leaved state) in a single transaction.voidremoveUserCallListener(UserCallListener listener) Removes the user listener.protected WebConferencingService.RoomInfoRoom info.voidSave provider configuration.protected WebConferencingService.SpaceEventInfospaceEventInfo(String spaceIdentityId, String callId, String[] participants, String[] spaces) Space event info.protected WebConferencingService.SpaceInfoSpace info.voidstart()Starts existing call and fires STARTED event.protected voidStart existing call.voidstop()Removes the call info from active and fires STOPPED event.protected voidStop call.protected voidsyncCallEntity(CallInfo call, CallEntity entity) Update call entity from given CallInfo instance.protected voidSync group members and participants.protected voidtxAddParticipant(String callId, UserInfo participant) Tx add participant.protected voidtxCreateCall(CallInfo call) Creates the call in a single transaction.protected intDelete all user calls (not group ones) within a single transaction.protected voidtxDeleteCall(String id) Delete call within a transaction.protected voidtxRemoveParticipant(String callId, String partId) Remove call participant.protected voidtxStopCall(CallInfo call, boolean remove) Tx stop call.protected voidSync group members and participants.protected voidtxUpdateCall(CallInfo call) Update existing call (mark it started, stopped etc) in a single transaction.protected voidTx update call and its origins.protected voidUpdate call and all its participants in a single transaction.protected voidtxUpdateInvites(String callId, List<InvitedIdentity> identities) Tx update invites.protected voidtxUpdateParticipant(String callId, UserInfo participant) Update call participant (for joined or leaved state) in a single transaction.protected voidtxUpdateParticipants(CallInfo call, List<UserInfo> participants) Tx update participants.updateCall(String callId, String ownerId, String newOwnerType, String newTitle, String newProviderType, List<String> partIds, List<String> spaces, Date startDate, Date endDate) Updates the existing call information and original settings (initial participants and spaces).protected voidupdateCall(CallInfo call) Update existing call (mark it started, stopped etc).protected voidupdateCallAndOrigins(CallInfo call) Update call and its origins.protected voidUpdate call and all its participants.updateInvites(String callId, List<InvitedIdentity> identities) Update invites.protected voidupdateParticipant(String callId, UserInfo participant) Update call participant (for joined or leaved state) in a single transaction.updateParticipants(String callId, List<String> partIds) Update participants of the call.voiduploadFile(UploadFileInfo uploadInfo, javax.servlet.http.HttpServletRequest request) Upload recording of the call.protected org.exoplatform.services.security.IdentityuserIdentity(String userId) Find or create user identity.protected UserInfo
-
Field Details
-
ID_MAX_LENGTH
public static final int ID_MAX_LENGTHThe Constant ID_MAX_LENGTH.- See Also:
-
TEXT_MAX_LENGTH
public static final int TEXT_MAX_LENGTHThe Constant TEXT_MAX_LENGTH.- See Also:
-
ARG_MAX_LENGTH
public static final int ARG_MAX_LENGTHThe Constant ARG_MAX_LENGTH.- See Also:
-
DATA_MAX_LENGTH
public static final int DATA_MAX_LENGTHThe Constant DATA_MAX_LENGTH.- See Also:
-
MAX_RESULT_SIZE
public static final int MAX_RESULT_SIZEThe Constant MAX_RESULT_SIZE.- See Also:
-
SESSION_TOKEN_COOKIE
The Constant SESSION_TOKEN_COOKIE. -
OPERATION_CALL_ADDED
The operation call added.- See Also:
-
OPERATION_CALL_STARTED
The operation call started.- See Also:
-
OPERATION_CALL_JOINED
The operation call joined.- See Also:
-
OPERATION_CALL_LEAVED
The operation call leaved.- See Also:
-
OPERATION_CALL_STOPPED
The operation call stopped.- See Also:
-
OPERATION_CALL_DELETED
The operation call deleted.- See Also:
-
OPERATION_CALL_RECORDED
The operation call recorded.- See Also:
-
STATUS_OK
The status ok.- See Also:
-
STATUS_NOT_OK
The status not ok.- See Also:
-
EVENT_CALL_CREATED
- See Also:
-
EVENT_CALL_STARTED
- See Also:
-
EVENT_CALL_JOINDED
- See Also:
-
EVENT_CALL_LEFT
- See Also:
-
EVENT_CALL_STOPPED
- See Also:
-
EVENT_CALL_RECORDED
- See Also:
-
ROOM_DEFAULT_AVATAR_URL
- See Also:
-
CALL_OWNER_SCOPE_NAME
The Constant CALL_OWNER_SCOPE_NAME. -
CALL_ID_SCOPE_NAME
The Constant CALL_ID_SCOPE_NAME. -
USER_CALLS_SCOPE_NAME
The Constant USER_CALLS_SCOPE_NAME. -
PROVIDER_SCOPE_NAME
The Constant PROVIDER_SCOPE_NAME. -
JWT_CONFIGURATION_PROPERTIES
The Constant JWT_CONFIGURATION_PROPERTIES.- See Also:
-
SECRET_KEY
The Constant SECRET_KEY.- See Also:
-
ALL_USERS
The Constant ALL_USERS.- See Also:
-
GROUP
The Constant GROUP.- See Also:
-
USER
The Constant USER.- See Also:
-
OWNER_TYPE_USER
The Constant OWNER_TYPE_USER.- See Also:
-
OWNER_TYPE_SPACE
The Constant OWNER_TYPE_SPACE.- See Also:
-
OWNER_TYPE_SPACEEVENT
The Constant OWNER_TYPE_SPACEEVENT.- See Also:
-
OWNER_TYPE_CHATROOM
The Constant OWNER_TYPE_CHATROOM.- See Also:
-
CMS_GROUPS_PATH
The Constant CMS_GROUPS_PATH.- See Also:
-
EXO_TITLE_PROP
The Constant EXO_TITLE_PROP.- See Also:
-
NT_FILE
The Constant NT_FILE.- See Also:
-
JCR_CONTENT
The Constant JCR_CONTENT.- See Also:
-
JCR_DATA
The Constant JCR_DATA.- See Also:
-
JCR_MIME_TYPE
The Constant JCR_MIME_TYPE.- See Also:
-
JCR_LAST_MODIFIED_PROP
The Constant JCR_LAST_MODIFIED_PROP.- See Also:
-
EXO_RSS_ENABLE_PROP
The Constant EXO_RSS_ENABLE_PROP.- See Also:
-
NT_RESOURCE
The Constant NT_RESOURCE.- See Also:
-
MIX_PRIVILEGEABLE
The Constant MIX_PRIVILEGEABLE.- See Also:
-
LOG
protected static final org.exoplatform.services.log.Log LOGThe Constant LOG. -
secretKey
The secret key. -
organization
protected final org.exoplatform.services.organization.OrganizationService organizationThe organization. -
listenerService
protected final org.exoplatform.services.listener.ListenerService listenerServiceThe listener service. -
settingService
protected final org.exoplatform.commons.api.settings.SettingService settingServiceThe settings service. -
callStorage
The calls storage. -
participantsStorage
The participants storage. -
originsStorage
The call origins storage. -
inviteStorage
The invite storage. -
providers
The providers. -
spaceService
protected org.exoplatform.social.core.space.spi.SpaceService spaceServiceThe space service. -
userListeners
The user listeners. -
uploadService
protected final org.exoplatform.upload.UploadService uploadServiceThe upload service. -
repositoryService
protected final org.exoplatform.services.jcr.RepositoryService repositoryServiceThe repository service. -
sessionProviders
protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProvidersThe session providers. -
nodeCreator
protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeCreatorThe node creator. -
identityRegistry
protected final org.exoplatform.services.security.IdentityRegistry identityRegistryThe identity registry. -
authenticator
protected final org.exoplatform.services.security.Authenticator authenticatorThe authenticator. -
linkManager
protected final org.exoplatform.services.cms.link.LinkManager linkManagerThe Link manager.
-
-
Constructor Details
-
Method Details
-
isValidId
Checks is ID valid (not null, not empty and not longer of 255 chars).- Parameters:
id- the id- Returns:
- true, if is valid id
-
isValidText
Checks if is valid text (null, not empty and not longer of 255 chars).- Parameters:
text- the text- Returns:
- true, if is valid text
-
isValidArg
Checks if argument valid (null or not empty and not longer of 32 chars).- Parameters:
arg- the arg- Returns:
- true, if is valid arg
-
isNotNullArg
Checks if argument not null (also not empty and not longer of 32 chars).- Parameters:
arg- the arg- Returns:
- true, if is not null arg
-
isValidData
Checks if data valid (null or not empty and not longer of 2000 bytes in UTF8 encoding).- Parameters:
data- the data- Returns:
- true, if is valid data
- Throws:
UnsupportedEncodingException- if UTF8 encoding not found in runtime
-
userInfo
- Throws:
IdentityStateException
-
getUserInfo
Gets the user info.- Parameters:
id- the id- Returns:
- the user info
- Throws:
IdentityStateException- if error happened during searching the user in Organization Service
-
getSpaceInfo
public WebConferencingService.SpaceInfo getSpaceInfo(String spacePrettyName) throws IdentityStateException, StorageException Gets the space info, it will return actual space members at the moment of invocation.- Parameters:
spacePrettyName- the space pretty name- Returns:
- the space info
- Throws:
IdentityStateException- if error reading space member in Organization ServiceStorageException- if error reading saved group call ID associated with a space
-
getSpaceEventInfo
public WebConferencingService.SpaceEventInfo getSpaceEventInfo(String spaceIdentityId, String[] partIds, String[] spacesPrettyName) throws IdentityStateException, StorageException Gets the space event info, it will return actual event participants at the moment of invocation. Even participants will be resolved from the owner and given spaces' members plus given participants IDs.- Parameters:
spaceIdentityId- the space identity idpartIds- the participants IDs (attendees) added to the event directlyspacesPrettyName- the Social spaces' pretty names for add its members as participants (attendees) to the event- Returns:
- the space event info
- Throws:
IdentityStateException- the identity state exceptionStorageException- the storage exception
-
getSecretKey
Gets the JWT secret key.- Returns:
- the secret key
-
spaceInfo
protected WebConferencingService.SpaceInfo spaceInfo(String spacePrettyName, String callId) throws IdentityStateException Space info.- Parameters:
spacePrettyName- the space pretty namecallId- the call id- Returns:
- the space info
- Throws:
IdentityStateException- if error reading space member in Organization Service
-
spaceEventInfo
protected WebConferencingService.SpaceEventInfo spaceEventInfo(String spaceIdentityId, String callId, String[] participants, String[] spaces) throws IdentityStateException Space event info.- Parameters:
spaceIdentityId- the space identity idcallId- the call idparticipants- the participants user namesspaces- an array of space pretty names- Returns:
- the space info
- Throws:
IdentityStateException- the identity state exception
-
getRoomInfo
public WebConferencingService.RoomInfo getRoomInfo(String id, String title, String[] members) throws IdentityStateException, StorageException Gets the room info.- Parameters:
id- the idtitle- the titlemembers- the room members- Returns:
- the room info
- Throws:
IdentityStateException- if error reading room member in Organization ServiceStorageException- if error reading saved group call ID associated with a room
-
roomInfo
protected WebConferencingService.RoomInfo roomInfo(String id, String title, String[] members, String callId) throws IdentityStateException Room info.- Parameters:
id- the idtitle- the titlemembers- the memberscallId- the call id- Returns:
- the room info
- Throws:
IdentityStateException- if user cannot be read
-
addCall
public CallInfo addCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> partIds) throws CallArgumentException, StorageException, IdentityStateException, CallConflictException, CallSettingsException Adds the call to list of active and fires STARTED event.- Parameters:
id- the id of the callownerId- the owner id of the callownerType- the owner typetitle- the title of the callproviderType- the provider typepartIds- the participants IDs- Returns:
- the call info object of type
CallInfo - Throws:
CallArgumentException- if call argument has wrong value (failed validation)StorageException- if error reading, adding or updating call information in persistent storageIdentityStateException- if error reading room member in Organization ServiceCallConflictException- if such call already exists and has active state (started and/or running)CallSettingsException- if call entry has wrong settings (it's for Chat room call, the title - too long or has bad value)
-
createCall
public CallInfo createCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> partIds, Collection<String> spaces, boolean start, Date startDate, Date endDate) throws CallArgumentException, StorageException, IdentityStateException, CallConflictException, CallSettingsException Create the call and add it to list of the existing in storage, optionally start the call and notify its participants.- Parameters:
id- the id of the callownerId- the owner id of the callownerType- the owner typetitle- the title of the callproviderType- the provider typepartIds- the original participants collectionspaces- the original spaces (pretty names collection) with members allowed for participating the callstart- the start flag, iftruethen the call will be started (listeners will be notified)- Returns:
- the call info object of type
CallInfo - Throws:
CallArgumentException- if call argument has wrong value (failed validation)StorageException- if error reading, adding or updating call information in persistent storageIdentityStateException- if error reading room member in Organization ServiceCallConflictException- if such call already exists and has active state (started and/or running)CallSettingsException- if call entry has wrong settings (it's for Chat room call, the title - too long or has bad value)
-
updateCall
public CallInfo updateCall(String callId, String ownerId, String newOwnerType, String newTitle, String newProviderType, List<String> partIds, List<String> spaces, Date startDate, Date endDate) throws InvalidCallException, CallArgumentException, CallSettingsException, StorageException, CallNotFoundException, IdentityStateException, ParticipantNotFoundException Updates the existing call information and original settings (initial participants and spaces). Note: this method will not update the call actual participants states (who is running the call right now or leaved it), seeupdateParticipants(String, List)method for such work.- Parameters:
callId- the call idownerId- the owner idnewOwnerType- the owner typenewTitle- the titlenewProviderType- the provider typepartIds- the participantsspaces- the spacesstartDate- the start dateendDate- the end date- Returns:
- the call info
- Throws:
InvalidCallException- the invalid call exceptionCallArgumentException- the call argument exceptionCallSettingsException- the call settings exceptionStorageException- the storage exceptionCallNotFoundException- the call not found exceptionIdentityStateException- the identity state exceptionParticipantNotFoundException- See Also:
-
createParticipants
protected Set<UserInfo> createParticipants(String providerType, Collection<String> partIds) throws IdentityStateException, CallArgumentException Make call's direct participants from its IDs.- Parameters:
providerType- the provider typepartIds- the participants IDs- Returns:
- the participants
- Throws:
IdentityStateException- the identity state exceptionCallArgumentException- the call argument exception
-
createOrigins
protected Set<OriginInfo> createOrigins(String providerType, Collection<String> partIds, Collection<String> spacePrettyNames) throws IdentityStateException, CallArgumentException Creates the origins.- Parameters:
providerType- the provider typepartIds- the part idsspacePrettyNames- the spaces names- Returns:
- the sets of origins built from participants and spaces
- Throws:
IdentityStateException- the identity state exceptionCallArgumentException- the call argument exception
-
createOwner
protected IdentityInfo createOwner(String ownerId, String ownerType, String title, boolean isUser, boolean isSpace, boolean isSpaceEvent, boolean isRoom) throws CallArgumentException, IdentityStateException Creates call owner.- Parameters:
ownerId- the owner idownerType- the owner typetitle- the titleisUser- the is userisSpace- the is spaceisSpaceEvent- the is space eventisRoom- the is room- Returns:
- the call owner
- Throws:
CallArgumentException- the call argument exceptionIdentityStateException- the identity state exception
-
getCall
Gets an active call info.- Parameters:
id- the id- Returns:
- the call info or
nullif call not found - Throws:
InvalidCallException- if call in erroneous state, see cause exception for details
-
initializeStartedCallsState
public void initializeStartedCallsState()initialize all saved started calls state. -
stopCall
public CallInfo stopCall(String callId, boolean remove) throws CallNotFoundException, InvalidCallException Removes the call info from active and fires STOPPED event.- Parameters:
callId- the call idremove- the remove- Returns:
- the call info object of type
CallInfo - Throws:
CallNotFoundException- if call not foundInvalidCallException- if call in erroneous state and cannot be used, details are in caused exception
-
stopCall
Stop call.- Parameters:
call- the calluserId- the user idremove- the remove- Throws:
StorageException- if persistence exception happen
-
startCall
public CallInfo startCall(String callId, String clientId) throws CallNotFoundException, InvalidCallException Starts existing call and fires STARTED event. It's actual for group calls.- Parameters:
callId- the call idclientId- the client id- Returns:
- the call info object of type
CallInfo - Throws:
CallNotFoundException- if call not foundInvalidCallException- if call in erroneous state and cannot be used, details are in caused exception
-
startCall
protected void startCall(CallInfo call, String partId, String clientId, boolean notifyStarted) throws ParticipantNotFoundException, CallSettingsException, StorageException, CallNotFoundException Start existing call.- Parameters:
call- the callpartId- the participant id who started the callclientId- the client idnotifyStarted- iftruethen all participants will be notified about the started call- Throws:
ParticipantNotFoundException- if call or its participants not found in storageCallSettingsException- if call entry has wrong settings (room title, owner type etc)StorageException- if storage exception happenCallNotFoundException- if call not found in storage
-
updateParticipants
public CallInfo updateParticipants(String callId, List<String> partIds) throws CallNotFoundException, InvalidCallException, StorageException Update participants of the call. Used to update current participants of call with provided user IDs. Use this method to sycn a group call associated with external apps like eXo Chat.- Parameters:
callId- the call idpartIds- the participants ids- Returns:
- the call info
- Throws:
CallNotFoundException- the call not found exceptionInvalidCallException- the invalid call exceptionStorageException- the storage exception
-
addParticipant
public void addParticipant(String callId, String partId) throws StorageException, CallNotFoundException, InvalidCallException, IdentityStateException, CallArgumentException Adds the participant to existing call.- Parameters:
callId- the call idpartId- the part id- Throws:
StorageException- the storage exceptionCallNotFoundException- the call not found exceptionInvalidCallException- the invalid call exceptionIdentityStateException- the identity state exceptionCallArgumentException- if participant cannot be found
-
addGuest
public CallInfo addGuest(String callIId, String guestId) throws StorageException, CallNotFoundException, InvalidCallException, IdentityStateException Adds the guest to call. Adds guest as a participant to the call.- Parameters:
callIId- the call idguestId- the guest id- Returns:
- the call info
- Throws:
StorageException- the storage exceptionCallNotFoundException- the call not found exceptionInvalidCallException- the invalid call exceptionIdentityStateException- the identity state exception
-
updateInvites
public CallInfo updateInvites(String callId, List<InvitedIdentity> identities) throws CallNotFoundException, InvalidCallException, StorageException Update invites. Updates list of invited users/groups for the call that can join by invite link.- Parameters:
callId- the call ididentities- the invites- Returns:
- the call info
- Throws:
CallNotFoundException- the call not found exceptionInvalidCallException- the invalid call exceptionStorageException- the storage exception
-
joinCall
public CallInfo joinCall(String callId, String partId, String clientId) throws InvalidCallException, CallNotFoundException, IdentityStateException, CallArgumentException Join a call if it is started or start already stopped one.- Parameters:
callId- the call idpartId- the participant idclientId- the client id- Returns:
- the call info object of type
CallInfo - Throws:
InvalidCallException- if call in erroneous state and cannot be used, details are in caused exceptionCallNotFoundException- if call not foundIdentityStateException- the identity state exceptionCallArgumentException- if participant cannot be found
-
leaveCall
public CallInfo leaveCall(String callId, String partId, String clientId) throws InvalidCallException If call started, then notify all its parties that given participant leaved. If call not found thennullwill be returned.- Parameters:
callId- the call idpartId- the participant idclientId- the client id- Returns:
- the call info or
nullif call not found - Throws:
InvalidCallException- if call in erroneous state and cannot be used, details are in caused exception
-
getUserCalls
Gets the user calls.- Parameters:
userId- the user id- Returns:
- the user call states
- Throws:
StorageException- if persistence error happen
-
addUserCallListener
Adds the user listener.- Parameters:
listener- the listener
-
removeUserCallListener
Removes the user listener.- Parameters:
listener- the listener
-
fireUserCallStateChanged
protected void fireUserCallStateChanged(String userId, String callId, String providerType, String callState, String ownerId, String ownerType) Fire user call state.- Parameters:
userId- the user idcallId- the call idproviderType- the provider typecallState- the call stateownerId- the caller idownerType- the caller type
-
fireUserCallJoined
protected void fireUserCallJoined(String callId, String providerType, String ownerId, String ownerType, String partId, String userId) Fire user call joined a new part.- Parameters:
callId- the call idproviderType- the provider typeownerId- the owner idownerType- the owner typepartId- the part iduserId- the user id
-
fireUserCallLeaved
protected void fireUserCallLeaved(String callId, String providerType, String ownerId, String ownerType, String partId, String userId) Fire user call part leaved.- Parameters:
callId- the call idproviderType- the provider typeownerId- the owner idownerType- the owner typepartId- the part iduserId- the user id
-
addPlugin
public void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin) Adds a provider plugin. This method is safe in runtime: if configured provider is not an instance ofCallProviderthen it will log a warning and let server continue the start.- Parameters:
plugin- the plugin
-
addProvider
Adds the provider.- Parameters:
provider- the provider
-
checkInvite
Check invite.- Parameters:
callId- the call idinviteId- the invite ididentity- the identity- Returns:
- true, if successful
- Throws:
Exception- the exception
-
getProvider
Gets the provider.- Parameters:
type- the type- Returns:
- the provider
-
getProviderConfigurations
Gets the provider configurations.- Parameters:
locale- the locale to apply to provider description, ifnulla default one will be used- Returns:
- the provider configurations
-
getProviderConfigurations
Gets the provider configurations.- Returns:
- the provider configurations
-
getProviderConfiguration
Gets the provider configuration.- Parameters:
providerType- the provider typelocale- the locale to apply to provider description, ifnulla default one will be used- Returns:
- the provider configuration or
nullif provider not found
-
saveProviderConfiguration
public void saveProviderConfiguration(CallProviderConfiguration conf) throws UnsupportedEncodingException, org.json.JSONException Save provider configuration.- Parameters:
conf- the configuration to save- Throws:
UnsupportedEncodingException- if UTF8 not supportedorg.json.JSONException- if cannot serialize to JSON
-
findGroupsAndUsers
Find groups and users.- Parameters:
name- the name- Returns:
- the list
- Throws:
Exception- the exception
-
findUsers
Find users.- Parameters:
name- the namecount- the count- Returns:
- the list
- Throws:
Exception- the exception
-
findGroups
Find groups.- Parameters:
name- the namecount- the count- Returns:
- the list
- Throws:
Exception- the exception
-
uploadFile
public void uploadFile(UploadFileInfo uploadInfo, javax.servlet.http.HttpServletRequest request) throws UploadFileException, javax.jcr.RepositoryException Upload recording of the call.- Parameters:
uploadInfo- the upload inforequest- the request- Throws:
UploadFileException- the upload recording exceptionjavax.jcr.RepositoryException- the repository exception
-
userIdentity
Find or create user identity.- Parameters:
userId- the user id- Returns:
- the identity can be null if not found and cannot be created via current authenticator
-
start
public void start()- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.picocontainer.Startable
-
isSpaceMember
Checks if is space member.- Parameters:
userName- the user namespacePrettyName- the space pretty name- Returns:
- true, if is space member
-
getSpaceMembers
Gets the space members.- Parameters:
spacePrettyName- the space pretty name- Returns:
- the space members
-
jsonToProviderConfig
protected CallProviderConfiguration jsonToProviderConfig(org.json.JSONObject json) throws org.json.JSONException Json to provider config.- Parameters:
json- the json- Returns:
- the call provider configuration
- Throws:
org.json.JSONException- the JSON exception
-
getUserIMs
protected List<UserInfo.IMInfo> getUserIMs(org.exoplatform.social.core.identity.model.Profile profile) Gets the user IM accounts.- Parameters:
profile- the profile- Returns:
- the user I ms
-
providerConfigToJson
protected org.json.JSONObject providerConfigToJson(CallProviderConfiguration conf) throws org.json.JSONException Provider config to json.- Parameters:
conf- the conf- Returns:
- the JSON object
- Throws:
org.json.JSONException- the JSON exception
-
readProviderConfig
Read saved call provider configuration.- Parameters:
type- the type- Returns:
- the configuration
-
currentUserId
Current user id.- Returns:
- the string
-
notifyUserCallStateChanged
Notify user call state changed.- Parameters:
call- the callinitiatorId- the initiator idstate- the state
-
readCallEntity
protected CallInfo readCallEntity(CallEntity savedCall, boolean withParticipants) throws CallSettingsException, IdentityStateException, CallOwnerException Read call entity.- Parameters:
savedCall- the saved callwithParticipants- the with participants- Returns:
- the call info
- Throws:
CallSettingsException- if call entry has wrong settings (Chat room call title too long or has bad value)IdentityStateException- if error reading call owner or participantCallOwnerException- if call owner is of wrong type or cannot be found (as an identity)
-
getInviteId
Gets the invite id.- Parameters:
callId- the call id- Returns:
- the invite id
- Throws:
StorageException- the storage exception
-
createCallEntity
Creates the call entity.- Parameters:
call- the call- Returns:
- the call entity
- Throws:
CallSettingsException- if call entry has wrong settings (chat room title)
-
syncCallEntity
Update call entity from given CallInfo instance.- Parameters:
call- the callentity- the entity- Throws:
CallSettingsException- if call entry has wrong settings (room title)
-
createParticipantEntity
Creates the participant entity.- Parameters:
callId- the call iduser- the user- Returns:
- the participant entity
-
createOriginEntity
Creates the origin entity.- Parameters:
callId- the call idorigin- the origin- Returns:
- the origin entity
-
exceptionCause
protected <C extends SQLException> C exceptionCause(javax.persistence.PersistenceException pe, Class<C> causeClass) Find cause exception of given type.- Type Parameters:
C- the generic type- Parameters:
pe- the pecauseClass- the cause class- Returns:
- the c
-
txCreateCall
protected void txCreateCall(CallInfo call) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallSettingsException Creates the call in a single transaction.- Parameters:
call- the call- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- if persistence exception happenCallSettingsException- if call entry has wrong settings (chat room title)- See Also:
-
ExoTransactional
-
txAddParticipant
protected void txAddParticipant(String callId, UserInfo participant) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException Tx add participant.- Parameters:
callId- the call idparticipant- the participant- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
txStopCall
protected void txStopCall(CallInfo call, boolean remove) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException Tx stop call.- Parameters:
call- the callremove- the remove- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
txUpdateCall
protected void txUpdateCall(CallInfo call) throws CallNotFoundException, IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallSettingsException Update existing call (mark it started, stopped etc) in a single transaction.- Parameters:
call- the call- Throws:
CallNotFoundException- if call not found in storageIllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exceptionCallSettingsException- if call entry has wrong settings (room call title)
-
txUpdateInvites
protected void txUpdateInvites(String callId, List<InvitedIdentity> identities) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException Tx update invites.- Parameters:
callId- the ididentities- the identities- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
txUpdateParticipant
protected void txUpdateParticipant(String callId, UserInfo participant) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, ParticipantNotFoundException Update call participant (for joined or leaved state) in a single transaction.- Parameters:
callId- the call idparticipant- the participant- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exceptionParticipantNotFoundException- if call participant not found in storage
-
txSyncMembersAndParticipants
Sync group members and participants.- Parameters:
call- the call
-
txRemoveParticipant
protected void txRemoveParticipant(String callId, String partId) throws ParticipantNotFoundException Remove call participant.- Parameters:
callId- the call idpartId- the participant id- Throws:
ParticipantNotFoundException- if participant not found
-
txUpdateCallAndParticipants
protected void txUpdateCallAndParticipants(CallInfo call) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallNotFoundException, CallSettingsException, ParticipantNotFoundException Update call and all its participants in a single transaction.- Parameters:
call- the call- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exceptionCallNotFoundException- if call or its participants not found in storageCallSettingsException- if call entry has wrong settings (room call title)ParticipantNotFoundException- if call participant not found in storage
-
txUpdateCallAndOrigins
protected void txUpdateCallAndOrigins(CallInfo call) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallNotFoundException, CallSettingsException, ParticipantNotFoundException Tx update call and its origins.- Parameters:
call- the call- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exceptionCallNotFoundException- the call not found exceptionCallSettingsException- the call settings exceptionParticipantNotFoundException- the participant not found exception
-
txDeleteCall
protected void txDeleteCall(String id) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException Delete call within a transaction.- Parameters:
id- the call id- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
txUpdateParticipants
protected void txUpdateParticipants(CallInfo call, List<UserInfo> participants) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException Tx update participants.- Parameters:
call- the callparticipants- the participants- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
txDeleteAllUserCalls
protected int txDeleteAllUserCalls() throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceExceptionDelete all user calls (not group ones) within a single transaction.- Returns:
- number of deleted calls
- Throws:
IllegalArgumentException- the illegal argument exceptionIllegalStateException- the illegal state exceptionjavax.persistence.PersistenceException- the persistence exception
-
clearStorage
Deprecated.Clear JPA storage from stale/cached objects. -
deleteCall
Delete call.- Parameters:
id- the id- Throws:
StorageException- if storage error happens
-
deleteAllUserCalls
Delete all user calls. This will not touch any group call. For use on server start to cleanup the storage.- Returns:
- number of deleted calls
- Throws:
StorageException- if storage error happens
-
updateCallAndParticipants
protected void updateCallAndParticipants(CallInfo call) throws StorageException, ParticipantNotFoundException, CallSettingsException, CallNotFoundException Update call and all its participants.- Parameters:
call- the call- Throws:
StorageException- if storage exception happenParticipantNotFoundException- if call or its participants not found in storageCallSettingsException- if call entry has wrong settings (room call title)CallNotFoundException- if call not found in storage
-
updateCallAndOrigins
protected void updateCallAndOrigins(CallInfo call) throws StorageException, ParticipantNotFoundException, CallSettingsException, CallNotFoundException Update call and its origins.- Parameters:
call- the call- Throws:
StorageException- the storage exceptionParticipantNotFoundException- the participant not found exceptionCallSettingsException- the call settings exceptionCallNotFoundException- the call not found exception
-
syncMembersAndParticipants
Sync group members and participants.- Parameters:
call- the call- Throws:
StorageException- the storage exception
-
updateParticipant
protected void updateParticipant(String callId, UserInfo participant) throws ParticipantNotFoundException, StorageException Update call participant (for joined or leaved state) in a single transaction.- Parameters:
callId- the call idparticipant- the participant- Throws:
ParticipantNotFoundException- if call participant not found in storageStorageException- if storage exception happen
-
removeParticipant
protected void removeParticipant(String callId, UserInfo participant) throws ParticipantNotFoundException, StorageException Remove call participant (for leaved state) in a single transaction.- Parameters:
callId- the call idparticipant- the participant- Throws:
ParticipantNotFoundException- if call participant not found in storageStorageException- if storage exception happen
-
updateCall
protected void updateCall(CallInfo call) throws CallNotFoundException, CallSettingsException, StorageException Update existing call (mark it started, stopped etc).- Parameters:
call- the call- Throws:
CallNotFoundException- if call not found in storageCallSettingsException- if call entry has wrong settings (room call title)StorageException- if storage exception happen
-
findCallById
protected CallInfo findCallById(String id, boolean withParticipants) throws IdentityStateException, StorageException, CallSettingsException, CallOwnerException Find call in storage by its ID.- Parameters:
id- the idwithParticipants- also read participants from the DB- Returns:
- the call info
- Throws:
IdentityStateException- if error reading call owner or participantStorageException- if persistent error happensCallSettingsException- if call entry has wrong settings (Chat room call title too long or has bad value)CallOwnerException- if call owner type of unknown type
-
findGroupCallId
Find a call, owned by group with given ID, in calls storage.- Parameters:
ownerId- the owner id- Returns:
- the string or
nullif no call found - Throws:
StorageException- the storage exception
-
findSpaceCallId
Find a call, owned by a space with given ID, in calls storage.- Parameters:
spaceId- the owner id- Returns:
- the string or
nullif no call found - Throws:
StorageException- the storage exception
-
findChatRoomCallId
Find a call, owned by a space with given ID, in calls storage.- Parameters:
roomId- the room id- Returns:
- the string or
nullif no call found - Throws:
StorageException- the storage exception
-
findLastSpaceEventCallId
Find last space event call id.- Parameters:
ownerId- the owner id- Returns:
- the string
- Throws:
StorageException- the storage exception
-
findUserGroupCalls
Find user group calls in calls storage.- Parameters:
userId- the user id- Returns:
- the collection
- Throws:
StorageException- if persistence error happen
-
createCall
protected void createCall(CallInfo call) throws StorageException, CallConflictException, CallSettingsException Create the call in storage with all its participants. If such call (by ID) already exists aCallConflictExceptionwill be raised.- Parameters:
call- the call info- Throws:
StorageException- if storage exception happenCallConflictException- the call conflicts with another (same ID) callCallSettingsException- the call settings wrong (chat room title)
-
invalidateCall
protected void invalidateCall(String id, boolean isGroup) throws CallConflictException, StorageException Invalidate a call by an ID. If such call (by ID) already found and, it's P2P call but not active - it will be removed, otherwiseCallConflictExceptionwill be thrown. This method designed to be called just beforecreateCall(CallInfo).- Parameters:
id- the idisGroup- the is group- Throws:
CallConflictException- if call conflict found and existing call cannot be removedStorageException- if storage exception happen
-
metricMessage
protected String metricMessage(String userId, CallInfo call, String operation, String status, Long duration, String error, Double fileSize) Metric message for reporting to the stats logger.- Parameters:
userId- the user id of the operationcall- the call in the operationoperation- the operation namestatus- the status of operationduration- the operation duration in millseconds (can benull), it's not a call durationerror- the error if present (can benull)- Returns:
- the string combining all given parameters in specified format according https://community.exoplatform.com/portal/g/:spaces:exo_itop/exo_itop/wiki/SPEC_-_logging_for_monitoring
-
getRecordingUrl
- Throws:
Exception
-
socialIdentityManager