Hi Boris,

Apologies for the vagueness I didn't want to bore anyone!

Ok, I am merging our "Mozilla for GroupWise" and "Liaison Projects". Both communicate with Novell's GroupWise email system via different methods. The original (that must be maintained) is URL encoded streams and XML messages, the new mechanism is SOAP. I am trying to marry the two together so I can remove duplicated code.

For example in "Message.Delete()", I don't want to have to write this method for each underlying XML protocol. I'd rather have the underlying "datastore" (this where nsIChannel came in) handle the specifics of deleting the message using either the URL encoded, XML message or SOAP RPC style as needed.

My conceptual problems were:

I had figured out that channels are a "single shot" data connection. So I need to handle the concept of being "connected" in my channel.

SOAP doesn't appear to use channels, or stream listeners so I'm some what forcing a square peg into round hole.

How do I convey a URL encoded stream into my custom channel for writing to the underlying one. I'm not sure if an XML message is best written via a nsIStreamListener anyway. Perhaps it's overkill and provides little value.

This is all very conceptual, and am struggling with the object model as much as anything.

Having looked at the new mozStoragexxx interfaces, I am tempted to create a more abstract "StorageConnector" with "Write()" and "AsyncWrite()" methods, and a similar "ValueArray" concept.

What got me thinking along this was seeing the other channel imps: nsIJARChannel, nsIFTPChannel, nsIFileChannel, nsIHttpChannel. I kind of assumed all the SQLLite interfaces in the new mozStorage interfaces would probably be implemented as an nsISQLChannel and that perhaps I could add an "XML Channel layer" above them all.

Thanks for the thoughts,

N


Boris Zbarsky wrote:
Neil Stansbury wrote:
There are however lots of holes in this concept, can someone explain the theory behind the nsIChannel imp please? The netlib docs of this area are "todo".

A channel is something that has a URI and that you can open and pass an nsIStreamListener to. After you have done so, it will eventually call back to the nsIStreamListener you passed to it (calling OnStartRequest/OnDataAvailable/OnStopRequest on it).

Wrapping one channel in another one is quite doable if you want to.

Past that, the question is so vague that I'm not really sure what to say. What specific issues are there that arise when you try to do it?

-Boris
_______________________________________________
Mozilla-netlib mailing list
Mozilla-netlib@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to