-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
244 changed files
with
11,507 additions
and
4,461 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
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
...ms.backend.common/src/io/openems/backend/common/jsonrpc/request/AddEdgeToUserRequest.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,63 @@ | ||
package io.openems.backend.common.jsonrpc.request; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; | ||
import io.openems.common.jsonrpc.base.JsonrpcRequest; | ||
import io.openems.common.utils.JsonUtils; | ||
|
||
/** | ||
* Adds a Edge to a User. | ||
* | ||
* <pre> | ||
* { | ||
* "jsonrpc": "2.0", | ||
* "id": UUID, | ||
* "method": "addEdgeToUser", | ||
* "params": { | ||
* "setupPassword": string | ||
* } | ||
* } | ||
* </pre> | ||
*/ | ||
public class AddEdgeToUserRequest extends JsonrpcRequest { | ||
|
||
public static final String METHOD = "addEdgeToUser"; | ||
|
||
/** | ||
* Create {@link AddEdgeToUserRequest} from a template {@link JsonrpcRequest}. | ||
* | ||
* @param r the template {@link JsonrpcRequest} | ||
* @return the {@link AddEdgeToUserRequest} | ||
* @throws OpenemsNamedException on parse error | ||
*/ | ||
public static AddEdgeToUserRequest from(JsonrpcRequest r) throws OpenemsNamedException { | ||
JsonObject p = r.getParams(); | ||
String setupPassword = JsonUtils.getAsString(p, "setupPassword"); | ||
return new AddEdgeToUserRequest(r, setupPassword); | ||
} | ||
|
||
private final String setupPassword; | ||
|
||
public AddEdgeToUserRequest(String setupPassword) { | ||
super(METHOD); | ||
this.setupPassword = setupPassword; | ||
} | ||
|
||
private AddEdgeToUserRequest(JsonrpcRequest request, String setupPassword) { | ||
super(request, METHOD); | ||
this.setupPassword = setupPassword; | ||
} | ||
|
||
@Override | ||
public JsonObject getParams() { | ||
return JsonUtils.buildJsonObject() // | ||
.addProperty("setupPassword", this.setupPassword) // | ||
.build(); | ||
} | ||
|
||
public String getSetupPassword() { | ||
return this.setupPassword; | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
...backend.common/src/io/openems/backend/common/jsonrpc/request/GetSetupProtocolRequest.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 io.openems.backend.common.jsonrpc.request; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; | ||
import io.openems.common.jsonrpc.base.JsonrpcRequest; | ||
import io.openems.common.utils.JsonUtils; | ||
|
||
public class GetSetupProtocolRequest extends JsonrpcRequest { | ||
|
||
public static final String METHOD = "getSetupProtocol"; | ||
|
||
/** | ||
* Create {@link GetSetupProtocolRequest} from a template | ||
* {@link JsonrpcRequest}. | ||
* | ||
* @param request the template {@link JsonrpcRequest} | ||
* @return Created {@link GetSetupProtocolRequest} | ||
*/ | ||
public static GetSetupProtocolRequest from(JsonrpcRequest request) throws OpenemsNamedException { | ||
JsonObject params = request.getParams(); | ||
|
||
return new GetSetupProtocolRequest(request, JsonUtils.getAsInt(params, "setupProtocolId")); | ||
} | ||
|
||
private final int setupProtocolId; | ||
|
||
private GetSetupProtocolRequest(JsonrpcRequest request, int setupProtocolId) { | ||
super(request, METHOD); | ||
this.setupProtocolId = setupProtocolId; | ||
} | ||
|
||
@Override | ||
public JsonObject getParams() { | ||
return JsonUtils.buildJsonObject() // | ||
.addProperty("setupProtocolId", this.setupProtocolId) // | ||
.build(); | ||
} | ||
|
||
/** | ||
* Gets the Setup Protocol ID. | ||
* | ||
* @return the Setup Protocol ID | ||
*/ | ||
public int getSetupProtocolId() { | ||
return this.setupProtocolId; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...ckend.common/src/io/openems/backend/common/jsonrpc/request/GetUserInformationRequest.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,43 @@ | ||
package io.openems.backend.common.jsonrpc.request; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import io.openems.common.jsonrpc.base.JsonrpcRequest; | ||
|
||
/** | ||
* Gets the User Information. | ||
* | ||
* <pre> | ||
* { | ||
* "jsonrpc": "2.0", | ||
* "id": UUID, | ||
* "method": "getUserInformation", | ||
* "params": {} | ||
* } | ||
* </pre> | ||
*/ | ||
public class GetUserInformationRequest extends JsonrpcRequest { | ||
|
||
public static final String METHOD = "getUserInformation"; | ||
|
||
/** | ||
* Create {@link GetUserInformationRequest} from a template | ||
* {@link JsonrpcRequest}. | ||
* | ||
* @param request the template {@link JsonrpcRequest} | ||
* @return Created {@link GetUserInformationRequest} | ||
*/ | ||
public static GetUserInformationRequest from(JsonrpcRequest request) { | ||
return new GetUserInformationRequest(request); | ||
} | ||
|
||
private GetUserInformationRequest(JsonrpcRequest request) { | ||
super(request, METHOD); | ||
} | ||
|
||
@Override | ||
public JsonObject getParams() { | ||
return new JsonObject(); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...ems.backend.common/src/io/openems/backend/common/jsonrpc/request/RegisterUserRequest.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,46 @@ | ||
package io.openems.backend.common.jsonrpc.request; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; | ||
import io.openems.common.jsonrpc.base.JsonrpcRequest; | ||
import io.openems.common.utils.JsonUtils; | ||
|
||
public class RegisterUserRequest extends JsonrpcRequest { | ||
|
||
public static final String METHOD = "registerUser"; | ||
|
||
/** | ||
* Create {@link RegisterUserRequest} from a template {@link JsonrpcRequest}. | ||
* | ||
* @param request the template {@link JsonrpcRequest} | ||
* @return Created {@link RegisterUserRequest} | ||
*/ | ||
public static RegisterUserRequest from(JsonrpcRequest request) throws OpenemsNamedException { | ||
JsonObject params = request.getParams(); | ||
|
||
return new RegisterUserRequest(request, JsonUtils.getAsJsonObject(params, "user")); | ||
} | ||
|
||
private final JsonObject jsonObject; | ||
|
||
private RegisterUserRequest(JsonrpcRequest request, JsonObject jsonObject) { | ||
super(request, METHOD); | ||
this.jsonObject = jsonObject; | ||
} | ||
|
||
@Override | ||
public JsonObject getParams() { | ||
return this.jsonObject; | ||
} | ||
|
||
/** | ||
* Gets the User Registration information as {@link JsonObject}. | ||
* | ||
* @return the {@link JsonObject} | ||
*/ | ||
public JsonObject getJsonObject() { | ||
return this.jsonObject; | ||
} | ||
|
||
} |
Oops, something went wrong.