diff --git a/dat-gateway/src/main/java/io/shinhanlife/dat/mcg/service/ToolPlanner.java b/dat-gateway/src/main/java/io/shinhanlife/dat/mcg/service/ToolPlanner.java index 5f808fc3..bbcce6bb 100644 --- a/dat-gateway/src/main/java/io/shinhanlife/dat/mcg/service/ToolPlanner.java +++ b/dat-gateway/src/main/java/io/shinhanlife/dat/mcg/service/ToolPlanner.java @@ -14,14 +14,14 @@ import java.util.Map; /** * @package io.shinhanlife.dat.mcg.service * @className ToolPlanner - * @description AX HUB ?�스??처리 ?�래?? + * @description AX HUB 시스템 처리 클래스 * @author 0986406 * @create 2026.09.01 *
- * ---------- 개정?�력 ----------
- * ?�정??     ?�정??   ?�정?�용
+ * ---------- 개정이력 ----------
+ * 수정일      수정자    수정내용
  * ---------- -------- ---------------------------
- * 2026.09.01  0986406    최초?�성
+ * 2026.09.01  0986406    최초생성
  * 
  * 
*/ @@ -35,25 +35,25 @@ public class ToolPlanner { private final GatewayFallbackProperties fallbackProperties; /** - * ?�청(payload)??분석?�여 ?�행?�야 ??Tool??계획???�성?�니?? + * 요청(payload)을 분석하여 실행해야 할 Tool의 계획을 생성합니다. */ public Object createPlan(Map payload, String tenantId) { - log.info(" [Planner] ?�청 분석 �??�행 계획 ?�립 ?�작"); + log.info(" [Planner] 요청 분석 및 실행 계획 수립 시작"); - // 1. ?�청?�서 ?�출?�려?????�름 추출 (JSON-RPC params.name) + // 1. 요청에서 호출하려는 툴 이름 추출 (JSON-RPC params.name) Map params = (Map) payload.get("params"); String toolName = params != null ? (String) params.get("name") : null; if (toolName == null || toolName.isEmpty()) { - throw new IllegalArgumentException("?�청??toolName???�함?�어 ?��? ?�습?�다."); + throw new IllegalArgumentException("요청에 toolName이 포함되어 있지 않습니다."); } - // 2. RedisRegistry?�서 ?�당 ?�의 메�??�이??조회 - // (?�제로는 ??메�??�이?��? ?�행 계획???�심???�니?? + // 2. RedisRegistry에서 해당 툴의 메타데이터 조회 + // (실제로는 이 메타데이터가 실행 계획의 핵심이 됩니다) var toolMetadata = InMemoryRegistryService.getToolByName(toolName); if (toolMetadata == null) { - log.warn(" [Planner] ?�록?��? ?��? ???�청: {}. Fallback ?�우??규칙???�인?�니??", toolName); + log.warn(" [Planner] 등록되지 않은 툴 요청: {}. Fallback 라우팅 규칙을 확인합니다.", toolName); String fallbackPodUrl = fallbackProperties.getDefaultUrl(); if (fallbackProperties.getRoutes() != null) { @@ -66,11 +66,11 @@ public class ToolPlanner { } if (fallbackPodUrl == null || fallbackPodUrl.isEmpty()) { - log.error(" [Planner] Fallback ?�우???�?�이 ?�닙?�다. ?? {}", toolName); - throw new RuntimeException("?�당 ??" + toolName + ")???��??�트리에 존재?��? ?�습?�다."); + log.error(" [Planner] Fallback 라우팅 대상이 아닙니다. 툴: {}", toolName); + throw new RuntimeException("해당 툴(" + toolName + ")이 레지스트리에 존재하지 않습니다."); } - log.info(" [Planner] Fallback ?�우??매칭?? {} -> {}", toolName, fallbackPodUrl); + log.info(" [Planner] Fallback 라우팅 매칭됨: {} -> {}", toolName, fallbackPodUrl); toolMetadata = ToolMetadata.builder() .uid(toolName) @@ -80,26 +80,26 @@ public class ToolPlanner { .build(); } - // 2-1. [?�규] ?�메??그룹??기반 권한 검�? + // 2-1. [신규] 도메인 그룹핑 기반 권한 검증 if (tenantId != null && !tenantId.equalsIgnoreCase("system") && toolMetadata.getCategoryKey() != null) { String normalizedTenantId = tenantId.toLowerCase(); List allowedDomains = securityProperties.getTenantDomains().get(normalizedTenantId); - // 만약 ?�?�문??변???�에???�으�??�래 값으�???�????�도 (?�위 ?�환?? + // 만약 대소문자 변환 후에도 없으면 원래 값으로 한 번 더 시도 (하위 호환성) if (allowedDomains == null) { allowedDomains = securityProperties.getTenantDomains().get(tenantId); } if (allowedDomains == null || (!allowedDomains.contains("ALL") && !allowedDomains.contains(toolMetadata.getCategoryKey()))) { - log.warn(" [Planner] 권한 거�? - Tenant: {}, Request Domain: {}", tenantId, toolMetadata.getCategoryKey()); - throw new SecurityException("?�당 ?�메??" + toolMetadata.getCategoryKey() + ")???�을 ?�행??권한???�습?�다."); + log.warn(" [Planner] 권한 거부 - Tenant: {}, Request Domain: {}", tenantId, toolMetadata.getCategoryKey()); + throw new SecurityException("해당 도메인(" + toolMetadata.getCategoryKey() + ")의 툴을 실행할 권한이 없습니다."); } } - log.info(" [Planner] ??'{}'???�???�행 계획 ?�립 ?�료", toolName); + log.info(" [Planner] 툴 '{}'에 대한 실행 계획 수립 완료", toolName); - // 3. ?�립??계획(??메�??�이?? 반환 + // 3. 수립된 계획(툴 메타데이터) 반환 return toolMetadata; } } \ No newline at end of file