추가 Windchill 기능 > 서비스 정보 관리 > Customizing Windchill Service Information Manager and Windchill Service Parts(Windchill Service Information Manager 및 Windchill Service Parts 사용자 정의) > 들어오는 번역된 컨텐트를 검증하기 위한 사용자 정의 후크
  
들어오는 번역된 컨텐트를 검증하기 위한 사용자 정의 후크
CustomXMLValidationHook를 사용하면 Service Information Manager로 컨텐트를 가져오기 전에 XML 파일과 함께 번역 공급업체로부터 수신된 들어오는 번역된 컨텐트를 검증할 수 있습니다. 검증이 성공한 경우 가져오기 프로세스가 계속 진행됩니다. 검증에 예외가 발생하는 경우 SIM 번역에서는 가져오기 프로세스가 실패하며 예외의 정보가 가져오기 실패 로그 파일에 추가됩니다. 번역 패키지에 CustomXMLValidationHook 검증을 통과한 파일이 포함된 경우에도 예외뿐만 아니라 번역 패키지의 컨텐트를 가져오지 않습니다.
이 후크를 구현하려면 다음 세부내용을 지정해야 합니다.
번역 패키지 가져오기 프로세스 실패 시 상태 - 처음 XML 검증 실패 시 또는 마지막 XML 검증 실패 후
가져오기 로그 파일에서 XML 검증에 실패한 파일에 대한 오류 메시지 채우기
번역 패키지 가져오기 프로세스에서 CustomXMLValidationHook 검증은 잘못된 XML 파일 컨텐트에 대해 번역된 패키지를 검사한 후 번역된 컨텐트가 체크 인되기 전에 수행됩니다.
인터페이스
package com.ptc.tml.validation;
import java.io.InputStream;
/**The interface provides the custom XML validation service for the translation *contents. The interface receives the file name and input stream of the file which is to be validated for the XML and need to throw the exception to indicate the XML validation
*failure for given file. The implementation must state whether the Import Translation Process should fail if the first XML validation failure has *encountered or after the last XML validation failure. The implementation also needs to populate the error message
*for failed XML validation for logging purpose.
*/
public interface CustomXMLValidationHook {
/**
* @return boolean Boolean value to indicate whether the translation process should be failed when the first XML validation failure is encountered
*/
public boolean failOnFirstError();
/**
* @param fileName Name of file in the translation zip to validated for XML
* @param is InputStream of the file to be validated for XML
* @throws TranslationException
*/
public void validateXML (String fileName, InputStream is) throws TranslationException;
/**
* @return Error message to be logged for XML validation failures
*/
public String getErrorMessage();
}
참조로 제공된 예제 구현인 SampleCustomXMLValidationFailFastHookImpl.javaSampleCustomXMLValidationHookImpl.java를 참조하십시오. 이 예제 구현은 $WT_HOME\codebase\com\ptc\tml\sample 위치에 있습니다.
레지스트리
1. xconfmanager 유틸리티를 사용하여 translation.service.properties.xconf를 편집할 수 있습니다. <Windchill>/codebase/com/ptc/core/components에 있는 components.service.properties 파일에서 등록할 수도 있습니다. xconfmanager 유틸리티 사용에 대한 자세한 내용은 xconfmanager 유틸리티 정보를 참조하십시오.
2. 다음 등록 정보를 추가합니다.
<Service context="default"
name="com.ptc.tml.validation.CustomXMLValidationHook">
<Option serviceClass="YourCustomXMLValidationHookClassName"
selector="null"/>
</Service>
3. 파일을 저장합니다.
4. xconfmanager 유틸리티를 사용하여 변경 사항을 전파합니다. <Windchill>\bin 디렉토리에서 다음 명령을 입력합니다.
xconfmanager -pF
5. 메소드 서버를 다시 시작합니다.