Files
spring-cloud-function/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk
Spring Operator c20f686731 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 25 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).
* http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch with 1 occurrences migrated to:
  https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch ([https](https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch) result 200).
* http://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin with 1 occurrences migrated to:
  https://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin ([https](https://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin) result 200).
* http://www.apache.org/licenses/LICENSE-2.0 with 2 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
* http://repo.spring.io/libs-milestone-local with 2 occurrences migrated to:
  https://repo.spring.io/libs-milestone-local ([https](https://repo.spring.io/libs-milestone-local) result 302).
* http://repo.spring.io/libs-snapshot-local with 2 occurrences migrated to:
  https://repo.spring.io/libs-snapshot-local ([https](https://repo.spring.io/libs-snapshot-local) result 302).
* http://repo.spring.io/release with 1 occurrences migrated to:
  https://repo.spring.io/release ([https](https://repo.spring.io/release) result 302).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0 with 50 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 25 occurrences
2019-03-16 10:23:59 -05:00
..
2017-06-16 09:43:10 -04:00
2019-03-16 10:23:59 -05:00
2018-08-21 17:42:35 +01:00

// Do not edit this file (e.g. go instead to src/main/asciidoc)

== Quick Start

Implement a POF (be sure to use the `functions` package):

```
package functions;

import java.util.function.Function;

public class Uppercase implements Function<String, String> {

	public String apply(String input) {
		return input.toUpperCase();
	}
}
```

Install it into your local Maven repository:

```
./mvnw clean install
```

Create a `function.properties` file that provides its Maven coordinates. For example:

```
dependencies.function: com.example:pof:0.0.1-SNAPSHOT
```

Copy the openwhisk runner JAR to the working directory (same directory as the properties file):

```
cp spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/target/spring-cloud-function-adapter-openwhisk-1.0.2.BUILD-SNAPSHOT.jar runner.jar
```

Generate a m2 repo from the `--thin.dryrun` of the runner JAR with the above properties file:

```
java -jar -Dthin.root=m2 runner.jar --thin.name=function --thin.dryrun
```

Use the following Dockerfile:

```
FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY m2 /m2
ADD runner.jar .
ADD function.properties .
ENV JAVA_OPTS=""
ENTRYPOINT [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "runner.jar", "--thin.root=/m2", "--thin.name=function", "--function.name=uppercase"]
EXPOSE 8080
```

> NOTE: you could use a Spring Cloud Function app, instead of just a jar with a POF in it, in which case you would have to change the way the app runs in the container so that it picks up the main class as a source file. For example, you could change the `ENTRYPOINT` above and add `--spring.main.sources=com.example.SampleApplication`.

Build the Docker image:

```
docker build -t [username/appname] .
```

Push the Docker image:

```
docker push [username/appname]
```

Use the OpenWhisk CLI (e.g. after `vagrant ssh`) to create the action:

```
wsk action create example --docker [username/appname]
```

Invoke the action:

```
wsk action invoke example --result --param payload foo
{
    "result": "FOO"
}
```

== Examples

The following examples are built based on the details and explanations above, on how to deploy Spring Cloud Functions on to https://openwhisk.apache.org/[OpenWhisk]

* https://github.com/redhat-developer-demos/ow-scf-fruiteason[Spring Cloud Function PoF Example]. This example shows how to use Spring Cloud Functions by defining simple Plain Old Function (POF)

* https://github.com/redhat-developer-demos/ow-scf-greeter[Spring Cloud Function Application Example]. This example shows how to use Spring Cloud Functions with a complete Spring Boot Application that has functions defined by extending `java.util.function.Function` interfaces.

The base docker images used for above examples is available https://github.com/redhat-developer-demos/openwhisk-scf-docker[here].