Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
RDFXMLDataSourceImpl Class Reference
Inheritance diagram for RDFXMLDataSourceImpl:
Inheritance graph
[legend]
Collaboration diagram for RDFXMLDataSourceImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS NS_IMETHOD GetURI (char **uri)
NS_IMETHOD GetSource (nsIRDFResource *property, nsIRDFNode *target, PRBool tv, nsIRDFResource **source)
NS_IMETHOD GetSources (nsIRDFResource *property, nsIRDFNode *target, PRBool tv, nsISimpleEnumerator **sources)
NS_IMETHOD GetTarget (nsIRDFResource *source, nsIRDFResource *property, PRBool tv, nsIRDFNode **target)
NS_IMETHOD GetTargets (nsIRDFResource *source, nsIRDFResource *property, PRBool tv, nsISimpleEnumerator **targets)
NS_IMETHOD Assert (nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool tv)
NS_IMETHOD Unassert (nsIRDFResource *source, nsIRDFResource *property, nsIRDFNode *target)
NS_IMETHOD Change (nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aOldTarget, nsIRDFNode *aNewTarget)
NS_IMETHOD Move (nsIRDFResource *aOldSource, nsIRDFResource *aNewSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget)
NS_IMETHOD HasAssertion (nsIRDFResource *source, nsIRDFResource *property, nsIRDFNode *target, PRBool tv, PRBool *hasAssertion)
NS_IMETHOD AddObserver (nsIRDFObserver *aObserver)
NS_IMETHOD RemoveObserver (nsIRDFObserver *aObserver)
NS_IMETHOD HasArcIn (nsIRDFNode *aNode, nsIRDFResource *aArc, PRBool *_retval)
NS_IMETHOD HasArcOut (nsIRDFResource *aSource, nsIRDFResource *aArc, PRBool *_retval)
NS_IMETHOD ArcLabelsIn (nsIRDFNode *node, nsISimpleEnumerator **labels)
NS_IMETHOD ArcLabelsOut (nsIRDFResource *source, nsISimpleEnumerator **labels)
NS_IMETHOD GetAllResources (nsISimpleEnumerator **aResult)
NS_IMETHOD GetAllCmds (nsIRDFResource *source, nsISimpleEnumerator **commands)
NS_IMETHOD IsCommandEnabled (nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments, PRBool *aResult)
NS_IMETHOD DoCommand (nsISupportsArray *aSources, nsIRDFResource *aCommand, nsISupportsArray *aArguments)
NS_IMETHOD BeginUpdateBatch ()
NS_IMETHOD EndUpdateBatch ()
NS_DECL_NSIRDFREMOTEDATASOURCE
NS_DECL_NSIRDFXMLSINK
NS_DECL_NSIRDFXMLSOURCE
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
NS_IMETHOD 
VisitAllSubjects (rdfITripleVisitor *aVisitor)
NS_IMETHOD VisitAllTriples (rdfITripleVisitor *aVisitor)
PRBool MakeQName (nsIRDFResource *aResource, nsString &property, nsString &nameSpacePrefix, nsString &nameSpaceURI)
nsresult SerializeAssertion (nsIOutputStream *aStream, nsIRDFResource *aResource, nsIRDFResource *aProperty, nsIRDFNode *aValue)
nsresult SerializeProperty (nsIOutputStream *aStream, nsIRDFResource *aResource, nsIRDFResource *aProperty)
PRBool IsContainerProperty (nsIRDFResource *aProperty)
nsresult SerializeDescription (nsIOutputStream *aStream, nsIRDFResource *aResource)
nsresult SerializeMember (nsIOutputStream *aStream, nsIRDFResource *aContainer, nsIRDFNode *aMember)
nsresult SerializeContainer (nsIOutputStream *aStream, nsIRDFResource *aContainer)
nsresult SerializePrologue (nsIOutputStream *aStream)
nsresult SerializeEpilogue (nsIOutputStream *aStream)
PRBool IsA (nsIRDFDataSource *aDataSource, nsIRDFResource *aResource, nsIRDFResource *aType)
nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find an RDF resource that points to a given node over the specified arc & truth value.
nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find all RDF resources that point to a given node over the specified arc & truth value.
nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find a child of that is related to the source by the given arc arc and truth value.
nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find all children of that are related to the source by the given arc arc and truth value.
void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Add an assertion to the graph.
void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 Remove an assertion from the graph.
void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget)
 Change an assertion from.
void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 'Move' an assertion from
boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Query whether an assertion exists in this graph.
void AddObserver (in nsIRDFObserver aObserver)
 Add an observer to this data source.
void RemoveObserver (in nsIRDFObserver aObserver)
 Remove an observer from this data source.
nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode)
 Get a cursor to iterate over all the arcs that point into a node.
nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource)
 Get a cursor to iterate over all the arcs that originate in a resource.
nsISimpleEnumerator GetAllResources ()
 Retrieve all of the resources that the data source currently refers to.
boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Returns whether a given command is enabled for a set of sources.
void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Perform the specified command on set of sources.
nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource)
 Returns the set of all commands defined for a given source.
boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc)
 Returns true if the specified node is pointed to by the specified arc.
boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc)
 Returns true if the specified node has the specified outward arc.
void beginUpdateBatch ()
 Notify observers that the datasource is about to send several notifications at once.
void endUpdateBatch ()
 Notify observers that the datasource has completed issuing a notification group.
void Init (in string aURI)
 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.
void Refresh (in boolean aBlocking)
 Refresh the remote datasource, re-loading its contents from the URI.
void Flush ()
 Request that a data source write it's contents out to permanent storage, if applicable.
void FlushTo (in string aURI)
void beginLoad ()
 Initiate the RDF/XML load.
void interrupt ()
 Suspend the RDF/XML load.
void resume ()
 Resume the RDF/XML load.
void endLoad ()
 Complete the RDF/XML load.
void addNameSpace (in nsIAtomPtr aPrefix,[const ] in nsStringRef aURI)
 Add namespace information to the RDF/XML sink.
void addXMLSinkObserver (in nsIRDFXMLSinkObserver aObserver)
 Add an observer that will be notified as the RDF/XML load progresses.
void removeXMLSinkObserver (in nsIRDFXMLSinkObserver aObserver)
 Remove an observer from the sink's set of observers.
void Serialize (in nsIOutputStream aStream)
 Serialize the contents of the datasource to aStream.
void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount)
 Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.
void onStartRequest (in nsIRequest aRequest, in nsISupports aContext)
 Called to signify the beginning of an asynchronous request.
void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode)
 Called to signify the end of an asynchronous request.
void visitAllSubjects (in rdfITripleVisitor aVisitor)
 Visit all the subject resources in the datasource.
void visitAllTriples (in rdfITripleVisitor aVisitor)
 Visit all the triples in the datasource.

Public Attributes

readonly attribute string URI
 The "URI" of the data source.
readonly attribute boolean loaded
 This value is true when the datasource has fully loaded itself.
attribute boolean readOnly
 Set to true if the sink is read-only and cannot be modified.

Protected Types

enum  LoadState { eLoadState_Unloaded, eLoadState_Pending, eLoadState_Loading, eLoadState_Loaded }

Protected Member Functions

nsresult Init ()
 RDFXMLDataSourceImpl (void)
virtual ~RDFXMLDataSourceImpl (void)
nsresult rdfXMLFlush (nsIURI *aURI)
PRBool IsLoading ()
nsresult BlockingParse (nsIURI *aURL, nsIStreamListener *aConsumer)

Protected Attributes

nsIRDFDataSourcemInner
PRPackedBool mIsWritable
PRPackedBool mIsDirty
LoadState mLoadState
nsCOMArray< nsIRDFXMLSinkObservermObservers
nsCOMPtr< nsIURImURL
nsCOMPtr< nsIStreamListenermListener
nsNameSpaceMap mNameSpaces

Static Protected Attributes

static PRInt32 gRefCnt = 0
static nsIRDFServicegRDFService

Friends

nsresult NS_NewRDFXMLDataSource (nsIRDFDataSource **aResult)

Detailed Description

Definition at line 216 of file nsRDFXMLDataSource.cpp.


Member Enumeration Documentation

Enumerator:
eLoadState_Unloaded 
eLoadState_Pending 
eLoadState_Loading 
eLoadState_Loaded 

Definition at line 224 of file nsRDFXMLDataSource.cpp.


Constructor & Destructor Documentation

Definition at line 489 of file nsRDFXMLDataSource.cpp.

    : mInner(nsnull),
      mIsWritable(PR_TRUE),
      mIsDirty(PR_FALSE),
      mLoadState(eLoadState_Unloaded)
{
#ifdef PR_LOGGING
    if (! gLog)
        gLog = PR_NewLogModule("nsRDFXMLDataSource");
#endif
}

Definition at line 520 of file nsRDFXMLDataSource.cpp.

{
    nsresult rv;

    // Unregister first so that nobody else tries to get us.
    rv = gRDFService->UnregisterDataSource(this);

    // Now flush contents
    rv = Flush();

    // Release RDF/XML sink observers
    mObservers.Clear();

    NS_RELEASE(mInner);

    if (--gRefCnt == 0)
        NS_IF_RELEASE(gRDFService);
}

Here is the call graph for this function:


Member Function Documentation

void nsIRDFXMLSink::addNameSpace ( in nsIAtomPtr  aPrefix,
[const ] in nsStringRef  aURI 
) [inherited]

Add namespace information to the RDF/XML sink.

Parameters:
aPrefixthe namespace prefix
aURIthe namespace URI

Add an observer to this data source.

If the datasource supports observers, the datasource source should hold a strong reference to the observer.

Here is the caller graph for this function:

Definition at line 319 of file nsRDFXMLDataSource.cpp.

                                                      {
        return mInner->AddObserver(aObserver);
    }

Here is the call graph for this function:

Add an observer that will be notified as the RDF/XML load progresses.

Note that the sink will acquire a strong reference to the observer, so care should be taken to avoid cyclical references that cannot be released (i.e., if the observer holds a reference to the sink, it should be sure that it eventually clears the reference).

Parameters:
aObserverthe observer to add to the sink's set of load observers.

Get a cursor to iterate over all the arcs that point into a node.

Returns:
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) nsISimpleEnumerator object.

Here is the caller graph for this function:

Definition at line 335 of file nsRDFXMLDataSource.cpp.

                                                         {
        return mInner->ArcLabelsIn(node, labels);
    }

Here is the call graph for this function:

Get a cursor to iterate over all the arcs that originate in a resource.

Returns:
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) nsISimpleEnumerator object.

Here is the caller graph for this function:

Definition at line 340 of file nsRDFXMLDataSource.cpp.

                                                          {
        return mInner->ArcLabelsOut(source, labels);
    }

Here is the call graph for this function:

void nsIRDFDataSource::Assert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Add an assertion to the graph.

Here is the caller graph for this function:

NS_IMETHODIMP RDFXMLDataSourceImpl::Assert ( nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  tv 
)

Definition at line 694 of file nsRDFXMLDataSource.cpp.

{
    // We don't accept assertions unless we're writable (except in the
    // case that we're actually _reading_ the datasource in).
    nsresult rv;

    if (IsLoading()) {
        PRBool hasAssertion = PR_FALSE;

        nsCOMPtr<nsIRDFPurgeableDataSource> gcable = do_QueryInterface(mInner);
        if (gcable) {
            rv = gcable->Mark(aSource, aProperty, aTarget, aTruthValue, &hasAssertion);
            if (NS_FAILED(rv)) return rv;
        }

        rv = NS_RDF_ASSERTION_ACCEPTED;

        if (! hasAssertion) {
            rv = mInner->Assert(aSource, aProperty, aTarget, aTruthValue);

            if (NS_SUCCEEDED(rv) && gcable) {
                // Now mark the new assertion, so it doesn't get
                // removed when we sweep. Ignore rv, because we want
                // to return what mInner->Assert() gave us.
                PRBool didMark;
                (void) gcable->Mark(aSource, aProperty, aTarget, aTruthValue, &didMark);
            }

            if (NS_FAILED(rv)) return rv;
        }

        return rv;
    }
    else if (mIsWritable) {
        rv = mInner->Assert(aSource, aProperty, aTarget, aTruthValue);

        if (rv == NS_RDF_ASSERTION_ACCEPTED)
            mIsDirty = PR_TRUE;

        return rv;
    }
    else {
        return NS_RDF_ASSERTION_REJECTED;
    }
}

Here is the call graph for this function:

void nsIRDFXMLSink::beginLoad ( ) [inherited]

Initiate the RDF/XML load.

Notify observers that the datasource is about to send several notifications at once.

This must be followed by calling endUpdateBatch(), otherwise viewers will get out of sync.

Definition at line 369 of file nsRDFXMLDataSource.cpp.

                                  {
        return mInner->BeginUpdateBatch();
    }
nsresult RDFXMLDataSourceImpl::BlockingParse ( nsIURI aURL,
nsIStreamListener aConsumer 
) [protected]
void nsIRDFDataSource::Change ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aOldTarget,
in nsIRDFNode  aNewTarget 
) [inherited]

Change an assertion from.

[aSource]--[aProperty]-->[aOldTarget]

to

[aSource]--[aProperty]-->[aNewTarget]

Here is the caller graph for this function:

NS_IMETHODIMP RDFXMLDataSourceImpl::Change ( nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aOldTarget,
nsIRDFNode aNewTarget 
)

Definition at line 766 of file nsRDFXMLDataSource.cpp.

{
    nsresult rv;

    if (IsLoading() || mIsWritable) {
        rv = mInner->Change(aSource, aProperty, aOldTarget, aNewTarget);

        if (!IsLoading() && rv == NS_RDF_ASSERTION_ACCEPTED)
            mIsDirty = PR_TRUE;
    }
    else {
        rv = NS_RDF_ASSERTION_REJECTED;
    }

    return rv;
}

Here is the call graph for this function:

void nsIRDFDataSource::DoCommand ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Perform the specified command on set of sources.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::DoCommand ( nsISupportsArray aSources,
nsIRDFResource aCommand,
nsISupportsArray aArguments 
) [inline]

Definition at line 361 of file nsRDFXMLDataSource.cpp.

                               {

Here is the call graph for this function:

void nsIRDFXMLSink::endLoad ( ) [inherited]

Complete the RDF/XML load.

Notify observers that the datasource has completed issuing a notification group.

Definition at line 373 of file nsRDFXMLDataSource.cpp.

                                {
        return mInner->EndUpdateBatch();
    }

Request that a data source write it's contents out to permanent storage, if applicable.

Implemented in LocalStoreImpl.

Here is the caller graph for this function:

Returns the set of all commands defined for a given source.

Here is the caller graph for this function:

Definition at line 349 of file nsRDFXMLDataSource.cpp.

                               {

Here is the call graph for this function:

Retrieve all of the resources that the data source currently refers to.

Here is the caller graph for this function:

Definition at line 345 of file nsRDFXMLDataSource.cpp.

                                                              {
        return mInner->GetAllResources(aResult);
    }

Here is the call graph for this function:

nsIRDFResource nsIRDFDataSource::GetSource ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find an RDF resource that points to a given node over the specified arc & truth value.

Returns:
NS_RDF_NO_VALUE if there is no source that leads to the target with the specified property.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::GetSource ( nsIRDFResource property,
nsIRDFNode target,
PRBool  tv,
nsIRDFResource **  source 
) [inline]

Definition at line 264 of file nsRDFXMLDataSource.cpp.

                                                  {
        return mInner->GetSource(property, target, tv, source);
    }

Here is the call graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetSources ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find all RDF resources that point to a given node over the specified arc & truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::GetSources ( nsIRDFResource property,
nsIRDFNode target,
PRBool  tv,
nsISimpleEnumerator **  sources 
) [inline]

Definition at line 271 of file nsRDFXMLDataSource.cpp.

                                                         {
        return mInner->GetSources(property, target, tv, sources);
    }

Here is the call graph for this function:

nsIRDFNode nsIRDFDataSource::GetTarget ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find a child of that is related to the source by the given arc arc and truth value.

Returns:
NS_RDF_NO_VALUE if there is no target accessable from the source via the specified property.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::GetTarget ( nsIRDFResource source,
nsIRDFResource property,
PRBool  tv,
nsIRDFNode **  target 
) [inline]

Definition at line 278 of file nsRDFXMLDataSource.cpp.

                                              {
        return mInner->GetTarget(source, property, tv, target);
    }

Here is the call graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetTargets ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find all children of that are related to the source by the given arc arc and truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::GetTargets ( nsIRDFResource source,
nsIRDFResource property,
PRBool  tv,
nsISimpleEnumerator **  targets 
) [inline]

Definition at line 285 of file nsRDFXMLDataSource.cpp.

                                                         {
        return mInner->GetTargets(source, property, tv, targets);
    }

Here is the call graph for this function:

Definition at line 676 of file nsRDFXMLDataSource.cpp.

{
    *aURI = nsnull;
    if (!mURL) {
        return NS_OK;
    }
    
    nsCAutoString spec;
    mURL->GetSpec(spec);
    *aURI = ToNewCString(spec);
    if (!*aURI) {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    
    return NS_OK;
}

Here is the call graph for this function:

boolean nsIRDFDataSource::hasArcIn ( in nsIRDFNode  aNode,
in nsIRDFResource  aArc 
) [inherited]

Returns true if the specified node is pointed to by the specified arc.

Equivalent to enumerating ArcLabelsIn and comparing for the specified arc.

NS_IMETHOD RDFXMLDataSourceImpl::HasArcIn ( nsIRDFNode aNode,
nsIRDFResource aArc,
PRBool _retval 
) [inline]

Definition at line 327 of file nsRDFXMLDataSource.cpp.

                                                                                  {
        return mInner->HasArcIn(aNode, aArc, _retval);
    }

Returns true if the specified node has the specified outward arc.

Equivalent to enumerating ArcLabelsOut and comparing for the specified arc.

NS_IMETHOD RDFXMLDataSourceImpl::HasArcOut ( nsIRDFResource aSource,
nsIRDFResource aArc,
PRBool _retval 
) [inline]

Definition at line 331 of file nsRDFXMLDataSource.cpp.

                                                                                         {
        return mInner->HasArcOut(aSource, aArc, _retval);
    }
boolean nsIRDFDataSource::HasAssertion ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Query whether an assertion exists in this graph.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::HasAssertion ( nsIRDFResource source,
nsIRDFResource property,
nsIRDFNode target,
PRBool  tv,
PRBool hasAssertion 
) [inline]

Definition at line 311 of file nsRDFXMLDataSource.cpp.

                                                  {
        return mInner->HasAssertion(source, property, target, tv, hasAssertion);
    }

Here is the call graph for this function:

void nsIRDFRemoteDataSource::Init ( in string  aURI) [inherited]

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.

Parameters:
aURIthe URI to load

Definition at line 503 of file nsRDFXMLDataSource.cpp.

{
    nsresult rv;
    rv = CallCreateInstance(kRDFInMemoryDataSourceCID, &mInner);
    if (NS_FAILED(rv)) return rv;

    if (gRefCnt++ == 0) {
        rv = CallGetService(kRDFServiceCID, &gRDFService);

        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
        if (NS_FAILED(rv)) return rv;
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFXMLSink::interrupt ( ) [inherited]

Suspend the RDF/XML load.

PRBool RDFXMLDataSourceImpl::IsA ( nsIRDFDataSource aDataSource,
nsIRDFResource aResource,
nsIRDFResource aType 
)
boolean nsIRDFDataSource::IsCommandEnabled ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Returns whether a given command is enabled for a set of sources.

Here is the caller graph for this function:

NS_IMETHOD RDFXMLDataSourceImpl::IsCommandEnabled ( nsISupportsArray aSources,
nsIRDFResource aCommand,
nsISupportsArray aArguments,
PRBool aResult 
) [inline]

Definition at line 354 of file nsRDFXMLDataSource.cpp.

                               {

Here is the call graph for this function:

PRBool RDFXMLDataSourceImpl::IsLoading ( ) [inline, protected]

Definition at line 252 of file nsRDFXMLDataSource.cpp.

Here is the caller graph for this function:

PRBool RDFXMLDataSourceImpl::MakeQName ( nsIRDFResource aResource,
nsString property,
nsString nameSpacePrefix,
nsString nameSpaceURI 
)
void nsIRDFDataSource::Move ( in nsIRDFResource  aOldSource,
in nsIRDFResource  aNewSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

'Move' an assertion from

[aOldSource]--[aProperty]-->[aTarget]

to

[aNewSource]--[aProperty]-->[aTarget]

Here is the caller graph for this function:

NS_IMETHODIMP RDFXMLDataSourceImpl::Move ( nsIRDFResource aOldSource,
nsIRDFResource aNewSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget 
)

Definition at line 787 of file nsRDFXMLDataSource.cpp.

{
    nsresult rv;

    if (IsLoading() || mIsWritable) {
        rv = mInner->Move(aOldSource, aNewSource, aProperty, aTarget);
        if (!IsLoading() && rv == NS_RDF_ASSERTION_ACCEPTED)
            mIsDirty = PR_TRUE;
    }
    else {
        rv = NS_RDF_ASSERTION_REJECTED;
    }

    return rv;
}

Here is the call graph for this function:

void nsIStreamListener::onDataAvailable ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsIInputStream  aInputStream,
in unsigned long  aOffset,
in unsigned long  aCount 
) [inherited]

Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.

The onDataAvailable impl must read exactly |aCount| bytes of data before returning.

Parameters:
aRequestrequest corresponding to the source of the data
aContextuser defined context
aInputStreaminput stream containing the data chunk
aOffsetNumber of bytes that were sent in previous onDataAvailable calls for this request. In other words, the sum of all previous count parameters. If that number is greater than or equal to 2^32, this parameter will be PR_UINT32_MAX (2^32 - 1).
aCountnumber of bytes available in the stream

NOTE: The aInputStream parameter must implement readSegments.

An exception thrown from onDataAvailable has the side-effect of causing the request to be canceled.

void nsIRequestObserver::onStartRequest ( in nsIRequest  aRequest,
in nsISupports  aContext 
) [inherited]

Called to signify the beginning of an asynchronous request.

Parameters:
aRequestrequest being observed
aContextuser defined context

An exception thrown from onStartRequest has the side-effect of causing the request to be canceled.

Here is the caller graph for this function:

void nsIRequestObserver::onStopRequest ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsresult  aStatusCode 
) [inherited]

Called to signify the end of an asynchronous request.

This call is always preceded by a call to onStartRequest.

Parameters:
aRequestrequest being observed
aContextuser defined context
aStatusCodereason for stopping (NS_OK if completed successfully)

An exception thrown from onStopRequest is generally ignored.

Here is the caller graph for this function:

Definition at line 808 of file nsRDFXMLDataSource.cpp.

{

    nsresult rv;

    {
        // Quick and dirty check to see if we're in XPCOM shutdown. If
        // we are, we're screwed: it's too late to serialize because
        // many of the services that we'll need to acquire to properly
        // write the file will be unaquirable.
        nsCOMPtr<nsIRDFService> dummy = do_GetService(kRDFServiceCID, &rv);
        if (NS_FAILED(rv)) {
            NS_WARNING("unable to Flush() diry datasource during XPCOM shutdown");
            return rv;
        }
    }

    // Is it a file? If so, we can write to it. Some day, it'd be nice
    // if we didn't care what kind of stream this was...
    nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aURI);
    
    if (fileURL) {
        nsCOMPtr<nsIFile> file;
        fileURL->GetFile(getter_AddRefs(file));
        if (file) {
            // get a safe output stream, so we don't clobber the datasource file unless
            // all the writes succeeded.
            nsCOMPtr<nsIOutputStream> out;
            rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(out),
                                                 file,
                                                 PR_WRONLY | PR_CREATE_FILE,
                                                 /*octal*/ 0666,
                                                 0);
            if (NS_FAILED(rv)) return rv;

            nsCOMPtr<nsIOutputStream> bufferedOut;
            rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOut), out, 4096);
            if (NS_FAILED(rv)) return rv;

            rv = Serialize(bufferedOut);
            if (NS_FAILED(rv)) return rv;
            
            // All went ok. Maybe except for problems in Write(), but the stream detects
            // that for us
            nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(bufferedOut, &rv);
            if (NS_FAILED(rv)) return rv;

            rv = safeStream->Finish();
            if (NS_FAILED(rv)) {
                NS_WARNING("failed to save datasource file! possible dataloss");
                return rv;
            }
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

void nsIRDFRemoteDataSource::Refresh ( in boolean  aBlocking) [inherited]

Refresh the remote datasource, re-loading its contents from the URI.

Parameters:
aBlockingIf true, the call will block until the datasource has completely reloaded.

Remove an observer from this data source.

Here is the caller graph for this function:

Definition at line 323 of file nsRDFXMLDataSource.cpp.

                                                         {
        return mInner->RemoveObserver(aObserver);
    }

Here is the call graph for this function:

Remove an observer from the sink's set of observers.

Parameters:
aObserverthe observer to remove.
void nsIRDFXMLSink::resume ( ) [inherited]

Resume the RDF/XML load.

Serialize the contents of the datasource to aStream.

Parameters:
aStreamthe output stream the will recieve the RDF/XML. Currently, the output stream need only implement the |write()| method.

Here is the caller graph for this function:

void nsIRDFDataSource::Unassert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

Remove an assertion from the graph.

Here is the caller graph for this function:

Definition at line 745 of file nsRDFXMLDataSource.cpp.

{
    // We don't accept assertions unless we're writable (except in the
    // case that we're actually _reading_ the datasource in).
    nsresult rv;

    if (IsLoading() || mIsWritable) {
        rv = mInner->Unassert(source, property, target);
        if (!IsLoading() && rv == NS_RDF_ASSERTION_ACCEPTED)
            mIsDirty = PR_TRUE;
    }
    else {
        rv = NS_RDF_ASSERTION_REJECTED;
    }

    return rv;
}

Here is the call graph for this function:

Visit all the subject resources in the datasource.

The order is intederminate and may change from one invocation to the next. The subjects will be in the aSubject argument in calls into aVisitor, aPredicate and aObject will be null.

Note:
Implementations may throw NS_ERROR_NOT_IMPLEMENTED for this method, but in this case RDF serializations of this datasource will not be possible.
NS_DECL_NSIRDFREMOTEDATASOURCE NS_DECL_NSIRDFXMLSINK NS_DECL_NSIRDFXMLSOURCE NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER NS_IMETHOD RDFXMLDataSourceImpl::VisitAllSubjects ( rdfITripleVisitor aVisitor) [inline]

Definition at line 393 of file nsRDFXMLDataSource.cpp.

                                                             {
        nsresult rv;
        nsCOMPtr<rdfIDataSource> rdfds = do_QueryInterface(mInner, &rv);
        if (NS_FAILED(rv)) return rv;
        return rdfds->VisitAllSubjects(aVisitor);
    } 

Here is the call graph for this function:

Visit all the triples in the datasource.

The order is intederminate and may change from one invocation to the next.

Note:
Implementations may throw NS_ERROR_NOT_IMPLEMENTED for this method, but in this case RDF serializations of this datasource will not be possible.

Definition at line 400 of file nsRDFXMLDataSource.cpp.

                                                            {
        nsresult rv;
        nsCOMPtr<rdfIDataSource> rdfds = do_QueryInterface(mInner, &rv);
        if (NS_FAILED(rv)) return rv;
        return rdfds->VisitAllTriples(aVisitor);
    } 

Here is the call graph for this function:


Friends And Related Function Documentation

Definition at line 465 of file nsRDFXMLDataSource.cpp.

{
    NS_PRECONDITION(aResult != nsnull, "null ptr");
    if (! aResult)
        return NS_ERROR_NULL_POINTER;

    RDFXMLDataSourceImpl* datasource = new RDFXMLDataSourceImpl();
    if (! datasource)
        return NS_ERROR_OUT_OF_MEMORY;

    nsresult rv;
    rv = datasource->Init();

    if (NS_FAILED(rv)) {
        delete datasource;
        return rv;
    }

    NS_ADDREF(datasource);
    *aResult = datasource;
    return NS_OK;
}

Member Data Documentation

Definition at line 242 of file nsRDFXMLDataSource.cpp.

PRInt32 RDFXMLDataSourceImpl::gRefCnt = 0 [static, protected]

Definition at line 241 of file nsRDFXMLDataSource.cpp.

This value is true when the datasource has fully loaded itself.

Definition at line 50 of file nsIRDFRemoteDataSource.idl.

Definition at line 231 of file nsRDFXMLDataSource.cpp.

Definition at line 233 of file nsRDFXMLDataSource.cpp.

Definition at line 232 of file nsRDFXMLDataSource.cpp.

Definition at line 237 of file nsRDFXMLDataSource.cpp.

Definition at line 234 of file nsRDFXMLDataSource.cpp.

Definition at line 238 of file nsRDFXMLDataSource.cpp.

Definition at line 235 of file nsRDFXMLDataSource.cpp.

Definition at line 236 of file nsRDFXMLDataSource.cpp.

Set to true if the sink is read-only and cannot be modified.

Definition at line 110 of file nsIRDFXMLSink.idl.

readonly attribute string nsIRDFDataSource::URI [inherited]

The "URI" of the data source.

This used by the RDF service's |GetDataSource()| method to cache datasources.

Definition at line 56 of file nsIRDFDataSource.idl.


The documentation for this class was generated from the following file: