What are the possible ways to change the binding of a resource to point to another resource in TIBCO Data Virtualization?

What are the possible ways to change the binding of a resource to point to another resource in TIBCO Data Virtualization?

book

Article ID: KB0073663

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization 8.2, 8.3

Description

Here is a brief description of the API "rebindResources":

Change the bindings of used resources within one or more resources. Within each resource specified in entries, the rebindRule is applied. Each rule changes usage of one resource to another as specified by the rule.

Location:
/services/webservices/system/admin/resource/operations/

Request Elements:
entries: List of source path-type pairs indicating where to apply rebinding:
  • entry
  • path: The path to the resource.
  • type: Resource type: TABLE, PROCEDURE, LINK, DEFINITION_SET, DATA_SOURCE, or TRIGGER.
  • rebindRules: List of rebindings to be performed on each resource identified in entries.• rebindRule (optional): A single rebinding:
  • oldPath: The path to the resource that used to be used.
  • oldType: The type of the resource that used to be used. See above.
  • newPath: The path to the resource that is now to be used.
  • newType: The type of the resource that is now to be used.

Issue/Introduction

This article will give a brief summary of the possible ways to change the binding of a resource using the "rebindResources" API in TIBCO Data Virtualization

Environment

Windows

Resolution

Refer to the example given below on how the contents can be entered for the rebindResources API:
<resource:rebindResources xmlns:resource="http://www.compositesw.com/services/system/admin/resource">
   (1st block)
  <resource:entries>
    <resource:entry>
      <resource:path>/shared/SQL_table/view1</resource:path>
      <resource:type>TABLE</resource:type>
    </resource:entry>
  </resource:entries>
  <resource:rebindRules>
    <resource:rebindRule>
      <resource:oldPath>/shared/SQL_table/view2</resource:oldPath>
      <resource:oldType>TABLE</resource:oldType>
      <resource:newPath>/shared/SQL_table/view3</resource:newPath>
      <resource:newType>TABLE</resource:newType>
    </resource:rebindRule>
  </resource:rebindRules>
</resource:rebindResources>

In the same way, this API can be used to change the bindings for a number of resources at a time by adding the details in the XML editor in the form of blocks.

An example for reference:
----------------------------------
<resource:rebindResources xmlns:resource="http://www.compositesw.com/services/system/admin/resource">
   (1st block)
  <resource:entries>
    <resource:entry>
      <resource:path>/shared/SQL_table/view1</resource:path>
      <resource:type>TABLE</resource:type>
    </resource:entry>
  </resource:entries>
  <resource:rebindRules>
    <resource:rebindRule>
      <resource:oldPath>/shared/SQL_table/view2</resource:oldPath>
      <resource:oldType>TABLE</resource:oldType>
      <resource:newPath>/shared/SQL_table/view3</resource:newPath>
      <resource:newType>TABLE</resource:newType>
    </resource:rebindRule>
  </resource:rebindRules>
  
  (2nd block)
  <resource:entries>
    <resource:entry>
      <resource:path>/shared/SQL_table/stuView</resource:path>
      <resource:type>TABLE</resource:type>
    </resource:entry>
  </resource:entries>
  <resource:rebindRules>
    <resource:rebindRule>
      <resource:oldPath>/shared/SQL_table/test/school</resource:oldPath>
      <resource:oldType>TABLE</resource:oldType>
      <resource:newPath>/shared/SQL_table/test/student</resource:newPath>
      <resource:newType>TABLE</resource:newType>
    </resource:rebindRule>
  </resource:rebindRules>
  
 (3rd block and so on)
  ...
  ...
  
</resource:rebindResources>
----------------------------------
However, if the requirement of the "rebindReosurces" API is for a large number of resources then it would become a tough task to do it manually.
For this, a custom script would have to be written to call the "rebindResources" API recursively.