public class WebConferencingService extends Object implements org.picocontainer.Startable
| Modifier and Type | Class and Description |
|---|---|
class |
WebConferencingService.RoomInfo
Represent Chat room in calls.
|
class |
WebConferencingService.SpaceInfo
Represent Space in calls.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ARG_MAX_LENGTH
The Constant ARG_MAX_LENGTH.
|
protected static String |
CALL_ID_SCOPE_NAME
The Constant CALL_ID_SCOPE_NAME.
|
protected static String |
CALL_OWNER_SCOPE_NAME
The Constant CALL_OWNER_SCOPE_NAME.
|
protected CallDAO |
callStorage
The calls storage.
|
static String |
CHAT_ROOM_TYPE_NAME
The Constant CHAT_ROOM_TYPE_NAME.
|
static int |
DATA_MAX_LENGTH
The Constant DATA_MAX_LENGTH.
|
protected static String |
GROUP_CALL_TYPE
The Constant GROUP_CALL_TYPE.
|
static int |
ID_MAX_LENGTH
The Constant ID_MAX_LENGTH.
|
protected org.exoplatform.services.listener.ListenerService |
listenerService
The listener service.
|
protected static org.exoplatform.services.log.Log |
LOG
The Constant LOG.
|
protected org.exoplatform.services.organization.OrganizationService |
organization
The organization.
|
static String |
OWNER_TYPE_CHATROOM
The Constant OWNER_TYPE_CHATROOM.
|
static String |
OWNER_TYPE_SPACE
The Constant OWNER_TYPE_SPACE.
|
protected ParticipantDAO |
participantsStorage
The participants storage.
|
protected static String |
PROVIDER_SCOPE_NAME
The Constant PROVIDER_SCOPE_NAME.
|
protected Map<String,CallProvider> |
providers
The providers.
|
protected org.exoplatform.commons.api.settings.SettingService |
settingService
The settings service.
|
protected org.exoplatform.social.core.manager.IdentityManager |
socialIdentityManager
The social identity manager.
|
static String |
SPACE_TYPE_NAME
The Constant SPACE_TYPE_NAME.
|
protected org.exoplatform.social.core.space.spi.SpaceService |
spaceService
The space service.
|
static int |
TEXT_MAX_LENGTH
The Constant TEXT_MAX_LENGTH.
|
protected static String |
USER_CALLS_SCOPE_NAME
The Constant USER_CALLS_SCOPE_NAME.
|
protected Map<String,Set<UserCallListener>> |
userListeners
The user listeners.
|
| Constructor and Description |
|---|
WebConferencingService(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)
Instantiates a new web conferencing service.
|
| Modifier and Type | Method and Description |
|---|---|
CallInfo |
addCall(String id,
String ownerId,
String ownerType,
String title,
String providerType,
Collection<String> parts)
Adds the call to list of active and fires STARTED event.
|
void |
addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
Adds a provider plugin.
|
void |
addProvider(CallProvider provider)
Adds the provider.
|
void |
addUserCallListener(UserCallListener listener)
Adds the user listener.
|
protected void |
createCall(CallInfo call)
Create the call in storage with all its participants.
|
protected CallEntity |
createCallEntity(CallInfo call)
Creates the call entity.
|
protected ParticipantEntity |
createParticipantEntity(String callId,
UserInfo user)
Creates the participant entity.
|
protected String |
currentUserId()
Current user id.
|
protected int |
deleteAllUserCalls()
Delete all user calls.
|
protected boolean |
deleteCall(String id)
Delete call.
|
protected <C extends SQLException> |
exceptionCause(javax.persistence.PersistenceException pe,
Class<C> causeClass)
Find cause exception of given type.
|
protected CallInfo |
findCallById(String id)
Find call in storage by its ID.
|
protected String |
findGroupCallId(String ownerId)
Find a call, owned by group with given ID, in calls storage.
|
protected Collection<CallInfo> |
findUserGroupCalls(String userId)
Find user group calls in calls storage.
|
protected void |
fireUserCallJoined(String callId,
String providerType,
String ownerId,
String ownerType,
String partId,
String userId)
Fire user call joined a new part.
|
protected void |
fireUserCallLeaved(String callId,
String providerType,
String ownerId,
String ownerType,
String partId,
String userId)
Fire user call part leaved.
|
protected void |
fireUserCallStateChanged(String userId,
String callId,
String providerType,
String callState,
String ownerId,
String ownerType)
Fire user call state.
|
CallInfo |
getCall(String id)
Gets an active call info.
|
CallProvider |
getProvider(String type)
Gets the provider.
|
CallProviderConfiguration |
getProviderConfiguration(String providerType,
Locale locale)
Gets the provider configuration.
|
Set<CallProviderConfiguration> |
getProviderConfigurations()
Gets the provider configurations.
|
Set<CallProviderConfiguration> |
getProviderConfigurations(Locale locale)
Gets the provider configurations.
|
WebConferencingService.RoomInfo |
getRoomInfo(String id,
String title,
String[] members)
Gets the room info.
|
WebConferencingService.SpaceInfo |
getSpaceInfo(String spacePrettyName)
Gets the space info.
|
protected Set<String> |
getSpaceMembers(String spacePrettyName)
Gets the space members.
|
CallState[] |
getUserCalls(String userId)
Gets the user calls.
|
UserInfo |
getUserInfo(String id)
Gets the user info.
|
protected void |
invalidateCall(String id,
boolean isGroup)
Invalidate a call by an ID.
|
static boolean |
isNotNullArg(String arg)
Checks if argument not null (also not empty and not longer of 32 chars).
|
protected boolean |
isSpaceMember(String userName,
String spacePrettyName)
Checks if is space member.
|
static boolean |
isValidArg(String arg)
Checks if argument valid (null or not empty and not longer of 32 chars).
|
static boolean |
isValidData(String data)
Checks if data valid (null or not empty and not longer of 2000 bytes in UTF8
encoding).
|
static boolean |
isValidId(String id)
Checks is ID valid (not null, not empty and not longer of 255 chars).
|
static boolean |
isValidText(String text)
Checks if is valid text (null, not empty and not longer of 255 chars).
|
CallInfo |
joinCall(String id,
String partId,
String clientId)
Join a call if it is started or start already stopped one.
|
protected CallProviderConfiguration |
jsonToProviderConfig(org.json.JSONObject json)
Json to provider config.
|
CallInfo |
leaveCall(String id,
String partId,
String clientId)
If call started, then notify all its parties that given participant leaved.
|
protected void |
notifyUserCallStateChanged(CallInfo call,
String initiatorId,
String state)
Notify user call state changed.
|
protected org.json.JSONObject |
providerConfigToJson(CallProviderConfiguration conf)
Provider config to json.
|
protected CallInfo |
readCallEntity(CallEntity savedCall,
boolean withParticipants)
Read call entity.
|
protected CallProviderConfiguration |
readProviderConfig(String type)
Read saved call provider configuration.
|
void |
removeUserCallListener(UserCallListener listener)
Removes the user listener.
|
protected WebConferencingService.RoomInfo |
roomInfo(String id,
String title,
String[] members,
String callId)
Room info.
|
void |
saveProviderConfiguration(CallProviderConfiguration conf)
Save provider configuration.
|
protected WebConferencingService.SpaceInfo |
spaceInfo(String spacePrettyName,
String callId)
Space info.
|
void |
start() |
protected void |
startCall(CallInfo call,
String clientId)
Start existing call.
|
CallInfo |
startCall(String id,
String clientId)
Starts existing call and fires STARTED event.
|
void |
stop() |
protected CallInfo |
stopCall(CallInfo call,
String userId,
boolean remove)
Stop call.
|
CallInfo |
stopCall(String id,
boolean remove)
Removes the call info from active and fires STOPPED event.
|
protected void |
syncCallEntity(CallInfo call,
CallEntity entity)
Update call entity from given CallInfo instance.
|
protected void |
txCreateCall(CallInfo call)
Creates the call in a single transaction.
|
protected int |
txDeleteAllUserCalls()
Delete all user calls (not group ones) within a single transaction.
|
protected boolean |
txDeleteCall(String id)
Delete call within a transaction.
|
protected void |
txUpdateCall(CallInfo call)
Update existing call (mark it started, stopped etc) in a single transaction.
|
protected void |
txUpdateCallAndParticipants(CallInfo call)
Update call and all its participants in a single transaction.
|
protected void |
txUpdateParticipant(String callId,
UserInfo participant)
Update call participant (for joined or leaved state) in a single transaction.
|
protected void |
updateCall(CallInfo call)
Update existing call (mark it started, stopped etc).
|
protected void |
updateCallAndParticipants(CallInfo call)
Update call and all its participants.
|
protected void |
updateParticipant(String callId,
UserInfo participant)
Update call participant (for joined or leaved state) in a single transaction.
|
public static final int ID_MAX_LENGTH
public static final int TEXT_MAX_LENGTH
public static final int ARG_MAX_LENGTH
public static final int DATA_MAX_LENGTH
public static final String SPACE_TYPE_NAME
public static final String CHAT_ROOM_TYPE_NAME
protected static final String GROUP_CALL_TYPE
protected static final String CALL_OWNER_SCOPE_NAME
protected static final String CALL_ID_SCOPE_NAME
protected static final String USER_CALLS_SCOPE_NAME
protected static final String PROVIDER_SCOPE_NAME
public static final String OWNER_TYPE_SPACE
public static final String OWNER_TYPE_CHATROOM
protected static final org.exoplatform.services.log.Log LOG
protected final org.exoplatform.services.organization.OrganizationService organization
protected final org.exoplatform.social.core.manager.IdentityManager socialIdentityManager
protected final org.exoplatform.services.listener.ListenerService listenerService
protected final org.exoplatform.commons.api.settings.SettingService settingService
protected final CallDAO callStorage
protected final ParticipantDAO participantsStorage
protected final Map<String,CallProvider> providers
protected org.exoplatform.social.core.space.spi.SpaceService spaceService
protected final Map<String,Set<UserCallListener>> userListeners
public WebConferencingService(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)
organization - the organizationsocialIdentityManager - the social identity managerlistenerService - the listener servicesettingService - the setting servicecallStorage - the call storageparticipantsStorage - the participants storagepublic static boolean isValidId(String id)
id - the idpublic static boolean isValidText(String text)
text - the textpublic static boolean isValidArg(String arg)
arg - the argpublic static boolean isNotNullArg(String arg)
arg - the argpublic static boolean isValidData(String data) throws UnsupportedEncodingException
data - the dataUnsupportedEncodingException - if UTF8 encoding not found in runtimepublic UserInfo getUserInfo(String id) throws IdentityStateException
id - the idIdentityStateException - if error happened during searching the user in Organization Servicepublic WebConferencingService.SpaceInfo getSpaceInfo(String spacePrettyName) throws IdentityStateException, StorageException
spacePrettyName - the space pretty nameStorageException - if error reading saved group call ID associated with a spaceIdentityStateException - if error reading space member in Organization Serviceprotected WebConferencingService.SpaceInfo spaceInfo(String spacePrettyName, String callId) throws IdentityStateException
spacePrettyName - the space pretty namecallId - the call idIdentityStateException - if error reading space member in Organization Servicepublic WebConferencingService.RoomInfo getRoomInfo(String id, String title, String[] members) throws IdentityStateException, StorageException
id - the idtitle - the titlemembers - the room membersStorageException - if error reading saved group call ID associated with a roomIdentityStateException - if error reading room member in Organization Serviceprotected WebConferencingService.RoomInfo roomInfo(String id, String title, String[] members, String callId) throws IdentityStateException
id - the idtitle - the titlemembers - the memberscallId - the call idIdentityStateException - if user cannot be readpublic CallInfo addCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> parts) throws CallArgumentException, StorageException, IdentityStateException, CallConflictException, CallSettingsException
id - the id of the callownerId - the owner id of the callownerType - the owner typetitle - the title of the callproviderType - the provider typeparts - the participantsCallInfoCallArgumentException - 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)public CallInfo getCall(String id) throws InvalidCallException
id - the idnull if call not foundInvalidCallException - if call in erroneous state, see cause exception for detailspublic CallInfo stopCall(String id, boolean remove) throws CallNotFoundException, InvalidCallException
id - the idremove - the removeCallInfoCallNotFoundException - if call not foundInvalidCallException - if call in erroneous state and cannot be used, details are in caused
exceptionprotected CallInfo stopCall(CallInfo call, String userId, boolean remove) throws StorageException
call - the calluserId - the user idremove - the removeStorageException - if persistence exception happenpublic CallInfo startCall(String id, String clientId) throws CallNotFoundException, InvalidCallException
id - the idclientId - the client idCallInfoCallNotFoundException - if call not foundInvalidCallException - if call in erroneous state and cannot be used, details are in caused
exceptionprotected void startCall(CallInfo call, String clientId) throws ParticipantNotFoundException, CallSettingsException, StorageException, CallNotFoundException
call - the callclientId - the client idStorageException - 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 storagepublic CallInfo joinCall(String id, String partId, String clientId) throws InvalidCallException, CallNotFoundException
id - the idpartId - the participant idclientId - the client idCallInfoCallNotFoundException - if call not foundInvalidCallException - if call in erroneous state and cannot be used, details are in caused
exceptionpublic CallInfo leaveCall(String id, String partId, String clientId) throws InvalidCallException
null will be returned.id - the idpartId - the participant idclientId - the client idnull if call not foundInvalidCallException - if call in erroneous state and cannot be used, details are in caused
exceptionpublic CallState[] getUserCalls(String userId) throws StorageException
userId - the user idStorageException - if persistence error happenpublic void addUserCallListener(UserCallListener listener)
listener - the listenerpublic void removeUserCallListener(UserCallListener listener)
listener - the listenerprotected void fireUserCallStateChanged(String userId, String callId, String providerType, String callState, String ownerId, String ownerType)
userId - the user idcallId - the call idproviderType - the provider typecallState - the call stateownerId - the caller idownerType - the caller typeprotected void fireUserCallJoined(String callId, String providerType, String ownerId, String ownerType, String partId, String userId)
callId - the call idproviderType - the provider typeownerId - the owner idownerType - the owner typepartId - the part iduserId - the user idprotected void fireUserCallLeaved(String callId, String providerType, String ownerId, String ownerType, String partId, String userId)
callId - the call idproviderType - the provider typeownerId - the owner idownerType - the owner typepartId - the part iduserId - the user idpublic void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
CallProvider then it will log a warning and let server continue the start.plugin - the pluginpublic void addProvider(CallProvider provider)
provider - the providerpublic CallProvider getProvider(String type)
type - the typepublic Set<CallProviderConfiguration> getProviderConfigurations(Locale locale)
locale - the locale to apply to provider description, if null a default one will be
usedpublic Set<CallProviderConfiguration> getProviderConfigurations()
public CallProviderConfiguration getProviderConfiguration(String providerType, Locale locale)
providerType - the provider typelocale - the locale to apply to provider description, if null a default one will be
usednull if provider not foundpublic void saveProviderConfiguration(CallProviderConfiguration conf) throws UnsupportedEncodingException, org.json.JSONException
conf - the configuration to saveorg.json.JSONException - if cannot serialize to JSONUnsupportedEncodingException - if UTF8 not supportedpublic void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startableprotected boolean isSpaceMember(String userName, String spacePrettyName)
userName - the user namespacePrettyName - the space pretty nameprotected Set<String> getSpaceMembers(String spacePrettyName)
spacePrettyName - the space pretty nameprotected CallProviderConfiguration jsonToProviderConfig(org.json.JSONObject json) throws org.json.JSONException
json - the jsonorg.json.JSONException - the JSON exceptionprotected org.json.JSONObject providerConfigToJson(CallProviderConfiguration conf) throws org.json.JSONException
conf - the conforg.json.JSONException - the JSON exceptionprotected CallProviderConfiguration readProviderConfig(String type)
type - the typeprotected String currentUserId()
protected void notifyUserCallStateChanged(CallInfo call, String initiatorId, String state)
call - the callinitiatorId - the initiator idstate - the stateprotected CallInfo readCallEntity(CallEntity savedCall, boolean withParticipants) throws CallSettingsException, IdentityStateException, CallOwnerException
savedCall - the saved callwithParticipants - the with participantsCallSettingsException - 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 typeprotected CallEntity createCallEntity(CallInfo call) throws CallSettingsException
call - the callCallSettingsException - if call entry has wrong settings (chat room title)protected void syncCallEntity(CallInfo call, CallEntity entity) throws CallSettingsException
call - the callentity - the entityCallSettingsException - if call entry has wrong settings (room title)protected ParticipantEntity createParticipantEntity(String callId, UserInfo user)
callId - the call iduser - the userprotected <C extends SQLException> C exceptionCause(javax.persistence.PersistenceException pe, Class<C> causeClass)
C - the generic typepe - the pecauseClass - the cause classprotected void txCreateCall(CallInfo call) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallSettingsException
call - the callIllegalArgumentException - the illegal argument exceptionIllegalStateException - the illegal state exceptionjavax.persistence.PersistenceException - if persistence exception happenCallSettingsException - if call entry has wrong settings (chat room title)ExoTransactionalprotected void txUpdateCall(CallInfo call) throws CallNotFoundException, IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallSettingsException
call - the callCallNotFoundException - 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)protected void txUpdateParticipant(String callId, UserInfo participant) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, ParticipantNotFoundException
callId - the call idparticipant - the participantIllegalArgumentException - the illegal argument exceptionIllegalStateException - the illegal state exceptionjavax.persistence.PersistenceException - the persistence exceptionParticipantNotFoundException - if call participant not found in storageprotected void txUpdateCallAndParticipants(CallInfo call) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException, CallNotFoundException, CallSettingsException, ParticipantNotFoundException
call - the callIllegalArgumentException - 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 storageprotected boolean txDeleteCall(String id) throws IllegalArgumentException, IllegalStateException, javax.persistence.PersistenceException
id - the call idIllegalArgumentException - the illegal argument exceptionIllegalStateException - the illegal state exceptionjavax.persistence.PersistenceException - the persistence exceptionprotected int txDeleteAllUserCalls()
throws IllegalArgumentException,
IllegalStateException,
javax.persistence.PersistenceException
IllegalArgumentException - the illegal argument exceptionIllegalStateException - the illegal state exceptionjavax.persistence.PersistenceException - the persistence exceptionprotected boolean deleteCall(String id) throws StorageException
id - the idStorageException - if storage error happensprotected int deleteAllUserCalls()
throws StorageException
StorageException - if storage error happensprotected void updateCallAndParticipants(CallInfo call) throws StorageException, ParticipantNotFoundException, CallSettingsException, CallNotFoundException
call - the callStorageException - 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 storageprotected void updateParticipant(String callId, UserInfo participant) throws ParticipantNotFoundException, StorageException
callId - the call idparticipant - the participantParticipantNotFoundException - if call participant not found in storageStorageException - if storage exception happenprotected void updateCall(CallInfo call) throws CallNotFoundException, CallSettingsException, StorageException
call - the callCallNotFoundException - if call not found in storageCallSettingsException - if call entry has wrong settings (room call title)StorageException - if storage exception happenprotected CallInfo findCallById(String id) throws IdentityStateException, StorageException, CallSettingsException, CallOwnerException
id - the idCallSettingsException - if call entry has wrong settings (Chat room call
title too long or has bad value)IdentityStateException - if error reading call owner or participantStorageException - if persistent error happensCallOwnerException - if call owner type of unknown typeprotected String findGroupCallId(String ownerId) throws StorageException
ownerId - the owner idnull if no call foundStorageException - the storage exceptionprotected Collection<CallInfo> findUserGroupCalls(String userId) throws StorageException
userId - the user idStorageException - if persistence error happenprotected void createCall(CallInfo call) throws StorageException, CallConflictException, CallSettingsException
CallConflictException will be raised.call - the call infoStorageException - if storage exception happenCallConflictException - the call conflicts with another (same ID) callCallSettingsException - the call settings wrong (chat room title)protected void invalidateCall(String id, boolean isGroup) throws CallConflictException, StorageException
CallConflictException will be thrown. This method designed to be
called just before createCall(CallInfo).id - the idisGroup - the is groupCallConflictException - if call conflict found and existing call cannot be removedStorageException - if storage exception happenCopyright © 2003–2020 eXo Platform SAS. All rights reserved.