From: Guevara, A. <Ale...@uh...> - 2003-04-29 19:49:17
|
std way: //create data object from message encapsulates code //to extract data from the msg using the std methods like //getMSH().get... DataObject do = createDataObjectFromMessage( msg ); sink.store( do ); using visitor: DataObjectCreatorVisitor v = new DataObjectCreatorVisitor( //these are the matching rules new String[] { "MSH-9-2", "^PID(?:|.*?){5}(.*)|" } ); msg.accept( v ); sink.store( v.getDataObject() ); As you can see, using the Visitor pattern is just another way to do it. One that usually tends to be more elegant and easier to use. (the idea is that the hapi source code generator will generate the base visitor code, and even some core visitors, like the DataObject creator). If we'll be using the Visitor pattern only to implement the logging feature, then most probably it will be an overkill... -----Original Message----- From: Tripp, Bryan Sent: April 29, 2003 3:36 PM To: Guevara, Alexei Subject: RE: RE: message database You're far too happy ;) Anyway, isn't loving a pattern an anti-pattern ("Golden Hammer")? I still don't see it for message logging. Maybe if you wrote some pseudocode? Bryan > -----Original Message----- > From: Guevara, Alexei > Sent: April 29, 2003 3:27 PM > To: Tripp, Bryan > Subject: RE: RE: message database > > > > > I like it, but for some reason I can't think of any use cases. > Anyone? > > Message logging is a good candidate, we could have different visitors, > each to log some piece of info of the message (or the whole message) > ... The visitor will construct the Data Object (the one that will be > thrown onto the DataSink) ..... > > It will provide as well the foundations for a more granular message > processing mechanism ... we could even use it to extract a very > specific piece of data from a message ... and so on ... on and on ... > I love the visitor pattern ;) > > alex6 > > > > > > > www.mailfiler.com [HAPI-devel] > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 > > --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. |