Skip to content

Commit

Permalink
Merge pull request #1 from formkiq/v1.1
Browse files Browse the repository at this point in the history
Added support for <classname>::<method> format and spotless formatting
  • Loading branch information
mfriesen authored Jun 12, 2020
2 parents 1694483 + 21a77b7 commit 3f9eecf
Show file tree
Hide file tree
Showing 16 changed files with 301 additions and 276 deletions.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id "com.diffplug.gradle.spotless" version "4.3.0"
}

group = 'com.formkiq'
version = '1.0'
version = '1.1'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -25,6 +26,12 @@ java {
withSourcesJar()
}

spotless {
java {
googleJavaFormat()
}
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/formkiq/lambda/runtime/graalvm/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright [2020] FormKiQ Inc. Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may obtain a copy of the License
* at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.lambda.runtime.graalvm;

Expand All @@ -20,15 +20,12 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;

/**
* Http Service using the build in Java {@link HttpURLConnection} library.
*
*/
/** Http Service using the build in Java {@link HttpURLConnection} library. */
public class HttpClient {

/**
* Send 'Get' request.
*
*
* @param url {@link String}
* @return {@link HttpResponse}
* @throws IOException IOException
Expand All @@ -43,7 +40,7 @@ public static HttpResponse get(final String url) throws IOException {

/**
* Build {@link HttpResponse} from {@link HttpURLConnection}.
*
*
* @param conn {@link HttpURLConnection}
* @return {@link HttpResponse}
* @throws IOException IOException
Expand All @@ -52,11 +49,14 @@ private static HttpResponse buildResponse(final HttpURLConnection conn) throws I

HttpResponse response = new HttpResponse(conn.getResponseCode());

conn.getHeaderFields().entrySet().forEach(e -> {
if (e.getKey() != null && e.getValue() != null) {
response.addHeader(e.getKey(), e.getValue());
}
});
conn.getHeaderFields()
.entrySet()
.forEach(
e -> {
if (e.getKey() != null && e.getValue() != null) {
response.addHeader(e.getKey(), e.getValue());
}
});

StringBuilder sb = new StringBuilder();
BufferedReader br =
Expand Down
43 changes: 19 additions & 24 deletions src/main/java/com/formkiq/lambda/runtime/graalvm/HttpResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright [2020] FormKiQ Inc. Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may obtain a copy of the License
* at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.lambda.runtime.graalvm;

Expand All @@ -19,10 +19,7 @@
import java.util.Map.Entry;
import java.util.Optional;

/**
* HttpResponse.
*
*/
/** HttpResponse. */
public class HttpResponse {

/** HTTP Status Code. */
Expand All @@ -34,16 +31,14 @@ public class HttpResponse {
/** HTTP Headers. */
private Map<String, List<String>> headers;

/**
* constructor.
*/
/** constructor. */
public HttpResponse() {
this.headers = new HashMap<>();
}

/**
* constructor.
*
*
* @param status int
*/
public HttpResponse(final int status) {
Expand All @@ -53,7 +48,7 @@ public HttpResponse(final int status) {

/**
* Get HTTP Status Code.
*
*
* @return int
*/
public int getStatusCode() {
Expand All @@ -62,7 +57,7 @@ public int getStatusCode() {

/**
* Set HTTP Status Code.
*
*
* @param status int
*/
public void setStatusCode(final int status) {
Expand All @@ -71,7 +66,7 @@ public void setStatusCode(final int status) {

/**
* Get HTTP Headers.
*
*
* @return {@link Map}
*/
public Map<String, List<String>> getHeaders() {
Expand All @@ -80,7 +75,7 @@ public Map<String, List<String>> getHeaders() {

/**
* Set HTTP Headers.
*
*
* @param httpHeaders {@link Map}
*/
public void setHeaders(final Map<String, List<String>> httpHeaders) {
Expand All @@ -89,7 +84,7 @@ public void setHeaders(final Map<String, List<String>> httpHeaders) {

/**
* Add HTTP Header.
*
*
* @param key {@link String}
* @param values {@link List}
*/
Expand All @@ -99,7 +94,7 @@ public void addHeader(final String key, final List<String> values) {

/**
* Get HTTP Body.
*
*
* @return {@link String}
*/
public String getBody() {
Expand All @@ -108,7 +103,7 @@ public String getBody() {

/**
* Set HTTP Body.
*
*
* @param httpbody {@link String}
*/
public void setBody(final String httpbody) {
Expand All @@ -117,7 +112,7 @@ public void setBody(final String httpbody) {

/**
* Get Header Values.
*
*
* @param key {@link String}
* @return {@link List}
*/
Expand All @@ -129,7 +124,7 @@ public List<String> getHeaderValues(final String key) {

/**
* Get Header Value.
*
*
* @param key {@link String}
* @return {@link List}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright [2020] FormKiQ Inc. Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may obtain a copy of the License
* at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.lambda.runtime.graalvm;

Expand All @@ -17,10 +17,7 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;

/**
* Implementation of {@link Context}.
*
*/
/** Implementation of {@link Context}. */
public class LambdaContext implements Context {

/** AWS Request Id. */
Expand All @@ -30,7 +27,7 @@ public class LambdaContext implements Context {

/**
* constructor.
*
*
* @param requestId {@link String}
*/
public LambdaContext(final String requestId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
* Copyright [2020] FormKiQ Inc. Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may obtain a copy of the License
* at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.lambda.runtime.graalvm;

import java.io.IOException;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import java.io.IOException;

/**
* Implementation of {@link LambdaLogger}.
*
*/
/** Implementation of {@link LambdaLogger}. */
public class LambdaLoggerSystemOut implements LambdaLogger {

@Override
Expand Down
Loading

0 comments on commit 3f9eecf

Please sign in to comment.