blob: 2dbe6cab1df3b5e1c3fe14408a3f917eebc404be [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="admin-shell">
<title>Equinox Console</title>
<section id="admin-shell-enable">
<title>Enabling Equinox Console</title>
<para>
Shells are provided for both user region and kernel, although they are disabled by default and need enabling before
they can be used.
</para>
<para>
The user region shell ports may be reconfigured by editing the file
<literal>osgi.console.telnet.properties</literal> or <literal>osgi.console.ssh.properties</literal> in the <literal>repository/ext</literal> directory, and
then restarting Virgo.
The kernel shell ports may be reconfigured by editing the file <literal>osgi.console.telnet.properties</literal> or
<literal>osgi.console.ssh.properties</literal> in the <literal>config</literal> directory, and then restarting Virgo.
</para>
<para>
To enable any of these shell ports, change the <literal>enabled</literal> setting from <literal>false</literal> to <literal>true</literal>
<programlisting><![CDATA[enabled=true]]></programlisting>
in the corresponding properties files.
</para>
<para>
If you wish to change a port, any free port can be used, but the usual defaults are, for telnet, 2501 for the user region and 2401 for the kernel, and
for ssh, 2502 for the user region and 2402 for the kernel.
</para>
<para>
Access is via ssh or telnet.
The simplest way to access the shell is via telnet to port 2501 or 2401 for user region or kernel, respectively.
<programlisting><![CDATA[prompt$ telnet localhost 2501
Trying ::1...
Connected to localhost.
Escape character is '^]'.
osgi> ]]></programlisting>
</para>
<para>
Alternatively, you can ssh to port 2502 or 2402 for user region or kernel, respectively.
The first time you use ssh to connect, specify the user "equinox" and password "equinox".
You'll then be prompted prompted to create a new user, password, and role (the "admin" role is recommended).
</para>
</section>
<section id="admin-shell-using-vsh">
<title>Using the Equinox Console Extension (<literal>vsh</literal>)</title>
<para>Virgo provides an extension to the Equinox console in the form of the <literal>vsh</literal> command that allows you to examine artifacts
currently installed to a particular Web Server instance, manage the lifecycle of the installed artifacts, install new artifacts, and shut down
the server. You can install, examine, and manage the lifecycle of the following artifacts:
<itemizedlist>
<listitem><para>Bundles</para></listitem>
<listitem><para>Configuration Artifacts</para></listitem>
<listitem><para>PARs</para></listitem>
<listitem><para>Plans</para></listitem>
</itemizedlist>
and can examine:
<itemizedlist>
<listitem><para>Exported packages</para></listitem>
<listitem><para>Services in the OSGi service registry</para></listitem>
</itemizedlist>
</para>
<para>You invoke the Equinox Console Extension using the <literal>vsh</literal> command. For example:</para>
<programlisting><![CDATA[
osgi> vsh help
bundle - Management and examination of bundle artifacts
config - Management and examination of configuration artifacts
exit - Exit the kernel shell environment
help - Get help on commands
install - Install (deploy) an artifact to the server
package - Examination of exported packages
par - Management and examination of PAR artifacts
plan - Management and examination of plan artifacts
service - Examination of services
shutdown - Shutdown Virgo Kernel
osgi> ]]></programlisting>
<section id="admin-shell-vsh-using-command-list">
<title>Equinox Console Extension (<literal>vsh</literal>) Subcommands</title>
<para>The following table lists the Equinox Console Extension subcommands; each subcommand in turn has a variety of options that you can specify, depending on what you want to do, such as start a bundle or refresh a plan. The reference documentation about each subcommand provides the full list of available options. </para>
<table id="admin-shell-vsh-commands-table" colsep="1" frame="all" rowsep="1">
<title>Equinox Console Extension Subcommands</title>
<tgroup cols="2">
<thead>
<row>
<entry>Subcommand </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="admin-shell-vsh-bundle-command">bundle</link></entry>
<entry>Manages and displays information about bundle artifacts.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-config-command">config</link></entry>
<entry>Manages and displays information about configuration artifacts.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-package-command">package</link></entry>
<entry>Displays information about exported packages.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-par-command">par</link></entry>
<entry>Manages and displays information about PAR artifacts.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-plan-command">plan</link></entry>
<entry>Manages and displays information about plan artifacts.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-service-command">service</link></entry>
<entry>Displays information about services in the OSGi service registry.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-install-command">install</link></entry>
<entry>Installs an artifact to Web Server. </entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-shutdown-command">shutdown</link></entry>
<entry>Shuts down the Web Server instance to which the Equinox Console is connected.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-help-command">help</link></entry>
<entry>Displays help about the list of available subcommands, as well as more detailed help about individual subcommands.</entry>
</row>
<row>
<entry><link linkend="admin-shell-vsh-exit-command">exit</link></entry>
<entry>Returns to the Equinox console with no effect.</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section id="admin-shell-vsh-command-reference">
<title>Equinox Console Extension Subcommand Reference</title>
<para>
This section contains reference information about the Equinox Console Extension subcommands
<link linkend="admin-shell-vsh-bundle-command">bundle</link>,
<link linkend="admin-shell-vsh-config-command">config</link>,
<link linkend="admin-shell-vsh-package-command">package</link>,
<link linkend="admin-shell-vsh-par-command">par</link>,
<link linkend="admin-shell-vsh-plan-command">plan</link>,
<link linkend="admin-shell-vsh-service-command">service</link>,
<link linkend="admin-shell-vsh-install-command">install</link>,
<link linkend="admin-shell-vsh-shutdown-command">shutdown</link>,
<link linkend="admin-shell-vsh-help-command">help</link>, and
<link linkend="admin-shell-vsh-exit-command">exit</link>.
</para>
<section id="admin-shell-vsh-bundle-command">
<title>bundle Subcommand</title>
<para>Use the <literal>bundle</literal> subcommand to manage the lifecycle of bundles deployed to @tomcat.product.name.short@ and to gather information about deployed bundles, such as diagnostic information, header information, and so on. </para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-bundle-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the bundle Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Displays the list of bundles that are currently installed to the current Web Server instance. With the exception of a few kernel bundles and their services, which Web Server uses to administer the user region, none of the kernel is visible to user installed artifacts; rather, only the bundles installed in the user region are visible.
<para>Each bundle is identified by an internal <literal>ID</literal> which you can then use with the other <literal>bundle</literal> subcommands that manage a particular bundle, such as <literal>start </literal><emphasis><literal>id</literal></emphasis>. The <literal>list</literal> subcommand also displays the version of the bundle, along with its state, which is one of the following standard OSGi lifecycle states:</para>
<itemizedlist>
<listitem><para><emphasis role="bold">Installed</emphasis>: The bundle is installed but its dependencies have not yet been resolved.</para></listitem>
<listitem><para><emphasis role="bold">Resolved</emphasis>: The bundle is resolved and you can now start it.</para></listitem>
<listitem><para><emphasis role="bold">Uninstalled</emphasis>: The bundle is uninstalled and you can not use it.</para></listitem>
<listitem><para><emphasis role="bold">Starting</emphasis>: The bundle is in the process of starting.</para></listitem>
<listitem><para><emphasis role="bold">Active</emphasis>: The bundle is running and you can now use it.</para></listitem>
<listitem><para><emphasis role="bold">Stopping</emphasis>: The bundle is in the process of stopping.</para></listitem>
</itemizedlist>
<para>Use one of the other <literal>bundle</literal> subcommands to change the state of a bundle. For example, use the <literal>bundle start </literal><emphasis><literal>id</literal></emphasis> subcommand to change the state of a bundle from <literal>Installed</literal> to <literal>Active</literal>.</para>
</entry>
</row>
<row>
<entry>examine <emphasis>id</emphasis></entry>
<entry>Displays detailed information about the specified bundle. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
<para>In addition to the information provided by the <literal>bundle list</literal> subcommand (id, full name, version, and state), the <literal>examine</literal> subcommand specifies whether the bundle includes a Spring application context (or is <emphasis>Spring Powered</emphasis>) and the exact physical location of the bundle JAR file. </para>
<para>The <literal>examine</literal> also provides the full list of packages that the bundle imports, as well as the bundles that in turn export these imported packages. Finally, the subcommand displays the packages that the current bundle exports, and then in turn the list of other installed bundles that are currently importing these exported packages. </para>
</entry>
</row>
<row>
<entry>start <emphasis>id</emphasis></entry>
<entry>Starts the specified bundle. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
<para>After Web Server successfully starts the bundle, it is listed in the <literal>Active</literal> state. </para>
</entry>
</row>
<row>
<entry>stop <emphasis>id</emphasis></entry>
<entry>Stops the specified bundle. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
<para>When you stop a bundle, it goes from the <literal>Active</literal> state to the <literal>Resolved</literal> state, and you must re-start it if you want to use the application that the bundle contains.</para> </entry>
</row>
<row>
<entry>refresh <emphasis>id</emphasis></entry>
<entry>Updates the contents of the specified bundle. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle. Use this subcommand if you have changed the contents of the bundle JAR file and you want to refresh the artifact as installed in the OSGi framework.
</entry>
</row>
<row>
<entry>uninstall <emphasis>id</emphasis></entry>
<entry>Uninstalls the specified bundle from Web Server. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
<para>When the uninstall process is complete, the bundle does not show up in the list of bundles displayed by the <literal>bundle list</literal> subcommand. If you want to use the application in the bundle, you must re-install it using the <literal>install</literal> subcommand.</para>
</entry>
</row>
<row>
<entry>diag <emphasis>id</emphasis></entry>
<entry>Provides diagnostic information about the specified bundle. In particular, this subcommand displays information about the imported packages that Web Server could not resolve. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
</entry>
</row>
<row>
<entry>headers <emphasis>id</emphasis></entry>
<entry>Displays the complete list of manifest headers of the specified bundle. Use the <literal>bundle list</literal> subcommand to get the internal id of a particular bundle.
<para>The manifest headers include: <literal>Import-Package</literal>, <literal>Export-Package</literal>, <literal>Bundle-SymbolicName</literal>, and so on. </para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following examples show how to use this subcommand.</para>
<para>First, use the <literal>bundle list</literal> subcommand to view all the installed bundles:</para>
<programlisting>osgi> vsh bundle list
Id Name Version State
0 org.eclipse.osgi 3.6.1.R36x_v20100806 ACTIVE
1 org.eclipse.virgo.region.user 0.0.0 ACTIVE
2 org.eclipse.virgo.kernel.userregion 2.1.0.RELEASE ACTIVE
3 org.eclipse.virgo.kernel.osgicommand 2.1.0.RELEASE ACTIVE
4 org.springframework.osgi.core 1.2.1 ACTIVE
5 S org.springframework.osgi.extender 1.2.1 ACTIVE
6 org.springframework.osgi.io 1.2.1 ACTIVE
7 org.eclipse.virgo.kernel.agent.dm 2.1.0.RELEASE ACTIVE
8 S org.eclipse.virgo.kernel.deployer.dm 2.1.0.RELEASE ACTIVE
9 com.springsource.org.aopalliance 1.0.0 ACTIVE
10 org.eclipse.virgo.kernel.dmfragment 2.1.0.RELEASE RESOLVED
11 org.springframework.aop 3.0.0.RELEASE ACTIVE
12 org.springframework.asm 3.0.0.RELEASE ACTIVE
13 org.springframework.beans 3.0.0.RELEASE ACTIVE
14 org.springframework.context 3.0.0.RELEASE ACTIVE
15 org.springframework.core 3.0.0.RELEASE ACTIVE
16 org.springframework.expression 3.0.0.RELEASE ACTIVE
osgi> </programlisting>
<para>The following example shows how to view the headers of the <literal>org.springframework.osgi.extender</literal> bundle (only the first few lines are shown):</para>
<programlisting>osgi> vsh bundle examine 5
Id: 5
Name: org.springframework.osgi.extender
Version 1.2.1
State: ACTIVE
Spring Powered: true
Bundle Location: file:&lt;... omitted ...&gt;/org.springframework.osgi.extender-1.2.1.jar/
Imported Packages:
org.springframework.osgi.context [1.2.1, 1.2.1]
exported by org.springframework.osgi.core 1.2.1 [4]
&lt;... remainder omitted ...&gt;
Exported Packages:
org.springframework.osgi.extender 1.2.1
&lt;... remainder omitted ...&gt;
Published services:
58 org.springframework.beans.factory.xml.NamespaceHandlerResolver
consumed by org.springframework.osgi.extender 1.2.1 [5]
consumed by org.eclipse.virgo.kernel.deployer.dm 2.1.0.RELEASE [8]
&lt;... remainder omitted ...&gt;
Consumed services:
34 org.eclipse.virgo.kernel.shim.serviceability.TracingService
published by org.eclipse.virgo.region.user 0.0.0 [1]
&lt;... remainder omitted ...&gt;
Fragments:
org.eclipse.virgo.kernel.dmfragment 2.1.0.RELEASE [10]
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-config-command">
<title>config Subcommand</title>
<para>Use the <literal>config</literal> subcommand to view and manage the configuration artifacts that have been installed to Web Server. A <emphasis>configuration artifact</emphasis> is simply a properties file that is associated with a user application that is contained in a bundle. Using configuration artifacts, you can manage the configuration of a user application completely separately from the bundle that contains the application. </para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-config-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the config Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Lists the configuration artifacts that are currently installed in Web Server.
<para>The <literal>list</literal> option displays the full name of each installed configuration artifact, its version, and its current state. Configuration artifacts have similar lifecycles to other artifacts, such as bundles, and so the list of states in which a configuration can be in is the same as those of bundles; see <link linkend="admin-shell-bundle-command">the bundle subcommand</link> for the list of possible states. </para>
</entry>
</row>
<row>
<entry>examine <emphasis>name [version]</emphasis></entry>
<entry>Displays information about the specified configuration artifact. Although you must specify the name of the configuration artifact, its version is optional unless you have multiple versions of the configuration artifact installed. Use the <literal>config list</literal> subcommand to view all configuration artifacts and versions currently installed in Web Server.
<para>A configuration artifact must be active for you to examine it; if it is not currently active, use <literal>config start</literal> to start it and thus change its state to <literal>Active</literal>.</para>
<para>The subcommand first displays the factory pid of the configuration artifact as well as the complete location of the bundle to which the configuration artifact is associated. The subcommand then lists all the properties that make up the configuration, as well as their current value. </para> </entry>
</row>
<row>
<entry>start <emphasis>name [version]</emphasis></entry>
<entry>Starts the specified configuration artifact and makes it visible to the internal configuration sub-system of Web Server. Although you must specify the name of the configuration artifact, its version is optional unless you have multiple versions of the configuration artifact installed. Use the <literal>config list</literal> subcommand to view all configuration artifacts and versions currently installed in Web Server.
<para>Starting the configuration sets its state to <literal>Active</literal>.</para></entry>
</row>
<row>
<entry>stop <emphasis>name [version]</emphasis></entry>
<entry>Stops the specified configuration artifact and makes it invisible to the internal configuration sub-system of Web Server. Although you must specify the name of the configuration artifact, its version is optional unless you have multiple versions of the configuration artifact installed. Use the <literal>config list</literal> subcommand to view all configuration artifacts and versions currently installed in Web Server.
<para>Stopping the configuration sets its state to <literal>Resolved</literal>.</para></entry>
</row>
<row>
<entry>refresh <emphasis>name [version]</emphasis></entry>
<entry>Updates the contents of the specified configuration artifact to the internal configuration sub-system of Web Server. Although you must specify the name of the configuration artifact, its version is optional unless you have multiple versions of the configuration artifact installed. Use the <literal>config list</literal> subcommand to view all configuration artifacts and versions currently installed in Web Server.
<para>Use this subcommand if you have changed the contents of the configuration artifact, and you want to make this information known to Web Server and the associated bundle. </para></entry>
</row>
<row>
<entry>uninstall <emphasis>name [version]</emphasis></entry>
<entry>Uninstalls the specified configuration artifact and make it completely unavailable to Web Server. Although you must specify the name of the configuration artifact, its version is optional unless you have multiple versions of the configuration artifact installed. Use the <literal>config list</literal> subcommand to view all configuration artifacts and versions currently installed in Web Server.
<para>Stopping the configuration removes it from Web Server's list of deployed artifacts and it will not show up when you perform a <literal>config list</literal>.</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following example shows how to use this subcommand to list the installed configuration artifacts.</para>
<programlisting>osgi> vsh config list
Name Version State
org.eclipse.virgo.kernel 0.0.0 ACTIVE
org.eclipse.virgo.kernel.jmxremote.access 0.0.0 ACTIVE
org.eclipse.virgo.kernel.userregion 0.0.0 ACTIVE
org.eclipse.virgo.kernel.users 0.0.0 ACTIVE
org.eclipse.virgo.medic 0.0.0 ACTIVE
org.eclipse.virgo.repository 0.0.0 ACTIVE
osgi> </programlisting>
<para>To view the properties of a configuration artifact, and their current values, use <literal>config examine</literal>:</para>
<programlisting>osgi> vsh config examine org.eclipse.virgo.kernel
Factory pid:
Bundle Location: file:lib/kernel/org.eclipse.virgo.kernel.osgi-2.1.0.RELEASE.jar
Properties:
deployer.pickupDirectory:
pickup
deployer.timeout:
300
domain:
org.eclipse.virgo.kernel
home.directory:
/Users/glynnormington/virgo-web-server-2.1.0.RELEASE
service.pid:
org.eclipse.virgo.kernel
work.directory:
/Users/glynnormington/virgo-web-server-2.1.0.RELEASE/work
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-package-command">
<title>package Subcommand</title>
<para>Use the <literal>package</literal> subcommand to view the complete list of packages exported by all bundles installed to Web Server, as well as examine a particular exported package in more detail.</para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-package-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the package Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Displays all the exported packages for all bundles in the uer region of Web Server. In addition to the package name, the subcommand displays the version of the exported package and the <literal>id</literal> of the bundle that contains the exported package. You can examine the bundle by using the subcommand <literal>bundle examine </literal><emphasis><literal>id</literal></emphasis>.</entry>
</row>
<row>
<entry>examine <emphasis>name version</emphasis></entry>
<entry>Displays details about the exported package. You must specify both the name of the exported package and its version; use <literal>package list</literal> to view the exact names and version.
<para>This subcommand provides the following additional information about the exported package:</para>
<itemizedlist>
<listitem><para>The name and version of the bundle that exports the package. This means that the package name is explicitly listed in the bundle's <literal>MANIFEST.MF</literal> file as part of the <literal>Export-Package</literal> header.</para></listitem>
<listitem><para>Any attributes that are part of the <literal>Export-Package</literal>, in addition to <literal>version</literal>.</para></listitem>
<listitem><para>The directives that are part of the <literal>Export-Package</literal> header. A typical directive is <literal>uses</literal>, which declares up-front constraints on a number of other packages.</para></listitem>
<listitem><para>The list of all bundles that import the package.</para></listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following example shows how to list all the exported packages for all bundles installed:</para>
<programlisting>osgi> vsh package list
Name Version Providing Bundle
javax.accessibility 0.0.0 0
javax.activation 0.0.0 0
javax.activation 1.1.1 0
&lt;... remainder omitted ...&gt;
osgi> </programlisting>
<para>The following example shows how to examine a particular exported package:</para>
<programlisting>osgi> vsh package examine org.slf4j 1.6.1
Exporter: org.eclipse.virgo.region.user 0.0.0 [1]
Attributes:
None
Directives:
uses:
org.slf4j.spi
x-equinox-ee:
-1
x-internal:
false
Importer(s):
org.eclipse.virgo.kernel.agent.dm 2.1.0.RELEASE [7]
Import-Package attributes:
bundle-version:
0.0.0
version:
[1.6.1,2.0.0)
Import-Package directives:
resolution:
static
&lt;... remainder omitted ...&gt;
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-par-command">
<title>par Subcommand</title>
<para>Use the <literal>par</literal> subcommand to view all the PARs currently installed in Web Server, view details about a particular PAR and manage its lifecycle, such as starting, stopping, refreshing, and uninstalling it.</para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-par-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the par Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Displays all the PARs that are currently installed in Web Server.
<para>The <literal>list</literal> option displays the full name of each installed PAR, its version, and its current state. PARs have similar lifecycles to other artifacts, such as bundles, and so the list of states in which a PAR can be in is the same as those of bundles; see <link linkend="admin-shell-bundle-command">the bundle subcommand</link> for the list of possible states. </para></entry>
</row>
<row>
<entry>examine <emphasis>name version</emphasis></entry>
<entry>Displays information about the specified PAR; you are required to identify the PAR with both its name and its version. Use the <literal>par list</literal> subcommand to view all installed PAR files and their versions. The subcommand displays the following information:
<itemizedlist>
<listitem><para>The current state of the PAR (see <link linkend="admin-shell-vsh-bundle-command">the bundle subcommand</link> for the full list of possible states).</para></listitem>
<listitem><para>Whether the PAR is <emphasis>scoped</emphasis>. Scoping specifies whether Web Server should deploy the members of the PAR in their own scope; when scoping is disabled, Web Server deploys the artifacts into the global scope and they are accessible for access by all other artifacts.</para></listitem>
<listitem><para>Whether the PAR is <emphasis>atomic</emphasis>. When a PAR is atomic, Web Server manages the lifecycle of all its member artifacts as a single entity, which means if one artifact member is started, then Web Server starts <emphasis>all</emphasis> the PAR artifacts. If one artifact fails to start, then Web Server stops all other artifacts in the PAR.</para></listitem>
<listitem><para>The individual members, or children, of the PAR. These could be other PARs, plans, bundles, configuration artifacts, and so on.</para></listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry>start <emphasis>name version</emphasis></entry>
<entry>Starts the specified PAR. You must specify both the full name of the PAR as well as the version you want to start. Use the <literal>par list</literal> subcommand to get the list of PARs currently installed in Web Server.
<para>To start a PAR, it must have already been resolved by Web Server, or in other words, be in the <literal>Resolved</literal> state. After Web Server successfully starts the PAR, it is listed in the <literal>Active</literal> state. </para></entry>
</row>
<row>
<entry>stop <emphasis>name version</emphasis></entry>
<entry>Stops the specified PAR. You must specify both the full name of the PAR as well as the version you want to stop. Use the <literal>par list</literal> subcommand to get the list of PARs currently installed in Web Server.
<para>When you stop a PAR, it goes from the <literal>Active</literal> state to the <literal>Resolved</literal> state, and you must re-start it if you want to use the application that the PAR contains.</para> </entry>
</row>
<row>
<entry>refresh <emphasis>name version</emphasis></entry>
<entry>Updates the contents of the specified PAR. You must specify both the name and version of the PAR you want to refresh. Use the <literal>par list</literal> subcommand to this information.
<para>Use this subcommand if you have changed the contents of the PAR file and you want to refresh the artifact as installed in the OSGi framework.</para></entry>
</row>
<row>
<entry>uninstall <emphasis>name version</emphasis></entry>
<entry>Uninstalls the specified PAR. You must specify both the name and version of the PAR you want to refresh. Use the <literal>par list</literal> subcommand to this information.
<para>When the uninstall process is complete, the PAR will not show up in the list of PARs displayed by the <literal>par list</literal> subcommand. If you want to use the application in the PAR, you must re-install it using the <literal>install</literal> subcommand.</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following example shows how to list the PARs that have been installed in Web Server:</para>
<programlisting>osgi> vsh par list
Name Version State
org.eclipse.virgo.server.repository.hosted 2.1.0.RELEASE ACTIVE
osgi> </programlisting>
<para>The following example shows how to examine a particular PAR file:</para>
<programlisting>osgi> vsh par examine org.eclipse.virgo.server.repository.hosted 2.1.0.RELEASE
State: ACTIVE
Scoped: true
Atomic: true
Children:
bundle org.eclipse.virgo.server.repository.hosted.core 2.1.0.RELEASE
bundle org.eclipse.virgo.server.repository.hosted.web 2.1.0.RELEASE
bundle org.eclipse.virgo.server.repository.hosted-synthetic.context 2.1.0.RELEASE
osgi> </programlisting>
<para>Finally, the following example shows how to refresh an installed PAR file:</para>
<programlisting>osgi> vsh par refresh my.exciting.par 1.2.0
par my.exciting.par 1.2.0 refreshed successfully
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-plan-command">
<title>plan Subcommand</title>
<para>Use the <literal>plan</literal> subcommand to view all the plans currently installed in Web Server, view details about a particular plan and manage its lifecycle, such as starting, stopping, refreshing, and uninstalling it.</para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-plan-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the plan Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Displays all the plans that are currently installed in Web Server.
<para>The <literal>list</literal> option displays the full name of each installed plan, its version, and its current state. Plans have similar lifecycles to other artifacts, such as bundles, and so the list of states in which a plan can be in is the same as those of bundles; see <link linkend="admin-shell-bundle-command">the bundle subcommand</link> for the list of possible states. </para></entry>
</row>
<row>
<entry>examine <emphasis>name version</emphasis></entry>
<entry>Displays information about the specified plan; you are required to identify the plan with both its name and its version. Use the <literal>plan list</literal> subcommand to view all installed plans and their versions. The subcommand displays the following information:
<itemizedlist>
<listitem><para>The current state of the plan (see <link linkend="admin-shell-vsh-bundle-command">the bundle subcommand</link> for the full list of possible states).</para></listitem>
<listitem><para>Whether the plan is <emphasis>scoped</emphasis>. Scoping specifies whether Web Server should deploy the members of the plan in their own scope; when scoping is disabled, Web Server deploys the artifacts into the global scope and they are accessible for access by all other artifacts.</para></listitem>
<listitem><para>Whether the plan is <emphasis>atomic</emphasis>. When a plan is atomic, Web Server manages the lifecycle of all its member artifacts as a single entity, which means if one artifact member is started, then Web Server starts <emphasis>all</emphasis> the plan artifacts. If one artifact fails to start, then Web Server stops all other artifacts in the plan.</para></listitem>
<listitem><para>The individual members, or children, of the plan. These could be other plans, PARs, bundles, configuration artifacts, and so on.</para></listitem>
</itemizedlist>
</entry>
</row>
<row>
<entry>start <emphasis>name version</emphasis></entry>
<entry>Starts the specified plan. You must specify both the full name of the plan as well as the version you want to start. Use the <literal>plan list</literal> subcommand to get the list of plans currently installed in Web Server.
<para>To start a plan, it must have already been resolved by Web Server, or in other words, be in the <literal>Resolved</literal> state. After Web Server successfully starts the plan, it is listed in the <literal>Active</literal> state. </para></entry>
</row>
<row>
<entry>stop <emphasis>name version</emphasis></entry>
<entry>Stops the specified plan. You must specify both the full name of the plan as well as the version you want to stop. Use the <literal>plan list</literal> subcommand to get the list of plans currently installed in Web Server.
<para>When you stop a plan, it goes from the <literal>Active</literal> state to the <literal>Resolved</literal> state, and you must re-start it if you want to use the application that the plan contains.</para> </entry>
</row>
<row>
<entry>refresh <emphasis>name version</emphasis></entry>
<entry>Updates the contents of the specified plan. You must specify both the name and version of the plan you want to refresh. Use the <literal>plan list</literal> subcommand to this information.
<para>Use this subcommand if you have changed the contents of the plan file and you want to refresh the artifact as installed in the OSGi framework.</para></entry>
</row>
<row>
<entry>uninstall <emphasis>name version</emphasis></entry>
<entry>Uninstalls the specified plan. You must specify both the name and version of the plan you want to refresh. Use the <literal>plan list</literal> subcommand to this information.
<para>When the uninstall process is complete, the plan will not show up in the list of plans displayed by the <literal>plan list</literal> subcommand. If you want to use the application in the plan, you must re-install it using the <literal>install</literal> subcommand.</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following example shows how to list the plans that have been installed in Web Server:</para>
<programlisting>osgi> vsh plan list
Name Version State
org.eclipse.virgo.apps.admin.plan 2.1.0 ACTIVE
org.eclipse.virgo.kernel.userregion.springdm 2.1.0 ACTIVE
org.eclipse.virgo.web 2.1.0 ACTIVE
osgi> </programlisting>
<para>The following example shows how to examine a particular plan:</para>
<programlisting>osgi> vsh plan examine org.eclipse.virgo.kernel.userregion.springdm 2.1.0
State: ACTIVE
Scoped: false
Atomic: false
Children:
bundle org.eclipse.virgo.kernel.agent.dm 2.1.0.RELEASE
bundle org.springframework.osgi.io 1.2.1
bundle org.springframework.osgi.extender 1.2.1
bundle org.springframework.osgi.core 1.2.1
bundle org.eclipse.virgo.kernel.deployer.dm 2.1.0.RELEASE
osgi> </programlisting>
<para>The following example shows how to stop a currently Active plan:</para>
<programlisting>osgi> vsh plan stop org.eclipse.virgo.web 2.1.0
plan org.eclipse.virgo.web:2.1.0 stopped successfully
osgi> </programlisting>
<para>The following example shows how to start a plan:</para>
<programlisting>osgi> vsh plan start org.eclipse.virgo.web 2.1.0
plan org.eclipse.virgo.web:2.1.0 started successfully
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-service-command">
<title>service Subcommand</title>
<para>Use the <literal>service</literal> subcommand to view all the services that have been registered in the OSGi service registry of Web Server. You can also examine a specific service to discover its properties, the bundle that publishes the service, and any bundles that consume the service.</para>
<para>The following table lists the options you can specify for this subcommand.</para>
<table id="admin-shell-vsh-service-command-table" colsep="1" frame="all" rowsep="1">
<title>Options of the service Subcommand</title>
<tgroup cols="2">
<thead>
<row>
<entry>Option </entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry>Displays the list of services that are currently registered in the OSGi service registry of Web Server.
<para>Each service is identified by an internal <literal>ID</literal> which you can then use with the <literal>service examine</literal> subcommand to view the details about a particular service. The <literal>list</literal> option also displays the object class that implements the service and the internal <literal>id</literal> of the bundle that provides the service. </para></entry>
</row>
<row>
<entry>examine <emphasis>id</emphasis></entry>
<entry>Displays detailed information about the specified service. Use the <literal>service list</literal> subcommand to get the internal id of a particular service.
<para>This subcommand displays the properties of the service, such as the object class that implements the service, the name of the bundle that publishes the service and any bundles that consume the service. </para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following example shows how to list the services currently registered in the OSGi service registry:</para>
<programlisting>osgi> vsh service list
Id Object Class(es) Providing Bundle
1 org.osgi.service.packageadmin.PackageAdmin 0
2 org.osgi.service.permissionadmin.PermissionAdmin, ... 0
3 org.osgi.service.startlevel.StartLevel 0
4 org.eclipse.osgi.service.debug.DebugOptions 0
5 java.lang.ClassLoader 0
6 org.eclipse.osgi.framework.log.FrameworkLog 0
7 org.eclipse.osgi.framework.log.FrameworkLog 0
&lt;... remainder omitted ...&gt;
72 org.eclipse.gemini.web.core.spi.ServletContainer 38
73 org.eclipse.gemini.web.core.WebContainer 37
74 org.eclipse.virgo.web.core.WebApplicationRegistry 39
&lt;... remainder omitted ...&gt;
osgi> </programlisting>
<para>The following example shows how to examine a particular service:</para>
<programlisting>osgi> vsh service examine 73
Properties:
objectClass:
org.eclipse.gemini.web.core.WebContainer
service.id:
73
Publisher: org.eclipse.gemini.web.core 1.1.0.RELEASE [37]
Consumer(s):
org.eclipse.virgo.web.core 2.1.0.RELEASE [39]
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-install-command">
<title>install Subcommand</title>
<para>Use the <literal>install</literal> subcommand to deploy an artifact to Web Server. The artifact can be a bundle, PAR, plan, or configuration artifact.</para>
<para>The <literal>install</literal> subcommand takes a single parameter: the URI of the artifact you want to deploy. For example, to deploy a bundle on the local computer, use the <literal>file</literal> scheme:</para>
<programlisting>file://full-pathname-to-artifact</programlisting>
<para>After you execute the <literal>install</literal> subcommand, Web Server attempts to resolve the artifact's dependencies, and if it is successful, puts it in the <literal>Resolved</literal> state. At that point, you must start the artifact to be able to actually use it. </para>
<para>The following example shows how to install a bundle called <literal>swf-booking-mvc.war</literal> located in the <literal>/home/apps</literal> directory of the computer on which the Equinox Console Extension is being run:</para>
<programlisting>:> install file://home/apps/swf-booking-mvc.war
Artifact bundle swf-booking-mvc.war 0.0.0 installed</programlisting>
<para>The following example shows how to use the <literal>bundle list</literal> subcommand to ensure that the bundle was indeed installed to Web Server; if you had installed a different kind of artifact, for example a plan, then you would use the appropriate subcommand (such as <literal>plan list</literal>):</para>
<programlisting>osgi> vsh bundle list
Id Name Version State
0 org.eclipse.osgi 3.6.1.R36x_v20100806 ACTIVE
1 org.eclipse.virgo.region.user 0.0.0 ACTIVE
&lt;... remainder omitted ...&gt;
59 org.eclipse.virgo.server.splash 2.1.0.RELEASE ACTIVE
60 swf-booking-mvc.war 0.0.0 RESOLVED
osgi> </programlisting>
<para>Note that the <literal>swf-booking-mvc.war</literal> file is in the <literal>Resolved</literal> state. The following examples start the bundle, and then examine it to ensure that it is in the <literal>Active</literal> state:</para>
<programlisting>osgi> vsh bundle start 60
bundle swf-booking-mvc.war:0.0.0 started successfully
osgi> vsh bundle examine 60
Id: 60
Name: swf-booking-mvc.war
Version 0.0.0
State: ACTIVE
Spring Powered: true
Bundle Location: file:&lt;... omitted ...&gt;/swf-booking-mvc.war/
Imported Packages:
javax.crypto.interfaces [0.0.0, 0.0.0]
exported by org.eclipse.osgi 3.6.1.R36x_v20100806 [0]
org.omg.CosNaming.NamingContextPackage [0.0.0, 0.0.0]
exported by org.eclipse.osgi 3.6.1.R36x_v20100806 [0]
org.omg.DynamicAny.DynAnyFactoryPackage [0.0.0, 0.0.0]
exported by org.eclipse.osgi 3.6.1.R36x_v20100806 [0]
&lt;... remainder omitted ...&gt;
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-shutdown-command">
<title>shutdown Subcommand</title>
<para>Use the <literal>shutdown</literal> subcommand to shut down the Web Server instance to which you are connected. When Web Server is shutdown, the shell returns you to the operating system prompt. </para>
<para>The <literal>shutdown</literal> subcommand does not have any options.</para>
<para>The following example shows how to use this subcommand.</para>
<programlisting>:> shutdown
Shutdown MBean called
prompt$</programlisting>
</section>
<section id="admin-shell-vsh-help-command">
<title>help Subcommand</title>
<para>Use the <literal>help</literal> subcommand on its own to get a list of all available Equinox Console Extension subcommands. If you specify a particular subcommand to the <literal>help</literal> subcommand, then you will get the list of options that you can pass to the subcommand. </para>
<para>For example:</para>
<programlisting>osgi> vsh help
bundle - Management and examination of bundle artifacts
config - Management and examination of configuration artifacts
exit - Exit the kernel shell environment
help - Get help on commands
install - Install (deploy) an artifact to the server
package - Examination of exported packages
par - Management and examination of PAR artifacts
plan - Management and examination of plan artifacts
service - Examination of services
shutdown - Shutdown Virgo Kernel
osgi> vsh help bundle
bundle list - List all bundle artifacts that are
currently installed
bundle examine [ id | name version ] - Examine a bundle artifact
bundle start [ id | name version ] - Start a bundle artifact. Starting this
artifact starts it in the OSGi
framework.
bundle stop [ id | name version ] - Stop a bundle artifact. Stopping this
artifact stops it in the OSGi
framework.
bundle refresh [ id | name version ] - Refresh a bundle artifact. Refreshing
this artifact updates its contents in
the OSGi framework.
bundle uninstall [ id | name version ] - Uninstall a bundle artifact
bundle diag [ id | name version ] - Provide diagnostics for a bundle
artifact
bundle headers [ id | name version ] - Show the headers for a bundle artifact
osgi> </programlisting>
</section>
<section id="admin-shell-vsh-exit-command">
<title>exit Subcommand</title>
<para>This returns to the Equinox console and otherwise has no effect.</para>
<para>The <literal>exit</literal> subcommand does not have any options.</para>
</section>
</section>
<section id="admin-shell-class-loading">
<title>Class Loading Commands</title>
<para>The class loading commands in @tomcat.product.name.short@ provide the ability to list all bundles that:
<itemizedlist>
<listitem><para><emphasis role="bold">contain</emphasis> a class</para></listitem>
<listitem><para><emphasis role="bold">export</emphasis> a class</para></listitem>
<listitem><para>can <emphasis role="bold">load</emphasis> a class</para></listitem>
</itemizedlist>
</para>
<section id="admin-shell-cl-using-command-list">
<title>Class Loading Commands List</title>
<para>The following table lists the class loading commands. The reference documentation about each command provides the full list of available options.</para>
<table id="admin-shell-cl-commands-table" colsep="1" frame="all" rowsep="1">
<title>Class Loading Commands</title>
<tgroup cols="2">
<thead>
<row>
<entry>Command</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="admin-shell-cl-clhas">clhas</link></entry>
<entry>Lists all bundles that <emphasis role="bold">contain</emphasis> a class.</entry>
</row>
<row>
<entry><link linkend="admin-shell-cl-clexport">clexport</link></entry>
<entry>Lists all bundles that <emphasis role="bold">export</emphasis> a class or package.</entry>
</row>
<row>
<entry><link linkend="admin-shell-cl-clload">clload</link></entry>
<entry>Lists all bundles that can <emphasis role="bold">load</emphasis> a class.</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section id="admin-shell-class-loading-reference">
<title>Class Loading Commands Reference</title>
<para>This section contains reference information about the class loading commands
<link linkend="admin-shell-cl-clhas">clhas</link>,
<link linkend="admin-shell-cl-clexport">clexport</link>, and
<link linkend="admin-shell-cl-clload">clload</link>.
</para>
<section id="admin-shell-cl-clhas">
<title>clhas command</title>
<para>Use the <literal>clhas</literal> command to list the classes contained in the bundles deployed to @tomcat.product.name.short@ and to solve class loading issues.</para>
<para>The command accepts as a parameter the fully qualified class name (in the form <emphasis>package.class</emphasis>).</para>
<para>A bundle is listed only if the class can be loaded. If the class is successfully loaded a check is made if the loading was delegated to another bundle. The command lists only the leaves in the class loading hierarchy - i.e. the bundles that actually contain the class and not the ones that delegate to another bundle via import/require mechanisms.</para>
<para>The following examples show how to use this command.</para>
<para>Use the <literal>clhas</literal> to view all bundles that contain <literal>Servlet</literal> class:</para>
<programlisting>osgi> clhas javax.servlet.Servlet
Bundles containing [javax.servlet.Servlet]:
14 com.springsource.javax.servlet</programlisting>
<para>The following example shows how to identify a possible <literal>ClassCastException</literal> due to wrong packaging:</para>
<programlisting>osgi> clhas javax.servlet.Servlet
Bundles containing [javax.servlet.Servlet]:
66 myapp
14 com.springsource.javax.servlet</programlisting>
<para>It's obvious that the <literal>javax.servlet</literal> package should not be present in <literal>myapp</literal> application and its packaging has to be changed. This problem can often be seen in WAR or web bundles that package Servlet/JSP classes by accident.</para>
</section>
<section id="admin-shell-cl-clexport">
<title>clexport command</title>
<para>Use the <literal>clexport</literal> command to list the bundles that export a class or package.</para>
<para>The command accepts as a parameter the fully qualified class name (in the form <emphasis>package.class</emphasis>).</para>
<para>Additional check if the provided class is actually contained in the bundle is performed. If the class is not found in a bundle, but its package is exported then a hint <literal>[class not found, package only]</literal> is displayed.</para>
<para>The following examples show how to use this command.</para>
<para>Use the <literal>clexport</literal> to view all bundles that contain <literal>Servlet</literal> class:</para>
<programlisting>osgi> clexport javax.servlet.Servlet
Bundles exporting [javax.servlet.Servlet]:
14 com.springsource.javax.servlet</programlisting>
<para>If a bundle exports a package but the requested class is not contained the output of the command will be similar to this:</para>
<programlisting>osgi> clexport javax.servlet.ServletX
Bundles exporting [javax.servlet.ServletX]:
14 com.springsource.javax.servlet [class not found, package only]</programlisting>
</section>
<section id="admin-shell-cl-clload">
<title>clload command</title>
<para>Use the <literal>clload</literal> command to list the bundles that can load a class or to check if a specific bundle can load a class.</para>
<para>The command accepts as a parameter either:
<itemizedlist>
<listitem><para>the fully qualified class name (in the form <emphasis>package.class</emphasis>)</para></listitem>
<listitem><para>the fully qualified class name (in the form <emphasis>package.class</emphasis>) and the symbolic name or id of the bundle that has to be tested</para></listitem>
</itemizedlist>
</para>
<para>The command lists not only the bundle that successfully loaded the class, but also the one that actually provides the class. This is visualized with hints like <literal>[exported by 14 com.springsource.javax.servlet]</literal>.</para>
<para>The following examples show how to use this command.</para>
<para>You can use the <literal>clload</literal> to view all bundles that can load <literal>Servlet</literal> class:</para>
<programlisting>osgi> clload javax.servlet.Servlet
Successfully loaded [javax.servlet.Servlet] from:
56 com.springsource.org.apache.taglibs.standard
[exported by 14 com.springsource.javax.servlet]
54 org.eclipse.virgo.apps.admin.web
[exported by 14 com.springsource.javax.servlet]
19 com.springsource.org.apache.commons.fileupload
[exported by 14 com.springsource.javax.servlet]
&lt;... remainder omitted ...&gt;</programlisting>
<para>If a bundle has to be tested, then its id can be used as a command parameter:</para>
<programlisting>osgi> clload javax.servlet.Servlet 19
Successfully loaded [javax.servlet.Servlet] using class loader from:
19 com.springsource.org.apache.commons.fileupload
[exported by 14 com.springsource.javax.servlet]</programlisting>
<para>Or the same class load test with the symbolic name of the bundle:</para>
<programlisting>osgi> clload javax.servlet.Servlet com.springsource.org.apache.commons.fileupload
Successfully loaded [javax.servlet.Servlet] using class loader from:
19 com.springsource.org.apache.commons.fileupload
[exported by 14 com.springsource.javax.servlet]</programlisting>
</section>
</section>
</chapter>