Skip to content

Commit 58ec3ad

Browse files
authored
Merge pull request #14 from jegasmlm/master
Version update to 2.0
2 parents 1de8792 + 2d30413 commit 58ec3ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1474
-763
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.idea/
22
build/
3+
.sonar/
4+
local.properties
0 Bytes
Binary file not shown.
7.49 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ If using **Maven**, add the following in your `pom.xml` file:
3333
<dependency>
3434
<groupId>io.kusanagi</groupId>
3535
<artifactId>katana-sdk-java8</artifactId>
36-
<version>1.3.0</version>
36+
<version>2.0.0</version>
3737
</dependency>
3838
```
3939

4040
Or, if using **Gradle**, add the following in your `build.gradle` file:
4141

4242
```gradle
4343
dependencies {
44-
compile group: 'io.kusanagi', name: 'katana-sdk-java8', version: '1.3.0'
44+
compile group: 'io.kusanagi', name: 'katana-sdk-java8', version: '2.0.0'
4545
}
4646
```
4747

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ apply plugin: 'signing'
2020

2121
group 'io.kusanagi'
2222
archivesBaseName = "katana-sdk-java8"
23-
version '1.3.0'
23+
version '2.0.0'
2424

2525
mainClassName = 'io.kusanagi.katana.api.component.Component'
2626

src/main/java/io/kusanagi/katana/api/Api.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,25 +229,32 @@ public ServiceSchema getServiceSchema(String name, String version) {
229229
}
230230

231231
/**
232-
* send a string representation of the value argument to stdout as a "DEBUG" log, with a length limit on the value
233-
* of 100,000 characters (not including the other elements of the log message, such as the timestamp), and return
234-
* true. If the component is not running in debug mode this function MUST NOT send a log, and SHOULD return false.
232+
* send a [string representation](#34-string-representation) of the `value` argument to `stdout` as a log, with a
233+
* length limit on the value of **100,000** characters (not including the other elements of the log message, such
234+
* as the timestamp).
235+
*
236+
* The `level` argument is the OPTIONAL value to use as the numeric Syslog severity level for the log message, as
237+
* defined in RFC5424, which by default is **6**, representing the "Informational" level.
235238
*
236239
* @param value String to log
237240
* @return true if the value gets logged
238241
*/
239-
public boolean log(String value) {
240-
Logger.log(Logger.DEBUG, value);
242+
public boolean log(String value, int level) {
243+
Logger.log(level < 0 ? 0 : level > 7 ? 7 : level, value);
241244
return true;
242245
}
243246

247+
public boolean log(String value) {
248+
return log(value, 6);
249+
}
250+
244251
/**
245252
*
246253
* @return This function is only for use in an asynchronous implementation of the SDK, for any other implementation
247-
* it MUST return false.
254+
* it MUST throw an exception.
248255
*/
249256
public boolean done(){
250-
return false;
257+
throw new RuntimeException("SDK does not support async call to end action: Api.done()");
251258
}
252259

253260
@Override

src/main/java/io/kusanagi/katana/api/commands/CallCommandPayload.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
import com.fasterxml.jackson.annotation.JsonProperty;
1919
import io.kusanagi.katana.api.commands.common.CommandPayload;
2020
import io.kusanagi.katana.api.component.Key;
21-
import io.kusanagi.katana.sdk.Callee;
21+
import io.kusanagi.katana.api.serializers.CalleeEntity;
2222

2323
/**
2424
* Created by jega on 3/03/17.
2525
*/
26-
public class CallCommandPayload extends CommandPayload<Callee> {
26+
public class CallCommandPayload extends CommandPayload<CalleeEntity> {
2727

2828
/**
2929
* The semantics of the command
@@ -80,29 +80,29 @@ public String toString() {
8080
'}';
8181
}
8282

83-
public static class CallCommand extends CommandPayload.Command<Callee> {
83+
public static class CallCommand extends CommandPayload.Command<CalleeEntity> {
8484

8585
/**
8686
* The key/value arguments for the command, if no arguments exist this property SHOULD NOT be defined
8787
*/
8888
@JsonProperty(Key.COMMAND_ARGUMENT)
89-
private Callee argument;
89+
private CalleeEntity argument;
9090

9191
public CallCommand() {
9292
//Empty constructor for serialization
9393
}
9494

9595
public CallCommand(CallCommandPayload.CallCommand other) {
9696
super(other);
97-
this.argument = new Callee(other.argument);
97+
this.argument = new CalleeEntity(other.argument);
9898
}
9999

100100
@Override
101-
public Callee getArgument() {
101+
public CalleeEntity getArgument() {
102102
return argument;
103103
}
104104

105-
public void setArgument(Callee argument) {
105+
public void setArgument(CalleeEntity argument) {
106106
this.argument = argument;
107107
}
108108

src/main/java/io/kusanagi/katana/api/component/Arg.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ public class Arg {
129129
public static final String ACTION_ARG = "--action";
130130

131131
/**
132-
* short argument key for the switch, which if defined MUST disable all logs, even if -D or --debug is present.
132+
* short argument key for An OPTIONAL switch, which if defined MUST enable logging support, where the value of the
133+
* option specifies the numeric Syslog severity level
133134
*/
134-
public static final String SHORT_QUIET_ARG = "-q";
135+
public static final String SHORT_LOG_ARG = "-L";
135136

136137
/**
137-
* argument key for the switch, which if defined MUST disable all logs, even if -D or --debug is present.
138+
* An OPTIONAL switch, which if defined MUST enable logging support, where the value of the option specifies the
139+
* numeric Syslog severity level
138140
*/
139-
public static final String QUIET_ARG = "--quiet";
141+
public static final String LOG_ARG = "--log-level";
140142

141143
private Arg() {
142144

0 commit comments

Comments
 (0)