diff --git a/rdf/base/public/nsIRDFCursor.h b/rdf/base/public/nsIRDFCursor.h index 6f96363a4dcf..8dfbff1ea82a 100644 --- a/rdf/base/public/nsIRDFCursor.h +++ b/rdf/base/public/nsIRDFCursor.h @@ -27,153 +27,6 @@ #ifndef nsIRDFCursor_h__ #define nsIRDFCursor_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nsISupports.h" -#include "prtypes.h" -#include "rdf.h" // for error codes -class nsIRDFDataSource; -class nsIRDFNode; -class nsIRDFResource; - -// 1c2abdb0-4cef-11d2-bc16-00805f912fe7 -#define NS_IRDFCURSOR_IID \ -{ 0x1c2abdb0, 0x4cef, 0x11d2, { 0xbc, 0x16, 0x00, 0x80, 0x5f, 0x91, 0x2f, 0xe7 } } - -/** - * An abstract base interface that is the basis for all RDF cursors. - */ -class nsIRDFCursor : public nsISupports { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFCURSOR_IID; return iid; } - - /** - * Advance the cursor to the next element. - * @return NS_ERROR_RDF_CURSOR_EMPTY if the cursor has reached the end - * and there are no more elements to enumerate; otherwise, NS_OK - * unless a catastrophic error occurs. - */ - NS_IMETHOD Advance(void) = 0; - /* Retrieve the data source from which the current item was obtained. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetDataSource(nsIRDFDataSource** aDataSource) = 0; - /** - * Irrespective of the query, a cursor is an interator over a set. - * This allows you to obtain the current value. - */ - NS_IMETHOD GetValue(nsIRDFNode** aValue) = 0; - -}; - - -// {1ED57100-9904-11d2-8EBA-00805F29F370} -#define NS_IRDFASSERTIONCURSOR_IID \ -{ 0x1ed57100, 0x9904, 0x11d2, { 0x8e, 0xba, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -/** - * A cursor that enumerates assertions - * @seealso nsIRDFDataSource::GetTargetS(), nsIRDFDataSource::GetSources() - */ -class nsIRDFAssertionCursor : public nsIRDFCursor { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFASSERTIONCURSOR_IID; return iid; } - - /** - * Retrieve the assertion's subject resource. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetSubject(nsIRDFResource** aSubject) = 0; - - /** - * Retrieve the assertion's predicate resource. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate) = 0; - - /** - * Retrieve the assertion's object node. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetObject(nsIRDFNode** aObject) = 0; - - /** - * Retrieve the assertion's truth value. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetTruthValue(PRBool* aTruthValue) = 0; -}; - - -// {1ED57101-9904-11d2-8EBA-00805F29F370} -#define NS_IRDFARCSOUTCURSOR_IID \ -{ 0x1ed57101, 0x9904, 0x11d2, { 0x8e, 0xba, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -/** - * A cursor that enumerates the outbound arcs from a resource node. - * @seealso nsIRDFDataSource::ArcsOut() - */ -class nsIRDFArcsOutCursor : public nsIRDFCursor { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFARCSOUTCURSOR_IID; return iid; } - - - /** - * Retrieve the "subject" node from which the arcs originate. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetSubject(nsIRDFResource** aSubject) = 0; - - /** - * Retrieve the predicate label of the arc. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate) = 0; - -}; - - -// {1ED57102-9904-11d2-8EBA-00805F29F370} -#define NS_IRDFARCSINCURSOR_IID \ -{ 0x1ed57102, 0x9904, 0x11d2, { 0x8e, 0xba, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -/** - * A cursor that enumerates the inbound arcs to a node. - * @seealso nsIRDFDataSource::ArcsIn() - */ -class nsIRDFArcsInCursor : public nsIRDFCursor { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFARCSINCURSOR_IID; return iid; } - - /** - * Retrieve the "object" node in which the arc terminates. - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetObject(nsIRDFNode** aObject) = 0; - - /** - * Retrieve the predicate label of the arc - * @return NS_OK, unless a catastrophic error occurs. - */ - NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate) = 0; - -}; - -// {C2850C10-B0CF-11d2-A684-00104BDE6048} -#define NS_IRDFRESOURCECURSOR_IID \ -{ 0xc2850c10, 0xb0cf, 0x11d2, { 0xa6, 0x84, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } } - -/** - * A cursor that enumerates all of the resources in a data source. - */ -class nsIRDFResourceCursor : public nsIRDFCursor { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFRESOURCECURSOR_IID; return iid; } - NS_IMETHOD GetResource(nsIRDFResource** aResource) = 0; -}; - -#endif #endif /* nsIRDFCursor_h__ */ diff --git a/rdf/base/public/nsIRDFDataSource.h b/rdf/base/public/nsIRDFDataSource.h index 12deaa4ede42..60e5bcbe2ddd 100644 --- a/rdf/base/public/nsIRDFDataSource.h +++ b/rdf/base/public/nsIRDFDataSource.h @@ -26,196 +26,6 @@ #ifndef nsIRDFDataSource_h__ #define nsIRDFDataSource_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nsISupports.h" -#include "nsISupportsArray.h" -#include "nsIEnumerator.h" - -// {0F78DA58-8321-11d2-8EAC-00805F29F370} -#define NS_IRDFDATASOURCE_IID \ -{ 0xf78da58, 0x8321, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -class nsIRDFAssertionCursor; -class nsIRDFArcsInCursor; -class nsIRDFArcsOutCursor; -class nsIRDFDataBase; -class nsIRDFNode; -class nsIRDFObserver; -class nsIRDFResource; -class nsIRDFResourceCursor; - -/** - * An RDF data source. - */ - -class nsIRDFDataSource : public nsISupports { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFDATASOURCE_IID; return iid; } - - // XXX I didn't make some of these methods "const" because it's - // probably pretty likely that many data sources will just make - // stuff up at runtime to answer queries. - - /** - * Specify the URI for the data source: this is the prefix - * that will be used to register the data source in the - * data source registry. - */ - NS_IMETHOD Init(const char* uri) = 0; - - /** - * Retrieve the URI of the data source. - */ - NS_IMETHOD GetURI(const char* *uri) const = 0; - - /** - * Find an RDF resource that points to a given node over the - * specified arc & truth value - * - * @return NS_ERROR_FAILURE if there is no source that leads - * to the target with the specified property. - */ - NS_IMETHOD GetSource(nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - nsIRDFResource** source /* out */) = 0; - - /** - * Find all RDF resources that point to a given node over the - * specified arc & truth value - * - * @return NS_OK unless a catastrophic error occurs. If the - * method returns NS_OK, you may assume that nsIRDFCursor points - * to a valid (but possibly empty) cursor. - */ - NS_IMETHOD GetSources(nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - nsIRDFAssertionCursor** sources /* out */) = 0; - - /** - * Find a child of that is related to the source by the given arc - * arc and truth value - * - * @return NS_ERROR_FAILURE if there is no target accessable from the - * source via the specified property. - */ - NS_IMETHOD GetTarget(nsIRDFResource* source, - nsIRDFResource* property, - PRBool tv, - nsIRDFNode** target /* out */) = 0; - - /** - * Find all children of that are related to the source by the given arc - * arc and truth value. - * - * @return NS_OK unless a catastrophic error occurs. If the - * method returns NS_OK, you may assume that nsIRDFCursor points - * to a valid (but possibly empty) cursor. - */ - NS_IMETHOD GetTargets(nsIRDFResource* source, - nsIRDFResource* property, - PRBool tv, - nsIRDFAssertionCursor** targets /* out */) = 0; - - /** - * Add an assertion to the graph. - */ - NS_IMETHOD Assert(nsIRDFResource* source, - nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv) = 0; - - /** - * Remove an assertion from the graph. - */ - NS_IMETHOD Unassert(nsIRDFResource* source, - nsIRDFResource* property, - nsIRDFNode* target) = 0; - - /** - * Query whether an assertion exists in this graph. - * - * @return NS_OK unless a catastrophic error occurs. - */ - NS_IMETHOD HasAssertion(nsIRDFResource* source, - nsIRDFResource* property, - nsIRDFNode* target, - PRBool tv, - PRBool* hasAssertion /* out */) = 0; - - /** - * Add an observer to this data source. - */ - NS_IMETHOD AddObserver(nsIRDFObserver* n) = 0; - - /** - * Remove an observer from this data source - */ - NS_IMETHOD RemoveObserver(nsIRDFObserver* n) = 0; - - // XXX individual resource observers? - - /** - * Get a cursor to iterate over all the arcs that point into a node. - * - * @return NS_OK unless a catastrophic error occurs. If the method - * returns NS_OK, you may assume that labels points to a valid (but - * possible empty) nsIRDFCursor object. - */ - NS_IMETHOD ArcLabelsIn(nsIRDFNode* node, - nsIRDFArcsInCursor** labels /* out */) = 0; - - /** - * Get a cursor to iterate over all the arcs that originate in - * a resource. - * - * @return NS_OK unless a catastrophic error occurs. If the method - * returns NS_OK, you may assume that labels points to a valid (but - * possible empty) nsIRDFCursor object. - */ - NS_IMETHOD ArcLabelsOut(nsIRDFResource* source, - nsIRDFArcsOutCursor** labels /* out */) = 0; - - /** - * Retrieve all of the resources that the data source currently - * refers to. - */ - NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) = 0; - - /** - * Request that a data source write it's contents out to - * permanent storage if applicable. - */ - NS_IMETHOD Flush(void) = 0; - - /** - * Returns the set of all commands defined for a given source. - */ - NS_IMETHOD GetAllCommands(nsIRDFResource* source, - nsIEnumerator/**/** commands) = 0; - - /** - * Returns whether a given command is enabled for a set of sources. - * - * @return NS_OK if command is enabled for all sources - * @return NS_COMFALSE if command is not enabled for some source - */ - NS_IMETHOD IsCommandEnabled(nsISupportsArray/**/* aSources, - nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) = 0; - - /** - * Perform the specified command on set of sources. - */ - NS_IMETHOD DoCommand(nsISupportsArray/**/* aSources, - nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) = 0; -}; - -#endif #endif /* nsIRDFDataSource_h__ */ diff --git a/rdf/base/public/nsIRDFNode.h b/rdf/base/public/nsIRDFNode.h index b076bbf52677..99e64728fd7a 100644 --- a/rdf/base/public/nsIRDFNode.h +++ b/rdf/base/public/nsIRDFNode.h @@ -26,110 +26,6 @@ #ifndef nsIRDFNode_h__ #define nsIRDFNode_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nscore.h" -#include "rdf.h" -#include "nsISupports.h" -#include "prtime.h" -// {0F78DA50-8321-11d2-8EAC-00805F29F370} -#define NS_IRDFNODE_IID \ -{ 0xf78da50, 0x8321, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -/** - * - * Nodes are created using an instance of nsIRDFService, which - * should be obtained from the service manager: - * - * nsIRDFService* service; - * if (NS_SUCCEEDED(nsServiceManager::GetService(kCRDFServiceCID, - * kIRDFServiceIID, - * (nsISupports**) &service))) { - * nsIRDFNode* node; - * if (NS_SUCCEEDED(service->GetResource("http://foo.bar/", node))) { - * // do something useful here... - * NS_IF_RELEASE(node); - * } - * nsServiceManager::ReleaseService(kCRDFServiceCID, mgr); - * } - * - */ - -class NS_RDF nsIRDFNode : public nsISupports { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFNODE_IID; return iid; } - - /** - * Determine if two nodes are identical - */ - NS_IMETHOD EqualsNode(nsIRDFNode* that, PRBool* result) const = 0; -}; - - -// {E0C493D2-9542-11d2-8EB8-00805F29F370} -#define NS_IRDFLITERAL_IID \ -{ 0xe0c493d2, 0x9542, 0x11d2, { 0x8e, 0xb8, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -class NS_RDF nsIRDFLiteral : public nsIRDFNode { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFLITERAL_IID; return iid; } - - /** - * Get the Unicode string value of the node. - */ - NS_IMETHOD GetValue(const PRUnichar* *value) const = 0; - - /** - * Determine if two resources are identical. - */ - NS_IMETHOD EqualsLiteral(const nsIRDFLiteral* literal, PRBool* result) const = 0; -}; - -// {E13A24E1-C77A-11d2-80BE-006097B76B8E} -#define NS_IRDFDATE_IID \ -{ 0xe13a24e1, 0xc77a, 0x11d2, { 0x80, 0xbe, 0x0, 0x60, 0x97, 0xb7, 0x6b, 0x8e } }; - - -class nsIRDFDate : public nsIRDFNode { -public: - static const nsIID& IID() { static nsIID iid = NS_IRDFDATE_IID; return iid; } - - /** - * Get the PRTime value of the node. - */ - NS_IMETHOD GetValue(PRTime *value) const = 0; - - /** - * Determine if two ints are identical. - */ - NS_IMETHOD EqualsDate(const nsIRDFDate* literal, PRBool* result) const = 0; -}; - -// {E13A24E3-C77A-11d2-80BE-006097B76B8E} -#define NS_IRDFINT_IID \ -{ 0xe13a24e3, 0xc77a, 0x11d2, { 0x80, 0xbe, 0x0, 0x60, 0x97, 0xb7, 0x6b, 0x8e } }; - -class nsIRDFInt : public nsIRDFNode { -public: - static const nsIID& IID() { static nsIID iid = NS_IRDFINT_IID; return iid; } - - /** - * Get the int32 value of the node. - */ - NS_IMETHOD GetValue(int32 *value) const = 0; - - /** - * Determine if two ints are identical. - */ - NS_IMETHOD EqualsInt(const nsIRDFInt* literal, PRBool* result) const = 0; -}; - - -// XXX this is here because a lot of files think they can just include nsIRDFNode -#include "nsIRDFResource.h" - -#endif #endif // nsIRDFNode_h__ diff --git a/rdf/base/public/nsIRDFObserver.h b/rdf/base/public/nsIRDFObserver.h index cf88b62324fe..12817b0fd8f3 100644 --- a/rdf/base/public/nsIRDFObserver.h +++ b/rdf/base/public/nsIRDFObserver.h @@ -26,44 +26,6 @@ #ifndef nsIRDFObserver_h__ #define nsIRDFObserver_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nsISupports.h" - -class nsIRDFDataSource; -class nsIRDFResource; -class nsIRDFNode; - -/** - * An observer on an nsIRDFDataSource. - */ - -// 3cc75360-484a-11d2-bc16-00805f912fe7 -#define NS_IRDFOBSERVER_IID \ -{ 0x3cc75360, 0x484a, 0x11d2, { 0xbc, 0x16, 0x00, 0x80, 0x5f, 0x91, 0x2f, 0xe7 } } - -class nsIRDFObserver : public nsISupports -{ -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFOBSERVER_IID; return iid; } - - /** - * Called whenever a new assertion is made in the data source. - */ - NS_IMETHOD OnAssert(nsIRDFResource* subject, - nsIRDFResource* predicate, - nsIRDFNode* object) = 0; - - /** - * Called whenever an assertion is removed from the data source. - */ - NS_IMETHOD OnUnassert(nsIRDFResource* subject, - nsIRDFResource* predicate, - nsIRDFNode* object) = 0; -}; - -#endif #endif /* nsIRDFObserver_h__ */ diff --git a/rdf/base/public/nsIRDFResource.h b/rdf/base/public/nsIRDFResource.h index c6ac2ad00a5a..7f9128adeb6c 100644 --- a/rdf/base/public/nsIRDFResource.h +++ b/rdf/base/public/nsIRDFResource.h @@ -20,59 +20,7 @@ #ifndef nsIRDFResource_h__ #define nsIRDFResource_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nsIRDFNode.h" -#include "prtypes.h" - -struct JSContext; -struct JSObject; - -/** - * A resource node, which has unique object identity. - */ - -// {E0C493D1-9542-11d2-8EB8-00805F29F370} -#define NS_IRDFRESOURCE_IID \ -{ 0xe0c493d1, 0x9542, 0x11d2, { 0x8e, 0xb8, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - -class NS_RDF nsIRDFResource : public nsIRDFNode { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFRESOURCE_IID; return iid; } - - /** - * Called by nsIRDFService after constructing a resource object to - * initialize it's URI. - */ - NS_IMETHOD Init(const char* uri) = 0; - - /** - * Get the 8-bit string value of the node. - */ - NS_IMETHOD GetValue(const char* *uri) const = 0; - - /** - * Determine if two resources are identical. - */ - NS_IMETHOD EqualsResource(const nsIRDFResource* resource, PRBool* result) const = 0; - - /** - * Determine if two resources are identical. - */ - NS_IMETHOD EqualsString(const char* uri, PRBool* result) const = 0; - - - // XXX This is a kludge that's here until we get XPIDL scriptability working. - static JSObject* - GetJSObject(JSContext* aContext, nsIRDFResource* aPrivate) { - NS_NOTREACHED("sorry, you script RDF resources yet"); - return nsnull; - } -}; - -#endif #endif // nsIRDFResource_h__ diff --git a/rdf/base/public/nsIRDFService.h b/rdf/base/public/nsIRDFService.h index 3d92acd9db65..410ed66827aa 100644 --- a/rdf/base/public/nsIRDFService.h +++ b/rdf/base/public/nsIRDFService.h @@ -21,177 +21,12 @@ The RDF service interface. This is a singleton object, and should be obtained from the nsServiceManager. - XXX I'm not particularly happy with the current APIs for named data - sources. The idea is that you want "rdf:bookmarks" to always map to - the "bookmarks" data store. The thing that bothers me now is that - the implementation has to pre-load all of the data sources: that - means you need to parse the bookmarks file, read the history, etc., - rather than doing this on-demand. With a little thought, it may be - able to enormously improve these APIs so that pre-loading data - sources is unnecessary. - */ #ifndef nsIRDFService_h__ #define nsIRDFService_h__ -#if 1 //defined(USE_XPIDL_INTERFACES) #include "nsRDFInterfaces.h" -#else - -#include "nscore.h" -#include "nsISupports.h" -#include "prtime.h" -class nsIRDFDataBase; -class nsIRDFDataSource; -class nsIRDFLiteral; -class nsIRDFResource; -class nsIRDFResourceFactory; -class nsIRDFDate; -class nsIRDFInt; - -// {BFD05261-834C-11d2-8EAC-00805F29F370} -#define NS_IRDFSERVICE_IID \ -{ 0xbfd05261, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } - - -class nsIRDFService : public nsISupports { -public: - static const nsIID& GetIID() { static nsIID iid = NS_IRDFSERVICE_IID; return iid; } - - // Resource management routines - - /** - * Construct an RDF resource from a single-byte URI. nsIRDFSerivce - * caches resources that are in-use, so multiple calls to GetResource() - * for the same uri will return identical pointers. FindResource - * is used to find out whether there already exists a resource corresponding to that url. - */ - NS_IMETHOD GetResource(const char* uri, nsIRDFResource** resource) = 0; - NS_IMETHOD FindResource(const char* uri, nsIRDFResource** resource, PRBool* found) = 0; - - /** - * Construct an RDF resource from a Unicode URI. This is provided - * as a convenience method, allowing automatic, in-line C++ - * conversion from nsString objects. The uri will - * be converted to a single-byte representation internally. - */ - NS_IMETHOD GetUnicodeResource(const PRUnichar* uri, nsIRDFResource** resource) = 0; - - /** - * Construct an RDF literal from a Unicode string. - */ - NS_IMETHOD GetLiteral(const PRUnichar* value, nsIRDFLiteral** literal) = 0; - - /** - - * Construct an RDF literal from a PRTime. - */ - NS_IMETHOD GetDateLiteral(const PRTime value, nsIRDFDate** date) = 0; - - /** - * Construct an RDF literal from an int. - */ - NS_IMETHOD GetIntLiteral(const int32 value, nsIRDFInt** intLiteral) = 0; - - /** - - * Registers a resource with the RDF system, making it unique w.r.t. - * GetResource. - * - * An implementation of nsIRDFResource should call this in its - * Init() method if it wishes the resource to be globally unique - * (which is usually the case). - * - * NOTE that the resource will not be ref-counted by the - * RDF service: the assumption is that the resource implementation - * will call nsIRDFService::UnregisterResource() when the last - * reference to the resource is released. - * - * NOTE that the nsIRDFService implementation may choose to - * maintain a reference to the resource's URI; therefore, the - * resource implementation should ensure that the resource's URI - * (accessable via nsIRDFResource::GetValue(const char* *aURI)) is - * valid before calling RegisterResource(). Furthermore, the - * resource implementation should ensure that this pointer - * remains valid for the lifetime of the resource. (The - * implementation of the resource cache in nsIRDFService uses the - * URI maintained "internally" in the resource as a key into the - * cache rather than copying the resource URI itself.) - */ - NS_IMETHOD RegisterResource(nsIRDFResource* aResource, PRBool replace = PR_FALSE) = 0; - - /** - - * Called to notify the resource manager that a resource is no - * longer in use. This method should only be called from the - * destructor of a "custom" resource implementation to notify the - * RDF service that the last reference to the resource has been - * released, so the resource is no longer valid. - * - * NOTE. As mentioned in nsIRDFResourceFactory::CreateResource(), - * the RDF service will use the result of - * nsIRDFResource::GetValue() as a key into its cache. For this - * reason, you must always un-cache the resource before - * releasing the storage for the const char* URI. - */ - NS_IMETHOD UnregisterResource(nsIRDFResource* aResource) = 0; - - // Data source management routines - - /** - * Register a named data source. The RDF service will call - * nsIRDFDataSource::GetURI() to determine the URI under - * which to register the data source. - * - * Note that the data source will not be refcounted by the - * RDF service! The assumption is that an RDF data source - * registers with the service once it is initialized (via - * nsIRDFDataSource::Init()), and unregisters when the - * last reference to the data source is released. - */ - NS_IMETHOD RegisterDataSource(nsIRDFDataSource* dataSource, - PRBool replace = PR_FALSE) = 0; - - /** - * Unregister a named data source. The RDF service will call - * nsIRDFDataSource::GetURI() to determine the URI under which the - * data source was registered. - */ - NS_IMETHOD UnregisterDataSource(nsIRDFDataSource* dataSource) = 0; - - /** - * Get the named data source corresponding to the URI. If a data - * source has been registered via RegisterDataSource(), that - * data source will be returned. - * - * If no data source is currently - * registered for the specified URI, and a data source constructor - * function has been registered via RegisterDatasourceConstructor(), - * the RDF service will call the constructor to attempt to construct a - * new data source. If construction is successful, the data source will - * be initialized via nsIRDFDataSource::Init(). - */ - NS_IMETHOD GetDataSource(const char* uri, nsIRDFDataSource** dataSource) = 0; - - /** - * Create a database that contains the specified named data - * sources. This is a convenience method whose functionality is - * equivalent to (1) constructing a new nsIRDFDataBase object from - * the repository, and (2) iteratively adding the named data sources - * to it, in order. - */ - NS_IMETHOD CreateDatabase(const char** uris, nsIRDFDataBase** dataBase) = 0; - - /** - * Get the database aggregating all the stuff that Navigator sees as a default, - * including a "local" store. - */ - NS_IMETHOD CreateBrowserDatabase(nsIRDFDataBase** dataBase) = 0; - -}; - -#endif extern nsresult NS_NewRDFService(nsIRDFService** result);