Design for NetFish

NetFish inherits from ApplicationModel. Most of its code is generated by the Canvas Tool of VisualWorks. NetFish delegates all of its hypertext and Web related tasks to WebClient, which is a subclass of HyperApp. NetFish also uses LinkHistorian to handle caching. The relationship between the LinkHistorian and NetFish matches the Memento pattern [ralph's book] in which NetFish is the originator, LinkHistorian is the caretaker, and UrlLink is the memento.

What is described in the above paragraph is very application dependent and is not very reusable in other applications. The use of HyperTalk in NetFish begins with WebClient.

In HyperTalk framework, there are several major abstract superclass components. In WebClient of NetFish, the corresponsing concrete subclasses are:

The WebController considers the mouse click from the user as meaningful. WebController has a Command object which is obtained from WebClient. The only concrete subclass of Command used in NetFIsh is ClickCommand.

After the user has clicked a point on HyperView, the controller records the point which has been clicked and executes the Command object with the point as a parameter. The ClickCommand, the only existing Command object so far, then builds a WebGUIAction which has information like the instance of HyperView, the point just clicked and the action symbol #click. Then, it asks the model to retrieve links based on the WebGUIAction.

WebClient informs all the registered LinkResolvers to retrieve links for itself. As a result, none, one or more links are resolved and reported back to WebClient by LinkResolvers.

When WebClient gets the report, it checks if the link is relevant. For example, a WebClient is only interested in the link with type #url. If it is relevant, then the WebClient will access that link. No matter if it is relevant or not, the link is broadcast to all the dependents of WebClient. These dependents may be a LinkHistorian, a WebCache, LinkResolvers, or other external objects such as the model of a Oxford English Dictionary. As a result,

WebClient accesses the destination component, addressed by a UrlLink, through its LinkAccessor. WebClient also instructs SMWeb to open a new window by sending it a #spawn:. If the access is successful and a stream returned, the UrlLink and the stream is sent to SMWeb.

The SMWeb examines the header of the stream for its MIME content type[ ] to determine the next action. If the node is a HTML document, its MIME content type is text/html. If SMWeb is in the spawn mode, then it gets the Filter from the class method #filterFor:and:. Otherwise, it gets a Viewer from the class method #viewerFor:and:. The type and subtype are parameters to these messages. Then, SMWeb delegates the Viewer or Filter to process the stream. For example, an ImageViewer may be used to spawn a new window and display the image, or a HtmlParser may be used to parse the stream.

Currently, SMWeb doesn't recognise any input external stream without response header. Several solutions are possible:

A filter converts one type of stream into another type. If a Filter is used to process the stream, then HyperRenderer is the next step to go. For each HyperComponent created by the Filter, HyperRenderer assigns a RenderPolicy to it based on its type. The mapping table is stored in the class variables FormatManagerMap. For example, a HyperComponent with the type #img is assigned to an ImagePolicy. Another one with type #p is assigned a ParagraphPolicy. The result is displayed on the HyperView of the WebClient. This view is contained in a ViewHolder of NetFish's main window.

That's it for NetFish!