public class BoxClient extends BoxBase implements IAuthFlowListener
| Constructor and Description |
|---|
BoxClient(String clientId,
String clientSecret)
Deprecated.
|
BoxClient(String clientId,
String clientSecret,
IBoxResourceHub hub,
IBoxJSONParser parser) |
BoxClient(String clientId,
String clientSecret,
IBoxResourceHub hub,
IBoxJSONParser parser,
int maxConnection,
int maxConnectionPerRoute,
long timePeriodCleanUpIdleConnection,
long idleTimeThreshold)
This constructor has some connection parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOAuthRefreshListener(OAuthRefreshListener listener) |
void |
authenticate(IAuthData authData)
Get authenticated using a Auth object, this could be a previously stored data.
|
void |
authenticate(IAuthFlowUI authFlowUI,
boolean autoRefreshOAuth,
IAuthFlowListener listener)
Get authenticated.
|
void |
authenticateFromSecureStorage(IAuthSecureStorage storage)
Authenticate from the auth object stored in the secure storage.
|
IAuthDataController |
createAuthDataController(String clientId,
String clientSecret) |
IBoxRequestAuth |
createAuthorization(IAuthDataController controller) |
protected IBoxJSONParser |
createJSONParser(IBoxResourceHub resourceHub)
Create a json parser.
|
protected IBoxRESTClient |
createMonitoredRestClient(int maxConnection,
int maxConnectionPerRoute,
long timePeriodCleanUpIdleConnection,
long idleTimeThreshold) |
protected IBoxResourceHub |
createResourceHub()
Create a resource hub
|
protected IBoxRESTClient |
createRestClient()
Create a REST client to make api calls.
|
IBoxRequestAuth |
getAuth()
Get the auth object used to make api calls.
|
BoxOAuthToken |
getAuthData()
Get the OAuth data.
|
OAuthDataController.OAuthTokenState |
getAuthState()
Check authentication state.
|
BoxCollaborationsManager |
getCollaborationsManager() |
BoxCommentsManager |
getCommentsManager() |
IBoxConfig |
getConfig()
Get config.
|
BoxEventsManager |
getEventsManager() |
BoxFilesManager |
getFilesManager()
Get the BoxFilesManager, which can be used to make API calls on files endpoints.
|
BoxFoldersManager |
getFoldersManager() |
BoxGroupsManager |
getGroupsManager()
Get the BoxGroupsManager, which can be used to make API calls on groups endpoints.
|
IBoxJSONParser |
getJSONParser() |
OAuthDataController |
getOAuthDataController()
Get the OAuthDataController that controls OAuth data.
|
BoxOAuthManager |
getOAuthManager()
Get the OAuthManager, which can be used to make OAuth related api calls.
|
protected BoxOAuthToken |
getOAuthTokenFromMessage(IAuthFlowMessage message) |
BoxResourceManager |
getPluginManager(String pluginManagerKey) |
IBoxResourceHub |
getResourceHub()
Get resource hub.
|
BoxResourceManager |
getResourceManagerWithSharedLinkAuth(BoxResourceType type,
String sharedLink,
String password)
A generic way to get a resourceManager with shared link auth.
|
protected IBoxRESTClient |
getRestClient()
Get rest client.
|
BoxSearchManager |
getSearchManager() |
BoxCommentsManager |
getSharedCommentsManager(String sharedLink,
String password)
Get the BoxCommentsManager for shared items, which can be used to make API calls on comments endpoints for a shared item.
|
BoxFilesManager |
getSharedFilesManager(String sharedLink,
String password)
Get the BoxFilesManager for shared items, which can be used to make API calls on files endpoints for a shared item.
|
BoxFoldersManager |
getSharedFoldersManager(String sharedLink,
String password)
Get the BoxFoldersManager for shared items, which can be used to make API calls on folders endpoints for a shared item.
|
IBoxRequestAuth |
getSharedItemAuth(String sharedLink,
String password)
Get the authorization needed for shared items.
|
BoxSharedItemsManager |
getSharedItemsManager(String sharedLink,
String password)
Get Shared Items manager, which can be used to make API calls on shared item endpoints.
|
BoxUsersManager |
getUsersManager() |
boolean |
isAuthenticated()
Whether this client is authenticated.
|
void |
onAuthFlowEvent(IAuthEvent event,
IAuthFlowMessage message)
On an event.
|
void |
onAuthFlowException(Exception e)
On an exception.
|
void |
onAuthFlowMessage(IAuthFlowMessage message)
On a message.
|
BoxResourceManager |
pluginResourceManager(String key,
IPluginResourceManagerBuilder builder) |
void |
saveAuth(IAuthSecureStorage storage)
Save auth in a customized secure storage.
|
void |
setAutoRefreshOAuth(boolean autoRefresh)
Makes OAuth auto refresh itself when token expires.
|
void |
setConnectionOpen(boolean connectionOpen) |
void |
setConnectionTimeOut(int timeOut)
Set connection time out.
|
public BoxClient(String clientId, String clientSecret, IBoxResourceHub hub, IBoxJSONParser parser, int maxConnection, int maxConnectionPerRoute, long timePeriodCleanUpIdleConnection, long idleTimeThreshold)
maxConnection - maximum connection. Recommend value: 1000maxConnectionPerRoute - maximum connection allowed per route. Recommend value: 50timePeriodCleanUpIdleConnection - clean up idle connection every such period of time. in miliseconds. Recommend value: 300000(5 minutes)idleTimeThreshold - an idle connection will be closed if idled above this threshold of time. in miliseconds. Recommend value: 60000(1 minute)public BoxClient(String clientId, String clientSecret, IBoxResourceHub hub, IBoxJSONParser parser)
clientId - client idclientSecret - client secrethub - resource hub, use null for default resource hub.parser - json parser, use null for default parser.@Deprecated public BoxClient(String clientId, String clientSecret)
public BoxResourceManager pluginResourceManager(String key, IPluginResourceManagerBuilder builder)
public boolean isAuthenticated()
public void setAutoRefreshOAuth(boolean autoRefresh)
autoRefresh - public void setConnectionOpen(boolean connectionOpen)
public void setConnectionTimeOut(int timeOut)
timeOut - public OAuthDataController getOAuthDataController()
public void addOAuthRefreshListener(OAuthRefreshListener listener)
public BoxOAuthToken getAuthData() throws AuthFatalFailureException
AuthFatalFailureExceptionpublic void saveAuth(IAuthSecureStorage storage) throws AuthFatalFailureException
storage - AuthFatalFailureExceptionpublic void authenticateFromSecureStorage(IAuthSecureStorage storage)
storage - public BoxFilesManager getFilesManager()
public BoxOAuthManager getOAuthManager()
public BoxGroupsManager getGroupsManager()
public BoxSharedItemsManager getSharedItemsManager(String sharedLink, String password)
sharedLink - shared linkpassword - passwordpublic BoxFilesManager getSharedFilesManager(String sharedLink, String password)
sharedLink - shared link.password - password of the shared link, use null if there is no passwordpublic BoxFoldersManager getSharedFoldersManager(String sharedLink, String password)
sharedLink - shared link.password - password of the shared link, use null if there is no passwordpublic BoxCommentsManager getSharedCommentsManager(String sharedLink, String password)
sharedLink - shared link.password - password of the shared link, use null if there is no passwordpublic BoxResourceManager getResourceManagerWithSharedLinkAuth(BoxResourceType type, String sharedLink, String password)
type - sharedLink - password - public BoxResourceManager getPluginManager(String pluginManagerKey)
public BoxFoldersManager getFoldersManager()
public BoxSearchManager getSearchManager()
public BoxEventsManager getEventsManager()
public BoxCollaborationsManager getCollaborationsManager()
public BoxCommentsManager getCommentsManager()
public BoxUsersManager getUsersManager()
public void authenticate(IAuthData authData)
token - public void authenticate(IAuthFlowUI authFlowUI, boolean autoRefreshOAuth, IAuthFlowListener listener)
authFlowUI - UI for the auth(OAuth) flow.autoRefreshOAuth - whether the OAuth token should be auto refreshed when it expires.listener - listener listening to the auth flow events.public void onAuthFlowEvent(IAuthEvent event, IAuthFlowMessage message)
IAuthFlowListeneronAuthFlowEvent in interface IAuthFlowListenerevent - statemessage - context message of this eventpublic OAuthDataController.OAuthTokenState getAuthState()
public IBoxConfig getConfig()
protected IBoxResourceHub createResourceHub()
protected IBoxJSONParser createJSONParser(IBoxResourceHub resourceHub)
resourceHub - public IBoxResourceHub getResourceHub()
public IBoxJSONParser getJSONParser()
protected IBoxRESTClient getRestClient()
protected IBoxRESTClient createRestClient()
protected IBoxRESTClient createMonitoredRestClient(int maxConnection, int maxConnectionPerRoute, long timePeriodCleanUpIdleConnection, long idleTimeThreshold)
public IBoxRequestAuth getSharedItemAuth(String sharedLink, String password)
sharedLink - shared linkpassword - password(use null if no password at all)public IAuthDataController createAuthDataController(String clientId, String clientSecret)
public IBoxRequestAuth createAuthorization(IAuthDataController controller)
public IBoxRequestAuth getAuth()
public void onAuthFlowMessage(IAuthFlowMessage message)
IAuthFlowListeneronAuthFlowMessage in interface IAuthFlowListenermessage - messagepublic void onAuthFlowException(Exception e)
IAuthFlowListeneronAuthFlowException in interface IAuthFlowListenere - exceptionprotected BoxOAuthToken getOAuthTokenFromMessage(IAuthFlowMessage message)
Copyright © 2014. All Rights Reserved.