//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

=== Installation

This chapter describes how to install Apache Karaf Cave into an existing Apache Karaf instance.

==== Pre-installation requirements

As Apache Karaf Cave is a Apache Karaf sub-project, it has to be installed into a running Apache Karaf instance.

Apache Karaf Cave is available as Apache Karaf features. The easiest way to install is just to have an internet
connection from the Apache Karaf running instance.

Apache Karaf Cave 4.0.x is designed to work on Apache Karaf 4.0.x.

==== Registration of the Apache Karaf Cave features

Simply register the Apache Karaf Cave features URL in your Apache Karaf instance:

----
karaf@root()> feature:repo-add cave 4.0.0
Adding feature url mvn:org.apache.karaf.cave/apache-karaf-cave/4.0.0/xml/features
----

Now Apache Karaf Cave features are available, ready to be installed:

----
karaf@root()> feature:list|grep -i cave
cave-server                     | 4.0.0                   |          | Uninstalled | karaf-cave-4.0.0 |
cave-storage                    | 4.0.0                   |          | Uninstalled | karaf-cave-4.0.0 |
cave-http                       | 4.0.0                   |          | Uninstalled | karaf-cave-4.0.0 |
cave-rest                       | 4.0.0                   |          | Uninstalled | karaf-cave-4.0.0 |
cave-maven                      | 4.0.0                   |          | Uninstalled | karaf-cave-4.0.0 |
----

==== Starting Apache Karaf Cave Server

The Apache Karaf Cave Server is installed by the 'cave-server' feature:

----
karaf@root()> feature:install cave-server
----

The cave-server feature is a meta-feature which actually installs:

* cave-storage feature providing the Cave filesystem default storage.
* cave-http feature providing the Cave HTTP service allowing a remote access to the repositories.
* cave-rest feature providing the Cave REST API allowing to manipulate the repository remotely with any REST HTTP client.
* cave-maven feature providing a complete Maven repository for the Cave repositories.

After the installation of the cave-server feature, new commands are available:

----
karaf@root()> cave:<TAB>
cave:repositories            cave:repository-create       cave:repository-destroy
cave:repository-install      cave:repository-populate     cave:repository-proxy
cave:repository-uninstall    cave:repository-update       cave:repository-upload
----
