Este conteúdo não está disponível no idioma selecionado.

16.5. Custom


If above provided metadata facilities are not sufficient for user's needs then user can extend the MetadataRepository class provided in the org.teiid.api JAR to plug-in their own metadata facilities into the JBoss Data Virtualization engine.
  1. Users can write metadata facility that is based on reading data from database or a JCR repository or so forth. Here is an example:
    package com.something;
    
    import org.teiid.metadata.MetadataRepository;
    ...
    			
    public class CustomMetadataRepository extends MetadataRepository {
        @Override
        public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory)
            throws TranslatorException {
            /* Provide implementation and fill the details in factory */
            ...
        }
    }
    
    Copy to Clipboard Toggle word wrap
  2. Build a JAR archive with above implementation class and create file named org.teiid.metadata.MetadataRepository in the META-INF/services directory with these contents:
    com.something.CustomMetadataRepository
    
    Copy to Clipboard Toggle word wrap
  3. Deploy the JAR to Red Hat JBoss EAP as a module under the modules directory. Follow the below steps to create a module.
    • Create a directory called modules/com/something/main.
    • Under this directory create a "module.xml" file that looks like:
      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.0" name="com.something">
          <resources>
              <resource-root path="something.jar" />
          </resources>
          <dependencies>
              <module name="javax.api"/>
              <module name="javax.resource.api"/>
              <module name="org.jboss.teiid.common-core"/>
              <module name="org.jboss.teiid.teiid-api" />
          </dependencies>
      </module>
      
      Copy to Clipboard Toggle word wrap
    • Copy the jar file under this same directory. Make sure you add any additional dependencies if required by your implementation class under dependencies.
    • Restart the server.
This is how you configure the VDB with the custom metadata repository you have created:

Example 16.4. Sample vdb.xml file

<vdb name="{vdb-name}" version="1">
    <model name="{model-name}" type="PHYSICAL">
        <source name="AccountsDB" translator-name="oracle" connection-jndi-name="java:/oracleDS"/>
        <metadata type="{metadata-repo-module}"></metadata>
    </model>
</vdb>
Copy to Clipboard Toggle word wrap
When the VDB is deployed, it will call the CustomMetadataRepository instance for metadata of the model. Using this you can define metadata for single model or for the whole VDB pragmatically.

Important

Be careful about holding state and synchronization in your repository instance.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat