R
Richard Maher
Hi,
I hope someone can help with an architecture/infrastructure strategy
question that is a lot less philisophical then it might originally sound.
(It looks long but the question(s) is straight-forward)
The immutables are: -
1) I'm running in a Web browser and and am using a combo of html and
Javascript for the user interface.
2) There is an Applet that has established and authorized a Socket
connection back to a non-Java server
3) Data/Messages are exchanged in the form of Byte Arrays (ie Records)
4) The customer doesn't want to "Just do it all in Java"
5) I am not interested in hearing about XDR or IDL, and if a given
application wants to use XML then good-luck to them, I will not stop them,
but for those of you left who are willing to think outside of the box,
please continue.
An example of what might happen is, the user enters an Employee Number and
as part of the validation a "Get Employee" message is sent to the server and
in response either an "Employee Details" or an "Error" message will be
returned. (For argument's sake let's adopt the convention that the first two
bytes of the message will be reserved for Message Id follow by a
message-specific body. "10" is Employee request, "11" is Employee Details
response and "99" is Lookup Error)
Anyway, if a "11" message comes back then we know 200 bytes of data will
follow which might have a Surname in a specific Character set, an integer
(little-endian) for base salary, and all the other crap that we all have.
Am I correct in assuming that there is simply no way that Javascript, and
its "var =" semantics, can deal with the complexities of character-set an
integer-endian issues, and that one must call back to Java-proper with the
document.applet.method() functionality?
(The rest of this post assumes that the answer to that question is a
rsounding "YES". If the answer is in fact "NO" then please ignore the rest
of this post and just show me how to do it in Javascript/html
The problem I'm faced with now is that I'm the infrastructure/middleware guy
and I have no idea about an individual or specific Application's message
passing and formatting requirements. I have established an application
neutral, or generic, link to the host and authorized application access and
I have made available the conduit for interacting with the server code, but
I simply don't know what your subsequent messages will look like or what
they with contain. I give you a read method and a write method (and a
lovely sendUrgentData() method) but you have to provide the Class for
packing and unpacking the messages :-( How do I make your lovely
application-sepcific scatter/gather methods available to your Javascript/htm
when I insist on controlling/owning the Applet?
The short answer is obviously let the Application-specific code own the html
object tag and the applet definition and just let them include/import my
Package into their classes, but I'd rather not, if that's all the same with
you
Can my Applet dynamically load a Class? If I get an Applet Parameter that
says PAYROLL can I not load codebase()payroll.class? OK, forget about my
applet loading the PAYROLL class; is there another way for the
Application-specific programmers to load their PAYROLL class into the JVM
and make them available to Javascript/html (who in turn will call my
send/recieve)?
Perhaps a second Applet? How do they know about each other? Is there
something in DOM that let's them share context? Is dynamic scripting the
answer?
If I don't get any worthwhile advice other than "Simply relinquish control
of the Applet and ship a normal Class" then I'm just gonna pout and
reproduce the same infrastructure (Socket and authorization) code with
*every* package that wants to use it! Cos' that's the kind o' guy I am
Cheers Richard Maher
PS. I really like the look of nio sockets and the endian and charset
qualities of the buffers! But I have taken good advice and have stuck with
the IO class and .net sockets. I am using getbytes(charset) for strings and
will REVERSE() work the endian magic or will I have to do that myself?
Data*Stream also looked good! (But only if they talk to each other, right?)
PPS. It's a bit scary that I haven't stumbled across a Scaled Integer
class/primitive/necessity! Please don't tell me that Java uses floating
point primitives for Money. (Note to self: - What does Number class do?)
PPPS. Sorry, I know even less about Javascript than I do about Java. Doh!
I hope someone can help with an architecture/infrastructure strategy
question that is a lot less philisophical then it might originally sound.
(It looks long but the question(s) is straight-forward)
The immutables are: -
1) I'm running in a Web browser and and am using a combo of html and
Javascript for the user interface.
2) There is an Applet that has established and authorized a Socket
connection back to a non-Java server
3) Data/Messages are exchanged in the form of Byte Arrays (ie Records)
4) The customer doesn't want to "Just do it all in Java"
5) I am not interested in hearing about XDR or IDL, and if a given
application wants to use XML then good-luck to them, I will not stop them,
but for those of you left who are willing to think outside of the box,
please continue.
An example of what might happen is, the user enters an Employee Number and
as part of the validation a "Get Employee" message is sent to the server and
in response either an "Employee Details" or an "Error" message will be
returned. (For argument's sake let's adopt the convention that the first two
bytes of the message will be reserved for Message Id follow by a
message-specific body. "10" is Employee request, "11" is Employee Details
response and "99" is Lookup Error)
Anyway, if a "11" message comes back then we know 200 bytes of data will
follow which might have a Surname in a specific Character set, an integer
(little-endian) for base salary, and all the other crap that we all have.
Am I correct in assuming that there is simply no way that Javascript, and
its "var =" semantics, can deal with the complexities of character-set an
integer-endian issues, and that one must call back to Java-proper with the
document.applet.method() functionality?
(The rest of this post assumes that the answer to that question is a
rsounding "YES". If the answer is in fact "NO" then please ignore the rest
of this post and just show me how to do it in Javascript/html
The problem I'm faced with now is that I'm the infrastructure/middleware guy
and I have no idea about an individual or specific Application's message
passing and formatting requirements. I have established an application
neutral, or generic, link to the host and authorized application access and
I have made available the conduit for interacting with the server code, but
I simply don't know what your subsequent messages will look like or what
they with contain. I give you a read method and a write method (and a
lovely sendUrgentData() method) but you have to provide the Class for
packing and unpacking the messages :-( How do I make your lovely
application-sepcific scatter/gather methods available to your Javascript/htm
when I insist on controlling/owning the Applet?
The short answer is obviously let the Application-specific code own the html
object tag and the applet definition and just let them include/import my
Package into their classes, but I'd rather not, if that's all the same with
you
Can my Applet dynamically load a Class? If I get an Applet Parameter that
says PAYROLL can I not load codebase()payroll.class? OK, forget about my
applet loading the PAYROLL class; is there another way for the
Application-specific programmers to load their PAYROLL class into the JVM
and make them available to Javascript/html (who in turn will call my
send/recieve)?
Perhaps a second Applet? How do they know about each other? Is there
something in DOM that let's them share context? Is dynamic scripting the
answer?
If I don't get any worthwhile advice other than "Simply relinquish control
of the Applet and ship a normal Class" then I'm just gonna pout and
reproduce the same infrastructure (Socket and authorization) code with
*every* package that wants to use it! Cos' that's the kind o' guy I am
Cheers Richard Maher
PS. I really like the look of nio sockets and the endian and charset
qualities of the buffers! But I have taken good advice and have stuck with
the IO class and .net sockets. I am using getbytes(charset) for strings and
will REVERSE() work the endian magic or will I have to do that myself?
Data*Stream also looked good! (But only if they talk to each other, right?)
PPS. It's a bit scary that I haven't stumbled across a Scaled Integer
class/primitive/necessity! Please don't tell me that Java uses floating
point primitives for Money. (Note to self: - What does Number class do?)
PPPS. Sorry, I know even less about Javascript than I do about Java. Doh!