Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2015 Zalando SE (http://tech.zalando.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.zalando.stups.tokens;
 
 import java.net.URI;
 
 import java.util.Set;
 
 public class AccessTokensBuilder {
     private final URI accessTokenUri;
 
     private int refreshPercentLeft = 40;
     private int warnPercentLeft = 20;
 
 
     private boolean locked = false;
 
     AccessTokensBuilder(final URI accessTokenUri) {
         this. = accessTokenUri;
     }
 
     private void checkLock() {
         if () {
             throw new IllegalStateException("configuration already done");
         }
     }
 
     private void checkNotNull(final String namefinal Object obj) {
         if (obj == null) {
             throw new IllegalArgumentException(name + " must not be null");
         }
     }
 
             final ClientCredentialsProvider clientCredentialsProvider) {
         checkLock();
         checkNotNull("clientCredentialsProvider"clientCredentialsProvider);
         this. = clientCredentialsProvider;
         return this;
     }
 
     public AccessTokensBuilder usingUserCredentialsProvider(final UserCredentialsProvider userCredentialsProvider) {
         checkLock();
         checkNotNull("userCredentialsProvider"userCredentialsProvider);
         this. = userCredentialsProvider;
         return this;
     }
 
     public AccessTokensBuilder refreshPercentLeft(final int refreshPercentLeft) {
         checkLock();
         this. = refreshPercentLeft;
         return this;
     }
 
     public AccessTokensBuilder warnPercentLeft(final int warnPercentLeft) {
         checkLock();
         this. = warnPercentLeft;
         return this;
     }
 
     public AccessTokenConfiguration manageToken(final Object tokenId) {
         checkLock();
         checkNotNull("tokenId"tokenId);
 
         final AccessTokenConfiguration config = new AccessTokenConfiguration(tokenIdthis);
         .add(config);
         return config;
     }
 
     URI getAccessTokenUri() {
         return ;
     }
 
         return ;
     }
 
         return ;
     }
 
    int getRefreshPercentLeft() {
        return ;
    }
    int getWarnPercentLeft() {
        return ;
    }
        return Collections.unmodifiableSet();
    }
    public AccessTokens start() {
        if (.size() == 0) {
            throw new IllegalArgumentException("no scopes defined");
        }
         = true;
        if ( == null) {
            // use default
        }
        if ( == null) {
            // use default
        }
        final AccessTokenRefresher refresher = new AccessTokenRefresher(this);
        refresher.run();
        refresher.start();
        return refresher;
    }
New to GrepCode? Check out our FAQ X