diff --git a/rdf/include/nsIRDFDataBase.h b/rdf/include/nsIRDFDataBase.h index 9bea1043574b..ef0902e14e42 100644 --- a/rdf/include/nsIRDFDataBase.h +++ b/rdf/include/nsIRDFDataBase.h @@ -19,16 +19,6 @@ #ifndef nsIRDFDataBase_h__ #define nsIRDFDataBase_h__ -/* - - RDF databases aggregate RDF data sources (see nsIRDFDataSource.h) - - XXX This needs to be thought about real hard. It seems really wrong - to me to have to hard code the data sources that a database knows - about. - -*/ - #include "nsISupports.h" #include "nsIRDFDataSource.h" @@ -38,12 +28,21 @@ class nsIRDFDataSource; #define NS_IRDFDATABASE_IID \ { 0x96343820, 0x307c, 0x11d2, { 0xb, 0x15, 0x00, 0x80, 0x5f, 0x91, 0x2f, 0xe7 } } +/** + * An nsIRDFDataBase composes individual data sources, providing + * the illusion of a single, coherent RDF graph. + */ class nsIRDFDataBase : public nsIRDFDataSource { public: - // XXX This is really a hack. I wish that the database was just a - // plain old data source that was smart import the data sources - // that it needed. + /** + * Add a datasource the the database. + */ NS_IMETHOD AddDataSource(nsIRDFDataSource* source) = 0; + + /** + * Remove a datasource from the database + */ + NS_IMETHOD RemoveDataSource(nsIRDFDataSource* source) = 0; }; diff --git a/rdf/src/nsSimpleDataBase.cpp b/rdf/src/nsSimpleDataBase.cpp index 90b186f380bf..90eb035df3cb 100644 --- a/rdf/src/nsSimpleDataBase.cpp +++ b/rdf/src/nsSimpleDataBase.cpp @@ -636,3 +636,15 @@ nsSimpleDataBase::AddDataSource(nsIRDFDataSource* source) +NS_IMETHODIMP +nsSimpleDataBase::RemoveDataSource(nsIRDFDataSource* source) +{ + if (! source) + return NS_ERROR_NULL_POINTER; + + if (mDataSources.IndexOf(source) >= 0) { + mDataSources.RemoveElement(source); + NS_RELEASE(source); + } + return NS_OK; +} diff --git a/rdf/src/nsSimpleDataBase.h b/rdf/src/nsSimpleDataBase.h index 626121c86d10..dfb680b44fd1 100644 --- a/rdf/src/nsSimpleDataBase.h +++ b/rdf/src/nsSimpleDataBase.h @@ -85,6 +85,7 @@ public: // nsIRDFDataBase interface NS_IMETHOD AddDataSource(nsIRDFDataSource* source); + NS_IMETHOD RemoveDataSource(nsIRDFDataSource* source); };