blob: 230ad5cdb879dd5afa521d0a4cce50f5df809cbb [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.11.1 from src/site/markdown/bundle-installation.md at 2022-08-21
| Rendered using Apache Maven Fluido Skin 1.11.1
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
<title>Apache Sling Maven Plugin &#x2013; Bundle Installation/Uninstallation</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.11.1.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script src="./js/apache-maven-fluido-1.11.1.min.js"></script>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org";
_paq.push(['setTrackerUrl', u+'/matomo.php']);
_paq.push(['setSiteId', '6']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<style>.github-fork-ribbon:before { background-color: gray; }</style>
</head>
<body class="topBarDisabled">
<a class="github-fork-ribbon right-top" href="https://github.com/apache/sling-maven-plugin" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-fluid">
<header>
<div id="banner">
<div class="pull-left"><a href="https://sling.apache.org/" id="bannerLeft"><img src="https://sling.apache.org/res/logos/sling.svg" alt="Apache Sling" style="width: 123px; height: 63px;" /></a></div>
<div class="pull-right"><a href="https://apache.org/" id="bannerRight"><img src="https://sling.apache.org/res/logos/apache.png" alt="Apache" style="" /></a></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class=""><a href="https://sling.apache.org/" class="externalLink" title="Apache Sling">Apache Sling</a><span class="divider">/</span></li>
<li class=""><a href="https://sling.apache.org/components/" class="externalLink" title="Maven Plugins">Maven Plugins</a><span class="divider">/</span></li>
<li class=""><a href="index.html" title="Apache Sling Maven Plugin">Apache Sling Maven Plugin</a><span class="divider">/</span></li>
<li class="active ">Bundle Installation/Uninstallation <a href="https://github.com/apache/sling-maven-plugin/src/site/markdown/bundle-installation.md"><img src="./images/accessories-text-editor.png" title="Edit" /></a></li>
<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2022-08-21</li>
<li id="projectVersion" class="pull-right">Version: 3.0.2</li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Overview</li>
<li><a href="index.html" title="Introduction"><span class="none"></span>Introduction</a></li>
<li class="active"><a><span class="none"></span>Bundle Installation</a></li>
<li><a href="plugin-info.html" title="Goals"><span class="none"></span>Goals</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10" >
<h1>Bundle Installation/Uninstallation</h1>
<p>There are three different installation approaches supported by the plugin which behave differently for the installation and uninstallation. In the following section all mechanisms are outlined individually for both use cases.</p>
<ul>
<li><a href="#Deploy.2FUpload.2FInstall">Deploy/Upload/Install</a>
<ul>
<li><a href="#Felix_Web_Console">Felix Web Console</a></li>
<li><a href="#WebDAV_PUT">WebDAV PUT</a></li>
<li><a href="#Sling_POST_Servlet">Sling POST Servlet</a></li></ul></li>
<li><a href="#Undeploy.2FUninstall">Undeploy/Uninstall</a>
<ul>
<li><a href="#Felix_Web_Console">Felix Web Console</a></li>
<li><a href="#WebDAV_PUT">WebDAV PUT</a></li>
<li><a href="#Sling_POST_Servlet">Sling POST Servlet</a></li></ul></li>
<li><a href="#Intermediate_Resources">Intermediate Resources</a></li></ul>
<section>
<h2><a name="Deploy.2FUpload.2FInstall"></a>Deploy/Upload/Install</h2><section>
<h3><a name="Felix_Web_Console"></a>Felix Web Console</h3>
<p>The plugin by default places an <i>HTTP POST</i> request to the <a class="externalLink" href="https://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html#post-requests">Felix Web Console</a>. This will achieve both upload and installation of the bundle in one request <i>synchronously</i>.</p></section><section>
<h3><a name="WebDAV_PUT"></a>WebDAV PUT</h3>
<p>It's also possible to use <i>HTTP PUT</i> instead of POST leveraging the <a class="externalLink" href="https://sling.apache.org/documentation/development/repository-based-development.html">WebDAV bundle from Sling</a>. This will create a new JCR node containing the OSGi bundle in the underlying repository.
From there it needs to be picked up by the <a class="externalLink" href="https://sling.apache.org/documentation/bundles/jcr-installer-provider.html">JCR Installer</a> to be actually installed in the OSGi container. The latter happens <i>asynchronously</i>. It is important that the bundle resource is uploaded to a location of the repository which is actually watched by the JCR installer (by default only resources below a resource called <code>install</code>).</p></section><section>
<h3><a name="Sling_POST_Servlet"></a>Sling POST Servlet</h3>
<p>Since version 2.1.8 you can also leverage the <a class="externalLink" href="https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html">Sling POST servlet</a> for uploading the bundle to the repository. The subsequent installation is being performed <i>asynchronously</i> by the JCR Installer (similar to the WebDAV PUT approach).</p></section></section><section>
<h2><a name="Undeploy.2FUninstall"></a>Undeploy/Uninstall</h2><section>
<h3><a name="Felix_Web_Console"></a>Felix Web Console</h3>
<p>Places an <i>HTTP POST</i> request to the <a class="externalLink" href="https://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html#post-requests">Felix Web Console</a>. This will achieve
uninstallation of the bundle <i>synchronously</i>.</p></section><section>
<h3><a name="WebDAV_PUT"></a>WebDAV PUT</h3>
<p>An <i>HTTP DELETE</i> request is issued which is handled by the <a class="externalLink" href="https://sling.apache.org/documentation/development/repository-based-development.html">WebDAV bundle from Sling</a>. This will remove the JCR node containing the OSGi bundle in the underlying repository.
From there it needs to be picked up by the <a class="externalLink" href="https://sling.apache.org/documentation/bundles/jcr-installer-provider.html">JCR Installer</a> to be actually uninstalled in the OSGi container. The latter happens <i>asynchronously</i>.</p></section><section>
<h3><a name="Sling_POST_Servlet"></a>Sling POST Servlet</h3>
<p>An <i>HTTP DELETE</i> request is issued which is handled by the <a class="externalLink" href="https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html">Sling POST servlet</a>. This will remove the resource containing the OSGi bundle in the underlying repository. The subsequent uninstallation is being performed <i>asynchronously</i> by the JCR Installer (similar to the WebDAV PUT approach).</p></section></section><section>
<h2><a name="Intermediate_Resources"></a>Intermediate Resources</h2>
<p>For both WebDAV PUT and Sling POST servlet installation, intermediate resources (i.e. non-existing parent resources)
are automatically created. The primary type of those intermediate nodes depend on the deployment method (only applicable if the JCR resource provider is used)</p>
<ul>
<li><b>WebDAV PUT</b>, uses the configured collection node type, by default <code>sling:Folder</code> (see also <a class="externalLink" href="https://sling.apache.org/documentation/development/repository-based-development.html">WebDAV Configuration</a>)</li>
<li><b>Sling POST Servlet</b>, uses internally <code>ResourceResolverFactory.create(...)</code> without setting any <code>jcr:primaryType</code>. Therefore the <code>JcrResourceProviderFactory</code> will call <code>Node.addNode(String relPath)</code> which determines a suitable
node type automatically, depending on the parent's node type definition (see <a class="externalLink" href="https://s.apache.org/jcr-2.0-javadoc/javax/jcr/Node.html#addNode(java.lang.String)">JCR Node Javadoc</a>).</li>
</ul>
<p>In most of the cases the intermediate node is of type <code>sling:Folder</code>, as this is the first allowed child node definition for node type <code>sling:Folder</code>. This may only differ if your existing parent node is not of type <code>sling:Folder</code> itself.</p></section>
</main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>&#169; 2022
<a href="https://www.apache.org/">The Apache Software Foundation</a> &vert; <a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy Policy</a>
</p>
</div>
</div>
</footer>
<script>
if(anchors) {
anchors.add();
}
</script>
</body>
</html>