// Path: src/main/java/org/springframework/social/bitbucket/config/support/BitBucketApiHelper.java
// public class BitBucketApiHelper implements ApiHelper<BitBucket> {
//     private final UsersConnectionRepository usersConnectionRepository;
// 
//     private final UserIdSource userIdSource;
// 
//     private BitBucketApiHelper(
//             UsersConnectionRepository usersConnectionRepository,
//             UserIdSource userIdSource) {
//         this.usersConnectionRepository = usersConnectionRepository;
//         this.userIdSource = userIdSource;
//     }
// 
//     @Override
//     public BitBucket getApi() {
//         if (logger.isDebugEnabled()) {
//             logger.debug("Getting API binding instance for BitBucket");
//         }
// 
//         Connection<BitBucket> connection = usersConnectionRepository
//                 .createConnectionRepository(userIdSource.getUserId())
//                 .findPrimaryConnection(BitBucket.class);
//         if (logger.isDebugEnabled() && connection == null) {
//             logger.debug("No current connection; Returning default BitBucketTemplate instance.");
//         }
//         return connection != null ? connection.getApi() : null;
//     }
// 
//     private final static Log logger = LogFactory
//             .getLog(BitBucketApiHelper.class);
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/connect/BitBucketConnectionFactory.java
// public class BitBucketConnectionFactory extends
//         OAuth1ConnectionFactory<BitBucket> {
// 
//     public BitBucketConnectionFactory(String consumerKey, String consumerSecret) {
//         super("bitbucket", new BitBucketServiceProvider(consumerKey,
//                 consumerSecret), new BitBucketAdapter());
//     }
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/security/BitBucketAuthenticationService.java
// public class BitBucketAuthenticationService extends
//         OAuth1AuthenticationService<BitBucket> {
// 
//     public BitBucketAuthenticationService(String apiKey, String appSecret) {
//         super(new BitBucketConnectionFactory(apiKey, appSecret));
//     }
// 
// }


import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.social.bitbucket.config.support.BitBucketApiHelper;
import org.springframework.social.bitbucket.connect.BitBucketConnectionFactory;
import org.springframework.social.bitbucket.security.BitBucketAuthenticationService;
import org.springframework.social.config.annotation.AbstractProviderConfigRegistrarSupport;
import org.springframework.social.security.provider.SocialAuthenticationService;
package org.springframework.social.bitbucket.config.annotation;


/**
 * {@link ImportBeanDefinitionRegistrar} for configuring a
 * {@link TwitterConnectionFactory} bean and a request-scoped {@link Twitter}
 * bean.
 * 
 * @author Craig Walls
 */
public class TwitterProviderConfigRegistrar extends
        AbstractProviderConfigRegistrarSupport {

    public TwitterProviderConfigRegistrar() {
        super(EnableBitBucket.class, BitBucketConnectionFactory.class,
                BitBucketApiHelper.class);
    }

    @Override
    protected Class<? extends SocialAuthenticationService<?>> getAuthenticationServiceClass() {
// Path: src/main/java/org/springframework/social/bitbucket/config/support/BitBucketApiHelper.java
// public class BitBucketApiHelper implements ApiHelper<BitBucket> {
//     private final UsersConnectionRepository usersConnectionRepository;
// 
//     private final UserIdSource userIdSource;
// 
//     private BitBucketApiHelper(
//             UsersConnectionRepository usersConnectionRepository,
//             UserIdSource userIdSource) {
//         this.usersConnectionRepository = usersConnectionRepository;
//         this.userIdSource = userIdSource;
//     }
// 
//     @Override
//     public BitBucket getApi() {
//         if (logger.isDebugEnabled()) {
//             logger.debug("Getting API binding instance for BitBucket");
//         }
// 
//         Connection<BitBucket> connection = usersConnectionRepository
//                 .createConnectionRepository(userIdSource.getUserId())
//                 .findPrimaryConnection(BitBucket.class);
//         if (logger.isDebugEnabled() && connection == null) {
//             logger.debug("No current connection; Returning default BitBucketTemplate instance.");
//         }
//         return connection != null ? connection.getApi() : null;
//     }
// 
//     private final static Log logger = LogFactory
//             .getLog(BitBucketApiHelper.class);
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/connect/BitBucketConnectionFactory.java
// public class BitBucketConnectionFactory extends
//         OAuth1ConnectionFactory<BitBucket> {
// 
//     public BitBucketConnectionFactory(String consumerKey, String consumerSecret) {
//         super("bitbucket", new BitBucketServiceProvider(consumerKey,
//                 consumerSecret), new BitBucketAdapter());
//     }
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/security/BitBucketAuthenticationService.java
// public class BitBucketAuthenticationService extends
//         OAuth1AuthenticationService<BitBucket> {
// 
//     public BitBucketAuthenticationService(String apiKey, String appSecret) {
//         super(new BitBucketConnectionFactory(apiKey, appSecret));
//     }
// 
// }


// Path: src/main/java/org/springframework/social/bitbucket/config/annotation/TwitterProviderConfigRegistrar.java
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.social.bitbucket.config.support.BitBucketApiHelper;
import org.springframework.social.bitbucket.connect.BitBucketConnectionFactory;
import org.springframework.social.bitbucket.security.BitBucketAuthenticationService;
import org.springframework.social.config.annotation.AbstractProviderConfigRegistrarSupport;
import org.springframework.social.security.provider.SocialAuthenticationService;

package org.springframework.social.bitbucket.config.annotation;


/**
 * {@link ImportBeanDefinitionRegistrar} for configuring a
 * {@link TwitterConnectionFactory} bean and a request-scoped {@link Twitter}
 * bean.
 * 
 * @author Craig Walls
 */
public class TwitterProviderConfigRegistrar extends
        AbstractProviderConfigRegistrarSupport {

    public TwitterProviderConfigRegistrar() {
        super(EnableBitBucket.class, BitBucketConnectionFactory.class,
                BitBucketApiHelper.class);
    }

    @Override
    protected Class<? extends SocialAuthenticationService<?>> getAuthenticationServiceClass() {
        return BitBucketAuthenticationService.class;