[5268] in java-interest
java-interest-digest V1 #72
daemon@ATHENA.MIT.EDU (owner-java-interest-digest@java.su)
Sun Feb 4 16:16:32 1996
From: owner-java-interest-digest@java.sun.com
Date: Sat, 3 Feb 1996 06:41:41 -0800
To: java-interest-digest@java.sun.com
Reply-To: java-interest@java.sun.com
java-interest-digest Saturday, 3 February 1996 Volume 01 : Number 072
In this issue:
Re: stack
Problem to detect lostFocus in TextField
Re: Is 'new' really necessary?
Re: GridBagLayout, and other layout problems.
threads move in mysterious ways
Re: FileDialog bugs!
Re: serial port?
Re: java.awt.ps
RE: Netscape security => lame applets
Re: Ports to other Unix OS?
FutureTense Texture
HTML Post equivalent in Java?
Re: Is 'new' really necessary?
Re: Ports to other Unix OS?
Re: Is 'new' really necessary?
Applet in frame / UDP works
java.awt.Component
IBM Java Activities
[none]
Pinball
Re: Netscape security => lame applets
----------------------------------------------------------------------
From: "COLLINS-LEE" <collinsl@norcmail.uchicago.edu>
Date: Fri, 02 Feb 96 16:03:29 CST
Subject: Re: stack
Paul,
It took a while to reply but here it is. Hope this helps.
class CurrentDirectory extends Applet
{
Stack theStack;
CurrentDirectory()
{
theStack = new Stack();
}
public String currentDirectory()
{
if (theStack.empty())
return null;
// peek() returns what is at the TOP of the stack
Object o = theStack.peek();
if ( o instanceof String )
{
// we know this assignment works because o IS an
instance of String - IT IS A STRING
String str = o;
return str;
}
else // if its NOT a String then its not a Directory so
return null
{
return null;
}
};
public void pushDirectory(String theDir)
{
theStack.push(theDir);
}
public String popDirectory()
{
// check to see if anything is on the stack
if (theStack.isEmpty())
return null;
// Pop the thing off the stack
Object o = theStack.pop();
// see if its a String
if ( o instanceof String )
{
// we know this assignment works because o IS an
instance of String - IT IS A STRING
String str = o;
return str;
}
else // if its NOT a String then its not a Directory so
return null
{
return null;
}
}
}
______________________________ Reply Separator _________________________________
Subject: stack
Author: ochs@ee.vill.edu (Paul Ochs) at INTERNET
Date: 1/28/96 11:27 AM
hello,
Can anyone send some info about java.util.stack?
Demonstrations, sample code, doc, etc... anything.
thanks
paul
//----------------------------------------------------------------------
class LeeCollins extends JavaDeveloper implements IllustriousJavaCode
{
public LeeCollins()
{
MailAddress ma =
new MailAddress("collinsl@norcmail.uchicago.edu");
}
}
//----------------------------------------------------------------------
------------------------------
From: Kenneth Cheng <kcheng@CS.Stanford.EDU>
Date: Fri, 2 Feb 1996 14:37:01 -0800 (PST)
Subject: Problem to detect lostFocus in TextField
When I use button and choice box, I have no problem to detect the lostFocus
status. However, I am not able to execute my lostFocus method in my TextField
object. It seems that TextField does not recognize lostFocus. Is it a bug or
I am doing something wrong. I am currently using the beta version in Win95.
Help!
------------------------------
From: Bruce Chee <bruce@tech.singalab.com.sg>
Date: Sat, 3 Feb 1996 07:39:52 +0700 (THAIST)
Subject: Re: Is 'new' really necessary?
On Fri, 2 Feb 1996 kkobashi@ix6.ix.netcom.com wrote:
> Can someone tell me why the 'new' keyword was used in Java?
>
> Given:
> (a) Date d = new Date(CurrentTime); // Java compiler likes
> (b) Date d(CurrentTime); // Java compiler doesn't like
> (c) Date d; // Java compiler likes
>
......stuff deleted...
>
> I hope you see my point. An instanciation is an instanciation.
> Why must I think about a "new" object?
>
I would like to do the following...without declaring any extra variables...
class Big {
Big() {}
}
class Small extends Big {
Small() {}
}
public class Test{
Test() {
Big g=new Small();
}
}
Perhaps this is one of the reasons for having 'new'?
Bruce Chee
> Kerry Kobashi
> Kobashi Computing
>
>
> -
> This message was sent to the java-interest mailing list
> Info: send 'help' to java-interest-request@java.sun.com
>
------------------------------
From: eea@ncgr.ncgr.org (Ethan E. Allen)
Date: Fri, 2 Feb 1996 16:39:57 -0700
Subject: Re: GridBagLayout, and other layout problems.
James,
You may want to try a new layout manager that has been created
called PackerLayout. It pretty intuitive and easy to follow.
You can find the code, and description, at:
http://www.geom.umn.edu/~daeron/apps/ui/pack/gui.html
Has some good examples including exactly what you are looking for.
Ethan
------------------------------
From: andruid@SLINKY.CS.NYU.EDU (Andruid Kerne)
Date: Fri, 2 Feb 96 19:15:15 EST
Subject: threads move in mysterious ways
>>>
Subject: Can you write a selfish thread that does graphics?
I tried to write a graphical version of the "selfish thread" program in the
Java tutorial, where the selfish thread doesn't call sleep() but waits in a
loop, then repaints itself, then goes back to a busy loop, all 1000 times.
This is on Solaris where the text-based "selfish thread" program clearly
shows that the selfish thread doesn't give up control once it is running.
But in graphics mode it wasn't all that selfish--it time sliced just fine.
Hence my question: Does a call to one of the graphics routines
(in my case g.fillOval(...)) give another thread a chance to butt in? Is
that well-defined or just an artifact of the Solaris implementation?
>>>
in fact, quite a bit abou threads is not clearly documented, or not
documented at all. behaviours do not seem to be identical from
Appletviewer to Netscape, and from platform to platform. my
intuition, maybe someone who *knows* will confirm or deny, is that
this lack of documentation is a "cover" for software that is in a
state of flux on many levels. have you noticed that there is *NO*
netscape documentation about their Java implementation. as if it
works just like Sun's :-)!
- --
Regards,
Andruid Kerne
NYU Media Research Laboratory
--and also--
Creative Media Cauldron
http://c4dm.nyu.edu/andruid/
The distinctions between artists and engineers -- between content
developers and programmers -- are entirely artificial.
------------------------------
From: "Walter Szewelanczyk" <Walter@adco.com>
Date: Thu, 1 Feb 1996 08:40:25 +0000
Subject: Re: FileDialog bugs!
Hi Glenn,
The new release should take care of the FileDialog problems for win32
Walt
********************************************************************************************
Walter Szewelanczyk Technical Director
Walter@adco.com NET VENTURE, Inc.
http://www.adco.com
"One must stay in a very RIGID state of FLEXABILITY"
********************************************************************************************
------------------------------
From: "Walter Szewelanczyk" <Walter@adco.com>
Date: Thu, 1 Feb 1996 09:51:46 +0000
Subject: Re: serial port?
On Wed, 31 Jan 1996 19:04:51 -0500 Chris Dobbs
> Can I read from a serial port via java?? Lots of nice
> stream stuff under io but nothing about hooking it up
> to anything.
I agree I also could use access to a serial port. I have some
hardware to controll/simulate that connects to the computer via the
serial port.
just my two cents worth
Walt
P.S. I have had trouble getting mail from the group for the last 2
days so if anyone had an answer to the available drives and current
working directories on those drives to the group I didn't get it.
:-(
********************************************************************************************
Walter Szewelanczyk Technical Director
Walter@adco.com NET VENTURE, Inc.
http://www.adco.com
"One must stay in a very RIGID state of FLEXABILITY"
********************************************************************************************
------------------------------
From: Sun Java Info <hotjava@genome.kku.ac.th>
Date: Sat, 3 Feb 1996 07:50:56 +0700 (GMT+0700)
Subject: Re: java.awt.ps
On Fri, 2 Feb 1996, Chris Gokey wrote:
> Does anyone know a a postscript viewer for Windows that
> will work?
ghostscript should help you, the sites are below
- --------------------------------------------------------
There are now 2 distinct branches of ghostscript: GNU and Aladdin.
Both may be used freely in non-commercial environments, but Aladdin
gs has strict rules for commercial usage.
You can always get the current version of GNU Ghostscript by Internet
FTP from
ftp.cs.wisc.edu:/pub/ghost/gnu/ghostscript*NNNN*
or
/afs/cs.wisc.edu/public/pub/ghost/gnu/ghostscript*NNNN*
or from any of the GNU distribution sites, such as
ftp.uu.net:/systems/gnu
or
gatekeeper.dec.com:/pub/GNU
where NNNN is the version number.
- ------------------------------------------------
Hope this help, cheer!
Chaisiri Wongkham
------------------------------
From: Cay Horstmann <horstman@jupiter.SJSU.EDU>
Date: Fri, 2 Feb 1996 17:20:43 -0800
Subject: RE: Netscape security => lame applets
Well, let's see. I go to http://java.sun.com/applets/index.html. I click =
on "applets we've written that Netscape Navigator 2.0 can run". I go to =
the stock ticker applet =
http://java.sun.com/applets/applets/StockDemo/index.html. There isn't a =
date, except for the statement "The stock data is taken from a snapshot =
of the stock market activity on December 8, 1995", so it seems fair to =
assume that it was written after that.=20
The Web page then goes on to say "These quotes can be obtained (via a =
URL) from any HTTP server that keeps a database of stock quotes."=20
That is plainly false for Netscape Navigator 2.0. Of course, one can =
make it work with a proxy server, and it may well be doable with HotJava =
once it works for the 1.0 Java release. (For that matter, it might still =
have been true on December 9. I don't remember when NN2.0B4 came out.)
Let's hope someone rewrites that page to be a little clearer about what =
would be involved in writing such an applet.=20
Cay
horstman@cs.sjsu.edu
- ----------
From: D'Arcy Smith[SMTP:darcy@arcs.bcit.bc.ca]
Sent: Friday, February 02, 1996 4:54 PM
To: Cay S. Horstmann
Subject: Re: Netscape security =3D> lame applets
Cay S. Horstmann wrote:
> Also, when you turn to the Sun page that explains the stock ticker
> applet, they suggest that an applet would be able to directly read
> from a URL with stock information. Looks like Sun needs to take some
> time to get its FAQs straight.
1) look at the date (it's an Alpha HotJava applet).
2) It depends on how your browser is configured (if you can configure =
it!)
..darcy
- --=20
D'Arcy Smith, Systems Analyst
Applied Research in Computer Systems (ARCS) Laboratory
British Columbia Institute of Technology (BCIT), Burnaby, BC, Canada
E-Mail: darcy@arcs.bcit.bc.ca URL http://www.arcs.bcit.bc.ca
Tel: (604) 432-8281 Fax: (604) 436-1297
------------------------------
From: hassan@scndprsn.Eng.Sun.COM (Hassan Schroeder)
Date: Fri, 2 Feb 1996 17:22:05 -0800
Subject: Re: Ports to other Unix OS?
Ryan Bruner <rbruner@svr1.corpnet.com> writes:
| Are there any attempts to port Java to other Unix operating systems? It
| would seem to me that porting Java (at least the interpreter and compiler)
| to another Unix would be a lot easier to do than porting it to Windows
| and Mac. And yet, there appears to be no attempt at this point.
And yet, there appears to be -
http://java.sun.com/Mail/external_lists.html
- - *some* activity :-)
(and if anyone knows of something that should be added to this page,
please let me know!)
FWIW,
H*
= Hassan Schroeder = hassan@Eng.Sun.COM ======| 415-473-7106 (voice)=
= Webmaster, JavaSoft ========================| 800-408-9864 (pager)=
=[ Java(tm): Programming for the Internet - http://java.sun.com/ ]=
------------------------------
From: BC Krishna <bc@futuretense.com>
Date: Sat, 03 Feb 1996 18:07:33 -0500
Subject: FutureTense Texture
Hi folks,
On Monday this week, we announced FutureTense Texture, a Java-based next
generation Internet publishing system. Texture has two parts: a Windows
'95/NT (Macintosh to follow) based authoring tool and a Java-based viewer.
The Texture authoring tool has an interface that feels very much like
high-end desktop publishing tools like QuarkXPress and PageMaker, and
enables graphic designers to create terrific looking, highly interactive
documents without writing any HTML or Java code.
Among many other things, Texture supports:
- arbitrary placement of text, graphics and image anywhere on the page
- layering of objects, including transparency
- content drawn from multiple, distributed Web sites
- content encoded in HTML, GIF or JPEG
- a rich set of interactive behaviors
- time-based content updates
...
No, I do not want to turn this into a sales pitch, but I thought that folks
interested in Java-based stuff would be interested in Texture. Here are some
pointers:
http://www.futuretense.com The FutureTense Home Page
and some nifty documents created using Texture. You'll need a Java-enabled
browser (like Netscape Navigator 2.0). And for those of you that have a copy
of a JDK 1.0-based HotJava, try it out and let us know if it works!
http://www.futuretense.com/Gazette/Gazette.html
http://www.futuretense.com/SportsPage/SportsPage.html
http://www.futuretense.com/Texture/Texture.html
And, as some in this list are known to say,
Have fun!
cheers, bc
------------------------------
From: David Lipscomb <dlipscom@mbed.com>
Date: Fri, 02 Feb 1996 20:27:26 -0800
Subject: HTML Post equivalent in Java?
Is it possible to do the equivalent of an HTML post in java? Thanks in
advance!
- --
David Lipscomb
dlipscom@mbed.com
------------------------------
From: Mete Senocak <msenocak@arachnid.microweb.com>
Date: Fri, 02 Feb 1996 21:19:00 -0800
Subject: Re: Is 'new' really necessary?
Hi Kerry:
kkobashi@ix6.ix.netcom.com wrote:
>
> Can someone tell me why the 'new' keyword was used in Java?
> It appears to me that its only use is as a token to
> denote that a class instanciation is coming up next.
> It seems redundant in that regard.
>
> Given:
> (a) Date d = new Date(CurrentTime); // Java compiler likes
> (b) Date d(CurrentTime); // Java compiler doesn't like
> (c) Date d; // Java compiler likes
>
No, it's not redundant. It works the same way as malloc() in C. It allocates
memory for the "new" object. When you type "Date d;", you only tell the
compiler what type of data you are introducing, but no physical memory is
allocated yet. First with "Date d = new (Date(CurrentTime);" the compiler
allocates memory space for the "new" instance of the class Date, and that new
instance is an object with the name "d". Now you can store data in it and/or use
its instance methods.
I hope this makes the thing a bit clearer for you.
Best regards,
- -Mete
------------------------------
From: Matthew James Marnell <marnellm@portia.portia.com>
Date: Sat, 03 Feb 1996 00:20:37 -0500
Subject: Re: Ports to other Unix OS?
:>
:>Are there any attempts to port Java to other Unix operating systems? It
:>would seem to me that porting Java (at least the interpreter and compiler)
:>to another Unix would be a lot easier to do than porting it to Windows
:>and Mac. And yet, there appears to be no attempt at this point.
:>Specifically, we need it ported to BSDi, or a Unix that can be run on
:>an Pentium-based machine. I don't understand why it isn't even ported to
:>Solaris x86.
Beta 1 has been ported to Linux. I'm still waiting on getting
1.0 FCS (or whatever it's called) so I can start working on it
under bsd/os. There is a group of people @ java-port-bsd@portia.com
who work on ports to BSD/OS, NetBSD and Freebsd in their spare time.
To subscribe to it send a message with the word 'subscribe' in
the body to java-port-bsd-request@portia.com. Has anyone actually
gotten the final source release from Sun yet. It's been over a
week and still no response.
Matt
------------------------------
From: Jonathan Locke <jonl@speakeasy.org>
Date: Fri, 2 Feb 1996 23:05:17 -0800 (PST)
Subject: Re: Is 'new' really necessary?
> Realize that (c) above creates a null REFERENCE to a Date, and does
> not create a local Date object, as it would in C++. Also note that
> the following:
>
> Date a = new Date(CurrentTime);
> Date c;
>
> c = a;
>
> is equivalent to the following C++ code:
>
> Date& a = *(new Date(CurrentTime));
> Date& c = 0;
>
> c = a;
not quite...
delete &a;
;-)
Java sure is cool!
J
------------------------------
From: Tim Moons <tim@INnet.be>
Date: Sat, 03 Feb 1996 10:17:05 +0100
Subject: Applet in frame / UDP works
Hello, Java-goeroes,
Does anybody know if it is possible to run a thread on a frame ???
I want to run a clock on a frame that sends every minute a UDP-packet to
our server. The meaning is that this goes on when our client surfs on.
So, I want a different window as my netscape, that stays on top of the
screen, while I surf on.
BTW : I wrote a good working UDP-client and server, wich works online in
the Netscape !!!!
Thanks in advance,
Tim.....
- ----------------------------------------------------------------------- <<< Tim Moons, student industrial software-engineer >>>
<<< doing a finalpaper for INnet, subject : programming in 'JAVA'>>>
Email : tim@INnet.be
Phone : (Mon + thu) : +32 3 281 49 83 (at INnet)
: (wed - sun) : +32 11 42 11 17 (at home)
Fax : (mon + thu) : +32 3 281 49 85
<<< INnet BENELUX - Internet Service Provider >>>
- -----------------------------------------------------------------------
------------------------------
From: Howard Yen <hty1@cornell.edu>
Date: Sat, 03 Feb 1996 04:38:51 -0500
Subject: java.awt.Component
Could anyone tell me what does
requestFocus() in java.awt.Component do. I saw someones code that uses it.
// Start applet
public void start() {
for(int i=0; i<cols; i++)
for(int j=0; j<rows+4; j++) {
field[i][j] = 0;
oldfield[i][j] = -1;
}
level = 5;
pieces= 0;
neednewpiece = true;
lost = false;
// spawn gravity thread
(gravity = new Thread(this)).start();
requestFocus(); // ????????
}
It was a tetris game
_____________________________________________________________
Howard Yen Developer & GenesisJive Guy
WebGenesis, Inc. Phone: 607.255.1396
409 College Ave. email: howard@webgenesis.com
Ithaca NY, 14850 hty1@cornell.edu
http://www.webgenesis.com/
_____________________________________________________________
------------------------------
From: ian_brackenbury@vnet.IBM.COM
Date: Sat, 03 Feb 96 05:34:41 EST
Subject: IBM Java Activities
From: Ian Brackenbury : 24-8130, HLG19 in Hursley, UK
Subject: IBM Java Activities
For information - especially in light of the postings re OS/2 and re Win3.x
This is information published on the Web from the URL below - or you can get
there from IBM's home page of course, http://www.ibm.com/. In addition to the
statements below about OS/2, AIX, OS/400, MVS, and Win3.x we've also said
that there'll be Java capability in Lotus Notes. Why Win3.1 - customer
demand actually, and, although it ain't easy, we try to give them what they
want. We're busy! ...Ian.
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Web page: HTTP://ncc.hursley.ibm.com:80/javainfo/ (activities.html)
Java Environment Porting at IBM
<Image>
So Where Have We Got To?
In the latter half of 1995, a team led by IBM Fellow Mike Cowlishaw at IBM's
Hursley laboratory spent several months evaluating the Java environment. The
team initially ported one of the alpha versions to both OS/2 and AIX.
The Java environment for OS/2 and AIX
Today (26 January 1996), we are delighted to be releasing the JDK Beta1 for
OS/2 and JDK Beta1 for AIX.
The future
Work continues on ports to MVS and OS/400, as well as to Win16. The Win16 port
is proceeding pretty well. We have addressed the chief technical problems
(threads and long file names) by use of existing code and raw intelligence (!)
and are progressing towards the stage of a complete implementation of the JDK.
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ---------------------------------------------------------------
Ian Brackenbury, Snr Scientist (STSM): *Teamwork over Networks*
Ph:+44-1962-81-8130 (Fax +44-1962-843-420) Mail Pt 146, Hursley
Internet:ian_brackenbury@vnet.ibm.com Vnet:winvmd(brack)
------------------------------
From: Avner Aviad <aaviad@netvision.net.il>
Date: Sat, 3 Feb 1996 13:28:37 +-200
Subject: [none]
Mike wrote:
> For the first time I tried to bring up an app I usually run
> on Solaris under WinNT. The result was an exception:
> "AWT-Callback-Win32" java.lang.InternalError
> getGraphics implemented only for Canvas components
> I do indeed do getGraphics on non-component stuff, namely images.
> Am I not supposed to do this, and the Solaris implementation just
> lets me get away with it, or is it a bug in the WinNT version, or
> is this something that will be there eventually?
> While I'm at it...is anyone aware of other differences between
> platforms?
> -Mike
> P.S. I'm running the "production" version 1 on both platforms.
The difference you are reporting is actually a difference between the =
Beta version and the "shipping" SDK 1.0.
I have no idea if this is intended or a bug but note that this exception =
will happen even if you do not call getGraphics() directly but by way of =
calling repaint() on (say) a TextField force the ScreenUpdater to send =
an update(Graphics g) to this Component which in turn requires a =
getGraphics() call.
This is one of the unfortunate design errors that AWT seem to have. =
There is a complete imbalance in the implementation of native =
components. The programmer that attempts to subclass any of the non =
Canvas components will find out that the Win32 implementation will paint =
it's own controls without calling back into the Java code. This will =
prevent any special effects or changes to the painting of these =
controls.
Note that the same observation can be made to the handling of mouse =
events. One would have expected the AWT to consult a derived object =
mouse handling "override" before doing their own thing, but instead the =
AWT native object will handle most mouse events without any notification =
to the derived class.
Example:
One would like to have:
class MyField extends TextField {
...
public void paint(Graphics g) {
super.paint(g);
doMyOwnPainting(g);
}
public boolean mouseDown(Event e, int x, iny y) {
if(doMyOwnThing)
{
handleMyOwnMouseDown(x, y);
return true;
}
else
return super.mouseDown(e, x, y);
}
}
now, if this was a Canvas all of this works. In my opinion this is a =
very odd and unacceptable way to implement AWT.
Hope you got it.
What do you think ???
- --------------------------------------------------
Avner Aviad - Webra Software
EMail: aaviad@netvision.net.il
Web: http://www.netvision.net.il/php/aaviad
------------------------------
From: Jeff Marin <jmarin@mars.superlink.net>
Date: Sat, 03 Feb 1996 07:04:15 -0500
Subject: Pinball
Hey everyone,
I hope this isn't spamming but I think I've done something unique and
I'd like to share it. Check out
http://www.worktechs.com/pinball/pinball.html
for an example of what can be done with Java for animation/games.
Would love to answer any questions about the development/code for
this game.
- --
************************************************************************Jeff Marin jmarin@superlink.com
@Work Technologies http://www.worktechs.com
< "To err is human, to not learn JAVA mentally healthy but unavoidable!"
>
------------------------------
From: Doug Lea <dl@altair.cs.oswego.edu>
Date: Sat, 3 Feb 1996 09:36:29 -0500
Subject: Re: Netscape security => lame applets
Cay writes...
> Let's hope someone rewrites that page to be a little clearer about what
> would be involved in writing such an applet.
>
Well, I'm not allowed to rewrite the page :-) but I know of at least
one way to arrange for an Applet to communicate with an arbitrary
number of servers, so long as they are set up to allow this. (I'm not
sure that this method is to be encouraged, or even if it falls under
the intent of current Applet security policies, but it seems to work.)
The rules state that an applet can only communicate with the machine
that it was loaded from (as specified in the `codebase' of the applet
tag of the html document that launched it). So in order to communicate
with a lot of machines, you need to load a lot of Applets. One way to
do this is to write an html page loading an Applet (of a special form)
from every server that some main applet will need to communicate with.
Each of these Applets can support a public method that tries to open a
connection itself if it is to the same machine as it was loaded from,
but if not, to hunt around for (via getAppletContext().getApplets()) a
co-resident Applet that can. For example, all could be subclasses of:
import java.applet.*;
import java.util.*;
import java.net.*;
import java.io.*;
public class ConnectingApplet extends Applet {
/* Skeletal but functional example code: */
public URLConnection openURL(URL u) throws IOException {
if (u.getHost().equals(getCodeBase().getHost()))
return u.openConnection();
for (Enumeration e = getAppletContext().getApplets(); e.hasMoreElements();) {
Applet a = (Applet)(e.nextElement());
if (a instanceof ConnectingApplet) {
if (u.getHost().equals(a.getCodeBase().getHost()))
return ((ConnectingApplet)(a)).openURL(u);
}
}
/*
Note: At least in netscape-2b6, if the above Enumeration loop
runs before an Applet has been fully loaded, it will fail to
list it. To live with this, if you know one will be coming, you could
just keep re-trying until it becomes loaded, or eventually
time out and take evasive action. To help manage such things,
instead of relying on AppletContext, you could build
your own registry; for example like the one sketched out in
the tutorial in http://g.oswego.edu/dl/pats/aopintro.html
*/
return null; // or otherwise somehow fail
}
/*
Similarly, you could support
public Socket openSocket(String hostname, int port);
and so on.
*/
}
Each distinct applet has to be an instance of distinct subclass of
ConnectingApplet, to ensure that it is loaded from its codebase. All
but the main Applet might as well have an empty start() method; in
fact just:
public class ConnectingAppletAtServer1DotFooDotEdu extends ConnectingApplet {}
And occupy no screen space:
<applet
codebase="http://server1.foo.edu/classes"
code="ConnectingAppletAtServer1DotFooDotEdu"
height=0 width=0
>
</applet>
You could probably find a way to use JavaScript to dynamically
configure a set of helper connection applets needed by the main
applet. (I haven't tried this.) Or perhaps source the page from a CGI
that did this kind of configuration.
For example, if you standardized things so that every `friendly'
server S that you ever needed to deal with was guaranteed to have a
class `ConnectingAppletAtFullHostNameOfS', you could blindly generate
an html <applet> of the right form for each one you need.
In this case, the basic connection policy amounts to:
If a server S would like to be talked to by an arbitrary Applet, then
it must possess a ConnectingAppletAtFullHostNameOfS.class file in
a known location.
This is just a more structured variant of the current Applet rules,
adapted to a kind of `advertised service' design. (It is also fully
secure, at least in the sense that a server is accessible in this
fashion ONLY if it possesses such a class. Of course, if you like,
you can add additional protocols on top of this. For example,
requiring that accessible servers use https (secure http) and/or
handcrafting some other kind of authentication policy.)
Since distributed OO applications tend to be structured more along the
lines of peer-to-peer (internet style) architectures rather than
traditional stateless-client/bulky-server architectures (that the
current Applet rules most readily support), you'd probably end up
placing these classes on every single node of any large scale WWW
application. Among other things, this allows each node to maintain and
access its own state without swamping servers that would otherwise
have to manage state on behalf of each client, which doesn't scale
very well in many applications.
This all has the limitation that Applets cannot connect to new
machines that they learn about in the course of computation. This and
other problems could be addressed by adding a level of indirection,
and putting up CGIs on each friendly server that will dynamically
maintain and route requests to other known friendly servers if they
don't directly connect to the requested URL. And from there, you could
add routing metrics, nameservers, monitors, security protocols, ...
In the extreme, you could arrange things so that you need only load a
single RouterApplet along with each main Applet, and let the Router
handle all connections. Although having lots of them helps avoid
single-point failure and congestion problems.
I shudder to think of the large-scale consequences of such designs
though. It amounts to setting up a second-level internet routing
structure on top of the already existing base internet routing
structure. Ad-hoc Java versions like the above are unlikely (at
best!) to be as efficient, well-tested, well-structured, or
well-managed as the underlying ones. It would be nicer if Applet rules
were changed to allow Applets just to use underlying capabilities
under some tolerable set of security policies.
- --
Doug Lea | dl@cs.oswego.edu | dl@cat.syr.edu | 315-341-2688 | FAX 315-341-5424
Computer Science Dept, SUNY Oswego, Oswego, NY 13126 | http://g.oswego.edu/dl/
Also: Software Eng. Lab, NY CASE Center, Syracuse Univ, Syracuse NY 13244
------------------------------
End of java-interest-digest V1 #72
**********************************
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com