Tidy up some javadocs and change email->username

This commit is contained in:
Dave Syer
2016-04-22 09:49:20 +01:00
parent 0c3ce308c5
commit 9c4624389e
7 changed files with 42 additions and 35 deletions

View File

@@ -69,7 +69,7 @@ import org.springframework.core.env.Environment;
* variants to specify which space and organization to use.
* <p/>
*
* @author <A href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
* @author Spencer Gibb
* @author Dave Syer
*/

View File

@@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
/**
* @author <A href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
@Configuration
@EnableConfigurationProperties
@@ -45,7 +45,7 @@ public class CloudFoundryDiscoveryClientConfiguration {
@Bean
@ConditionalOnMissingBean(CloudCredentials.class)
public CloudCredentials cloudCredentials() {
return new CloudCredentials(this.discovery.getEmail(),
return new CloudCredentials(this.discovery.getUsername(),
this.discovery.getPassword());
}
@@ -54,10 +54,10 @@ public class CloudFoundryDiscoveryClientConfiguration {
public CloudFoundryClient cloudFoundryClient(CloudCredentials cc)
throws MalformedURLException {
CloudFoundryClient cloudFoundryClient;
if (discovery.getOrg() != null && discovery.getSpace() != null) {
if (this.discovery.getOrg() != null && this.discovery.getSpace() != null) {
cloudFoundryClient = new CloudFoundryClient(cc,
URI.create(this.discovery.getUrl()).toURL(), discovery.getOrg(),
discovery.getSpace());
URI.create(this.discovery.getUrl()).toURL(), this.discovery.getOrg(),
this.discovery.getSpace());
}
else {
cloudFoundryClient = new CloudFoundryClient(cc,

View File

@@ -19,7 +19,7 @@ package org.springframework.cloud.cloudfoundry.discovery;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author <A href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
@ConfigurationProperties(prefix = "spring.cloud.cloudfoundry.discovery")
public class CloudFoundryDiscoveryProperties {
@@ -30,9 +30,9 @@ public class CloudFoundryDiscoveryProperties {
private String url = "https://api.run.pivotal.io";
/**
* Email address of user to authenticate.
* Username to authenticate (usually an email address).
*/
private String email;
private String username;
/**
* Password for user to authenticate and obtain token.
@@ -70,12 +70,12 @@ public class CloudFoundryDiscoveryProperties {
this.url = cloudControllerUrl;
}
public String getEmail() {
return this.email;
public String getUsername() {
return this.username;
}
public void setEmail(String email) {
this.email = email;
public void setUsername(String email) {
this.username = email;
}
public String getPassword() {
@@ -87,7 +87,7 @@ public class CloudFoundryDiscoveryProperties {
}
public String getOrg() {
return org;
return this.org;
}
public void setOrg(String org) {
@@ -95,7 +95,7 @@ public class CloudFoundryDiscoveryProperties {
}
public String getSpace() {
return space;
return this.space;
}
public void setSpace(String space) {

View File

@@ -16,22 +16,23 @@
package org.springframework.cloud.cloudfoundry.discovery;
import com.netflix.client.config.CommonClientConfigKey;
import com.netflix.client.config.IClientConfig;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicPropertyFactory;
import com.netflix.config.DynamicStringProperty;
import com.netflix.loadbalancer.ServerList;
import javax.annotation.PostConstruct;
import org.cloudfoundry.client.lib.CloudFoundryClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import com.netflix.client.config.CommonClientConfigKey;
import com.netflix.client.config.IClientConfig;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicPropertyFactory;
import com.netflix.config.DynamicStringProperty;
import com.netflix.loadbalancer.ServerList;
/**
* @author <A href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
@Configuration
public class CloudFoundryRibbonClientConfiguration {

View File

@@ -16,11 +16,12 @@
package org.springframework.cloud.cloudfoundry.discovery;
import com.netflix.loadbalancer.Server;
import org.cloudfoundry.client.lib.domain.CloudApplication;
import com.netflix.loadbalancer.Server;
/**
* @author <a href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
public class CloudFoundryServer extends Server {
@@ -55,6 +56,6 @@ public class CloudFoundryServer extends Server {
@Override
public MetaInfo getMetaInfo() {
return metaInfo;
return this.metaInfo;
}
}

View File

@@ -16,19 +16,19 @@
package org.springframework.cloud.cloudfoundry.discovery;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.AbstractServerList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cloudfoundry.client.lib.CloudFoundryClient;
import org.cloudfoundry.client.lib.domain.CloudApplication;
import java.util.Collections;
import java.util.List;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.AbstractServerList;
/**
* @author <A href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
public class CloudFoundryServerList extends AbstractServerList<CloudFoundryServer> {
@@ -64,7 +64,7 @@ public class CloudFoundryServerList extends AbstractServerList<CloudFoundryServe
return Collections.singletonList(new CloudFoundryServer(cloudApplications));
}
catch (Exception e) {
log.warn("Cannot determine server list for " + serviceId + ": " + e.getClass() + "(" + e.getMessage() + ")");
log.warn("Cannot determine server list for " + this.serviceId + ": " + e.getClass() + "(" + e.getMessage() + ")");
return Collections.emptyList();
}
}

View File

@@ -16,16 +16,21 @@
package org.springframework.cloud.cloudfoundry.discovery;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* Convenience annotation for clients to enable Cloud Foundry discovery configuration (specifically).
* Use this (optionally) in case you want discovery and know for sure that it is Cloud Foundry you want.
* All it does is turn on discovery and let the auto-configuration find the Cloud Foundry classes.
*
* @author <a href="mailto:josh@joshlong.com">Josh Long</A>
* @author Josh Long
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)