Re: [Vysper] Stanzas for a module without namespace

2009-08-13 Thread Bernd Fondermann
Niklas Gustavsson wrote:
> A committed a first stab at this in rev 803275. Have a look.

Looks good.

  Bernd


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Niklas Gustavsson
A committed a first stab at this in rev 803275. Have a look.

/niklas


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Niklas Gustavsson
On Tue, Aug 11, 2009 at 5:46 PM, Michael Jakl wrote:
> Sorry, my mail might be misleading. I was thinking of throwing an
> exception if a module registers with a subdomain but also registers a
> handler with a namespace, which would not work.

This would work if a module both handles messages for a subdomain as
well as for the server domain (and in such cases with namespaces).
However, such a scenario seems very unlikely. So, I'm +1 to your idea
and will implement it (we can change it later if we like of course).

/niklas


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Niklas Gustavsson
On Tue, Aug 11, 2009 at 4:39 PM, Bernd Fondermann wrote:
>> Yes. Probably it's still a good idea to check if a module registers a
>> subdomain *and* one or more namespaces, which would be a hard-to-find
>> bug for the modules developer (but is easy to check for us, I guess).
>
> IIRC, the component spec requires _all_ stanzas for a "subdomain" to be
> routed to the component.

That's the way I've done it (not yet committed, needs more Javadoc).
All messages in a subdomain are routed to the
SubdomainHandlerDictionary registered for that domain. If the
dictionary returns a handler, it will be used. If it does not return a
handler (or no dictionary has been registered for the subdomain), the
stanza will go through the already existing lookup mechanism.

Sounds good?

/niklas


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Michael Jakl
On Tue, Aug 11, 2009 at 16:39, Bernd Fondermann wrote:
> Michael Jakl wrote:
>> On Mon, Aug 10, 2009 at 22:39, Niklas Gustavsson wrote:
>>> On Mon, Aug 10, 2009 at 10:31 PM, Michael Jakl 
>>> wrote:
>>> I would say that the module should deal with that. So, subdomain
>>> routing first. Everything matching the subdomain goes to the handler
>>> dictionary. The SubdomainHandlerDictionery.get() will have to do the
>>> namespace routing in the case where a module works like the pubsub
>>> module (and the MUC module btw). Makes sense?
>>
>> Yes. Probably it's still a good idea to check if a module registers a
>> subdomain *and* one or more namespaces, which would be a hard-to-find
>> bug for the modules developer (but is easy to check for us, I guess).
>
> IIRC, the component spec requires _all_ stanzas for a "subdomain" to be
> routed to the component.

Sorry, my mail might be misleading. I was thinking of throwing an
exception if a module registers with a subdomain but also registers a
handler with a namespace, which would not work.

The spec doesn't define how internal components work AFAIK, only the
protocol for external (server independent) components is well defined.

Michael


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Bernd Fondermann
Michael Jakl wrote:
> Hi!
> 
> On Mon, Aug 10, 2009 at 22:39, Niklas Gustavsson wrote:
>> On Mon, Aug 10, 2009 at 10:31 PM, Michael Jakl wrote:
>> I would say that the module should deal with that. So, subdomain
>> routing first. Everything matching the subdomain goes to the handler
>> dictionary. The SubdomainHandlerDictionery.get() will have to do the
>> namespace routing in the case where a module works like the pubsub
>> module (and the MUC module btw). Makes sense?
> 
> Yes. Probably it's still a good idea to check if a module registers a
> subdomain *and* one or more namespaces, which would be a hard-to-find
> bug for the modules developer (but is easy to check for us, I guess).

IIRC, the component spec requires _all_ stanzas for a "subdomain" to be
routed to the component.

  Bernd


Re: [Vysper] Stanzas for a module without namespace

2009-08-11 Thread Michael Jakl
Hi!

On Mon, Aug 10, 2009 at 22:39, Niklas Gustavsson wrote:
> On Mon, Aug 10, 2009 at 10:31 PM, Michael Jakl wrote:
> I would say that the module should deal with that. So, subdomain
> routing first. Everything matching the subdomain goes to the handler
> dictionary. The SubdomainHandlerDictionery.get() will have to do the
> namespace routing in the case where a module works like the pubsub
> module (and the MUC module btw). Makes sense?

Yes. Probably it's still a good idea to check if a module registers a
subdomain *and* one or more namespaces, which would be a hard-to-find
bug for the modules developer (but is easy to check for us, I guess).

Michael


Re: [Vysper] Stanzas for a module without namespace

2009-08-10 Thread Bernd Fondermann
Niklas Gustavsson wrote:
> On Mon, Aug 10, 2009 at 10:31 PM, Michael Jakl wrote:
>> That's exactly how I'd do it. If it's no problem that subdomain
>> routing takes precedence over namespace routing this is the way to go
>> IMHO.
>>
>> On a second thought we might want to keep the namespace routing within
>> the subdomain routing. Is there a use-case where we need to  route by
>> subdomain first, then by namespace or should the module take care of
>> that?
>>
>> In the pubsub case, we have two namespaces (the "general" namespace
>> and the "owner" namespace). In my case it's handled by the same
>> module, but is this always the case?
> 
> I would say that the module should deal with that. So, subdomain
> routing first. Everything matching the subdomain goes to the handler
> dictionary. The SubdomainHandlerDictionery.get() will have to do the
> namespace routing in the case where a module works like the pubsub
> module (and the MUC module btw). Makes sense?

+1, sounds good.

  Bernd


Re: [Vysper] Stanzas for a module without namespace

2009-08-10 Thread Niklas Gustavsson
On Mon, Aug 10, 2009 at 10:31 PM, Michael Jakl wrote:
> That's exactly how I'd do it. If it's no problem that subdomain
> routing takes precedence over namespace routing this is the way to go
> IMHO.
>
> On a second thought we might want to keep the namespace routing within
> the subdomain routing. Is there a use-case where we need to  route by
> subdomain first, then by namespace or should the module take care of
> that?
>
> In the pubsub case, we have two namespaces (the "general" namespace
> and the "owner" namespace). In my case it's handled by the same
> module, but is this always the case?

I would say that the module should deal with that. So, subdomain
routing first. Everything matching the subdomain goes to the handler
dictionary. The SubdomainHandlerDictionery.get() will have to do the
namespace routing in the case where a module works like the pubsub
module (and the MUC module btw). Makes sense?

/niklas


Re: [Vysper] Stanzas for a module without namespace

2009-08-10 Thread Michael Jakl
Hi!

On Mon, Aug 10, 2009 at 22:15, Niklas Gustavsson wrote:
> On Mon, Aug 10, 2009 at 9:54 AM, Michael Jakl wrote:
> So, in addition to the component support (using the component
> protocol), how about we allow for registering modules with a
> subdomain? For example, adding a XMPPServer.addModule(String
> subdomain, Module module) method. Then we do a
> SubdomainHandlerDictionary working similar to the
> NamespaceHandlerDictionary which takes care of finding the handler.
>
> That way, we can have the server respond to different subdomains in an
> easy way. What do you think?

That's exactly how I'd do it. If it's no problem that subdomain
routing takes precedence over namespace routing this is the way to go
IMHO.

On a second thought we might want to keep the namespace routing within
the subdomain routing. Is there a use-case where we need to  route by
subdomain first, then by namespace or should the module take care of
that?
In the pubsub case, we have two namespaces (the "general" namespace
and the "owner" namespace). In my case it's handled by the same
module, but is this always the case?

Michael


Re: [Vysper] Stanzas for a module without namespace

2009-08-10 Thread Niklas Gustavsson
On Mon, Aug 10, 2009 at 9:54 AM, Michael Jakl wrote:
> Routing via subdomain seems to be the only viable alternative. Only
> broadcasting to all modules might work too, but doesn't sound as
> clean.

Agreed, this also seems to be what the spec assumes. Reading further
into the spec, it turns out the this type of routing is used for all
message stanzas, rather than extension namespaces.

So, in addition to the component support (using the component
protocol), how about we allow for registering modules with a
subdomain? For example, adding a XMPPServer.addModule(String
subdomain, Module module) method. Then we do a
SubdomainHandlerDictionary working similar to the
NamespaceHandlerDictionary which takes care of finding the handler.

That way, we can have the server respond to different subdomains in an
easy way. What do you think?

/niklas


Re: [Vysper] Stanzas for a module without namespace

2009-08-10 Thread Michael Jakl
Hi!

On Sun, Aug 9, 2009 at 22:35, Niklas Gustavsson wrote:
> In the MUC XEP, implementations should also support the old groupchat
> protocol. This was defined before the extension-based-on-namespaces
> approach was invented and thus use regular stanzas without namespaces,
> for example:
> Enter a room:
>     from='ha...@shakespeare.lit/pda'
>    to='darkc...@chat.shakespeare.lit/thirdwitch'/>
>
> "darkc...@chat.shakespeare.lit" in the example is a room in the group chat.
>
> What would be the best way to route such messages to the appropriate
> handler? Maybe component support will handle this by being able to
> replace the default presence handler completely?

Routing via subdomain seems to be the only viable alternative. Only
broadcasting to all modules might work too, but doesn't sound as
clean.

I don't know whether it's a good idea to register modules with a
specific "to" address? But that is very close to the subdomain routing
of the component support... .

Michael


[Vysper] Stanzas for a module without namespace

2009-08-09 Thread Niklas Gustavsson
Hi

In the MUC XEP, implementations should also support the old groupchat
protocol. This was defined before the extension-based-on-namespaces
approach was invented and thus use regular stanzas without namespaces,
for example:
Enter a room:


"darkc...@chat.shakespeare.lit" in the example is a room in the group chat.

What would be the best way to route such messages to the appropriate
handler? Maybe component support will handle this by being able to
replace the default presence handler completely?

/niklas