Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02


oracle.jbo
Interface JboContext

All Superinterfaces:
javax.naming.Context
All Known Implementing Classes:
JboInitialContext

public interface JboContext
extends javax.naming.Context

Defines additional properties (or environment variables) for the initial context. The following table describes the properties, their possible values, and the platforms for which they are required.

Context Property Description Required on Platforms
DEPLOY_PLATFORM Platform to which an Application Module is deployed. One of PLATFORM_LOCAL, PLATFORM_VB, PLATFORM_EJB, or PLATFORM_ORACLE8I. ALL
INITIAL_CONTEXT_FACTORY Must be JBO_CONTEXT_FACTORY. ALL
HOST_NAME Host on which the Application Module server is deployed. Required on Visibroker for USE_BIND mode only. Oracle8i,
Visibroker
CONNECTION_PORT Port  number where the ORB listens for IIOP requests Oracle8i
CONNECTION_MODE Specifies how to connect to Application Module server. Clients can connect to an Application Module server started on a remote host (USE_BIND mode), find the server using the Visibroker naming service (REMOTE mode), or load the server in the client's VM (COLOCATED mode). Visibroker
ORACLE_SID Oracle8i  service ID to identify the ORB service. Oracle8i
APPLICATION_PATH JNDI path under which an Application Module is registered. Full path under which an Application Module is published. Oracle8i
USE_APPLET Must be used whenever the client is an applet. Visibroker, Oracle8
SECURITY_PRINCIPAL User name. Required for connecting to an Application Module deployed as CORBA server or an EJB session bean. Oracle8i
SECURITY_CREDENTIALS Password. Required for connecting to an Application Module deployed as CORBA server or an EJB session bean. Oracle8i

Using the Context Properties

You first create a hashtable to store the properties:

 static Hashtable env = new Hashtable(10);
 

Your code must also include a definition of the Application Module home:

 static ApplicationModuleHome mHome ;
 

You must include code to connect to the database. Then set the properties for deploying.

Setting Properties for Deploying Locally

The following code snippet illustrates how to set the properties to run an Application Module deployed locally.

  // Component running locally
     {
     public static void setLocalEnv()  {
     env.put(JboContext.INITIAL_CONTEXT_FACTORY,
                        JboContext.JBO_CONTEXT_FACTORY);
     env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
     }
   }
 

Setting Properties for Deploying on Oracle8i as a CORBA Server Object

The following code snippet illustrates how to set the properties for loading an Application Module deployed on Oracle8i as a CORBA object.

 // Component deployed to Oracle8i CORBA Server.
 // Set up the 8i environment
    public static void set8iEnv()   {
    env.put(JboContext.INITIAL_CONTEXT_FACTORY,
                      JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_ORACLE8I);
    env.put(JboContext.SECURITY_PRINCIPAL, "scott");
    env.put(JboContext.SECURITY_CREDENTIALS, "tiger");
    env.put(JboContext.HOST_NAME, "localhost");
    env.put(JboContext.CONNECTION_PORT, "2481");
    env.put(JboContext.ORACLE_SID, "ORA815");
    env.put(JboContext.APPLICATION_PATH, "test");
  }
 

Setting the Environment for Deploying on Oracle8i as an EJB

The following code snippet illustrates how to use the properties to set the environment for loading an Application Module deployed on Oracle8i as an EJB.

  // Component deployed to Oracle8i as EJB.
  // Set up the 8i environment
     public static void set8iEnv()  {
     env.put(JboContext.INITIAL_CONTEXT_FACTORY,
                       JboContext.JBO_CONTEXT_FACTORY);
     env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_EJB);
     env.put(JboContext.SECURITY_PRINCIPAL, "scott");
     env.put(JboContext.SECURITY_CREDENTIALS, "tiger");
     env.put(JboContext.HOST_NAME, "localhost");
     env.put(JboContext.CONNECTION_PORT, "2481");
     env.put(JboContext.ORACLE_SID, "ORA815");
     env.put(JboContext.APPLICATION_PATH, "test");
  }
 

Setting the Environment for Visibroker Servers

For examples of setting the environment for Visibroker Servers, see ConnectionModeConstants

Setting the Initial Context and Loading the Application Module

The following code snippet illustrates creating an initial context for the environment and creating the Application Module d2e.D2eModule in the database. This Application Module was created at design time.

 // Load the Application Module
    ApplicationModule appMod = null;
      try
        {
          Context ic = new InitialContext(env);
          String theAMDefname="d2e_D2eModule";
          ApplicationModuleHome home =
                              (ApplicationModuleHome)ic.lookup(theAMDefName);
          ApplicationModule appMod = home.create();
          appMod.getTransaction().connect("jdbc:oracle:thin:scott/tiger@pc3:1521:ORCL");
          return appMod;
        }
        catch(Exception e) {
      e.printStackTrace();
   }
 
See Also:
Context

Field Summary
static java.lang.String APPLICATION_PACKAGES
Reserved for future use.
static java.lang.String APPLICATION_PATH
JNDI path under which an Application Module is registered.
static java.lang.String CONNECTION_MODE
Specifies how to connect to Application Module server.
static java.lang.String CONNECTION_PORT
Port number where the ORB listens for IIOP requests.
static java.lang.String DEPLOY_PLATFORM
Platform to which an Application Module is deployed.
static java.lang.String HOST_NAME
Host on which the Application Module server is started.
static java.lang.String JBO_CONTEXT_FACTORY
static java.lang.String JBO_PROJECT
Used to pass the Project substitution name for Oracle8i.
static java.lang.String ORACLE_SID
Oracle8i CORBA Server service ID to identify the ORB service.
static java.lang.String PLATFORM_COLO
Colocated platform.
static java.lang.String PLATFORM_EJB
EJB on the Oracle8i platform.
static java.lang.String PLATFORM_EJB_IAS
Oracle Application Server platform.
static java.lang.String PLATFORM_LOCAL
Local platform.
static java.lang.String PLATFORM_ORACLE8I
Oracle8i platform.
static java.lang.String PLATFORM_VB
Visibroker platform.
static java.lang.String PLATFORM_WLS
EJB on the Oracle Application Server platform.
static java.lang.String USE_APPLET
Must be used whenever the client is an applet.
static java.lang.String USE_DEFAULT_CONTEXT

Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES

Methods inherited from interface javax.naming.Context
addToEnvironment, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind

Field Detail

DEPLOY_PLATFORM

public static final java.lang.String DEPLOY_PLATFORM
Platform to which an Application Module is deployed. One of PLATFORM_VB, PLATFORM_LOCAL, or PLATFORM_ORACLE8I.

Required for all platforms.

See Also:
Constant Field Values

HOST_NAME

public static final java.lang.String HOST_NAME
Host on which the Application Module server is started.

Required on Visibroker for USE_BIND mode only. Also required for PLATFORM_ORACLE8I.

See Also:
Constant Field Values

CONNECTION_PORT

public static final java.lang.String CONNECTION_PORT
Port number where the ORB listens for IIOP requests.

Required for PLATFORM_ORACLE8I.

See Also:
Constant Field Values

CONNECTION_MODE

public static final java.lang.String CONNECTION_MODE
Specifies how to connect to Application Module server. Clients can connect to an Application Module server started on a remote host (USE_BIND mode), find the server using the Visibroker naming service (REMOTE mode), or load the server in the client's VM (COLOCATED mode).

Required for PLATFORM_VB.

See Also:
Constant Field Values

ORACLE_SID

public static final java.lang.String ORACLE_SID
Oracle8i CORBA Server service ID to identify the ORB service.

Required for PLATFORM_ORACLE8I.

See Also:
Constant Field Values

APPLICATION_PATH

public static final java.lang.String APPLICATION_PATH
JNDI path under which an Application Module is registered. Full path under which an Application Module is published.

Required for PLATFORM_VB.

See Also:
Constant Field Values

PLATFORM_VB

public static final java.lang.String PLATFORM_VB
Visibroker platform.
See Also:
Constant Field Values

PLATFORM_LOCAL

public static final java.lang.String PLATFORM_LOCAL
Local platform.
See Also:
Constant Field Values

PLATFORM_COLO

public static final java.lang.String PLATFORM_COLO
Colocated platform.
See Also:
Constant Field Values

PLATFORM_EJB_IAS

public static final java.lang.String PLATFORM_EJB_IAS
Oracle Application Server platform.
See Also:
Constant Field Values

PLATFORM_ORACLE8I

public static final java.lang.String PLATFORM_ORACLE8I
Oracle8i platform.
See Also:
Constant Field Values

PLATFORM_EJB

public static final java.lang.String PLATFORM_EJB
EJB on the Oracle8i platform.
See Also:
Constant Field Values

PLATFORM_WLS

public static final java.lang.String PLATFORM_WLS
EJB on the Oracle Application Server platform.
See Also:
Constant Field Values

JBO_CONTEXT_FACTORY

public static final java.lang.String JBO_CONTEXT_FACTORY

APPLICATION_PACKAGES

public static final java.lang.String APPLICATION_PACKAGES
Reserved for future use.
See Also:
Constant Field Values

USE_APPLET

public static final java.lang.String USE_APPLET
Must be used whenever the client is an applet.

Required for PLATFORM_ORACLE8I and PLATFORM_VB.

See Also:
Constant Field Values

JBO_PROJECT

public static final java.lang.String JBO_PROJECT
Used to pass the Project substitution name for Oracle8i.
See Also:
Constant Field Values

USE_DEFAULT_CONTEXT

public static final java.lang.String USE_DEFAULT_CONTEXT
See Also:
Constant Field Values

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02


Copyright © 1997, 2005, Oracle. All rights reserved.