Appendix A. Editing Profiles with the Built-In Text Editor

Abstract

When you have a lot of changes and additions to make to a profile's configuration, it is usually more convenient to do this interactively, using the built-in text editor for profiles. The editor can be accessed by entering the profile-edit command with no arguments except for the profile's name (and optionally, version); or adding the --pid option for editing OSGi PID properties; or adding the --resource option for editing general resources.

A.1. Editing Agent Properties

Overview

This section explains how to use the built-in text editor to modify a profile's agent properties, which are mainly used to define what bundles and features are deployed by the profile.

Open the agent properties resource

To start editing a profile's agent properties using the built-in text editor, enter the following console command:
JBossFuse:karaf@root> profile-edit Profile [Version]
Where Profile is the name of the profile to edit and you can optionally specify the profile version, Version, as well. The text editor opens in the console window, showing the current profile name and version in the top-left corner of the Window. The bottom row of the editor screen summarizes the available editing commands and you can use the arrow keys to move about the screen.

Specifying feature repository locations

To specify the location of a feature repository, add a line in the following format:
repository.ID=URL
Where ID is an arbitrary unique identifier and URL gives the location of a single feature repository (only one repository URL can be specified on a line).

Specifying deployed features

To specify a feature to deploy (which must be available from one of the specified feature repositories), add a line in the following format:
feature.ID=FeatureName
Where ID is an arbitrary unique identifier and FeatureName is the name of a feature.

Specifying deployed bundles

To specify a bundle to deploy, add a line in the following format:
bundle.ID=URL
Where ID is an arbitrary unique identifier and URL specifies the bundle's location.
Note
A bundle entry can be used in combination with a blueprint: (or spring:) URL handler to deploy a Blueprint XML resource (or a Spring XML resource) as an OSGi bundle.

Specifying bundle overrides

To specify a bundle override, add a line in the following format:
override.ID=URL
Where ID is an arbitrary unique identifier and URL specifies the bundle's location.
Note
A bundle override is used to override a bundle installed by a feature, replacing it with a different version of the bundle. For example, this functionality is used by the patching system to install a patched bundle in a container.

Specifying etc/config.properties properties

To specify Java system properties that affect the Apache Karaf container (analogous to editing etc/config.properties in a standalone container), add a line in the following format:
config.Property=Value

Specifying etc/system.properties properties

To specify Java system properties that affect the bundles deployed in the container (analogous to editing etc/system.properties in a standalone container), add a line in the following format:
system.Property=Value
If the system property, Property, is already set at the JVM level (for example, through the --jvm-opts option to the fabric:container-create command), the preceding fabric:profile-edit command will not override the JVM level setting. To override a JVM level setting, set the system property as follows:
system.karaf.override.Property=Value

Specifying libraries to add to Java runtime lib/

To specify a Java library to deploy (equivalent to adding a library to the lib/ directory of the underlying Java runtime), add a line in the following format:
lib.ID=URL
Where ID is an arbitrary unique identifier and URL specifies the library's location.

Specifying libraries to add to Java runtime lib/ext/

To specify a Java extension library to deploy (equivalent to adding a library to the lib/ext/ directory of the underlying Java runtime), add a line in the following format:
ext.ID=URL
Where ID is an arbitrary unique identifier and URL specifies the extension library's location.

Specifying libraries to add to Java runtime lib/endorsed/

To specify a Java endorsed library to deploy (equivalent to adding a library to the lib/endorsed/ directory of the underlying Java runtime), add a line in the following format:
endorsed.ID=URL
Where ID is an arbitrary unique identifier and URL specifies the endorsed library's location.

Example

To open the mq-client profile's agent properties for editing, enter the following console command:
JBossFuse:karaf@root> profile-edit mq-client
The text editor starts up, and you should see the following screen in the console window:
Profile:mq-client 1.0                                                                 L:1 C:1
#
# Copyright (C) Red Hat, Inc.
# http://redhat.com
#
# 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.
#

repository.activemq=mvn:org.apache.activemq/activemq-karaf/${version:activemq}/xml/features
repository.karaf-standard=mvn\:org.apache.karaf.assemblies.features/standard/${version:karaf}/
xml/features

     ^X Quit    ^S Save    ^Z Undo    ^R Redo    ^G Go To    ^F Find    ^N Next    ^P Previous
Type ^X to quit the text editor and get back to the console prompt.