diff --git a/cloudfoundry-connector.html b/cloudfoundry-connector.html index d4e2f57..d9dbc2e 100644 --- a/cloudfoundry-connector.html +++ b/cloudfoundry-connector.html @@ -568,7 +568,7 @@ table.CodeRay td.code>pre{padding:0} diff --git a/heroku-connector.html b/heroku-connector.html index 236c444..f102329 100644 --- a/heroku-connector.html +++ b/heroku-connector.html @@ -588,7 +588,7 @@ table.CodeRay td.code>pre{padding:0} diff --git a/localconfig-connector.html b/localconfig-connector.html index a13d1fe..1219adb 100644 --- a/localconfig-connector.html +++ b/localconfig-connector.html @@ -636,7 +636,7 @@ spring.cloud.database: mysql://user:pass@host:1234/dbname diff --git a/spring-cloud-connectors.html b/spring-cloud-connectors.html index 729a3ad..9cfb8c2 100644 --- a/spring-cloud-connectors.html +++ b/spring-cloud-connectors.html @@ -698,7 +698,7 @@ table.CodeRay td.code>pre{padding:0} diff --git a/spring-cloud-core.html b/spring-cloud-core.html index ebd9eb5..65659e4 100644 --- a/spring-cloud-core.html +++ b/spring-cloud-core.html @@ -506,10 +506,10 @@ table.CodeRay td.code>pre{padding:0}
Table of Contents
@@ -517,18 +517,15 @@ table.CodeRay td.code>pre{padding:0}
-

This core library provides programmatic access to application and service information. This library has no Spring dependencies and may be used in non-Spring applications.

+

This core library provides programmatic access to application and service information. It has no Spring dependencies and may be used in non-Spring applications.

-

This library requires Java 6 or newer.

-
-
-

This library is cloud-agnostic. Using Java SPI, it supports pluggable cloud and service connectors; support for Cloud Foundry and Heroku is available out-of-the-box, in addition to locally-provided configuration for development and testing.

+

This library requires Java 6 or newer. It is cloud-agnostic, supports pluggable cloud and service connectors using Java SPI, and provides support for Cloud Foundry and Heroku out-of-the-box, with locally-provided configuration available for development and testing.

-

Connecting to a cloud

+

Connecting to a Cloud

@@ -547,20 +544,16 @@ table.CodeRay td.code>pre{padding:0}
  • -

    Include the desired cloud connectors on the runtime classpath as described in the main documentation.

    +

    Include the desired cloud connectors on the runtime classpath, as described in the main documentation.

  • -

    Create a CloudFactory instance. Creation of a CloudFactory instance is a bit expensive, so using a singleton instance is recommended. If you are using a dependency injection framework such as Spring, create a bean for the CloudFactory.

    -
  • -
-
+

Create a CloudFactory instance. Creation of a CloudFactory instance is a bit expensive, so we recommend using a singleton instance. If you are using a Dependency Injection framework such as Spring, create a bean for the CloudFactory.

CloudFactory cloudFactory = new CloudFactory();
-
-
    +
  • Obtain the Cloud object for the environment in which the application is running.

    @@ -569,79 +562,81 @@ table.CodeRay td.code>pre{padding:0}
-

Note that you must have a CloudConnector suitable for your deployment environment on your classpath. For example, if you are deploying the application to Cloud Foundry, you must add the Cloud Foundry Connector to your classpath. If no suitable CloudConnector is found, the getCloud() method will throw a CloudException.

+

Note that your classpath must have a CloudConnector suitable for your deployment environment---for example, if you are deploying the application to Cloud Foundry, you must add the Cloud Foundry Connector to your classpath. If the getCloud() method finds no suitable CloudConnector, it will throw a CloudException.

  • Use the Cloud instance to access application and service information and to create service connectors.

    -
  • - -
    -
    // ServiceInfo has all the information necessary to connect to the underlying service
    +
    // ServiceInfo has all of the information necessary to connect to the underlying service
     List<ServiceInfo> serviceInfos = cloud.getServiceInfos();
    -
    // find the `ServiceInfo` definitions suitable for connecting to a particular service type
    +
    // Find the `ServiceInfo` definitions suitable for connecting to a particular service type
     List<ServiceInfo> databaseInfos = cloud.getServiceInfos(DataSource.class);
    -
    // Alternately, let Spring Cloud create a service connector for you
    +
    // Alternatively, let Spring Cloud create a service connector for you
     String serviceId = "inventory-db";
    -DataSource ds = cloud.getServiceConnector(serviceId, DataSource.class, null /* default config */);
    +DataSource ds = cloud.getServiceConnector(serviceId, DataSource.class, + null /* default config */);
    + + +
    -

    Adding cloud connectors

    +

    Adding Cloud Connectors

    -

    A cloud provider may extend Spring Cloud by adding a new CloudConnector to make Spring Cloud work with a new cloud platform. The connector is responsible for telling whether the application is running in the specific cloud, identifying application information (such as the name and instance ID of the particular running instance), and mapping bound services (such as URIs exposed in environment variables) as ServiceInfo objects.

    +

    A cloud provider may extend Spring Cloud by adding a new CloudConnector that tells Spring Cloud how to work with a new cloud platform. The connector is responsible for determining whether the application is running in the specific cloud, identifying application information (such as the name and instance ID of the particular running instance), and mapping bound services (such as URIs exposed in environment variables) as ServiceInfo objects.

    +
    +
    + + + + +
    +
    Tip
    +

    See the Cloud Foundry Connector and Heroku Connector for examples.

    +
    +
    -

    Spring Cloud uses the Java SPI to discover available connectors. New cloud connectors should list the fully-qualified class name in the provider-configuration file at

    -
    -
    -
    -
    META-INF/services/org.springframework.cloud.CloudConnector
    -
    +

    Spring Cloud uses the Java SPI to discover available connectors. New cloud connectors should list the fully-qualified class name in the provider-configuration file at META-INF/services/org.springframework.cloud.CloudConnector.

    -

    Adding service discovery

    +

    Adding Service Discovery

    -

    To allow Spring Cloud to discover a new type of service (HelloWorldService), create a ServiceInfo class containing the information necessary to connect to your service. If your service can be specified via a URI, extend UriBasedServiceInfo and provide the URI scheme in a call to the super constructor.

    +

    To allow Spring Cloud to discover a new type of service, create a ServiceInfo class containing the information necessary to connect to your service. If your service can be specified via a URI, extend UriBasedServiceInfo and provide the URI scheme in a call to the super constructor.

    -

    This class will expose information for a service available at

    -
    -
    -
    -
    helloworld://username:password@host:port/Bonjour
    -
    +

    Consider an example HelloWorldService. The following class will expose information for a service available at helloworld://username:password@host:port/Bonjour.

    public class HelloWorldServiceInfo extends UriBasedServiceInfo {
         public static final String URI_SCHEME = "helloworld";
     
    -  // needed to support structured service definitions like Cloud Foundry
    +  // Needed to support structured service definitions such as Cloud Foundry's
         public HelloWorldServiceInfo(String id, String host, int port, String username, String password, String greeting) {
         super(id, URI_SCHEME, host, port, username, password, greeting);
         }
     
    -    // needed to support URI-based service definitions like Heroku
    +    // Needed to support URI-based service definitions such as Heroku's
         public HelloWorldServiceInfo(String id, String uri) {
             super(id, uri);
         }
    @@ -649,36 +644,31 @@ table.CodeRay td.code>pre{padding:0}
     
    -

    Then you will need to create a ServiceInfoCreator for each cloud platform you want to support. You will probably want to extend the appropriate creator base class(es), such as HerokuServiceInfoCreator. This is often as simple as writing a method that instantiates a new HelloWorldServiceInfo.

    +

    Next, create a ServiceInfoCreator for each cloud platform that you want to support. You will probably want to extend the appropriate creator base class(es), such as HerokuServiceInfoCreator. This is often as simple as (for example, in the case of the HelloWorldService) writing a method that instantiates a new HelloWorldServiceInfo.

    -

    Register your ServiceInfoCreator classes in the appropriate provider-configuration file for your cloud’s ServiceInfoCreator base class.

    +

    Finally, register your ServiceInfoCreator classes in the appropriate provider-configuration file for your cloud’s ServiceInfoCreator base class.

    -

    Adding service connectors

    +

    Adding Service Connectors

    -

    A service connector consumes a ServiceInfo discovered by the cloud connector and converts it into the appropriate service object, such as a DataSource for a service definition representing a SQL database.

    +

    A service connector consumes a ServiceInfo discovered by the cloud connector and converts it into the appropriate service object (such as, in the case of a service definition representing a SQL database, a DataSource).

    -

    Service connectors may be tightly bound to the framework whose service objects they are creating; for example, some connectors in the Spring service connector create connection factories defined by Spring Data, for use in building Spring Data templates.

    +

    Service connectors may be tightly bound to the framework whose service objects they are creating. For example, in the Spring Service Connector library, some connectors create connection factories defined by Spring Data for use in building Spring Data templates.

    -

    To add new service connectors, implement ServiceConnectorCreator in your connector classes and list the fully-qualified class names in the provider-configuration file at

    -
    -
    -
    -
    META-INF/services/org.springframework.cloud.service.ServiceConnectorCreator
    -
    +

    To add new service connectors, implement ServiceConnectorCreator in your connector classes and list the fully-qualified class names in the provider-configuration file at META-INF/services/org.springframework.cloud.service.ServiceConnectorCreator.

    diff --git a/spring-cloud-spring-service-connector.html b/spring-cloud-spring-service-connector.html index f0ebe6b..c0c48de 100644 --- a/spring-cloud-spring-service-connector.html +++ b/spring-cloud-spring-service-connector.html @@ -506,7 +506,7 @@ table.CodeRay td.code>pre{padding:0}
    Table of Contents