Oracle8i CORBA Developer's Guide and Reference Release 3 (8.1.7) Part Number A83722-01 |
|
For all oracle clients, you need to set the following in the environment before creating InitialContext env.put(ServiceCtx.APPLET_CLASS, this);// This referes to the applet class In the HTML file itself, you need to set ORBdisableLocator=true, for all versions. In addition, if you are using JDK 1.2 (i.e, plug in 1.2), then you also need to set the following in the HTML file. <PARAM NAME="org.omg.CORBA.ORBClass" VALUE="com.visigenic.vbroker.orb.ORB"> <PARAM NAME="org.omg.CORBA.ORBSingletonClass" VALUE="com.visigenic.vbroker.orb.O RB"> The syntax slightly differs from plugin to plugin. Look at the example applets in this diretory. Note that you don't need to copy any jars on to the client machine. But if you do wish to copy the jar files to the client machine, also set "ClassLoader" to the appletClassLoader (this.getClass().getClassLoader()) and things will work fine. You also don't need to change any files (like java.security etc.) on the client.
<pre> <html> <title> CORBA Applet talking to 8i</title> <h1> CORBA applet talking to 8i using java plug in 1.1 </h1> <hr> The good old bank example <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 50 codebase="http://java.sun.com/products/plugin/1.1/jinst all-11-win32.cab#Version=1,1,0,0"> <PARAM NAME = CODE VALUE = OracleClientApplet.class > <PARAM NAME = ARCHIVE VALUE = "oracleClient.jar,aurora_client.jar,vbjorb.jar,vbj app.jar" > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1"> <PARAM NAME="ORBdisableLocator" VALUE="true"> <COMMENT> <EMBED type="application/x-java-applet;version=1.1" ORBdisableLocator="true" java_CODE = OracleClientApplet.class java_ARCHIVE = "or acleClient.jar,aurora_client.jar,vbjorb.jar,vbjapp.jar" WIDTH = 500 HEIGHT = 50 pluginspage="http://java.sun.com/products/plugin/1.1/plugin-install.html"> <NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> </center> <hr> </pre>
<pre> <html> <title> CORBA applet talking to 8i</title> <h1> CORBA applet talking to 8i using Java plug in 1.2 </h1> <hr> The good old bank example <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 50 codebase="http://java.sun.com/products/plugin/1.2/jinst all-11-win32.cab#Version=1,1,0,0"> <PARAM NAME = CODE VALUE = OracleClientApplet.class > <PARAM NAME = ARCHIVE VALUE = "oracleClient.jar,aurora_client.jar,vbjorb.jar,vbj app.jar" > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1.2"> <PARAM NAME="ORBdisableLocator" VALUE="true"> <PARAM NAME="org.omg.CORBA.ORBClass" VALUE="com.visigenic.vbroker.orb.ORB"> <PARAM NAME="org.omg.CORBA.ORBSingletonClass" VALUE="com.visigenic.vbroker.orb.O RB"> <COMMENT> <EMBED type="application/x-java-applet;version=1.1.2" ORBdisableLocator="true" org.omg.CORBA.ORBClass="com.visigenic.vbroker.orb.ORB" org.omg.CORBA.ORBSingletonClass="com.visigenic.vbroker.orb.ORB" java_CODE = Orac leClientApplet.class java_ARCHIVE = "oracleClient.jar,aurora_client.jar,vbjorb.j ar,vbjapp.jar" WIDTH = 500 HEIGHT = 50 pluginspage="http://java.sun.com/produc ts/plugin/1.2/plugin-install.html"> <NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> </center> <hr> </pre>
<h1>CORBA applet talking to 8i using JInitiator 1.1.7.18</h1> <COMMENT> <EMBED type="application/x-jinit-applet;version=1.1.7.18" java_CODE="OracleClientApplet" java_CODEBASE="http://mysun:8080/applets/bank" java_ARCHIVE="oracleClient.jar,aurora_client.jar,vbjorb.jar,vbjapp.jar" WIDTH=400 HEIGHT=100 ORBdisableLocator="true" org.omg.CORBA.ORBClass="com.visigenic.vbroker.orb.ORB" org.omg.CORBA.ORBSingletonClass="com.visigenic.vbroker.orb.ORB" serverHost="mysun" serverPort=8080 <NOEMBED> </COMMENT> </NOEMBED> </EMBED>
// ClientApplet.java import java.awt.*; import oracle.aurora.jndi.sess_iiop.ServiceCtx; import javax.naming.Context; import javax.naming.InitialContext; import java.util.Hashtable; import Bank.*; public class OracleClientApplet extends java.applet.Applet { private TextField _nameField, _balanceField; private Button _checkBalance; private Bank.AccountManager _manager; public void init() { // This GUI uses a 2 by 2 grid of widgets. setLayout(new GridLayout(2, 2, 5, 5)); // Add the four widgets. add(new Label("Account Name")); add(_nameField = new TextField()); add(_checkBalance = new Button("Check Balance")); add(_balanceField = new TextField()); // make the balance text field non-editable. _balanceField.setEditable(false); try { String serviceURL = "sess_iiop://mysun:2222"; String objectName = "/test/myBank"; // Initialize the ORB (using the Applet). Hashtable env = new Hashtable(); env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi"); env.put(Context.SECURITY_PRINCIPAL, "scott"); env.put(Context.SECURITY_CREDENTIALS, "tiger"); env.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN); env.put(ServiceCtx.APPLET_CLASS, this); Context ic = new InitialContext(env); _manager = (AccountManager)ic.lookup (serviceURL + objectName); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); throw new RuntimeException(); } } public boolean action(Event ev, Object arg) { if(ev.target == _checkBalance) { // Request the account manager to open a named account. // Get the account name from the name text widget. Bank.Account account = _manager.open(_nameField.getText()); // Set the balance text widget to the account's balance. _balanceField.setText(Float.toString(account.balance())); return true; } return false; } }
|
Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|