|
Letzte
Bearbeitung dieses Dokuments: |
Code
Erklärungen
und Anwendungsbeispiele
Verwandte
Dokumentation
package
js_base.frame;
/*
* de:
* Package und Klasse für
Properties (Eigenschaften).
* Diese 'Eigenschaften'
definieren, zu welchem JAS die Verbindung hergestellt wird.
*
en:
* Package and class for Properties.
* These
properties define, to which JAS the connection will be established.
*/import
java.util.Properties;
/*
* de:
* Package mit universellem und
speziellem Context.
* Im 'Context' ist die Verbindung
zu einem JAS definiert und über den 'Context' kann
eine
* Verbindung zu einem EJB (das im spezifiziertem
JAS 'läuft') hergestellt werden.
* en:
* Package
with universal and special Context.
* Within a
'Context' the connection to a JAS is defined and via the 'Context'
the connection
* to a EJB ('running' on the defined
JAS) can be established. */
import
javax.naming.Context;
import
javax.naming.InitialContext;
/*
* de:
* Package und Klasse zum Einlesen
der XML-Struktur, die die 'Properties' für die Verbindung zum
JAS enthält.
* en:
* Package and class
to read the XML-structure containing the 'Properties' to connect to
the JAS. */import
js_base.xml.JSBS_XML_Connections;
/**
*
* @author kurt[at]javascout(dot)biz
* @date
2009-09-14
*
* @description
* de:
*
Klasse zum Aufbauen einer Verbindung zu einem JAS (Java Application
Server).
*
* Diese Klasse hat die
folgenden Aufgabe:
* * Methode zum Erstellen eines
'Context'; das sind die Verbindungsdaten zu einem JAS.
* Die
Daten ('Properties') für die Verbindung werden aus einer
XML-Struktur ausgelesen.
* Der Name
der Datei mit der XML-Struktur ist in der Interface
JSBS_UniversalParameters_Constants
* definiert.
*
-------------------
* en: *
Class to establish a connection to a JAS (Java Application
Server).
*
* This class has the
following functions:
* * Method to establish a
'Context'; that are the values needed to connect to a JAS.
* The
values ('Properties') for the connection are read from an
XML-structure.
* The name of the file
with the XML-structure is defined within the Interface
* JSBS_UniversalParameters_Constants.
*
*
@change-log
* when who why
*
--------------------------------------------------------
*
*/public
class
JSBS_StartFrame__JASConnections
{
/*
*
de: Variable mit dem Objekt, dass dieses Objekt konstruiert hat.
*
en: Variable holding the object which constructed this object. */
public
JSBS_StartFrame
frmCC
;
/*
*
de: Variable mit dem Namen des EJB, das als 'Standard'-EJB definiert
ist.
* en: Variable with the name of the EJB which is
defined as 'Standard'-EJB. */
public
String
strStandardEJB_JNDI_Name
;
/*
*
de:
* Variable mit dem Context mit den Daten für
die Verbindung zum JAS, auf dem das 'Standard'-EJB 'läuft'.
*
en:
* Variable with the Context holding the values for the
connection to the JAS where the 'Standard'-EJB
* is
running. */
public
Context
initialStandardContext
;
/*
*
CONSTRUCTOR
* --------------------
* de:
*
Übernehmen des Start-Frame das dieses Objekt konstruiert hat
(und als Parameter übergeben
* wird) und speichern in
der oben definierten Variablen.
* Lesen des JNDI-Namens
für das 'Standard'-EJB aus der XML-Struktur.
* Lesen
der Werte für den Context für die Verbindung zum JAS aus
der XML-Struktur.
* en: * Takes
the task that constructed this class (which is passed as a parameter)
and stores it
* in the above defined variable.
* Read
the JNDI-Name for the 'Standard'-EJB out of the XML-structure.
*
Read the values for the Context for the connection to the JAS out of
the XML-structure. */
public
JSBS_StartFrame__JASConnections(JSBS_StartFrame parmCC) {
/*
* de:
Übernehmen der Referenz auf das konstruierende Objekt.
* en:
Take over the reference to the constructing object. */
frmCC
= parmCC;
/*
* de:
Erstellen des Initial-Context für das Standard-EJB;
Detailbeschreibung in der Methode.
* en: Establish the
Initial-Context for the Standard-EJB; detailed description within the
method. */ establishStandardInitialContext();
}/*
*
METHODEN / METHODS
* ----------------------
*/
/*
* --------------------
* de:
*
METHODE zum Auslesen der Werte für das 'Standard'-EJB aus der
XML-Struktur.
* Das 'Standard'-EJB hat eine besondere
Bedeutung weil darin die Methoden zum Speichern und Wieder-Lesen
*
der Werte für die Position und Größe eines Fensters
enhalten ist (Details in Klasse JSBS_FramePosition_BOC)
*
und die Methoden zum Speichern und Wieder-Lesen in den
JavaScout-Basisklassen implementiert sind.
* Die Werte
für das 'Standard'-EJB sind innerhalb der XML-Struktur durch den
<SymbolicName>Standard</SymbolicName>
* identifiziert.
*
en: *
METHOD to read the values for the 'Standard'-EJB out of the
XML-structure.
* The 'Standard'-EJB has a special
meaning as within the EJB the methods to store and reread the values
for
* the position and size of a window is contained
(for details please see class JSBS_FramePosition_BOC)
* and
the methods to store and read are implemented within the JavaScout
base-classes.
* The values for the 'Standard'-EJB are
identifier by <SymbolicName>Standard</SymbolicName>
within the XML-structure. */
public
void
establishStandardInitialContext()
{
/*
* de:
* Aufrufen der universellen Methode
zum Lesen des EJB-JNDI-Namens; als Parameter wird der Identifikator,
wie er
* unter <SymbolicName>Standard</SymbolicName>
in der XML-Struktur festgelegt ist, übergeben.
* en:
* Call the universal method to read the EJB-JNDI-Name;
passed as parameter ist the identifier which is defined under
*
<SymbolicName>Standard</SymbolicName> within the
XML-structure. */
strStandardEJB_JNDI_Name
= get_EJB_JNDI_Name(
"Standard"
);
/*
* de:
* Aufrufen der universellen Methode
zum Lesen der 'Properties' (mit den Werten für die Verbindung
zum JAS);
* als Parameter wird der Identifikator, wie
er unter <SymbolicName>Standard</SymbolicName>
* in
der XML-Struktur festgelegt ist, übergeben.
* en:
*
Call the universal method to read the 'Properties' (with the values
to connect to the JAS); passed as
* parameter ist the
identifier which is defined under
<SymbolicName>Standard</SymbolicName> within the
XML-structure. */
initialStandardContext
= get_InitialContext(
"Standard"
);
}
/*
* --------------------
*
de:
* METHODE zum Auslesen eines EJB-JNDI-Namens aus der
XML-Struktur wenn der <SymbolicName> bekannt ist.
* Diese
Methode wurde allgemein gültig geschrieben damit sie auch von
der erbenden Klasse verwendet
* werden kann.
* In
der erbenden Klasse können dann auch weitere EJB (z.B. als
'Statefull' entworfene für 'High-Volume'
* Transaktionen)
definiert werden.
* en: *
METHOD to get a EJB-JNDI-Name out of the XML-structure for a known
<SymbolicName>.
* This method is designed to be
universally used so it can be also called by an inheriting
class.
* The inheriting class may contain more
connections to EJBs (e.g. such designed als 'Statefull' to
* be
used for 'High-Volume' transactions). */
public
String
get_EJB_JNDI_Name(String parmSymbolicName) {
/*
de:
* 'Konstruieren' einer XML-structure mit den
Parameter-Werten für Verbindungen.
* Der 'Constructor'
für die Klasse enthält auch das Lesen der XML-Struktur aus
der Datei.
* Der standardisierte Name für die Datei ist
in der Interface JSBS_UniversalParameters_Constants festgelegt.
*
en:
* 'Construct' a XML-structure for the
connection-parameters.
* The 'constructor' of the
class includes the reading of the XML-structure from the file.
*
The standardized name of the file is defined in Interface
JSBS_UniversalParameters_Constants. */ JSBS_XML_Connections
structJSBS_XML_Connections =
new
JSBS_XML_Connections(
frmCC
);
/*
* de:
* Prüfen ob die XML-Struktur aus
der Datei gelesen werden konnte;
* wenn nicht dann
'null'-Wert als Signal zurückliefern.
* en:
*
Verify if the XML-structure could be read out of the file;
* if
not then signal via 'null'-value. */
if
(structJSBS_XML_Connections
==
null
)
return
null
;
/*
* de: Auslesen des EJB-JNDI-Namens aus der
XML-Struktur.
* en: Read the EJB-JNDI-Name out of the
XML-structure. */ String
strEJB_JNDI_Name =
structJSBS_XML_Connections.getJASJNDIName(parmSymbolicName);
/*
* de:
* Prüfen ob der Name aus der
XML-Struktur gelesen werden konnte;
* wenn nicht dann
'null'-Wert als Signal zurückliefern.
* en:
*
Verify if the name could be read out of the XML-structure;
* if
not then signal via 'null'-value. */
if
(strEJB_JNDI_Name
==
null
)
return
null
;
/*
* de:Methode bis jetzt ordnungsgemäß
ausgeführt; EJB-JNDI-Name zurückliefern.
* en:
Method run without an error till now; return EJB-JNDI-Name.
*/
return
strEJB_JNDI_Name;
}
/*
* --------------------
*
de:
* METHODE zum Auslesen der Werte für den 'Context'
aus der XML-Struktur wenn der <SymbolicName> bekannt ist
* und
bilden eines Objektes der Klasse 'Context'.
* Diese
Methode wurde allgemein gültig geschrieben damit sie auch von
der erbenden Klasse verwendet
* werden kann.
* In
der erbenden Klasse können dann auch weitere EJB (z.B. als
'Statefull' entworfene für 'High-Volume'
* Transaktionen)
definiert werden.
* en: *
METHOD to get the values for the 'Context' out of the XML-structure
for a known <SymbolicName> and
* build an object
of the class 'Context'.
* This method is designed to be
universally used so it can be also called by an inheriting
class.
* The inheriting class may contain more
connections to EJBs (e.g. such designed als 'Statefull' to
* be
used for 'High-Volume' transactions). */
public
Context
get_InitialContext(String parmSymbolicName) {
/*
de:
* 'Konstruieren' einer XML-structure mit den
Parameter-Werten für Verbindungen.
* Der 'Constructor'
für die Klasse enthält auch das Lesen der XML-Struktur aus
der Datei.
* Der standardisierte Name für die Datei ist
in der Interface JSBS_UniversalParameters_Constants festgelegt.
*
en:
* 'Construct' a XML-structure for the
connection-parameters.
* The 'constructor' of the
class includes the reading of the XML-structure from the file.
*
The standardized name of the file is defined in Interface
JSBS_UniversalParameters_Constants. */
JSBS_XML_Connections
structJSBS_XML_Connections =
new
JSBS_XML_Connections(
frmCC
);
/*
* de:
* Prüfen ob die XML-Struktur aus
der Datei gelesen werden konnte;
* wenn nicht dann
'null'-Wert als Signal zurückliefern.
* en:
*
Verify if the XML-structure could be read out of the file;
* if
not then signal via 'null'-value. */
if
(structJSBS_XML_Connections
==
null
)
return
null
;
/*
* de: Auslesen der Werte 'Properties' aus der
XML-Struktur.
* en: Read the values 'Properties' out of the
XML-structure. */ Properties
propForJASConnection =
structJSBS_XML_Connections.getJASContextProperties(parmSymbolicName);
/*
* de: Definieren eines Objekts der Klasse 'Context'
das von dieser Methode zurück geliefert wird.
* en:
Define an object of class 'Context' which will be returned from this
method. */ Context
returnContext;
/*
* de: Zum Erstellen des Context ist eine try/catch
Logic notwendig.
* en: The context is established within a
try/catch logic. */
try
{
/*
* de: Prüfen, ob für die Properties in der
XML-Struktur Werte gefunden wurden.
* en: Verify if there
where values found within the XML-structure for the Properties.
*/
if
(propForJASConnection
==
null
)
{
/*
* de:
* In der XML-Struktur sind keine
Werte für die 'Properties' enthalten.
* Das
bedeutet, dass die 'Properties' in der Datei 'jndi.properties'
enthalten sind.
* Diese Datei wird gelesen, wenn ein
Objekt der Klasse 'InitialContext' ohne Parameter konstruiert
wird.
* en:
* The XML-structure does not
contain values for the 'Properties'.
* That means that
the 'Properties' are contained in the file 'jndi.properties'.
* This
file will be read when an object of the class 'InitialContext' is
constructed without parameters. */ returnContext
=
new
InitialContext();
}
else
{
/*
* de:
* In der XML-Struktur sind Werte
für die 'Properties' enthalten.
* Diese
'Properties' als Parameter übergeben wenn das Objekt der Klasse
'InitialContext' konstruiert wird.
* en:
* The
XML-structure contains values for the 'Properties'.
* Pass
the 'Properties' when an object of the class 'InitialContext' is
consturcted. */ returnContext
=
new
InitialContext(propForJASConnection);
}
/*
* de: Methode bis jetzt ordnungsgemäß
ausgeführt; Context zurückliefern.
* en: Method
run without an error till now; return Context. */
return
returnContext;
}
catch
(Exception
e){
/*
* de: Nicht näher bestimmter Fehler aufgetreten;
über 'null'-Wert signalisieren.
* en: An error occured
without further detailed specification; signal via 'null'-value.
*/
return
null
;
}
}}
xxx
Dokument |
Inhalt |
Dieser
Leitfaden enthält die notwendigen Tätigkeiten für
die Entwicklung eines StartFrame (auch als Command-Center
bekannt). |