-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from skarnecki/java-support
add java support. Closes #4
- Loading branch information
Showing
14 changed files
with
456 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
main | ||
*.zip | ||
.DS_Store | ||
examples/go/main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"hello": "world" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"description": "Java example function", | ||
"timeout": 1, | ||
"memory": 256, | ||
"runtime": "java", | ||
"handler": "lambda.Example::handler" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- Generic values --> | ||
<groupId>plugin-result</groupId> | ||
<artifactId>run.apex</artifactId> | ||
<packaging>jar</packaging> | ||
<version>apex</version> | ||
<name>apex-plugin-result</name> | ||
|
||
<properties> | ||
<!-- This prop is set when apex mvn package --> | ||
<jar.finalName>apex-plugin-result</jar.finalName> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-lambda-java-core</artifactId> | ||
<version>1.1.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.3</version> | ||
<configuration> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.3.2</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
49 changes: 49 additions & 0 deletions
49
_examples/java/functions/bar/src/main/java/lambda/Example.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package lambda; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
|
||
public class Example { | ||
|
||
public static class ExampleRequest { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest() { | ||
} | ||
} | ||
|
||
|
||
public static class ExampleResponse { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse() { | ||
} | ||
} | ||
|
||
public ExampleResponse handler(ExampleRequest event, Context context) { | ||
return new ExampleResponse("bar"); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
_examples/java/functions/baz/src/main/java/lambda/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package lambda; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
|
||
public class Main { | ||
|
||
public static class ExampleRequest { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest() { | ||
} | ||
} | ||
|
||
|
||
public static class ExampleResponse { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse() { | ||
} | ||
} | ||
|
||
public ExampleResponse handler(ExampleRequest event, Context context) { | ||
return new ExampleResponse("baz"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"description": "Java example function", | ||
"timeout": 1, | ||
"memory": 512, | ||
"runtime": "java", | ||
"handler": "lambda.Hello::handler" | ||
} |
49 changes: 49 additions & 0 deletions
49
_examples/java/functions/foo/src/main/java/lambda/Hello.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package lambda; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
|
||
public class Hello { | ||
|
||
public static class ExampleRequest { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleRequest() { | ||
} | ||
} | ||
|
||
|
||
public static class ExampleResponse { | ||
String hello; | ||
|
||
public String getHello() { | ||
return hello; | ||
} | ||
|
||
public void setHello(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse(String hello) { | ||
this.hello = hello; | ||
} | ||
|
||
public ExampleResponse() { | ||
} | ||
} | ||
|
||
public ExampleResponse handler(ExampleRequest event, Context context) { | ||
return new ExampleResponse("foo"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "java", | ||
"description": "Java example project", | ||
"memory": 128, | ||
"timeout": 5, | ||
"role": "arn:aws:iam::293503197324:role/lambda" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Requirements | ||
Apex expects pom.xml file to be in function directory. If not found, it generic pom.xml will be used. | ||
|
||
Requirements for pom.xml to work with apex: | ||
- mvn package produces valid jar | ||
- jar.finalName prop have to set name jar name | ||
- has AWS Lambda dependencies (com.amazonaws.aws-lambda-java-core) | ||
|
||
# Generic pom.xml | ||
When no pom.xml file in function main directory, Apex will generate one with default properties. | ||
|
||
Generated pom.xml | ||
```xml | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- Generic values --> | ||
<groupId>plugin-result</groupId> | ||
<artifactId>run.apex</artifactId> | ||
<packaging>jar</packaging> | ||
<version>apex</version> | ||
<name>apex-plugin-result</name> | ||
|
||
<properties> | ||
<!-- This prop is set when apex mvn package --> | ||
<jar.finalName>apex-plugin-result</jar.finalName> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-lambda-java-core</artifactId> | ||
<version>1.1.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.3</version> | ||
<configuration> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.3.2</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ var defaultPlugins = []string{ | |
"golang", | ||
"python", | ||
"nodejs", | ||
"java", | ||
"hooks", | ||
"env", | ||
"shim", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.