[Previous] [Contents] [Next] [IONA Technologies]


Chapter 11
Registration and Activation of Servers


Contents

11.1 The Implementation Repository
11.2 Activation Modes
11.2.1 Primary Activation Modes
11.2.2 Secondary Activation Modes
11.2.3 Further Registration Options
11.2.4 Implementation Repository Entries
11.3 The OrbixWeb putit Utility for Server Registration
11.3.1 Examples of using putit
11.3.2 Using the Orbix putit Utility for OrbixWeb Server Registration
11.4 Additional Registration Commands
11.5 Further Mode Options: Activation and Pattern Matching
11.6 Persistent Servers and impl_is_ready()
11.7 Unregistered Servers
11.8 Activation Issues Specific to IIOP Servers
11.8.1 Comparison of IIOP Servers with Orbix Protocol Servers
11.9 Security Issues for OrbixWeb Servers
11.9.1 Identity of the Caller of an Operation
11.9.2 Security of Servers
11.9.3 UNIX: Effective uid/gid of Launched Servers
11.10 Activation and Concurrency
11.11 Activation Information for Servers
11.12 IDL Interface to the Implementation Repository



This chapter describes the Implementation Repository, the component of OrbixWeb that maintains registration information about servers and controls their activation. The Implementation Repository is implemented in the OrbixWeb daemon. The OrbixWeb daemon and utilities provide a superset of the functionality supported by a standard, non-Java Orbix installation.

In this chapter we will outline the full functionality supported by the OrbixWeb Implementation Repository. We will describe aspects of registration and activation which affect servers which communicate over either the CORBA Internet Inter-ORB Protocol (IIOP) or the Orbix protocol. We will also discuss aspects of server activation which are specific to IIOP servers; these servers only need to be registered in the Implementation Repository under specific circumstances, and this can be advantageous in a Java environment.

11.1 The Implementation Repository

The OrbixWeb Implementation Repository maintains a mapping from a server's name to the Java bytecode of the class which implements that server. A server must be registered with the Implementation Repository to make use of this mapping.

If the server is not running, it will be automatically launched by OrbixWeb when a client binds to one of the server's objects, or when a client invokes an operation on an object reference which names that server. The OrbixWeb daemon launches a Java server by invoking the Java interpreter on the bytecode specified in an Implementation Repository entry.

To allow the daemon to correctly locate and invoke the Java interpreter, it is important that the values IT_JAVA_INTERPRETER and IT_DEFAULT_CLASSPATH are assigned correctly in the OrbixWeb configuration file, Orbix.cfg. The configuration of these values is described in Chapter 3, "OrbixWeb Configuration" of the OrbixWeb Reference Guide.

Whenever a client first communicates with an object, OrbixWeb uses the Implementation Repository to identify an appropriate server to handle the connection. This search can occur in the following circumstances:

If a suitable entry cannot be found in the Implementation Repository during a search for a server, then a system exception is returned to the caller.

11.2 Activation Modes

OrbixWeb provides a number of different mechanisms, or modes, for launching servers, giving the programmer control over how servers are implemented as processes by the underlying operating system. The mode of a server is specified when it is being registered.

11.2.1 Primary Activation Modes

The following primary activation modes are supported.

Shared Activation Mode

Unshared Activation Mode

Per-method Call Activation Mode

11.2.2 Secondary Activation Modes

For each one of these modes, a server can also be launched in one of the following secondary activation modes.

Per-client

Per-client-process

Multiple-client

11.2.3 Further Registration Options

If a server is registered in the shared mode, then it can be launched manually prior to any invocations on its objects. Subsequent invocations will be passed to the process. (CORBA uses the term persistent server to refer to a process launched manually in this way.)2

Launching servers in this way is useful for a number of reasons. Some servers take considerable time to initialise themselves, and therefore it is sensible to launch such servers before any client wishes to use them. Also, during development, it may be clearer to launch a server in its own window, allowing its diagnostic messages to be more easily seen.

Manually launched servers, once they have called impl_is_ready(), behave in a similar way to shared activation mode servers. If a server is registered as unshared or per-method, then, in line with the CORBA specification, impl_is_ready() will fail if the server is launched manually (see section 11.6).

A shared server may be registered such that it may only be launched manually–that is, OrbixWeb will not launch the server when an operation invocation arrives for one of its objects. This is explained in section 11.7.

Usually, clients are not concerned with the activation details of a server or aware of what server processes are launched. To a client, a server is viewed as a single unit; an object in a server can be bound to and communicated with without considering activation mode details.

Although servers are registered in the Implementation Repository, individual objects do not need to be registered. Only those objects for which OrbixWeb should launch a process (if an appropriate process is not already running) should be registered.

11.2.4 Implementation Repository Entries

The Implementation Repository maintains its data in Implementation Repository entries. An entry for a server in an Implementation Repository includes the following information:

The putit command creates an Implementation Repository entry, if no entry exists for the server specified. If an Implementation Repository entry exists for the server, the putit command creates or modifies an activation order within the existing entry. In the latter case, the putit command must specify the same fundamental activation mode (shared, unshared or per-method) as already registered for the server.

11.3 The OrbixWeb putit Utility for Server Registration

The putit utility registers servers with OrbixWeb–specifically with the Implementation Repository.

Here, we will give some examples of common uses of putit. A full description of putit and its switches is given in Chapter 1, "The OrbixWeb Utilities" of the OrbixWeb Reference Guide.

The putit command is mostly used in one of the following forms:

The -java switch is an extension over the standard Orbix putit command, and indicates that the specified server should be launched via the Java interpreter. This switch can be truncated to -j.

The first of the above command forms indicates that the server is to be registered with the specified complete class path, independent of any configuration settings, and with the specified class name. The second indicates that the specified class path should be appended to the value of IT_DEFAULT_CLASSPATH in the Orbix.cfg file, when the daemon attempts to launch the server.

By default, putit uses the shared activation mode: therefore, on any given host, all objects with the specified server name will be controlled by the same process. Also by default, putit registers a server in the multiple-client activation mode: that is, all client processes will bind to the same server process.

For example:

The class idl_demo.BankServer (with partial class path /usr:/users/chris/banker) will be registered as the implementation code of the server called BankSrv at the current host. The putit command does not launch the server: this can be done explicitly from the shell (or otherwise), or it will be automatically launched in shared mode by OrbixWeb in response to an incoming operation invocation.

Server names may be hierarchically structured, in the same way as UNIX file names. For example:

Hierarchical server names are useful in structuring the name space of servers in Implementation Repositories. The hierarchical structure can be created using the mkdirit command, as described in Chapter 1, "The OrbixWeb Utilities", of the OrbixWeb Reference Guide.

11.3.1 Examples of using putit

The following examples illustrate some further switches to putit. Full details of the available switches to putit are given in Chapter 1, "The OrbixWeb Utilities" of the OrbixWeb Reference Guide.

11.3.2 Using the Orbix putit Utility for OrbixWeb Server Registration

The standard Orbix daemon process is not currently Java-aware, with the consequence that it is incapable of directly invoking the Java interpreter on an OrbixWeb server class. However, this functionality can be imitated using an intermediate executable file which the daemon can launch and which can, in turn, invoke the Java interpreter.

A simple program which supports this is supplied with OrbixWeb; this program is called jrunit and is installed by default in the OrbixWeb bin directory. By using jrunit, an Orbix programmer can register an OrbixWeb server in the Orbix Implementation Repository.

To register an OrbixWeb server in the Orbix Implementation Repository, the Orbix putit command (which currently does not support the -java switch) should be used as follows:

The commandLineArgs value simply specifies parameters to be passed to the server main() method, if any.

The following Orbix putit command:

is equivalent to the OrbixWeb putit command:

Note that, if the jrunit command specified in the server launch command is not prefixed by a full path name, then the location of jrunit should be in the environment path setting, as passed to the Orbix daemon at start-up.

11.4 Additional Registration Commands

Implementation Repository entries created by putit can be managed using the following commands. Executing any command without arguments gives a summary of its switches

catit

Outputs full information about a given Implementation Repository entry.

chmodit

Allows launch and invoke rights on a server to be granted to users other than the server owner.

chownit

Allows the ownership of Implementation Repository entries and directories to be changed.

killit

Kills a running server process.

lsit

Lists a specific entry or all entries.

mkdirit

Creates a new registration directory. (The Implementation Repository may be structured hierarchically in a way that is analogous to UNIX file names.)

pingit

Pings the OrbixWeb daemon to determine whether it is alive.

psit

Outputs a list of server processes known to the OrbixWeb daemon.

rmdirit

Removes a registration directory.

rmit

Removes an Implementation Repository entry or modifies an entry.

11.5 Further Mode Options: Activation and Pattern Matching

Recall from Chapter 7, "Publishing Object References in Servers", that a server programmer may choose the marker names for objects. Alternatively, they can be assigned automatically by OrbixWeb.

Since objects can be named, the various activation policies can be instructed to use pattern matching when seeking to identify which server process to communicate with. In particular, when a server is registered, it is possible to specify that it should be launched if any of a set of its objects are invoked. This set of objects is specified by registering a marker pattern which uses wildcard characters. If no pattern is specified, invoking on any of a server's objects will cause the server to be launched (if it is not already launched).

Patterns may also be specified for methods so that operation names matching a particular pattern will cause a particular server to be launched.

11.6 Persistent Servers and impl_is_ready()

A persistent server should ensure that the server name is correctly set before it has any interaction with OrbixWeb. For example, a persistent server should not pass out an object reference for one of its objects (as a parameter or return value, or even by printing its object reference string) until the server name has been set.3 Normally, the server name is set by calling impl_is_ready(). Alternatively, the server name can be set using the method ORB.setServerName(), which can be invoked on the _CORBA.Orbix object.

Other interactions with OrbixWeb such as calling an operation on a remote object, or using the locator, also cause difficulties if they occur in a persistent server before impl_is_ready() is called.

Persistent servers, once they have called impl_is_ready() behave as shared activation mode servers. In line with the CORBA specification, if a server is registered as unshared or per-method, then impl_is_ready() will fail if the server is launched manually.

11.7 Unregistered Servers

In some circumstances, it may be useful not to register servers with the Implementation Repository. To support this, the OrbixWeb daemon may be configured to allow unregistered servers using the -u switch (see Chapter 3, "OrbixWeb Configuration" of the OrbixWeb Reference Guide). Any server process can then be started manually; when it calls impl_is_ready(), it can pass any string as its server name, and the daemon will not check that this is a server name known to it.

A disadvantage of this approach is that an unregistered server will not be known to the daemon so the daemon will not be able to automatically invoke the Java interpreter on the server bytecode when a client binds to or invokes an operation on one of its objects. The server must be launched in advance of a client invocation, if that invocation is to succeed.

In a Java context, a more significant disadvantage of this approach is that the OrbixWeb daemon is involved in initial communications between the client and server, even though the server is not registered in the Implementation Repository. This restriction applies to all OrbixWeb servers which communicate over the standard Orbix communications protocol and limits such servers to running on hosts where an Orbix or OrbixWeb daemon process is available.

11.8 Activation Issues Specific to IIOP Servers

OrbixWeb servers which communicate over IIOP do not need to be registered in the Implementation Repository. As described in Chapter 9, "ORB Interoperability", an IIOP server can publish Interoperable Object References (IORs) for the implementation objects it creates and then awaits incoming client requests on those objects without contacting an OrbixWeb daemon.

Unregistered IIOP servers are important in a Java domain, as they can be completely independent of any supporting processes which may be platform specific. In particular, any server which relies on the OrbixWeb daemon to establish initial connections will depend on the availability of the daemon on specific platforms. An OrbixWeb unregistered IIOP server is completely self-contained and platform independent.

However, an IIOP server suffers from an important disadvantage. The TCP/IP port number on which a server communicates is embedded in each IOR that a server creates. If the port is dynamically allocated to a server process on start-up, then the port may differ between different processes for a single server. This may invalidate IORs created by a server if, for example, the server is killed and relaunched. OrbixWeb addresses this problem by allowing IIOP server programmers to assign a well-known IIOP port number to the server.

These issues are discussed in detail in Chapter 9, "ORB Interoperability".

11.8.1 Comparison of IIOP Servers with Orbix Protocol Servers

OrbixWeb supports servers which communicate over IIOP and servers which communicate over the standard Orbix protocol4. In each case, a server may or may not be registered in the OrbixWeb Implementation Repository. The combination of a server's communications protocol and its registration characteristics has important implications for the deployment of the server in a Java environment.

All Orbix protocol servers require an Orbix or OrbixWeb daemon process to establish client-server communications. As the OrbixWeb daemon is not currently implemented in Java, these servers cannot be deployed in a completely platform-independent manner.

Servers which communicate using IIOP and which are not registered in the Implementation Repository require no contact with a daemon in order to communicate with clients (although a which uses the _bind() method to contact an IOR will need to contact the daemon). These servers do not rely on any non-Java applications and can be deployed on any platform supported by Java. They can also maintain consistent IORs between server processes, if configured correctly. However, these servers must be launched manually.

Servers which communicate using IIOP and which are registered in the Implementation Repository are dependent on the availability of an Orbix or OrbixWeb daemon at the server host. These servers cannot be deployed independently of the platforms supported by the daemon. However, they combine an ability to interoperate with applications implemented using other ORBs, with an ability to be launched automatically and an ability to maintain consistent IORs between server processes.

11.9 Security Issues for OrbixWeb Servers

The following subsections cover issues concerned with security for OrbixWeb servers.

11.9.1 Identity of the Caller of an Operation

A server object can obtain the user name of the process that made the current operation call by using the method get_principal() on the _CORBA.Orbix object. This method is listed in class BOA as follows:

The parameter of type _ObjectRef is not used, but it is supported for compatibility with CORBA.

11.9.2 Security of Servers

For each Implementation Repository entry, OrbixWeb maintains two access control lists as follows:

Launch

The users or groups that can launch the associated server (users on this list, and users in groups on this list, can cause the server to be launched by invoking on one of its objects; also, only these users and groups can call impl_is_ready() with the Implementation Repository entry's server name).

Invoke

The users and groups that can invoke operations on any object controlled by the associated server.

The entries in the access control list can be either user names or group names. There is also a pseudo group name called all, which can be used to implicitly add all users to an access control list. The owner of an Implementation Repository entry is always allowed to launch it and invoke operations on its objects.

The chmodit command can be used to modify the two access control lists.

The group system is determined by the underlying operating system. For example, on UNIX, group membership of a user is determined using the user's primary group as well as the user's supplementary groups (as specified in the /etc/group file).

Only the owner of an Implementation Repository entry can call the chmodit command on it. The original owner is the user who calls the putit command; subsequently, the ownership can be changed using the chownit command.

11.9.3 UNIX: Effective uid/gid of Launched Servers

On UNIX, the effective uid and gid of a server process launched by the OrbixWeb daemon are determined as follows:

    1. If orbixd is not running as the root (super-) user, then the uid and gid of every activated server process will be that of orbixd itself.
    2. If orbixd is run as root, then it will attempt to activate a server with the uid and gid of the, possibly remote, principal attempting to activate the server.
    If the principal is unknown (that is, is not a registered user) at the local machine on which orbixd is running, then, orbixd will attempt to run the new server with uid and gid of a standard user "orbixusr".
    3. If there is no such standard user "orbixusr", then orbixd will attempt to run the new server with uid and gid of a user "nobody".
    If there is no such user "nobody", then the activation will fail and an exception will be returned to the caller.
You are recommended not to run orbixd as root because to do so would allow a client running as root on a remote machine to launch a server with root privileges on a different machine. This security risk can be avoided by setting the set-uid bit of the orbixd executable and giving ownership of the executable to a user called, say, orbixusr that does not have root privileges. Then orbixd, and any server launched by the daemon, will not have root privileges. Any servers that must be run with different privileges can have the set-uid bit set on the executable file.

11.10 Activation and Concurrency

It should be noted that in the per-method activation mode or when the secondary activation modes per-client and per-client-process are used, there is no built-in concurrency control between the different processes created to handle operation invocations on a given object. Each resulting process must co-ordinate its actions as required.

11.11 Activation Information for Servers

A server can determine a number of details about how and why it was launched. It can determine how it was launched: whether shared, unshared, per-method or persistently. It can also determine the marker name of the object that caused the server to be launched; the name of the method called on that object; and also its own server name.

In a server, this information can be found by invoking the following methods–defined in class BOA–on the _CORBA.Orbix object:

Each of these methods raises an exception if called by a client.

11.12 IDL Interface to the Implementation Repository

The interface to the Implementation Repository is defined in IDL and implemented by the OrbixWeb daemon. This interface is called IT_daemon and its operations are explained in the OrbixWeb Reference Guide.

Note that the UNIX utilities (putit, catit, and so on) and the Orbix Server Manager (available under Windows 95 and Windows NT) are implemented in terms of the daemon's IDL interface.



1 The method ORB.pingDuringBind() (defined in package IE.Iona.Orbix2.CORBA) can be called on the _CORBA.Orbix object (defined in package IE.Iona.Orbix2) to configure this.



2 The OMG CORBA term "persistent server" is not ideal, since it leads to some confusion with the notion of persistent (long lived, on disk) objects. The term "manual server" is preferable.



3 The implementation of impl_is_ready() will insert the correct server name into the object names of the server's objects, but it cannot do so for any object references that have already been passed out of the address space.



4 Servers which communicate over both protocols are also supported, and can be considered as Orbix protocol servers for the purposes of this discussion.



[Roadmap] [Introduction] [GS: Applications] [GS: Applets]
[IDL] [Mapping] [Programming OrbixWeb] [Publishing Objects] [Retrieving Objects] [IIOP]
[Running Clients] [Running Servers] [Exceptions] [Inheritance] [Callbacks] [Contexts]
[API Configuration] [TypeCode] [Any] [DII] [IR] [Filters] [Smart Proxies] [Loaders] [Locators]
[Index]