public class OnlyofficeEditorServiceImpl extends Object implements OnlyofficeEditorService, org.picocontainer.Startable
| Modifier and Type | Field and Description |
|---|---|
protected org.exoplatform.services.cache.ExoCache<String,ConcurrentHashMap<String,Config>> |
activeCache
Cache of Editing documents.
|
protected ReentrantLock |
activeLock
Lock for updating Editing documents cache.
|
protected org.exoplatform.services.security.Authenticator |
authenticator
The authenticator.
|
static String |
CACHE_NAME
The Constant CACHE_NAME.
|
protected Map<String,String> |
config
The config.
|
static String |
CONFIG_DS_ACCESS_ONLY
The Constant CONFIG_DS_ACCESS_ONLY.
|
static String |
CONFIG_DS_HOST
The Constant CONFIG_DS_HOST.
|
static String |
CONFIG_DS_SCHEMA
The Constant CONFIG_DS_SCHEMA.
|
protected boolean |
documentserverAccessOnly
The documentserver access only.
|
protected String |
documentserverHostName
The documentserver host name.
|
protected String |
documentserverUrl
The documentserver url.
|
protected static String |
EMPTY_TEXT
The Constant EMPTY_TEXT.
|
protected Map<String,String> |
fileTypes
The file types.
|
protected NodeFinder |
finder
The finder.
|
protected static char |
HTTP_PORT_DELIMITER
The Constant HTTP_PORT_DELIMITER.
|
protected org.exoplatform.services.security.IdentityRegistry |
identityRegistry
The identity registry.
|
protected org.exoplatform.services.jcr.RepositoryService |
jcrService
The jcr service.
|
protected ConcurrentLinkedQueue<OnlyofficeEditorListener> |
listeners
The listeners.
|
protected static int |
LOCK_WAIT_ATTEMTS
The Constant LOCK_WAIT_ATTEMTS.
|
protected static long |
LOCK_WAIT_TIMEOUT
The Constant LOCK_WAIT_TIMEOUT.
|
protected static org.exoplatform.services.log.Log |
LOG
The Constant LOG.
|
protected org.exoplatform.services.organization.OrganizationService |
organization
The organization.
|
protected static Random |
RANDOM
The Constant RANDOM.
|
protected org.exoplatform.services.jcr.ext.app.SessionProviderService |
sessionProviders
The session providers.
|
protected static String |
TYPE_PRESENTATION
The Constant TYPE_PRESENTATION.
|
protected static String |
TYPE_SPREADSHEET
The Constant TYPE_SPREADSHEET.
|
protected static String |
TYPE_TEXT
The Constant TYPE_TEXT.
|
protected MessageFormat |
uploadParams
The upload params.
|
protected String |
uploadUrl
The upload url.
|
| Constructor and Description |
|---|
OnlyofficeEditorServiceImpl(org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.security.IdentityRegistry identityRegistry,
NodeFinder finder,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.services.security.Authenticator authenticator,
org.exoplatform.services.cache.CacheService cacheService,
org.exoplatform.container.xml.InitParams params)
Cloud Drive service with storage in JCR and with managed features.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(OnlyofficeEditorListener listener)
Add listener to the service.
|
boolean |
canDownloadBy(String hostName)
Check does given host can download document content by this service.
|
protected javax.jcr.version.Version |
checkin(javax.jcr.Node node)
Deprecated.
|
protected boolean |
checkout(javax.jcr.Node node)
Checkout.
|
Config |
createEditor(String schema,
String host,
String userId,
String workspace,
String path)
Create an editor config for given config node.
|
protected javax.jcr.Property |
data(javax.jcr.Node content)
Data.
|
protected String |
documentType(String fileType)
Document type.
|
protected void |
download(Config config,
DocumentStatus status)
Download.
|
protected void |
downloadChange(Config config)
Deprecated.
|
protected StringBuilder |
editorUrl(String schema,
String host)
Editor url.
|
protected String |
fileType(javax.jcr.Node node)
File type.
|
protected void |
fireCreated(Config config)
Fire created.
|
protected void |
fireError(Config config)
Fire error.
|
protected void |
fireGet(Config config)
Fire get.
|
protected void |
fireJoined(Config config)
Fire joined.
|
protected void |
fireLeaved(Config config)
Fire leaved.
|
protected void |
fireSaved(Config config)
Fire saved.
|
protected UUID |
generateId(String workspace,
String path)
Generate id.
|
DocumentContent |
getContent(String userId,
String key)
Get file content.
|
protected String[] |
getCurrentUsers(ConcurrentHashMap<String,Config> configs)
Gets the current users.
|
protected Config |
getEditor(String userId,
String nodePath)
Gets the editor.
|
Config |
getEditor(String userId,
String workspace,
String path)
Return existing editor for given user and node.
|
ChangeState |
getState(String userId,
String key)
Local state of editing document.
|
protected org.exoplatform.services.organization.User |
getUser(String username)
Gets the user.
|
protected String |
getUserLang(String userId)
Gets the user lang.
|
protected javax.jcr.lock.Lock |
lock(javax.jcr.Node node,
Config config)
Lock by current user of the node.
|
protected String |
mimeType(javax.jcr.Node content)
Mime type.
|
protected javax.jcr.Node |
node(String workspace,
String path)
Node.
|
protected javax.jcr.Node |
nodeContent(javax.jcr.Node node)
Node content.
|
protected Calendar |
nodeCreated(javax.jcr.Node node)
Node created.
|
protected String |
nodePath(Config config)
Node path.
|
protected String |
nodePath(String workspace,
String path)
Node path.
|
protected String |
nodeTitle(javax.jcr.Node node)
Node title.
|
protected StringBuilder |
platformUrl(String schema,
String host)
Platform url.
|
void |
removeListener(OnlyofficeEditorListener listener)
Remove listener from the service.
|
void |
start()
On-start initializer.
|
void |
stop()
On-stop finalizer.
|
protected boolean |
syncUsers(ConcurrentHashMap<String,Config> configs,
String[] users)
Sync users.
|
protected javax.jcr.Node |
systemNode(String workspace,
String path)
System node.
|
protected void |
trackChange(Config config,
DocumentStatus status)
Deprecated.
|
protected boolean |
unlock(javax.jcr.Node node,
Config config)
Deprecated.
|
void |
updateDocument(String userId,
DocumentStatus status)
Update a config associated with given editor
Config instance. |
protected String |
uploadContent(InputStream localContent,
String fileKey,
String mimeType,
long length)
Deprecated.
|
protected org.exoplatform.services.security.Identity |
userIdentity(String userId)
Find or create user identity.
|
protected void |
validateUser(String userId,
Config config)
Validate user.
|
protected URI |
webdavUri(String schema,
String host)
Webdav uri.
|
protected String |
webdavUrl(String schema,
String host,
String workspace,
String path)
Webdav url.
|
protected static final org.exoplatform.services.log.Log LOG
protected static final Random RANDOM
public static final String CONFIG_DS_HOST
public static final String CONFIG_DS_SCHEMA
public static final String CONFIG_DS_ACCESS_ONLY
protected static final char HTTP_PORT_DELIMITER
protected static final String TYPE_TEXT
protected static final String TYPE_SPREADSHEET
protected static final String TYPE_PRESENTATION
protected static final int LOCK_WAIT_ATTEMTS
protected static final long LOCK_WAIT_TIMEOUT
protected static final String EMPTY_TEXT
public static final String CACHE_NAME
protected final org.exoplatform.services.jcr.RepositoryService jcrService
protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders
protected final org.exoplatform.services.security.IdentityRegistry identityRegistry
protected final NodeFinder finder
protected final org.exoplatform.services.organization.OrganizationService organization
protected final org.exoplatform.services.security.Authenticator authenticator
protected final org.exoplatform.services.cache.ExoCache<String,ConcurrentHashMap<String,Config>> activeCache
protected final ReentrantLock activeLock
protected final String uploadUrl
protected final String documentserverHostName
protected final String documentserverUrl
protected final boolean documentserverAccessOnly
protected final MessageFormat uploadParams
protected final ConcurrentLinkedQueue<OnlyofficeEditorListener> listeners
public OnlyofficeEditorServiceImpl(org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.security.IdentityRegistry identityRegistry,
NodeFinder finder,
org.exoplatform.services.organization.OrganizationService organization,
org.exoplatform.services.security.Authenticator authenticator,
org.exoplatform.services.cache.CacheService cacheService,
org.exoplatform.container.xml.InitParams params)
throws org.exoplatform.container.configuration.ConfigurationException
jcrService - RepositoryServicesessionProviders - SessionProviderServiceidentityRegistry - the identity registryfinder - the finderorganization - the organizationauthenticator - the authenticatorcacheService - the cache serviceparams - the paramsorg.exoplatform.container.configuration.ConfigurationException - the configuration exceptionpublic void addListener(OnlyofficeEditorListener listener)
addListener in interface OnlyofficeEditorServicelistener - the listenerpublic void removeListener(OnlyofficeEditorListener listener)
removeListener in interface OnlyofficeEditorServicelistener - the listenerpublic Config getEditor(String userId, String workspace, String path) throws OnlyofficeEditorException, javax.jcr.RepositoryException
null will be returned.getEditor in interface OnlyofficeEditorServiceuserId - Stringworkspace - Stringpath - StringConfig or nullOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exceptionprotected Config getEditor(String userId, String nodePath) throws OnlyofficeEditorException, javax.jcr.RepositoryException
userId - the user idnodePath - the node pathOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exceptionpublic Config createEditor(String schema, String host, String userId, String workspace, String path) throws OnlyofficeEditorException, javax.jcr.RepositoryException
createEditor in interface OnlyofficeEditorServiceschema - the schemahost - the hostuserId - Stringworkspace - Stringpath - StringConfig instance in case of successful creation or null if local file type
not supported.OnlyofficeEditorException - if editor exception happenedjavax.jcr.RepositoryException - if storage exception happenedpublic DocumentContent getContent(String userId, String key) throws OnlyofficeEditorException, javax.jcr.RepositoryException
getContent in interface OnlyofficeEditorServiceuserId - Stringkey - StringDocumentContentOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exceptionpublic boolean canDownloadBy(String hostName)
canDownloadBy in interface OnlyofficeEditorServicehostName - Stringtrue if client host with given name can download document content,
false otherwise.public ChangeState getState(String userId, String key) throws OnlyofficeEditorException
getState in interface OnlyofficeEditorServiceuserId - Stringkey - StringChangeStateOnlyofficeEditorException - the onlyoffice editor exceptionpublic void updateDocument(String userId, DocumentStatus status) throws OnlyofficeEditorException, javax.jcr.RepositoryException
Config instance. A Node from that the
config was created will be updated. This operation will close the editor and it will not be usable
after that.updateDocument in interface OnlyofficeEditorServiceuserId - Stringstatus - DocumentStatusOnlyofficeEditorException - if editor exception happenedjavax.jcr.RepositoryException - if storage exception happenedpublic void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startableprotected String nodeTitle(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected String fileType(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected String documentType(String fileType)
fileType - the file typeprotected javax.jcr.Node nodeContent(javax.jcr.Node node)
throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected Calendar nodeCreated(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected String mimeType(javax.jcr.Node content) throws javax.jcr.RepositoryException
content - the contentjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Property data(javax.jcr.Node content)
throws javax.jcr.RepositoryException
content - the contentjavax.jcr.RepositoryException - the repository exceptionprotected UUID generateId(String workspace, String path)
workspace - the workspacepath - the pathprotected String nodePath(String workspace, String path)
workspace - the workspacepath - the pathprotected String nodePath(Config config)
config - the configprotected org.exoplatform.services.organization.User getUser(String username) throws OnlyofficeEditorException
username - the usernameOnlyofficeEditorException - the onlyoffice editor exceptionprotected String webdavUrl(String schema, String host, String workspace, String path) throws OnlyofficeEditorException, javax.jcr.RepositoryException
schema - the schemahost - the hostworkspace - the workspacepath - the pathOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exception@Deprecated protected String uploadContent(InputStream localContent, String fileKey, String mimeType, long length) throws IOException, OnlyofficeEditorException
localContent - the local contentfileKey - the file keymimeType - the mime typelength - the lengthIOException - Signals that an I/O exception has occurred.OnlyofficeEditorException - the onlyoffice editor exceptionprotected boolean syncUsers(ConcurrentHashMap<String,Config> configs, String[] users)
configs - the configsusers - the usersprotected String[] getCurrentUsers(ConcurrentHashMap<String,Config> configs)
configs - the configsprotected void download(Config config, DocumentStatus status) throws OnlyofficeEditorException, javax.jcr.RepositoryException
config - the configstatus - the statusOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exception@Deprecated protected void downloadChange(Config config) throws OnlyofficeEditorException, javax.jcr.RepositoryException
config - the configOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exception@Deprecated protected void trackChange(Config config, DocumentStatus status) throws BadParameterException, OnlyofficeEditorException, javax.jcr.RepositoryException
config - the configstatus - the statusBadParameterException - the bad parameter exceptionOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node node(String workspace, String path) throws BadParameterException, javax.jcr.RepositoryException
workspace - the workspacepath - the pathBadParameterException - the bad parameter exceptionjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Node systemNode(String workspace, String path) throws BadParameterException, javax.jcr.RepositoryException
workspace - the workspacepath - the pathBadParameterException - the bad parameter exceptionjavax.jcr.RepositoryException - the repository exceptionprotected boolean checkout(javax.jcr.Node node)
throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exception@Deprecated protected javax.jcr.version.Version checkin(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the nodejavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.lock.Lock lock(javax.jcr.Node node,
Config config)
throws OnlyofficeEditorException,
javax.jcr.RepositoryException
OnlyofficeEditorException. If node isn't mix:versionable it will be added first and node saved.node - Nodeconfig - ConfigLock acquired by current user.OnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exception@Deprecated protected boolean unlock(javax.jcr.Node node, Config config) throws OnlyofficeEditorException, javax.jcr.RepositoryException
node - the nodeconfig - the configOnlyofficeEditorException - the onlyoffice editor exceptionjavax.jcr.RepositoryException - the repository exceptionprotected void validateUser(String userId, Config config) throws OnlyofficeEditorException
userId - the user idconfig - the configOnlyofficeEditorException - the onlyoffice editor exceptionprotected String getUserLang(String userId) throws OnlyofficeEditorException
userId - the user idnull if user has no profile or language in itOnlyofficeEditorException - the onlyoffice editor exceptionprotected StringBuilder platformUrl(String schema, String host)
schema - the schemahost - the hostprotected StringBuilder editorUrl(String schema, String host)
schema - the schemahost - the hostprotected URI webdavUri(String schema, String host) throws URISyntaxException
schema - the schemahost - the hostURISyntaxException - the URI syntax exceptionprotected void fireCreated(Config config)
config - the configprotected void fireGet(Config config)
config - the configprotected void fireJoined(Config config)
config - the configprotected void fireLeaved(Config config)
config - the configprotected void fireSaved(Config config)
config - the configprotected void fireError(Config config)
config - the configprotected org.exoplatform.services.security.Identity userIdentity(String userId)
Copyright © 2003–2018 eXo Platform SAS. All rights reserved.