9 Replies Latest reply on Jul 12, 2012 2:35 AM by nsabina

    Chain of delegating translators

    nsabina

      I am trying to insert translator2 in the following chain of translators

       

      Call to backend:

      translator1 -> translator2 -> datasource specific translator -> datasource

      response:

      datasource -> datasource specific translator -> translator2 -> translator1

       

      Example below will contain h2 for simplicity.

       

      Based on my understanding I should build vdb definition as:

       

          <translator name="h2_model.delegating-translator" type="h2"/>

       

          <translator name="h2_model.delegating-delegated-translator2" type="translator2_type">

              <property name="DelegateName" value="h2_model.delegating-translator"/>

          </translator>

       

          <translator name=" h2_model.delegated-translator1" type="translator1-type">

              <property name="DelegateName" value="h2_model.delegating-delegated-translator2"/>

          </translator>

       

      Is this the correct approach to implement a chain of delegating translators?  (I need to ensure that translator1 is always the outer most)

       

      Thank you,

      Sabina

        • 1. Re: Chain of delegating translators
          rareddy

          Sabina,

           

          I do not think the you can chain multiple delegating translators with the current code. However you can write such delegating translator as you have control over it as you control the first delegation, however the configuration will not be same as you shown above, it will be specific to as you write it. If Teiid does, then it has to control order in which it needs to load, avoid circular dependency etc.. which it does not have.

           

          Ramesh..

          • 2. Re: Chain of delegating translators
            shawkins

            Sabina,

             

            What you are trying to do should work.  The current code does allow multiple delegate chaining and we will also check for cicurlar dependencies.  It should not matter what order you define them in the vdb.xml.

             

            Steve

            • 3. Re: Chain of delegating translators
              nsabina

              Thank you guys.

              Steve,

              When you say "current code" do you refer to both 7.7 and 8 ?

              • 4. Re: Chain of delegating translators
                shawkins

                Yes, both 7.7 and 8.x.

                • 5. Re: Chain of delegating translators
                  nsabina

                  I keep getting NullPointerException on translator1.setDelegate(translator2). Exhausted ideas where else to look at the moment, any suggestions are appreciated. JBoss bean for new translator2 is defined, translator jars are all in place, it has to be VDB definition.

                   

                  Here is an actual generated VDB XML fragment:

                   

                  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                  <vdb version="1" name="Chorus">
                       <property name="UseConnectorMetadata" value="true"/>

                  .......

                       <model type="PHYSICAL" visible="true" name="timeseries">
                           <property name="importer.useFullSchemaName" value="false"/>
                           <source name="timeseries" connection-jndi-name="java:CHORUS-H2-METRICPOLLER-DS" translator-name="timeseries.delegated-translator"/>
                       </model>

                  .......

                       <translator name="timeseries.delegating-delegated-translator" type="chorus-translator-timezone">
                           <property name="DelegateName" value="timeseries.delegating-translator"/>
                       </translator>
                       <translator name="timeseries.delegating-translator" type="h2"/>
                       <translator name="timeseries.delegated-translator" type="chorus-translator-safetyHarness">
                           <property name="DelegateName" value="timeseries.delegating-delegated-translator"/>
                       </translator>

                  </vdb>

                   

                  * translator1(outer most) = chorus-translator-safetyHarness

                  ** trabslator2 = chorus-translator-timezone

                  • 6. Re: Chain of delegating translators
                    shawkins

                    I didn't have a problem with this scenario on trunk.  What version are you using and what exception are you seeing?

                    • 7. Re: Chain of delegating translators
                      nsabina

                      We have Teiid 7.7. Exception happens due to null delegate being passed to out translator1 (SafetyHarness):

                       

                       

                      [08:46:16.136][info][talledLocalContainer]  at java.lang.Thread.run(Thread.java:722)
                      [08:46:16.136][info][talledLocalContainer] Caused by: java.lang.NullPointerException
                      [08:46:16.136][info][talledLocalContainer]  at org.teiid.translator.BaseDelegatingExecutionFactory.supportsFullOuterJoins(BaseDelegatingExecutionFactory.java:405)
                      [08:46:16.136][info][talledLocalContainer]  at com.ca.chorus.teiid.safety.SafetyHarnessExecutionFactory.setDelegate(SafetyHarnessExecutionFactory.java:139)
                      [08:46:16.136][info][talledLocalContainer]  at org.teiid.deployers.VDBDeployer.getExecutionFactory(VDBDeployer.java:223)
                      [08:46:16.136][info][talledLocalContainer]  at org.teiid.deployers.VDBDeployer.createConnectorManagers(VDBDeployer.java:196)
                      [08:46:16.136][info][talledLocalContainer]  at org.teiid.deployers.VDBDeployer.deploy(VDBDeployer.java:113)
                      [08:46:16.136][info][talledLocalContainer]  at org.teiid.deployers.VDBDeployer.deploy(VDBDeployer.java:60)
                      [08:46:16.136][info][talledLocalContainer]  at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                      [08:46:16.136][info][talledLocalContainer]  at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                      [08:46:16.136][info][talledLocalContainer]  at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                      [08:46:16.136][info][talledLocalContainer]  ... 73 more
                      [08:46:16.244][info][talledLocalContainer] 11 Jul 2012 08:46:16,243 PDT INFO  [DeployHandler] Failed to complete command: [start] for deployment: names=[vfsfile:/C:/Users/norsa01/workspace/Chorus.1231/Chorus.1231/chorus-main/server/chorus-server-run/target/cargo/configurations/jboss51x/deploy/chorus.1-vdb.xml], copyContent=true
                      [08:46:16.244][info][talledLocalContainer] org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
                      [08:46:16.244][info][talledLocalContainer]
                      [08:46:16.244][info][talledLocalContainer] *** DEPLOYMENTS IN ERROR: Name -> Error
                      [08:46:16.244][info][talledLocalContainer]
                      [08:46:16.244][info][talledLocalContainer] vfsfile:/C:/Users/norsa01/workspace/Chorus.1231/Chorus.1231/chorus-main/server/chorus-server-run/target/cargo/configurations/jboss51x/deploy/chorus.1-vdb.xml -> org.jboss.deployers.spi.DeploymentException: Error during deploy: vfsfile:/C:/Users/norsa01/workspace/Chorus.1231/Chorus.1231/chorus-main/server/chorus-server-run/target/cargo/configurations/jboss51x/deploy/chorus.1-vdb.xml
                      [08:46:16.244][info][talledLocalContainer]

                       

                       

                      • 8. Re: Chain of delegating translators
                        shawkins

                        I think the issue may lie in your code.  Check your override for the setDelegate method - what object is having supportsFullOuterJoins called and are you still calling super.setDelegate?  Also with 7.7.1 and later changes that removed final from supports methods, you're setDelegate override may not be needed.

                         

                        Steve

                        • 9. Re: Chain of delegating translators
                          nsabina

                          Everything is working now, thank you for the clue Steve!