A.3. Editing Other Resources
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
In addition to agent properties and PID properties, the built-in text editor makes it possible for you edit any resource associated with a profile. This is particularly useful, if you need to store additional configuration files in a profile. The extra configuration files can be stored as profile resources (which are stored in a Fabric server's built-in Git repository) and then can be accessed by your applications at run time.
Creating and editing an arbitrary resource Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
You can create and edit arbitrary profile resources using the following command syntax:
JBossFuse:karaf@root> profile-edit --resource Resource Profile [Version]
JBossFuse:karaf@root> profile-edit --resource Resource Profile [Version]
Where
Resource
is the name of the profile resource you want to edit. If Resource
does not already exist, it will be created.
broker.xml example Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
For example, the
mq-base
profile has the broker.xml
resource, which stores the contents of an Apache ActiveMQ broker configuration file. To edit the broker.xml
resource, enter the following console command:
JBossFuse:karaf@root> profile-edit --resource broker.xml mq-base 1.0
JBossFuse:karaf@root> profile-edit --resource broker.xml mq-base 1.0
The text editor starts up, and you should see the following screen in the console window:
Any changes you make to this file will take effect whenever the broker restarts.
Type
^X
to quit the text editor and get back to the console prompt.
Referencing a profile resource Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
In order to use an arbitrary profile resource, you must be able to reference it. You can use the profile URL to access resources stored under the current profile or parent profile. It has the following format:
For example, the default profile provides the jetty.xml resource and this resource is accessed by setting the
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
profile:ResourceName
A key characteristic of the profile URL is that the location of a resource can change dynamically at run time, as follows:
- The profile URL handler first tries to find the named resource,
ResourceName
, in the current version of the current profile (where the current version is a property of the container in which the profile is running). - If the specified resource is not found under the current profile, the profile URL tries to find the resource in the current version of the parent profile.
org.ops4j.pax.web.config.url=${profile:jetty.xml}
org.ops4j.pax.web.config.url=${profile:jetty.xml}