Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    datasource loading and inheritsFrom

    We are using 3.0 and I have a question about Datasource.load.

    If I specify a Datasource in XML that inherits from another datasource, should it not automatically resolve the parent datasource during the load? The only way I could get it to work was to specify the datasource and parent together in the Datasource.load() method. For example:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <DataSource ID="adatasource"
                serverConstructor="com.mypkg.ADataSource"
                inheritsFrom="parentDS" useParentFieldOrder="true">
    </DataSource>
    where "parentDS" is another XML file with a basic datasource definition (i.e. a couple of fields).

    I would get an error everytime I use "Datasource.load()" saying that it did not load the
    parent DS (14:28:26.414:XRP2:WARN:DataSource:adatasource:DataSource adatasource inheritsFrom parentDS, but there is no DataSource of that name currently loaded. Ignoring the inheritsFrom declaration).


    The only way I could get it to load was with passing in all DS in a call to Datasource.load, example:
    Code:
       String[]  allDS = new String[] {"adatasource", "parentDS"};  
       DataSource.load(allDS, new Function()
                    {
                        @Override
                        public void execute()
                        {
    .....
                        }
                    }, false);
    It now means that with every XML datasource I have, I need to know the inheritance to make sure its loaded correctly, is there a reason why it couldn't determine it?
    Last edited by tankdom; 5 Mar 2012, 11:29.

    #2
    We've added a convenience API DataSource.loadWithParents() in the latest to make this easier - you'll need a 3.1d build to try it out.

    Comment


      #3
      Great! thanks for the quick response!

      Comment

      Working...
      X