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 org.exoplatform.services.cms.drives.ManageDriveService |
driveService
The drive service.
|
protected static String |
GROUP_CALL_TYPE
The Constant GROUP_CALL_TYPE.
|
protected org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator |
hierarchyCreator
The hierarchy owner.
|
static int |
ID_MAX_LENGTH
The Constant ID_MAX_LENGTH.
|
protected org.exoplatform.services.jcr.RepositoryService |
jcrService
The jcr service.
|
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.services.jcr.ext.app.SessionProviderService |
sessionProviders
The session 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.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.social.core.manager.IdentityManager socialIdentityManager,
org.exoplatform.services.cms.drives.ManageDriveService driveService,
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)
Creates the call in a single transaction of the storage.
|
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 callId)
Delete call.
|
protected <C extends SQLException> |
findCause(javax.persistence.PersistenceException pe,
Class<C> causeClass)
Find cause exception of given type.
|
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.
|
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 userId,
String clientId)
If call started, then notify all its parties that given participant joined.
|
protected CallProviderConfiguration |
jsonToProviderConfig(org.json.JSONObject json)
Json to provider config.
|
CallInfo |
leaveCall(String id,
String userId,
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 |
readCallById(String id)
Read call by id.
|
protected CallInfo |
readCallEntity(CallEntity savedCall,
boolean withParticipants)
Read call entity.
|
protected String |
readGroupCallId(String ownerId)
Read group owned call ID.
|
protected org.json.JSONObject |
readJson(String str)
Read JSON from the string.
|
protected UserInfo |
readParticipantEntity(ParticipantEntity savedPart)
Read participant entity.
|
protected CallProviderConfiguration |
readProviderConfig(String type)
Read saved call provider configuration.
|
protected Collection<CallInfo> |
readUserGroupCalls(String userId)
Read user group call ids.
|
void |
removeUserCallListener(UserCallListener listener)
Removes the user listener.
|
protected WebConferencingService.RoomInfo |
roomInfo(String id,
String title,
String[] members,
String callId)
Room info.
|
protected void |
saveProviderConfig(CallProviderConfiguration conf)
Save provider configuration.
|
void |
saveProviderConfiguration(CallProviderConfiguration config)
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 |
updateCall(CallInfo call)
Update existing call (mark it started, stopped etc).
|
protected void |
updateCallAndParticipant(CallInfo call,
UserInfo participant)
Update call and participant.
|
protected void |
updateCallAndParticipants(CallInfo call)
Update call and all its participants.
|
protected void |
updateCallEntity(CallInfo call,
CallEntity entity)
Update call entity.
|
protected void |
updateParticipant(String callId,
UserInfo participant)
Update call participant (for joined or leaved state).
|
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.jcr.RepositoryService jcrService
protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders
protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator
protected final org.exoplatform.services.organization.OrganizationService organization
protected final org.exoplatform.social.core.manager.IdentityManager socialIdentityManager
protected final org.exoplatform.services.cms.drives.ManageDriveService driveService
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.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.social.core.manager.IdentityManager socialIdentityManager,
org.exoplatform.services.cms.drives.ManageDriveService driveService,
org.exoplatform.services.listener.ListenerService listenerService,
org.exoplatform.commons.api.settings.SettingService settingService,
CallDAO callStorage,
ParticipantDAO participantsStorage)
jcrService - the jcr servicesessionProviders - the session providershierarchyCreator - the hierarchy creatororganization - the organizationsocialIdentityManager - the social identity managerdriveService - the drive servicelistenerService - 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 Exception
id - the idException - the exceptionpublic WebConferencingService.SpaceInfo getSpaceInfo(String spacePrettyName) throws Exception
spacePrettyName - the space pretty nameException - the exceptionprotected WebConferencingService.SpaceInfo spaceInfo(String spacePrettyName, String callId) throws Exception
spacePrettyName - the space pretty namecallId - the call idException - the exceptionpublic WebConferencingService.RoomInfo getRoomInfo(String id, String title, String[] members) throws Exception
id - the idtitle - the titlemembers - the room membersException - the exceptionprotected WebConferencingService.RoomInfo roomInfo(String id, String title, String[] members, String callId) throws Exception
id - the idtitle - the titlemembers - the memberscallId - the call idException - the exceptionpublic CallInfo addCall(String id, String ownerId, String ownerType, String title, String providerType, Collection<String> parts) throws Exception
id - the idownerId - the owner idownerType - the owner typetitle - the titleproviderType - the provider typeparts - the partsException - the exceptionpublic CallInfo getCall(String id) throws Exception
id - the idnull if call not foundException - the exceptionpublic CallInfo stopCall(String id, boolean remove) throws Exception
id - the idremove - the removenull if call not foundException - the exceptionprotected CallInfo stopCall(CallInfo call, String userId, boolean remove) throws Exception
call - the calluserId - the user idremove - the removeException - the exceptionpublic CallInfo startCall(String id, String clientId) throws Exception
id - the idclientId - the client idnull if call not foundException - the exceptionprotected void startCall(CallInfo call, String clientId) throws Exception
call - the callclientId - the client idException - the exceptionpublic CallInfo joinCall(String id, String userId, String clientId) throws Exception
InvalidCallStateException will be thrown.id - the iduserId - the user idclientId - the client idnull if call not foundException - the exceptionpublic CallInfo leaveCall(String id, String userId, String clientId) throws Exception
InvalidCallStateException will be thrown.id - the iduserId - the user idclientId - the client idnull if call not foundException - the exceptionpublic CallState[] getUserCalls(String userId) throws Exception
userId - the user idException - the exceptionpublic 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) throws Exception
providerType - the provider typelocale - the locale to apply to provider description, if null a default one will be
usednull if provider not foundException - the exceptionpublic void saveProviderConfiguration(CallProviderConfiguration config) throws Exception
config - the configException - the exceptionpublic 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 org.json.JSONObject readJson(String str) throws org.json.JSONException, CallInfoException
str - the strorg.json.JSONException - the JSON exception if string cannot be parsed to JSONCallInfoException - if string doesn't start with '{'protected CallInfo readCallById(String id) throws Exception
id - the idException - the exceptionprotected String readGroupCallId(String ownerId)
ownerId - the owner idnull if no call foundprotected Collection<CallInfo> readUserGroupCalls(String userId) throws Exception
userId - the user idException - the exceptionprotected CallProviderConfiguration jsonToProviderConfig(org.json.JSONObject json) throws Exception
json - the jsonException - the exceptionprotected org.json.JSONObject providerConfigToJson(CallProviderConfiguration conf) throws org.json.JSONException
conf - the conforg.json.JSONException - the JSON exceptionprotected CallProviderConfiguration readProviderConfig(String type) throws Exception
type - the typeException - the exceptionprotected void saveProviderConfig(CallProviderConfiguration conf) throws Exception
conf - the confException - the exceptionprotected 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 Exception
savedCall - the saved callwithParticipants - the with participantsException - the exceptionprotected UserInfo readParticipantEntity(ParticipantEntity savedPart) throws Exception
savedPart - the saved partException - the exceptionprotected CallEntity createCallEntity(CallInfo call) throws Exception
call - the callException - the exceptionprotected void updateCallEntity(CallInfo call, CallEntity entity) throws Exception
call - the callentity - the entityException - the exceptionprotected ParticipantEntity createParticipantEntity(String callId, UserInfo user)
callId - the call iduser - the userprotected <C extends SQLException> C findCause(javax.persistence.PersistenceException pe, Class<C> causeClass)
C - the generic typepe - the pecauseClass - the cause classprotected void createCall(CallInfo call) throws Exception
call - the callException - the exceptionExoTransactionalprotected void updateCall(CallInfo call) throws Exception
call - the callException - the exceptionprotected void updateParticipant(String callId, UserInfo participant) throws Exception
callId - the call idparticipant - the participantException - the exceptionprotected void updateCallAndParticipant(CallInfo call, UserInfo participant) throws Exception
call - the callparticipant - the participantException - the exceptionprotected void updateCallAndParticipants(CallInfo call) throws Exception
call - the callException - the exceptionprotected boolean deleteCall(String callId) throws Exception
callId - the call idException - the exceptionCopyright © 2003–2018 eXo Platform SAS. All rights reserved.