blob: e0999e32ebd9d40d1896624b762dd45549a0affa [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>10.&nbsp;The Provisioning Repository</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo User Guide"><link rel="up" href="index.html" title="Virgo User Guide"><link rel="prev" href="ch09s02.html" title="9.2&nbsp;Typical Admin Console Use Cases"><link rel="next" href="ch10s02.html" title="10.2&nbsp;Downloading Bundles from the SpringSource Enterprise Bundle Repository"><!--Begin Google Analytics code--><script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2728886-3");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">10.&nbsp;The Provisioning Repository</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch10s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="repository"></a>10.&nbsp;The Provisioning Repository</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="repository-introduction"></a>10.1&nbsp;Overview of the Provisioning Repository</h2></div></div></div><p>
This section describes the provisioning repository feature of Virgo, the reasons for using it, and how to configure it.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.gif"></td><th align="left">Note</th></tr><tr><td align="left" valign="top">
This section is not applicable to Virgo Nano. The provisioning mechanism used there is p2.
</td></tr></table></div><p>
</p><p>
In most use cases, your application has a dependency on one or more separate artifacts; these artifacts might include OSGi bundles, configuration artifacts, third-party libraries, PARs or plans. A typical example is a Spring application that depends on a third-party library such as Spring Framework or Hibernate.
</p><p>
The way you express this dependency depends on the artifact. For example, a plan is by definition a list of dependent bundles.
</p><p>
Libraries are another example. Some third-party dependencies consist of multiple bundles but are logically one unit. To support this, Virgo has a concept of a library. A library is a collection of related bundles that can be referenced as a whole. You typically express the dependencies between your application and third-party libraries using the <code class="literal">Import-Package</code>, <code class="literal">Import-Bundle</code>, or <code class="literal">Import-Library</code> manifest header in the <code class="literal">MANIFEST.MF</code> file of your application. The <code class="literal">Import-Package</code> header is standard to OSGi; <code class="literal">Import-Bundle</code> and <code class="literal">Import-Library</code>, however, are specific to Virgo.
</p><p>
For additional details about the creation and usage of libraries, as well as general information about dependencies, see <a class="ulink" href="../../virgo-programmer-guide/html/index.html" target="_top">Programmer&#8217;s Guide</a>.
</p><p>
In Virgo, you store all third-party dependencies required by your applications, such as Spring Framework and Hibernate, as artifacts in the provisioning repository. As mentioned above, you can store the following types of artifacts in the repository:
</p><div class="itemizedlist"><ul type="disc"><li>OSGi bundles</li><li>Libraries</li><li>PARs</li><li>Plans</li><li>Configuration Artifacts</li></ul></div><p>
When you deploy your application, Virgo installs the bundle(s) comprising the application to the Virgo runtime; part of this internal installation procedure is to satisfy all the application&#8217;s dependencies. If your application has a dependency that cannot be satisfied from the bundles that you have already deployed (and Virgo has thus installed), then Virgo searches the provisioning repository for an artifact that can satisfy that dependency.
</p><p>
The provisioning repository for a particular instance of Virgo can include artifacts in the following general locations:
</p><div class="itemizedlist"><ul type="disc"><li>Local: This means that artifacts have been physically installed in the provisioning repository directory structure of the local Virgo instance. The artifacts in a local repository include installed third-party libraries, bundles supplied by Virgo, bundles supplied by an end user, and internal bundles used only by Virgo. You can further categorize this location into <code class="literal">external</code> directories that adhere to a specified search pattern and are scanned by Virgo just on a clean startup, or <code class="literal">watched</code> directories that point to a single directory location and which Virgo scans on a regular basis. </li><li>Remote: This means that a local instance of Virgo gets the artifact from a remotely-hosted repository that is physically located on a remote Virgo Server for Apache Tomcat instance. </li></ul></div><p>
You configure the provisioning repository using the <code class="literal">$SERVER_HOME/configuration/org.eclipse.virgo.repository.properties</code> file.
</p><p> As previously described, a particular instance of Virgo Server for Apache Tomcat can itself also act as a repository host for remote server instances to use when satisfying the dependencies of the applications deployed to it. In this case, you configure a hosted repository using the <code class="literal">$SERVER_HOME/configuration/org.eclipse.virgo.apps.repository.properties</code> file. Typically, only remote clients use hosted repositories and their contents; the Virgo Server for Apache Tomcat instance that actually hosts the repository does not typically use the artifacts in it. Rather, it uses artifacts in its local repository.
</p><p>
Making a third-party dependency available to your application is simply a matter of adding its artifact to the appropriate location in the provisioning repository. This could be either in the local directories or the remote ones if you are getting artifacts from a remotely-hosted repository.
</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="repository-structure"></a>Local Repository Structure</h3></div></div></div><p>
When you first install Virgo, the local provisioning repository is located at <code class="literal">$SERVER_HOME/repository</code> by default and consists of two main directories: <code class="literal">ext</code> and <code class="literal">usr</code>. The <code class="literal">ext</code> directory contains artifacts supplied with the Virgo and <code class="literal">usr</code> contains artifacts supplied by the user and is initially empty.
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="repository-installing-bundles"></a>Installing Artifacts to a Repository</h3></div></div></div><p>
To install an artifact into the default repository, simply copy it into the <code class="literal">$SERVER_HOME/repository/usr</code> directory.
</p><p>If you have configured additional watched or external repositories (additional, that is, to the default ones already configured in a freshly-installed Virgo instance), you install the artifacts in the same way: simply copy the files to the configured directories. You configure additional watched or external repositories in the same file as the default repositories: <code class="literal">$SERVER_HOME/configuration/org.eclipse.virgo.repository.properties</code>.
</p><p>When you install a plan or a library into the repository, you must ensure that all referenced artifacts within the plan or library have been installed as well.
</p><p>Artifacts must have unique names so it is considered best practice to include the version number in the file name,
allowing for multiple versions of the artifact to be installed at the same time. For example, a bundle file name might be <code class="literal">my-exciting-bundle.2.1.0.jar</code>.
</p><p>
For watched repositories, such as <code class="literal">$SERVER_HOME/repository/usr</code>, Virgo automatically detects changes
at runtime, thereby avoiding the need to restart Virgo.
</p><p>
Of specific relevance during development is picking up changes to an application&#8217;s direct dependencies during deployment of the application. For example, if you deploy an application and receive a message that a dependency is missing, you can simply add the dependency to the repository and then redeploy the application. The redeploy will cause the new dependency to be picked up, allowing progress to be made without restarting Virgo. For other changes such as addition of optional dependencies, Virgo must be restarted to pick up any changes to the provisioning repository.
</p></div></div></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript">
_lf_cid = "LF_48be82fa";
_lf_remora();
</script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s02.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch10s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.2&nbsp;Typical Admin Console Use Cases&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;10.2&nbsp;Downloading Bundles from the SpringSource Enterprise Bundle Repository</td></tr></table></div></body></html>