Re: what should return unwritable Javascript RDF Datasources for composite-datasources ?

Axel Hecht <[email protected]> Fri, 13 May 2005 12:04:50 +0200
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
vaab wrote:
> I have done a new Datasource that implements the common interface of 
> datasource (GetTarget, Assert, ...). All the function are implemented.
> 
> I use this datasource without problems in composite datasources with 
> other built-in datasource.
> 
> I wanted to do a second datasource in javascript, but this one is not 
> writable (as some built-in datasources). But when Assert in a composite 
> datasource, my datasource comes first and I don't know what to return 
> (exception ? error code ?) to reject properly the assertion and let the 
> composite datasource try with other datasource contained...
> 
> I'm afraid I'm not so clear... Hopin somebody will understand.
> Vaab
> 
> PS: I've tryed with throwing arbitrary exception, but this do not work, 
> I've outputed the return value of built-in datasources, and they return 
> "null" whether they have or have not accepted the assertion.
> 
> PS2: I've found references of casting NS_RDF_ASSERTION_REJECTED. There 
> are no Components.results.NS_RDF_ASSERTION_REJECTED and I've found that 
> it should be :
> 
> --- Found in LDAP module for firefox
> const NS_ERROR_RDF_BASE = 0x804f0000; // XXX is this right?
> const NS_RDF_ASSERTION_REJECTED = NS_ERROR_RDF_BASE + 3;
> ---
> 
> But casting this with a 'throw', or return it doesn't work as expected.
> 
> --- Quote from "Modifying RDF Datasource"
> Datasources may not accept the change. For instance, when a datasource 
> is not writeable or you attempt to add invalid data, the datasource will 
> reject the change. In native code, you can detect this as the datasource 
> will return an NS_RDF_ASSERTION_REJECTED status code. This status code 
> in not an error however.
> ---
> 
> Any hints ?


     Components.returnCode = NS_RDF_ASSERTION_REJECTED;
     return null;

The value of that const looks good to me

Axel