context: function Init(){    // Initialize the Flash panel.    dump('Init!\n');    var tree = document.getElementById('tree');    // Install all the datasources named in the Flash Registry into    // the tree control. Datasources are listed as members of the    // NC:FlashDataSources sequence, and are loaded in the order that    // they appear in that sequence.    var registry;    try {        // First try to construct a new one and load it        // synchronously. nsIRDFService::GetDataSource() loads RDF/XML        // asynchronously by default.        registry = Components.classes['component://netscape/rdf/datasource?name=xml-datasource'].createInstance();        registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource);        var remote = registry.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);        remote.Init(flashdb); // this will throw if it's already been opened and registered.        // read it in synchronously.        remote.Refresh(true);    }    catch (ex) {        // if we get here, then the RDF/XML has been opened and read        // once. We just need to grab the datasource.        registry = RDF.GetDataSource(flashdb);    }    // Create a 'container' wrapper around the NC:FlashDataSources    // resource so we can use some utility routines that make access a    // bit easier.    var flashdatasources = Components.classes['component://netscape/rdf/container'].createInstance();    flashdatasources = flashdatasources.QueryInterface(Components.interfaces.nsIRDFContainer);    flashdatasources.Init(registry, RDF.GetResource('NC:FlashDataSources'));    // Now enumerate all of the flash datasources.    var enumerator = flashdatasources.GetElements();    while (enumerator.HasMoreElements()) {        var service = enumerator.GetNext();        service = service.QueryInterface(Components.interfaces.nsIRDFResource);        dump('adding "' + service.Value + '" to the tree\n');        try {            // create a new RDF/XML datasource. This will,            // unfortunately, force it to be read synchronously the            // first time around.            var flashservice = RDF.GetDataSource(service.Value);            flashservice = flashservice.QueryInterface(Components.interfaces.nsIRDFDataSource);            // Add it to the tree control's composite datasource.            tree.database.AddDataSource(flashservice);            var pollInterval =                registry.GetTarget(service,                                   RDF.GetResource('http://home.netscape.com/NC-rdf#poll-interval'),                                   true);            dump('poll interval = "' + pollInterval + '"\n');            if (pollInterval)                pollInterval = pollInterval.QueryInterface(Components.interfaces.nsIRDFLiteral);            if (pollInterval)                pollInterval = pollInterval.Value;            if (pollInterval) {                dump(service.Value + ': setting poll interval to ' + pollInterval + 'sec.\n');                Schedule(service.Value, pollInterval);            }        }        catch (ex) {            dump('an exception occurred trying to load "' + service.Value + '":\n');            dump(ex + '\n');        }    }    // Install all of the stylesheets in the Flash Registry into the    // panel.    // TODO    // XXX hack to force the tree to rebuild    var treebody = document.getElementById('NC:FlashRoot');    treebody.setAttribute('id', 'NC:FlashRoot');}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/a6e51f0941705e90484e1d43890e866dea63954d/flash.js/clean/rdf/resources/flash.js