From directory-dev-return-2085-apmail-incubator-directory-dev-archive=incubator.apache.org@incubator.apache.org Mon Oct 11 18:36:29 2004 Return-Path: Delivered-To: apmail-incubator-directory-dev-archive@www.apache.org Received: (qmail 60764 invoked from network); 11 Oct 2004 18:36:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Oct 2004 18:36:29 -0000 Received: (qmail 36306 invoked by uid 500); 11 Oct 2004 18:36:28 -0000 Delivered-To: apmail-incubator-directory-dev-archive@incubator.apache.org Received: (qmail 36203 invoked by uid 500); 11 Oct 2004 18:36:27 -0000 Mailing-List: contact directory-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list directory-dev@incubator.apache.org Received: (qmail 36173 invoked by uid 99); 11 Oct 2004 18:36:26 -0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FROM_ENDS_IN_NUMS,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of aok123@bellsouth.net designates 205.152.59.71 as permitted sender) Received: from [205.152.59.71] (HELO imf23aec.mail.bellsouth.net) (205.152.59.71) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 11 Oct 2004 11:36:26 -0700 Received: from mail.bellsouth.net ([205.152.59.157]) by imf23aec.mail.bellsouth.net (InterMail vM.5.01.06.11 201-253-122-130-111-20040605) with SMTP id <20041011183624.OEYA1787.imf23aec.mail.bellsouth.net@mail.bellsouth.net> for ; Mon, 11 Oct 2004 14:36:24 -0400 X-Mailer: Openwave WebEngine, version 2.8.16.1 (webedge20-101-1106-101-20040924) X-Originating-IP: [65.90.232.2] From: Alex Karasulu Organization: Solarsis Group To: "Apache Directory Developers List" Subject: Re: Re: [seda] event notifier pattern clarification Date: Mon, 11 Oct 2004 14:36:24 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-Id: <20041011183624.OEYA1787.imf23aec.mail.bellsouth.net@mail.bellsouth.net> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Oh ok good I missed the part about creating the branch. And it looks as though I sent my last email to you and not to the list. Unfortunately I'm dealing with a web based email client today. I will be able to respond more thoroughly tonight once I get home. TTYS, Alex > > From: Trustin Lee > Date: 2004/10/10 Sun PM 09:40:23 EDT > To: Apache Directory Developers List > Subject: Re: [seda] event notifier pattern clarification > > I'm working on this issue (DIRSEDA-12), and I think I found a better solution. > > The problem here was 'bypassing encoder and decoder is impossible for > current event routing model', and it was solved by RoutingAdvice, but > it looked somewhat messy; we had to have three(!) control factors! So > I tried to make them to two: > > 1. EventFilter: event types are also handled here by EventTypeFilter > utility class. > 2. Source Subscriber: the subscriber who fired the event. > > This two factor elegantly solves all of our routing issues completely > because it makes us to control the routing by 'source subscriber'. > 'Who' fired this event? It is probaly most important information! > > and, here is my suggesting API: > > public interface EventRouter { > SubscriberContext add(String name, Subscriber subscriber); > void remove(String name); > } > > public interface SubscriberContext { > String getName(); > void subscribe(String eventSourceName, Filter eventFilter); > void unsubscribe(String eventSourceName, Filter eventFilter); > boolean publish(SessionEvent event); > SubscriberMonitor getMonitor(); > void setMonitor(SubscriberMonitor monitor); > } > > public interface Subscriber extends EventListener { > void inform(SubscriberContext ctx, SessionEvent event); > } > > public interface Filter { > static Filter ALL = new Filter() { > public boolean accept(SessionEvent event) { > return true; > } > }; > > boolean accept(SessionEvent event); > } > > And here is the usage: > > EventRouter er = ...; > SubscriberContext ctx; > > er.add("listener", tcpLIstenerManager); > ctx = er.add("input", inputListenerManager); > ctx.subscribe("listener", Filter.ALL); > ... > > public class MySubscriber implements Subscriber { > > public void inform(SubscriberContext ctx, SessionEvent event) { > // do something with event > .... > ctx.publish(replyEvent); > } > .... > } > > HDYT? > > I'm already working on this, and you can see it in > 'trustin_api_redesign' branch now although there are a lot of > compilation errors in the implementation part. > > Cheers, > Trustin Lee >