Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit bcd3aa8

Browse files
authored
Update README.md
1 parent d2917e5 commit bcd3aa8

File tree

1 file changed

+21
-27
lines changed

1 file changed

+21
-27
lines changed

README.md

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,50 @@
11
# cf-java-client [![Build Status](https://travis-ci.org/SAP/cf-java-client-sap.svg?branch=master)](https://travis-ci.org/SAP/cf-java-client-sap) [![REUSE status](https://api.reuse.software/badge/github.com/SAP/cf-java-client-sap)](https://api.reuse.software/info/github.com/SAP/cf-java-client-sap)
22

3-
This is a fork of the 1.1.4.RELEASE version of the official Cloud Foundry Java client (https://github.com/cloudfoundry/cf-java-client/tree/v1.1.4.RELEASE). It has been modified to include several bugfixes and improvements.
3+
This is a facade that hides the official Cloud Foundry Java client (https://github.com/cloudfoundry/cf-java-client) under a **synchronous** API similar to the one it had back in version 1.1.4.RELEASE (see https://github.com/cloudfoundry/cf-java-client/tree/v1.1.4.RELEASE).
44

55
# Introduction
66

7-
The `cf-java-client` project is a Java language binding for interacting with a Cloud Foundry instance. It provides similar functionality to the Cloud Foundry command line client (https://github.com/cloudfoundry/cli), such as creating services and applications, binding services to applications or even registering service brokers. It communicates with the [Cloud Foundry Controller](https://docs.cloudfoundry.org/concepts/architecture/cloud-controller.html) by making HTTP requests to the controller's REST API, which is documented at https://apidocs.cloudfoundry.org/.
8-
9-
# Components
10-
11-
In addition to the actual client, the official `cf-java-client` repository contains a [Maven](http://maven.apache.org/) and a [Gradle](http://www.gradle.org/) plugin for deploying and managing applications through Maven goals and Gradle tasks respectively. However, since we've made no changes to these plugins, they've been removed from this fork entirely. The client implementation is the only remaining component and it can be found under the `cloudfoundry-client-lib` subdirectory.
7+
The `cf-java-client` project is a Java language binding for interacting with a Cloud Foundry instance. It provides similar functionality to the Cloud Foundry command line client (https://github.com/cloudfoundry/cli), such as creating services and applications, binding services to applications or even registering service brokers. It communicates with the [Cloud Foundry Controller](https://docs.cloudfoundry.org/concepts/architecture/cloud-controller.html) by making HTTP requests to the controller's REST API, which is documented at https://apidocs.cloudfoundry.org/ (V2) and https://v3-apidocs.cloudfoundry.org/ (V3).
128

139
# Usage
1410

1511
In order to use this client in your application, you need to include the following dependency in your `pom.xml`:
1612

1713
```xml
18-
<dependencies>
19-
<dependency>
20-
<groupId>com.sap.cloud.lm.sl</groupId>
21-
<artifactId>cloudfoundry-client-lib</artifactId>
22-
<version>...</version>
23-
</dependency>
24-
...
25-
</dependencies>
14+
<dependency>
15+
<groupId>com.sap.cloud.lm.sl</groupId>
16+
<artifactId>cloudfoundry-java-client-facade</artifactId>
17+
<version>...</version>
18+
</dependency>
2619
```
20+
The latest version can always be found in Maven Central: https://mvnrepository.com/artifact/com.sap.cloud.lm.sl/cloudfoundry-java-client-facade
2721

2822
The following is a very simple sample application that connects to a Cloud Foundry instance, logs in, and displays some information about the Cloud Foundry account. When running the program, provide the Cloud Foundry target API endpoint, along with a valid user name and password as command-line parameters.
2923

3024
```java
31-
import org.cloudfoundry.client.lib.CloudCredentials;
32-
import org.cloudfoundry.client.lib.CloudFoundryClient;
33-
import org.cloudfoundry.client.lib.domain.CloudApplication;
34-
import org.cloudfoundry.client.lib.domain.CloudService;
35-
import org.cloudfoundry.client.lib.domain.CloudSpace;
36-
3725
import java.net.MalformedURLException;
3826
import java.net.URI;
3927
import java.net.URL;
4028

29+
import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
30+
import com.sap.cloudfoundry.client.facade.domain.CloudServiceInstance;
31+
import com.sap.cloudfoundry.client.facade.domain.CloudSpace;
32+
4133
public final class JavaSample {
4234

4335
public static void main(String[] args) {
4436
String target = args[0];
45-
String user = args[1];
37+
String username = args[1];
4638
String password = args[2];
4739

48-
CloudCredentials credentials = new CloudCredentials(user, password);
49-
CloudFoundryClient client = new CloudFoundryClient(credentials, getTargetURL(target));
40+
CloudCredentials credentials = new CloudCredentials(username, password);
41+
CloudControllerClient client = new CloudControllerClientImpl(getTargetURL(target), credentials);
5042
client.login();
5143

5244
System.out.printf("%nSpaces:%n");
5345
for (CloudSpace space : client.getSpaces()) {
54-
System.out.printf(" %s\t(%s)%n", space.getName(), space.getOrganization().getName());
46+
System.out.printf(" %s\t(%s)%n", space.getName(), space.getOrganization()
47+
.getName());
5548
}
5649

5750
System.out.printf("%nApplications:%n");
@@ -60,16 +53,17 @@ public final class JavaSample {
6053
}
6154

6255
System.out.printf("%nServices%n");
63-
for (CloudService service : client.getServices()) {
56+
for (CloudServiceInstance service : client.getServiceInstances()) {
6457
System.out.printf(" %s\t(%s)%n", service.getName(), service.getLabel());
6558
}
6659
}
6760

6861
private static URL getTargetURL(String target) {
6962
try {
70-
return URI.create(target).toURL();
63+
return URI.create(target)
64+
.toURL();
7165
} catch (MalformedURLException e) {
72-
throw new RuntimeException("The target URL is not valid: " + e.getMessage());
66+
throw new IllegalArgumentException("The target URL is not valid: " + e.getMessage());
7367
}
7468
}
7569

0 commit comments

Comments
 (0)