refactor: Replace inline fully qualified package names with proper imports

This commit is contained in:
jade
2026-07-16 21:36:51 +09:00
parent c982696631
commit e1591761d2
6 changed files with 26 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
package io.shinhanlife.dap.biz.mcp.gateway.service; package io.shinhanlife.dap.biz.mcp.gateway.service;
import java.util.HashMap;
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata; import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType; import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
import io.shinhanlife.dap.biz.mcp.gateway.resilience.RetryPolicy; import io.shinhanlife.dap.biz.mcp.gateway.resilience.RetryPolicy;
@@ -219,9 +221,9 @@ public class ExecuteService {
LargeToolResponseService.Collector collector = largeResponses.newCollector(metadata.getName(), context.requestId()); LargeToolResponseService.Collector collector = largeResponses.newCollector(metadata.getName(), context.requestId());
while (true) { while (true) {
Map<String, Object> pagePayload = new java.util.HashMap<>(payload); Map<String, Object> pagePayload = new HashMap<>(payload);
if (pagePayload.containsKey("params")) { if (pagePayload.containsKey("params")) {
Map<String, Object> params = new java.util.HashMap<>((Map<String, Object>) pagePayload.get("params")); Map<String, Object> params = new HashMap<>((Map<String, Object>) pagePayload.get("params"));
params.put("arguments", objectMapper.convertValue(pageArguments, Map.class)); params.put("arguments", objectMapper.convertValue(pageArguments, Map.class));
pagePayload.put("params", params); pagePayload.put("params", params);
} else { } else {

View File

@@ -1,5 +1,7 @@
package io.shinhanlife.dap.biz.mcp.gateway.sync; package io.shinhanlife.dap.biz.mcp.gateway.sync;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.modelcontextprotocol.json.TypeRef; import io.modelcontextprotocol.json.TypeRef;
import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema;
@@ -127,7 +129,7 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
McpServerSession session = sessions.get(sessionId); McpServerSession session = sessions.get(sessionId);
try { try {
java.util.Map<String, Object> map = objectMapper.readValue(body, new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, Object>>() {}); Map<String, Object> map = objectMapper.readValue(body, new TypeReference<Map<String, Object>>() {});
io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message; io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message;
if (map.containsKey("id")) { if (map.containsKey("id")) {

View File

@@ -1,5 +1,7 @@
package io.shinhanlife.dap.biz.mcp.gateway.sync; package io.shinhanlife.dap.biz.mcp.gateway.sync;
import java.util.UUID;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -72,7 +74,7 @@ public class DynamicMcpController {
if (sessionId == null || sessionId.isEmpty()) { if (sessionId == null || sessionId.isEmpty()) {
// 새 세션 생성 (initialize 요청) // 새 세션 생성 (initialize 요청)
String newSessionId = java.util.UUID.randomUUID().toString(); String newSessionId = UUID.randomUUID().toString();
SseEmitter emitter = transport.handleCustomSse(newSessionId, body); SseEmitter emitter = transport.handleCustomSse(newSessionId, body);
return ResponseEntity.ok() return ResponseEntity.ok()

View File

@@ -1,5 +1,6 @@
package io.shinhanlife.dap.biz.mcp.gateway.sync; package io.shinhanlife.dap.biz.mcp.gateway.sync;
import io.modelcontextprotocol.spec.McpSchema.ServerCapabilities;
import io.modelcontextprotocol.server.McpServer; import io.modelcontextprotocol.server.McpServer;
import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.server.McpSyncServer;
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata; import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
@@ -51,7 +52,7 @@ public class DynamicMcpServerManager {
McpSyncServer newServer = McpServer.sync(transport) McpSyncServer newServer = McpServer.sync(transport)
.serverInfo("DAP-Gateway-" + key, "1.0.0") .serverInfo("DAP-Gateway-" + key, "1.0.0")
.capabilities(io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.builder().tools(true).build()) .capabilities(ServerCapabilities.builder().tools(true).build())
.build(); .build();
categoryTransports.put(key, transport); categoryTransports.put(key, transport);

View File

@@ -1,5 +1,8 @@
package io.shinhanlife.dap.biz.mcp.gateway.tool.large; package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
import java.util.Iterator;
import java.util.Map;
import io.shinhanlife.dap.biz.mcp.gateway.config.AgentResponseBudgetProperties; import io.shinhanlife.dap.biz.mcp.gateway.config.AgentResponseBudgetProperties;
import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker; import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -99,9 +102,9 @@ public class AgentResponseBudgetService {
int copied = 0; int copied = 0;
int originalFields = 0; int originalFields = 0;
java.util.Iterator<java.util.Map.Entry<String, JsonNode>> fields = masked.fields(); Iterator<Map.Entry<String, JsonNode>> fields = masked.fields();
while (fields.hasNext()) { while (fields.hasNext()) {
java.util.Map.Entry<String, JsonNode> entry = fields.next(); Map.Entry<String, JsonNode> entry = fields.next();
originalFields++; originalFields++;
if (copied >= properties.maxFieldsPerItem()) { if (copied >= properties.maxFieldsPerItem()) {
continue; continue;
@@ -135,9 +138,9 @@ public class AgentResponseBudgetService {
ObjectNode source = (ObjectNode) item; ObjectNode source = (ObjectNode) item;
ObjectNode limited = json.createObjectNode(); ObjectNode limited = json.createObjectNode();
java.util.Iterator<java.util.Map.Entry<String, JsonNode>> fields = source.fields(); Iterator<Map.Entry<String, JsonNode>> fields = source.fields();
while (fields.hasNext()) { while (fields.hasNext()) {
java.util.Map.Entry<String, JsonNode> entry = fields.next(); Map.Entry<String, JsonNode> entry = fields.next();
JsonNode value = entry.getValue(); JsonNode value = entry.getValue();
if (value.isTextual()) { if (value.isTextual()) {
limited.put(entry.getKey(), truncateText(value.asText())); limited.put(entry.getKey(), truncateText(value.asText()));
@@ -164,7 +167,7 @@ public class AgentResponseBudgetService {
fallback.put("maxItemBytes", properties.maxItemBytes()); fallback.put("maxItemBytes", properties.maxItemBytes());
if (item.isObject()) { if (item.isObject()) {
ArrayNode fieldNames = json.createArrayNode(); ArrayNode fieldNames = json.createArrayNode();
java.util.Iterator<String> fieldNamesIter = item.fieldNames(); Iterator<String> fieldNamesIter = item.fieldNames();
while (fieldNamesIter.hasNext()) { while (fieldNamesIter.hasNext()) {
fieldNames.add(fieldNamesIter.next()); fieldNames.add(fieldNamesIter.next());
} }
@@ -188,9 +191,9 @@ public class AgentResponseBudgetService {
private ObjectNode copyWithout(ObjectNode source, String... excludedFields) { private ObjectNode copyWithout(ObjectNode source, String... excludedFields) {
ObjectNode copy = json.createObjectNode(); ObjectNode copy = json.createObjectNode();
java.util.Iterator<java.util.Map.Entry<String, JsonNode>> fields = source.fields(); Iterator<Map.Entry<String, JsonNode>> fields = source.fields();
while (fields.hasNext()) { while (fields.hasNext()) {
java.util.Map.Entry<String, JsonNode> entry = fields.next(); Map.Entry<String, JsonNode> entry = fields.next();
if (!excluded(entry.getKey(), excludedFields)) { if (!excluded(entry.getKey(), excludedFields)) {
copy.set(entry.getKey(), entry.getValue()); copy.set(entry.getKey(), entry.getValue());
} }

View File

@@ -1,5 +1,7 @@
package io.shinhanlife.dap.biz.mcp.gateway.tool.large; package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
import java.util.Iterator;
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties; import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker; import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker;
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType; import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
@@ -266,7 +268,7 @@ public class LargeToolResponseService {
preview.put("maxItemBytes", properties.largeResponseMaxItemBytes()); preview.put("maxItemBytes", properties.largeResponseMaxItemBytes());
if (masked.isObject()) { if (masked.isObject()) {
ArrayNode fieldNames = json.createArrayNode(); ArrayNode fieldNames = json.createArrayNode();
java.util.Iterator<String> fieldNamesIter = masked.fieldNames(); Iterator<String> fieldNamesIter = masked.fieldNames();
while (fieldNamesIter.hasNext()) { while (fieldNamesIter.hasNext()) {
fieldNames.add(fieldNamesIter.next()); fieldNames.add(fieldNamesIter.next());
} }
@@ -309,7 +311,7 @@ public class LargeToolResponseService {
private int count(JsonNode node) { private int count(JsonNode node) {
int count = 0; int count = 0;
java.util.Iterator<JsonNode> iter = node.elements(); Iterator<JsonNode> iter = node.elements();
while(iter.hasNext()) { while(iter.hasNext()) {
iter.next(); iter.next();
count++; count++;