Skip to content

Commit 50a4f39

Browse files
committed
Merge branch 'apply-sdk-java-jvm' into apply-sdk-java
# Conflicts: # src/main/java/space/ao/services/support/platform/PlatformClient.java
2 parents 03b668b + d01b113 commit 50a4f39

File tree

6 files changed

+52
-173
lines changed

6 files changed

+52
-173
lines changed

.github/workflows/build-push-image.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
tags: ${{ steps.meta.outputs.tags }}
178178
labels: ${{ steps.meta.outputs.labels }}
179179
builder: ${{ steps.buildx.outputs.name }}
180-
platforms: linux/amd64
180+
platforms: linux/amd64,linux/arm64
181181
cache-from: type=gha
182182
cache-to: type=gha,mode=max
183183
file: Dockerfile.jvm
@@ -317,4 +317,4 @@ jobs:
317317
cache-from: type=gha
318318
cache-to: type=gha,mode=max
319319
file: Dockerfile
320-
provenance: false
320+
provenance: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2022 Institute of Software Chinese Academy of Sciences (ISCAS)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package space.ao.services.support.platform;
17+
18+
import io.github.ren2003u.authentication.model.ObtainBoxRegKeyRequest;
19+
import io.github.ren2003u.authentication.model.ObtainBoxRegKeyResponse;
20+
import io.github.ren2003u.migration.model.*;
21+
import io.github.ren2003u.register.model.*;
22+
import io.quarkus.runtime.annotations.RegisterForReflection;
23+
import space.ao.services.account.member.dto.migration.ClientMigrationInfo;
24+
25+
@RegisterForReflection(targets = {RegisterClientRequest.class, RegisterClientResponse.class, RegisterDeviceRequest.class, RegisterDeviceResponse.class, RegisterUserRequest.class, RegisterUserResponse.class,
26+
ClientMigrationInfo.class, SpacePlatformMigrationOutRequest.class, SpacePlatformMigrationOutResponse.class, SpacePlatformMigrationRequest.class, SpacePlatformMigrationResponse.class, UserDomainRouteInfo.class, UserMigrationInfo.class,
27+
ObtainBoxRegKeyRequest.class, ObtainBoxRegKeyResponse.class})
28+
public class MyReflectionConfiguration {
29+
}

src/main/java/space/ao/services/support/platform/PlatformClient.java

+21-36
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
/*
2+
* Copyright (c) 2022 Institute of Software Chinese Academy of Sciences (ISCAS)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package space.ao.services.support.platform;
217

3-
//import io.github.ren2003u.authentication.model.ObtainBoxRegKeyResponse;
4-
import com.fasterxml.jackson.databind.ObjectMapper;
18+
import io.github.ren2003u.authentication.model.ObtainBoxRegKeyResponse;
519
import io.github.ren2003u.client.Client;
620
import io.github.ren2003u.domain.errorHandle.ApiResponse;
7-
//import io.github.ren2003u.register.model.RegisterClientResponse;
8-
//import io.github.ren2003u.register.model.RegisterUserResponse;
21+
import io.github.ren2003u.register.model.RegisterClientResponse;
22+
import io.github.ren2003u.register.model.RegisterUserResponse;
923
import jakarta.annotation.PostConstruct;
1024
import jakarta.enterprise.context.ApplicationScoped;
1125
import jakarta.inject.Inject;
@@ -18,7 +32,6 @@
1832
import space.ao.services.support.platform.info.registry.UserRegistryInfo;
1933
import space.ao.services.support.platform.info.registry.UserRegistryResult;
2034
import space.ao.services.support.platform.info.token.TokenVerifySignInfo;
21-
import space.ao.services.support.platform.model.*;
2235
import space.ao.services.support.security.SecurityUtils;
2336

2437
import java.nio.charset.StandardCharsets;
@@ -70,19 +83,8 @@ public UserRegistryResult registerUser(String requestId, UserRegistryInfo userRe
7083
return null;
7184
}
7285

73-
// Prepare RegisterUserRequest object
74-
RegisterUserRequest request = new RegisterUserRequest();
75-
request.setBoxUUID(properties.boxUuid());
76-
request.setUserId(userRegistryInfo.userId());
77-
request.setSubdomain(userRegistryInfo.subdomain());
78-
request.setUserType(userRegistryInfo.userType());
79-
request.setClientUUID(userRegistryInfo.clientUUID());
80-
81-
// Convert RegisterUserRequest object to JSON
82-
String jsonRequest = new ObjectMapper().writeValueAsString(request);
83-
8486
// Register User
85-
ApiResponse<RegisterUserResponse> response = client.registerUser(jsonRequest, requestId, boxRegKey);
87+
ApiResponse<RegisterUserResponse> response = client.registerUser(properties.boxUuid(), userRegistryInfo.userId(), userRegistryInfo.subdomain(), userRegistryInfo.userType(), userRegistryInfo.clientUUID(), requestId, boxRegKey);
8688
if (response.getError() != null) {
8789
LOG.error("Error registering user: {}", response.getError().getMessage());
8890
return null;
@@ -103,16 +105,8 @@ public ClientRegistryResult registerClient(String requestId, ClientRegistryInfo
103105
return null;
104106
}
105107

106-
// Prepare RegisterClientRequest object
107-
RegisterClientRequest request = new RegisterClientRequest();
108-
request.setClientUUID(clientRegistryInfo.clientUUID());
109-
request.setClientType(clientRegistryInfo.clientType());
110-
111-
// Convert RegisterClientRequest object to JSON
112-
String jsonRequest = new ObjectMapper().writeValueAsString(request);
113-
114108
// Register Client
115-
ApiResponse<RegisterClientResponse> response = client.registerClient(properties.boxUuid(), userId, jsonRequest, requestId, boxRegKey);
109+
ApiResponse<RegisterClientResponse> response = client.registerClient(properties.boxUuid(), userId, clientRegistryInfo.clientUUID(), clientRegistryInfo.clientType(), requestId, boxRegKey);
116110
if (response.getError() != null) {
117111
LOG.error("Error registering client: {}", response.getError().getMessage());
118112
return null;
@@ -135,16 +129,7 @@ private String obtainBoxRegKey(String requestId) {
135129
Base64.getEncoder().encodeToString(
136130
utils.objectToJson(TokenVerifySignInfo.of(properties.boxUuid(), List.of("10001")))
137131
.getBytes(StandardCharsets.UTF_8)));
138-
139-
ObtainBoxRegKeyRequest request = new ObtainBoxRegKeyRequest();
140-
request.setBoxUUID(properties.boxUuid());
141-
request.setServiceIds(List.of("10001"));
142-
request.setSign(sign);
143-
144-
String jsonRequest = new ObjectMapper().writeValueAsString(request);
145-
146-
//ApiResponse<ObtainBoxRegKeyResponse> response = client.obtainBoxRegKey(properties.boxUuid(), List.of("10001"), requestId,sign);
147-
ApiResponse<ObtainBoxRegKeyResponse> response = client.obtainBoxRegKey(jsonRequest, requestId);
132+
ApiResponse<ObtainBoxRegKeyResponse> response = client.obtainBoxRegKey(properties.boxUuid(), List.of("10001"), requestId,sign);
148133
if (response.getError() != null) {
149134
LOG.error("Error obtaining BoxRegKey: {}", response.getError().getMessage());
150135
return null;

src/main/java/space/ao/services/support/platform/model/ObtainBoxRegKeyResponse.java

-33
This file was deleted.

src/main/java/space/ao/services/support/platform/model/RegisterClientResponse.java

-46
This file was deleted.

src/main/java/space/ao/services/support/platform/model/RegisterUserResponse.java

-56
This file was deleted.

0 commit comments

Comments
 (0)