이 콘텐츠는 선택한 언어로 제공되지 않습니다.

13.8. Delegating Translators


You can create a delegating translator by extending the org.teiid.translator.BaseDelegatingExecutionFactory class.
Once your classes are packaged as a custom translator, you will be able to wire another translator instance into your delegating translator at runtime in order to intercept all of the calls to the delegate. This base class does not provide any functionality on its own, other than delegation.
Expand
Table 13.2. Execution Properties
Name
Description
Default
delegateName
Translator instance name to delegate to.
As an example, consider if you are currently using "oracle" translator in your VDB and you need to intercept the calls going through this translator.
  • You first write a custom delegating translator:
    @Translator(name="interceptor", description="interceptor")
    public class InterceptorExecutionFactory extends org.teiid.translator.BaseDelegatingExecutionFactory{
        @Override
        public void getMetadata(MetadataFactory metadataFactory, C conn) throws TranslatorException {
            // do intercepting code here..
    
            // If you need to call the original delegate, do not call if do not need to.
            // but if you did not call the delegate fulfill the method contract
            super.getMetadata(metadataFactory, conn);
    
            // do more intercepting code here..
        }
    }
    
    Copy to Clipboard Toggle word wrap
  • Then you deploy this translator.
  • Then modify your -vdb.xml or .vdb file:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <vdb name="myvdb" version="1">
    
        <model name="mymodel">
            <source name="source" translator-name="oracle-interceptor" connection-jndi-name="java:oracle-ds"/>
        </model>
    
        <!-- the below it is called translator overriding, where you can set different properties -->
        <translator name="oracle-interceptor" type="interceptor" />
            <property name="delegateName" value="oracle" />
       </translator>
    </vdb>
    
    Copy to Clipboard Toggle word wrap
We have defined a "translator" called "oracle-interceptor", which is based on the custom translator "interceptor" from above, and supplied the translator it required to delegate to "oracle" as its delegateName. Then, we used this override translator "oracle-interceptor" in the VDB. Now any calls going into this VDB model's translator will be intercepted by your code to do whatever you need to do.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat