Class CometdOnlyofficeService
- java.lang.Object
-
- org.exoplatform.onlyoffice.cometd.CometdOnlyofficeService
-
- All Implemented Interfaces:
org.picocontainer.Startable
public class CometdOnlyofficeService extends Object implements org.picocontainer.Startable
The CometdOnlyofficeService.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCometdOnlyofficeService.CometdServiceThe CometService is responsible for sending messages to Cometd channels when a document is saved.
-
Field Summary
Fields Modifier and Type Field Description static StringCHANNEL_NAMEThe channel name.static StringCHANNEL_NAME_PARAMSThe channel name.static StringDOCUMENT_CHANGED_EVENTThe document changed event.static StringDOCUMENT_CONTENT_UPDATED_EVENTThe Constant DOCUMENT_CONTENT_UPDATED_EVENT.static StringDOCUMENT_DELETED_EVENTThe document deleted event.static StringDOCUMENT_LINK_EVENTThe document link event.static StringDOCUMENT_SAVED_EVENTThe document saved event.static StringDOCUMENT_TITLE_UPDATEDThe document title updated event.static StringDOCUMENT_USERSAVEDThe document usersave event.static StringDOCUMENT_VERSION_EVENTThe document version event.static StringEDITOR_CLOSED_EVENTThe editor closed event.protected OnlyofficeEditorServiceeditorsThe Onlyoffice editor service.protected ExecutorServiceeventsHandlersThe call handlers.protected org.mortbay.cometd.continuation.EXoContinuationBayeuxexoBayeuxThe exo bayeux.protected org.exoplatform.services.jcr.RepositoryServicejcrServiceThe jcr service.static intMAX_FACTORMaximum threads per CPU for thread executors of document changes channel.static intMIN_MAX_THREADSMinimal number of threads maximum possible for document updates thread executors.static intMIN_THREADSBase minimum number of threads for document updates thread executors.static intQUEUE_FACTORQueue size per CPU for thread executors of document updates channel.protected CometdOnlyofficeService.CometdServiceserviceThe service.static intTHREAD_IDLE_TIMEThread idle time for thread executors (in seconds).static StringTHREAD_PREFIXThread name used for the executor.
-
Constructor Summary
Constructors Constructor Description CometdOnlyofficeService(org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux, OnlyofficeEditorService onlyofficeEditorService, org.exoplatform.services.jcr.RepositoryService jcrService)Instantiates the CometdOnlyofficeService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringchannelsAsString(Set<org.cometd.bayeux.server.ServerChannel> channels)Channels as string.protected ExecutorServicecreateThreadExecutor(String threadNamePrefix, int maxFactor, int queueFactor)Create a new thread executor service.StringgetCometdServerPath()Gets the cometd server path.protected StringgetDisplayName(String userId)Gets user's display name.StringgetUserToken(String userId)Gets the user token.voidstart()voidstop()
-
-
-
Field Detail
-
CHANNEL_NAME
public static final String CHANNEL_NAME
The channel name.- See Also:
- Constant Field Values
-
CHANNEL_NAME_PARAMS
public static final String CHANNEL_NAME_PARAMS
The channel name.- See Also:
- Constant Field Values
-
DOCUMENT_SAVED_EVENT
public static final String DOCUMENT_SAVED_EVENT
The document saved event.- See Also:
- Constant Field Values
-
DOCUMENT_DELETED_EVENT
public static final String DOCUMENT_DELETED_EVENT
The document deleted event.- See Also:
- Constant Field Values
-
DOCUMENT_CHANGED_EVENT
public static final String DOCUMENT_CHANGED_EVENT
The document changed event.- See Also:
- Constant Field Values
-
DOCUMENT_VERSION_EVENT
public static final String DOCUMENT_VERSION_EVENT
The document version event.- See Also:
- Constant Field Values
-
DOCUMENT_LINK_EVENT
public static final String DOCUMENT_LINK_EVENT
The document link event.- See Also:
- Constant Field Values
-
DOCUMENT_TITLE_UPDATED
public static final String DOCUMENT_TITLE_UPDATED
The document title updated event.- See Also:
- Constant Field Values
-
DOCUMENT_USERSAVED
public static final String DOCUMENT_USERSAVED
The document usersave event.- See Also:
- Constant Field Values
-
EDITOR_CLOSED_EVENT
public static final String EDITOR_CLOSED_EVENT
The editor closed event.- See Also:
- Constant Field Values
-
DOCUMENT_CONTENT_UPDATED_EVENT
public static final String DOCUMENT_CONTENT_UPDATED_EVENT
The Constant DOCUMENT_CONTENT_UPDATED_EVENT.- See Also:
- Constant Field Values
-
MIN_THREADS
public static final int MIN_THREADS
Base minimum number of threads for document updates thread executors.- See Also:
- Constant Field Values
-
MIN_MAX_THREADS
public static final int MIN_MAX_THREADS
Minimal number of threads maximum possible for document updates thread executors.- See Also:
- Constant Field Values
-
THREAD_IDLE_TIME
public static final int THREAD_IDLE_TIME
Thread idle time for thread executors (in seconds).- See Also:
- Constant Field Values
-
MAX_FACTOR
public static final int MAX_FACTOR
Maximum threads per CPU for thread executors of document changes channel.- See Also:
- Constant Field Values
-
QUEUE_FACTOR
public static final int QUEUE_FACTOR
Queue size per CPU for thread executors of document updates channel.- See Also:
- Constant Field Values
-
THREAD_PREFIX
public static final String THREAD_PREFIX
Thread name used for the executor.- See Also:
- Constant Field Values
-
editors
protected final OnlyofficeEditorService editors
The Onlyoffice editor service.
-
exoBayeux
protected final org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux
The exo bayeux.
-
service
protected final CometdOnlyofficeService.CometdService service
The service.
-
eventsHandlers
protected final ExecutorService eventsHandlers
The call handlers.
-
jcrService
protected final org.exoplatform.services.jcr.RepositoryService jcrService
The jcr service.
-
-
Constructor Detail
-
CometdOnlyofficeService
public CometdOnlyofficeService(org.mortbay.cometd.continuation.EXoContinuationBayeux exoBayeux, OnlyofficeEditorService onlyofficeEditorService, org.exoplatform.services.jcr.RepositoryService jcrService)Instantiates the CometdOnlyofficeService.- Parameters:
exoBayeux- the exoBayeuxonlyofficeEditorService- the onlyoffice editor servicejcrService- the jcr service
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceorg.picocontainer.Startable
-
channelsAsString
protected String channelsAsString(Set<org.cometd.bayeux.server.ServerChannel> channels)
Channels as string.- Parameters:
channels- the channels- Returns:
- the string
-
stop
public void stop()
- Specified by:
stopin interfaceorg.picocontainer.Startable
-
getCometdServerPath
public String getCometdServerPath()
Gets the cometd server path.- Returns:
- the cometd server path
-
getUserToken
public String getUserToken(String userId)
Gets the user token.- Parameters:
userId- the userId- Returns:
- the token
-
createThreadExecutor
protected ExecutorService createThreadExecutor(String threadNamePrefix, int maxFactor, int queueFactor)
Create a new thread executor service.- Parameters:
threadNamePrefix- the thread name prefixmaxFactor- - max processes per CPU corequeueFactor- - queue size per CPU core- Returns:
- the executor service
-
-