/** * Gets the access token. If no access token is present or the access token * is expired, a new token is requested. * * @return the access token */ protected String getAccessToken() { lock.writeLock().lock(); try { if (token.getAccessToken() == null) { if (token.getRefreshToken() == null) { requestToken(); } else { refreshToken(); } } else if (token.isExpired()) { refreshToken(); } return token.getAccessToken(); } catch (CmisConnectionException ce) { throw ce; } catch (Exception e) { throw new CmisConnectionException("Cannot get OAuth access token: " + e.getMessage(), e); } finally { lock.writeLock().unlock(); } }
/** * Gets the access token. If no access token is present or the access token * is expired, a new token is requested. * * @return the access token */ protected String getAccessToken() { lock.writeLock().lock(); try { if (token.getAccessToken() == null) { if (token.getRefreshToken() == null) { requestToken(); } else { refreshToken(); } } else if (token.isExpired()) { refreshToken(); } return token.getAccessToken(); } catch (CmisConnectionException ce) { throw ce; } catch (Exception e) { throw new CmisConnectionException("Cannot get OAuth access token: " + e.getMessage(), e); } finally { lock.writeLock().unlock(); } }