Oracle8i Enterprise JavaBeans and CORBA Developer's Guide
Release 8.1.5

A64683-01

Library

Product

Contents

Index

Prev  Chap Top Next

Session Namespace Tools

Each database instance running the Oracle8 i JServer software has a session namespace, which the Oracle8 i ORB uses to activate CORBA and EJB objects. A session namespace is a hierarchical collection of objects known as PublishedObjects and PublishingContexts. PublishedObjects are the leaves of the hierarchy and PublishingContexts are the nodes, analogous to Unix file system files and directories. Each PublishedObject is associated with a class schema object that represents a CORBA or EJB implementation. To activate a CORBA or EJB object, a client refers to a PublishedObject's name. From the PublishedObject, the Oracle8 i ORB obtains the information necessary to find and launch the corresponding class schema object.

Creating a PublishedObject is known as publishing and can be done with the command-line publish tool or the interactive session shell, both of which this section describes. CORBA server developers create PublishedObjects explicitly after loading the implementation of an object with loadjava. EJB developers do not explicitly load or publish their implementations; the deployejb tool (see "deployejb") implicitly does both.

A PublishedObject has the following attributes:

PublishedObjects and PublishingContexts, like their file and directory counterparts, have owners and rights (privileges). An owner can be a user name or a role name; only the owner can change the ownership or rights of a PublishedObject or PublishingContext. Table 6-4 describes session namespace rights.

Table 6-4 PublishingContext and PublishedObject Rights
Right  Meaning for PublishingContext  Meaning for PublishedObject 

read  

List contents and attributes (type, rights and creation time).  

List object attributes (type, schema object, schema, helper, rights, and creation time).  

write  

Create a PublishedObject or PublishingContext in the PublishingContext.  

Republish object.  

execute  

Use contents to resolve a name.  

Activate associated class.  

Oracle8 i creates a session namespace automatically when the Oracle8 i ORB is configured. The PublishingContexts contained in Table 6-5 are present in all session namespaces:

Table 6-5 Initial PublishingContexts and Rights
Name  Owner  Read  Write  Execute 

/  

SYS  

PUBLIC  

SYS  

PUBLIC  

/bin  

SYS  

PUBLIC  

SYS  

PUBLIC  

/etc  

SYS  

PUBLIC  

SYS  

PUBLIC  

/test  

SYS  

PUBLIC  

PUBLIC  

PUBLIC  

Because by default only /test is writable by PUBLIC, you will normally create PublishingContexts and PublishedObjects subordinate to /test.

publish

The publish tool creates or replaces (republishes) a PublishedObject in a PublishingContext. It is not necessary to republish when you update a Java class schema object; republishing is required only to change a PublishedObject's attributes. To publish, you must have write permission (the write right) for the destination PublishingContext; by default only the PublishingContext /test is writable by PUBLIC. To republish you must additionally have the write right for the PublishedObject.

Syntax

publish <name> <class> [<helper>] -user <username> -password <password>
-service <serviceURL> [options]
  [-describe] 
  [{-g | -grant} {<user> | <role>}[,{<user> | <role>}]...]
  [{-h | -help}] 
  [-iiop]
  [-role <role>] 
  [-republish]
  [-schema <schema>]
  [-ssl]
  [-version] 

Argument Summary

Table 6-6 summarizes the publish tool arguments.

Table 6-6 publish Tool Argument Summary
Option  Description 

<name>  

Name of the PublishedObject being created or republished; PublishingContexts are created if necessary.  

<class>  

Name of the class schema object that corresponds to <name>.  

<helper>  

Name of the Java class schema object that implements the narrow() method for <class>.  

-user  

Specifies identity with which to log into the database instance named in -service.  

-password  

Specifies authenticating password for the username specified with -user.  

-service  

URL identifying database whose session namespace is to be "opened" by sess_sh. The serviceURL has the form:

sess_iiop://<host>:<lport>:<sid>. 

<host> is the computer that hosts the target database; <lport> is the listener port that has been configured to listen for session IIOP; <sid> is the database instance identifier. Example:

sess_iiop://localhost:2481:orcl

which matches the default installation on the invoker's machine.  

-describe  

Summarizes the tool's operation, then exits.  

-grant  

After creating or republishing the PublishedObject, grants read and execute rights to the sequence of <user> and <role> names. When republishing, replace the existing users/roles that have read/execute rights with the <user> and <role> names. To selectively change the rights of a PublishedObject, use the sess_sh's chmod command. Note that to activate a CORBA object or EJB, a user must have the execute right for both the PublishedObject and the corresponding class schema object.  

-help  

Summarizes the tool's syntax, then exits.  

-iiop  

Connects to the target database with IIOP instead of the default session IIOP. Use this option when publishing to a database server that has been configured without session IIOP.  

-role  

Role to assume for the publish; no default.  

-republish  

Directs publish to replace an existing PublishedObject; without this option, the publish tool rejects an attempt to publish an existing name. If the PublishedObject does not exist, publish creates it. Republishing deletes non-owner rights; use the -grant option to add read/execute rights when republishing.  

-schema  

The schema containing the Java <class> schema object. If you do not specify, the publish tool uses the invoker's schema.  

-ssl  

Connects to the database with SSL server authentication. You must have configured the database for SSL to use this option, and you must specify an SSL listener port in -service.  

-version  

Shows the tool's version, then exist.  

Here is a publish example.

Publish the CORBA server implementation vbjBankTestbank.AccountManagerImpl and its helper class as /test/bankMgr in the tool invoker's schema:

publish /test/bankMgr vbjBankTestServer.AccountManagerImpl \ 
vbjBankTestServer.AccountManagerHelper \
-user SCOTT -password TIGER \ 
-service sess_iiop://dlsun164:2481:orcl 

remove

The remove tool removes a PublishedObject or PublishingContext from a session namespace. It does not remove the Java class schema object associated with a PublishedObject; use dropjava to do that.

Syntax

remove <name> -user <username> -password <password> -service <serviceURL> 
[options]
  [{-d | -describe}]
  [{-h | -help}]
  [-iiop]
  [{-r | -recurse}]
  [-role role]
  [-ssl]
  [-version]

Argument Summary

Table 6-7 describes the remove arguments.

Table 6-7 remove Argument Summary
Option  Description 

<name>  

Name of PublishingContext or PublishedObject to be removed.  

-user  

Specifies identity with which to log into the instance named in -service.  

-password  

Specifies authenticating password for the <username> you specified with -user.  

-service  

URL identifying database whose session namespace is to be "opened" by sess_sh. The serviceURL has the form:

sess_iiop://<host>:<lport>:<sid>. 

<host> is the computer that hosts the target database; <lport> is the listener port that has been configured to listen for session IIOP; <sid> is the database instance identifier. Example:

sess_iiop://localhost:2481:orcl

which matches the default installation on the invoker's machine.  

-describe  

Summarizes the tool's operation, then exits.  

-help  

Summarizes the tool's syntax, then exits.  

-iiop  

Connects to the target database with IIOP instead of the default session IIOP. Use this option when removing from a database server that has been configured without session IIOP.  

-recurse  

Recursively removes <name> and all subordinate PublishingContexts; required to remove a PublishingContext.  

-role  

Role to assume for the remove; no default.  

-ssl  

Connects to the database with SSL server authentication. You must have configured the database for SSL to use this option.  

-version  

Shows the tool's version, then exits.  

Here are examples of remove tool usage.

sess_sh

The sess_sh (session shell) tool is an interactive interface to a database instance's session namespace. You specify database connection arguments when you start sess_sh. It then presents you with a prompt to indicate that it is ready for commands.

The sess_sh gives a session namespace much of the "look and feel" of a Unix file system you access through a shell, such as the C shell. For example, the session shell command:

ls /alpha/beta/gamma

means "List the PublishedObjects and PublishingContexts in the PublishingContext known as /alpha/beta/gamma". (NT users note: /alpha/beta/gamma, not \alpha\beta\gamma.) Indeed, many session shell command names that operate on PublishingContexts have the same names as their Unix shell counterparts that operate on directories. For example: mkdir (create a PublishingContext) and cd (change the working PublishingContext).

In addition to Unix-style manipulation of PublishingContexts and PublishedObjects, the session shell can launch an executable, which is analogous to a Java standalone application, that is, a class with a static main() method. Executables must have been loaded with loadjava, but not published--publishing is for CORBA and EJB objects only.

Syntax

sess_sh [options] -user <user> -password <password> -service <serviceURL>
  [-d | -describe]
  [-h | -help] 
  [-iiop]
  [-role <rolename>]
  [-ssl]
  [-version]

Argument Summary

Table 6-8 summarizes the sess_sh arguments.

Table 6-8 sess_sh Argument Summary
Option  Description 

-user  

Specifies user's name for connecting to the database.  

-password  

Specifies user's password for connecting to the database.  

-service  

URL identifying database whose session namespace is to be "opened" by sess_sh. The serviceURL has the form:

sess_iiop://<host>:<lport>:<sid>. 

<host> is the computer that hosts the target database; <lport> is the listener port configured to listen for session IIOP; <sid> is the database instance identifier. Example:

sess_iiop://localhost:2481:orcl

which matches the default database installation on the invoker's machine.  

-describe  

Summarizes the tool's operation, then exits.  

-help  

Summarizes the tool's syntax, then exits.  

-iiop  

Connects to the target database with plain IIOP instead of the default session IIOP. Use this option for a database server configured without session IIOP.  

-role  

Role to pass to database; there is no default.  

-ssl  

Connect to the database with SSL server authentication. You must have configured the database for SSL to use this option.  

-version  

Shows the command's version, then exits.  

Here is a sess_sh example.

Open a session shell on the session namespace of the database orcl on listener port 2481 on host dbserver.

sess_sh -user scott -password tiger -service sess_iiop://dbserver:2481:orcl

cd Command

The cd command is analogous to a Unix shell's cd command; it changes the working PublishingContext.

Syntax

cd [path] 

Here is an example.

Change to root PublishingContext:

$ cd /

chmod Command

The chmod command is analogous to a Unix shell's chmod command; it changes the users or roles that have rights for a PublishingContext or PublishedObject. See Table 6-4 for descriptions of the read, write, and execute rights. Only the object's owner can change its rights.

Syntax

chmod  [options] {+|-}{r|w|e} {<user> | <role>} [, {<user> | <role>} ...] \
<objectname>
  [-h | -help] 
  [-version] 
Argument Summary

Table 6-9 summarizes the chmod arguments.

Table 6-9 chmod Argument Summary
Option  Description 

+/-rwe  

Specifies the right (read, write, or execute) to be added (+) or removed (-) for <user> or <role>.  

<user> | <role>  

Specifies the user or role whose rights are to be increased or decreased.  

<objectname>  

Specifies the name of the PublishingContext or PublishedObject whose rights are to be changed.  

-help  

Summarizes the command's syntax, then exits.  

-version  

Shows the command's version, then exits.  

Here are some chmod examples.

chown Command

The chown command is analogous to the Unix chown command; it changes the ownership of a PublishingContext or PublishedObject. The owner of a newly created PublishingContext or PublishedObject is the user who publishes it. To change a PublishingContext's or PublishedObject's ownership you must be SYS.

Syntax

chown [options] {<user> | <role>} <objectname>
  [-h | -help] 
  [-version] 
Argument Summary

Table 6-10 summarizes the chown arguments.

Table 6-10 chown Argument Summary
Option  Description 

<user> | <role>  

Specifies the user or role to be the new owner.  

<objectname>  

Specifies the name of the PublishingContext or PublishedObject whose owner is to be changed.  

-help  

Summarizes the command's syntax, then exits.  

-version  

Shows the command's version, then exits.  

Here is a chown example.

Make Scott the owner of /alpha/beta/gamma:

$ chown scott /alpha/beta/gamma

exit Command

The exit command terminates sess_sh.

Syntax

exit

Here is an example:

Leave the session shell:

$ exit
% 

help Command

The help command summarizes the syntax of the session shell commands.

Syntax

help 

Here is a help example.

$ help
Commands are of the format <command> [arg1, ar2...]
Intrinsic Commands:
    exit           exit the shell
    help           prints this message
    version        print version inforamtion
    pwd            print working directory
    cd             change working directory
    ls             list directory
    ln             link name
    chmod          change read, write or execute permissions on an object
    chown          change an objects owner    
    mkdir          create a directory
    mv             move an object or directory to another location
    rm             remove an object or directory
    lls            list directory on local file system
    lpwd           print local file system working directory
    lcd            change the local file systems working directory
    loadjar        load java classes, source, resources from jar files into the server
    loadfile       load java classes, source, resources from files into the server
    publish        publish an object
    republish      republish an object
    java           execute the "main" method on a java class

java Command

The java command is analogous to the JDK java command; it invokes a class's static main() method. The class must have been loaded with loadjava (see "loadjava"). (There is no point to publishing a class that will be invoked with the java command.) The java command provides a convenient way to test Java code that runs in the database. In particular, the command catches exceptions and redirects the class's standard output and standard error to the session shell, which displays them as with any other command output. (The usual destination of standard out and standard error for Java classes executed in the database is one or more database server process trace files, which are inconvenient and may require DBA priviliges to read.)

Syntax

java class [arg1 ... argn] [options]
  [{-h | -help}] 
  [-schema <schema>]
  [-version] 
Argument Summary

Table 6-11 summarizes the java arguments.

Table 6-11 java Argument Summary
Option  Description 

class  

Names the Java class schema object that is to be executed.  

arg1 ... argn  

Arguments to the class's main() method.  

-help  

Summarizes the command's syntax, then exits.  

-schema  

Names the schema containing the class to be executed; the default is the invoker's schema.  

-version  

Shows the command's version, then exits.  

Here is a java command example.

Say hello and display arguments:

package hello;
public class World {
    public World() {
        super();
    }
    public static void main(String[] argv) {
        System.out.println("Hello from the JServer/ORB");
        if (argv.length != 0)
            System.out.println("You supplied " + argv.length + " arguments: ");
            for (int i = 0; i < argv.length; i++)
                System.out.println(" arg[" + i + "] : " + argv[i]);
    }
}

Compile, load, publish, and run the executable as follows, substituting your userid, host, and port information as appropriate:

% javac hello/World.java
% loadjava -r -user scott/tiger@localhost:2481:orcl hello/World.class
% sess_sh -user scott -password tiger -service sess_iiop://localhost:2481:orcl
$ java testhello alpha beta
Hello from the JServer/ORB
You supplied 2 arguments:
arg[0] : alpha
arg[1] : beta
$

lcd Command

The lcd (local cd) command changes the local working directory just as executing cd outside of the session shell would.

Syntax

lcd [path]

Here is an example of the lcd command.

Change the file system directory to alpha/beta:

$ lcd alpha/beta

lls Command

The lls (local ls) command lists the contents of the working directory, just as executing ls outside of the session shell would.

Syntax

lls 
  [-l] 
  [<path>] 
Argument Summary

Table 6-12 summarizes the lls command's arguments.

Table 6-12 lls Argument Summary
Option  Description 

-l  

Lists the directory in long format.  

<path>  

Lists the directory named in <path>.  

Here is an lls command example.

List the working file system directory in long format:

$ lls -l

ln Command

The ln (link) command is analogous to the Unix ln command. A link is a synonym for a PublishingContext or PublishedObject. A link can prevent a reference to a PublishingContext or PublishedObject from becoming invalid when you move a PublishingContext or PublishedObject (see "mv Command"); creating a link with the old name makes the object accessible by both its old and new names.

Syntax

ln <object> <link>
Argument Summary

Table 6-13 summarizes the ln arguments.

Table 6-13 ln Argument Summary
Option  Description 

<object>  

The name of the PublishingContext or PublishedObject for which a link is to be created.  

<link>  

The synonym by which <object> is also to be known.  

Here is an ln command example.

Preserve access via old although the object's name is changed to new:

$ mv old new
$ ln new old

lpwd Command

The lpwd (local print working directory) command displays the name of the working directory, just as executing pwd outside of the session shell would.

Syntax

lpwd

Here is an example of the lpwd command that shows the working directory:

$ lpwd
/home/usr/billc

ls Command

The ls (list) command shows the contents of PublishingContexts as the Unix ls command shows the contents of directories.

Syntax

ls [options] [{<pubcon> | <pubobj} [{<pubcon> | <pubobj}] ...] 
  [-dir]
  [-h | -help]
  [-l] 
  [-ld | ldir]
  [-R]
  [-version] 
Argument Summary

Table 6-14 describes the ls arguments.

Table 6-14 ls Argument Summary
Option  Description 

<pubcon> | <pubobj>  

Name of PublishingContext(s) and/or PublishingObject(s) to be listed; the default is the working PublishingContext.  

-dir  

Shows only PublishingContexts; analogous to the Unix ls -d command.  

-help  

Summarizes the command's syntax, then exits.  

-l  

Shows contents in long (detailed) format. The long format includes name, creation time, owner, and rights. For PublishedObjects, the option also shows class, schema, and helper.  

-ldir  

Lists PublishingContexts in long format, ignoring PublishingObjects; analogous to Unix ls -ld command.  

-R  

Lists recursively.  

-version  

Shows the command's version, then exits.  

Here are examples of the ls command.

Show contents of the root PublishingContext in short format:

$ ls /
bin/
etc/
test/

Show contents of the root PublishingContext in long format:

$ ls -l /
Read    Write   Exec      Owner   Date   Time   Name      Schema    Class     Helper 
PUBLIC  SYS     PUBLIC    SYS     Dec 14 14:59  bin/ 
PUBLIC  SYS     PUBLIC    SYS     Dec 14 14:59  etc/ 
PUBLIC  PUBLIC  PUBLIC    SYS     Dec 14 14:59  test/ 
    

Show contents of the /test PublishingContext in long format:

$ ls -l test 
Read  Write Exec  Owner Date   Time  Name Schema Class                   Helper 
SCOTT SCOTT SCOTT SCOTT Dec 14 16:32 bank SCOTT  Bank.AccountManagerImpl Bank.AccountManagerHelper 

mkdir Command

The mkdir command is analogous to the Unix shell mkdir command; it creates a PublishingContext. You must have the write right for the target PublishingContext to use mkdir in it.

Syntax

mkdir [options] <name>
 [-path] 
Argument Summary

Table 6-15 describes the mkdir arguments.

Table 6-15 mkdir Argument Summary
Option  Description 

<name>  

Name of PublishingContext to create.  

-path  

Creates intermediate PublishingContexts if they do not exist.  

Here are examples of the mkdir command.

Create a PublishingContext called /test/alpha (/test exists):

mkdir /test/alpha

Create a PublishingContext called /test/alpha/beta/gamma (/test/alpha/beta does not exist):

$ mkdir -path /test/alpha/beta/gamma

mv Command

The mv command is analogous to the Unix shell mv command.

Syntax

mv <old> <new>

Here is an example of the mv command.

Change the name of /test/foo to /test/bar:

$ mv /test/foo /test/bar

publish Command

The publish command creates or replaces (republishes) a PublishedObject in a PublishingContext. It is not necessary to republish when you update a Java class schema object that has been published; republish only to change a PublishedObject's attributes. To publish, you must have the write right for the destination PublishingContext; to republish you must also have the write right for the PublishedObject.

Syntax

publish <name> <class> <helper> [options] 
  [{-e | -executable}] 
  [{-g | -grant} {<user> | <role>}[,{<user> | <role>} ... ]]
  [{-h | -help}] 
  [-republish] 
  [-schema <schema>]
  [-version] 
Argument Summary

Table 6-16 summarizes the publish command arguments.

Table 6-16 publish Command Argument Summary
Option  Description 

<name>  

Name of the PublishedObject being created or republished; PublishingContexts are created if necessary.  

<class>  

Name of the class schema object that corresponds to <name>.  

<helper>  

Name of the Java class schema object that implements the narrow() method for <class>.  

-grant  

After creating or republishing the PublishedObject, grants read and execute rights to the sequence of <user> and <role> names. When republishing, replaces the existing users/roles that have read/execute rights with the <user> and <role> names. To selectively change the rights of a PublishedObject, use the session shell's chmod command. Note that to activate a CORBA object or EJB, a user must have the execute right for both the PublishedObject and the corresponding class schema object.  

-help  

Summarizes the command's syntax, then exits.  

-republish  

Directs publish to replace an existing PublishedObject; without this option, the publish command rejects an attempt to publish an existing name. If the PublishedObject does not exist, it is created. Republishing deletes non-owner rights; use the -grant option to add read/execute rights when republishing.  

-schema  

The schema containing the Java <class> schema object; if you do not specify, the command uses the invoker's schema.  

-version  

Shows the command's version, then exits.  

Here is an example of the publish command.

Publish the CORBA server implementation Bank.AccountManagerImpl and its helper class as /test/bank in the command invoker's schema:

$ ls -l /test
$ publish /test/bank Bank.AccountManagerImpl Bank.AccountManagerHelper 
    
$ ls -l /test 
Read  Write Exec  Owner Date   Time  Name  Schema Class                   Helper 
SCOTT SCOTT SCOTT SCOTT Dec 14 16:32 bank  SCOTT  Bank.AccountManagerImpl Bank.AccountManagerHelper 
    

pwd Command

The pwd command displays the name of the current working PublishingContext. It is analogous to the Unix pwd command.

Syntax

pwd

Here is an example of the pwd command.

$ pwd
/test/alpha

rm Command

The rm (remove) command is analogous to the rm -r Unix shell commands; it removes a PublishedObject or a PublishingContext, including its contents. To remove an object, you must have the write right for the containing PublishingContext.

Syntax

rm [options] <object> ... <object>
  [{-h | -help}] 
  [-r]
  [-version] 
Argument Summary

Table 6-17 describes the rm arguments.

Table 6-17 rm Argument Summary
Option  Description 

<object>  

Name of PublishedObject or PublishingContext to be removed.  

-help  

Summarizes the command's syntax, then exits.  

-r  

Interprets <object> as a PublishingContext; removes it and its contents recursively.  

-version  

Shows the command's version, then exits.  

Here is an example of the rm command.

Remove the PublishedObject /test/bank:

rm /test/bank

Remove the PublishingContext /test/release3 and everything it contains:

rm -r /test/release3

version Command

The version command shows the version of the sess_sh tool.

Syntax

version

Here is an example of the version command.

Display the session shell's version:

$ version
1.0



Prev

Top

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index