org.springframework.social.connect.Connection.getApi()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.springframework.social.connect.Connection.getApi()方法的一些代码示例,展示了Connection.getApi()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getApi()方法的具体详情如下:
包路径:org.springframework.social.connect.Connection
类名称:Connection
方法名:getApi

Connection.getApi介绍

[英]A Java binding to the service provider's native API.
[中]与服务提供商的本机API的Java绑定。

代码示例

代码示例来源:origin: com.jtbdevelopment.core-games/games-web

@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.INTERFACES)
@Autowired
public Facebook facebook(final ConnectionRepository connectionRepository) {
 Connection<Facebook> connection = connectionRepository.findPrimaryConnection(Facebook.class);
 return (connection == null ? null : connection.getApi());
}

代码示例来源:origin: PacktPublishing/OAuth-2.0-Cookbook

@Bean
@ConditionalOnMissingBean(Facebook.class)
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Facebook facebook(ConnectionRepository repository) {
  Connection<Facebook> connection = repository
      .findPrimaryConnection(Facebook.class);
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: spring-projects/spring-social-facebook

@Bean
@ConditionalOnMissingBean(Facebook.class)
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Facebook facebook(ConnectionRepository repository) {
  Connection<Facebook> connection = repository
      .findPrimaryConnection(Facebook.class);
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: org.siggi-ci/siggi-ci-connect-github-ghcom

@Bean
@ConditionalOnMissingBean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Ghcom ghcom(ConnectionRepository repository) {
  Connection<Ghcom> connection = repository.findPrimaryConnection(Ghcom.class);
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: spring-projects/spring-social-linkedin

@Bean
@ConditionalOnMissingBean(LinkedIn.class)
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public LinkedIn linkedin(ConnectionRepository repository) {
  Connection<LinkedIn> connection = repository
      .findPrimaryConnection(LinkedIn.class);
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: PacktPublishing/OAuth-2.0-Cookbook

@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public GitHub gitHub(ConnectionRepository repository) {
  Connection<GitHub> connection = repository
      .findPrimaryConnection(GitHub.class);
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: org.springframework.social/spring-social-facebook

public Facebook getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for Facebook");
  }
  
  Connection<Facebook> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Facebook.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default FacebookTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: org.springframework.social/spring-social-google

public Google getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for Google provider");
  }
  Connection<Google> connection = usersConnectionRepository
      .createConnectionRepository(userIdSource.getUserId())
      .findPrimaryConnection(Google.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default GoogleTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: com.wuyushuo/spring-social-boxes

public Wechat getApi() {
  if (log.isDebugEnabled()) {
    log.debug("Getting API binding instance for Wechat provider");
  }
  Connection<Wechat> connection = this.usersConnectionRepository.createConnectionRepository(this.userIdSource.getUserId()).findPrimaryConnection(Wechat.class);
  if (log.isDebugEnabled() && connection == null) {
    log.debug("No current connection; Returning default WechatTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: com.wuyushuo/spring-social-boxes

public QQ getApi() {
  if (log.isDebugEnabled()) {
    log.debug("Getting API binding instance for Wechat provider");
  }
  Connection<QQ> connection = this.usersConnectionRepository.createConnectionRepository(this.userIdSource.getUserId()).findPrimaryConnection(QQ.class);
  if (log.isDebugEnabled() && connection == null) {
    log.debug("No current connection; Returning default FacebookTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: spring-projects/spring-social-facebook

public Facebook getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for Facebook");
  }
  
  Connection<Facebook> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Facebook.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default FacebookTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: org.springframework.social/spring-social-twitter

public Twitter getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for Twitter");
  }
      
  Connection<Twitter> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Twitter.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default TwitterTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: spring-projects/spring-social-twitter

public Twitter getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for Twitter");
  }
      
  Connection<Twitter> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Twitter.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default TwitterTemplate instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: socialsignin/spring-social-security

public SpringSocialSecurity getApi() {
  if (logger.isDebugEnabled()) {
    logger.debug("Getting API binding instance for SpringSocialSecurity");
  }
  
  Connection<SpringSocialSecurity> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(SpringSocialSecurity.class);
  if (logger.isDebugEnabled() && connection == null) {
    logger.debug("No current connection; Returning default SpringSocialSecurity instance.");
  }
  return connection != null ? connection.getApi() : null;
}

代码示例来源:origin: FundRequest/platform

@Bean
public Gitter gitter(@Value("${io.fundrequest.notifications.gitter.consumer-key}") final String consumerKey,
           @Value("${io.fundrequest.notifications.gitter.consumer-secret}") final String consumerSecret,
           @Value("${io.fundrequest.notifications.gitter.access-token}") final String accessToken) {
  final Connection<Gitter> gitterConnection = new GitterConnectionFactory(consumerKey, consumerSecret).createConnection(new AccessGrant(accessToken));
  assert gitterConnection.test();
  return gitterConnection.getApi();
}

代码示例来源:origin: org.alfresco/alfresco-benchmark-util

@Override
public Alfresco getTenantAdminPublicApi(String domain)
{
  ConnectionDetails connectionDetails = new ConnectionDetails(scheme, host, port, "admin@" + domain, "admin", context,
      publicApiServletName, serviceServletName, maxNumberOfConnections, connectionTimeoutMs, socketTimeoutMs, socketTtlMs);
  BasicAuthAlfrescoConnectionFactory connectionFactory = new BasicAuthAlfrescoConnectionFactory(connectionDetails, null);
  Connection<Alfresco> connection = connectionFactory.createConnection();
  Alfresco alfresco = connection.getApi();
  return alfresco;
}

代码示例来源:origin: org.alfresco/alfresco-benchmark-util

@Override
  public Alfresco getAdminPublicApi()
  {
    ConnectionDetails connectionDetails = new ConnectionDetails(scheme, host, port, "admin", "admin", context,
        publicApiServletName, serviceServletName, maxNumberOfConnections, connectionTimeoutMs, socketTimeoutMs, socketTtlMs);
    BasicAuthAlfrescoConnectionFactory connectionFactory = new BasicAuthAlfrescoConnectionFactory(connectionDetails, null);
    Connection<Alfresco> connection = connectionFactory.createConnection();
    Alfresco alfresco = connection.getApi();
    return alfresco;
  }
}

代码示例来源:origin: io.syndesis.server/server-credential

@Override
  protected void additionalApplication(final Connection.Builder mutableConnection,
    final AccessGrant accessGrant) {
    final org.springframework.social.connect.Connection<Salesforce> salesforceConnection = salesforce
      .createConnection(accessGrant);
    final Salesforce salesforceApi = salesforceConnection.getApi();
    final String instanceUrl = salesforceApi.getInstanceUrl();
    Applicator.applyProperty(mutableConnection, "instanceUrl", instanceUrl);
  }
}

代码示例来源:origin: io.syndesis/credential

@Override
  protected void additionalApplication(final Connection.Builder mutableConnection,
    final AccessGrant accessGrant) {
    final org.springframework.social.connect.Connection<Salesforce> salesforceConnection = salesforce
      .createConnection(accessGrant);
    final Salesforce salesforceApi = salesforceConnection.getApi();
    final String instanceUrl = salesforceApi.getInstanceUrl();
    Applicator.applyProperty(mutableConnection, "instanceUrl", instanceUrl);
  }
}

代码示例来源:origin: io.loli.social/custom-social-core-extension

private void assertTwitterConnection(Connection<TestTwitterApi> twitter) {
  assertEquals(new ConnectionKey("twitter", "1"), twitter.getKey());
  assertEquals("@kdonald", twitter.getDisplayName());
  assertEquals("http://twitter.com/kdonald", twitter.getProfileUrl());
  assertEquals("http://twitter.com/kdonald/picture",
      twitter.getImageUrl());
  TestTwitterApi twitterApi = twitter.getApi();
  assertEquals("123456789", twitterApi.getAccessToken());
  assertEquals("987654321", twitterApi.getSecret());
  twitter.sync();
  assertEquals("http://twitter.com/kdonald/a_new_picture",
      twitter.getImageUrl());
}

相关文章