<refmiscinfo class="copyright"> Copyright 2001 Sun Microsystems, Inc. All rights reserved. Copyright 2001 Sun Microsystems, Inc. Tous droits réservés. </refmiscinfo>
</refmeta>
<refnamediv><refname>rmid</refname><refpurpose>RMI activation system daemon</refpurpose></refnamediv>
<indexterm id="rmid-1-indx-1"><primary sortas="RMI activation system daemon">RMI activation system daemon — rmid</primary></indexterm><indexterm id="rmid-1-indx-2"><primary sortas="rmid">rmid — RMI activation system daemon</primary></indexterm><para>The <command>rmid</command> tool starts the activation system daemon. Before activatable objects can be either registered with the activation
system or activated in a Java VM, the activation system daemon must be started. See the <citetitle>RMI Specification</citetitle> and <citetitle>Activation Tutorials</citetitle> for details on how to write programs that use activatable remote objects.</para>
<para>The daemon can be started by executing the <command>rmid</command> command, and specifying a security policy file, as follows:<informalexample><screen>example% <userinput>rmid –J–Djava.security.policy=rmid.policy</userinput></screen>
</informalexample></para>
<para><emphasis>Note:</emphasis> When running Sun's implementation of <command>rmid</command>, by default you will need to specify a security policy file so that <command>rmid</command> can verify whether or not <literal>ActivationGroupDesc</literal> is allowed to be used to launch a <acronym>JVM</acronym> for an activation group. Specifically, the command and options specified by the <literal>CommandEnvironment
</literal> and any <literal>Properties</literal> passed to an <literal>ActivationGroupDesc</literal>'s constructor must now be explicitly allowed in the security policy file for <command>rmid</command>. The value of the <literal>sun.rmi.activation.execPolicy</literal> property dictates the policy that <command>rmid</command> uses to determine whether or not the information in an <literal>ActivationGroupDesc
</literal> may be used to launch a <acronym>JVM</acronym> for an activation group.</para>
<para>Executing <command>rmid</command> by default</para>
<itemizedlist>
<listitem><para>starts the Activator and an internal registry on the default port, <literal>1098</literal>, and </para></listitem>
<listitem><para>binds an <literal>ActivationSystem</literal> to the name <literal>java.rmi.activation.ActivationSystem</literal> in this internal registry.</para></listitem>
</itemizedlist>
<para>To specify an alternate port for the registry, you must specify the <option>port</option> option when starting up <command>rmid</command>. For example,<informalexample><screen><userinput>rmid –J–Djava.security.policy=rmid.policy –port 1099</userinput></screen>
</informalexample>starts the activation system daemon and a registry on the registry's default port, <literal>1099</literal>.</para>
</refsect1>
<refsect1><title>&opts-tt;</title>
<para>The following options are supported:</para>
<variablelist termlength="wholeline"><varlistentry><term><option>C</option><replaceable>someCommandLineOption</replaceable> </term><listitem><para>Specifies an option that is passed as a command-line argument to each child process (activation group) of <command>rmid</command> when that process is created. For example, you could pass a property to each Java virtual machine spawned by the activation
system daemon:<informalexample><screen><userinput>rmid –C–Dsome.property=value</userinput></screen>
</informalexample>This ability to pass command-line arguments to child processes can be useful for debugging. For example, the following command:<informalexample><screen><userinput>rmid –C–Djava.rmi.server.logCalls=true</userinput></screen>
</informalexample>will enable server-call logging in all child <acronym>JVM</acronym>s.</para>
</listitem></varlistentry>
<varlistentry><term><option>J</option><replaceable>someCommandLineOption</replaceable></term><listitem><para>Specifies an option that is passed to the java interpreter running <command>rmid</command>. For example, to specify that <command>rmid</command> use a policy file named <literal>rmid.policy</literal>, the <option>J</option> option can be used to define the <literal>java.security.policy</literal>
property on <command>rmid</command>'s command line. For example:<informalexample><screen><userinput>rmid –J–Djava.security.policy=rmid.policy</userinput></screen>
</informalexample></para>
</listitem></varlistentry>
<varlistentry><term><option>J</option><option>D</option>sun.rmi.activation.execPolicy=<replaceable>policy</replaceable> </term><listitem><para>Specifies the policy that <command>rmid</command> employs to check commands and command-line options used to launch the <acronym>JVM</acronym> in which an activation group runs. Please notice that this option exists only in Sun's implementation of the <acronym>
RMI</acronym> activation daemon. If this property is not specified on the command line, the result is the same as if <literal>–J-Dsun.rmi.activation.execPolicy=default</literal> were specified. The possible values of <replaceable>policy</replaceable> can be <literal>default</literal>, <replaceable>policyClassName</replaceable>, or <literal>none</literal>: <itemizedlist>
<listitem><para><literal>default</literal> (or if this property is <emphasis>unspecified</emphasis>).</para>
<para>The default <literal>execPolicy</literal> allows <command>rmid</command> to execute commands with specific command-line options only if <command>rmid</command> has been granted permission to execute those commands and options in the security policy file that <command>rmid</command> uses. Only the default activation group implementation can be used with the <literal>default</literal> execution
policy.</para>
<para><command>rmid</command> launches a <acronym>JVM</acronym> for an activation group using the information in the group's registered activation group descriptor, an <literal>ActivationGroupDesc</literal>. The group descriptor specifies an optional <literal>ActivationGroupDesc.CommandEnvironment</literal> that includes the <emphasis>command</emphasis> to execute to start the activation group as well
as any command line <replaceable>options</replaceable> to be added to the command line. By default, <command>rmid</command> uses the <command>java</command> command found in <literal>java.home</literal>. The group descriptor also contains <replaceable>properties</replaceable> overrides that are added to the command line as options defined as:<informalexample><screen><userinput>-D <replaceable>property
</informalexample>The permission <literal>com.sun.rmi.rmid.ExecPermission</literal> is used to grant <command>rmid</command> permission to execute a command, specified in the group descriptor's <literal>CommandEnvironment</literal> to launch an activation group. The permission <literal>com.sun.rmi.rmid.ExecOptionPermission</literal> is used to allow <command>rmid</command> to use command-line options,
specified as properties overrides in the group descriptor or as options in the <literal>CommandEnvironment</literal>, when launching the activation group.</para>
<para>When granting <command>rmid</command> permission to execute various commands and options, the permissions <literal>ExecPermission</literal> and <literal>ExecOptionPermission</literal> need to be granted universally (that is, granted to all code sources). <variablelist termlength="wholeline"><varlistentry><term remap="7"><literal>ExecPermission</literal> </term><listitem><para>The <literal>ExecPermission
</literal> class represents permission for <command>rmid</command> to execute a specific command to launch an activation group.<variablelist termlength="xtranarrow"><varlistentry><term><literal>Syntax</literal></term><listitem><para>The name of an <literal>ExecPermission</literal> is the path name of a command to grant <command>rmid</command> permission to execute. A path name that ends in "/*" indicates
all the files contained in that directory (where "/" is the file-separator character, <literal>File.separatorChar</literal>). A path name that ends with "/-" indicates all files and subdirectories contained in that directory (recursively). A path name consisting of the special token "<<ALL FILES>>" matches <emphasis>any</emphasis> file. </para>
<para><emphasis>Note:</emphasis> A path name consisting of a single "*" indicates all the files in the current directory, while a path name consisting of a single "-" indicates all the files in the current directory and (recursively) all files and subdirectories contained in the current directory.</para>
</listitem></varlistentry>
</variablelist> </para>
</listitem></varlistentry>
<varlistentry><term><literal>ExecOptionPermission</literal> </term><listitem><para>The <literal>ExecOptionPermission</literal> class represents permission for <command>rmid</command> to use a specific command-line option when launching an activation group. The name of an <literal>ExecOptionPermission</literal> is the value of a command line option.<variablelist termlength="xtranarrow"><varlistentry>
<term><literal>Syntax</literal></term><listitem><para>Options support a limited wildcard scheme. An asterisk signifies a wildcard match, and it may appear as the option name itself (that is, it matches any option), or an asterisk may appear at the end of the option name only if the asterisk follows either a "." or "=".</para>
<para>For example: "*" or "–Dfoo.*" or "-Da.b.c=*" is valid; "*foo" or "-Da*b" or "ab*" is not.</para>
</listitem></varlistentry>
</variablelist></para>
</listitem></varlistentry>
</variablelist></para>
<para><literal>Policy file for rmid</literal></para>
<para>When granting <command>rmid</command> permission to execute various commands and options, the permissions <literal>ExecPermission</literal> and <literal>ExecOptionPermission</literal> need to be granted universally (that is, granted to all code sources). It is safe to grant these permissions universally because only <command>rmid</command> checks these permissions.</para>
<para>An example policy file that grants various execute permissions to <literal>rmid</literal> is: <screen>grant {
};</screen>The first two permissions granted allow <command>rmid</command> to execute the 1.2.2 version of the <command>java</command> and <command>java_g</command> commands, specified by their explicit path names. Notice that by default, the version of the <command>java</command> command found in <literal>java.home</literal> is used (the same one that <command>rmid</command> uses), and does not need
to be specified in the policy file. The third permission allows <command>rmid</command> to execute any command in the directory <literal>/files/apps/rmidcmds</literal>. The fourth permission granted, an <literal>ExecOptionPermission</literal>, allows <command>rmid</command> to launch an activation group that defines the security policy file to be <literal>/files/policies/group.policy</literal>. The
next permission allows the <literal>java.security.debug</literal> property to be used by an activation group. The last permission allows any property in the <literal>sun.rmi</literal> property name hierarchy to be used by activation groups. To start <command>rmid</command> with a policy file, the <literal>java.security.policy</literal> property needs to be specified on <command>rmid</command>'s command
line. For example:<informalexample><screen><userinput>rmid –J–Djava.security.policy=rmid.policy</userinput></screen>
<para>If the default behavior is not flexible enough, an administrator can provide, when starting <command>rmid</command>, the name of a class whose <literal>checkExecCommand</literal> method is executed in order to check commands to be executed by <command>rmid</command>. The <literal>policyClassName</literal> specifies a public class with a public, no-argument constructor and an implementation of
the following <literal>checkExecCommand</literal> method: <screen>public void checkExecCommand(ActivationGroupDesc desc,
String[] command)
throws SecurityException;</screen>Before launching an activation group, <command>rmid</command> calls the policy's <literal>checkExecCommand</literal> method, passing it the activation group descriptor and an array containing the complete command to launch the activation group. If the <literal>checkExecCommand</literal> throws a <literal>SecurityException</literal>, <command>rmid</command>
will not launch the activation group and an <literal>ActivationException</literal> will be thrown to the caller attempting to activate the object. </para>
</listitem>
<listitem><para><literal>none</literal></para>
<para>If the <literal>sun.rmi.activation.execPolicy</literal> property value is <literal>none</literal>, then <command>rmid</command> will not perform any validation of commands to launch activation groups.</para>
</listitem>
</itemizedlist></para>
</listitem></varlistentry>
<varlistentry><term><option>log</option> <replaceable>dir</replaceable></term><listitem><para>Specifies the name of the directory the activation system daemon uses to write its database and associated information. The log directory defaults to creating a directory, <literal>log</literal>, in the directory in which the <command>rmid</command> command was executed.</para>
</listitem></varlistentry>
<varlistentry><term><option>port</option> <replaceable>port</replaceable> </term><listitem><para>Specifies the port <command>rmid</command>'s registry uses. The activation system daemon binds the <literal>ActivationSystem</literal>, with the name <literal>java.rmi.activation.ActivationSystem</literal>, in this registry. Thus, the <literal>ActivationSystem</literal> on the local machine can be obtained
using the following <literal>Naming.lookup</literal> method call:</para>
<variablelist termlength="xtranarrow"><varlistentry><term><option>stop</option> </term><listitem><para>Stops the current invocation of <command>rmid</command>, for a port specified by the <option>port</option> option. If no <replaceable>port</replaceable> is specified, it will stop the <command>rmid</command> running on port <literal>1098</literal>.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1><title>&envr-tt;</title>
<variablelist termlength="medium"><varlistentry><term remap="20"><envar>CLASSPATH</envar></term><listitem><para>Used to provide the system a path to user-defined classes. Directories are separated by colons. For example, <informalexample><para><screen>example% <userinput>.:/usr/local/java/classes</userinput></screen></para>
</informalexample></para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1><title>&attr-tt;</title>
<para>See <citerefentry><refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a description of the following attributes:</para>