diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 11:54:06 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 11:54:06 +0000 |
commit | 1b64e03aedfd2e40e01ccc35dde249310a9737a3 (patch) | |
tree | 56987c950873bd16ebc17c11e0f1a643ca09057c | |
parent | b5d0edea37b43a55f4d6a730bb5961250e1984c4 (diff) |
CWS-TOOLING: integrate CWS dtrans2vcl
2009-09-09 19:47:56 +0200 pl r276016 : merge fix for #i104390# into moved code
2009-09-07 12:50:47 +0200 pl r275891 : remove nonexistant header
2009-09-04 16:47:05 +0200 pl r275819 : forgot calling convention for Windoze
2009-09-04 13:27:36 +0200 pl r275800 : #150926# remove X11 dependency
2009-09-04 13:19:08 +0200 pl r275799 : #150926# move mac dtrans service to vcl to be used in service implementation
2009-09-03 21:19:01 +0200 pl r275774 : fix warning, adjust comment
2009-09-03 18:36:01 +0200 pl r275768 : no more sjlib
2009-09-03 17:56:49 +0200 pl r275767 : remove unused X11 link dependency
2009-09-03 17:43:35 +0200 pl r275766 : headless not used in X11 case
2009-09-03 17:34:36 +0200 pl r275765 : #150926# bye bye sj2
2009-09-03 16:19:04 +0200 pl r275761 : #150926# bye bye sj2, x11 dependenices removed where not necessary
2009-09-01 17:22:54 +0200 pl r275674 : #150926# step 1: move X11 code from dtrans to vcl, adapt glue code
37 files changed, 21 insertions, 5248 deletions
diff --git a/basic/prj/build.lst b/basic/prj/build.lst index ec6bd0e839..994901580c 100644 --- a/basic/prj/build.lst +++ b/basic/prj/build.lst @@ -1,4 +1,4 @@ -sb basic : l10n offuh svtools sj2 xmlscript framework NULL +sb basic : l10n offuh svtools xmlscript framework NULL sb basic usr1 - all sb_mkout NULL sb basic\inc nmake - all sb_inc NULL sb basic\source\app nmake - all sb_app sb_class sb_inc NULL diff --git a/desktop/util/makefile.mk b/desktop/util/makefile.mk index 69b9c2254f..3712e49e98 100644 --- a/desktop/util/makefile.mk +++ b/desktop/util/makefile.mk @@ -108,7 +108,6 @@ APP1STDLIBS = \ $(SAXLIB) \ $(FWILIB) \ $(ICUUCLIB) \ - $(SJLIB) \ $(I18NUTILLIB) \ $(ICULIB) \ $(JVMFWKLIB) \ @@ -120,11 +119,11 @@ APP1STDLIBS = \ $(VOSLIB) -.IF "$(GUI)" == "UNX" -.IF "$(OS)" == "LINUX" || "$(OS)" == "FREEBSD" -APP1STDLIBS+= -lXext -lSM -lICE -.ENDIF -.ENDIF +#.IF "$(GUI)" == "UNX" +#.IF "$(OS)" == "LINUX" || "$(OS)" == "FREEBSD" +#APP1STDLIBS+= -lXext -lSM -lICE +#.ENDIF +#.ENDIF APP1DEPN= $(APP1RES) verinfo.rc @@ -172,7 +171,6 @@ APP5STDLIBS = \ $(SAXLIB) \ $(FWILIB) \ $(ICUUCLIB) \ - $(SJLIB) \ $(I18NUTILLIB) \ $(ICULIB) \ $(JVMFWKLIB) \ @@ -183,9 +181,9 @@ APP5STDLIBS = \ $(SALHELPERLIB) \ $(VOSLIB) -.IF "$(OS)" == "LINUX" -APP5STDLIBS+= -lXext -lSM -lICE -.ENDIF # LINUX +#.IF "$(OS)" == "LINUX" +#APP5STDLIBS+= -lXext -lSM -lICE +#.ENDIF # LINUX APP5DEPN= $(APP1TARGETN) $(APP5RES) ooverinfo.rc APP5DEF= $(MISCX)$/$(TARGET).def diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index 478712de08..073deaa45f 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -485,7 +485,6 @@ #include "sal/types.h" #include "setup_native/qswin32.h" #include "shell/systemshell.hxx" -#include "sj2/sjapplet.hxx" #include "sot/clsids.hxx" #include "sot/exchange.hxx" #include "sot/factory.hxx" diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index d7be1bbf66..8f18b37067 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -62,7 +62,7 @@ #include <sot/exchange.hxx> //#include <svtools/agprop.hxx> -#include <sj2/sjapplet.hxx> +//#include <sj2/sjapplet.hxx> #include <svtools/isethint.hxx> #include <unotools/configmgr.hxx> @@ -850,6 +850,8 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) // INet Session neu aufsetzen if ( bResetSession ) { + // no more sj2 + #if 0 try { SjApplet2::settingsChanged(); @@ -858,6 +860,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) { DBG_ERRORFILE( "SjApplet2::settingsChanged() throws an exception" ); } + #endif } // geaenderte Daten speichern diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 47f875466e..81d198412a 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -137,7 +137,7 @@ using namespace ::com::sun::star::io; #include "brokenpackageint.hxx" #include "eventsupplier.hxx" #include "xpackcreator.hxx" -#include "applet.hxx" +// #include "applet.hxx" #include "plugin.hxx" #include "iframe.hxx" #include <ownsubfilterservice.hxx> @@ -2150,6 +2150,7 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( xNewKey = xKey->createKey( aTempStr ); xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.frame.SpecialEmbeddedObject") ); + #if 0 // AppletObject aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); aImpl += ::sfx2::AppletObject::impl_getStaticImplementationName(); @@ -2158,7 +2159,8 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); xNewKey = xKey->createKey( aTempStr ); xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.frame.SpecialEmbeddedObject") ); - + #endif + // IFrameObject aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); aImpl += ::sfx2::IFrameObject::impl_getStaticImplementationName(); @@ -2324,11 +2326,13 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory( IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler ) #endif IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator ) + #if 0 if ( ::sfx2::AppletObject::impl_getStaticImplementationName().equals( ::rtl::OUString::createFromAscii( pImplementationName ) ) ) { xFactory = ::sfx2::AppletObject::impl_createFactory(); } + #endif IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject ) IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject ) IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService ) diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 986755558c..1b42844491 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -55,7 +55,6 @@ SLOFILES = \ $(SLO)$/docinf.obj \ $(SLO)$/oleprops.obj \ $(SLO)$/iframe.obj \ - $(SLO)$/applet.obj \ $(SLO)$/plugin.obj \ $(SLO)$/docfile.obj \ $(SLO)$/objuno.obj \ @@ -90,6 +89,8 @@ SLOFILES = \ $(SLO)$/docstoragemodifylistener.obj \ $(SLO)$/querytemplate.obj +# $(SLO)$/applet.obj \ + # --- Tagets ------------------------------------------------------- diff --git a/sfx2/util/makefile.mk b/sfx2/util/makefile.mk index 5ee6e64dac..6bdb4a8122 100644 --- a/sfx2/util/makefile.mk +++ b/sfx2/util/makefile.mk @@ -98,7 +98,6 @@ SHL1STDLIBS+=\ $(CPPULIB) \ $(VOSLIB) \ $(SALLIB) \ - $(SJLIB) \ $(LIBXML2LIB) \ diff --git a/sj2/doc/Todo.txt b/sj2/doc/Todo.txt deleted file mode 100644 index 6520abaa10..0000000000 --- a/sj2/doc/Todo.txt +++ /dev/null @@ -1,108 +0,0 @@ -Erkenntnisse aus sj/sj1, die in sj2 beachtet werden müssen - - -- 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 deleted file mode 100644 index 49f336b131..0000000000 --- a/sj2/doc/concepts.html +++ /dev/null @@ -1,844 +0,0 @@ -<!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äher betrachtet werden muß, 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öglichst einfach sein das -System in einen definierten arbeitsfähigen Zustand zu -versetzen.<BR>Es gibt grundsä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ß nach einer solchen Exception - nicht mehr ihre Spezifikation einhalten. Diese Exception wird im - folgenden mit „Undefined Exception“ benannt. Dabei ist zu - beachten, daß keine weiteren <A HREF="#Resourcen">Resourcen</A>, - außer die angegebenen, benutzt werden. Außerdem werden - „ReadOnly“ 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 „Defined Exception“ benannt. Dabei ist zu beachten, - daß keine weiteren <A HREF="#Resourcen">Resourcen</A>, außer - die angegebenen, benutzt werden. Außerdem werden „ReadOnly“ - 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 „Transacted Exception“ benannt. Dabei ist zu beachten, - daß keine weiteren <A HREF="#Resourcen">Resourcen</A>, außer - die angegebenen, benutzt werden. Außerdem werden „ReadOnly“ - Resourcen nicht modifiziert. Diese Spezifikation trifft auch auf - „Defined Exception“ zu, wegen ihrer Bedeutung führe - ich sie extra auf.</P> -</OL> -<P>Die Benutzbarkeit eines Objektes, nachdem eine Exception -aufgetreten ist, ist vom obigen Typ der Exception abhängig.</P> -<P><FONT COLOR="#ff0000">Satz 1.1: Nachdem eine „Undefined -Exception“ aufgetreten ist, kann mit dem Objekt sowie allen -„ReadWrite“ Resourcen nicht mehr weiter gearbeitet werden.</FONT></P> -<P><FONT COLOR="#ff0000">Satz 1.2: Nachdem eine „Defined -Exception“ aufgetreten ist, kann aufgrund des genau definierten -Zustandes weiter gearbeitet werden.</FONT></P> -<P><FONT COLOR="#ff0000">Satz 1.3: Nach einer „Transacted -Exception“ ist der gleiche Zustand wie vor dem Aufruf -wiederhergestellt.</FONT></P> -<P>Es sollten möglichst nur „Transacted Exception“ -ausgelöst werden. Bei komplizierten Methoden läßt -sich aber eine „Defined Exception“ nicht immer vermeiden. -Eine „Undefined Exception“ 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önnen dann verschiedene Aufträge -gleichzeitig arbeiten, wenn sie nicht dieselben Resourcen benutzen. -Z.B. kann man in einer Textverarbeitung die einzelnen Dokumente als -Einheiten betrachten. Aufträge, die sich nur auf ein Dokument -beziehen, können parallel zu anderen Dokumenten bearbeitet -werden.<BR>Mit Resourcen sind im System bzw. der Applikation -vorhandene Objekte, Services, Kanäle ... gemeint, die zur Zeit -nur von einem Thread benutzt werden können. Als Konsequenz -müssen Resourcen einem Thread zugeordnet werden, bevor dieser -sie benutzt.<BR><B>Ziel:</B> Es muß möglich sein, 1. -Aufträge parallel abzuarbeiten, 2. die Frage „Warum können -zwei Aufträge nicht parallel arbeiten?“ beantwortet zu -können.<BR>Es gibt verschiedene Mö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ür den Auftrag - benötigten Resourcen. Ist dies möglich, kann der Auftrag - ohne weitere Störungen ablaufen. Die Resourcen dürfen - freigegeben werden, bevor der Auftrag beendet ist. Dies gilt - natürlich nur für nicht mehr verwendete Resourcen. Es darf - ebenfalls das Zuordnungsrecht von lesend und schreibend auf lesend - zurückgenommen werden. Diese Zuornungsart wird im weiteren mit - „Prealloc Resource Konzept“ bezeichnet.</P> - <LI><P><A NAME="Ondemand Resource Konzept"></A>Eine andere Art der - Zuordnung ist das Anfordern der Resourcen, wenn sie benötigt - werden. Dabei kann es zu Störungen kommen, wenn sich - verschiedene Aufträge um die gleiche Resource bewerben. Die - Resourcen dürfen freigegeben werden, bevor der Auftrag beendet - ist. Dies gilt natürlich nur für nicht mehr verwendete - Resourcen. Es darf ebenfalls das Zuordnungsrecht von lesend und - schreibend auf lesend zurückgenommen werden. Diese Zuornungsart - wird im weiteren mit „Ondemand Resource Konzept“ - bezeichnet.</P> -</OL> -<P>Es gibt noch weitere Möglichkeiten Aufträge zu -bearbeiten, die die gleichen Resourcen benutzen. Häufig findet -man solche Lösungen bei Datenbankanwendungen.<BR>In der -folgenden Tabelle stehen sich die beiden Konzepte mit ihren Vor- und -Nachteilen und ihren Anforderungen gegenü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üssen vor der Auftragsausfü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ötigte Resourcen dü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 „Races“ kommen.</TD> - <TD VALIGN=TOP> - <P>Nein</TD> - <TD VALIGN=TOP> - <P>Ja</TD> - </TR> - <TR> - <TD VALIGN=TOP> - <P>In Bearbeitung befindliche Aufträge mü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 überprüft werden muß, ob alle - benötigten Resourcen verfügbar sind.</TD> - <TD VALIGN=TOP> - <P>Komplex, da neben dem Anfordern von Resourcen auch noch - überprüft werden muß, ob das System <A HREF="#lebendig">lebendig</A> - ist.</TD> - </TR> - <TR> - <TD VALIGN=TOP> - <P>Parallelität</TD> - <TD VALIGN=TOP> - <P>Hoch, da unabhängige Aufträge meistens nur lesend - auf gemeinsame Resourcen zugreifen.</TD> - <TD VALIGN=TOP> - <P>Sehr hoch, da die benötigten Resourcen erst angefordert - werden, wenn man sie braucht.</TD> - </TR> - </TBODY> -</TABLE> -<P ALIGN=LEFT>Meiner Meinung nach ist nur das „Prealloc Resource -Konzept“ ohne richtige Programmierwerkzeuge zur Entwicklung -paralleler Algorithmen (z.B. Netzprogrammierung) wenigstens ein -bißchen beherschbar.</P> -<P ALIGN=LEFT>Es stellt sich die Frage wie das „Prealloc -Resource Konzept“ 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önnte man die -Verbindung der Textverarbeitung zu ihren Dokumenten als -Objekt-Environment bezeichnen. Ein Objekt in diesem Environment kann -nun über seine Verbindungen mit anderen Objekten kommunizieren. -Die Schnittstellen mit denen über die Verbindung kommuniziert -wird nennt man Komponenten-Modell. Die Idee des Objekt-Environments -ist es weitere Objekte möglichst einfach zu integrieren. So -könnten in unserem Beispiel weitere Dokumenttypen wie ein -HTML-Dokument eingebunden werden. Die Schittstellen müßten -nur dem, von der Textverarbeitung geforderten, Komponenten-Modell -genügen. Liefert aber das Modell, wie heute üblich, keine -Information über die benötigten Resourcen bei Benutzung der -Schnittstellen, dann kö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ß ein Kompromiß zwischen hoher Nebenläufigkeit -und der damit verbundenen Komplexität, sowie einfacher -Programmierung und geringer Nebenläufigkeit gefunden -werden.<BR><B>Folgen:</B> In einem Objekt-Environment müssen die -einzelnen Objekte also dynamisch auf Verbindungen zu Objekten mit -hoher oder geringer Nebenläufigkeit reagieren. Die Komplexität -dieser Aufgabe darf aber nicht in die Objekte verlagert werden, da -von einem seriellen Objekt (bzw. dessen Programmierer) nicht die -Steuerung nebenläufiger Aufträge verlangt werden -kann.<BR><B>Lösungsansatz:</B> Die Behandlung der -Nebenläufigkeit wird nicht in einer einfachen Komponente -implementiert. Das bedeutet sie muß mit einer -Default-Behandlung zufrieden sein, die minimale Nebeläufigkeit -nach sich zieht. Eine Komponente kann sich aber in die Vergabe der -Resourcen einmischen. So kann sie ihren Grad der Nebenläufigkeit -erhöhen. Dies ist dann aber auch mit erhöhtem -Implementationsaufwand zu bezahlen. Auf der anderen Seite macht es -aber keinen Sinn serielle oder Komponenten mit zu großem -Resourcebedarf einzubinden, wenn das Objekt-Environment danach -praktisch nicht mehr lauffähig ist. Das bedeutet, daß das -Objekt-Environment auch Forderungen bezüglich des Resourcebedarf -an die Komponenten stellen darf.</P> -<H3>Anforderungen</H3> -<OL> - <LI><P ALIGN=LEFT>Es muß ein Modell geben, in dem alle - vorhandenen Resourcen und deren Beziehung zueinander eingetragen - werden. Dadurch kann abgeschätzt werden, welchen Resourcebedarf - eine Komponente hat. Das „Schätzen“ ist wörtlich - zu nehmen. (Im Zusammenhang mit <A HREF="#Security">Security</A> - wird man aber auch noch sehen, daß der Zugriff auf bestimmte - Resourcen nicht möglich ist.) Für das „Prealloc - Resource Konzept“ gilt, es müssen mindestens die - benötigten Resourcen verfügbar sein. Zur Not sind diese - alle.</P> - <LI><P ALIGN=LEFT>Eine nebenläufige Komponente muß in - jeder ihrer von außen erreichbaren Methoden kontrollieren, ob - die entsprechenden Resourcen für sie angefordert wurden. Damit - serielle Komponenten diese Methoden nutzen können, können - die benötigten Resourcen angefordert werden, wenn vorher noch - <B>keine einzige</B> durch den ausführenden Auftrag belegt war. - Zur Erläuterung: Serielle Komponenten belegen keine Resourcen. - Damit würde jeder Aufruf einer nebenläufigen Komponente - scheitern. Um dies zu vermeiden, werden die Resourcen in der - nebenläufigen Komponente angefordert.</P> - <LI><P ALIGN=LEFT>Serielle Komponenten müssen also damit - rechnen eine Fehlermeldung über nicht verfü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äufiges Tabellendokument und ein -nebenläufiges Präsentationsdokument. Die Applikation selbst -ist nebenlä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ügt werden. Da es sich um eine serielle Komponente -handelt, kann dieses Einfügen nicht von selbst ausgelöst -werden, es muß von einer nebenläufigen Komponente, hier -die Applikation, angestoßen werden. Die Applikation ist aber -verpflichtet die Resourcen vorher zu reservieren. Für diese -Abschätzung gibt es drei realistische Mö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 „Prealloc Resource Konzept“ muß 3. gewählt -werden. Aufgrund von Sicherheitsbeschränkungen werden wir aber -noch sehen, das serielle Komponenten in ihrer Auftragsbearbeitung -gestoppt werden können. Wenn der Abbruch eines Auftrags mö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äufige Tabellendokument soll eine -Zeichenfolge eingefügt werden. Dieser Auftrag kann von der -Applikation oder der Komponente selbst ausgelöst werden. In -jedem Fall müssen die Resourcen vor der Auftragsbearbeitung -reserviert werden. Man kann dies auch der Komponente überlassen -(siehe Anforderung 2.), aber man scheitert, wenn zwei Aufträge -zu einem Auftrag zusammengefaßt werden sollen. Dies passiert -z.B., wenn der Auftrag „Text ersetzen“ aus den Aufträgen -„Löschen“ und „Einfügen“ besteht. Auf -jeden Fall wird nur das Tabellendokument selbst reserviert, da das -Einfügen keine Auswirkung auf andere Komponenten hat.</P> -<P>Fall 3:<BR>In das nebenläufige Tabellendokument wird der -Applikationsname aus der Applikation eingefügt. Dazu fragt das -Tabellendokument nach den benötigten Resourcen, um den Namen zu -holen und ihn einzufügen. Zum Holen wird die Applikation -benötigt und zum Einfügen das Tabellendokument. Beide -müssen vor der Auftragsausführung reserviert werden.</P> -<P>Fall 4:<BR>Das nebenläufige Tabellendokument fügt -selektierten Text aus dem seriellen Textdokument ein. Da das -Textdokument seinen Resourcebedarf nicht mitteilt, wird einer aus -Fall eins abgeschätzte Bedarf genommen. Man kann sehen, daß -der Auftrag für alle drei Möglichkeiten erteilt werden -kann. Seine Nebenläufigkeit wird dann durch die Abschätzung -eingeschränkt. Zusätzlich müssen natürlich die -benötigten Resourcen für das Einfügen geholt werden. -Alle müssen vor der Auftragsausführung reserviert werden.</P> -<H3>Programmierkonzepte</H3> -<P>Welche Konzepte können in einer objektorientierten Sprache -wie c++ oder Java oder einer prozeduralen Sprache wie Fortran oder -„c“ eingesetzt werden, um Nebenläufigkeit zu -erreichen. </P> -<OL> - <LI><P>Es gibt zwei Möglichkeiten eine Resource zu belegen. Das - ist Exclusive (lesen, schreiben) und „ReadOnly“. Eine - Resource kann von mehreren Aufträgen benutzt werden, wenn diese - nur „ReadOnly“ benötigen.</P> - <LI><P>Es gibt Resourcen für die man die Resourceverteilung - optimieren kann. Ein Objekt welches nicht geändert werden kann - und das während der Auftragsausführung immer konsistent - ist kann die Anforderung „Exclusiv“ automatisch auf - „ReadOnly“ abschwächen. Dies lohnt sich, wenn man - serielle Komponenten hat, die nichts über die - Resourceanforderungen mitteilen. Als Beispiel möchte ich eine - Instanz der Klasse String in Java nennen. Ein weitere Art von - Resourcen fordern bei Aufträgen an sie 1. keine weiteren - Aufträge an, 2. beenden sie die Aufträge schnell und 3. - die Reihenfolge der Änderung an ihnen ist für andere nicht - wichtig. Dies ist zum Beispiel bei der Speicherverwaltung in c der - Fall. Diese Art der Resource darf zu einem späteren Zeitpunkt - angefordert werden. Sie muß sofort benutzt und wieder - freigegeben werden. Aus diesem Grund erledigen solche Resourcen das - Anfordern und Freigeben selbst.</P> - <LI><P>Bevor ein Auftrag ausgeführt werden kann, müssen - alle von ihm benötigten Resourcen reserviert werden. Dies ist - für einen Auftrag, der aus mehreren Teilaufträgen besteht, - aufwendig. Eine Optimierung kann darin bestehen die Teilaufträge - asynchron auszuführen. Allerdings dringt diese Verhaltensweise - nach außen. Z.B. müssen Aufträ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 ändert. Es ist dann möglich mehr - Aufträge vorzuziehen.</P> - <LI><P>Es muß eine Queue geben, in die Aufträge eingefügt - werden können. Konfliktfreie Aufträge können parallel - ausgeführt werden. <B>Achtung:</B> Der Resourcebedarf eines - Auftrages kann nur bestimmt werden, wenn alle benötigten - Resourcen „ReadOnly“ reserviert werden können, es sei - denn kein vor ihm laufender Auftrag ändert die Resourcevergabe. - Warum ist das so? Ein Auftrag kann eine Resource dahingehend ändern, - daß danach andere Resourcen benötigt werden als vorher. - Der vorher bestimmte Bedarf ist dann falsch.</P> - <LI><P>Das Modell der Resourcen kann vergröbert oder verfeinert - werden. In einem Tabellendokument könnte man jede einzelne - Zelle zu einer Resource machen. Um die Komplexitä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ür den - Auftraggeber ist die Vergrö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öberung zugeordnet werden. Die Tabellenzellen dürfen - also nur dem Tabellendokument zugeordnet werden. Daraus ergibt sich, - daß innerhalb einer solchen Hierarchie nebenläufig - gearbeitet werden kann. Es dürfen dann aber keine Resourcen - außerhalb der Hierarchie benutzt werden, selbst wenn diese - reserviert sind.</P> -</OL> -<H3>Probleme und Lösungen</H3> -<P>Über den Benutzer müssen Daten abgefragt werden, die -über die Benutzung von Resourcen entscheidet (z.B. -Dateiname):<BR>Ein solcher Auftrag muß in zwei Teilaufträ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ängige Aufträ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ührung eines Auftrages und 2. einen Event von einer -nebenläufigen Komponente. Im ersten Fall überprüfe ich -den Resourcebedarf und führe dann den Auftrag aus. Im zweiten -Fall reserviere ich die benötigten Resourcen und fü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öse ich den Broadcast ohne Auftrag aus, muß -ich die Resourcen für die Listener bestimmen und sie vor dem -Aufruf reservieren. Die einzelnen Listener werden als unabhängig -betrachtet. Im Detail findet folgender Ablauf statt. 1. Die Liste der -Listener wird kopiert. 2. Für den ersten Listener wird der -Resourcebedarf ermittelt.</P> -<H3>Implementation</H3> -<P>Die Basis fü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önnen -sind folgende Schritte notwendig:<BR>1. Das Resourceable Interface -muß 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ührt. 8. Alle Resourcen -und der Auftrag werden wieder freigegeben.<BR>Diese Liste ist -detailliert aber nicht <B>vollständig</B>. In der Klasse -Resource steht imm eine Beispiel, welches aktuell sein sollte.</P> -<P>Folgende Programmierrichtlinien gibt es, um das „Prealloc -Resource Konzept“ in Java zu integrieren:</P> -<OL> - <LI><P ALIGN=LEFT>Es muß 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ür die Superklasse.</P> - <LI><P ALIGN=LEFT>???Es muß das Interface <A HREF="stardiv.concepts.ModifyTestable.html#ModifyTestable">ModifyTestable</A> - implementiert werden. Damit kann überprüft werden, ob an - den Resourcen Veränderungen vorgenommen wurden.</P> - <LI><P ALIGN=LEFT>Nur Methoden die über die Lebensdauer des - Objektes keine veränderten Werte liefern dü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ührte, ist das Lesen von -Daten über einen „langsamen“ Internet-Stream. Das -bedeutet es werden Daten benötigt, die erst noch übertragen -werden müssen. Da das Pull-Modell immer einen eigenen Thread -vorraussetzt, um die restliche Anwendung nicht zu blockieren, habe -ich das Push-Modell gewählt.<BR><B>Ziel:</B> Für die -Implementation sollte es möglichst transparent sein, wie die -Daten herangeschafft werden. Als zweites soll die Schnittstelle für -denjenigen einfach sein, der alle Daten sofort bereithält.<BR><B>Lösung:</B> -Der Datenverarbeiter ist passiv. Das bedeutet, beim Entgegennehmen -der Daten beginnt er nicht sie zu verarbeiten. Dies muß extra -angestoßen werden. Zweitens, der Datenverarbeiter hält den -Status des Datenlieferanten. Dies können EOF, für alle -Daten gelesen, READY, fü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ültig. Der Datenverarbeiter -darf nur im Zustand PENDING Daten bekommen. Diese Annahme schützt -ihn vor der Implementation eines Puffers. Das <A HREF="stardiv.concepts.QueryData.html#QueryData">QueryData</A> -- Interface ist die Spezifikation fü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 Änderungen überprüft werden kann. Da es für -ein Objekt verschiedene Möglichkeiten gibt Änderungen an -sich zu prüfen (z.B. Änderungszähler, Kopie), muß -die Schnittstelle möglichst flexibel sein, um vielen -Implementationen gerecht zu werden. Die Lösung sind zwei -Methoden. Mit der einen (getModifyHandle()) kann der Zeitpunkt -festgemacht werden, zu dem mögliche Änderungen überprüft -werden sollen. Der Rückgabewert ist eine beliebiges Objekt, so -daß in ihm die benötigte Überprüfungsinformation -(z.B. der Änderungszähler) untergebracht werden kann. -Danach kann mit der zweiten Methode (isModified(Object)) überprüft -werden, ob eine Änderung stattgefunden hat. Das Interface für -dieses Konzept heiß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ü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ß das HTML-Tag MYSCRIPT -angegeben werden. Auf die Java-Klassen kann in JavaScript mit dem -Prefix „Package“ zugegriffen werden (sun, java und netscape -benö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 „JavaScript -Language Specifications“ 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-überschreitung</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(11) Zahl oder Fehler, wenn Bereichs-überschreitung</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(11) Zahl oder Fehler, wenn Bereichs-überschreitung</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(12) Zahl oder Fehler, wenn Bereichs-überschreitung</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(13) Zahl oder Fehler, wenn Bereichs-ü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>„undefined“</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) „null“</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-überschreitung</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(30) Zahl</TD> - <TD VALIGN=TOP> - <P ALIGN=LEFT>(7) 0, NaN -> false !0, -+Infinite -> 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) „false“/ “true“</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ß übereinstimmen.<BR>2. Die -Parameter müssen, nach der obigen Tabelle, konvertiert werden -können.<BR>3. Es gibt ein Punktesystem, nach dem die Methode -ausgewählt wird. Die Punkte stehen in Klammern in den -Tabelleneinträgen. Die Konvertierungspunkte für Zahlen sind -typabhängig und nicht wertabhängig. Dadurch ist -sichergestellt, das nicht unterschiedliche Methoden bei sich -ändernden Werten gerufen werden. Kommt es allerdings zu einem -Konvertierungsfehler (Überlauf), dann wird versucht eine andere -Methode zu finden.<BR>4. Es wird vorausgesetzt, daß die -Methoden „valueOf“ und „toString“ keine -Seiteneffekte haben. Sie dü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ür jede Methode abzuarbeiten.</P> -<OL> - <LI><P>Zu jeder Klasse gibt es eine entsprechende Testklasse. Diese - steht im Package „test“.... Der Name der Klasse wird mit - „Test“ erweitert. Beispiel: stardiv.memory.BitArray wird - zu test.memory.BitArrayTest. Jede dieser Klassen hat eine Methode - „public static void main( String [] )“. Diese Methode wird - aufgerufen, um den Test aller Methoden anzustoßen. Der Test - ist nicht interaktiv. Wird ein Fehler festgestellt, wird das - Programm mit exit( -1 ) verlassen.</P> - <LI><P>Jede Methode muß unabhängig von ihren Environment - getestet werden. Alle Resourcen für die Methode werden als - Dummy für den Test implementiert. Diese Forderung führt zu - sauberen Schnittstellen, da ansonsten für den Test ja ganze - Objekte implementiert werden müssen.</P> - <LI><P>Das Testprotokoll protokolliert mit „System.out.println“. - Vor dem Test der einzelnen Methoden wird in einer Zeile kurz über - den Test informiert. Scheitert der Test, dann wird eine - Fehlermeldung ausgegeben in der „failed“ enthalten sein - muß. </P> - <LI><P>Um <A HREF="#Defined Exception">Defined Exception</A> und - <A HREF="#Transacted Exception">Transacted Exception</A> testen zu - kö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üft - werden, ob sich eine Resource unerlaubter Weise geä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äge -fertiggestellt werden können. Sie sich also nicht in einer -Verklemmung oder einem „Race“ befinden.</P> -</BODY> -</HTML>
\ No newline at end of file diff --git a/sj2/inc/sjapplet.hxx b/sj2/inc/sjapplet.hxx deleted file mode 100644 index 1125b519c8..0000000000 --- a/sj2/inc/sjapplet.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sjapplet.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SJ_SJAPPLET_HXX -#define _SJ_SJAPPLET_HXX - -#include "com/sun/star/uno/Reference.hxx" -#include <tools/string.hxx> - -class INetURLObject; -class Size; -class SjJScriptAppletObject; -class SvCommandList; -class Window; -namespace com { namespace sun { namespace star { namespace uno { - class XComponentContext; -} } } } - -struct SjApplet2_Impl; - -enum SjNetAccess -{ - NET_UNRESTRICTED, NET_NONE, NET_HOST -}; - -class SjApplet2 -{ - SjApplet2_Impl * _pImpl; - -public: - static void settingsChanged(void); - - SjApplet2(); - virtual ~SjApplet2(); - void Init( - com::sun::star::uno::Reference< - com::sun::star::uno::XComponentContext > const & context, - 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/build.lst b/sj2/prj/build.lst deleted file mode 100644 index 82fe969d02..0000000000 --- a/sj2/prj/build.lst +++ /dev/null @@ -1,8 +0,0 @@ -j2 sj2 : jvmaccess sandbox svtools NULL -j2 sj2 usr1 - all j2_mkout NULL -j2 sj2\stardiv\applet nmake - all j2_starappl j2_contr NULL -j2 sj2\stardiv\applet\resources nmake - all j2_appres j2_starappl NULL -j2 sj2\stardiv\controller nmake - all j2_contr NULL -j2 sj2\stardiv\app nmake - all j2_starapp j2_starappl j2_contr NULL -j2 sj2\source\jscpp nmake - all j2_jscpp j2_starapp NULL -j2 sj2\util nmake - all j2_util j2_jscpp NULL diff --git a/sj2/prj/d.lst b/sj2/prj/d.lst deleted file mode 100644 index c70fb0ef2b..0000000000 --- a/sj2/prj/d.lst +++ /dev/null @@ -1,9 +0,0 @@ -mkdir: %_DEST%\inc%_EXT%\sj2 -..\%__SRC%\class\classes.jar %_DEST%\bin%_EXT%\classes.jar -..\inc\sjapplet.hxx %_DEST%\inc%_EXT%\sj2\sjapplet.hxx - -..\%__SRC%\lib\sj.lib %_DEST%\lib%_EXT%\sj.lib -..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT% -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib -..\%__SRC%\slb\sj.lib %_DEST%\lib%_EXT%\xsj.lib -..\%__SRC%\bin\j?????_g.dll %_DEST%\bin%_EXT%\j?????_g.dll diff --git a/sj2/source/inc/java_lang_object.hxx b/sj2/source/inc/java_lang_object.hxx deleted file mode 100644 index c756dc8c0b..0000000000 --- a/sj2/source/inc/java_lang_object.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: java_lang_object.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#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 deleted file mode 100644 index 9c0e1d8992..0000000000 --- a/sj2/source/jscpp/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.9 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sj2 -TARGET=jscpp -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -.IF "$(GUIBASE)"=="aqua" -CFLAGSCXX+=$(OBJCXXFLAGS) -.ENDIF # "$(GUIBASE)"=="aqua" - -SLOFILES= \ - $(SLO)$/sjapplet.obj \ - $(SLO)$/sjapplet_impl.obj - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -.INCLUDE : $(PRJ)$/util$/target.pmk - diff --git a/sj2/source/jscpp/sjapplet.cxx b/sj2/source/jscpp/sjapplet.cxx deleted file mode 100644 index 0f8173bd56..0000000000 --- a/sj2/source/jscpp/sjapplet.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sjapplet.cxx,v $ - * $Revision: 1.16 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "sal/config.h" - -#include "sjapplet.hxx" - -#include "osl/diagnose.h" -#include "rtl/string.hxx" -#include "rtl/ustring.hxx" - -#include "sjapplet_impl.hxx" - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -SjApplet2::SjApplet2() - : _pImpl(new SjApplet2_Impl()) -{ -} - -SjApplet2::~SjApplet2() -{ - delete _pImpl; -} - -//========================================================================= -void SjApplet2::Init( - com::sun::star::uno::Reference< - com::sun::star::uno::XComponentContext > const & context, - Window * pParentWin, const INetURLObject & rDocBase, - const SvCommandList & rCmdList) -{ - try { - if(_pImpl) - _pImpl->init(pParentWin, context, rDocBase, rCmdList); - } - catch(RuntimeException & runtimeException) { -#if OSL_DEBUG_LEVEL > 1 - OString message = OUStringToOString(runtimeException.Message, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("sjapplet.cxx: SjApplet2::Init - exception occurred: %s\n", message.getStr()); -#else - (void) runtimeException; // avoid warning -#endif - - delete _pImpl; - _pImpl = 0; - } -} - -//========================================================================= -void SjApplet2::setSizePixel( const Size & rSize ) -{ - if(_pImpl) - _pImpl->setSize(rSize); -} - -void SjApplet2::appletRestart() -{ - if(_pImpl) - _pImpl->restart(); -} - -void SjApplet2::appletReload() -{ - if(_pImpl) - _pImpl->reload(); -} - -void SjApplet2::appletStart() -{ - if(_pImpl) - _pImpl->start(); -} - -void SjApplet2::appletStop() -{ - if(_pImpl) - _pImpl->stop(); -} - -void SjApplet2::appletClose() -{ - if(_pImpl) - _pImpl->close(); -} - -// Fuer SO3, Wrapper fuer Applet liefern -SjJScriptAppletObject * SjApplet2::GetJScriptApplet() -{ - OSL_TRACE("SjApplet2::GetJScriptApplet\n"); - - return NULL; -} - -// Settings are detected by the JavaVM service -// This function is not necessary anymore -void SjApplet2::settingsChanged(void) -{} diff --git a/sj2/source/jscpp/sjapplet_impl.cxx b/sj2/source/jscpp/sjapplet_impl.cxx deleted file mode 100644 index 31a419e154..0000000000 --- a/sj2/source/jscpp/sjapplet_impl.cxx +++ /dev/null @@ -1,617 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sjapplet_impl.cxx,v $ - * $Revision: 1.32 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "sjapplet_impl.hxx" - -#ifdef WNT -#include <tools/prewin.h> -#include <windows.h> -#include <tools/postwin.h> -#elif (defined QUARTZ) -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#elif (defined UNX) -#include <tools/prex.h> -#include "X11/Xlib.h" -#include <tools/postx.h> -#endif - -#include "rtl/ustring.hxx" -#include <rtl/process.h> -#include <osl/mutex.hxx> - -#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> -#include <vcl/sysdata.hxx> -#include <com/sun/star/java/XJavaVM.hpp> -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "jvmaccess/classpath.hxx" - -using namespace ::rtl; -using namespace ::osl; -#ifdef SOLAR_JAVA -using namespace ::com::sun::star::java; -#endif // SOLAR_JAVA -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - -namespace css = ::com::sun::star; -#ifdef SOLAR_JAVA - -static void testJavaException(JNIEnv * pEnv) throw(com::sun::star::uno::RuntimeException) -{ - jthrowable jtThrowable = pEnv->ExceptionOccurred(); - if(jtThrowable) { // is it a java exception ? -#if OSL_DEBUG_LEVEL > 1 - pEnv->ExceptionDescribe(); -#endif - pEnv->ExceptionClear(); - - jclass jcThrowable = pEnv->FindClass("java/lang/Throwable"); - jmethodID jmThrowable_getMessage = pEnv->GetMethodID(jcThrowable, "getMessage", "()Ljava/lang/String;"); - - jstring jsMessage = (jstring)pEnv->CallObjectMethod(jtThrowable, jmThrowable_getMessage); - - rtl::OUString ouMessage; - if(jsMessage) { - const jchar * jcMessage = pEnv->GetStringChars(jsMessage, NULL); - ouMessage = rtl::OUString(jcMessage); - pEnv->ReleaseStringChars(jsMessage, jcMessage); - } - - throw css::uno::RuntimeException(ouMessage, css::uno::Reference<XInterface>()); - } -} -#else // !SOLAR_JAVA -static void throwException() throw(com::sun::star::uno::RuntimeException) -{ - throw css::uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Java applets not supported.")), css::uno::Reference<XInterface>()); -} -#endif - -#ifdef SOLAR_JAVA -#if defined (UNX) && !defined(QUARTZ) -struct EmbeddedWindow { - jobject _joWindow; - - EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) throw(com::sun::star::uno::RuntimeException); - void dispose(JNIEnv * pEnv); -}; - -EmbeddedWindow::EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) - throw(com::sun::star::uno::RuntimeException) : _joWindow(0) -{ - // ensure that all operations for the window contained in pEnvData - // have been processed by the Xserver since java will access that - // window by a separate connection to the Xserver - XSync( (Display*)pEnvData->pDisplay, False); - try - { //java < 1.5 - jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit"); testJavaException(pEnv); - jmethodID jmToolkit_getDefaultToolkit = pEnv->GetStaticMethodID( - jcToolkit, "getDefaultToolkit", "()Ljava/awt/Toolkit;" ); testJavaException(pEnv); - pEnv->CallStaticObjectMethod(jcToolkit, jmToolkit_getDefaultToolkit); testJavaException(pEnv); - - jclass jcMotifAppletViewer = pEnv->FindClass( - "sun/plugin/navig/motif/MotifAppletViewer"); - if(pEnv->ExceptionOccurred()) - { - pEnv->ExceptionClear(); - jcMotifAppletViewer = pEnv->FindClass( - "sun/plugin/viewer/MNetscapePluginContext"); testJavaException(pEnv); - } - - jclass jcClassLoader = pEnv->FindClass("java/lang/ClassLoader"); testJavaException(pEnv); - jmethodID jmClassLoader_loadLibrary = pEnv->GetStaticMethodID( - jcClassLoader, "loadLibrary", - "(Ljava/lang/Class;Ljava/lang/String;Z)V" ); testJavaException(pEnv); - jstring jsplugin = pEnv->NewStringUTF("javaplugin_jni"); testJavaException(pEnv); - pEnv->CallStaticVoidMethod(jcClassLoader, jmClassLoader_loadLibrary, - jcMotifAppletViewer, jsplugin, JNI_FALSE); testJavaException(pEnv); - - jmethodID jmMotifAppletViewer_getWidget = pEnv->GetStaticMethodID( - jcMotifAppletViewer, "getWidget", "(IIIII)I" ); testJavaException(pEnv); - jint ji_widget = pEnv->CallStaticIntMethod(jcMotifAppletViewer, - jmMotifAppletViewer_getWidget, pEnvData->aWindow, - 0, 0, 1, 1); testJavaException(pEnv); - jclass jcFrame = pEnv->FindClass("sun/awt/motif/MEmbeddedFrame"); testJavaException(pEnv); - jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "(J)V" ); testJavaException(pEnv); - jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); - pEnv->CallVoidMethod(joFrame, jmFrame_rinit, (jlong)ji_widget); testJavaException(pEnv); - _joWindow = pEnv->NewGlobalRef(joFrame); - } - catch (RuntimeException & ) - { - } - - if (_joWindow) - return; - //try Java > 1.5 -#ifdef SOLARIS - jclass jcFrame = pEnv->FindClass("sun/awt/motif/MEmbeddedFrame"); testJavaException(pEnv); - jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); - jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "(JZ)V" ); testJavaException(pEnv); - pEnv->CallVoidMethod(joFrame, jmFrame_rinit, (jlong) pEnvData->aWindow, JNI_FALSE); testJavaException(pEnv); - _joWindow = pEnv->NewGlobalRef(joFrame); -#elif LINUX - jclass jcFrame = pEnv->FindClass("sun/awt/X11/XEmbeddedFrame"); testJavaException(pEnv); - jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); - jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "(J)V" ); testJavaException(pEnv); - - pEnv->CallVoidMethod(joFrame, jmFrame_rinit, (jlong) pEnvData->aWindow); testJavaException(pEnv); - _joWindow = pEnv->NewGlobalRef(joFrame); -#endif -} - -#else // UNX && !QUARTZ - -struct EmbeddedWindow { -jobject _joWindow; - -EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) throw(com::sun::star::uno::RuntimeException); -void dispose(JNIEnv * pEnv); -}; - - -#ifdef WNT -EmbeddedWindow::EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) throw(com::sun::star::uno::RuntimeException) -{ -jclass jcFrame = pEnv->FindClass("sun/awt/windows/WEmbeddedFrame"); testJavaException(pEnv); -jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "(I)V"); testJavaException(pEnv); - -jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); -pEnv->CallVoidMethod(joFrame, jmFrame_rinit, (jint)pEnvData->hWnd); testJavaException(pEnv); - -_joWindow = pEnv->NewGlobalRef(joFrame); -} - -#elif defined QUARTZ -EmbeddedWindow::EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) throw(com::sun::star::uno::RuntimeException) -{ - /* The WNT code (above) that this code derives from, may be using quite old - ways of interacting with native windows. More modern approaches seems to - point towards JAWT_* and com.apple.eawt */ -#if 0 -// FIXME: this is not going to work on cocoa -jclass jcFrame = pEnv->FindClass("apple/awt/CEmbeddedFrame"); testJavaException(pEnv); -jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "(I)V"); testJavaException(pEnv); - -jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); -pEnv->CallVoidMethod(joFrame, jmFrame_rinit, (jint)pEnvData->pView); testJavaException(pEnv); - -_joWindow = pEnv->NewGlobalRef(joFrame); -#endif -} - -#else - -EmbeddedWindow::EmbeddedWindow(JNIEnv * pEnv, SystemEnvData const * pEnvData) throw(com::sun::star::uno::RuntimeException) -{ -jclass jcFrame = pEnv->FindClass("java/awt/Frame"); testJavaException(pEnv); -jmethodID jmFrame_rinit = pEnv->GetMethodID(jcFrame, "<init>", "()V"); testJavaException(pEnv); -jobject joFrame = pEnv->AllocObject(jcFrame); testJavaException(pEnv); -pEnv->CallVoidMethod(joFrame, jmFrame_rinit); testJavaException(pEnv); - -_joWindow = pEnv->NewGlobalRef(joFrame); -} - -#endif - -#endif // UNX && !QUARTZ - -void EmbeddedWindow::dispose(JNIEnv * pEnv) -{ -jclass jcWindow = pEnv->FindClass("java/awt/Window"); testJavaException(pEnv); -jmethodID jmWindow_dispose = pEnv->GetMethodID(jcWindow, "dispose", "()V" ); testJavaException(pEnv); - -pEnv->CallVoidMethod(_joWindow, jmWindow_dispose); testJavaException(pEnv); -pEnv->DeleteGlobalRef(_joWindow); - -_joWindow = 0; -} -#endif // SOLAR_JAVA - - -#ifdef SOLAR_JAVA -SjApplet2_Impl::SjApplet2_Impl() throw(com::sun::star::uno::RuntimeException) - : - _joAppletExecutionContext(0), - _jcAppletExecutionContext(0) - -{} -#else // !SOLAR_JAVA -SjApplet2_Impl::SjApplet2_Impl() throw(com::sun::star::uno::RuntimeException) -{} -#endif - - -SjApplet2_Impl::~SjApplet2_Impl() throw() -{ -#ifdef SOLAR_JAVA - if (_joAppletExecutionContext) - { - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - _pEmbeddedWindow->dispose(pEnv); - delete _pEmbeddedWindow; - - pEnv->DeleteGlobalRef(_joAppletExecutionContext); - pEnv->DeleteGlobalRef(_jcAppletExecutionContext); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - } - } -#endif -} - -void SjApplet2_Impl::init( - Window * pParentWin, - css::uno::Reference< css::uno::XComponentContext > const & context, - const INetURLObject & rDocBase, const SvCommandList & rCmdList) - throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - _pParentWin = pParentWin; - - - // Java URL erzeugen - rtl::OUString url = rDocBase.GetMainURL(INetURLObject::DECODE_TO_IURI); - - if(!url.getLength()) - url = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///")); - - if (url.getLength()) { - //WorkAround, weil Java mit dem | nicht zurecht kommt - if(rDocBase.GetProtocol() == INET_PROT_FILE && url.pData->buffer[9] == INET_ENC_DELIM_TOKEN) { - rtl::OUString tmp = url.copy(0, 9); - tmp += String(INET_DELIM_TOKEN); - tmp += url.copy(10); - - url = tmp; - } - } - - -#if OSL_DEBUG_LEVEL > 1 - rtl::OString tmp = rtl::OUStringToOString(url, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("SjApplet2_Impl::init - mainUrl: %s\n", tmp.getStr()); -#endif - - css::uno::Reference<XJavaVM> _xJavaVM = css::uno::Reference<XJavaVM>( - (css::uno::Reference< css::lang::XMultiComponentFactory >( - context->getServiceManager(), css::uno::UNO_QUERY_THROW)-> - createInstanceWithContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.java.JavaVirtualMachine")), - context)), - UNO_QUERY); - Sequence<sal_Int8> processID(17); - rtl_getGlobalProcessId((sal_uInt8 *)processID.getArray()); - processID[16] = 0; - - OSL_ENSURE(sizeof (sal_Int64) - >= sizeof (jvmaccess::VirtualMachine *), - "Pointer cannot be represented as sal_Int64"); - sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( - static_cast< jvmaccess::VirtualMachine * >(0)); - _xJavaVM->getJavaVM(processID) >>= nPointer; - _virtualMachine = reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer); - if (!_virtualMachine.is()) - return; - - try - { - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - - _jcAppletExecutionContext = jvmaccess::ClassPath::loadClass( - context, pEnv, - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "vnd.sun.star.expand:$ORIGIN/classes/classes.jar")), - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "stardiv.applet.AppletExecutionContext"))); - testJavaException(pEnv); - _jcAppletExecutionContext = (jclass) pEnv->NewGlobalRef(_jcAppletExecutionContext ); testJavaException(pEnv); - - jclass jcURL = pEnv->FindClass("java/net/URL"); testJavaException(pEnv); - jmethodID jmURL_rinit = pEnv->GetMethodID(jcURL, "<init>", "(Ljava/lang/String;)V"); testJavaException(pEnv); - jobject joDocBase = pEnv->AllocObject(jcURL); testJavaException(pEnv); - jstring jsURL = pEnv->NewString(url.getStr(), url.getLength()); testJavaException(pEnv); - pEnv->CallVoidMethod(joDocBase, jmURL_rinit, jsURL); testJavaException(pEnv); - - jclass jcHashtable = pEnv->FindClass("java/util/Hashtable"); testJavaException(pEnv); - jmethodID jmHashtable_rinit = pEnv->GetMethodID(jcHashtable, "<init>", "()V"); testJavaException(pEnv); - jmethodID jmHashtable_put = pEnv->GetMethodID(jcHashtable, "put", - "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); testJavaException(pEnv); - jobject joParameters = pEnv->AllocObject(jcHashtable); testJavaException(pEnv); - pEnv->CallVoidMethod(joParameters, jmHashtable_rinit); testJavaException(pEnv); - - for(sal_uInt32 i = 0; i < rCmdList.Count(); ++i) { - const SvCommand & rCmd = rCmdList[i]; - String aCmd = rCmd.GetCommand(); - String aLoweredCmd = aCmd.ToLowerAscii(); - -#if OSL_DEBUG_LEVEL > 1 - rtl::OUString command = aCmd; - rtl::OUString value = rCmd.GetArgument(); - rtl::OString cmd_tmp = rtl::OUStringToOString(command, RTL_TEXTENCODING_ASCII_US); - rtl::OString value_tmp = rtl::OUStringToOString(value, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("command: %s=%s", cmd_tmp.getStr(), value_tmp.getStr()); -#endif - jstring jsCommand = pEnv->NewString(aLoweredCmd.GetBuffer(), aLoweredCmd.Len()); testJavaException(pEnv); - jstring jsArg = pEnv->NewString(rCmd.GetArgument().GetBuffer(), rCmd.GetArgument().Len()); testJavaException(pEnv); - pEnv->CallObjectMethod(joParameters, jmHashtable_put, jsCommand, jsArg); testJavaException(pEnv); - } - - SystemEnvData const * pEnvData = ((SystemChildWindow *)pParentWin)->GetSystemData(); - _pEmbeddedWindow = new EmbeddedWindow(pEnv, pEnvData); - - jmethodID jmAppletExecutionContext_rinit = pEnv->GetMethodID(_jcAppletExecutionContext, "<init>", - "(Ljava/net/URL;Ljava/util/Hashtable;Ljava/awt/Container;J)V"); testJavaException(pEnv); - jmethodID jmAppletExecutionContext_init = pEnv->GetMethodID(_jcAppletExecutionContext, "init", "()V"); testJavaException(pEnv); - jmethodID jmAppletExecutionContext_startUp = pEnv->GetMethodID(_jcAppletExecutionContext, "startUp", "()V"); testJavaException(pEnv); - - _joAppletExecutionContext = pEnv->AllocObject(_jcAppletExecutionContext); testJavaException(pEnv); - _joAppletExecutionContext = pEnv->NewGlobalRef(_joAppletExecutionContext); testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_rinit, - joDocBase, joParameters, _pEmbeddedWindow->_joWindow, (jlong)0); testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_init); testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_startUp); testJavaException(pEnv); - - } - catch(jvmaccess::VirtualMachine::AttachGuard::CreationException & ) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "sjapplet_impl.cxx: Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } - -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::setSize(const Size & rSize) throw(com::sun::star::uno::RuntimeException) -{ - -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - - _pParentWin->SetSizePixel(rSize); - - jmethodID jmAppletExecutionContext_resize = pEnv->GetMethodID( - _jcAppletExecutionContext, "appletResize", "(II)V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, - jmAppletExecutionContext_resize, (jint)rSize.Width(), - (jint)rSize.Height()); - testJavaException(pEnv); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::setSize, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::restart() throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - jmethodID jmAppletExecutionContext_restart = pEnv->GetMethodID( - _jcAppletExecutionContext, "restart", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_restart); - testJavaException(pEnv); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::restart, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::reload() throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - jmethodID jmAppletExecutionContext_reload = pEnv->GetMethodID( - _jcAppletExecutionContext, "reload", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_reload); - testJavaException(pEnv); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::reload, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::start() throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - jmethodID jmAppletExecutionContext_sendStart = pEnv->GetMethodID( - _jcAppletExecutionContext, "sendStart", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStart); - testJavaException(pEnv); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::restart, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::stop() throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - jmethodID jmAppletExecutionContext_sendStop = pEnv->GetMethodID( - _jcAppletExecutionContext, "sendStop", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStop); - testJavaException(pEnv); - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::restart, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - -void SjApplet2_Impl::close() throw(com::sun::star::uno::RuntimeException) -{ -#ifdef SOLAR_JAVA - try - { - if ( ! _virtualMachine.is()) - return; - jvmaccess::VirtualMachine::AttachGuard vmAttachGuard(_virtualMachine); - JNIEnv * pEnv = vmAttachGuard.getEnvironment(); - - jmethodID jmAppletExecutionContext_shutdown = pEnv->GetMethodID( - _jcAppletExecutionContext, "shutdown", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_shutdown); - testJavaException(pEnv); - - jmethodID jmWaitForDispose= pEnv->GetMethodID( - _jcAppletExecutionContext,"waitForDispose","()V"); - testJavaException(pEnv); - //blocks until the applet has destroyed itself and the container was disposed - //(stardiv.applet.AppletExecutionContext.dispose) - pEnv->CallVoidMethod(_joAppletExecutionContext, jmWaitForDispose); - - // now that the applet is disposed, we dispose the AppletExecutionContext, that will end the thread - // which dispatches the applet methods, such as init, start, stop , destroy. - jmethodID jmAppletExecutionContext_dispose= pEnv->GetMethodID( - _jcAppletExecutionContext,"dispose", "()V"); - testJavaException(pEnv); - pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_dispose); - testJavaException(pEnv); - - if( _pParentWin ) - { - WorkWindow* pAppWin = Application::GetAppWindow(); - if(pAppWin) - { - while(_pParentWin->GetChildCount()) - { - Window* pChild = _pParentWin->GetChild(0); - pChild->Show( FALSE ); - pChild->SetParent( pAppWin ); - } - } - } - } - catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - throw RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SjApplet2_Impl::close, Could not create jvmaccess::" - "VirtualMachine::AttachGuard!")), 0); - } -#else // !SOLAR_JAVA - throwException(); -#endif -} - diff --git a/sj2/source/jscpp/sjapplet_impl.hxx b/sj2/source/jscpp/sjapplet_impl.hxx deleted file mode 100644 index c8d83b0832..0000000000 --- a/sj2/source/jscpp/sjapplet_impl.hxx +++ /dev/null @@ -1,56 +0,0 @@ -#include <cstdarg> - -#ifdef SOLAR_JAVA -#include <jni.h> -#endif // SOLAR_JAVA - -#ifdef SOLAR_JAVA -#include <com/sun/star/java/XJavaVM.hpp> -#include <com/sun/star/java/XJavaThreadRegister_11.hpp> -#else -#include <com/sun/star/uno/RuntimeException.hpp> -#endif // SOLAR_JAVA - -#include "rtl/ref.hxx" -#include "com/sun/star/uno/Reference.hxx" -#include "jvmaccess/virtualmachine.hxx" - -class Window; -class INetURLObject; -class SvCommandList; -class Size; -namespace com { namespace sun { namespace star { namespace uno { - class XComponentContext; -} } } } - -#ifdef SOLAR_JAVA -struct EmbeddedWindow; -#endif // SOLAR_JAVA - -struct SjApplet2_Impl { -#ifdef SOLAR_JAVA - Window * _pParentWin; - - rtl::Reference<jvmaccess::VirtualMachine> _virtualMachine; - - jobject _joAppletExecutionContext; - jclass _jcAppletExecutionContext; - - EmbeddedWindow * _pEmbeddedWindow; -#endif // SOLAR_JAVA - SjApplet2_Impl() throw(com::sun::star::uno::RuntimeException); - ~SjApplet2_Impl() throw(); - - void init(Window * pParentWin, - com::sun::star::uno::Reference< - com::sun::star::uno::XComponentContext > const & context, - const INetURLObject & rDocBase, - const SvCommandList & rCmdList) throw(com::sun::star::uno::RuntimeException); - - void setSize(const Size & rSize) throw(com::sun::star::uno::RuntimeException); - void restart() throw(com::sun::star::uno::RuntimeException); - void reload() throw(com::sun::star::uno::RuntimeException); - void start() throw(com::sun::star::uno::RuntimeException); - void stop() throw(com::sun::star::uno::RuntimeException); - void close() throw(com::sun::star::uno::RuntimeException); -}; diff --git a/sj2/stardiv/app/AppletMessageHandler.java b/sj2/stardiv/app/AppletMessageHandler.java deleted file mode 100644 index 742d41d91a..0000000000 --- a/sj2/stardiv/app/AppletMessageHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AppletMessageHandler.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -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 deleted file mode 100644 index 01d879648b..0000000000 --- a/sj2/stardiv/app/AppletProps.java +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AppletProps.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -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 deleted file mode 100644 index 47e7eef92e..0000000000 --- a/sj2/stardiv/app/AppletViewer.java +++ /dev/null @@ -1,995 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AppletViewer.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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(); - //sun.awt.ScreenUpdater does not exist in Java 1.4 -// 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 deleted file mode 100644 index 23a37aa77e..0000000000 --- a/sj2/stardiv/app/AppletViewerFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AppletViewerFactory.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* - * 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 deleted file mode 100644 index 12d91c6e16..0000000000 --- a/sj2/stardiv/app/MsgAppletViewer.java +++ /dev/null @@ -1,189 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: MsgAppletViewer.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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 deleted file mode 100644 index 4e4b5f36a3..0000000000 --- a/sj2/stardiv/app/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sj2 -TARGET=app - -PACKAGE=stardiv$/app -JARFILES=sandbox.jar - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -.IF "$(JDK)" == "gcj" -all: - @echo This dir cannot be build with gcj because of sun.net.ftp.FtpClient -.ELSE -# --- 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 ------------------------------------------------------ -.ENDIF - -.INCLUDE : target.mk - -.INCLUDE : $(PRJ)$/util$/target.pmk - diff --git a/sj2/stardiv/applet/AppletExecutionContext.java b/sj2/stardiv/applet/AppletExecutionContext.java deleted file mode 100644 index ddf81c1a15..0000000000 --- a/sj2/stardiv/applet/AppletExecutionContext.java +++ /dev/null @@ -1,383 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AppletExecutionContext.java,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -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.awt.Toolkit; -import java.awt.Window; - -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.SandboxSecurity; -import com.sun.star.lib.sandbox.CodeSource; - -import stardiv.controller.SjSettings; - -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 _documentBase = null; - private URL _baseURL = null; - - private 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 documentBase, - Hashtable parameters, - Container container, - long pCppJSbxObject) - { - this(pCppJSbxObject); - - if(DEBUG) System.err.println("#### AppletExecutionContext.<init>:" + documentBase + " " + parameters + " " + container + " " + pCppJSbxObject); - _documentBase = documentBase; - _parameters = parameters; - _container = container; - - _toolkit = container.getToolkit(); - - _documentProxy = DocumentProxy.getDocumentProxy(documentBase, _toolkit); - addObserver(_documentProxy); - } - - public void init() { - _baseURL = null; - - try { - String codeBase = getParameter("codebase"); - - if (!codeBase.endsWith("/")) { - codeBase += "/"; - } - _baseURL = new URL(_documentBase, codeBase); - } - catch (MalformedURLException e) { - if(DEBUG) System.err.println("#### AppletExecutionContext: Could not create base Url"); - } - - if(_baseURL == null) - _baseURL = _documentBase; - - if(DEBUG) System.err.println("##### " + getClass().getName() + ".init - baseUrl:" + _baseURL); - - _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); - - super.init(nm, ClassContextProxy.create(_baseURL, null, null, false)); - - // Set the property stardiv.security.noExit to true. That value will be used in - // SjSettings.changeProperties in the constructor of the SecurityManager SandboxSecurity - if (System.getSecurityManager() == null) - System.setProperty("stardiv.security.noExit", "true"); - // SjSettings.changeProperties puts a lot of applet relating properties into the system properties - // and it sets the SecurityManager - SjSettings.changeProperties( System.getProperties()); - - if(DEBUG) System.err.println("#####" + getClass().getName() + ".init: _className=" + _className + " _baseURL=" + _baseURL); - } - - 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); - - appletResize(_container.getSize().width, _container.getSize().height); - - _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() { - if(DEBUG) System.err.println("##### " + getClass().getName() + ".xdestroy"); - - _applet.destroy(); - _applet.setVisible(false); - _applet.setStub(null); - - _documentProxy.removeExecutionContext(_applet.getClass().getName()); - } - - protected void xdispose() { - if(DEBUG) System.err.println("##### " + getClass().getName() + ".xdispose"); - - if(_container != null) { - _container.remove(_applet); - - if(_container instanceof Window) - ((Window)_container).dispose(); - } - - _applet = null; - } - - private void loadArchive(String archive) throws MalformedURLException, IOException { - ResourceProxy jarResourceProxy = ResourceProxy.load(new URL(_baseURL, archive), null /*_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) { - if(DEBUG) System.err.println("##### " + getClass().getName() + ".appletResize: " + width + " " + height); - - _container.setSize(width, height); - if(_applet != null) - _applet.setSize(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 deleted file mode 100644 index b1eb9c5a7a..0000000000 --- a/sj2/stardiv/applet/Document.java +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: Document.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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) { - // Create the document base. - //For example, suppose an applet is contained within the document: - //http://java.sun.com/products/jdk/1.2/index.html - //The document base is: - //http://java.sun.com/products/jdk/1.2/ - - String s= url.toString(); - int index= s.lastIndexOf('/'); - if( index != -1) - { - s=s.substring(0, index + 1); - } - try{ - documentBase = new URL(s); - }catch(Exception e){ - } - 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 deleted file mode 100644 index 02017c4898..0000000000 --- a/sj2/stardiv/applet/DocumentProxy.java +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: DocumentProxy.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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.util.Iterator; -import java.io.InputStream; - -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; - } - - // AppletContext. This method is new since 1.4. We insert it so as to - // have the project buildable - public void setStream( String key,InputStream stream) - throws java.io.IOException { - } - // AppletContext. This method is new since 1.4. We insert it so as to - // have the project buildable - public InputStream getStream( String key) { - return null; - } - // AppletContext. This method is new since 1.4. We insert it so as to - // have the project buildable - public Iterator getStreamKeys() { - return null; - } - - - /* - ** 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 deleted file mode 100644 index aca30e16ec..0000000000 --- a/sj2/stardiv/applet/LiveConnectable.java +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: LiveConnectable.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -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 deleted file mode 100644 index 3096d15ece..0000000000 --- a/sj2/stardiv/applet/makefile.mk +++ /dev/null @@ -1,78 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sj2 -TARGET=applet - -PACKAGE=stardiv$/applet - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -.IF "$(JDK)" == "gcj" -all: - @echo This dir cannot be build with gcj because of com.sun.star.lib.sandbox.ResourceProxy -.ELSE - -# --- 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 - -.ENDIF - -#.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 deleted file mode 100644 index 18a2a8495d..0000000000 --- a/sj2/stardiv/applet/resources/MsgAppletViewer.java +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: MsgAppletViewer.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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 deleted file mode 100644 index af89ef8a80..0000000000 --- a/sj2/stardiv/applet/resources/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -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 deleted file mode 100644 index 74d570353b..0000000000 --- a/sj2/stardiv/controller/SjSettings.java +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: SjSettings.java,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package stardiv.controller; - -import java.util.Properties; -import java.util.Hashtable; -import java.util.Enumeration; - -import com.sun.star.lib.sandbox.SandboxSecurity; - -/** - * Ueber diese Klasse werden alle globalen Einstellungen, die fuer das Sj Projekt - * wichtig sind, dokumentiert und modifiziert. - * - * @version $Version: 1.0 $ - * @author Markus Meyer - * - */ -public 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.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"); - - } - - // 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 - boolean bNoExit = Boolean.getBoolean( "stardiv.security.noExit" ); - //Create and install the security manager - if (System.getSecurityManager() == null) - System.setSecurityManager(new SandboxSecurity(bNoExit)); - -// if( Boolean.getBoolean("stardiv.controller.installConsole") ) -// Console.installConsole(); - } - } - - 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 deleted file mode 100644 index 8776f7f7fd..0000000000 --- a/sj2/stardiv/controller/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sj2 -TARGET=controller - -PACKAGE=stardiv$/controller -JARFILES=sandbox.jar tkt.jar - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -.IF "$(JDK)" == "gcj" -all: - @echo This dir cannot be build with gcj because of com.sun.star.lib.sandbox.ResourceProxy -.ELSE - -# --- Files -------------------------------------------------------- - -JAVACLASSFILES= \ - $(CLASSDIR)$/$(PACKAGE)$/SjSettings.class - -# --- Targets ------------------------------------------------------ -.ENDIF - -.INCLUDE : target.mk - -.INCLUDE : $(PRJ)$/util$/target.pmk - diff --git a/sj2/stardiv/security/resources/MsgAppletViewer.java b/sj2/stardiv/security/resources/MsgAppletViewer.java deleted file mode 100644 index 89671d38fe..0000000000 --- a/sj2/stardiv/security/resources/MsgAppletViewer.java +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: MsgAppletViewer.java,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -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 deleted file mode 100644 index f57edbbc4a..0000000000 --- a/sj2/stardiv/security/resources/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -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 deleted file mode 100644 index 9a74eb31b0..0000000000 --- a/sj2/util/makefile.mk +++ /dev/null @@ -1,97 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.16 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=sj2 -TARGET=sj -TARGETTYPE=GUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1FILES= \ - $(SLB)$/jscpp.lib - -SHL1DEPN= $(LIB1TARGET) - -SHL1TARGET= j$(DLLPOSTFIX)_g -SHL1IMPLIB= $(TARGET) - -SHL1STDLIBS= \ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(CPPULIB) \ - $(SALLIB) - -.IF "$(GUI)$(COMID)"=="WNTMSC" -SHL1STDLIBS+= \ - $(SVTOOLLIB) -.ENDIF # "$(GUI)$(COMID)"=="WNTMSC" - -.IF "$(SOLAR_JAVA)"!="" - SHL1STDLIBS+=$(JVMACCESSLIB) -.ENDIF - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt -DEFLIB1NAME =$(TARGET) -DEF1DES =JavaCPP -DEF1CEXP =Java - -JARTARGET=classes.jar -JARCLASSDIRS=stardiv -JARCLASSPATH = sandbox.jar - -# --- 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>>$@ - @echo _C@>>$@ -.ENDIF diff --git a/sj2/util/makefile.pmk b/sj2/util/makefile.pmk deleted file mode 100644 index 6976b55b38..0000000000 --- a/sj2/util/makefile.pmk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.pmk,v $ -# -# $Revision: 1.5 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JAVAPREPRO= -.IF "$(JDK_VERSION)" == "110" -JAVAPREPRO=-jdk11 -.ENDIF -.IF "$(PRODUCT)" != "" -JAVAPREPRO=$(JAVAPREPRO) + " -product" -.ENDIF - -ENABLE_EXCEPTIONS=TRUE - -JARFILES=sandbox.jar tkt.jar - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk - diff --git a/sj2/util/target.pmk b/sj2/util/target.pmk deleted file mode 100644 index 56da244699..0000000000 --- a/sj2/util/target.pmk +++ /dev/null @@ -1,42 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: target.pmk,v $ -# -# $Revision: 1.3 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -.IF "$(depend)" == "" -ONLYZIP: $(SLOFILES) - cd $(PRJ)$/util - nmake debug=t - -TEST: - -DOC: - -PREPRO: - $(JAVAI) $(JAVACPS) $(CLASSPATH) stardiv.app.Javac $(JAVAPREPRO) $(JAVAFILES) -.ENDIF |