fabric3
Content
Documentation
Developer Reference
Packaging
Service Configuration Files
Service Configuration Files
search
attachments
weblink
advanced
image-effects
image-attributes
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
Colour picker
More colours
Formatting
Strikethrough
Subscript
Superscript
Monospace
Clear formatting
Bullet list
Numbered list
Task list
Outdent
Indent
Align left
Align center
Align right
Page layout
Link
Table
Insert
Insert content
Files and images
Link
Symbol
Emoticon
Markup
Horizontal rule
Insert macro
User mention
Jira Issue/Filter
Info
Status
Gallery
Table of Contents
Jira timeline
Lucidchart Diagrams
Trello Board
Other macros
Page layout
No layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Find/Replace
Keyboard shortcuts help
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account.
<h2>Overview</h2><p>Component properties are the primary mechanism for adding configuration to an application. Property values can be defined in a composite file or DSL. However, in many cases, property values need to be modified without opening a contribution archive. Fabric3 supports the ability to define property values in XML files that are deployed external to the contribution that references them.</p><h2>Defining External Property Values with Annotations</h2><p>External property values are specified using an XPath expression that points to a value in an XML file. With Java annotations, this is done using the <code>Source</code> annotation:</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="language=java" data-macro-schema-version="1" style="background-image: url(https://fabric3.atlassian.net/wiki/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bGFuZ3VhZ2U9amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>@Component(namespaces = {@Namespace(prefix = "foo", uri = "urn:foo")}) public class ComponentImpl implements ... { @Property @Source("$app//foo:configuration/@installation.id") protected String installationId; }</pre></td></tr></table><p>The <code>Source</code> annotation defines a configuration file, <code>app.xml</code>, located in the runtime's <code>config</code> directory (<code><image>/runtimes/<name>/config</code>) that contains the value for the <code>installationId</code> property. The <code>app.xml</code> file could be similar to the following:</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="language=xml" data-macro-schema-version="1" style="background-image: url(https://fabric3.atlassian.net/wiki/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bGFuZ3VhZ2U9eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre><configuration xmlns:foo="urn:foo" installationId="test id"> </configuration> </pre></td></tr></table><p>The XPath expression can also point to arbitrarily nested elements in a configuration file. Also note the use of namespaces. The <code>Namespace</code> attribute on the <code>Component</code> annotation is used to define a namespace to use when applying the XPath expression.</p><h2>Defining External Property Values with Composites</h2><p>A property source can also be defined using XML-based composites:</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="language=xml" data-macro-schema-version="1" style="background-image: url(https://fabric3.atlassian.net/wiki/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bGFuZ3VhZ2U9eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre><composite ... xmlns:f3-samples="urn:samples.fabric3.org"> <component name="GatewayService"> <implementation.java class="..."/> <property name="interval" source="$app//f3-samples:gateway/@timeout"/> </component> </composite> </pre></td></tr></table><p>The above example configures a property value to be sourced from the <em>timeout</em> attribute of the <em>gateway</em> element defined in the <em>app</em> XML file. External configuration files must use the <em>f3:</em>config root element to define a name (in this case "app") and target namespace:</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="language=xml" data-macro-schema-version="1" style="background-image: url(https://fabric3.atlassian.net/wiki/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bGFuZ3VhZ2U9eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre><config xmlns="urn:fabric3.org" name="app" targetNamespace="urn:samples.fabric3.org"> <gateway timeout="100"/> </config></pre></td></tr></table><p>The app XML file is deployed separately from the contribution containing the <code>Gateway</code> component. Note that it is possible for multiple components to reference parts of the same external configuration file.</p><p> </p><h2> </h2>
Save
Close
Edit
Preview
View changes
Revert to last published version
{"serverDuration": 265, "requestCorrelationId": "7f8993b1da4c4b0d8edda6172611d1f5"}