summaryrefslogtreecommitdiff
path: root/sj2
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commitfd069bee7e57ad529c3c0974559fd2d84ec3151a (patch)
treeef2eddeefb786feaf966d6a1c0c291872c0ae420 /sj2
parent04c1c754ab9d0ad07f2c5362d46597d13efe75c2 (diff)
initial import
Diffstat (limited to 'sj2')
-rw-r--r--sj2/doc/Todo.txt108
-rw-r--r--sj2/doc/concepts.html844
-rw-r--r--sj2/inc/sjapplet.hxx120
-rw-r--r--sj2/prj/d.lst15
-rw-r--r--sj2/source/inc/java_lang_object.hxx125
-rw-r--r--sj2/source/jscpp/makefile.mk103
-rw-r--r--sj2/source/jscpp/sjapplet.cxx601
-rw-r--r--sj2/stardiv/app/AppletMessageHandler.java148
-rw-r--r--sj2/stardiv/app/AppletProps.java221
-rw-r--r--sj2/stardiv/app/AppletViewer.java1025
-rw-r--r--sj2/stardiv/app/AppletViewerFactory.java77
-rw-r--r--sj2/stardiv/app/MsgAppletViewer.java220
-rw-r--r--sj2/stardiv/app/makefile.mk95
-rw-r--r--sj2/stardiv/applet/AppletExecutionContext.java415
-rw-r--r--sj2/stardiv/applet/Document.java182
-rw-r--r--sj2/stardiv/applet/DocumentProxy.java207
-rw-r--r--sj2/stardiv/applet/LiveConnectable.java76
-rw-r--r--sj2/stardiv/applet/makefile.mk110
-rw-r--r--sj2/stardiv/applet/resources/MsgAppletViewer.java166
-rw-r--r--sj2/stardiv/applet/resources/makefile.mk85
-rw-r--r--sj2/stardiv/controller/SjSettings.java261
-rw-r--r--sj2/stardiv/controller/makefile.mk102
-rw-r--r--sj2/stardiv/security/resources/MsgAppletViewer.java122
-rw-r--r--sj2/stardiv/security/resources/makefile.mk85
-rw-r--r--sj2/util/makefile.mk138
-rw-r--r--sj2/util/makefile.pmk85
-rw-r--r--sj2/util/target.pmk73
27 files changed, 5809 insertions, 0 deletions
diff --git a/sj2/doc/Todo.txt b/sj2/doc/Todo.txt
new file mode 100644
index 000000000000..6520abaa10a8
--- /dev/null
+++ b/sj2/doc/Todo.txt
@@ -0,0 +1,108 @@
+Erkenntnisse aus sj/sj1, die in sj2 beachtet werden mssen
+
+
+- Call von C++
+"javascript: ..." nicht wie event behandeln, insbesondere werden
+this und document nicht implizit als Search-Objekte gesetzt.
+
+
+- prototype Eigenschaft von Objekten:
+Manipuliert Klassen-Informationen, falls an einem beliebigen Objekt
+eine Property mit gleichem Namen angelegt wird, so gilt dieses
+Ueberschreiben jedoch nur fuer dieses eine Objekt !!!
+Im Sj/Sj1 Projekt ist dies jedoch nicht erfuellt !
+
+Beispiel:
+function Ctor() { ... }
+
+obj1 = new Ctor(); // obj1 obj2
+obj2 = new Ctor(); //-------------------------
+Ctor.prototype.toString = myToString; // myToString myToString
+obj1.toString = myToString2; // myToString2 myToString
+Ctor.prototype.toString = myToString3; // myToString2 myToString3
+
+
+- toString() und valueOf() Behandlung des BaseObj bei Type-Konversion
+
+========================================================================
+
+Bemerkungen zur Suchreihenfolge und zum Ueberladen von Funktionen:
+
+* fuer jede 'Klasse' (z.B. Math, Date, String) gibt es ein Konstruktor-
+ Objekt in der JavaScript-Umgebung.
+ In dem Konstruktor-Objekt werden die Properties der Klasse angelegt,
+ z.B. sin, cos.
+ Der Konstruktor setzt seine Properties an jedem neu erzeugten
+ Objekt. Daher hat z.B. jedes Date-Objekt eine (default-behandelte)
+ Property setMonth.
+ Zum Setzten der Properties des Konstruktor an das neu erzeugte
+ Objekt sollte die initProp()-Methode noch einen Bereich der zu
+ kopierenden Properties bekommen, damit nicht alle nachtraeglich
+ am Konstruktor-Objekt angelegten Properties auch am Objekt gesetzt
+ werden.
+
+* jedes Objekt haelt eine Referenz auf seinen Konstruktor (entweder die
+ vordefinierten Klassen wie Math, Date oder die Funktion mit der das
+ Objekt erzeugt wurde).
+
+* fuer die Suchreihenfolge gibt es folgende drei Moeglichkeiten:
+
+ - Default-behandelte Property:
+ aStrg = new String( "gulp" );
+ aStrg.toString() // --> verwendet toString-Property am
+ // String-Konstruktor (default-Behandlung)
+
+ - Default-Behandlung ueberladen am Konstruktor:
+ aStrg = new String( "gulp" );
+ String.prototype.toString = myToString; // UEBERLADEN !
+ aStrg.toString() // --> verwendet myToString-Funktion.
+ // Das prototype-Objekt wird am String-Ctor.
+ // angelegt und ueberschreibt daher die
+ // default-behandelte Property am Objekt !!!
+ // Der Interpreter muss dann noch an einem
+ // ggf. vorhandenen prototype-Objekt am
+ // Konstruktor nach der Property suchen.
+
+ - ueberladen am Objekt:
+ aStrg = new String( "gulp" );
+ String.prototype.toString = myToString; // am Ctor. ueberladen
+ aStrg.toString = myToString2;
+ aStrg.toString() // --> verwendet myToString2-Funktion.
+ // Die Property toString wird am Objekt
+ // ueberschrieben und somit das Flag, dass
+ // die default-Behandlung anzeigt, zurueck
+ // gesetzt. D.h. der Interpreter muss das
+ // prototype-Objekt des Konstruktors NICHT
+ // durchsuchen.
+
+
+========================================================================
+
+DEMNAECHST:
+
+Die Properties der Standard-Objekte (z.B. setSeconds() am Date)
+werden am prototype-Objekt des Konstruktors (z.B. DateCtor) angelegt.
+Bei der Suche nach Properties an einem beliebigen Objekt wird erst
+das Objekt durchsucht und anschliessend das prototype-Objekt des
+Konstruktors fuer das Objekt durchsucht. Dieses Verhalten gleicht
+dem Netscape-Verhalten (Stand 2.7.1997).
+
+ACHTUNG, AB 11.8:
+Das ist so nicht korrekt, da die entsprechenden Properties direkt
+am prototype-Objekt nicht bekannt sind. Die an den Objekten als
+Default geflagten Properties bilden daher das Netscape-Verhalten
+besser ab.
+
+
+========================================================================
+
+WEITERE OFFENE PROBLEME:
+------------------------
+
+ * this auf der Wiese funktioniert noch nicht korrekt
+
+ * Konversion von Typen ?
+
+
+
+
diff --git a/sj2/doc/concepts.html b/sj2/doc/concepts.html
new file mode 100644
index 000000000000..49f336b131d8
--- /dev/null
+++ b/sj2/doc/concepts.html
@@ -0,0 +1,844 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+ <TITLE></TITLE>
+ <META NAME="GENERATOR" CONTENT="StarOffice/4.0 (WinNT/Win95)">
+ <META NAME="AUTHOR" CONTENT=" ">
+ <META NAME="CREATED" CONTENT="19970401;13233926">
+ <META NAME="CHANGEDBY" CONTENT=" ">
+ <META NAME="CHANGED" CONTENT="19970529;8045806">
+</HEAD>
+<BODY>
+<H1>Stardivision erweiterte Java Grundkonzepte</H1>
+<H2><A NAME="Exceptions"></A>Exceptions:</H2>
+<P>Die Grundidee von Exceptions ist es einen Fehlerkontext
+aufzuspannen, der erst n&auml;her betrachtet werden mu&szlig;, wenn
+man Fehler korrigieren will. Der Programmcode sollte durch die
+Behandlung von Fehlern nicht undurchsichtig und unleserlich werden.
+Meiner Meinung nach sollten Exceptions deswegen auch nicht als
+zweiter Returnwert vergewaltigt werden.<BR><B>Ziel:</B> Nach dem
+Auftreten einer Exception sollte es m&ouml;glichst einfach sein das
+System in einen definierten arbeitsf&auml;higen Zustand zu
+versetzen.<BR>Es gibt grunds&auml;tzlich drei verschiedenen Arten von
+Exceptions. Diese unterscheiden sich durch den Zustand in dem sie das
+Objekt hinterlassen.</P>
+<OL>
+ <LI><P><A NAME="Undefined Exception"></A>Die von der Methode
+ benutzten Objekte sind in einem undefinierten Zustand. Jede auf dem
+ Objekt aufgerufene Methode mu&szlig; nach einer solchen Exception
+ nicht mehr ihre Spezifikation einhalten. Diese Exception wird im
+ folgenden mit &#132;Undefined Exception&#147; benannt. Dabei ist zu
+ beachten, da&szlig; keine weiteren <A HREF="#Resourcen">Resourcen</A>,
+ au&szlig;er die angegebenen, benutzt werden. Au&szlig;erdem werden
+ &#132;ReadOnly&#147; Resourcen nicht modifiziert.</P>
+ <LI><P><A NAME="Defined Exception"></A>Die von der Methode benutzten
+ Objekte sind in einem genau definierten Zustand, der aber von der
+ Zusicherung der Methode abweicht. Diese Exception wird im folgenden
+ mit &#132;Defined Exception&#147; benannt. Dabei ist zu beachten,
+ da&szlig; keine weiteren <A HREF="#Resourcen">Resourcen</A>, au&szlig;er
+ die angegebenen, benutzt werden. Au&szlig;erdem werden &#132;ReadOnly&#147;
+ Resourcen nicht modifiziert.</P>
+ <LI><P><A NAME="Transacted Exception"></A>Die von der Methode
+ benutzten Objekte sind in ihrem vorherigen Zustand, der aber von der
+ Zusicherung der Methode abweicht. Diese Exception wird im folgenden
+ mit &#132;Transacted Exception&#147; benannt. Dabei ist zu beachten,
+ da&szlig; keine weiteren <A HREF="#Resourcen">Resourcen</A>, au&szlig;er
+ die angegebenen, benutzt werden. Au&szlig;erdem werden &#132;ReadOnly&#147;
+ Resourcen nicht modifiziert. Diese Spezifikation trifft auch auf
+ &#132;Defined Exception&#147; zu, wegen ihrer Bedeutung f&uuml;hre
+ ich sie extra auf.</P>
+</OL>
+<P>Die Benutzbarkeit eines Objektes, nachdem eine Exception
+aufgetreten ist, ist vom obigen Typ der Exception abh&auml;ngig.</P>
+<P><FONT COLOR="#ff0000">Satz 1.1: Nachdem eine &#132;Undefined
+Exception&#147; aufgetreten ist, kann mit dem Objekt sowie allen
+&#132;ReadWrite&#147; Resourcen nicht mehr weiter gearbeitet werden.</FONT></P>
+<P><FONT COLOR="#ff0000">Satz 1.2: Nachdem eine &#132;Defined
+Exception&#147; aufgetreten ist, kann aufgrund des genau definierten
+Zustandes weiter gearbeitet werden.</FONT></P>
+<P><FONT COLOR="#ff0000">Satz 1.3: Nach einer &#132;Transacted
+Exception&#147; ist der gleiche Zustand wie vor dem Aufruf
+wiederhergestellt.</FONT></P>
+<P>Es sollten m&ouml;glichst nur &#132;Transacted Exception&#147;
+ausgel&ouml;st werden. Bei komplizierten Methoden l&auml;&szlig;t
+sich aber eine &#132;Defined Exception&#147; nicht immer vermeiden.
+Eine &#132;Undefined Exception&#147; deutet immer auf eine
+Programmierfehler hin. Der Typ der Exeption kann nur in Zusammenhang
+mit der Methode in der sie Auftritt ermittelt werden.</P>
+<P><FONT COLOR="#ff0000">Satz 1.4: Durch die Klasse der Exception
+kann niemals alleine der Typ (undefined, defined oder transacted)
+entschieden werden.</FONT></P>
+<H2><A NAME="Resourcen"></A>Resourcen (under construction)</H2>
+<P>Die Grundidee von Resourcen ist die Aufteilung eines Gebildes in
+weitere Einheiten. Auf diesen k&ouml;nnen dann verschiedene Auftr&auml;ge
+gleichzeitig arbeiten, wenn sie nicht dieselben Resourcen benutzen.
+Z.B. kann man in einer Textverarbeitung die einzelnen Dokumente als
+Einheiten betrachten. Auftr&auml;ge, die sich nur auf ein Dokument
+beziehen, k&ouml;nnen parallel zu anderen Dokumenten bearbeitet
+werden.<BR>Mit Resourcen sind im System bzw. der Applikation
+vorhandene Objekte, Services, Kan&auml;le ... gemeint, die zur Zeit
+nur von einem Thread benutzt werden k&ouml;nnen. Als Konsequenz
+m&uuml;ssen Resourcen einem Thread zugeordnet werden, bevor dieser
+sie benutzt.<BR><B>Ziel:</B> Es mu&szlig; m&ouml;glich sein, 1.
+Auftr&auml;ge parallel abzuarbeiten, 2. die Frage &#132;Warum k&ouml;nnen
+zwei Auftr&auml;ge nicht parallel arbeiten?&#147; beantwortet zu
+k&ouml;nnen.<BR>Es gibt verschiedene M&ouml;glichkeiten diese
+Zuordnung vorzunehmen. Zwei stelle ich kurz vor.</P>
+<OL>
+ <LI><P><A NAME="Prealloc Resource Konzept"></A>Eine Art der
+ Zuordnung ist das vorherige Anfordern aller f&uuml;r den Auftrag
+ ben&ouml;tigten Resourcen. Ist dies m&ouml;glich, kann der Auftrag
+ ohne weitere St&ouml;rungen ablaufen. Die Resourcen d&uuml;rfen
+ freigegeben werden, bevor der Auftrag beendet ist. Dies gilt
+ nat&uuml;rlich nur f&uuml;r nicht mehr verwendete Resourcen. Es darf
+ ebenfalls das Zuordnungsrecht von lesend und schreibend auf lesend
+ zur&uuml;ckgenommen werden. Diese Zuornungsart wird im weiteren mit
+ &#132;Prealloc Resource Konzept&#147; bezeichnet.</P>
+ <LI><P><A NAME="Ondemand Resource Konzept"></A>Eine andere Art der
+ Zuordnung ist das Anfordern der Resourcen, wenn sie ben&ouml;tigt
+ werden. Dabei kann es zu St&ouml;rungen kommen, wenn sich
+ verschiedene Auftr&auml;ge um die gleiche Resource bewerben. Die
+ Resourcen d&uuml;rfen freigegeben werden, bevor der Auftrag beendet
+ ist. Dies gilt nat&uuml;rlich nur f&uuml;r nicht mehr verwendete
+ Resourcen. Es darf ebenfalls das Zuordnungsrecht von lesend und
+ schreibend auf lesend zur&uuml;ckgenommen werden. Diese Zuornungsart
+ wird im weiteren mit &#132;Ondemand Resource Konzept&#147;
+ bezeichnet.</P>
+</OL>
+<P>Es gibt noch weitere M&ouml;glichkeiten Auftr&auml;ge zu
+bearbeiten, die die gleichen Resourcen benutzen. H&auml;ufig findet
+man solche L&ouml;sungen bei Datenbankanwendungen.<BR>In der
+folgenden Tabelle stehen sich die beiden Konzepte mit ihren Vor- und
+Nachteilen und ihren Anforderungen gegen&uuml;ber.</P>
+<TABLE WIDTH=100% BORDER=1 CELLPADDING=5 FRAME=BOX RULES=ALL>
+ <COLGROUP>
+ <COL WIDTH=85*>
+ <COL WIDTH=85*>
+ <COL WIDTH=85*>
+ </COLGROUP>
+ <THEAD>
+ <TR>
+ <TH WIDTH=33% VALIGN=TOP>
+ <P><BR></TH>
+ <TD WIDTH=33% VALIGN=TOP><DL>
+ <DD>Prealloc Resource Konzept </DD>
+ </DL>
+ </TD>
+ <TD WIDTH=33% VALIGN=TOP>
+ <DL>
+ <DD>Ondemand Resource Konzept </DD>
+ </DL>
+ </TD>
+ </TR>
+ </THEAD>
+ <TBODY>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Alle Resourcen m&uuml;ssen vor der Auftragsausf&uuml;hrung
+ bekannt sein.</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ <TD VALIGN=TOP>
+ <P>Nein</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Nicht mehr ben&ouml;tigte Resourcen d&uuml;rfen freigegeben
+ werden.</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Es kann zu Verklemmungen oder &#132;Races&#147; kommen.</TD>
+ <TD VALIGN=TOP>
+ <P>Nein</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>In Bearbeitung befindliche Auftr&auml;ge m&uuml;ssen, aufgrund
+ fehlender Resourcen, abgebrochen werden.</TD>
+ <TD VALIGN=TOP>
+ <P>Nein</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Der Zustand der Resourcen ist zu jedem Zeitpunkt der
+ Auftragsabarbeitung bekannt.</TD>
+ <TD VALIGN=TOP>
+ <P>Ja</TD>
+ <TD VALIGN=TOP>
+ <P>Nein</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Algorithmus zur Resourcevergabe.</TD>
+ <TD VALIGN=TOP>
+ <P>Einfach, da nur &uuml;berpr&uuml;ft werden mu&szlig;, ob alle
+ ben&ouml;tigten Resourcen verf&uuml;gbar sind.</TD>
+ <TD VALIGN=TOP>
+ <P>Komplex, da neben dem Anfordern von Resourcen auch noch
+ &uuml;berpr&uuml;ft werden mu&szlig;, ob das System <A HREF="#lebendig">lebendig</A>
+ ist.</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P>Parallelit&auml;t</TD>
+ <TD VALIGN=TOP>
+ <P>Hoch, da unabh&auml;ngige Auftr&auml;ge meistens nur lesend
+ auf gemeinsame Resourcen zugreifen.</TD>
+ <TD VALIGN=TOP>
+ <P>Sehr hoch, da die ben&ouml;tigten Resourcen erst angefordert
+ werden, wenn man sie braucht.</TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P ALIGN=LEFT>Meiner Meinung nach ist nur das &#132;Prealloc Resource
+Konzept&#147; ohne richtige Programmierwerkzeuge zur Entwicklung
+paralleler Algorithmen (z.B. Netzprogrammierung) wenigstens ein
+bi&szlig;chen beherschbar.</P>
+<P ALIGN=LEFT>Es stellt sich die Frage wie das &#132;Prealloc
+Resource Konzept&#147; in einem Komponenten-Modell und in einem
+Objekt-Environment integriert werden kann. Ein Objekt-Environment ist
+ein mehr oder weniger dynamische Menge von Objekten die miteinander
+in Verbindung stehen. Aus dem obigen Beispiel k&ouml;nnte man die
+Verbindung der Textverarbeitung zu ihren Dokumenten als
+Objekt-Environment bezeichnen. Ein Objekt in diesem Environment kann
+nun &uuml;ber seine Verbindungen mit anderen Objekten kommunizieren.
+Die Schnittstellen mit denen &uuml;ber die Verbindung kommuniziert
+wird nennt man Komponenten-Modell. Die Idee des Objekt-Environments
+ist es weitere Objekte m&ouml;glichst einfach zu integrieren. So
+k&ouml;nnten in unserem Beispiel weitere Dokumenttypen wie ein
+HTML-Dokument eingebunden werden. Die Schittstellen m&uuml;&szlig;ten
+nur dem, von der Textverarbeitung geforderten, Komponenten-Modell
+gen&uuml;gen. Liefert aber das Modell, wie heute &uuml;blich, keine
+Information &uuml;ber die ben&ouml;tigten Resourcen bei Benutzung der
+Schnittstellen, dann k&ouml;nnen Verklemmungen bzw. Inkonsistenzen
+nicht vermieden werden. Aus diesem Grunde ist es notwendig, das
+Resource-Konzept in das Komponenten-Modell zu integrieren.<BR><B>Ziel:</B>
+Es mu&szlig; ein Kompromi&szlig; zwischen hoher Nebenl&auml;ufigkeit
+und der damit verbundenen Komplexit&auml;t, sowie einfacher
+Programmierung und geringer Nebenl&auml;ufigkeit gefunden
+werden.<BR><B>Folgen:</B> In einem Objekt-Environment m&uuml;ssen die
+einzelnen Objekte also dynamisch auf Verbindungen zu Objekten mit
+hoher oder geringer Nebenl&auml;ufigkeit reagieren. Die Komplexit&auml;t
+dieser Aufgabe darf aber nicht in die Objekte verlagert werden, da
+von einem seriellen Objekt (bzw. dessen Programmierer) nicht die
+Steuerung nebenl&auml;ufiger Auftr&auml;ge verlangt werden
+kann.<BR><B>L&ouml;sungsansatz:</B> Die Behandlung der
+Nebenl&auml;ufigkeit wird nicht in einer einfachen Komponente
+implementiert. Das bedeutet sie mu&szlig; mit einer
+Default-Behandlung zufrieden sein, die minimale Nebel&auml;ufigkeit
+nach sich zieht. Eine Komponente kann sich aber in die Vergabe der
+Resourcen einmischen. So kann sie ihren Grad der Nebenl&auml;ufigkeit
+erh&ouml;hen. Dies ist dann aber auch mit erh&ouml;htem
+Implementationsaufwand zu bezahlen. Auf der anderen Seite macht es
+aber keinen Sinn serielle oder Komponenten mit zu gro&szlig;em
+Resourcebedarf einzubinden, wenn das Objekt-Environment danach
+praktisch nicht mehr lauff&auml;hig ist. Das bedeutet, da&szlig; das
+Objekt-Environment auch Forderungen bez&uuml;glich des Resourcebedarf
+an die Komponenten stellen darf.</P>
+<H3>Anforderungen</H3>
+<OL>
+ <LI><P ALIGN=LEFT>Es mu&szlig; ein Modell geben, in dem alle
+ vorhandenen Resourcen und deren Beziehung zueinander eingetragen
+ werden. Dadurch kann abgesch&auml;tzt werden, welchen Resourcebedarf
+ eine Komponente hat. Das &#132;Sch&auml;tzen&#147; ist w&ouml;rtlich
+ zu nehmen. (Im Zusammenhang mit <A HREF="#Security">Security</A>
+ wird man aber auch noch sehen, da&szlig; der Zugriff auf bestimmte
+ Resourcen nicht m&ouml;glich ist.) F&uuml;r das &#132;Prealloc
+ Resource Konzept&#147; gilt, es m&uuml;ssen mindestens die
+ ben&ouml;tigten Resourcen verf&uuml;gbar sein. Zur Not sind diese
+ alle.</P>
+ <LI><P ALIGN=LEFT>Eine nebenl&auml;ufige Komponente mu&szlig; in
+ jeder ihrer von au&szlig;en erreichbaren Methoden kontrollieren, ob
+ die entsprechenden Resourcen f&uuml;r sie angefordert wurden. Damit
+ serielle Komponenten diese Methoden nutzen k&ouml;nnen, k&ouml;nnen
+ die ben&ouml;tigten Resourcen angefordert werden, wenn vorher noch
+ <B>keine einzige</B> durch den ausf&uuml;hrenden Auftrag belegt war.
+ Zur Erl&auml;uterung: Serielle Komponenten belegen keine Resourcen.
+ Damit w&uuml;rde jeder Aufruf einer nebenl&auml;ufigen Komponente
+ scheitern. Um dies zu vermeiden, werden die Resourcen in der
+ nebenl&auml;ufigen Komponente angefordert.</P>
+ <LI><P ALIGN=LEFT>Serielle Komponenten m&uuml;ssen also damit
+ rechnen eine Fehlermeldung &uuml;ber nicht verf&uuml;gbare Resourcen
+ zu bekommen.</P>
+</OL>
+<H3>Szenarien</H3>
+<P>Von unserem bisherigen Beispiel ausgehend, gibt es eine
+Applikation in der sich drei Dokumente befinden. Ein serielles
+Textdokument, ein nebenl&auml;ufiges Tabellendokument und ein
+nebenl&auml;ufiges Pr&auml;sentationsdokument. Die Applikation selbst
+ist nebenl&auml;ufig. Die Relationen gehen von der Applikation zu den
+Dokumenten und umgekehrt. Die Dokumente kennen sich nicht.</P>
+<P>Fall 1:<BR>In das serielle Textdokument soll eine Zeichenfolge
+eingef&uuml;gt werden. Da es sich um eine serielle Komponente
+handelt, kann dieses Einf&uuml;gen nicht von selbst ausgel&ouml;st
+werden, es mu&szlig; von einer nebenl&auml;ufigen Komponente, hier
+die Applikation, angesto&szlig;en werden. Die Applikation ist aber
+verpflichtet die Resourcen vorher zu reservieren. F&uuml;r diese
+Absch&auml;tzung gibt es drei realistische M&ouml;glichkeiten. 1. Sie
+reserviert nur das Textdokument selbst. Das bedeutet, das
+Textdokument kann mit keinem anderen Objekt, auch nicht mit der
+Applikation, kommunizieren. 2. Die Applikation und das Textdokument
+wird reserviert. Es ist also nur der Zugriff auf die anderen
+Dokumente verwehrt. 3. Alle Objekte werden reserviert. Geht es nach
+dem &#132;Prealloc Resource Konzept&#147; mu&szlig; 3. gew&auml;hlt
+werden. Aufgrund von Sicherheitsbeschr&auml;nkungen werden wir aber
+noch sehen, das serielle Komponenten in ihrer Auftragsbearbeitung
+gestoppt werden k&ouml;nnen. Wenn der Abbruch eines Auftrags m&ouml;glich
+ist, spielt es aber keine Rolle durch wen (Resourcen oder <A HREF="#Security">Security</A>)
+dies geschehen ist.</P>
+<P>Fall 2:<BR>In das nebenl&auml;ufige Tabellendokument soll eine
+Zeichenfolge eingef&uuml;gt werden. Dieser Auftrag kann von der
+Applikation oder der Komponente selbst ausgel&ouml;st werden. In
+jedem Fall m&uuml;ssen die Resourcen vor der Auftragsbearbeitung
+reserviert werden. Man kann dies auch der Komponente &uuml;berlassen
+(siehe Anforderung 2.), aber man scheitert, wenn zwei Auftr&auml;ge
+zu einem Auftrag zusammengefa&szlig;t werden sollen. Dies passiert
+z.B., wenn der Auftrag &#132;Text ersetzen&#147; aus den Auftr&auml;gen
+&#132;L&ouml;schen&#147; und &#132;Einf&uuml;gen&#147; besteht. Auf
+jeden Fall wird nur das Tabellendokument selbst reserviert, da das
+Einf&uuml;gen keine Auswirkung auf andere Komponenten hat.</P>
+<P>Fall 3:<BR>In das nebenl&auml;ufige Tabellendokument wird der
+Applikationsname aus der Applikation eingef&uuml;gt. Dazu fragt das
+Tabellendokument nach den ben&ouml;tigten Resourcen, um den Namen zu
+holen und ihn einzuf&uuml;gen. Zum Holen wird die Applikation
+ben&ouml;tigt und zum Einf&uuml;gen das Tabellendokument. Beide
+m&uuml;ssen vor der Auftragsausf&uuml;hrung reserviert werden.</P>
+<P>Fall 4:<BR>Das nebenl&auml;ufige Tabellendokument f&uuml;gt
+selektierten Text aus dem seriellen Textdokument ein. Da das
+Textdokument seinen Resourcebedarf nicht mitteilt, wird einer aus
+Fall eins abgesch&auml;tzte Bedarf genommen. Man kann sehen, da&szlig;
+der Auftrag f&uuml;r alle drei M&ouml;glichkeiten erteilt werden
+kann. Seine Nebenl&auml;ufigkeit wird dann durch die Absch&auml;tzung
+eingeschr&auml;nkt. Zus&auml;tzlich m&uuml;ssen nat&uuml;rlich die
+ben&ouml;tigten Resourcen f&uuml;r das Einf&uuml;gen geholt werden.
+Alle m&uuml;ssen vor der Auftragsausf&uuml;hrung reserviert werden.</P>
+<H3>Programmierkonzepte</H3>
+<P>Welche Konzepte k&ouml;nnen in einer objektorientierten Sprache
+wie c++ oder Java oder einer prozeduralen Sprache wie Fortran oder
+&#132;c&#147; eingesetzt werden, um Nebenl&auml;ufigkeit zu
+erreichen. </P>
+<OL>
+ <LI><P>Es gibt zwei M&ouml;glichkeiten eine Resource zu belegen. Das
+ ist Exclusive (lesen, schreiben) und &#132;ReadOnly&#147;. Eine
+ Resource kann von mehreren Auftr&auml;gen benutzt werden, wenn diese
+ nur &#132;ReadOnly&#147; ben&ouml;tigen.</P>
+ <LI><P>Es gibt Resourcen f&uuml;r die man die Resourceverteilung
+ optimieren kann. Ein Objekt welches nicht ge&auml;ndert werden kann
+ und das w&auml;hrend der Auftragsausf&uuml;hrung immer konsistent
+ ist kann die Anforderung &#132;Exclusiv&#147; automatisch auf
+ &#132;ReadOnly&#147; abschw&auml;chen. Dies lohnt sich, wenn man
+ serielle Komponenten hat, die nichts &uuml;ber die
+ Resourceanforderungen mitteilen. Als Beispiel m&ouml;chte ich eine
+ Instanz der Klasse String in Java nennen. Ein weitere Art von
+ Resourcen fordern bei Auftr&auml;gen an sie 1. keine weiteren
+ Auftr&auml;ge an, 2. beenden sie die Auftr&auml;ge schnell und 3.
+ die Reihenfolge der &Auml;nderung an ihnen ist f&uuml;r andere nicht
+ wichtig. Dies ist zum Beispiel bei der Speicherverwaltung in c der
+ Fall. Diese Art der Resource darf zu einem sp&auml;teren Zeitpunkt
+ angefordert werden. Sie mu&szlig; sofort benutzt und wieder
+ freigegeben werden. Aus diesem Grund erledigen solche Resourcen das
+ Anfordern und Freigeben selbst.</P>
+ <LI><P>Bevor ein Auftrag ausgef&uuml;hrt werden kann, m&uuml;ssen
+ alle von ihm ben&ouml;tigten Resourcen reserviert werden. Dies ist
+ f&uuml;r einen Auftrag, der aus mehreren Teilauftr&auml;gen besteht,
+ aufwendig. Eine Optimierung kann darin bestehen die Teilauftr&auml;ge
+ asynchron auszuf&uuml;hren. Allerdings dringt diese Verhaltensweise
+ nach au&szlig;en. Z.B. m&uuml;ssen Auftr&auml;ge, die diesen dann
+ asynchronen Auftrag nutzen, dann auch asynchron sein. Eine weitere
+ Optimierung in der Autragsvergabe gibt es, wenn ein Autrag die
+ Resourcervergabe nicht &auml;ndert. Es ist dann m&ouml;glich mehr
+ Auftr&auml;ge vorzuziehen.</P>
+ <LI><P>Es mu&szlig; eine Queue geben, in die Auftr&auml;ge eingef&uuml;gt
+ werden k&ouml;nnen. Konfliktfreie Auftr&auml;ge k&ouml;nnen parallel
+ ausgef&uuml;hrt werden. <B>Achtung:</B> Der Resourcebedarf eines
+ Auftrages kann nur bestimmt werden, wenn alle ben&ouml;tigten
+ Resourcen &#132;ReadOnly&#147; reserviert werden k&ouml;nnen, es sei
+ denn kein vor ihm laufender Auftrag &auml;ndert die Resourcevergabe.
+ Warum ist das so? Ein Auftrag kann eine Resource dahingehend &auml;ndern,
+ da&szlig; danach andere Resourcen ben&ouml;tigt werden als vorher.
+ Der vorher bestimmte Bedarf ist dann falsch.</P>
+ <LI><P>Das Modell der Resourcen kann vergr&ouml;bert oder verfeinert
+ werden. In einem Tabellendokument k&ouml;nnte man jede einzelne
+ Zelle zu einer Resource machen. Um die Komplexit&auml;t der
+ Resourcemodells zu vereinfachen kann man aber weiter alle Zellen der
+ Dokument-Resource zuordnen. Wird also aus einer anderen Komponente
+ die Zelle angefordert, wird automatisch das ganze Dokument
+ reserviert. Daraus ergeben sich zwei Vorteile: 1. F&uuml;r den
+ Auftraggeber ist die Vergr&ouml;berung transparent und 2. Kann die
+ Resource an dem Objekt reserviert werden, das man ohnehin kennt.</P>
+ <LI><P>Das Resource-Modell ist hierarchisch. Eine Resource kann nur
+ einer Vergr&ouml;berung zugeordnet werden. Die Tabellenzellen d&uuml;rfen
+ also nur dem Tabellendokument zugeordnet werden. Daraus ergibt sich,
+ da&szlig; innerhalb einer solchen Hierarchie nebenl&auml;ufig
+ gearbeitet werden kann. Es d&uuml;rfen dann aber keine Resourcen
+ au&szlig;erhalb der Hierarchie benutzt werden, selbst wenn diese
+ reserviert sind.</P>
+</OL>
+<H3>Probleme und L&ouml;sungen</H3>
+<P>&Uuml;ber den Benutzer m&uuml;ssen Daten abgefragt werden, die
+&uuml;ber die Benutzung von Resourcen entscheidet (z.B.
+Dateiname):<BR>Ein solcher Auftrag mu&szlig; in zwei Teilauftr&auml;ge
+unterteilt werden. Der erste erledigt die Abfrage. Danach werden alle
+Resourcen freigegeben und dann fordert der zweite seine Resourcen und
+wird bearbeitet. Eventuell kann ein solcher Auftrag den vorherigen
+ersetzten, um zu verhindern das andere abh&auml;ngige Auftr&auml;ge
+vor dem Aufgeteilten bearbeitet werden.</P>
+<P>Ich habe mich bei einem Objekt als Listener angemeldet:<BR>Es gibt
+zwei Arten von Benachrichtigungen die ich erhalte. 1. Aufgrund der
+Ausf&uuml;hrung eines Auftrages und 2. einen Event von einer
+nebenl&auml;ufigen Komponente. Im ersten Fall &uuml;berpr&uuml;fe ich
+den Resourcebedarf und f&uuml;hre dann den Auftrag aus. Im zweiten
+Fall reserviere ich die ben&ouml;tigten Resourcen und f&uuml;hren den
+Auftrag aus. Sind Resourcen reserviert, ist dies Fall eins, sonst
+Fall zwei.</P>
+<P>Ich bin Broadcaster:<BR>Broadcaste ich aufgrund eines Auftrags tue
+ich nichts weiter. L&ouml;se ich den Broadcast ohne Auftrag aus, mu&szlig;
+ich die Resourcen f&uuml;r die Listener bestimmen und sie vor dem
+Aufruf reservieren. Die einzelnen Listener werden als unabh&auml;ngig
+betrachtet. Im Detail findet folgender Ablauf statt. 1. Die Liste der
+Listener wird kopiert. 2. F&uuml;r den ersten Listener wird der
+Resourcebedarf ermittelt.</P>
+<H3>Implementation</H3>
+<P>Die Basis f&uuml;r die Implementation des Resourcekonzeptes legen
+die Klassen <A HREF="stardiv.resource.Resource.html#Resource">Resource</A>,
+<A HREF="stardiv.resource.ResourceList.html#ResourceList">ResourceList</A>,
+<A HREF="stardiv.resource.ResourceLockException.html#ResourceLockException">ResourceLockException</A>,
+<A HREF="stardiv.resource.Task.html#Task">Task</A>, <A HREF="stardiv.resource.TaskManager.html#TaskManager">TaskManager</A>,
+<A HREF="stardiv.resource.TaskThread.html#Task">TaskThread</A>,
+<A HREF="stardiv.resource.ThreadData.html#ThreadData">ThreadData</A>
+und das Interface <A HREF="stardiv.resource.Resourceable.html#Resourceable">Resourceable</A>
+fest. Um ein Objekt in das Resourcekonzept einbinden zu k&ouml;nnen
+sind folgende Schritte notwendig:<BR>1. Das Resourceable Interface
+mu&szlig; implementiert werden. 2. Ein Konstruktor mit der dem
+Objekte zugewiesenen Resource. 3. Jede public Methode bekommt eine
+*_Resource(...) Methode zur Seite, mit der der Resourcebedarf
+ermittelt werden kann. 4. Innerhalb der public Methode wird der
+Resourcebedarf ermittelt. 5. Mit dieser Information die als
+ResourceListe vorliegt, wird eine Auftrag (Task) erzeugt. 6. Dieser
+Auftrag wird beim TaskManager angemeldet. 7. Nach der Zuteilung durch
+den TaskManager wird der Auftrag ausgef&uuml;hrt. 8. Alle Resourcen
+und der Auftrag werden wieder freigegeben.<BR>Diese Liste ist
+detailliert aber nicht <B>vollst&auml;ndig</B>. In der Klasse
+Resource steht imm eine Beispiel, welches aktuell sein sollte.</P>
+<P>Folgende Programmierrichtlinien gibt es, um das &#132;Prealloc
+Resource Konzept&#147; in Java zu integrieren:</P>
+<OL>
+ <LI><P ALIGN=LEFT>Es mu&szlig; das Interface <A HREF="stardiv.resource.Resourceable.html#Resourceable">Resourceable</A>
+ implementiert werden. Mit Hilfe dieses Interfaces kann der
+ Resourcebedarf eines Objektes erfragt werden. Diese Richtlinien
+ gelten dann auch f&uuml;r die Superklasse.</P>
+ <LI><P ALIGN=LEFT>???Es mu&szlig; das Interface <A HREF="stardiv.concepts.ModifyTestable.html#ModifyTestable">ModifyTestable</A>
+ implementiert werden. Damit kann &uuml;berpr&uuml;ft werden, ob an
+ den Resourcen Ver&auml;nderungen vorgenommen wurden.</P>
+ <LI><P ALIGN=LEFT>Nur Methoden die &uuml;ber die Lebensdauer des
+ Objektes keine ver&auml;nderten Werte liefern d&uuml;rfen immer
+ gerufen werden. Das sind zum Beispiel alle Methoden der Klasse
+ java.lang.Object.</P>
+ <LI><P ALIGN=LEFT>Um den Resourcebedarf einzelner Methoden genauer
+ zu ermitteln kann eine Methode mit dem, um _Resource( ResourceList
+ aRL, boolean bCheck, ... ) erweiterten Namen, gerufen werden. Ein
+ Beispiel befindet sich in der Klasse <A HREF="stardiv.resource.Resource.html#Resource">Resource</A>.</P>
+</OL>
+<H2><A NAME="Security"></A>Security</H2>
+<H2><A NAME="Data Requests"></A>Data Requests</H2>
+<P>Diese Schnittstelle soll das Anfordern von Daten vereinheitlichen.
+Das Problem, welches zu diesem Ansatz f&uuml;hrte, ist das Lesen von
+Daten &uuml;ber einen &#132;langsamen&#147; Internet-Stream. Das
+bedeutet es werden Daten ben&ouml;tigt, die erst noch &uuml;bertragen
+werden m&uuml;ssen. Da das Pull-Modell immer einen eigenen Thread
+vorraussetzt, um die restliche Anwendung nicht zu blockieren, habe
+ich das Push-Modell gew&auml;hlt.<BR><B>Ziel:</B> F&uuml;r die
+Implementation sollte es m&ouml;glichst transparent sein, wie die
+Daten herangeschafft werden. Als zweites soll die Schnittstelle f&uuml;r
+denjenigen einfach sein, der alle Daten sofort bereith&auml;lt.<BR><B>L&ouml;sung:</B>
+Der Datenverarbeiter ist passiv. Das bedeutet, beim Entgegennehmen
+der Daten beginnt er nicht sie zu verarbeiten. Dies mu&szlig; extra
+angesto&szlig;en werden. Zweitens, der Datenverarbeiter h&auml;lt den
+Status des Datenlieferanten. Dies k&ouml;nnen EOF, f&uuml;r alle
+Daten gelesen, READY, f&uuml;r sind Daten da, PENDING, es kommen noch
+weitere Daten und NO_SOURCE, es wurden nicht alle Daten verarbeitet
+und es kommen keine weiteren Daten mehr. <B>Achtung</B> der Status
+ist nur zu bestimmten Zeitpunkten g&uuml;ltig. Der Datenverarbeiter
+darf nur im Zustand PENDING Daten bekommen. Diese Annahme sch&uuml;tzt
+ihn vor der Implementation eines Puffers. Das <A HREF="stardiv.concepts.QueryData.html#QueryData">QueryData</A>
+- Interface ist die Spezifikation f&uuml;r dieses Verhalten.</P>
+<H2><A NAME="Modify"></A>Modify</H2>
+<P>Das Ziel ist nur eine Schnittstelle zu erstellen, mit der ein
+Objekt auf &Auml;nderungen &uuml;berpr&uuml;ft werden kann. Da es f&uuml;r
+ein Objekt verschiedene M&ouml;glichkeiten gibt &Auml;nderungen an
+sich zu pr&uuml;fen (z.B. &Auml;nderungsz&auml;hler, Kopie), mu&szlig;
+die Schnittstelle m&ouml;glichst flexibel sein, um vielen
+Implementationen gerecht zu werden. Die L&ouml;sung sind zwei
+Methoden. Mit der einen (getModifyHandle()) kann der Zeitpunkt
+festgemacht werden, zu dem m&ouml;gliche &Auml;nderungen &uuml;berpr&uuml;ft
+werden sollen. Der R&uuml;ckgabewert ist eine beliebiges Objekt, so
+da&szlig; in ihm die ben&ouml;tigte &Uuml;berpr&uuml;fungsinformation
+(z.B. der &Auml;nderungsz&auml;hler) untergebracht werden kann.
+Danach kann mit der zweiten Methode (isModified(Object)) &uuml;berpr&uuml;ft
+werden, ob eine &Auml;nderung stattgefunden hat. Das Interface f&uuml;r
+dieses Konzept hei&szlig;t <A HREF="stardiv.concepts.ModifyTestable.html#ModifyTestable">ModifyTestable</A>
+.</P>
+<H2><A NAME="LifeConnect"></A>LifeConnect</H2>
+<P>LifeConnect ist die Kommunikation zwischen PlugIns, Applets und
+JavaScript. Die Kommunikation kann in beide Richtungen erfolgen.Unter
+JavaScript kann auf alle Systemklassen zugegriffen werden. Die
+Abbildung der JavaScript-Aufrufe nach Java ist die Aufgabe der Klasse
+<A HREF="stardiv.js.ip.CallJava.html#CallJava">CallJava</A>. Dazu
+wird das in Java 1.1 implementierte Package java.lang.reflect
+benutzt. Da JavaScript eine nicht typisierte Sprache ist, werden die
+Werte nach JavaScript-Regeln in die entsprechenden Javatypen
+umgesetzt. Bez&uuml;glich der Sicherheit wird ein JavaScript-Programm
+auf die gleiche Stufe wie ein Applet gestellt. Um den Zugriff der
+Applets auf JavaScript zu gestatten, mu&szlig; das HTML-Tag MYSCRIPT
+angegeben werden. Auf die Java-Klassen kann in JavaScript mit dem
+Prefix &#132;Package&#147; zugegriffen werden (sun, java und netscape
+ben&ouml;tigen keinen Prefix). Die Klassen netscape.plugin.Plugin,
+netscape.javascript.JSObject und netscape.javascript.JSException
+dienen zur Kommunikation von Java mit JavaScript.</P>
+<P>Konvertierungstabelle anhand der Spezifikation &#132;JavaScript
+Language Specifications&#147; 3.1.2 TypeConversion</P>
+<TABLE WIDTH=100% BORDER=1 CELLPADDING=5 CELLSPACING=0 FRAME=HSIDES RULES=ALL>
+ <COLGROUP>
+ <COL WIDTH=26*>
+ <COL WIDTH=40*>
+ <COL WIDTH=47*>
+ <COL WIDTH=47*>
+ <COL WIDTH=47*>
+ <COL WIDTH=47*>
+ </COLGROUP>
+ <THEAD>
+ <TR>
+ <TH WIDTH=10% VALIGN=TOP>
+ <P><BR></TH>
+ <TH WIDTH=16% VALIGN=TOP>
+ <P><I>byte</I></TH>
+ <TH WIDTH=19% VALIGN=TOP>
+ <P><I>short</I></TH>
+ <TH WIDTH=19% VALIGN=TOP>
+ <P><I>char</I></TH>
+ <TH WIDTH=19% VALIGN=TOP>
+ <P><I>int</I></TH>
+ <TH WIDTH=19% VALIGN=TOP>
+ <P><I>long</I></TH>
+ </TR>
+ </THEAD>
+ <TBODY>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Undef.</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Function</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(10) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(12) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(13) valueOf/error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Object</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(10) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(12) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(13) valueOf/error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Object (null)</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(10) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(12) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(13) 0</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>double</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(10) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(12) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(13) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>boolean</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Leer String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(10) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(11) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(12) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(13) error/ Zahl</TD>
+ </TR>
+ </TBODY>
+</TABLE><DL>
+ <DT><BR></DT>
+</DL>
+<TABLE WIDTH=100% BORDER=1 CELLPADDING=5 CELLSPACING=0 FRAME=BOX RULES=ALL>
+ <COLGROUP>
+ <COL WIDTH=27*>
+ <COL WIDTH=59*>
+ <COL WIDTH=44*>
+ <COL WIDTH=35*>
+ <COL WIDTH=36*>
+ <COL WIDTH=55*>
+ </COLGROUP>
+ <THEAD>
+ <TR>
+ <TH WIDTH=10% VALIGN=TOP>
+ <P><BR></TH>
+ <TH WIDTH=23% VALIGN=TOP>
+ <P><I>float</I></TH>
+ <TH WIDTH=17% VALIGN=TOP>
+ <P><I>double</I></TH>
+ <TH WIDTH=14% VALIGN=TOP>
+ <P><I>boolean</I></TH>
+ <TH WIDTH=14% VALIGN=TOP>
+ <P><I>String</I></TH>
+ <TH WIDTH=22% VALIGN=TOP>
+ <P><I>Object</I></TH>
+ </TR>
+ </THEAD>
+ <TBODY>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Undef.</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Fehler</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>false</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>&#132;undefined&#147;</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>null</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Function</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(14) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) valueOf/ true</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) JS-Code der Funktion</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) netscape .javascript. JSObject</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Object</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(14) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) valueOf/error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) valueOf/ true</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) valueOf / toString
+ </TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) Java-Cast/ error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Object (null)</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(14) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) false</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) &#132;null&#147;</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) null</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>double</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(14) Zahl oder Fehler, wenn Bereichs-&uuml;berschreitung</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(7) 0, NaN -&gt; false !0, -+Infinite -&gt; true</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(8) Zahl, NaN, Infinity oder -Infinity</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(9) Number/ error
+ </TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>boolean</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) 0/1</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) boolean</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) &#132;false&#147;/ &#147;true&#147;</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) Boolean/ error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>Leer String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>error</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) false</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) String/ error</TD>
+ </TR>
+ <TR>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(14) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) error/ Zahl</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) true</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(30) String</TD>
+ <TD VALIGN=TOP>
+ <P ALIGN=LEFT>(15) String/ error</TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P><BR></P>
+<P>Der Algorithmus zum mappen der polymorphen Methoden in Java:<BR>1.
+Die Anzahl der Parameter mu&szlig; &uuml;bereinstimmen.<BR>2. Die
+Parameter m&uuml;ssen, nach der obigen Tabelle, konvertiert werden
+k&ouml;nnen.<BR>3. Es gibt ein Punktesystem, nach dem die Methode
+ausgew&auml;hlt wird. Die Punkte stehen in Klammern in den
+Tabelleneintr&auml;gen. Die Konvertierungspunkte f&uuml;r Zahlen sind
+typabh&auml;ngig und nicht wertabh&auml;ngig. Dadurch ist
+sichergestellt, das nicht unterschiedliche Methoden bei sich
+&auml;ndernden Werten gerufen werden. Kommt es allerdings zu einem
+Konvertierungsfehler (&Uuml;berlauf), dann wird versucht eine andere
+Methode zu finden.<BR>4. Es wird vorausgesetzt, da&szlig; die
+Methoden &#132;valueOf&#147; und &#132;toString&#147; keine
+Seiteneffekte haben. Sie d&uuml;rfen also beliebig oft aufgerufen
+werden.<BR>5. Es wird nur null auf eine Java-Array abgebildet.</P>
+<H2><A NAME="Testen"></A>Testen</H2>
+<P>Das Ziel dieses Abschnitts ist es Vorgehensweisen zu entwickeln,
+mit denen sich die Java Grundkonzepte testen lassen. Folgende
+Checkliste ist f&uuml;r jede Methode abzuarbeiten.</P>
+<OL>
+ <LI><P>Zu jeder Klasse gibt es eine entsprechende Testklasse. Diese
+ steht im Package &#132;test&#147;.... Der Name der Klasse wird mit
+ &#132;Test&#147; erweitert. Beispiel: stardiv.memory.BitArray wird
+ zu test.memory.BitArrayTest. Jede dieser Klassen hat eine Methode
+ &#132;public static void main( String [] )&#147;. Diese Methode wird
+ aufgerufen, um den Test aller Methoden anzusto&szlig;en. Der Test
+ ist nicht interaktiv. Wird ein Fehler festgestellt, wird das
+ Programm mit exit( -1 ) verlassen.</P>
+ <LI><P>Jede Methode mu&szlig; unabh&auml;ngig von ihren Environment
+ getestet werden. Alle Resourcen f&uuml;r die Methode werden als
+ Dummy f&uuml;r den Test implementiert. Diese Forderung f&uuml;hrt zu
+ sauberen Schnittstellen, da ansonsten f&uuml;r den Test ja ganze
+ Objekte implementiert werden m&uuml;ssen.</P>
+ <LI><P>Das Testprotokoll protokolliert mit &#132;System.out.println&#147;.
+ Vor dem Test der einzelnen Methoden wird in einer Zeile kurz &uuml;ber
+ den Test informiert. Scheitert der Test, dann wird eine
+ Fehlermeldung ausgegeben in der &#132;failed&#147; enthalten sein
+ mu&szlig;. </P>
+ <LI><P>Um <A HREF="#Defined Exception">Defined Exception</A> und
+ <A HREF="#Transacted Exception">Transacted Exception</A> testen zu
+ k&ouml;nnen, sollten die <A HREF="stardiv.concepts.Resource.html#Resource">Resource</A>
+ und <A HREF="stardiv.concepts.ModifyTestable.html#ModifyTestable">ModifyTestable</A>
+ Interfaces implementiert werden. Es kann damit automatisch gepr&uuml;ft
+ werden, ob sich eine Resource unerlaubter Weise ge&auml;ndert hat.</P>
+</OL>
+<H2>Begriffe</H2>
+<P><A NAME="lebendig"></A>Lebendig: Ein System wird als lebendig
+bezeichnet, wenn alle in ihm befindlichen Auftr&auml;ge
+fertiggestellt werden k&ouml;nnen. Sie sich also nicht in einer
+Verklemmung oder einem &#132;Race&#147; befinden.</P>
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/sj2/inc/sjapplet.hxx b/sj2/inc/sjapplet.hxx
new file mode 100644
index 000000000000..6f7a5ec7012a
--- /dev/null
+++ b/sj2/inc/sjapplet.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: sjapplet.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SJ_SJAPPLET_HXX
+#define _SJ_SJAPPLET_HXX
+
+#include <tools/string.hxx>
+
+// **************************************************************
+//class stardiv_applet_AppletViewerPanel;
+// class stardiv_applet_AppletExecutionContext;
+// class java_awt_Frame;
+// class com_sun_star_comp_jawt_peer_EmbeddedFrame;
+// class java_awt_Window;
+// class XubString;
+// class SjJSbxObject;
+
+//#include <jni.h>
+
+class INetURLObject;
+class Size;
+class SjJScriptAppletObject;
+class SvCommandList;
+class Window;
+
+struct SjApplet2ImplStruct;
+
+enum SjNetAccess
+{
+ NET_UNRESTRICTED, NET_NONE, NET_HOST
+};
+
+class SjApplet2
+{
+ Window * _pParentWin;
+ SjApplet2ImplStruct * _pImpl;
+
+public:
+ static void settingsChanged(void);
+
+ SjApplet2();
+ ~SjApplet2();
+ void Init(Window * pParentWin, const INetURLObject & rDocBase, const SvCommandList & rCmdList);
+ void setSizePixel( const Size & );
+ void appletRestart();
+ void appletReload();
+ void appletStart();
+ void appletStop();
+ void appletClose();
+
+ // Fuer SO3, Wrapper fuer Applet liefern
+ SjJScriptAppletObject * GetJScriptApplet();
+
+ virtual void appletResize( const Size & ) = 0;
+ virtual void showDocument( const INetURLObject &, const XubString & ) = 0;
+ virtual void showStatus( const XubString & ) = 0;
+// virtual SjJSbxObject * getJScriptWindowObj() = 0;
+};
+
+
+
+#endif // _REF_HXX
diff --git a/sj2/prj/d.lst b/sj2/prj/d.lst
new file mode 100644
index 000000000000..e0246462b8b8
--- /dev/null
+++ b/sj2/prj/d.lst
@@ -0,0 +1,15 @@
+dos: mkdir %_DEST%\inc%_EXT%\sj2
+..\%__SRC%\class\classes.jar %_DEST%\bin%_EXT%\classes.jar
+hedabu: ..\inc\sjapplet.hxx %_DEST%\inc%_EXT%\sj2\sjapplet.hxx
+
+..\%__SRC%\lib\sj.lib %_DEST%\lib%_EXT%\sj.lib
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\slb\sj.lib %_DEST%\lib%_EXT%\xsj.lib
+..\%__SRC%\bin\j%UPD%*_g.dll %_DEST%\bin%_EXT%\j%UPD%*_g.dll
+
+dos: if "%GUI%" == "WIN" attrib -r %_DEST%\bin%_EXT%\sj%UPD%*.map
+dos: if "%GUI%" == "WIN" copy ..\%__SRC%\misc\sj%UPD%*.map %_DEST%\bin%_EXT%\sj2%UPD%*.map
+dos: if "%GUI%" == "WIN" attrib +r %_DEST%\bin%_EXT%\sj2%UPD%*.map
+dos: if "%GUI%" == "OS2" attrib -r %_DEST%\bin%_EXT%\sj2%UPD%*.map
+dos: if "%GUI%" == "OS2" copy ..\%__SRC%\misc\sj%UPD%*.map %_DEST%\bin%_EXT%\sj2%UPD%*.map
+dos: if "%GUI%" == "OS2" attrib +r %_DEST%\bin%_EXT%\sj2%UPD%*.map
diff --git a/sj2/source/inc/java_lang_object.hxx b/sj2/source/inc/java_lang_object.hxx
new file mode 100644
index 000000000000..b9c39252aeba
--- /dev/null
+++ b/sj2/source/inc/java_lang_object.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: java_lang_object.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <jni.h>
+#ifdef OS2
+#include <typedefs.h>
+#endif
+
+#ifndef _SJ_JAVA_LANG_OBJECT_HXX
+#define _SJ_JAVA_LANG_OBJECT_HXX
+
+#include <tools/string.hxx>
+
+
+#ifdef HAVE_64BIT_POINTERS
+#error "no 64 bit pointer"
+#else
+#ifdef OS2
+#define INT64_TO_PVOID(x) (void *)x.lo
+inline jlong Make_Os2_Int64( INT32 hi, INT32 lo ) {jlong x = CONST64( hi, lo ); return x; }
+#define PVOID_TO_INT64(x) Make_Os2_Int64( 0, (INT32)x )
+#else //OS2
+#define PVOID_TO_INT64(x) (jlong)(INT32)x
+#define INT64_TO_PVOID(x) (void *)x
+#endif //Os2
+#endif
+
+//=====================================================================
+class java_lang_Class;
+class java_lang_Object
+{
+ // Zuweisungsoperator und Copy Konstruktor sind verboten
+ java_lang_Object& operator = (java_lang_Object&) { return *this;};
+ java_lang_Object(java_lang_Object&) {};
+
+ static jclass getMyClass();
+ // nur zum Zerstoeren des C++ Pointers in vom JSbxObject
+ // abgeleiteten Java Objekten
+ //static jclass getJSbxObjectClass();
+
+protected:
+ // der JAVA Handle zu dieser Klasse
+ jobject object;
+ // Klassendefinition
+
+ // neu in SJ2:
+ static jclass theClass; // die Klasse braucht nur einmal angefordert werden !
+ static jclass theJSbxObjectClass; // die Klasse braucht nur einmal angefordert werden !
+ static ULONG nObjCount; // Zaehler fuer die Anzahl der Instanzen
+
+public:
+ // der Konstruktor, der fuer die abgeleiteten Klassen verwendet
+ // werden soll.
+ java_lang_Object( JNIEnv * pEnv, jobject myObj );
+ // der eigentliche Konstruktor
+ java_lang_Object();
+
+ virtual ~java_lang_Object();
+
+ void saveRef( JNIEnv * pEnv, jobject myObj );
+ jobject getJavaObject() const { return object; }
+ java_lang_Object * GetWrapper() { return this; }
+
+ java_lang_Class * getClass();
+
+};
+
+#endif
diff --git a/sj2/source/jscpp/makefile.mk b/sj2/source/jscpp/makefile.mk
new file mode 100644
index 000000000000..9b2d65e9ea44
--- /dev/null
+++ b/sj2/source/jscpp/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sj2
+TARGET=jscpp
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT=$(OUT)$/inc
+
+# --- Files --------------------------------------------------------
+
+UNOTYPES= \
+ com.sun.star.uno.Exception \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.awt.XControl \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.java.XJavaVM \
+ com.sun.star.java.XJavaThreadRegister_11
+
+
+CXXFILES= \
+ sjapplet.cxx \
+
+
+SLOFILES= \
+ $(SLO)$/sjapplet.obj \
+
+# .IF "$(GUI)"=="WNT"
+# SLOFILES += $(SLO)$/sun_awt_windows_package.obj
+# .ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/sj2/source/jscpp/sjapplet.cxx b/sj2/source/jscpp/sjapplet.cxx
new file mode 100644
index 000000000000..2df01d049958
--- /dev/null
+++ b/sj2/source/jscpp/sjapplet.cxx
@@ -0,0 +1,601 @@
+/*************************************************************************
+ *
+ * $RCSfile: sjapplet.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <jnihelp.hxx>
+
+#include <sjapplet.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <rtl/ustring>
+
+#include <rtl/process.h>
+
+#include <jni.h>
+
+using namespace ::rtl;
+using namespace ::com::sun::star::lang;
+using namespace ::utl;
+
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <svtools/ownlist.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/syschild.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::java;
+using namespace ::sj2;
+
+#include <com/sun/star/java/XJavaVM.hpp>
+
+struct SjApplet2ImplStruct {
+ JavaVM * _pJVM;
+ jobject _joAppletExecutionContext;
+ jobject _joFrame;
+ jclass _jcAppletExecutionContext;
+
+ Reference<XJavaVM> _xJavaVM;
+ Reference<XJavaThreadRegister_11> _xJavaThreadRegister_11;
+};
+
+SjApplet2::SjApplet2()
+ : _pParentWin(NULL),
+ _pImpl( new SjApplet2ImplStruct() )
+{
+}
+
+SjApplet2::~SjApplet2()
+{
+ if (_pImpl->_joAppletExecutionContext)
+ {
+ TKTThreadAttach jenv( _pImpl->_pJVM,
+ _pImpl->_xJavaThreadRegister_11.get()
+ );
+
+ jenv.pEnv->DeleteGlobalRef( _pImpl->_joAppletExecutionContext );
+ jenv.pEnv->DeleteGlobalRef( _pImpl->_joFrame );
+ jenv.pEnv->DeleteGlobalRef( _pImpl->_jcAppletExecutionContext );
+ }
+
+ delete _pImpl;
+}
+
+//=========================================================================
+void SjApplet2::Init( Window * pParentWin, const INetURLObject & rDocBase, const SvCommandList & rCmdList )
+{
+ Reference<XMultiServiceFactory> serviceManager(getProcessServiceFactory());
+
+ _pImpl->_xJavaVM = Reference<XJavaVM> (serviceManager->createInstance(OUString::createFromAscii("com.sun.star.java.JavaVirtualMachine")), UNO_QUERY);
+ _pImpl->_xJavaThreadRegister_11 = Reference<XJavaThreadRegister_11>(_pImpl->_xJavaVM, UNO_QUERY);
+
+ Sequence<sal_Int8> processID(16);
+ rtl_getGlobalProcessId((sal_uInt8 *)processID.getArray());
+ Any aVMPtr = _pImpl->_xJavaVM->getJavaVM(processID);
+ if( sizeof( _pImpl->_pJVM ) == sizeof( sal_Int32 ) )
+ {
+ // 32 bit system
+ sal_Int32 nP = 0;
+ aVMPtr >>= nP;
+ _pImpl->_pJVM = (JavaVM*)nP;
+ }
+ else if( sizeof( _pImpl->_pJVM ) == sizeof( sal_Int64 ) )
+ {
+ // 64 bit system
+ sal_Int64 nP = 0;
+ aVMPtr >>= nP;
+ _pImpl->_pJVM = (JavaVM*)nP;
+ }
+
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+
+ // Java URL erzeugen
+ String aURL = rDocBase.GetMainURL();
+ if ( aURL.Len() )
+ {
+ //WorkAround, weil Java mit dem | nicht zurecht kommt
+ if( rDocBase.GetProtocol() == INET_PROT_FILE
+ && aURL.GetChar( (xub_StrLen)9 ) == INET_ENC_DELIM_TOKEN )
+ aURL = aURL.Insert( INET_DELIM_TOKEN, (xub_StrLen)9 );
+ }
+
+ jclass jcURL = jenv.pEnv->FindClass("java/net/URL");
+ jmethodID jmURL_rinit = jenv.pEnv->GetMethodID(jcURL, "<init>", "(Ljava/lang/String;)V");
+ jobject joDocBase = jenv.pEnv->AllocObject(jcURL);
+ jstring jsURL = jenv.pEnv->NewString( aURL.GetBuffer(), aURL.Len() );
+ jenv.pEnv->CallVoidMethod(joDocBase, jmURL_rinit, jsURL);
+
+ jclass jcHashtable = jenv.pEnv->FindClass("java/util/Hashtable");
+ jmethodID jmHashtable_rinit = jenv.pEnv->GetMethodID(jcHashtable, "<init>", "()V");
+ jmethodID jmHashtable_put = jenv.pEnv->GetMethodID(jcHashtable, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+ jobject joParameters = jenv.pEnv->AllocObject(jcHashtable);
+ jenv.pEnv->CallVoidMethod(joParameters, jmHashtable_rinit);
+
+ for( ULONG i = 0; i < rCmdList.Count(); i++ ) {
+ const SvCommand & rCmd = rCmdList[i];
+ String aCmd = rCmd.GetCommand();
+ String aLoweredCmd = aCmd.ToLowerAscii();
+ jstring jsCommand = jenv.pEnv->NewString( aLoweredCmd.GetBuffer(), aLoweredCmd.Len() );
+ jstring jsArg = jenv.pEnv->NewString( rCmd.GetArgument().GetBuffer(), rCmd.GetArgument().Len() );
+ jenv.pEnv->CallVoidMethod(joParameters, jmHashtable_put, jsCommand, jsArg);
+ }
+
+
+ _pParentWin = pParentWin;
+
+#if defined(WNT) && defined(blblblblblblb)
+ if (WINDOW_SYSTEMCHILDWINDOW == pParentWin->GetType())
+ {
+ const SystemChildData* pCD = ((SystemChildWindow*) pParentWin)->GetSystemData();
+ if ( pCD )
+ // hier wird das C++-Wrapper-Objekt fuer ein Java-Objekt erzeugt
+ pWindow = new sun_awt_windows_WEmbeddedFrame((INT32)pCD->hWnd);
+ }
+ if (!pWindow)
+ pWindow = new sun_awt_windows_WEmbeddedFrame();
+#else
+ jclass jcFrame = jenv.pEnv->FindClass("java/awt/Frame");
+ jmethodID jmFrame_rinit = jenv.pEnv->GetMethodID(jcFrame, "<init>", "()V");
+ _pImpl->_joFrame = jenv.pEnv->AllocObject(jcFrame);
+ _pImpl->_joFrame = jenv.pEnv->NewGlobalRef(_pImpl->_joFrame);
+ jenv.pEnv->CallVoidMethod(_pImpl->_joFrame, jmFrame_rinit);
+#endif
+
+ jmethodID jmFrame_show = jenv.pEnv->GetMethodID(jcFrame, "show", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joFrame, jmFrame_show);
+
+ _pImpl->_jcAppletExecutionContext = jenv.pEnv->FindClass("stardiv/applet/AppletExecutionContext");
+ _pImpl->_jcAppletExecutionContext = (jclass)jenv.pEnv->NewGlobalRef( _pImpl->_jcAppletExecutionContext );
+ jmethodID jmAppletExecutionContext_rinit = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "<init>", "(Ljava/net/URL;Ljava/util/Hashtable;Ljava/awt/Container;J)V");
+ jmethodID jmAppletExecutionContext_init = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "init", "()V");
+ jmethodID jmAppletExecutionContext_startUp = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "startUp", "()V");
+
+ _pImpl->_joAppletExecutionContext = jenv.pEnv->AllocObject(_pImpl->_jcAppletExecutionContext);
+ _pImpl->_joAppletExecutionContext = jenv.pEnv->NewGlobalRef(_pImpl->_joAppletExecutionContext);
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_rinit, joDocBase, joParameters, _pImpl->_joFrame, (jlong)0);
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_init);
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_startUp);
+
+// pWindow->setVisible(TRUE);
+
+// pAppletExecutionContext = new stardiv_applet_AppletExecutionContext_Impl(&aDocBase, &aHashtable, pWindow, this);
+// pAppletExecutionContext->init();
+
+// pAppletExecutionContext->startUp();
+}
+
+//=========================================================================
+void SjApplet2::setSizePixel( const Size & rSize )
+{
+// pWindow->setSize(rSize.Width(), rSize.Height());
+}
+
+void SjApplet2::appletRestart()
+{
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+ jmethodID jmAppletExecutionContext_restart = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "restart", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_restart);
+}
+
+void SjApplet2::appletReload()
+{
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+ jmethodID jmAppletExecutionContext_reload = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "reload", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_reload);
+}
+
+void SjApplet2::appletStart()
+{
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+ jmethodID jmAppletExecutionContext_sendStart = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "sendStart", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_sendStart);
+}
+
+void SjApplet2::appletStop()
+{
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+ jmethodID jmAppletExecutionContext_sendStop = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "sendStop", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_sendStop);
+}
+
+void SjApplet2::appletClose()
+{
+ if(_pImpl->_joAppletExecutionContext)
+ {
+ TKTThreadAttach jenv(_pImpl->_pJVM, _pImpl->_xJavaThreadRegister_11.get());
+ jmethodID jmAppletExecutionContext_shutdown = jenv.pEnv->GetMethodID(_pImpl->_jcAppletExecutionContext, "shutdown", "()V");
+ jenv.pEnv->CallVoidMethod(_pImpl->_joAppletExecutionContext, jmAppletExecutionContext_shutdown);
+ }
+
+// pWindow->dispose();
+
+ if( _pParentWin )
+ {
+ WorkWindow* pAppWin = Application::GetAppWindow();
+ if(pAppWin)
+ {
+ while(_pParentWin->GetChildCount())
+ {
+ Window* pChild = _pParentWin->GetChild(0);
+ pChild->Show( FALSE );
+ pChild->SetParent( pAppWin );
+ }
+ }
+ }
+
+// delete pWindow;
+// pWindow = NULL;
+}
+
+// Fuer SO3, Wrapper fuer Applet liefern
+SjJScriptAppletObject * SjApplet2::GetJScriptApplet()
+{
+ return NULL;
+}
+
+#ifdef _OLD_FEATURE
+class SjINetSettings : public ApplicationProperty
+/* [Beschreibung]
+
+ Diese Klasse repr"asentiert die Internet Einstellungen von Java.
+ Beim Initialisieren von Java werden, "uber die Methode
+ <Application::Property(...)>, die Einstellungen abgefragt.
+*/
+{
+ String aHttpProxy;
+ int nHttpProxyPort;
+ String aFtpProxy;
+ int nFtpProxyPort;
+ String aFirewallProxy;
+ int nFirewallProxyPort;
+public:
+ TYPEINFO();
+ SjINetSettings();
+
+ void SetHttpProxy( const String & rStr )
+ { aHttpProxy = rStr; }
+ const String & GetHttpProxy() const { return aHttpProxy; }
+ void SetHttpProxyPort( int n )
+ { nHttpProxyPort = n; }
+ int GetHttpProxyPort() const { return nHttpProxyPort; }
+
+ void SetFtpProxy( const String & rStr )
+ { aFtpProxy = rStr; }
+ const String & GetFtpProxy() const { return aFtpProxy; }
+ void SetFtpProxyPort( int n )
+ { nFtpProxyPort = n; }
+ int GetFtpProxyPort() const { return nFtpProxyPort; }
+
+ void SetFirewallProxy( const String & rStr )
+ { aFirewallProxy = rStr; }
+ const String & GetFirewallProxy() const { return aFirewallProxy; }
+ void SetFirewallProxyPort( int n )
+ { nFirewallProxyPort = n; }
+ int GetFirewallProxyPort() const { return nFirewallProxyPort; }
+};
+
+class SjJavaSettings : public ApplicationProperty
+/* [Beschreibung]
+
+ Diese Klasse repr"asentiert die allgemeinen Java Einstellungen.
+ Beim Initialisieren von Java werden, "uber die Methode
+ <Application::Property(...)>, die Einstellungen abgefragt.
+
+ JavaHomeDir ist das Installationsverzeichnis von Java.
+*/
+{
+ String aClassPath;
+ String aJavaHomeDir;
+ SjNetAccess eNetAccess;
+ UINT32 nNativeStackSize; // Stack size for native threads
+ UINT32 nJavaStackSize; // Stack size for Java threads
+ UINT32 nMinHeapSize; // Minimum heap size (default 0 -> Java-Default)
+ UINT32 nMaxHeapSize; // Maximum heap size (default 0 -> JavaDefault)
+
+ UINT32 nVerifyMode; // controls whether Java byte code should be verified:
+ // 0 -- none,
+ // 1 -- remotely loaded code,
+ // 2 -- all code.
+
+ BOOL bEnableClassGC; // default set to TRUE
+ BOOL bEnableVerboseGC; // default set to FALSE
+ BOOL bEnableAsyncGC; // default set to TRUE
+ BOOL bVerbose; // Switch the verbose mode of the VM
+ BOOL bDebugging; // Enables or disable the debugging VM
+ UINT32 nDebugPort; // Set the debug port. Only valid with bDebugging = TRUE
+ BOOL bSecurity; // TRUE, sandbox security enabled. FALSE, no security. Default set to TRUE.
+
+public:
+
+ TYPEINFO();
+ SjJavaSettings();
+
+ void SetClassPath( const String & rStr )
+ { aClassPath = rStr; }
+ const String & GetClassPath() const { return aClassPath; }
+
+ void SetJavaHomeDir( const String & rStr )
+ { aJavaHomeDir = rStr; }
+ const String & GetJavaHomeDir() const { return aJavaHomeDir; }
+
+ void SetNetAccess( SjNetAccess eAcc )
+ { eNetAccess = eAcc; }
+ SjNetAccess GetNetAccess() const { return eNetAccess; }
+
+ // nSize == 0 -> Systemdefault
+ void SetMinHeapSize( UINT32 nSize )
+ { nMinHeapSize = nSize; }
+ UINT32 GetMinHeapSize() const { return nMinHeapSize; }
+
+ // nSize == 0 -> Systemdefault
+ void SetMaxHeapSize( UINT32 nSize )
+ { nMaxHeapSize = nSize; }
+ UINT32 GetMaxHeapSize() const { return nMaxHeapSize; }
+
+ // nSize == 0 -> Systemdefault
+ void SetNativeStackSize( UINT32 nSize )
+ { nNativeStackSize = nSize; }
+ UINT32 GetNativeStackSize() const { return nNativeStackSize; }
+
+ // nSize == 0 -> Systemdefault
+ void SetJavaStackSize( UINT32 nSize )
+ { nJavaStackSize = nSize; }
+ UINT32 GetJavaStackSize() const { return nJavaStackSize; }
+
+ // default = 2 -> remotely loaded code
+ void SetVerifyMode( UINT32 nSize )
+ { nVerifyMode = nSize; }
+ UINT32 GetVerifyMode() const { return nVerifyMode; }
+
+ void EnableClassGC( BOOL bEnable )
+ { bEnableClassGC = bEnable; }
+ UINT32 IsClassGCEnabled() const { return bEnableClassGC; }
+
+ void EnableVerboseGC( BOOL bEnable )
+ { bEnableVerboseGC = bEnable; }
+ UINT32 IsVerboseGCEnabled() const { return bEnableVerboseGC; }
+
+ void EnableAsyncGC( BOOL bEnable )
+ { bEnableAsyncGC = bEnable; }
+ UINT32 IsAsyncGCEnabled() const { return bEnableAsyncGC; }
+
+ void EnableVerboseVM( BOOL bEnable )
+ { bVerbose = bEnable; }
+ UINT32 IsVerboseVMEnabled() const { return bVerbose; }
+
+ void EnableDebugging( BOOL bEnable )
+ { bDebugging = bEnable; }
+ UINT32 IsDebuggingEnabled() const { return bDebugging; }
+
+ void SetDebugPort( UINT32 nPort )
+ { nDebugPort = nPort; }
+ UINT32 GetDebugPort() const { return nDebugPort; }
+
+
+ void EnableSecurity( BOOL bEnable )
+ { bSecurity = bEnable; }
+ BOOL IsSecurityEnabled() const { return bSecurity; }
+
+};
+
+
+TYPEINIT1( SjJavaSettings, ApplicationProperty )
+SjJavaSettings::SjJavaSettings()
+/* [Beschreibung]
+
+ Im Konstruktor werden die Einstellungen des Classpath und JavaHome
+ auf die Environment Variablen "classpath" und "java_home" initialisiert.
+*/
+ : eNetAccess( NET_HOST )
+ , nNativeStackSize( 0 )
+ , nJavaStackSize( 0 )
+ , nMinHeapSize( 0 )
+ , nMaxHeapSize( 0 )
+ , nVerifyMode( 1 )
+ , bEnableClassGC( TRUE )
+ , bEnableVerboseGC( FALSE )
+ , bEnableAsyncGC( TRUE )
+ , bDebugging( FALSE )
+ , nDebugPort( 0 )
+ , bSecurity( TRUE )
+{
+}
+
+//=========================================================================
+//=========================================================================
+//=========================================================================
+TYPEINIT1( SjINetSettings, ApplicationProperty )
+SjINetSettings::SjINetSettings()
+/* [Beschreibung]
+
+ Die Proxy-Servernamen werden auf "" und die Port auf 0 initialisiert.
+*/
+ : nHttpProxyPort( 0 )
+ , nFtpProxyPort( 0 )
+ , nFirewallProxyPort( 0 )
+{
+}
+#endif // _OLD_FEATURE
+
+
+/*
+ * Java init function to invoke Java runtime using JNI invocation API.
+ */
+
+void JRE_PropertyChanged( JNIEnv * env, const SvCommandList & rCmdList )
+{
+ jclass pClass = env->FindClass("java/util/Properties");
+ if( !pClass )
+ return;
+
+ jmethodID mCtor = env->GetMethodID( pClass, "<init>", "()V" );
+ jobject pProps = env->NewObject( pClass, mCtor, NULL );
+
+ char * pSignature = "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;";
+ char * pMethodName = "put";
+ jmethodID mPut = env->GetMethodID( pClass, pMethodName, pSignature );
+ env->DeleteLocalRef( pClass );
+
+ if( !mCtor || !pProps || ! mPut )
+ return;
+
+ for( ULONG i = 0; i < rCmdList.Count(); i++ )
+ {
+ const SvCommand & rCmd = rCmdList[i];
+ jstring pCommand = env->NewString( rCmd.GetCommand().GetBuffer(), rCmd.GetCommand().Len() );
+ jstring pArg = env->NewString( rCmd.GetArgument().GetBuffer(), rCmd.GetArgument().Len() );
+
+ jobject hTmp = env->CallObjectMethod( pProps, mPut, pCommand, pArg );
+ env->DeleteLocalRef( hTmp );
+ env->DeleteLocalRef( pCommand );
+ env->DeleteLocalRef( pArg );
+ }
+
+ pClass = env->FindClass("stardiv/controller/SjSettings");
+
+ if( !pClass )
+ return;
+
+ jmethodID mid = env->GetStaticMethodID( pClass , "changeProperties", "(Ljava/util/Properties;)V");
+ if( !mid )
+ return;
+
+ env->CallStaticVoidMethod( pClass, mid, pProps );
+ env->DeleteLocalRef( pProps );
+ env->DeleteLocalRef( pClass );
+}
+
+
+void SjApplet2::settingsChanged(void)
+{
+ Reference<XMultiServiceFactory> serviceManager(getProcessServiceFactory());
+
+ Reference<XJavaVM> xJavaVM(serviceManager->createInstance(OUString::createFromAscii("com.sun.star.java.JavaVirtualMachine")), UNO_QUERY);
+
+ if(xJavaVM->isVMStarted())
+ {
+ Reference<XJavaThreadRegister_11> xJavaThreadRegister_11(xJavaVM, UNO_QUERY);
+
+ Sequence<sal_Int8> processID(16);
+ rtl_getGlobalProcessId((sal_uInt8 *)processID.getArray());
+ JavaVM * pJVM = (JavaVM *)xJavaVM->getJavaVM(processID).getValue();
+ TKTThreadAttach jenv(pJVM, xJavaThreadRegister_11.get());
+
+ if( jenv.pEnv)
+ {
+ DBG_ERROR( "SjApplet2::settingsChanged not implemented" );
+#ifdef _OLD_FEATURE
+
+ SjINetSettings aINetSettings;
+ GetpApp()->Property(aINetSettings);
+ SjJavaSettings aJSettings;
+ GetpApp()->Property(aJSettings);
+
+ SvCommandList aCmdList;
+ // Security Settings
+ switch ( aJSettings.GetNetAccess() )
+ {
+ case NET_UNRESTRICTED:
+ aCmdList.Append( String::CreateFromAscii("appletviewer.security.mode"),
+ String::CreateFromAscii("unrestricted") );
+ break;
+
+ case NET_NONE:
+ aCmdList.Append( String::CreateFromAscii("appletviewer.security.mode"),
+ String::CreateFromAscii("none") );
+ break;
+
+ case NET_HOST:
+ aCmdList.Append( String::CreateFromAscii("appletviewer.security.mode"),
+ String::CreateFromAscii("host") );
+ break;
+ }
+ if ( aJSettings.IsSecurityEnabled() )
+ aCmdList.Append( String::CreateFromAscii("stardiv.security.disableSecurity"),
+ String::CreateFromAscii("false") );
+ else
+ aCmdList.Append( String::CreateFromAscii("stardiv.security.disableSecurity"),
+ String::CreateFromAscii("true") );
+
+ // HTTP settings
+ aCmdList.Append( String::CreateFromAscii("http.proxyHost"),
+ aINetSettings.GetHttpProxy());
+ aCmdList.Append( String::CreateFromAscii("http.proxyPort"),
+ aINetSettings.GetHttpProxyPort());
+
+ // Ftp settings
+ if( aINetSettings.GetFtpProxy().Len() )
+ aCmdList.Append( String::CreateFromAscii("ftpProxySet"), String::CreateFromAscii("true") );
+ else
+ aCmdList.Append( String::CreateFromAscii("ftpProxySet"), String::CreateFromAscii("false") );
+
+ aCmdList.Append( String::CreateFromAscii("ftpProxyHost"), aINetSettings.GetFtpProxy());
+ aCmdList.Append( String::CreateFromAscii("ftpProxyPort"), aINetSettings.GetFtpProxyPort());
+
+ JRE_PropertyChanged(jenv.pEnv, aCmdList);
+#endif //_OLD_FEATURE
+ }
+ }
+}
+
diff --git a/sj2/stardiv/app/AppletMessageHandler.java b/sj2/stardiv/app/AppletMessageHandler.java
new file mode 100644
index 000000000000..401a8332f5f7
--- /dev/null
+++ b/sj2/stardiv/app/AppletMessageHandler.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppletMessageHandler.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stardiv.app;
+
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.text.MessageFormat;
+
+/**
+ * An hanlder of localized messages.
+ *
+ * @version 1.8, 03/03/97
+ * @author Koji Uno
+ */
+public class AppletMessageHandler {
+ private static ResourceBundle rb;
+ private String baseKey = null;
+
+ static {
+ try {
+ rb = ResourceBundle.getBundle("stardiv.app.MsgAppletViewer");
+ } catch (MissingResourceException e) {
+ System.out.println(e.getMessage());
+ }
+ };
+
+ public AppletMessageHandler(String baseKey) {
+ this.baseKey = baseKey;
+ }
+
+ public String getMessage(String key) {
+ return (String)rb.getString(getQualifiedKey(key));
+ }
+
+ public String getMessage(String key, Object arg){
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[1];
+ if (arg == null) {
+ arg = "null"; // mimic java.io.PrintStream.print(String)
+ }
+ msgobj[0] = arg;
+ return msgfmt.format(msgobj);
+ }
+
+ public String getMessage(String key, Object arg1, Object arg2) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[2];
+ if (arg1 == null) {
+ arg1 = "null";
+ }
+ if (arg2 == null) {
+ arg2 = "null";
+ }
+ msgobj[0] = arg1;
+ msgobj[1] = arg2;
+ return msgfmt.format(msgobj);
+ }
+
+ public String getMessage(String key, Object arg1, Object arg2, Object arg3) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[3];
+ if (arg1 == null) {
+ arg1 = "null";
+ }
+ if (arg2 == null) {
+ arg2 = "null";
+ }
+ if (arg3 == null) {
+ arg3 = "null";
+ }
+ msgobj[0] = arg1;
+ msgobj[1] = arg2;
+ msgobj[2] = arg3;
+ return msgfmt.format(msgobj);
+ }
+
+ public String getMessage(String key, Object arg[]) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ return msgfmt.format(arg);
+ }
+
+ public String getQualifiedKey(String subKey) {
+ return baseKey + "." + subKey;
+ }
+}
diff --git a/sj2/stardiv/app/AppletProps.java b/sj2/stardiv/app/AppletProps.java
new file mode 100644
index 000000000000..5b13d4febe76
--- /dev/null
+++ b/sj2/stardiv/app/AppletProps.java
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppletProps.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stardiv.app;
+
+import stardiv.app.AppletMessageHandler;
+import stardiv.applet.AppletExecutionContext;
+
+import java.awt.*;
+import java.io.*;
+import java.util.Properties;
+import sun.net.www.http.HttpClient;
+import sun.net.ftp.FtpClient;
+
+public class AppletProps extends Frame {
+ TextField proxyHost;
+ TextField proxyPort;
+ Choice networkMode;
+ Choice accessMode;
+ Choice unsignedMode;
+
+ AppletExecutionContext appletExecutionContext;
+
+ AppletProps(AppletExecutionContext appletExecutionContext) {
+ this.appletExecutionContext = appletExecutionContext;
+
+ setTitle(amh.getMessage("title"));
+ Panel p = new Panel();
+ p.setLayout(new GridLayout(0, 2));
+
+ p.add(new Label(amh.getMessage("label.http.server", "Http proxy server:")));
+ p.add(proxyHost = new TextField());
+
+ p.add(new Label(amh.getMessage("label.http.proxy")));
+ p.add(proxyPort = new TextField());
+
+ p.add(new Label(amh.getMessage("label.network")));
+ p.add(networkMode = new Choice());
+ networkMode.addItem(amh.getMessage("choice.network.item.none"));
+ networkMode.addItem(amh.getMessage("choice.network.item.applethost"));
+ networkMode.addItem(amh.getMessage("choice.network.item.unrestricted"));
+
+ String securityMode = System.getProperty("appletviewer.security.mode");
+ securityMode = (securityMode == null) ? "none" : securityMode;
+ securityMode = securityMode.equals("host") ? "applethost" : securityMode;
+ networkMode.select(amh.getMessage("choice.network.item." + securityMode));
+
+ p.add(new Label(amh.getMessage("label.class")));
+ p.add(accessMode = new Choice());
+ accessMode.addItem(amh.getMessage("choice.class.item.restricted"));
+ accessMode.addItem(amh.getMessage("choice.class.item.unrestricted"));
+
+ accessMode.select(Boolean.getBoolean("package.restrict.access.sun")
+ ? amh.getMessage("choice.class.item.restricted")
+ : amh.getMessage("choice.class.item.unrestricted"));
+
+ p.add(new Label(amh.getMessage("label.unsignedapplet")));
+ p.add(unsignedMode = new Choice());
+ unsignedMode.addItem(amh.getMessage("choice.unsignedapplet.no"));
+ unsignedMode.addItem(amh.getMessage("choice.unsignedapplet.yes"));
+
+ add("Center", p);
+ p = new Panel();
+ p.add(new Button(amh.getMessage("button.apply")));
+ p.add(new Button(amh.getMessage("button.reset")));
+ p.add(new Button(amh.getMessage("button.cancel")));
+ add("South", p);
+ setLocation(200, 150);
+ pack();
+ reset();
+ }
+
+ void reset() {
+ // if (Boolean.getBoolean("package.restrict.access.sun")) {
+ // accessMode.select(amh.getMessage("choice.class.item.restricted"));
+ // } else {
+ // accessMode.select(amh.getMessage("choice.class.item.unrestricted"));
+ // }
+
+ if (System.getProperty("http.proxyHost") != null) {
+ proxyHost.setText(System.getProperty("http.proxyHost"));
+ proxyPort.setText(System.getProperty("http.proxyPort"));
+ HttpClient.proxyPort = Integer.valueOf(System.getProperty("http.proxyPort")).intValue();
+ }
+ else {
+ proxyHost.setText("");
+ proxyPort.setText("");
+ }
+
+ // if (Boolean.getBoolean("appletviewer.security.allowUnsigned")) {
+ // unsignedMode.select(amh.getMessage("choice.unsignedapplet.yes"));
+ // } else {
+ // unsignedMode.select(amh.getMessage("choice.unsignedapplet.no"));
+ // }
+ }
+
+ void apply() {
+ // Get properties, set version
+ Properties props = System.getProperties();
+ if (proxyHost.getText().length() > 0) {
+ props.put("http.proxyHost", proxyHost.getText().trim());
+ props.put("http.proxyPort", proxyPort.getText().trim());
+ } else {
+ props.remove("http.proxyHost");
+ }
+ if ("None".equals(networkMode.getSelectedItem())) {
+ props.put("appletviewer.security.mode", "none");
+ } else if ("Unrestricted".equals(networkMode.getSelectedItem())) {
+ props.put("appletviewer.security.mode", "unrestricted");
+ } else {
+ props.put("appletviewer.security.mode", "host");
+ }
+
+ if ("Restricted".equals(accessMode.getSelectedItem())) {
+ props.put("package.restrict.access.sun", "true");
+ props.put("package.restrict.access.netscape", "true");
+ props.put("package.restrict.access.stardiv", "true");
+ } else {
+ props.put("package.restrict.access.sun", "false");
+ props.put("package.restrict.access.netscape", "false");
+ props.put("package.restrict.access.stardiv", "false");
+ }
+
+ if ("Yes".equals(unsignedMode.getSelectedItem())) {
+ props.put("appletviewer.security.allowUnsigned", "true");
+ } else {
+ props.put("appletviewer.security.allowUnsigned", "false");
+ }
+
+ // Save properties
+ try {
+ reset();
+
+ FileOutputStream out = new FileOutputStream(AppletViewer.theUserPropertiesFile);
+ props.save(out, "AppletViewer");
+ out.close();
+ setVisible( false );
+ } catch (IOException e) {
+ System.out.println(amh.getMessage("apply.exception", e));
+ e.printStackTrace();
+ reset();
+ }
+ }
+
+ public boolean action(Event evt, Object obj) {
+ if (amh.getMessage("button.apply").equals(obj)) {
+ apply();
+ return true;
+ }
+ if (amh.getMessage("button.reset").equals(obj)) {
+ reset();
+ return true;
+ }
+ if (amh.getMessage("button.cancel").equals(obj)) {
+ setVisible( false );
+ return true;
+ }
+ return false;
+ }
+
+ private static AppletMessageHandler amh = new AppletMessageHandler("appletprops");
+
+}
diff --git a/sj2/stardiv/app/AppletViewer.java b/sj2/stardiv/app/AppletViewer.java
new file mode 100644
index 000000000000..0104eebdc5de
--- /dev/null
+++ b/sj2/stardiv/app/AppletViewer.java
@@ -0,0 +1,1025 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppletViewer.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.app;
+
+import java.awt.Toolkit;
+
+import java.net.InetAddress;
+
+//import stardiv.applet.AppletMessageHandler;
+import stardiv.applet.AppletExecutionContext;
+import stardiv.applet.DocumentProxy;
+
+//import stardiv.js.ip.RootTaskManager;
+//import stardiv.js.ip.BaseObj;
+//import stardiv.js.ide.Ide;
+//import stardiv.js.ne.RunTime;
+//import stardiv.js.base.IdentifierPool;
+//import stardiv.js.base.Identifier;
+//import stardiv.memory.AtomUnion;
+//import stardiv.js.ip.Ctor;
+import stardiv.controller.SjSettings;
+
+import java.util.*;
+import java.io.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.*;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+
+/**
+ * A frame to show the applet tag in.
+ */
+class TextFrame extends Frame {
+ /**
+ * Create the tag frame.
+ */
+ TextFrame(int x, int y, String title, String text) {
+ setTitle(title);
+ TextArea txt = new TextArea(20, 60);
+ txt.setText(text);
+ txt.setEditable(false);
+
+ add("Center", txt);
+
+ Panel p = new Panel();
+ add("South", p);
+ Button b = new Button(amh.getMessage("button.dismiss", "Dismiss"));
+ p.add(b);
+
+ class ActionEventListener implements ActionListener {
+ public void actionPerformed(ActionEvent evt) {
+ dispose();
+ }
+ }
+ b.addActionListener(new ActionEventListener());
+
+ pack();
+ setLocation(x, y);
+ setVisible(true);
+
+ WindowListener windowEventListener = new WindowAdapter() {
+
+ public void windowClosing(WindowEvent evt) {
+ dispose();
+ }
+ };
+
+ addWindowListener(windowEventListener);
+ }
+ private static AppletMessageHandler amh = new AppletMessageHandler("textframe");
+
+}
+
+/**
+ * The toplevel applet viewer.
+ */
+public class AppletViewer extends Frame implements Observer {
+ com.sun.star.lib.sandbox.ResourceViewer resourceViewer;
+
+ /**
+ * Some constants...
+ */
+ private static String defaultSaveFile = "Applet.ser";
+
+ /**
+ * Look here for the properties file
+ */
+ public static File theUserPropertiesFile;
+ public static File theAppletViewerPropsFile;
+
+ //private Ide aIde;
+ //private RootTaskManager aRTM;
+ //private BaseObj aRootObj;
+
+ private AppletExecutionContext appletExecutionContext = null;
+ Hashtable atts = null;
+
+ static DocumentProxy documentViewer = null;
+
+ /**
+ * The status line.
+ */
+ Label label;
+
+ /**
+ * output status messages to this stream
+ */
+
+ PrintStream statusMsgStream;
+
+ static Vector contexts = new Vector();
+
+ private final class UserActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent evt) {
+ processUserAction(evt);
+ }
+ }
+
+ static {
+ String sep = File.separator;
+
+ File userHome = new File(System.getProperty("user.home"));
+
+ File AVHome = new File(userHome, ".hotjava");
+ // ensure the props folder can be made
+ AVHome.mkdirs();
+
+ theUserPropertiesFile = new File(AVHome, "properties");
+ File JH = new File(System.getProperty("java.home"));
+ theAppletViewerPropsFile = new File(JH, "lib" + sep + "appletviewer.properties");
+ };
+
+ /**
+ * Create the applet viewer
+ */
+ public AppletViewer(int x, int y, URL doc, Hashtable atts, PrintStream statusMsgStream) {
+// resourceViewer = new stardiv.util.ResourceViewer();
+// resourceViewer.show();
+ System.err.println("#*#*#*:" + sun.awt.ScreenUpdater.updater);
+ this.statusMsgStream = statusMsgStream;
+ this.atts = atts;
+
+ setTitle(amh.getMessage("tool.title", atts.get("code")));
+
+ MenuBar mb = new MenuBar();
+
+ Menu m = new Menu(amh.getMessage("menu.applet"));
+
+ addMenuItem(m, "menuitem.restart");
+ addMenuItem(m, "menuitem.reload");
+ addMenuItem(m, "menuitem.stop");
+ addMenuItem(m, "menuitem.save");
+ addMenuItem(m, "menuitem.start");
+ addMenuItem(m, "menuitem.clone");
+ m.add(new MenuItem("-"));
+ addMenuItem(m, "menuitem.tag");
+ addMenuItem(m, "menuitem.info");
+ addMenuItem(m, "menuitem.edit").setEnabled( false );
+ addMenuItem(m, "menuitem.encoding");
+ m.add(new MenuItem("-"));
+ addMenuItem(m, "menuitem.print");
+ m.add(new MenuItem("-"));
+ addMenuItem(m, "menuitem.props");
+ m.add(new MenuItem("-"));
+ addMenuItem(m, "menuitem.close");
+ // if (factory.isStandalone()) {
+ addMenuItem(m, "menuitem.quit");
+ // }
+
+ mb.add(m);
+
+ setMenuBar(mb);
+
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent evt) {
+ appletExecutionContext.shutdown();
+ }
+
+ public void windowIconified(WindowEvent evt) {
+ appletExecutionContext.sendLoad();
+ }
+
+ public void windowDeiconified(WindowEvent evt) {
+ appletExecutionContext.sendStart();
+ }
+ });
+
+ add("South", label = new Label(amh.getMessage("label.hello")));
+
+ appletExecutionContext = new AppletExecutionContext(doc, atts, this, 0);
+ appletExecutionContext.init();
+
+ appletExecutionContext.addObserver(this);
+ contexts.addElement(appletExecutionContext);
+
+ pack();
+ setVisible(true);
+
+// appletExecutionContext.send();
+ appletExecutionContext.startUp();
+
+/*
+ if( atts.get( "mayscript" ) != null ) {
+ aIde = new Ide();
+ aRTM = aIde.getActRootTaskManager();
+ aRootObj = new BaseObj( aRTM );
+ //Ctor aCtor = new AppletCtor( aRTM, "Window" );
+ //aRootObj.initProperties( aCtor, aCtor.getStaticPropCount(), aCtor.getBasePropCount() );
+ //aRootObj.setCtor( aCtor );
+ aRTM.setRootObj( aRootObj );
+ RunTime aRT = new RunTime( aRootObj, aRTM );
+ aIde.setRootObj( aRootObj );
+
+ AtomUnion aAU = new AtomUnion();
+ BaseObj aDocument = new BaseObj( aRTM );
+ aAU.setObject( aDocument );
+ Identifier aId = IdentifierPool.aGlobalPool.addIdentifier( "RootObject" );
+ aRootObj.newProperty( aId, aAU );
+ IdentifierPool.aGlobalPool.releaseIdentifier( aId );
+
+ String pName = (String)atts.get( "name" );
+ if( pName != null ) {
+ BaseObj aApplet = new BaseObj( aRTM );
+ aAU.setObject( aApplet );
+ aId = IdentifierPool.aGlobalPool.addIdentifier( pName );
+ aDocument.newProperty( aId, aAU );
+ IdentifierPool.aGlobalPool.releaseIdentifier( aId );
+ }
+ }
+ */
+ }
+
+ public MenuItem addMenuItem(Menu m, String s) {
+ MenuItem mItem = new MenuItem(amh.getMessage(s));
+ mItem.addActionListener(new UserActionListener());
+ return m.add(mItem);
+ }
+
+ /**
+ * Ignore.
+ */
+ public void showDocument(URL url) {
+ }
+
+ /**
+ * Ignore.
+ */
+ public void showDocument(URL url, String target) {
+ }
+
+ /**
+ * Show status.
+ */
+ public void showStatus(String status) {
+ label.setText(status);
+ }
+
+ public void update(Observable observable, Object status) {
+ showStatus((String)status);
+ }
+
+ public Object getJavaScriptJSObjectWindow() {
+ //if( aRootObj != null )
+ // return aRootObj.getJSObject();
+ return null;
+ }
+
+
+ /**
+ * System parameters.
+ */
+ static Hashtable systemParam = new Hashtable();
+
+ static {
+ systemParam.put("codebase", "codebase");
+ systemParam.put("code", "code");
+ systemParam.put("alt", "alt");
+ systemParam.put("width", "width");
+ systemParam.put("height", "height");
+ systemParam.put("align", "align");
+ systemParam.put("vspace", "vspace");
+ systemParam.put("hspace", "hspace");
+ }
+
+ /**
+ * Print the HTML tag.
+ */
+ public static void printTag(PrintStream out, Hashtable atts) {
+ out.print("<applet");
+
+ String v = (String)atts.get("codebase");
+ if (v != null) {
+ out.print(" codebase=\"" + v + "\"");
+ }
+
+ v = (String)atts.get("code");
+ if (v == null) {
+ v = "applet.class";
+ }
+ out.print(" code=\"" + v + "\"");
+ v = (String)atts.get("width");
+ if (v == null) {
+ v = "150";
+ }
+ out.print(" width=" + v);
+
+ v = (String)atts.get("height");
+ if (v == null) {
+ v = "100";
+ }
+ out.print(" height=" + v);
+
+ v = (String)atts.get("name");
+ if (v != null) {
+ out.print(" name=\"" + v + "\"");
+ }
+ out.println(">");
+
+ // A very slow sorting algorithm
+ int len = atts.size();
+ String params[] = new String[len];
+ len = 0;
+ for (Enumeration e = atts.keys() ; e.hasMoreElements() ;) {
+ String param = (String)e.nextElement();
+ int i = 0;
+ for (; i < len ; i++) {
+ if (params[i].compareTo(param) >= 0) {
+ break;
+ }
+ }
+ System.arraycopy(params, i, params, i + 1, len - i);
+ params[i] = param;
+ len++;
+ }
+
+ for (int i = 0 ; i < len ; i++) {
+ String param = params[i];
+ if (systemParam.get(param) == null) {
+ out.println("<param name=" + param +
+ " value=\"" + atts.get(param) + "\">");
+ }
+ }
+ out.println("</applet>");
+ }
+
+ /**
+ * Make sure the atrributes are uptodate.
+ */
+ public void updateAtts() {
+ Dimension d = getSize();
+ Insets in = getInsets();
+ atts.put("width", new Integer(d.width - (in.left + in.right)).toString());
+ atts.put("height", new Integer(d.height - (in.top + in.bottom)).toString());
+ }
+
+ /**
+ * Save the applet to a well known file (for now) as a serialized object
+ */
+ void appletSave() {
+ // REMIND -- should check that the applet has really stopped
+ FileDialog fd = new FileDialog(this, "Serialize Applet into File", FileDialog.SAVE);
+ // needed for a bug under Solaris...
+ fd.setDirectory(System.getProperty("user.dir"));
+ fd.setFile(defaultSaveFile);
+ fd.show();
+ String fname = fd.getFile();
+ if (fname == null) {
+ return; // cancelled
+ }
+ String dname = fd.getDirectory();
+ File file = new File(dname, fname);
+
+ try {
+ OutputStream s = new FileOutputStream(file);
+ ObjectOutputStream os = new ObjectOutputStream(s);
+ showStatus(amh.getMessage("appletsave.err1",
+ appletExecutionContext.getApplet().toString(), file.toString()));
+ os.writeObject(appletExecutionContext.getApplet());
+ } catch (IOException ex) {
+ System.err.println(amh.getMessage("appletsave.err2", ex));
+ }
+ }
+
+ /**
+ * Clone the viewer and the applet.
+ */
+ void appletClone() {
+ Point p = getLocation();
+ updateAtts();
+ // factory.createAppletViewer(p.x + 30, p.y + 10,
+ // pHelper.panel.documentURL, (Hashtable)pHelper.panel.atts.clone());
+ }
+
+ /**
+ * Show the applet tag.
+ */
+ void appletTag() {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ updateAtts();
+ printTag(new PrintStream(out), atts);
+ showStatus(amh.getMessage("applettag"));
+
+ Point p = getLocation();
+ new TextFrame(p.x + 50, p.y + 20, amh.getMessage("applettag.textframe"), out.toString());
+ }
+
+ /**
+ * Show the applet info.
+ */
+ void appletInfo() {
+ String str = appletExecutionContext.getApplet().getAppletInfo();
+ if (str == null) {
+ str = amh.getMessage("appletinfo.applet");
+ }
+ str += "\n\n";
+
+ String atts[][] = appletExecutionContext.getApplet().getParameterInfo();
+ if (atts != null) {
+ for (int i = 0 ; i < atts.length ; i++) {
+ str += atts[i][0] + " -- " + atts[i][1] + " -- " + atts[i][2] + "\n";
+ }
+ } else {
+ str += amh.getMessage("appletinfo.param");
+ }
+
+ Point p = getLocation();
+ new TextFrame(p.x + 50, p.y + 20, amh.getMessage("appletinfo.textframe"), str);
+
+ }
+
+ /**
+ * Show character encoding type
+ */
+ void appletCharacterEncoding() {
+ showStatus(amh.getMessage("appletencoding", encoding));
+ }
+
+ /**
+ * Edit the applet.
+ */
+ void appletEdit() {
+ }
+
+ /**
+ * Print the applet.
+ */
+ void appletPrint() {
+ PrintJob pj = Toolkit.getDefaultToolkit().
+ getPrintJob(this, amh.getMessage("appletprint.printjob"), (Properties)null);
+
+
+ if (pj != null) {
+ Dimension pageDim = pj.getPageDimension();
+ int pageRes = pj.getPageResolution();
+ boolean lastFirst = pj.lastPageFirst();
+
+ Graphics g = pj.getGraphics();
+ if (g != null) {
+ appletExecutionContext.getApplet().printComponents(g);
+ g.dispose();
+ } else {
+ statusMsgStream.println(amh.getMessage("appletprint.fail"));
+ }
+ statusMsgStream.println(amh.getMessage("appletprint.finish"));
+ pj.end();
+
+ } else {
+ statusMsgStream.println(amh.getMessage("appletprint.cancel"));
+ }
+ }
+
+ /**
+ * Properties.
+ */
+ AppletProps props;
+ public synchronized void networkProperties() {
+ if (props == null) {
+ props = new AppletProps(appletExecutionContext);
+ }
+ props.addNotify();
+ props.setVisible(true);
+ }
+
+ /**
+ * Close this viewer.
+ * Stop, Destroy, Dispose and Quit an AppletView, then
+ * reclaim resources and exit the program if this is
+ * the last applet.
+ */
+ public void appletClose() {
+ appletExecutionContext.shutdown();
+ contexts.removeElement(this);
+
+ if (contexts.size() == 0) {
+ appletSystemExit();
+ }
+ }
+
+
+// public static void writeClasses() {
+// try {
+// java.io.FileOutputStream file = new FileOutputStream("classes.txt");
+// java.io.PrintStream printStream = new java.io.PrintStream(file);
+
+// printStream.println("- .* .*");
+// Enumeration elements = stardiv.util.HardClassContext.classList.elements();
+// while(elements.hasMoreElements()) {
+// String string = (String)elements.nextElement();
+
+// String packageName = "";
+// String className = string;
+
+// int lastIndex = string.lastIndexOf('.');
+// if(lastIndex > -1) {
+// packageName = string.substring(0, lastIndex);
+// className = string.substring(lastIndex + 1);
+// }
+
+// printStream.print("+ ");
+// int index;
+// while((index = packageName.indexOf('.')) > -1) {
+// printStream.print(packageName.substring(0, index) + "\\\\");
+// packageName = packageName.substring(index + 1);
+// }
+// printStream.print(packageName + " ");
+
+// while((index = className.indexOf('$')) > -1) {
+// printStream.print(className.substring(0, index) + "\\$");
+// className = className.substring(index + 1);
+// }
+// printStream.println(className + "\\.class");
+// }
+// file.close();
+// }
+// catch(java.io.IOException eio) {
+// System.err.println("IOException:" + eio);
+// }
+// }
+
+ /**
+ * Exit the program.
+ * Exit from the program (if not stand alone) - do no clean-up
+ */
+ private void appletSystemExit() {
+ // if (factory.isStandalone())
+ System.exit(0);
+ }
+
+ /**
+ * Quit all viewers.
+ * Shutdown all viewers properly then
+ * exit from the program (if not stand alone)
+ */
+ protected void appletQuit() {
+ appletExecutionContext.shutdown();
+ appletSystemExit();
+ }
+
+ /**
+ * Handle events.
+ */
+ public void processUserAction(ActionEvent evt) {
+
+ String label = ((MenuItem)evt.getSource()).getLabel();
+
+ if (amh.getMessage("menuitem.restart").equals(label)) {
+ appletExecutionContext.restart();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.reload").equals(label)) {
+ appletExecutionContext.reload();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.clone").equals(label)) {
+ appletClone();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.stop").equals(label)) {
+ appletExecutionContext.sendStop();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.save").equals(label)) {
+ appletSave();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.start").equals(label)) {
+ appletExecutionContext.sendStart();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.tag").equals(label)) {
+ appletTag();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.info").equals(label)) {
+ appletInfo();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.encoding").equals(label)) {
+ appletCharacterEncoding();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.edit").equals(label)) {
+ appletEdit();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.print").equals(label)) {
+ appletPrint();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.props").equals(label)) {
+ networkProperties();
+ return;
+ }
+
+ if (amh.getMessage("menuitem.close").equals(label)) {
+ appletClose();
+ return;
+ }
+
+ if (/*factory.isStandalone() && */amh.getMessage("menuitem.quit").equals(label)) {
+ appletQuit();
+ return;
+ }
+ //statusMsgStream.println("evt = " + evt);
+ }
+
+ /**
+ * Prepare the enviroment for executing applets.
+ */
+ public static void init() {
+ Properties props = new Properties();
+ props.put( "http.proxyHost", "wwwproxy" );
+ props.put( "http.proxyPort", "3128" );
+ props.put( "ftpProxySet", "true" );
+ props.put( "ftpProxyHost", "wwwproxy" );
+ props.put( "ftpProxyPort", "3128" );
+ props.put( "ftpProxyPort", "3128" );
+ props.put( "stardiv.debug.trace", "window" );
+ props.put( "stardiv.debug.warning", "window" );
+ props.put( "stardiv.debug.error", "window" );
+ props.put( "stardiv.security.defaultSecurityManager", "true" );
+
+ // Try loading the appletviewer properties file to get messages, etc.
+// try {
+// FileInputStream in = new FileInputStream(theAppletViewerPropsFile);
+// props.load(new BufferedInputStream(in));
+// in.close();
+// } catch (Exception e) {
+// System.out.println(amh.getMessage("init.err"));
+// }
+
+ // Try loading the saved user properties file to override some
+ // of the above defaults.
+ try {
+ FileInputStream in = new FileInputStream(theUserPropertiesFile);
+ props.load(new BufferedInputStream(in));
+ in.close();
+ } catch (Exception e) {
+ /* is it really necessary to say this?
+ This is always the case the first time we run..
+ System.out.println("[no properties loaded, using defaults]"); */
+ }
+
+ // Install a property list.
+
+ SjSettings.changeProperties(props);
+ }
+
+ /**
+ * The current character.
+ */
+ static int c;
+
+ /**
+ * Scan spaces.
+ */
+ public static void skipSpace(Reader in) throws IOException {
+ while ((c >= 0) && ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'))) {
+ c = in.read();
+ }
+ }
+
+ /**
+ * Scan identifier
+ */
+ public static String scanIdentifier(Reader in) throws IOException {
+ StringBuffer buf = new StringBuffer();
+ while (true) {
+ if (((c >= 'a') && (c <= 'z')) ||
+ ((c >= 'A') && (c <= 'Z')) ||
+ ((c >= '0') && (c <= '9')) || (c == '_')) {
+ buf.append((char)c);
+ c = in.read();
+ } else {
+ return buf.toString();
+ }
+ }
+ }
+
+ /**
+ * Scan tag
+ */
+ public static Hashtable scanTag(Reader in) throws IOException {
+ Hashtable atts = new Hashtable();
+ skipSpace(in);
+ while (c >= 0 && c != '>') {
+ String att = scanIdentifier(in);
+ String val = "";
+ skipSpace(in);
+ if (c == '=') {
+ int quote = -1;
+ c = in.read();
+ skipSpace(in);
+ if ((c == '\'') || (c == '\"')) {
+ quote = c;
+ c = in.read();
+ }
+ StringBuffer buf = new StringBuffer();
+ while ((c > 0) &&
+ (((quote < 0) && (c != ' ') && (c != '\t') &&
+ (c != '\n') && (c != '\r') && (c != '>'))
+ || ((quote >= 0) && (c != quote)))) {
+ buf.append((char)c);
+ c = in.read();
+ }
+ if (c == quote) {
+ c = in.read();
+ }
+ skipSpace(in);
+ val = buf.toString();
+ }
+ //statusMsgStream.println("PUT " + att + " = '" + val + "'");
+ atts.put(att.toLowerCase(), val);
+ skipSpace(in);
+ }
+ return atts;
+ }
+
+ static int x = 100;
+ static int y = 50;
+
+ static String encoding = null;
+
+ static private Reader makeReader(InputStream is) {
+ if (encoding != null) {
+ try {
+ return new BufferedReader(new InputStreamReader(is, encoding));
+ } catch (IOException x) { }
+ }
+ InputStreamReader r = new InputStreamReader(is);
+ encoding = r.getEncoding();
+ return new BufferedReader(r);
+ }
+
+ /**
+ * Scan an html file for <applet> tags
+ */
+ public static void parse(URL url) throws IOException {
+ parse(url, System.out);
+ }
+
+ public static void parse(URL url, PrintStream statusMsgStream) throws IOException {
+
+ // warning messages
+ String requiresNameWarning = amh.getMessage("parse.warning.requiresname");
+ String paramOutsideWarning = amh.getMessage("parse.warning.paramoutside");
+ String requiresCodeWarning = amh.getMessage("parse.warning.requirescode");
+ String requiresHeightWarning = amh.getMessage("parse.warning.requiresheight");
+ String requiresWidthWarning = amh.getMessage("parse.warning.requireswidth");
+ String appNotLongerSupportedWarning = amh.getMessage("parse.warning.appnotLongersupported");
+
+ java.net.URLConnection conn = url.openConnection();
+ Reader in = makeReader(conn.getInputStream());
+ /* The original URL may have been redirected - this
+ * sets it to whatever URL/codebase we ended up getting
+ */
+ url = conn.getURL();
+
+ Hashtable atts = null;
+ while(true) {
+ c = in.read();
+ if (c == -1)
+ break;
+
+ if (c == '<') {
+ c = in.read();
+ if (c == '/') {
+ c = in.read();
+ String nm = scanIdentifier(in);
+ if (nm.equalsIgnoreCase("applet")) {
+ if (atts != null) {
+ new AppletViewer(x, y, url, atts, System.out);
+ x += 50;
+ y += 20;
+ // make sure we don't go too far!
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ if (x > d.width - 30)
+ x = 100;
+ if (y > d.height - 30)
+ y = 50;
+ }
+ atts = null;
+ }
+ }
+ else {
+ String nm = scanIdentifier(in);
+ if (nm.equalsIgnoreCase("param")) {
+ Hashtable t = scanTag(in);
+ String att = (String)t.get("name");
+ if (att == null) {
+ statusMsgStream.println(requiresNameWarning);
+ } else {
+ String val = (String)t.get("value");
+ if (val == null) {
+ statusMsgStream.println(requiresNameWarning);
+ } else if (atts != null) {
+ atts.put(att.toLowerCase(), val);
+ } else {
+ statusMsgStream.println(paramOutsideWarning);
+ }
+ }
+ }
+ else if (nm.equalsIgnoreCase("applet")) {
+ atts = scanTag(in);
+ if (atts.get("code") == null && atts.get("object") == null) {
+ statusMsgStream.println(requiresCodeWarning);
+ atts = null;
+ } else if (atts.get("width") == null) {
+ statusMsgStream.println(requiresWidthWarning);
+ atts = null;
+ } else if (atts.get("height") == null) {
+ statusMsgStream.println(requiresHeightWarning);
+ atts = null;
+ }
+ }
+ else if (nm.equalsIgnoreCase("app")) {
+ statusMsgStream.println(appNotLongerSupportedWarning);
+ Hashtable atts2 = scanTag(in);
+ nm = (String)atts2.get("class");
+ if (nm != null) {
+ atts2.remove("class");
+ atts2.put("code", nm + ".class");
+ }
+ nm = (String)atts2.get("src");
+ if (nm != null) {
+ atts2.remove("src");
+ atts2.put("codebase", nm);
+ }
+ if (atts2.get("width") == null) {
+ atts2.put("width", "100");
+ }
+ if (atts2.get("height") == null) {
+ atts2.put("height", "100");
+ }
+ printTag(statusMsgStream, atts2);
+ statusMsgStream.println();
+ }
+ }
+ }
+ }
+ in.close();
+ }
+
+ /**
+ * Print usage
+ */
+ static void usage() {
+ System.out.println(amh.getMessage("usage"));
+ }
+
+ static boolean didInitialize = false;
+
+ /**
+ * mainInit can be called by direct clients
+ */
+ public static void mainInit() {
+ if (! didInitialize) {
+ didInitialize = true;
+
+ init();
+
+ }
+ }
+
+ /**
+ * Main
+ */
+ public static void main(String argv[]) {
+ mainInit();
+
+ // Parse arguments
+ if (argv.length == 0) {
+ System.out.println(amh.getMessage("main.err.inputfile"));
+ usage();
+ return;
+ }
+
+ // Parse the documents
+ for (int i = 0 ; i < argv.length ; i++) {
+ try {
+ URL url = null;
+
+ if (argv[i].equals("-encoding")) {
+ if(i + 1 < argv.length) {
+ i++;
+ encoding = argv[i];
+ continue;
+ } else {
+ usage();
+ System.exit(1);
+ }
+ }
+ else
+ if (argv[i].indexOf(':') <= 1) {
+ String userDir = System.getProperty("user.dir");
+ String prot;
+ // prepend native separator to path iff not present
+ if (userDir.charAt(0) == '/' ||
+ userDir.charAt(0) == java.io.File.separatorChar) {
+ prot = "file:";
+ } else {
+ prot = "file:/";
+ }
+ url = new URL(prot + userDir.replace(File.separatorChar, '/')
+ + "/");
+ url = new URL(url, argv[i]);
+ } else {
+ url = new URL(argv[i]);
+ }
+
+ parse(url);
+ documentViewer = DocumentProxy.getDocumentProxy(url, Toolkit.getDefaultToolkit());
+ } catch (MalformedURLException e) {
+ System.out.println(amh.getMessage("main.err.badurl", argv[i], e.getMessage()));
+ System.exit(1);
+ } catch (IOException e) {
+ System.out.println(amh.getMessage("main.err.io", e.getMessage()));
+ if (argv[i].indexOf(':') < 0) {
+ System.out.println(amh.getMessage("main.err.readablefile", argv[i]));
+ } else {
+ System.out.println(amh.getMessage("main.err.correcturl", argv[i]));
+ }
+ System.exit(1);
+ }
+ }
+ /*
+ if (documentViewer.countApplets() == 0) {
+ System.out.println(amh.getMessage("main.warning"));
+ usage();
+ System.exit(1);
+ }*/
+ }
+ private static AppletMessageHandler amh = new AppletMessageHandler("appletviewer");
+}
diff --git a/sj2/stardiv/app/AppletViewerFactory.java b/sj2/stardiv/app/AppletViewerFactory.java
new file mode 100644
index 000000000000..c2019046be71
--- /dev/null
+++ b/sj2/stardiv/app/AppletViewerFactory.java
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppletViewerFactory.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ * AppletViewerFactory.java
+ */
+
+package stardiv.app;
+
+import java.util.Hashtable;
+import java.net.URL;
+import java.awt.MenuBar;
+
+public
+interface AppletViewerFactory {
+ public AppletViewer createAppletViewer(int x, int y, URL doc, Hashtable atts);
+ public MenuBar getBaseMenuBar();
+ public boolean isStandalone();
+}
diff --git a/sj2/stardiv/app/MsgAppletViewer.java b/sj2/stardiv/app/MsgAppletViewer.java
new file mode 100644
index 000000000000..e37d74f724ab
--- /dev/null
+++ b/sj2/stardiv/app/MsgAppletViewer.java
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * $RCSfile: MsgAppletViewer.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.app;
+
+import java.util.ListResourceBundle;
+
+public class MsgAppletViewer extends ListResourceBundle {
+
+ public Object[][] getContents() {
+ return contents;
+ }
+
+ static final Object[][] contents = {
+ {"textframe.button.dismiss", "Dismiss"},
+ {"appletviewer.tool.title", "Applet Viewer: {0}"},
+ {"appletviewer.menu.applet", "Applet"},
+ {"appletviewer.menuitem.restart", "Restart"},
+ {"appletviewer.menuitem.reload", "Reload"},
+ {"appletviewer.menuitem.stop", "Stop"},
+ {"appletviewer.menuitem.save", "Save..."},
+ {"appletviewer.menuitem.start", "Start"},
+ {"appletviewer.menuitem.clone", "Clone..."},
+ {"appletviewer.menuitem.tag", "Tag..."},
+ {"appletviewer.menuitem.info", "Info..."},
+ {"appletviewer.menuitem.edit", "Edit"},
+ {"appletviewer.menuitem.encoding", "Character Encoding"},
+ {"appletviewer.menuitem.print", "Print..."},
+ {"appletviewer.menuitem.props", "Properties..."},
+ {"appletviewer.menuitem.close", "Close"},
+ {"appletviewer.menuitem.quit", "Quit"},
+ {"appletviewer.label.hello", "Hello..."},
+ {"appletviewer.status.start", "starting applet..."},
+ {"appletviewer.appletsave.err1", "serializing an {0} to {1}"},
+ {"appletviewer.appletsave.err2", "in appletSave: {0}"},
+ {"appletviewer.applettag", "Tag shown"},
+ {"appletviewer.applettag.textframe", "Applet HTML Tag"},
+ {"appletviewer.appletinfo.applet", "-- no applet info --"},
+ {"appletviewer.appletinfo.param", "-- no parameter info --"},
+ {"appletviewer.appletinfo.textframe", "Applet Info"},
+ {"appletviewer.appletprint.printjob", "Print Applet"},
+ {"appletviewer.appletprint.fail", "Printing failed."},
+ {"appletviewer.appletprint.finish", "Finished printing."},
+ {"appletviewer.appletprint.cancel", "Printing cancelled."},
+ {"appletviewer.appletencoding", "Character Encoding: {0}"},
+ {"appletviewer.init.err", "[no appletviewer.properties file found!]"},
+ {"appletviewer.parse.warning.requiresname", "Warning: <param name=... value=...> tag requires name attribute."},
+ {"appletviewer.parse.warning.paramoutside", "Warning: <param> tag outside <applet> ... </applet>."},
+ {"appletviewer.parse.warning.requirescode", "Warning: <applet> tag requires code attribute."},
+ {"appletviewer.parse.warning.requiresheight", "Warning: <applet> tag requires height attribute."},
+ {"appletviewer.parse.warning.requireswidth", "Warning: <applet> tag requires width attribute."},
+ {"appletviewer.parse.warning.appnotLongersupported", "Warning: <app> tag no longer supported, use <applet> instead:"},
+ {"appletviewer.usage", "usage: appletviewer [-debug] [-J<javaflag>] [-encoding <character encoding type> ] url|file ..."},
+ {"appletviewer.main.err.inputfile", "No input files specified."},
+ {"appletviewer.main.err.badurl", "Bad URL: {0} ( {1} )"},
+ {"appletviewer.main.err.io", "I/O exception while reading: {0}"},
+ {"appletviewer.main.err.readablefile", "Make sure that {0} is a file and is readable."},
+ {"appletviewer.main.err.correcturl", "Is {0} the correct URL?"},
+ {"appletviewer.main.warning", "Warning: No Applets were started. Make sure the input contains an <applet> tag."},
+ {"appletioexception.loadclass.throw.interrupted", "class loading interrupted: {0}"},
+ {"appletioexception.loadclass.throw.notloaded", "class not loaded: {0}"},
+ {"appletclassloader.loadcode.verbose", "Opening stream to: {0} to get {1}"},
+ {"appletclassloader.filenotfound", "File not found when looking for: {0}"},
+ {"appletclassloader.fileformat", "File format exception when loading: {0}"},
+ {"appletclassloader.fileioexception", "I/O exception when loading: {0}"},
+ {"appletclassloader.fileexception", "{0} exception when loading: {1}"},
+ {"appletclassloader.filedeath", "{0} killed when loading: {1}"},
+ {"appletclassloader.fileerror", "{0} error when loading: {1}"},
+ {"appletclassloader.findclass.verbose.findclass", "{0} find class {1}"},
+ {"appletclassloader.findclass.verbose.openstream", "Opening stream to: {0} to get {1}"},
+ {"appletclassloader.getresource.verbose.forname", "AppletClassLoader.getResource for name: {0}"},
+ {"appletclassloader.getresource.verbose.found", "Found resource: {0} as a system resource"},
+ {"appletclassloader.getresourceasstream.verbose", "Found resource: {0} as a system resource"},
+ {"appletcopyright.title", "Copyright Notice"},
+ {"appletcopyright.button.accept", "Accept"},
+ {"appletcopyright.button.reject", "Reject"},
+ {"appletcopyright.defaultcontent", "Copyright (c) 1995, 1996, 1997 Sun Microsystems, Inc."},
+ {"appletcopyright.copyrightfile", "COPYRIGHT"},
+ {"appletcopyright.copyrightencoding", "8859_1"},
+ {"appletpanel.runloader.err", "Either object or code parameter!"},
+ {"appletpanel.runloader.exception", "exception while deserializing {0}"},
+ {"appletpanel.destroyed", "Applet destroyed."},
+ {"appletpanel.loaded", "Applet loaded."},
+ {"appletpanel.started", "Applet started."},
+ {"appletpanel.inited", "Applet initialized."},
+ {"appletpanel.stopped", "Applet stopped."},
+ {"appletpanel.disposed", "Applet disposed."},
+ {"appletpanel.nocode", "APPLET tag missing CODE parameter."},
+ {"appletpanel.notfound", "load: class {0} not found."},
+ {"appletpanel.nocreate", "load: {0} can''t be instantiated."},
+ {"appletpanel.noconstruct", "load: {0} is not public or has no public constructor."},
+ {"appletpanel.death", "killed"},
+ {"appletpanel.exception", "exception: {0}."},
+ {"appletpanel.exception2", "exception: {0}: {1}."},
+ {"appletpanel.error", "error: {0}."},
+ {"appletpanel.error2", "error: {0}: {1}."},
+ {"appletpanel.notloaded", "Init: applet not loaded."},
+ {"appletpanel.notinited", "Start: applet not initialized."},
+ {"appletpanel.notstarted", "Stop: applet not started."},
+ {"appletpanel.notstopped", "Destroy: applet not stopped."},
+ {"appletpanel.notdestroyed", "Dispose: applet not destroyed."},
+ {"appletpanel.notdisposed", "Load: applet not disposed."},
+ {"appletpanel.bail", "Interrupted: bailing out."},
+ {"appletpanel.filenotfound", "File not found when looking for: {0}"},
+ {"appletpanel.fileformat", "File format exception when loading: {0}"},
+ {"appletpanel.fileioexception", "I/O exception when loading: {0}"},
+ {"appletpanel.fileexception", "{0} exception when loading: {1}"},
+ {"appletpanel.filedeath", "{0} killed when loading: {1}"},
+ {"appletpanel.fileerror", "{0} error when loading: {1}"},
+ {"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream requires non-null loader"},
+ {"appletprops.title", "AppletViewer Properties"},
+ {"appletprops.label.http.server", "Http proxy server:"},
+ {"appletprops.label.http.proxy", "Http proxy port:"},
+ {"appletprops.label.network", "Network access:"},
+ {"appletprops.choice.network.item.none", "None"},
+ {"appletprops.choice.network.item.applethost", "Applet Host"},
+ {"appletprops.choice.network.item.unrestricted", "Unrestricted"},
+ {"appletprops.label.class", "Class access:"},
+ {"appletprops.choice.class.item.restricted", "Restricted"},
+ {"appletprops.choice.class.item.unrestricted", "Unrestricted"},
+ {"appletprops.label.unsignedapplet", "Allow unsigned applets:"},
+ {"appletprops.choice.unsignedapplet.no", "No"},
+ {"appletprops.choice.unsignedapplet.yes", "Yes"},
+ {"appletprops.button.apply", "Apply"},
+ {"appletprops.button.cancel", "Cancel"},
+ {"appletprops.button.reset", "Reset"},
+ {"appletprops.apply.exception", "Failed to save properties: {0}"},
+ {"appletsecurityexception.checkcreateclassloader", "Security Exception: classloader"},
+ {"appletsecurityexception.checkaccess.thread", "Security Exception: thread"},
+ {"appletsecurityexception.checkaccess.threadgroup", "Security Exception: threadgroup: {0}"},
+ {"appletsecurityexception.checkexit", "Security Exception: exit: {0}"},
+ {"appletsecurityexception.checkexec", "Security Exception: exec: {0}"},
+ {"appletsecurityexception.checklink", "Security Exception: link: {0}"},
+ {"appletsecurityexception.checkpropsaccess", "Security Exception: properties"},
+ {"appletsecurityexception.checkpropsaccess.key", "Security Exception: properties access {0}"},
+ {"appletsecurityexception.checkread.exception1", "Security Exception: {0}, {1}"},
+ {"appletsecurityexception.checkread.exception2", "Security Exception: file.read: {0}"},
+ {"appletsecurityexception.checkread", "Security Exception: file.read: {0} == {1}"},
+ {"appletsecurityexception.checkwrite.exception", "Security Exception: {0}, {1}"},
+ {"appletsecurityexception.checkwrite", "Security Exception: file.write: {0} == {1}"},
+ {"appletsecurityexception.checkread.fd", "Security Exception: fd.read"},
+ {"appletsecurityexception.checkwrite.fd", "Security Exception: fd.write"},
+ {"appletsecurityexception.checklisten", "Security Exception: socket.listen: {0}"},
+ {"appletsecurityexception.checkaccept", "Security Exception: socket.accept: {0}:{1}"},
+ {"appletsecurityexception.checkconnect.networknone", "Security Exception: socket.connect: {0}->{1}"},
+ {"appletsecurityexception.checkconnect.networkhost1", "Security Exception: Couldn''t connect to {0} with origin from {1}."},
+ {"appletsecurityexception.checkconnect.networkhost2", "Security Exception: Couldn''t resolve IP for host {0} or for {1}. "},
+ {"appletsecurityexception.checkconnect.networkhost3", "Security Exception: Could not resolve IP for host {0}. See the trustProxy property."},
+ {"appletsecurityexception.checkconnect", "Security Exception: connect: {0}->{1}"},
+ {"appletsecurityexception.checkpackageaccess", "Security Exception: cannot access package: {0}"},
+ {"appletsecurityexception.checkpackagedefinition", "Security Exception: cannot define package: {0}"},
+ {"appletsecurityexception.cannotsetfactory", "Security Exception: cannot set factory"},
+ {"appletsecurityexception.checkmemberaccess", "Security Exception: check member access"},
+ {"appletsecurityexception.checkgetprintjob", "Security Exception: getPrintJob"},
+ {"appletsecurityexception.checksystemclipboardaccess", "Security Exception: getSystemClipboard"},
+ {"appletsecurityexception.checkawteventqueueaccess", "Security Exception: getEventQueue"},
+ {"appletsecurityexception.checksecurityaccess", "Security Exception: security operation: {0}"},
+ {"appletsecurityexception.getsecuritycontext.unknown", "unknown class loader type. unable to check for getContext"},
+ {"appletsecurityexception.checkread.unknown", "unknown class loader type. unable to check for checking read {0}"},
+ {"appletsecurityexception.checkconnect.unknown", "unknown class loader type. unable to check for checking connect"},
+ {"appletsecurityexception.getresource.noclassaccess", "Cannot use getResource to access .class file: {0} in JDK1.1"},
+ };
+}
diff --git a/sj2/stardiv/app/makefile.mk b/sj2/stardiv/app/makefile.mk
new file mode 100644
index 000000000000..aa0f441c0e73
--- /dev/null
+++ b/sj2/stardiv/app/makefile.mk
@@ -0,0 +1,95 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sj2
+TARGET=app
+
+PACKAGE=stardiv$/app
+JARFILES=sandbox.jar
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ AppletViewer.java \
+ AppletViewerFactory.java \
+ AppletProps.java \
+ AppletMessageHandler.java \
+ MsgAppletViewer.java
+
+JAVACLASSFILES= \
+ $(CLASSDIR)$/$(PACKAGE)$/AppletViewer.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppletViewerFactory.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppletProps.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppletMessageHandler.class \
+ $(CLASSDIR)$/$(PACKAGE)$/MsgAppletViewer.class
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/sj2/stardiv/applet/AppletExecutionContext.java b/sj2/stardiv/applet/AppletExecutionContext.java
new file mode 100644
index 000000000000..faf36b0a9262
--- /dev/null
+++ b/sj2/stardiv/applet/AppletExecutionContext.java
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppletExecutionContext.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stardiv.applet;
+
+import java.applet.Applet;
+import java.applet.AppletStub;
+import java.applet.AppletContext;
+import java.applet.AudioClip;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Panel;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
+import sun.misc.Queue;
+
+import com.sun.star.lib.sandbox.ClassContextProxy;
+import com.sun.star.lib.sandbox.ExecutionContext;
+import com.sun.star.lib.sandbox.JarEntry;
+import com.sun.star.lib.sandbox.ResourceProxy;
+
+import com.sun.star.lib.sandbox.CodeSource;
+import com.sun.star.lib.sandbox.PermissionCollection;
+import com.sun.star.lib.sandbox.ProtectionDomain;
+import com.sun.star.lib.sandbox.RuntimePermission;
+import com.sun.star.lib.sandbox.FilePermission;
+import com.sun.star.lib.sandbox.SocketPermission;
+
+
+public final class AppletExecutionContext extends ExecutionContext
+ implements AppletStub, LiveConnectable
+{
+ private static final boolean DEBUG = false; // Enable / disable debug output
+
+ private Applet applet;
+ private Container container;
+
+ private DocumentProxy documentProxy;
+ private Hashtable parameters;
+
+ private String className;
+ private Vector jarResourceProxys = new Vector();
+
+ private URL documentURL = null;
+ private URL baseURL = null;
+
+ private ProtectionDomain protectionDomain;
+ private PermissionCollection permissionCollection;
+
+ private java.awt.Toolkit toolkit;
+
+ //************** C++ WRAPPER ******************
+ private long pCppJSbxObject;
+
+ synchronized public void ClearNativeHandle() {
+ pCppJSbxObject = 0;
+ if(DEBUG)System.err.println("### AppletExecutionContext.ClearNativeHandle");
+ }
+
+ public AppletExecutionContext(long pCppJSbxObject) {
+ this.pCppJSbxObject = pCppJSbxObject;
+ }
+ //************** C++ WRAPPER ******************
+
+ public AppletExecutionContext( URL documentURL,
+ Hashtable parameters,
+ Container container,
+ long pCppJSbxObject)
+ {
+ this(pCppJSbxObject);
+
+ if(DEBUG) System.err.println("#### AppletExecutionContext.<init>:" + documentURL + " " + parameters + " " + container + " " + pCppJSbxObject);
+ this.documentURL = documentURL;
+ this.parameters = parameters;
+ this.container = container;
+
+ toolkit = container.getToolkit();
+
+ documentProxy = DocumentProxy.getDocumentProxy(documentURL, toolkit);
+ addObserver(documentProxy);
+ }
+
+ public void init() {
+ baseURL = null;
+
+ try {
+ String codeBase = getParameter("codebase");
+
+ if (!codeBase.endsWith("/")) {
+ codeBase += "/";
+ }
+ baseURL = new URL(documentURL, codeBase);
+ }
+ catch (Exception e) {
+ try {
+ String file = documentURL.getFile();
+ int i = file.lastIndexOf('/');
+
+ if (i > 0 && i < file.length() - 1) {
+ baseURL = new URL(documentURL, file.substring(0, i + 1));
+ }
+ }
+ catch (Exception e2) {
+ baseURL = documentURL;
+ }
+ }
+
+ if(baseURL == null)
+ baseURL = documentURL;
+
+ className = getParameter("code");
+ String defaultExtension = ".class";
+ String oldExtension = ".java";
+
+ int extensionIndex = className.lastIndexOf('.');
+ String extension = "";
+
+ if (extensionIndex != -1) {
+ extension = className.substring(extensionIndex);
+
+ if(!extension.equals(defaultExtension) && !extension.equals(oldExtension)) {
+ extension = defaultExtension;
+ }
+ else
+ className = className.substring(0, extensionIndex);
+ }
+
+ String nm = "applet-" + className;
+
+ documentProxy.addExecutionContext(this, className);
+
+ permissionCollection = new PermissionCollection();
+ protectionDomain = new ProtectionDomain(new CodeSource(baseURL, null), permissionCollection);
+
+ super.init(nm, ClassContextProxy.create(baseURL, protectionDomain, null));
+
+ permissionCollection.add(new RuntimePermission("modifyThreadGroup", getThreadGroup()));
+ permissionCollection.add(new SocketPermission(SocketPermission.NETWORK_APPLET, baseURL.getHost()));
+
+ try {
+ if(baseURL.getProtocol().equals("file")) // allow read acces for applet directory
+ permissionCollection.add(new FilePermission(new File(baseURL.getFile()).getCanonicalPath(), "read"));
+ }
+ catch(IOException eio) {
+ }
+ }
+
+ void sDispose(long timeout) {
+ if(DEBUG) System.err.println("#### AppletExecutionContext.sDispose");
+
+ container = null;
+ jarResourceProxys = null;
+
+ super.dispose(timeout);
+ }
+
+ public void dispose(long timeout) {
+ sDispose(timeout); // call direct
+
+/* Deadlock with TKT
+ class DisposeEvent extends java.awt.AWTEvent
+ implements java.awt.peer.ActiveEvent,
+ java.awt.ActiveEvent
+ {
+ private AppletExecutionContext executionContext;
+ private long timeout;
+
+ public DisposeEvent(AppletExecutionContext executionContext, long timeout) {
+ super(executionContext, 0);
+
+ this.executionContext = executionContext;
+ this.timeout = timeout;
+ }
+
+ public void dispatch() {
+ executionContext.sDispose(timeout);
+ }
+ }
+
+ toolkit.getSystemEventQueue().postEvent(new DisposeEvent(this, timeout));
+*/
+ }
+
+ protected int getIntParameter(String name) {
+ int value = 0;
+ String string = getParameter(name);
+ if(string != null)
+ value = Integer.valueOf(string).intValue();
+
+ return value;
+ }
+
+ protected void xload()
+ throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException
+ {
+ String archives = getParameter("archive");
+
+ try {
+ if(archives != null) {
+ int index = archives.indexOf(",");
+ while(index > -1) {
+ try { // try to load archive
+ loadArchive(archives.substring(0, index));
+ }
+ catch(MalformedURLException malformedURLException) {
+ System.err.println("#### can't load archive:" + archives.substring(0, index));
+ }
+ catch(IOException ioException) {
+ System.err.println("#### can't load archive:" + archives.substring(0, index) + " reason:" + ioException);
+ }
+
+ archives = archives.substring(index + 1).trim();
+
+ index = archives.indexOf(",");
+ }
+ if(archives.length() > 0) loadArchive(archives);
+ }
+
+ Class appletClass = classContext.loadClass(className);
+ synchronized(className) {
+ applet = (Applet)appletClass.newInstance();
+ applet.setStub(this);
+ className.notifyAll();
+ }
+ }
+ catch(IOException eio) {
+ throw new ClassNotFoundException(eio.getMessage());
+ }
+ }
+
+ protected void xinit() {
+ java.awt.Dimension size = new Dimension(getIntParameter("width"), getIntParameter("height"));
+
+ container.setLayout(null);
+ container.setVisible(true);
+ container.setSize(size);
+ container.add(applet);
+
+ applet.setVisible(false);
+ applet.setSize(size);
+
+ container.validate();
+
+ applet.init();
+ }
+
+ protected void xstart() {
+ applet.setVisible(true);
+ container.validate();
+
+ applet.start();
+ }
+
+ protected void xstop() {
+ applet.stop();
+ }
+
+ protected void xdestroy() {
+ applet.destroy();
+ applet.setVisible(false);
+ applet.setStub(null);
+
+ documentProxy.removeExecutionContext(applet.getClass().getName());
+ }
+
+ protected void xdispose() {
+ if(container != null)
+ container.remove(applet);
+
+ applet = null;
+ }
+
+ private void loadArchive(String archive) throws MalformedURLException, IOException {
+ ResourceProxy jarResourceProxy = ResourceProxy.load(new URL(baseURL, archive), protectionDomain);
+ jarResourceProxy.loadJar(baseURL);
+ jarResourceProxys.addElement(jarResourceProxy);
+ }
+
+ public Applet getApplet() {
+ synchronized(className) {
+ if(applet == null) {
+ if(DEBUG)System.err.println("#### AppletExecutionContext.getApplet - waiting for applet");
+ try {
+ className.wait();
+ }
+ catch(InterruptedException interruptedException) {
+ System.err.println("#### AppletExecutionContext.getApplet:" + interruptedException);
+ }
+ if(DEBUG)System.err.println("#### AppletExecutionContext.getApplet - got it");
+ }
+ }
+ return applet;
+ }
+
+ /*
+ * Methods for AppletStub interface
+ */
+ public void appletResize(int width, int height) {
+ applet.setSize(new java.awt.Dimension(width, height));
+ }
+
+ public AppletContext getAppletContext() {
+ return documentProxy;
+ }
+
+ public URL getCodeBase() {
+ return classContext.getBase();
+ }
+
+ public URL getDocumentBase() {
+ return documentProxy.getDocumentBase();
+ }
+
+ public String getParameter(String name) {
+ String string = (String)parameters.get(name.toLowerCase());
+ if(string != null)
+ string = string.trim();
+
+ return string;
+ }
+
+ public boolean isActive() {
+ return getStatus() == STARTED && pCppJSbxObject != 0;
+ }
+
+ public void finalize() {
+ if(DEBUG) System.err.println("#### AppletExecutionContext finalized");
+ }
+
+ // sollte eigentlich im DocumentProxy sein, geht aber nicht
+ private native void xshowStatus(String status);
+ private native void xshowDocument(URL url, String aTarget);
+
+ void printStatus(String status) {
+ if(pCppJSbxObject != 0) xshowStatus(status);
+ }
+
+ void printDocument(URL url, String aTarget) {
+ if(pCppJSbxObject != 0) xshowDocument(url, aTarget);
+ }
+
+ native public Object getJavaScriptJSObjectWindow();
+}
diff --git a/sj2/stardiv/applet/Document.java b/sj2/stardiv/applet/Document.java
new file mode 100644
index 000000000000..7264a5420c80
--- /dev/null
+++ b/sj2/stardiv/applet/Document.java
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: Document.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.applet;
+
+import java.awt.Image;
+
+// import java.applet.Applet;
+// import java.applet.AppletContext;
+// import java.applet.AudioClip;
+
+
+import java.io.IOException;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Observer;
+import java.util.Observable;
+
+import java.net.URL;
+
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AudioClip;
+
+import com.sun.star.lib.sandbox.ExecutionContext;
+import com.sun.star.lib.sandbox.ResourceProxy;
+
+class Document implements LiveConnectable {
+ private Hashtable executionContexts = new Hashtable();
+ private URL documentBase = null;
+ private java.awt.Toolkit toolkit;
+
+ Document(URL url, java.awt.Toolkit toolkit) {
+ documentBase = url;
+ this.toolkit = toolkit;
+ }
+
+ void addExecutionContext(ExecutionContext executionContext, String name) {
+ executionContexts.put(name, executionContext);
+ }
+
+ void removeExecutionContext(String name) {
+ executionContexts.remove(name);
+ }
+
+ Enumeration getExecutionContexts() {
+ return executionContexts.elements();
+ }
+
+ URL getDocumentBase() {
+ return documentBase;
+ }
+
+ ExecutionContext getExecutionContext(String name) {
+ return (ExecutionContext)executionContexts.get(name);
+ }
+
+ Enumeration getExcutionContexts() {
+ return executionContexts.elements();
+ }
+
+ /**
+ * Get the javascript environment for this applet.
+ */
+ /*
+ public native Object getJavaScriptJSObjectWindow();
+ public native void appletResize( int width, int height );
+ public native void showDocument( URL url, String aTarget );
+ public native void showStatus( String status );
+ */
+
+ public AudioClip getAudioClip(URL url) {
+ ResourceProxy resourceProxy = ResourceProxy.load(url, null);
+ AudioClip audioClip = resourceProxy.getAudioClip();
+
+ return audioClip;
+ }
+
+ public Image getImage(URL url) {
+ ResourceProxy resourceProxy = ResourceProxy.load(url, null);
+ Image image = toolkit.createImage(resourceProxy.getImageProducer());
+
+ return image;
+ }
+
+ AppletExecutionContext getAppletExecutionContext() {
+ AppletExecutionContext appletExecutionContext = null;
+
+ for(Enumeration e = executionContexts.elements(); e.hasMoreElements();) {
+ Object object = e.nextElement();
+ if(object instanceof AppletExecutionContext) {
+ appletExecutionContext = (AppletExecutionContext)object;
+ }
+ }
+ return appletExecutionContext;
+ }
+
+
+ void showDocument(URL url, String aTarget) {
+ AppletExecutionContext appletExecutionContext = getAppletExecutionContext();
+ if(appletExecutionContext != null) appletExecutionContext.printDocument(url, aTarget);
+ }
+
+ public void showDocument(URL url) {
+ showDocument(url, "_top");
+ }
+
+ void showStatus(String status) {
+ status = (status == null) ? "" : status;
+
+ AppletExecutionContext appletExecutionContext = getAppletExecutionContext();
+ if(appletExecutionContext != null) appletExecutionContext.printStatus(status);
+ }
+
+ public Object getJavaScriptJSObjectWindow() {
+ Object object = null;
+
+ AppletExecutionContext appletExecutionContext = getAppletExecutionContext();
+ if(appletExecutionContext != null)
+ object = appletExecutionContext.getJavaScriptJSObjectWindow();
+
+ return object;
+ }
+}
diff --git a/sj2/stardiv/applet/DocumentProxy.java b/sj2/stardiv/applet/DocumentProxy.java
new file mode 100644
index 000000000000..6ef4d5055c7e
--- /dev/null
+++ b/sj2/stardiv/applet/DocumentProxy.java
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * $RCSfile: DocumentProxy.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.applet;
+
+import java.awt.Toolkit;
+import java.awt.Image;
+
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AudioClip;
+
+import java.io.IOException;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Observer;
+import java.util.Observable;
+
+import java.net.URL;
+
+import com.sun.star.lib.sandbox.Cachable;
+import com.sun.star.lib.sandbox.ExecutionContext;
+import com.sun.star.lib.sandbox.WeakRef;
+import com.sun.star.lib.sandbox.WeakTable;
+import com.sun.star.lib.sandbox.ResourceProxy;
+
+public class DocumentProxy implements AppletContext, Cachable, Observer, LiveConnectable {
+ static private int instances;
+
+ synchronized static public DocumentProxy getDocumentProxy(URL url, Toolkit toolkit) {
+ DocumentProxy documentProxy = (DocumentProxy)WeakTable.get("Document: " + url);
+
+ if(documentProxy == null) {
+ documentProxy = new DocumentProxy(url, toolkit);
+ WeakTable.put("Document: " + url, documentProxy);
+ }
+
+ return documentProxy;
+ }
+
+
+ /*
+ ** interface cachable methods
+ */
+ private Document document;
+ private WeakRef weakRef;
+
+ public DocumentProxy() {
+ instances ++;
+ }
+
+ public Object getHardObject() {
+ return document;
+ }
+
+ public void setWeakRef(WeakRef weakRef) {
+ document = (Document)weakRef.getRef();
+
+ weakRef.incRefCnt();
+ this.weakRef = weakRef;
+ }
+
+ public void finalize() {
+ weakRef.decRefCnt();
+ instances --;
+ }
+
+ /*
+ ** DocumentProxy methods
+ */
+ private Toolkit toolkit;
+
+ private DocumentProxy(URL url, Toolkit toolkit) {
+ this();
+ document = new Document(url, toolkit);
+ }
+
+ void addExecutionContext(ExecutionContext executionContext, String name) {
+ document.addExecutionContext(executionContext, name);
+ }
+
+ void removeExecutionContext(String name) {
+ document.removeExecutionContext(name);
+ }
+
+ public URL getDocumentBase() {
+ return document.getDocumentBase();
+ }
+
+ /*
+ ** AppletContext interface methods
+ */
+ public Applet getApplet(String name) {
+ return ((AppletExecutionContext)document.getExecutionContext(name)).getApplet();
+ }
+
+ public Enumeration getApplets() {
+ return new Enumeration() {
+ Enumeration contexts = document.getExecutionContexts();
+
+ public boolean hasMoreElements() {
+ return contexts.hasMoreElements();
+ }
+
+ public Object nextElement() {
+ return ((AppletExecutionContext)contexts.nextElement()).getApplet();
+ }
+ };
+ }
+
+ public AudioClip getAudioClip(URL url) {
+ return document.getAudioClip(url);
+ }
+
+ public Image getImage(URL url) {
+ return document.getImage(url);
+ }
+
+ public void showDocument(URL url) {
+ document.showDocument(url);
+ }
+
+ /**
+ * Get the javascript environment for this applet.
+ */
+ /*
+ public native Object getJavaScriptJSObjectWindow();
+ public native void appletResize( int width, int height );
+ public native void showDocument( URL url, String aTarget );
+ public native void showStatus( String status );
+ */
+
+ public void showDocument(URL url, String aTarget) {
+ document.showDocument(url, aTarget);
+ }
+
+ public void showStatus(String status) {
+ document.showStatus(status);
+ }
+
+ public void update(Observable observable, Object object) {
+ showStatus((String)object);
+ }
+
+ public Object getJavaScriptJSObjectWindow() {
+ return document.getJavaScriptJSObjectWindow();
+ }
+}
+
diff --git a/sj2/stardiv/applet/LiveConnectable.java b/sj2/stardiv/applet/LiveConnectable.java
new file mode 100644
index 000000000000..9c33c09633c9
--- /dev/null
+++ b/sj2/stardiv/applet/LiveConnectable.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: LiveConnectable.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stardiv.applet;
+
+/**
+ * LiveConnectable interface .
+ *
+ * @version 1.0, 21/04/98
+ * @author Markus Meyer
+ */
+
+public interface LiveConnectable
+{
+ public Object getJavaScriptJSObjectWindow();
+}
+
+
diff --git a/sj2/stardiv/applet/makefile.mk b/sj2/stardiv/applet/makefile.mk
new file mode 100644
index 000000000000..6adfa52db4e7
--- /dev/null
+++ b/sj2/stardiv/applet/makefile.mk
@@ -0,0 +1,110 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sj2
+TARGET=applet
+
+PACKAGE=stardiv$/applet
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+JARFILES= \
+ sandbox.jar
+
+JAVAFILES=\
+ AppletExecutionContext.java \
+ Document.java \
+ DocumentProxy.java \
+ LiveConnectable.java
+
+#.IF "$(GUI)"=="WNT"
+#JAVAFILES += WNativeAppletViewerFrame.java
+#.ENDIF
+
+JAVACLASSFILES= \
+ $(CLASSDIR)$/$(PACKAGE)$/DocumentProxy.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Document.class \
+ $(CLASSDIR)$/$(PACKAGE)$/LiveConnectable.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppletExecutionContext.class
+
+
+#.IF "$(GUI)"=="WNT"
+#JAVACLASSFILES += $(CLASSDIR)$/stardiv$/applet$/WNativeAppletViewerFrame.class
+#.ENDIF
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+
+
+
+
+
+
diff --git a/sj2/stardiv/applet/resources/MsgAppletViewer.java b/sj2/stardiv/applet/resources/MsgAppletViewer.java
new file mode 100644
index 000000000000..d7e24350f63d
--- /dev/null
+++ b/sj2/stardiv/applet/resources/MsgAppletViewer.java
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: MsgAppletViewer.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.applet.resources;
+
+import java.util.ListResourceBundle;
+
+public class MsgAppletViewer extends ListResourceBundle {
+
+ public Object[][] getContents() {
+ return contents;
+ }
+
+ static final Object[][] contents = {
+ {"textframe.button.dismiss", "Dismiss"},
+ {"appletviewer.tool.title", "Applet Viewer: {0}"},
+ {"appletviewer.menu.applet", "Applet"},
+ {"appletviewer.menuitem.restart", "Restart"},
+ {"appletviewer.menuitem.reload", "Reload"},
+ {"appletviewer.menuitem.stop", "Stop"},
+ {"appletviewer.menuitem.save", "Save..."},
+ {"appletviewer.menuitem.start", "Start"},
+ {"appletviewer.menuitem.clone", "Clone..."},
+ {"appletviewer.menuitem.tag", "Tag..."},
+ {"appletviewer.menuitem.info", "Info..."},
+ {"appletviewer.menuitem.edit", "Edit"},
+ {"appletviewer.menuitem.encoding", "Character Encoding"},
+ {"appletviewer.menuitem.print", "Print..."},
+ {"appletviewer.menuitem.props", "Properties..."},
+ {"appletviewer.menuitem.close", "Close"},
+ {"appletviewer.menuitem.quit", "Quit"},
+ {"appletviewer.label.hello", "Hello..."},
+ {"appletviewer.status.start", "starting applet..."},
+ {"appletviewer.appletsave.err1", "serializing an {0} to {1}"},
+ {"appletviewer.appletsave.err2", "in appletSave: {0}"},
+ {"appletviewer.applettag", "Tag shown"},
+ {"appletviewer.applettag.textframe", "Applet HTML Tag"},
+ {"appletviewer.appletinfo.applet", "-- no applet info --"},
+ {"appletviewer.appletinfo.param", "-- no parameter info --"},
+ {"appletviewer.appletinfo.textframe", "Applet Info"},
+ {"appletviewer.appletprint.printjob", "Print Applet"},
+ {"appletviewer.appletprint.fail", "Printing failed."},
+ {"appletviewer.appletprint.finish", "Finished printing."},
+ {"appletviewer.appletprint.cancel", "Printing cancelled."},
+ {"appletviewer.appletencoding", "Character Encoding: {0}"},
+ {"appletviewer.init.err", "[no appletviewer.properties file found!]"},
+ {"appletviewer.parse.warning.requiresname", "Warning: <param name=... value=...> tag requires name attribute."},
+ {"appletviewer.parse.warning.paramoutside", "Warning: <param> tag outside <applet> ... </applet>."},
+ {"appletviewer.parse.warning.requirescode", "Warning: <applet> tag requires code attribute."},
+ {"appletviewer.parse.warning.requiresheight", "Warning: <applet> tag requires height attribute."},
+ {"appletviewer.parse.warning.requireswidth", "Warning: <applet> tag requires width attribute."},
+ {"appletviewer.parse.warning.appnotLongersupported", "Warning: <app> tag no longer supported, use <applet> instead:"},
+ {"appletviewer.usage", "usage: appletviewer [-debug] [-J<javaflag>] [-encoding <character encoding type> ] url|file ..."},
+ {"appletviewer.main.err.inputfile", "No input files specified."},
+ {"appletviewer.main.err.badurl", "Bad URL: {0} ( {1} )"},
+ {"appletviewer.main.err.io", "I/O exception while reading: {0}"},
+ {"appletviewer.main.err.readablefile", "Make sure that {0} is a file and is readable."},
+ {"appletviewer.main.err.correcturl", "Is {0} the correct URL?"},
+ {"appletviewer.main.warning", "Warning: No Applets were started. Make sure the input contains an <applet> tag."},
+ {"appletpanel.runloader.err", "Either object or code parameter!"},
+ {"appletpanel.runloader.exception", "exception while deserializing {0}"},
+ {"appletpanel.destroyed", "Applet destroyed."},
+ {"appletpanel.loaded", "Applet loaded."},
+ {"appletpanel.started", "Applet started."},
+ {"appletpanel.inited", "Applet initialized."},
+ {"appletpanel.stopped", "Applet stopped."},
+ {"appletpanel.disposed", "Applet disposed."},
+ {"appletpanel.nocode", "APPLET tag missing CODE parameter."},
+ {"appletpanel.notfound", "load: class {0} not found."},
+ {"appletpanel.nocreate", "load: {0} can''t be instantiated."},
+ {"appletpanel.noconstruct", "load: {0} is not public or has no public constructor."},
+ {"appletpanel.death", "killed"},
+ {"appletpanel.exception", "exception: {0}."},
+ {"appletpanel.exception2", "exception: {0}: {1}."},
+ {"appletpanel.error", "error: {0}."},
+ {"appletpanel.error2", "error: {0}: {1}."},
+ {"appletpanel.notloaded", "Init: applet not loaded."},
+ {"appletpanel.notinited", "Start: applet not initialized."},
+ {"appletpanel.notstarted", "Stop: applet not started."},
+ {"appletpanel.notstopped", "Destroy: applet not stopped."},
+ {"appletpanel.notdestroyed", "Dispose: applet not destroyed."},
+ {"appletpanel.notdisposed", "Load: applet not disposed."},
+ {"appletpanel.bail", "Interrupted: bailing out."},
+ {"appletpanel.filenotfound", "File not found when looking for: {0}"},
+ {"appletpanel.fileformat", "File format exception when loading: {0}"},
+ {"appletpanel.fileioexception", "I/O exception when loading: {0}"},
+ {"appletpanel.fileexception", "{0} exception when loading: {1}"},
+ {"appletpanel.filedeath", "{0} killed when loading: {1}"},
+ {"appletpanel.fileerror", "{0} error when loading: {1}"},
+ {"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream requires non-null loader"},
+ {"appletprops.title", "AppletViewer Properties"},
+ {"appletprops.label.http.server", "Http proxy server:"},
+ {"appletprops.label.http.proxy", "Http proxy port:"},
+ {"appletprops.label.network", "Network access:"},
+ {"appletprops.choice.network.item.none", "None"},
+ {"appletprops.choice.network.item.applethost", "Applet Host"},
+ {"appletprops.choice.network.item.unrestricted", "Unrestricted"},
+ {"appletprops.label.class", "Class access:"},
+ {"appletprops.choice.class.item.restricted", "Restricted"},
+ {"appletprops.choice.class.item.unrestricted", "Unrestricted"},
+ {"appletprops.label.unsignedapplet", "Allow unsigned applets:"},
+ {"appletprops.choice.unsignedapplet.no", "No"},
+ {"appletprops.choice.unsignedapplet.yes", "Yes"},
+ {"appletprops.button.apply", "Apply"},
+ {"appletprops.button.cancel", "Cancel"},
+ {"appletprops.button.reset", "Reset"},
+ {"appletprops.apply.exception", "Failed to save properties: {0}"},
+ };
+}
diff --git a/sj2/stardiv/applet/resources/makefile.mk b/sj2/stardiv/applet/resources/makefile.mk
new file mode 100644
index 000000000000..bb272aa5d201
--- /dev/null
+++ b/sj2/stardiv/applet/resources/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sj2
+TARGET=applet_resource
+
+PACKAGE=stardiv$/applet$/resources
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES=\
+ MsgAppletViewer.java
+
+JAVACLASSFILES=\
+ $(CLASSDIR)$/$(PACKAGE)$/MsgAppletViewer.class
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/sj2/stardiv/controller/SjSettings.java b/sj2/stardiv/controller/SjSettings.java
new file mode 100644
index 000000000000..c5ab72b3d51d
--- /dev/null
+++ b/sj2/stardiv/controller/SjSettings.java
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * $RCSfile: SjSettings.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package stardiv.controller;
+
+import java.util.Properties;
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+import com.sun.star.lib.sandbox.SandboxSecurity;
+
+/**
+ * ber diese Klasse werden alle globalen Einstellungen, die fr das Sj Projekt
+ * wichtig sind, dokumentiert und modifiziert.
+ *
+ * @version $Version: 1.0 $
+ * @author Markus Meyer
+ *
+ */
+public final class SjSettings {
+ /**
+ * The following properties are used to setup the environment for
+ * the stardiv packages.<BR>
+ * "appletviewer.security.mode"="unrestricted" | "host" | "none": Set the
+ * security level of the default SecurityManager. The default is "host".<BR>
+ * "stardiv.security.defaultSecurityManager"="true" | "false": Create and set
+ * the stardiv.security.AppletSecurity, if the property is "true". This occures
+ * only in the first call.<BR>
+ * "stardiv.security.noExit"="true" | "false": no exit is allowed. Use this property
+ * if you are running more than one java application in the virtual machine. This occures
+ * only in the first call.<BR>
+ * "stardiv.security.disableSecurity"="true" | "false": disable security checking. Only usefull
+ * if a SecurityManager is installed. The default is "false".<BR>
+ * if you are running more than one java application in the virtual machine. This occures
+ * only in the first call.<BR>
+ * "stardiv.controller.installConsole"="true" | "false": pipe the stdout and stderr
+ * through a console. Show the console with stardiv.controller.Console.showConsole( true ).
+ * This occures only in the first call.<BR>
+ * "stardiv.js.debugOnError"="true" | "false": Start the javascript ide, if an error
+ * occures. The default is "false".<BR>
+ * "stardiv.js.debugImmediate"="true" | "false": Start the javascript ide, if a script
+ * starts. The default is "false".<BR>
+ * "stardiv.debug.trace"="messageBox" | "window" | "file" | "none": The trace pipe is
+ * set to one of the four mediums. The Default is "none".<BR>
+ * "stardiv.debug.error"="messageBox" | "window" | "file" | "none": The error pipe is
+ * set to one of the four mediums. The Default is "none".<BR>
+ * "stardiv.debug.warning"="messageBox" | "window" | "file" | "none": The warning pipe is
+ * set to one of the four mediums. The Default is "none".<BR>
+ * If the properties http.proxyHost, http.proxyPort, http.maxConnections,
+ * http.keepAlive or http.nonProxyHosts are changed, the method
+ * sun.net.www.http.HttpClient.resetProperties() is called.<BR>
+ * If the properties ftpProxySet, ftpProxyHost or ftpProxyPort are changed,
+ * the static variables useFtpProxy, ftpProxyHost and ftpProxyPort in the class
+ * sun.net.ftp.FtpClient are set.<BR>
+ * <B>If you are writing your own SecurityManager and ClassLoader, please implement the
+ * interfaces stardiv.security.ClassLoaderExtension and
+ * stardiv.security.SecurityManagerExtension. Be shure to set the
+ * stardiv.security.ClassLoaderFactory, to enable dynamic class loading, otherwise
+ * the stardiv.security.AppletClassLoader is used. Set the factory with
+ * SjSettings.setClassLoaderFactory().</B>
+ */
+ static public synchronized void changeProperties( Properties pChangeProps )
+ {
+ SecurityManager pSM = System.getSecurityManager();
+ if( pSM != null )
+ pSM.checkPropertiesAccess();
+ Properties props = new Properties( System.getProperties() );
+ boolean bInited = Boolean.getBoolean( "stardiv.controller.SjSettings.inited" );
+
+
+ if( !bInited )
+ {
+ // check the awt.toolkit property: if none is set use com.sun.star.comp.jawt.peer.Toolkit
+ //if ( props.getProperty("awt.toolkit") == null )
+ // props.put("awt.toolkit", "com.sun.star.comp.jawt.peer.Toolkit");
+
+ // Define a number of standard properties
+ props.put("acl.read", "+");
+ props.put("acl.read.default", "");
+ props.put("acl.write", "+");
+ props.put("acl.write.default", "");
+
+ // Standard browser properties
+ props.put("browser", "stardiv.applet.AppletViewerFrame");
+ props.put("browser.version", "4.02");
+ props.put("browser.vendor", "Sun Microsystems, Inc.");
+ props.put("http.agent", "JDK/1.1");
+
+ // Define which packages can be accessed by applets
+ props.put("package.restrict.access.sun", "true");
+ props.put("package.restrict.access.netscape", "true");
+ props.put("package.restrict.access.stardiv", "true");
+
+ // Define which packages can be extended by applets
+ props.put("package.restrict.definition.java", "true");
+ props.put("package.restrict.definition.sun", "true");
+ props.put("package.restrict.definition.netscape", "true");
+ props.put("package.restrict.definition.stardiv", "true");
+
+ // Define which properties can be read by applets.
+ // A property named by "key" can be read only when its twin
+ // property "key.applet" is true. The following ten properties
+ // are open by default. Any other property can be explicitly
+ // opened up by the browser user setting key.applet=true in
+ // ~/.hotjava/properties. Or vice versa, any of the following can
+ // be overridden by the user's properties.
+ props.put("java.version.applet", "true");
+ props.put("java.vendor.applet", "true");
+ props.put("java.vendor.url.applet", "true");
+ props.put("java.class.version.applet", "true");
+ props.put("os.name.applet", "true");
+ props.put("os.version.applet", "true");
+ props.put("os.arch.applet", "true");
+ props.put("file.separator.applet", "true");
+ props.put("path.separator.applet", "true");
+ props.put("line.separator.applet", "true");
+
+ // das appletresourceprotokol
+ props.put("java.protocol.handler.pkgs", "stardiv.net.protocol");
+ }
+
+ boolean bHttpClientChanged = false;
+ boolean bFtpClientChanged = false;
+ boolean bSecurityChanged = false;
+ // detect changes
+ if( pChangeProps != null )
+ {
+ bHttpClientChanged =
+ !equalsImpl( props.get( "http.proxyHost" ), pChangeProps.get( "http.proxyHost" ) )
+ || !equalsImpl( props.get( "http.proxyPort" ), pChangeProps.get( "http.proxyPort" ) )
+ || !equalsImpl( props.get( "http.maxConnections" ), pChangeProps.get( "http.maxConnections" ) )
+ || !equalsImpl( props.get( "http.keepAlive" ), pChangeProps.get( "http.keepAlive" ) )
+ || !equalsImpl( props.get( "http.nonProxyHosts" ), pChangeProps.get( "http.nonProxyHosts" ) );
+ bFtpClientChanged =
+ !equalsImpl( props.get( "ftpProxySet" ), pChangeProps.get( "ftpProxySet" ) )
+ || !equalsImpl( props.get( "ftpProxyHost" ), pChangeProps.get( "ftpProxyHost" ) )
+ || !equalsImpl( props.get( "ftpProxyPort" ), pChangeProps.get( "ftpProxyPort" ) );
+ bSecurityChanged =
+ !equalsImpl( props.get( "appletviewer.security.mode" ), pChangeProps.get( "appletviewer.security.mode" ) )
+ || !equalsImpl( props.get( "stardiv.security.disableSecurity" ), pChangeProps.get( "stardiv.security.disableSecurity" ) );
+ }
+
+ // put new and changed properties to the property table
+ if( pChangeProps != null )
+ {
+ Enumeration aEnum = pChangeProps.propertyNames();
+ while( aEnum.hasMoreElements() )
+ {
+ String aKey = (String)aEnum.nextElement();
+ props.put( aKey, pChangeProps.getProperty( aKey ) );
+ }
+ }
+
+ // Install a property list.
+ if( !bInited )
+ props.put( "stardiv.controller.SjSettings.inited", "true" );
+ System.setProperties(props);
+ if( !bInited )
+ {
+ // Security Manager setzten
+ if( Boolean.getBoolean( "stardiv.security.defaultSecurityManager" ) )
+ {
+ boolean bNoExit = Boolean.getBoolean( "stardiv.security.noExit" );
+ //Create and install the security manager
+ System.setSecurityManager(new SandboxSecurity(bNoExit));
+ }
+ if( Boolean.getBoolean("stardiv.controller.installConsole") )
+ Console.installConsole();
+
+ }
+ // Not Documented, setting a try catch, for IncompatibleClassChangeException.
+ try
+ {
+ if( bHttpClientChanged )
+ sun.net.www.http.HttpClient.resetProperties();
+ if( bFtpClientChanged )
+ {
+ sun.net.ftp.FtpClient.useFtpProxy = Boolean.getBoolean("ftpProxySet");
+ sun.net.ftp.FtpClient.ftpProxyHost = System.getProperty("ftpProxyHost");
+ sun.net.ftp.FtpClient.ftpProxyPort = Integer.getInteger("ftpProxyPort", 80).intValue();
+ }
+ }
+ catch( Throwable e )
+ {
+ }
+ if( bSecurityChanged )
+ {
+ pSM = System.getSecurityManager();
+ if( pSM instanceof SandboxSecurity )
+ {
+ ((SandboxSecurity)pSM).reset();
+ }
+ }
+ }
+
+ private static boolean equalsImpl( Object p1, Object p2 )
+ {
+ return p1 == p2 || (p1 != null && p2 != null && p1.equals( p2 ) );
+ }
+}
+
+
+
diff --git a/sj2/stardiv/controller/makefile.mk b/sj2/stardiv/controller/makefile.mk
new file mode 100644
index 000000000000..6a2b2402cf1a
--- /dev/null
+++ b/sj2/stardiv/controller/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sj2
+TARGET=controller
+
+PACKAGE=stardiv$/controller
+JARFILES=sandbox.jar tkt.jar
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ SjSettings.java \
+ StreamObserver.java \
+ NativeStreamObserver.java \
+ AppStarter.java \
+ AppStarterStatus.java \
+ AppStarterStatusNative.java \
+ JavaSystemMonitor.java \
+ Console.java \
+ PropertyEditor.java
+
+JAVACLASSFILES= \
+ $(CLASSDIR)$/$(PACKAGE)$/SjSettings.class \
+ $(CLASSDIR)$/$(PACKAGE)$/StreamObserver.class \
+ $(CLASSDIR)$/$(PACKAGE)$/NativeStreamObserver.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppStarter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppStarterStatus.class \
+ $(CLASSDIR)$/$(PACKAGE)$/AppStarterStatusNative.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Console.class \
+ $(CLASSDIR)$/$(PACKAGE)$/JavaSystemMonitor.class \
+ $(CLASSDIR)$/$(PACKAGE)$/PropertyEditor.class
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/sj2/stardiv/security/resources/MsgAppletViewer.java b/sj2/stardiv/security/resources/MsgAppletViewer.java
new file mode 100644
index 000000000000..d02ce8184216
--- /dev/null
+++ b/sj2/stardiv/security/resources/MsgAppletViewer.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: MsgAppletViewer.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+package stardiv.security.resources;
+
+import java.util.ListResourceBundle;
+
+/* Alle Resourcen aus AppletClassLoader, Applet und AppletSecurityException.
+*/
+public class MsgAppletViewer extends ListResourceBundle {
+
+ public Object[][] getContents() {
+ return contents;
+ }
+
+ static final Object[][] contents = {
+ {"appletclassloader.loadcode.verbose", "Opening stream to: {0} to get {1}"},
+ {"appletclassloader.filenotfound", "File not found when looking for: {0}"},
+ {"appletclassloader.fileformat", "File format exception when loading: {0}"},
+ {"appletclassloader.fileioexception", "I/O exception when loading: {0}"},
+ {"appletclassloader.fileexception", "{0} exception when loading: {1}"},
+ {"appletclassloader.filedeath", "{0} killed when loading: {1}"},
+ {"appletclassloader.fileerror", "{0} error when loading: {1}"},
+ {"appletclassloader.findclass.verbose.findclass", "{0} find class {1}"},
+ {"appletclassloader.findclass.verbose.openstream", "Opening stream to: {0} to get {1}"},
+ {"appletclassloader.getresource.verbose.forname", "AppletClassLoader.getResource for name: {0}"},
+ {"appletclassloader.getresource.verbose.found", "Found resource: {0} as a system resource"},
+ {"appletclassloader.getresourceasstream.verbose", "Found resource: {0} as a system resource"},
+ {"appletioexception.loadclass.throw.interrupted", "class loading interrupted: {0}"},
+ {"appletioexception.loadclass.throw.notloaded", "class not loaded: {0}"},
+ {"appletsecurityexception.checkcreateclassloader", "Security Exception: classloader"},
+ {"appletsecurityexception.checkaccess.thread", "Security Exception: thread"},
+ {"appletsecurityexception.checkaccess.threadgroup", "Security Exception: threadgroup: {0}"},
+ {"appletsecurityexception.checkexit", "Security Exception: exit: {0}"},
+ {"appletsecurityexception.checkexec", "Security Exception: exec: {0}"},
+ {"appletsecurityexception.checklink", "Security Exception: link: {0}"},
+ {"appletsecurityexception.checkpropsaccess", "Security Exception: properties"},
+ {"appletsecurityexception.checkpropsaccess.key", "Security Exception: properties access {0}"},
+ {"appletsecurityexception.checkread.exception1", "Security Exception: {0}, {1}"},
+ {"appletsecurityexception.checkread.exception2", "Security Exception: file.read: {0}"},
+ {"appletsecurityexception.checkread", "Security Exception: file.read: {0} == {1}"},
+ {"appletsecurityexception.checkwrite.exception", "Security Exception: {0}, {1}"},
+ {"appletsecurityexception.checkwrite", "Security Exception: file.write: {0} == {1}"},
+ {"appletsecurityexception.checkread.fd", "Security Exception: fd.read"},
+ {"appletsecurityexception.checkwrite.fd", "Security Exception: fd.write"},
+ {"appletsecurityexception.checklisten", "Security Exception: socket.listen: {0}"},
+ {"appletsecurityexception.checkaccept", "Security Exception: socket.accept: {0}:{1}"},
+ {"appletsecurityexception.checkconnect.networknone", "Security Exception: socket.connect: {0}->{1}"},
+ {"appletsecurityexception.checkconnect.networkhost1", "Security Exception: Couldn''t connect to {0} with origin from {1}."},
+ {"appletsecurityexception.checkconnect.networkhost2", "Security Exception: Couldn''t resolve IP for host {0} or for {1}. "},
+ {"appletsecurityexception.checkconnect.networkhost3", "Security Exception: Could not resolve IP for host {0}. See the trustProxy property."},
+ {"appletsecurityexception.checkconnect", "Security Exception: connect: {0}->{1}"},
+ {"appletsecurityexception.checkpackageaccess", "Security Exception: cannot access package: {0}"},
+ {"appletsecurityexception.checkpackagedefinition", "Security Exception: cannot define package: {0}"},
+ {"appletsecurityexception.cannotsetfactory", "Security Exception: cannot set factory"},
+ {"appletsecurityexception.checkmemberaccess", "Security Exception: check member access"},
+ {"appletsecurityexception.checkgetprintjob", "Security Exception: getPrintJob"},
+ {"appletsecurityexception.checksystemclipboardaccess", "Security Exception: getSystemClipboard"},
+ {"appletsecurityexception.checkawteventqueueaccess", "Security Exception: getEventQueue"},
+ {"appletsecurityexception.checksecurityaccess", "Security Exception: security operation: {0}"},
+ {"appletsecurityexception.getsecuritycontext.unknown", "unknown class loader type. unable to check for getContext"},
+ {"appletsecurityexception.checkread.unknown", "unknown class loader type. unable to check for checking read {0}"},
+ {"appletsecurityexception.checkconnect.unknown", "unknown class loader type. unable to check for checking connect"},
+ };
+}
diff --git a/sj2/stardiv/security/resources/makefile.mk b/sj2/stardiv/security/resources/makefile.mk
new file mode 100644
index 000000000000..44bfeb2ec5a0
--- /dev/null
+++ b/sj2/stardiv/security/resources/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sj2
+TARGET=security_resource
+
+PACKAGE=stardiv$/security$/resources
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES=\
+ MsgAppletViewer.java
+
+JAVACLASSFILES=\
+ $(CLASSDIR)$/stardiv$/security$/resources$/MsgAppletViewer.class
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/sj2/util/makefile.mk b/sj2/util/makefile.mk
new file mode 100644
index 000000000000..14d238d98eb1
--- /dev/null
+++ b/sj2/util/makefile.mk
@@ -0,0 +1,138 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=sj2
+TARGET=sj
+USE_LDUMP2=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+LDUMP2=LDUMP3
+
+# ------------------------------------------------------------------
+
+.IF "$(header)" == ""
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= \
+ $(SLB)$/java.lib \
+ $(SLB)$/jscpp.lib
+
+SHL1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(L)$/svtool.lib $(LIB1TARGET)
+
+SHL1TARGET= j$(UPD)$(DLLPOSTFIX)_g
+SHL1IMPLIB= $(TARGET)
+
+SHL1STDLIBS= \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(RTLLIB) \
+ $(CPPULIB) \
+ $(UNOTOOLSLIB)
+
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME =$(SHL1TARGET)
+DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME =$(TARGET)
+DEF1DES =JavaCPP
+DEF1CEXP =Java
+.ENDIF
+
+JARTARGET=classes.jar
+JARCLASSDIRS=stardiv
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : target.pmk
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+ @echo bad_alloc::bad_alloc>>$@
+ @echo exception::exception>>$@
+.IF "$(COM)"=="MSC"
+ @echo __CT>>$@
+.ENDIF
+.IF "$(COM)"=="ICC"
+ @echo __lower_bound>>$@
+ @echo __stl_prime>>$@
+ @echo __alloc>>$@
+ @echo __malloc>>$@
+.ENDIF
+
diff --git a/sj2/util/makefile.pmk b/sj2/util/makefile.pmk
new file mode 100644
index 000000000000..f36e7c0312de
--- /dev/null
+++ b/sj2/util/makefile.pmk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+#PROJECTPCH4DLL=TRUE
+#PROJECTPCH=sjpch
+#PROJECTPCHSOURCE=$(PRJ)$/util\sjpch
+#PDBTARGET=sj
+PRJPCH=
+
+JAVAPREPRO=
+.IF "$(JDK_VERSION)" == "110"
+JAVAPREPRO=-jdk11
+.ENDIF
+.IF "$(PRODUCT)" != ""
+JAVAPREPRO=$(JAVAPREPRO) + " -product"
+.ENDIF
+
+ENABLE_EXCEPTIONS=TRUE
+
+JARFILES=sandbox.jar tkt.jar
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
diff --git a/sj2/util/target.pmk b/sj2/util/target.pmk
new file mode 100644
index 000000000000..af6cc99902a7
--- /dev/null
+++ b/sj2/util/target.pmk
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# $RCSfile: target.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:54:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+.IF "$(depend)" == ""
+ONLYZIP: $(SLOFILES)
+ cd $(PRJ)$/util
+ nmake debug=t
+
+TEST:
+
+DOC:
+
+PREPRO:
+ $(JAVAI) $(JAVACPS) $(CLASSPATH) stardiv.app.Javac $(JAVAPREPRO) $(JAVAFILES)
+.ENDIF