@ -2,9 +2,11 @@ package go.kr.project.api.config.properties;
import javax.validation.constraints.NotBlank ;
import javax.validation.constraints.NotNull ;
import lombok.Data ;
import org.springframework.boot.context.properties.ConfigurationProperties ;
import org.springframework.validation.annotation.Validated ;
@Data
@ConfigurationProperties ( prefix = "vmis" )
@Validated
public class VmisProperties {
@ -22,41 +24,23 @@ public class VmisProperties {
@NotNull
private ExternalProps external = new ExternalProps ( ) ;
public IntegrationProps getIntegration ( ) { return integration ; }
public void setIntegration ( IntegrationProps integration ) { this . integration = integration ; }
public RestTemplateProps getRestTemplate ( ) { return restTemplate ; }
public void setRestTemplate ( RestTemplateProps restTemplate ) { this . restTemplate = restTemplate ; }
public SystemProps getSystem ( ) { return system ; }
public void setSystem ( SystemProps system ) { this . system = system ; }
public GpkiProps getGpki ( ) { return gpki ; }
public void setGpki ( GpkiProps gpki ) { this . gpki = gpki ; }
public GovProps getGov ( ) { return gov ; }
public void setGov ( GovProps gov ) { this . gov = gov ; }
public ExternalProps getExternal ( ) { return external ; }
public void setExternal ( ExternalProps external ) { this . external = external ; }
@Data
public static class IntegrationProps {
@NotBlank
private String mode = "external" ;
public String getMode ( ) { return mode ; }
public void setMode ( String mode ) { this . mode = mode ; }
}
@Data
public static class ExternalProps {
@NotNull
private ApiProps api = new ApiProps ( ) ;
public ApiProps getApi ( ) { return api ; }
public void setApi ( ApiProps api ) { this . api = api ; }
@Data
public static class ApiProps {
@NotNull
private UrlProps url = new UrlProps ( ) ;
public UrlProps getUrl ( ) { return url ; }
public void setUrl ( UrlProps url ) { this . url = url ; }
@Data
public static class UrlProps {
@NotBlank
private String base = "http://localhost:8081/api/v1/vehicles" ; // 기본 Base URL
@ -65,13 +49,6 @@ public class VmisProperties {
@NotBlank
private String ledger = "/ledger" ; // 자동차등록원부 엔드포인트 경로
public String getBase ( ) { return base ; }
public void setBase ( String base ) { this . base = base ; }
public String getBasic ( ) { return basic ; }
public void setBasic ( String basic ) { this . basic = basic ; }
public String getLedger ( ) { return ledger ; }
public void setLedger ( String ledger ) { this . ledger = ledger ; }
// 중요: 외부 VMIS-interface 호출용 전체 URL 조합 헬퍼 (공통 RestTemplate 타임아웃 설정 사용)
public String buildBasicUrl ( ) { return join ( base , basic ) ; }
public String buildLedgerUrl ( ) { return join ( base , ledger ) ; }
@ -91,6 +68,7 @@ public class VmisProperties {
}
}
@Data
public static class SystemProps {
@NotBlank
private String infoSysId ;
@ -103,23 +81,9 @@ public class VmisProperties {
private String chargerId ;
private String chargerIp ;
private String chargerNm ;
public String getInfoSysId ( ) { return infoSysId ; }
public void setInfoSysId ( String infoSysId ) { this . infoSysId = infoSysId ; }
public String getInfoSysIp ( ) { return infoSysIp ; }
public void setInfoSysIp ( String infoSysIp ) { this . infoSysIp = infoSysIp ; }
public String getSigunguCode ( ) { return sigunguCode ; }
public void setSigunguCode ( String sigunguCode ) { this . sigunguCode = sigunguCode ; }
public String getDepartmentCode ( ) { return departmentCode ; }
public void setDepartmentCode ( String departmentCode ) { this . departmentCode = departmentCode ; }
public String getChargerId ( ) { return chargerId ; }
public void setChargerId ( String chargerId ) { this . chargerId = chargerId ; }
public String getChargerIp ( ) { return chargerIp ; }
public void setChargerIp ( String chargerIp ) { this . chargerIp = chargerIp ; }
public String getChargerNm ( ) { return chargerNm ; }
public void setChargerNm ( String chargerNm ) { this . chargerNm = chargerNm ; }
}
@Data
public static class GpkiProps {
/** "Y" 또는 "N" */
@NotBlank
@ -142,49 +106,17 @@ public class VmisProperties {
private String sigPrivateKeyFilePathName ; // ..._sig.key
private String sigPrivateKeyPasswd ;
public String getEnabled ( ) { return enabled ; }
public void setEnabled ( String enabled ) { this . enabled = enabled ; }
public boolean isUseSign ( ) { return useSign ; }
public void setUseSign ( boolean useSign ) { this . useSign = useSign ; }
public String getCharset ( ) { return charset ; }
public void setCharset ( String charset ) { this . charset = charset ; }
public String getCertServerId ( ) { return certServerId ; }
public void setCertServerId ( String certServerId ) { this . certServerId = certServerId ; }
public String getTargetServerId ( ) { return targetServerId ; }
public void setTargetServerId ( String targetServerId ) { this . targetServerId = targetServerId ; }
public Boolean getLdap ( ) { return ldap ; }
public void setLdap ( Boolean ldap ) { this . ldap = ldap ; }
public String getGpkiLicPath ( ) { return gpkiLicPath ; }
public void setGpkiLicPath ( String gpkiLicPath ) { this . gpkiLicPath = gpkiLicPath ; }
public String getCertFilePath ( ) { return certFilePath ; }
public void setCertFilePath ( String certFilePath ) { this . certFilePath = certFilePath ; }
public String getEnvCertFilePathName ( ) { return envCertFilePathName ; }
public void setEnvCertFilePathName ( String envCertFilePathName ) { this . envCertFilePathName = envCertFilePathName ; }
public String getEnvPrivateKeyFilePathName ( ) { return envPrivateKeyFilePathName ; }
public void setEnvPrivateKeyFilePathName ( String envPrivateKeyFilePathName ) { this . envPrivateKeyFilePathName = envPrivateKeyFilePathName ; }
public String getEnvPrivateKeyPasswd ( ) { return envPrivateKeyPasswd ; }
public void setEnvPrivateKeyPasswd ( String envPrivateKeyPasswd ) { this . envPrivateKeyPasswd = envPrivateKeyPasswd ; }
public String getSigCertFilePathName ( ) { return sigCertFilePathName ; }
public void setSigCertFilePathName ( String sigCertFilePathName ) { this . sigCertFilePathName = sigCertFilePathName ; }
public String getSigPrivateKeyFilePathName ( ) { return sigPrivateKeyFilePathName ; }
public void setSigPrivateKeyFilePathName ( String sigPrivateKeyFilePathName ) { this . sigPrivateKeyFilePathName = sigPrivateKeyFilePathName ; }
public String getSigPrivateKeyPasswd ( ) { return sigPrivateKeyPasswd ; }
public void setSigPrivateKeyPasswd ( String sigPrivateKeyPasswd ) { this . sigPrivateKeyPasswd = sigPrivateKeyPasswd ; }
public boolean isEnabledFlag ( ) { return "Y" . equalsIgnoreCase ( enabled ) ; }
}
@Data
public static class RestTemplateProps {
@NotNull
private ModeConfig internal = new ModeConfig ( ) ;
@NotNull
private ModeConfig external = new ModeConfig ( ) ;
public ModeConfig getInternal ( ) { return internal ; }
public void setInternal ( ModeConfig internal ) { this . internal = internal ; }
public ModeConfig getExternal ( ) { return external ; }
public void setExternal ( ModeConfig external ) { this . external = external ; }
@Data
public static class ModeConfig {
@NotNull
private TimeoutConfig timeout = new TimeoutConfig ( ) ;
@ -193,42 +125,26 @@ public class VmisProperties {
@NotNull
private RateLimitConfig rateLimit = new RateLimitConfig ( ) ;
public TimeoutConfig getTimeout ( ) { return timeout ; }
public void setTimeout ( TimeoutConfig timeout ) { this . timeout = timeout ; }
public ConnectionPoolConfig getConnectionPool ( ) { return connectionPool ; }
public void setConnectionPool ( ConnectionPoolConfig connectionPool ) { this . connectionPool = connectionPool ; }
public RateLimitConfig getRateLimit ( ) { return rateLimit ; }
public void setRateLimit ( RateLimitConfig rateLimit ) { this . rateLimit = rateLimit ; }
@Data
public static class TimeoutConfig {
private int connectTimeoutMillis = 10000 ;
private int readTimeoutMillis = 12000 ;
public int getConnectTimeoutMillis ( ) { return connectTimeoutMillis ; }
public void setConnectTimeoutMillis ( int connectTimeoutMillis ) { this . connectTimeoutMillis = connectTimeoutMillis ; }
public int getReadTimeoutMillis ( ) { return readTimeoutMillis ; }
public void setReadTimeoutMillis ( int readTimeoutMillis ) { this . readTimeoutMillis = readTimeoutMillis ; }
}
@Data
public static class ConnectionPoolConfig {
private int maxTotal = 100 ;
private int maxPerRoute = 20 ;
public int getMaxTotal ( ) { return maxTotal ; }
public void setMaxTotal ( int maxTotal ) { this . maxTotal = maxTotal ; }
public int getMaxPerRoute ( ) { return maxPerRoute ; }
public void setMaxPerRoute ( int maxPerRoute ) { this . maxPerRoute = maxPerRoute ; }
}
@Data
public static class RateLimitConfig {
private double permitsPerSecond = 5.0 ;
public double getPermitsPerSecond ( ) { return permitsPerSecond ; }
public void setPermitsPerSecond ( double permitsPerSecond ) { this . permitsPerSecond = permitsPerSecond ; }
}
}
}
@Data
public static class GovProps {
@NotBlank
private String scheme = "http" ;
@ -239,15 +155,6 @@ public class VmisProperties {
@NotNull
private Services services = new Services ( ) ;
public String getScheme ( ) { return scheme ; }
public void setScheme ( String scheme ) { this . scheme = scheme ; }
public String getHost ( ) { return host ; }
public void setHost ( String host ) { this . host = host ; }
public String getBasePath ( ) { return basePath ; }
public void setBasePath ( String basePath ) { this . basePath = basePath ; }
public Services getServices ( ) { return services ; }
public void setServices ( Services services ) { this . services = services ; }
public String buildServiceUrl ( String path ) {
StringBuilder sb = new StringBuilder ( ) ;
sb . append ( scheme ) . append ( "://" ) . append ( host ) ;
@ -262,18 +169,15 @@ public class VmisProperties {
return sb . toString ( ) ;
}
@Data
public static class Services {
@NotNull
private Service basic = new Service ( ) ;
@NotNull
private Service ledger = new Service ( ) ;
public Service getBasic ( ) { return basic ; }
public void setBasic ( Service basic ) { this . basic = basic ; }
public Service getLedger ( ) { return ledger ; }
public void setLedger ( Service ledger ) { this . ledger = ledger ; }
}
@Data
public static class Service {
@NotBlank
private String path ;
@ -283,15 +187,6 @@ public class VmisProperties {
private String apiKey ;
@NotBlank
private String cvmisApikey ;
public String getPath ( ) { return path ; }
public void setPath ( String path ) { this . path = path ; }
public String getCntcInfoCode ( ) { return cntcInfoCode ; }
public void setCntcInfoCode ( String cntcInfoCode ) { this . cntcInfoCode = cntcInfoCode ; }
public String getApiKey ( ) { return apiKey ; }
public void setApiKey ( String apiKey ) { this . apiKey = apiKey ; }
public String getCvmisApikey ( ) { return cvmisApikey ; }
public void setCvmisApikey ( String cvmisApikey ) { this . cvmisApikey = cvmisApikey ; }
}
}
}