Re: [JDEV] Question on using NIO with SAX

2002-03-22 Thread Joe Hildebrand


I did a JNI wrapper around xpat for marbles, as a stop-gap.

http://marbles.sourceforge.net/

Haven't worked on it in a while, but it should still be there.



"Chan, Oscar" <[EMAIL PROTECTED]> writes:

> Thanks. I guess I will have to live with this until the SAX API provide
> API for this push-model parser.  
>
> I looked at the Xerces-J parser's parseSome() method, but it is only for
> parsing the first line of XML document to get the encoding in XML
> Declaration, so it does not work in the way that I needed.
>
> Thanks again, 
>
> Oscar 
>
> -Original Message- 
> From: David Waite [ mailto:[EMAIL PROTECTED]  ] 
> Sent: Thursday, March 21, 2002 5:16 PM 
> To: [EMAIL PROTECTED] 
> Subject: Re: [JDEV] Question on using NIO with SAX 
>
>
> This is an issue with the SAX Api (which understandably, we can't 
> change). What you want is a push-model parser (like SAX) which takes a 
> block of bytes/characters and calls events on the DocumentHandler (on 
> that thread) until that block of data has been processed, then returns 
> or saves the remainder until the next time it is passed.  SAX does not 
> define this, and anything which does this at least is extending SAX. 
>
> I believe Xerces-J at least defines a parseSome method on its XmlParser 
> method, but I don't know if this does what you want. 
>
> -David Waite 
>
> Chan, Oscar wrote: 
>
>> Hi all, 
>> 
>> I am new here.  I am now developing a message server based on the 
>> subset of Jabber protocol. I am building using Java, and SAX parser in
>
>> javax.xml.parsers package.   My problem is that I am trying to code 
>> the server so that it can use NIO (new i/o) package once java 1.4 is 
>> stable enough to use.  By using NIO, it eliminates the problem of 
>> having a thread per socket because it multiplexes the input and store 
>> the data in a buffer instead of blocking the call and waiting until 
>> data is available.  Usually, the server machine will slow down when 
>> the number of thread reach about 1000.  Therefore, NIO will increase 
>> the number of connection that we can have. 
>> 
>> Since parse() method in java.xml.parsers.SAXParser is using a blocking
>
>> I/O and, hence, it increase the number of threads. Does anyone know 
>> any workaround for it, or any future support for SAX using NIO? 
>> 
>> Thanks 
>> 
>> Oscar 
>> 
>
>
>
> ___ 
> jdev mailing list 
> [EMAIL PROTECTED] 
> http://mailman.jabber.org/listinfo/jdev
>   
>

-- 
Joe Hildebrand
Chief Architect
Jabber, Inc.
http://www.jabber.com/

___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



Re: [JDEV] Question on using NIO with SAX

2002-03-22 Thread Iain Shigeoka

On 3/21/02 5:16 PM, "David Waite" <[EMAIL PROTECTED]> wrote:

> This is an issue with the SAX Api (which understandably, we can't
> change). What you want is a push-model parser (like SAX) which takes a
> block of bytes/characters and calls events on the DocumentHandler (on
> that thread) until that block of data has been processed, then returns
> or saves the remainder until the next time it is passed.  SAX does not
> define this, and anything which does this at least is extending SAX.

Yeah.  The best bet is probably to tweak the SAX parser to behave this way.
I have no idea how hard this is in Xerces.  A smaller parser like J Clark's
XP parser http://www.jclark.com/xml/xp/index.html may be easier to work with
being that it is a LOT smaller.

-iain


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



[JDEV] How To Get A Remote Jabber Clients IP

2002-03-22 Thread Melvin Tucker

Is it possible to get the IP address of a contact in your roster



Melvin Tucker
[EMAIL PROTECTED] - Jabber ID
[EMAIL PROTECTED] - MSN Instant Messenger
MelvinTucker  - AOL Instant Messenger
Meltucker1- Yahoo Messenger

__
MyBuddies Instant Meesenger - Comming Soon
myBuddies Instant Messenger is aimed at providing an easy to use
Interface yet very powerful features not found in other
IM clients.


** PLEASE NOTE **
This E-Mai
___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



Re: [JDEV] Question on using NIO with SAX

2002-03-22 Thread Chris Chen

Well, I'm thinking of another way of wrapping a underlying stream into a 
"faked blocking IO stream" for SAX.

What you can do is have NIO on one side, put all the data into a channel, 
then create a data buffer processor that reads in the data from the 
channel.  This processor will also implement the InputStream interface so 
that it can be read...  Then you can just pass the wrapped stream to the 
SAX handler.  This way, SAX still thinks it's using a traditional stream 
but the underlying implementation is actually using the new NIO.

I think this might work, but you do have to implement your own blocking 
mechanism for the read() operation.

Chris

___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



[JDEV] Net::Jabber and oob

2002-03-22 Thread Rico -mc- Gloeckner

Hi,

i wrote a tiny perl client for jabber and everything was working fine,
but when i get a Mail from, i.e. a Psi Client with oob Data for, i.e.
URLs, iam lost on how to decode them.

i have the callback for messages setup:

sub doMessage {
my $reference = shift;
my $message = shift;

my $mfrom   = $message->GetFrom()  || "";
[...]

Now, i thought, its an x Namespace, so it would be appropriate to get the
whole jabber:x:oob Entitity via:
my @mxspace = $message->GetX() || "";
I expected any Ref to handle the OOB Data, but all i got was a simple
"1". Since iam still a bit of unexperienced in advanced Perl Techniques
i tried to change the Context, i.e. to Scalar, Array and Hash, but none
seemed to work. Also trying to directly access the $message Object with
Methods which are valid for jabber:x:oob Objects failed, ofcourse.

Can someone enlighten me?


TIA,
-mc

-- 
| Rico -mc- Gloeckner |   <[EMAIL PROTECTED]>   | {ICQ:99798577} |
| http://www.ukeer.de | mc (at) irc.tu-ilmenau.de | <[EMAIL PROTECTED]> |
| Jabber: [EMAIL PROTECTED] |  :wq
___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



Re: [JDEV] How To Get A Remote Jabber Clients IP

2002-03-22 Thread Thomas Muldowney

Not without them msging it to you.  Major design decision in the system.

--temas


On Fri, 2002-03-22 at 12:11, Melvin Tucker wrote:
> Is it possible to get the IP address of a contact in your roster
> 
> 
> 
> Melvin Tucker
> [EMAIL PROTECTED] - Jabber ID
> [EMAIL PROTECTED] - MSN Instant Messenger
> MelvinTucker  - AOL Instant Messenger
> Meltucker1- Yahoo Messenger
> 
> __
> MyBuddies Instant Meesenger - Comming Soon
> myBuddies Instant Messenger is aimed at providing an easy to use
> Interface yet very powerful features not found in other
> IM clients.
> 
> 
> ** PLEASE NOTE **
> This E-Mai
> ___
> jdev mailing list
> [EMAIL PROTECTED]
> http://mailman.jabber.org/listinfo/jdev


___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



[JDEV] Message distribution?

2002-03-22 Thread Captain Wasted


Is there anything out there that is able to do some sort of message 
distribution, either through a transport or filter. Our goal is to create a 
tech support center where customers would contact our server and the 
distribute the message to multiple support people. Some type of message load 
balancing?

Keith
The R&D Group.

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com

___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



Re: [JDEV] Net::Jabber and oob

2002-03-22 Thread DJ Adams

On Fri, Mar 22, 2002 at 08:10:23PM +0100, Rico -mc- Gloeckner wrote:
> Now, i thought, its an x Namespace, so it would be appropriate to get the
> whole jabber:x:oob Entitity via:
> my @mxspace = $message->GetX() || "";
> I expected any Ref to handle the OOB Data, but all i got was a simple
> "1". Since iam still a bit of unexperienced in advanced Perl Techniques
> i tried to change the Context, i.e. to Scalar, Array and Hash, but none
> seemed to work. Also trying to directly access the $message Object with
> Methods which are valid for jabber:x:oob Objects failed, ofcourse.
> 

Hi

after the above line, all you need is something like this:

$mxspace[0]->GetURL()

and

$mxspace[0]->GetDesc()

to access the two bits of info carried in the x:oob extension

dj
___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev



Re: [JDEV] Question on using NIO with SAX

2002-03-22 Thread Joe Hildebrand


Wouldn't there still be a thread per parser then, since the SAX parser
would block in the InputStream?  In which case, why bother with NIO?

Note: since NIO is currently limited to 64 sockets at a time on
windows, the actual perf gain is going to be small, if any, for that
platform.


Chris Chen <[EMAIL PROTECTED]> writes:

> Well, I'm thinking of another way of wrapping a underlying stream
> into a "faked blocking IO stream" for SAX.
>
> What you can do is have NIO on one side, put all the data into a
> channel, then create a data buffer processor that reads in the data
> from the channel.  This processor will also implement the
> InputStream interface so that it can be read...  Then you can just
> pass the wrapped stream to the SAX handler.  This way, SAX still
> thinks it's using a traditional stream but the underlying
> implementation is actually using the new NIO.
>
> I think this might work, but you do have to implement your own
> blocking mechanism for the read() operation.
>
> Chris
>
> ___
> jdev mailing list
> [EMAIL PROTECTED]
> http://mailman.jabber.org/listinfo/jdev

-- 
Joe Hildebrand
Chief Architect
Jabber, Inc.
http://www.jabber.com/

___
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev