搜索

此内容没有您所选择的语言版本。

10.8. Preparser

download PDF
If it is desirable to manipulate incoming queries prior to being handled by Teiid logic, then a custom pre-parser can be installed. Use the PreParser interface provided in the org.teiid.api jar to plug-in a pre-parser for the Teiid engine. See Setting up the build environment to start development.
import org.teiid.PreParser;
...
 
package com.something;
 
public class CustomPreParser implements PreParser {
 
    @Override
    public String preParse(String command, CommandContext context) {
        //manipulate the command
    }
}
Next, build a JAR archive with above implementation class and create a file named org.teiid.PreParser in the META-INF/services directory with these contents:
com.something.CustomPreParser
The JAR has now been built. Deploy it in the JBoss AS as a module under jboss-as/modules directory. Now create a module:
Create a directory called jboss-as/modules/com/something/main. In it create a "module.xml" file with these contents:
<?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 the jar file under this same directory. Make sure you add any additional dependencies if required by your implementation class under dependencies.
Use the command line interface or modify the configuration to set the preparser-module in the Teiid subsystem configuration to the appropriate module name.
Restart the server

Important

Development Considerations Changing the incoming query to a different type of statement is not recommended as are any modifications to the number or types of projected symbols.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.