Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help on WMA specification!

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The generic connection framework includes convenience methods for getting InputStream and OutputStream handles for connections which are StreamConnections. The MessageConnection does not support stream based operations. If an application calls the Connector.open*Stream methods, they will receive an IllegalArgumentException.

I extracted some parts of WMA specification as above. I can't figure it out in the code... How is MessageConnection related to Stream-based operations? Connector.open*Stream will return *Stream and how is it related to MessageConnection? Could anyone please help me?
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a typical problem with 'convenience' methods and generalization. When you generalize something, there are going to be some special cases where the generalization is not applicable and hence have to be dealt separately.

Case in point is the Connector class.

As you mentioned, there are some convenience methods in the Connector class to open and close "stream-based connections", since they are the most common connections one will use. In fact, every Connection defined so far, other than the MessageConnection, is in fact, a stream-based connection.

A stream-based connection is a type of connection where data are transmitted and received continuously, like a SocketConnection.

But a special-case to this, as mentioned earlier, is the MessageConnection, where data is transmittted and received in terms of discrete 'packets'.

Hence, the convenient stream methods are not applicable anymore to such a connection. Since MessageConnection extends Connection and has an URL similar to other Connections, this can be happily passed as a parameter to these conevience methods.

But as the MessageConnection is not associated with a stream, these methods will throw an IllegalArgumentException.

Hope this helps.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sathya,
It's an excellent explanation!!! Thanks a lot!!! I can figure it out now...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic