org.exoplatform.clouddrive.cmis
Class CMISConnector

java.lang.Object
  extended by org.exoplatform.container.component.BaseComponentPlugin
      extended by org.exoplatform.clouddrive.CloudDriveConnector
          extended by org.exoplatform.clouddrive.cmis.CMISConnector
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin

public class CMISConnector
extends org.exoplatform.clouddrive.CloudDriveConnector

CMIS Connector.
Created by The eXo Platform SAS

Version:
$Id: CMISConnector.java 00000 Aug 30, 2013 pnedonosko $
Author:
Peter Nedonosko

Nested Class Summary
protected  class CMISConnector.API
          Internal API builder (logic based on OAuth2 flow used in Google Drive and Box connectors).
 
Nested classes/interfaces inherited from class org.exoplatform.clouddrive.CloudDriveConnector
org.exoplatform.clouddrive.CloudDriveConnector.PredefinedServices
 
Field Summary
protected static String CONFIG_PREDEFINED
           
 
Fields inherited from class org.exoplatform.clouddrive.CloudDriveConnector
config, CONFIG_CONNECTOR_HOST, CONFIG_CONNECTOR_SCHEMA, CONFIG_LOGIN_SSO, CONFIG_PREDEFINED_SERVICES, CONFIG_PROVIDER_CLIENT_ID, CONFIG_PROVIDER_CLIENT_SECRET, CONFIG_PROVIDER_ID, CONFIG_PROVIDER_NAME, connectorHost, connectorSchema, jcrFinder, jcrService, LOG, loginSSO, mimeTypes, predefinedServices, provider, PROVIDER_REQUEST_ATTEMPT_TIMEOUT, PROVIDER_REQUEST_ATTEMPTS, sessionProviders
 
Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name
 
Constructor Summary
CMISConnector(org.exoplatform.services.jcr.RepositoryService jcrService, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.clouddrive.jcr.NodeFinder finder, org.exoplatform.clouddrive.utils.ExtendedMimeTypeResolver mimeTypes, org.exoplatform.container.xml.InitParams params, CodeAuthentication codeAuth)
           
 
Method Summary
protected  CMISUser authenticate(String code)
          Authenticate an user by a code and return CMISUser instance.
protected  CMISAPI createAPI(CodeAuthentication.Identity userId)
          Create CMISAPI instance.
protected  org.exoplatform.clouddrive.CloudDrive createDrive(org.exoplatform.clouddrive.CloudUser user, javax.jcr.Node driveNode)
           
protected  org.exoplatform.clouddrive.CloudProvider createProvider()
           
protected  CMISUser createUser(CodeAuthentication.Identity userId)
          Create an instance of CMISUser using data from given CodeAuthentication.Identity or/and CMISAPI.
protected  String exoURL()
           
protected  String getAuthProviderId()
          Provider id that should be used in authentication URL of the provider.
protected  CMISProvider getProvider()
          
protected  org.exoplatform.clouddrive.CloudDrive loadDrive(javax.jcr.Node driveNode)
           
 
Methods inherited from class org.exoplatform.clouddrive.CloudDriveConnector
getClientId, getClientSecret, getConnectorHost, getConnectorSchema, getProviderId, getProviderName, sessionProvider
 
Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_PREDEFINED

protected static final String CONFIG_PREDEFINED
See Also:
Constant Field Values
Constructor Detail

CMISConnector

public CMISConnector(org.exoplatform.services.jcr.RepositoryService jcrService,
                     org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
                     org.exoplatform.clouddrive.jcr.NodeFinder finder,
                     org.exoplatform.clouddrive.utils.ExtendedMimeTypeResolver mimeTypes,
                     org.exoplatform.container.xml.InitParams params,
                     CodeAuthentication codeAuth)
              throws org.exoplatform.clouddrive.ConfigurationException
Throws:
org.exoplatform.clouddrive.ConfigurationException
Method Detail

getProvider

protected CMISProvider getProvider()

Overrides:
getProvider in class org.exoplatform.clouddrive.CloudDriveConnector

createProvider

protected org.exoplatform.clouddrive.CloudProvider createProvider()
                                                           throws org.exoplatform.clouddrive.ConfigurationException
Specified by:
createProvider in class org.exoplatform.clouddrive.CloudDriveConnector
Throws:
org.exoplatform.clouddrive.ConfigurationException

authenticate

protected CMISUser authenticate(String code)
                         throws org.exoplatform.clouddrive.CloudDriveException
Authenticate an user by a code and return CMISUser instance. CMIS connector requires custom two step authentication instead of OAuth2 flow. This two-step flow is similar to OAuth2 where user does authentication to the service and then authorizes via OAuth2 protocol. This is done to support other parts of Cloud Drive add-on.
On first call of this method (first step), given code will be exchanged on user identity and CMISUser instance will be created. This user instance will be stored in the connector mapped by the code. At the same time the user identity should be late initialized with a context (CMIS repository to connect by the user). If the identity will not be initialized before a second call (second step), this method will fail with CloudDriveException.
CMIS connector doesn't manage the user identity initialization or any other extra steps. This should be done outside this connector (e.g. via dedicated authenticator).
CMIS connector will detect if dedicated connector available for given service and then will return user instance initialized by that connector.

Specified by:
authenticate in class org.exoplatform.clouddrive.CloudDriveConnector
Parameters:
code - String authentication code
Returns:
CMISUser
Throws:
org.exoplatform.clouddrive.CloudDriveException

createDrive

protected org.exoplatform.clouddrive.CloudDrive createDrive(org.exoplatform.clouddrive.CloudUser user,
                                                            javax.jcr.Node driveNode)
                                                     throws org.exoplatform.clouddrive.CloudDriveException,
                                                            javax.jcr.RepositoryException
Specified by:
createDrive in class org.exoplatform.clouddrive.CloudDriveConnector
Throws:
org.exoplatform.clouddrive.CloudDriveException
javax.jcr.RepositoryException

loadDrive

protected org.exoplatform.clouddrive.CloudDrive loadDrive(javax.jcr.Node driveNode)
                                                   throws org.exoplatform.clouddrive.DriveRemovedException,
                                                          org.exoplatform.clouddrive.CloudDriveException,
                                                          javax.jcr.RepositoryException
Specified by:
loadDrive in class org.exoplatform.clouddrive.CloudDriveConnector
Throws:
org.exoplatform.clouddrive.DriveRemovedException
org.exoplatform.clouddrive.CloudDriveException
javax.jcr.RepositoryException

exoURL

protected String exoURL()

createAPI

protected CMISAPI createAPI(CodeAuthentication.Identity userId)
                     throws CMISException,
                            org.exoplatform.clouddrive.CloudDriveException
Create CMISAPI instance.

Parameters:
userId - CodeAuthentication.Identity
Returns:
CMISAPI instance
Throws:
CMISException
org.exoplatform.clouddrive.CloudDriveException

createUser

protected CMISUser createUser(CodeAuthentication.Identity userId)
                       throws CMISException,
                              org.exoplatform.clouddrive.CloudDriveException
Create an instance of CMISUser using data from given CodeAuthentication.Identity or/and CMISAPI.

Parameters:
userId - CodeAuthentication.Identity
api - CMISAPI
Returns:
CMISUser
Throws:
CMISException
org.exoplatform.clouddrive.CloudDriveException

getAuthProviderId

protected String getAuthProviderId()
                            throws org.exoplatform.clouddrive.ConfigurationException
Provider id that should be used in authentication URL of the provider. In case of dedicated connector based on CMIS this method may return 'cmis' id to use default authentication flow for CMIS services.

Returns:
String
Throws:
org.exoplatform.clouddrive.ConfigurationException - if provider id cannot be determined for this connector authentication flow


Copyright © 2003–2015 eXo Platform SAS. All rights reserved.