此内容没有您所选择的语言版本。
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.
- Users can write metadata facility that is based on reading data from database or a JCR repository or so forth. Here is an example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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
com.something.CustomMetadataRepository
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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
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.