このコンテンツは選択した言語では利用できません。

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 では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat