--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-properties version: 1.1.9 group: io.fabric8.funktion.connector name: properties data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: properties spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: properties spec: containers: - image: fabric8/connector-properties:1.1.9 name: connector schema.yml: | --- component: kind: component scheme: properties syntax: properties:key title: Properties description: The properties component is used for using property placeholders in endpoint uris. label: core,endpoint deprecated: false async: false javaType: org.apache.camel.component.properties.PropertiesComponent groupId: org.apache.camel artifactId: camel-core version: 2.18.1 componentProperties: locations: kind: property type: array javaType: java.lang.String[] deprecated: false secret: false description: A list of locations to load properties. You can use comma to separate multiple locations. This option will override any default locations and only use the locations from this option. location: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: A list of locations to load properties. You can use comma to separate multiple locations. This option will override any default locations and only use the locations from this option. encoding: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Encoding to use when loading properties file from the file system or classpath. If no encoding has been set then the properties files is loaded using ISO-8859-1 encoding (latin-1) as documented by link java.util.Propertiesload(java.io.InputStream) propertiesResolver: kind: property type: object javaType: org.apache.camel.component.properties.PropertiesResolver deprecated: false secret: false description: To use a custom PropertiesResolver propertiesParser: kind: property type: object javaType: org.apache.camel.component.properties.PropertiesParser deprecated: false secret: false description: To use a custom PropertiesParser cache: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether or not to cache loaded properties. The default value is true. propertyPrefix: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Optional prefix prepended to property names before resolution. propertySuffix: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Optional suffix appended to property names before resolution. fallbackToUnaugmentedProperty: kind: property type: boolean javaType: boolean deprecated: false secret: false description: If true first attempt resolution of property name augmented with propertyPrefix and propertySuffix before falling back the plain property name specified. If false only the augmented property name is searched. ignoreMissingLocation: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether to silently ignore if a location cannot be located such as a properties file not found. prefixToken: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Sets the value of the prefix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_PREFIX_TOKEN). suffixToken: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Sets the value of the suffix token used to identify properties to replace. Setting a value of null restores the default token (link link DEFAULT_SUFFIX_TOKEN). initialProperties: kind: property type: object javaType: java.util.Properties deprecated: false secret: false description: Sets initial properties which will be used before any locations are resolved. overrideProperties: kind: property type: object javaType: java.util.Properties deprecated: false secret: false description: Sets a special list of override properties that take precedence and will use first if a property exist. systemPropertiesMode: kind: property type: integer javaType: int deprecated: false secret: false description: Sets the system property mode. properties: key: kind: path group: common required: true type: string javaType: java.lang.String deprecated: false secret: false description: Property key to use as placeholder ignoreMissingLocation: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to silently ignore if a location cannot be located such as a properties file not found. locations: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false description: A list of locations to load properties. You can use comma to separate multiple locations. This option will override any default locations and only use the locations from this option. bridgeErrorHandler: kind: parameter group: consumer label: consumer type: boolean javaType: boolean optionalPrefix: consumer. deprecated: false secret: false defaultValue: false description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored. exceptionHandler: kind: parameter group: consumer (advanced) label: consumer,advanced type: object javaType: org.apache.camel.spi.ExceptionHandler optionalPrefix: consumer. deprecated: false secret: false description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored. exchangePattern: kind: parameter group: consumer (advanced) label: consumer,advanced type: string javaType: org.apache.camel.ExchangePattern enum: - InOnly - RobustInOnly - InOut - InOptionalOut - OutOnly - RobustOutOnly - OutIn - OutOptionalIn deprecated: false secret: false description: Sets the default exchange pattern when creating an exchange. synchronous: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). documentation.adoc: "[[Properties-PropertiesComponent]]\nProperties Component\n\ ~~~~~~~~~~~~~~~~~~~~\n\n*Available as of Camel 2.3*\n\n[[Properties-URIformat]]\n\ URI format\n^^^^^^^^^^\n\n[source]\n----\nproperties:key[?options]\n----\n\n\ Where *key* is the key for the property to lookup\n\n[[Properties-Options]]\n\ Options\n^^^^^^^\n\n// component options: START\nThe Properties component supports\ \ 15 options which are listed below.\n\n\n\n{% raw %}\n[width=\"100%\",cols=\"\ 2,1m,7\",options=\"header\"]\n|=======================================================================\n\ | Name | Java Type | Description\n| locations | String[] | A list of locations\ \ to load properties. You can use comma to separate multiple locations. This\ \ option will override any default locations and only use the locations from\ \ this option.\n| location | String | A list of locations to load properties.\ \ You can use comma to separate multiple locations. This option will override\ \ any default locations and only use the locations from this option.\n| encoding\ \ | String | Encoding to use when loading properties file from the file system\ \ or classpath. If no encoding has been set then the properties files is loaded\ \ using ISO-8859-1 encoding (latin-1) as documented by link java.util.Propertiesload(java.io.InputStream)\n\ | propertiesResolver | PropertiesResolver | To use a custom PropertiesResolver\n\ | propertiesParser | PropertiesParser | To use a custom PropertiesParser\n|\ \ cache | boolean | Whether or not to cache loaded properties. The default value\ \ is true.\n| propertyPrefix | String | Optional prefix prepended to property\ \ names before resolution.\n| propertySuffix | String | Optional suffix appended\ \ to property names before resolution.\n| fallbackToUnaugmentedProperty | boolean\ \ | If true first attempt resolution of property name augmented with propertyPrefix\ \ and propertySuffix before falling back the plain property name specified.\ \ If false only the augmented property name is searched.\n| ignoreMissingLocation\ \ | boolean | Whether to silently ignore if a location cannot be located such\ \ as a properties file not found.\n| prefixToken | String | Sets the value of\ \ the prefix token used to identify properties to replace. Setting a value of\ \ null restores the default token (link link DEFAULT_PREFIX_TOKEN).\n| suffixToken\ \ | String | Sets the value of the suffix token used to identify properties\ \ to replace. Setting a value of null restores the default token (link link\ \ DEFAULT_SUFFIX_TOKEN).\n| initialProperties | Properties | Sets initial properties\ \ which will be used before any locations are resolved.\n| overrideProperties\ \ | Properties | Sets a special list of override properties that take precedence\ \ and will use first if a property exist.\n| systemPropertiesMode | int | Sets\ \ the system property mode.\n|=======================================================================\n\ {% endraw %}\n// component options: END\n\n\n// endpoint options: START\nThe\ \ Properties component supports 7 endpoint options which are listed below:\n\ \n{% raw %}\n[width=\"100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\ | Name | Group | Default | Java Type | Description\n| key | common | | String\ \ | *Required* Property key to use as placeholder\n| ignoreMissingLocation |\ \ common | false | boolean | Whether to silently ignore if a location cannot\ \ be located such as a properties file not found.\n| locations | common | |\ \ String | A list of locations to load properties. You can use comma to separate\ \ multiple locations. This option will override any default locations and only\ \ use the locations from this option.\n| bridgeErrorHandler | consumer | false\ \ | boolean | Allows for bridging the consumer to the Camel routing Error Handler\ \ which mean any exceptions occurred while the consumer is trying to pickup\ \ incoming messages or the likes will now be processed as a message and handled\ \ by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler\ \ to deal with exceptions that will be logged at WARN/ERROR level and ignored.\n\ | exceptionHandler | consumer (advanced) | | ExceptionHandler | To let the\ \ consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler\ \ is enabled then this options is not in use. By default the consumer will deal\ \ with exceptions that will be logged at WARN/ERROR level and ignored.\n| exchangePattern\ \ | consumer (advanced) | | ExchangePattern | Sets the default exchange pattern\ \ when creating an exchange.\n| synchronous | advanced | false | boolean | Sets\ \ whether synchronous processing should be strictly used or Camel is allowed\ \ to use asynchronous processing (if supported).\n|=======================================================================\n\ {% endraw %}\n// endpoint options: END\n\n\n[TIP]\n**Resolving property from\ \ Java code** +\nYou can use the method `resolvePropertyPlaceholders` on the\n\ `CamelContext` to resolve a property from any Java code.\n\n[[Properties-UsingPropertyPlaceholder]]\n\ Using PropertyPlaceholder\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n*Available as of Camel\ \ 2.3*\n\nCamel now provides a new `PropertiesComponent` in *camel-core* which\n\ allows you to use property placeholders when defining Camel\nlink:endpoint.html[Endpoint]\ \ URIs.\n\nThis works much like you would do if using Spring's\n``\ \ tag. However Spring have a limitation which\nprevents 3rd party frameworks\ \ to leverage Spring property placeholders\nto the fullest. See more at\nlink:how-do-i-use-spring-property-placeholder-with-camel-xml.html[How\ \ do\nI use Spring Property Placeholder with Camel XML].\n\n[TIP]\n**Bridging\ \ Spring and Camel property placeholders** +\nFrom Camel 2.10 onwards, you can\ \ bridge the Spring property placeholder\nwith Camel, see further below for\ \ more details.\n\nThe property placeholder is generally in use when doing:\n\ \n* lookup or creating endpoints\n* lookup of beans in the link:registry.html[Registry]\n\ * additional supported in Spring XML (see below in examples)\n* using Blueprint\ \ PropertyPlaceholder with Camel\nlink:properties.html[Properties] component\n\ * using `@PropertyInject` to inject a property in a POJO\n* *Camel 2.14.1* Using\ \ default value if a property does not exists\n* *Camel 2.14.1* Include out\ \ of the box functions, to lookup property\nvalues from OS environment variables,\ \ JVM system properties, or the\nservice idiom.\n* *Camel 2.14.1* Using custom\ \ functions, which can be plugged into the\nproperty component.\n\n[[Properties-Syntax]]\n\ Syntax\n^^^^^^\n\nThe syntax to use Camel's property placeholder is to use `{{key}}`\ \ for\nexample `{{file.uri}}` where `file.uri` is the property key.\n\nYou can\ \ use property placeholders in parts of the endpoint URI's which\nfor example\ \ you can use placeholders for parameters in the URIs.\n\nFrom??**Camel 2.14.1**\ \ onwards you can specify a default value to use if\na property with the key\ \ does not exists, eg??`file.url:/some/path` where\nthe default value is the\ \ text after the colon (eg /some/path).\n\nNOTE: Do not use colon in the property\ \ key. The colon is used as a separator\ntoken when you are providing a default\ \ value, which is supported from\n*Camel 2.14.1* onwards.\n\n[[Properties-PropertyResolver]]\n\ PropertyResolver\n^^^^^^^^^^^^^^^^\n\nCamel provides a pluggable mechanism which\ \ allows 3rd part to provide\ntheir own resolver to lookup properties. Camel\ \ provides a default\nimplementation\n`org.apache.camel.component.properties.DefaultPropertiesResolver`\ \ which\nis capable of loading properties from the file system, classpath or\n\ link:registry.html[Registry]. You can prefix the locations with either:\n\n\ * `ref:` *Camel 2.4:* to lookup in the link:registry.html[Registry]\n* `file:`\ \ to load the from file system\n* `classpath:` to load from classpath (this\ \ is also the default if no\nprefix is provided)\n* `blueprint:` *Camel 2.7:*\ \ to use a specific OSGi blueprint placeholder\nservice\n\n[[Properties-Defininglocation]]\n\ Defining location\n^^^^^^^^^^^^^^^^^\n\nThe `PropertiesResolver` need to know\ \ a location(s) where to resolve the\nproperties. You can define 1 to many locations.\ \ If you define the\nlocation in a single String property you can separate multiple\ \ locations\nwith comma such as:\n\n[source,java]\n----\npc.setLocation(\"com/mycompany/myprop.properties,com/mycompany/other.properties\"\ );\n----\n\n[[Properties-Usingsystemandenvironmentvariablesinlocations]]\nUsing\ \ system and environment variables in locations\n+++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \n*Available as of Camel 2.7*\n\nThe location now supports using placeholders\ \ for JVM system properties\nand OS environments variables.\n\nFor example:\n\ \n[source]\n----\nlocation=file:${karaf.home}/etc/foo.properties\n----\n\nIn\ \ the location above we defined a location using the file scheme using\nthe\ \ JVM system property with key `karaf.home`.\n\nTo use an OS environment variable\ \ instead you would have to prefix with\nenv:\n\n[source]\n----\nlocation=file:${env:APP_HOME}/etc/foo.properties\n\ ----\n\nWhere `APP_HOME` is an OS environment.\n\nYou can have multiple placeholders\ \ in the same location, such as:\n\n[source]\n----\nlocation=file:${env:APP_HOME}/etc/${prop.name}.properties\n\ ----\n\n[[Properties-Usingsystemandenvironmentvariablestoconfigurepropertyprefixesandsuffixes]]\n\ Using system and environment variables to configure property prefixes and suffixes\n\ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \n*Available as of Camel 2.12.5, 2.13.3, 2.14.0*\n\n`propertyPrefix`, `propertySuffix`\ \ configuration properties support\nusing placeholders for JVM system properties\ \ and OS environments\nvariables.\n\nFor example. if??`PropertiesComponent`\ \ is configured with the following\nproperties file:\n\n[source]\n----\ndev.endpoint\ \ = result1\ntest.endpoint = result2\n----\n\nThen with the following route\ \ definition:\n\n[source,java]\n----\nPropertiesComponent pc = context.getComponent(\"\ properties\", PropertiesComponent.class);\npc.setPropertyPrefix(\"${stage}.\"\ );\n// ...\ncontext.addRoutes(new RouteBuilder() {\n @Override\n public\ \ void configure() throws Exception {\n from(\"direct:start\").to(\"\ properties:mock:{{endpoint}}\");\n }\n});\n----\n\nit is possible to change\ \ the target endpoint by changing system\nproperty??`stage` either to??`dev`\ \ (the message will be routed\nto??`mock:result1`) or??`test` (the message will\ \ be routed\nto??`mock:result2`).\n\n[[Properties-ConfiguringinJavaDSL]]\nConfiguring\ \ in Java DSL\n^^^^^^^^^^^^^^^^^^^^^^^\n\nYou have to create and register the\ \ `PropertiesComponent` under the name\n`properties` such as:\n\n[source,java]\n\ ----\nPropertiesComponent pc = new PropertiesComponent();\npc.setLocation(\"\ classpath:com/mycompany/myprop.properties\");\ncontext.addComponent(\"properties\"\ , pc);\n----\n\n[[Properties-ConfiguringinSpringXML]]\nConfiguring in Spring\ \ XML\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSpring XML offers two variations to configure.\ \ You can define a spring\nbean as a `PropertiesComponent` which resembles the\ \ way done in Java\nDSL. Or you can use the `` tag.\n\n\ [source,xml]\n----\n\n \n\n----\n\nUsing the `` tag makes the configuration\ \ a bit more\nfresh such as:\n\n[source,xml]\n----\n\n \n\n\ ----\n\n[TIP]\n**Specifying the cache option inside XML** +\nCamel 2.10 onwards\ \ supports specifying a value for the cache option both\ninside the Spring as\ \ well as the Blueprint XML.\n\n[[Properties-UsingaPropertiesfromthe]]\nUsing\ \ a Properties from the link:registry.html[Registry]\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.4* +\nFor example in OSGi you may want to expose\ \ a service which returns the\nproperties as a `java.util.Properties` object.\n\ \nThen you could setup the link:properties.html[Properties] component as\nfollows:\n\ \n[source,xml]\n----\n \n----\n\nWhere `myProperties` is the id to use for lookup\ \ in the OSGi registry.\nNotice we use the `ref:` prefix to tell Camel that\ \ it should lookup the\nproperties for the link:registry.html[Registry].\n\n\ [[Properties-Examplesusingpropertiescomponent]]\nExamples using properties component\n\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nWhen using property placeholders in the\ \ endpoint URIs you can either use\nthe `properties:` component or define the\ \ placeholders directly in the\nURI. We will show example of both cases, starting\ \ with the former.\n\n[source,java]\n----\n// properties\ncool.end=mock:result\n\ \n// route\nfrom(\"direct:start\").to(\"properties:{{cool.end}}\");\n----\n\n\ You can also use placeholders as a part of the endpoint uri:\n\n[source,java]\n\ ----\n// properties\ncool.foo=result\n\n// route\nfrom(\"direct:start\").to(\"\ properties:mock:{{cool.foo}}\");\n----\n\nIn the example above the to endpoint\ \ will be resolved to `mock:result`.\n\nYou can also have properties with refer\ \ to each other such as:\n\n[source,java]\n----\n// properties\ncool.foo=result\n\ cool.concat=mock:{{cool.foo}}\n\n// route\nfrom(\"direct:start\").to(\"properties:mock:{{cool.concat}}\"\ );\n----\n\nNotice how `cool.concat` refer to another property.\n\nThe `properties:`\ \ component also offers you to override and provide a\nlocation in the given\ \ uri using the `locations` option:\n\n[source,java]\n----\n from(\"direct:start\"\ ).to(\"properties:bar.end?locations=com/mycompany/bar.properties\");\n----\n\ \n[[Properties-Examples]]\nExamples\n^^^^^^^^\n\nYou can also use property placeholders\ \ directly in the endpoint uris\nwithout having to use `properties:`.\n\n[source,java]\n\ ----\n// properties\ncool.foo=result\n\n// route\nfrom(\"direct:start\").to(\"\ mock:{{cool.foo}}\");\n----\n\nAnd you can use them in multiple wherever you\ \ want them:\n\n[source,java]\n----\n// properties\ncool.start=direct:start\n\ cool.showid=true\ncool.result=result\n\n// route\nfrom(\"{{cool.start}}\")\n\ \ .to(\"log:{{cool.start}}?showBodyType=false&showExchangeId={{cool.showid}}\"\ )\n .to(\"mock:{{cool.result}}\");\n----\n\nYou can also your property placeholders\ \ when using\nlink:producertemplate.html[ProducerTemplate] for example:\n\n\ [source,java]\n----\ntemplate.sendBody(\"{{cool.start}}\", \"Hello World\");\n\ ----\n\n[[Properties-Examplewithlanguage]]\nExample with link:simple.html[Simple]\ \ language\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe link:simple.html[Simple]\ \ language now also support using property\nplaceholders, for example in the\ \ route below:\n\n[source,java]\n----\n// properties\ncheese.quote=Camel rocks\n\ \n// route\nfrom(\"direct:start\")\n .transform().simple(\"Hi ${body} do\ \ you think ${properties:cheese.quote}?\");\n----\n\nYou can also specify the\ \ location in the link:simple.html[Simple]\nlanguage for example:\n\n[source,java]\n\ ----\n// bar.properties\nbar.quote=Beer tastes good\n\n// route\nfrom(\"direct:start\"\ )\n .transform().simple(\"Hi ${body}. ${properties:com/mycompany/bar.properties:bar.quote}.\"\ );\n----\n\n[[Properties-AdditionalpropertyplaceholdersupportedinSpringXML]]\n\ Additional property placeholder supported in Spring XML\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \nThe property placeholders is also supported in many of the Camel Spring\n\ XML tags such as\n`, , , , ,\ \ , `\nand the others.\n\nThe example below has property\ \ placeholder in the `` tag:\n\nYou can also define property placeholders\ \ in the various attributes on\nthe `` tag such as `trace` as\ \ shown here:\n\n[[Properties-OverridingapropertysettingusingaJVMSystemProperty]]\n\ Overriding a property setting using a JVM System Property\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.5* +\nIt is possible to override a property value\ \ at runtime using a JVM\nSystem property without the need to restart the application\ \ to pick up\nthe change. This may also be accomplished from the command line\ \ by\ncreating a JVM System property of the same name as the property it\nreplaces\ \ with a new value. An example of this is given below\n\n[source,java]\n----\n\ PropertiesComponent pc = context.getComponent(\"properties\", PropertiesComponent.class);\n\ pc.setCache(false);\n\nSystem.setProperty(\"cool.end\", \"mock:override\");\n\ System.setProperty(\"cool.result\", \"override\");\n\ncontext.addRoutes(new\ \ RouteBuilder() {\n @Override\n public void configure() throws Exception\ \ {\n from(\"direct:start\").to(\"properties:cool.end\");\n from(\"\ direct:foo\").to(\"properties:mock:{{cool.result}}\");\n }\n});\ncontext.start();\n\ \ngetMockEndpoint(\"mock:override\").expectedMessageCount(2);\n\ntemplate.sendBody(\"\ direct:start\", \"Hello World\");\ntemplate.sendBody(\"direct:foo\", \"Hello\ \ Foo\");\n\nSystem.clearProperty(\"cool.end\");\nSystem.clearProperty(\"cool.result\"\ );\n\nassertMockEndpointsSatisfied();\n----\n\n[[Properties-UsingpropertyplaceholdersforanykindofattributeintheXMLDSL]]\n\ Using property placeholders for any kind of attribute in the XML DSL\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.7*\n\nNOTE: If you use OSGi Blueprint then this only\ \ works from *2.11.1* or *2.10.5*\nonwards.\n\nPreviously it was only the `xs:string`\ \ type attributes in the XML DSL\nthat support placeholders. For example often\ \ a timeout attribute would\nbe a `xs:int` type and thus you cannot set a string\ \ value as the\nplaceholder key. This is now possible from Camel 2.7 onwards\ \ using a\nspecial placeholder namespace.\n\nIn the example below we use the\ \ `prop` prefix for the namespace\n`http://camel.apache.org/schema/placeholder`\ \ by which we can use the\n`prop` prefix in the attributes in the XML DSLs.\ \ Notice how we use that\nin the link:multicast.html[Multicast] to indicate\ \ that the option\n`stopOnException` should be the value of the placeholder\ \ with the key\n\"stop\".\n\nIn our properties file we have the value defined\ \ as\n\n[source]\n----\nstop=true\n----\n\n[[Properties-UsingpropertyplaceholderintheJavaDSL]]\n\ Using property placeholder in the Java DSL\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.7*\n\nLikewise we have added support for defining\ \ placeholders in the Java DSL\nusing the new `placeholder` DSL as shown in\ \ the following equivalent\nexample:\n\n[[Properties-UsingBlueprintpropertyplaceholderwithCamelroutes]]\n\ Using Blueprint property placeholder with Camel routes\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.7*\n\nCamel supports link:using-osgi-blueprint-with-camel.html[Blueprint]\n\ which also offers a property placeholder service. Camel supports\nconvention\ \ over configuration, so all you have to do is to define the\nOSGi Blueprint\ \ property placeholder in the XML file as shown below:\n\n[source]\n{% raw %}\n\ ----\n\n \n \n \n \n \n \ \ \n \n\ \ \n \n \n \n \n \n \n \n\ \ \n \n\n----\n{% endraw %}\n\n\ *Using OSGi blueprint property placeholders in Camel routes*\n\nBy default Camel\ \ detects and uses OSGi blueprint property placeholder\nservice. You can disable\ \ this by setting the attribute\n`useBlueprintPropertyResolver` to false on\ \ the ``\ndefinition.\n\n[Info]\n====\n**About placeholder syntaxes**\n\ \nNotice how we can use the Camel syntax for placeholders `{{` and `}}` in the\n\ Camel route, which will lookup the value from OSGi blueprint.\n\nThe blueprint\ \ syntax for placeholders is `${ }`. So outside the\n`` you must\ \ use the `${ }` syntax. Where as inside\n`` you must use `{{`\ \ and `}}` syntax.\n\nOSGi blueprint allows you to configure the syntax, so\ \ you can actually\nalign those if you want.\n====\n\nYou can also explicit\ \ refer to a specific OSGi blueprint property\nplaceholder by its id. For that\ \ you need to use the Camel's\n`` as shown in the example\ \ below:\n\n[source]\n{% raw %}\n----\n\n \n \n \n \n \n \ \ \n \n\ \ \n \n \n \n \n \n \n \n \n \n \n\ \ \n \n\n----\n{% endraw %}\n\n\ *Explicit referring to a OSGi blueprint placeholder in Camel*\n\nNotice how\ \ we use the `blueprint` scheme to refer to the OSGi blueprint\nplaceholder\ \ by its id. This allows you to mix and match, for example you\ncan also have\ \ additional schemes in the location. For example to load a\nfile from the classpath\ \ you can do:\n\n[source]\n----\nlocation=\"blueprint:myblueprint.placeholder,classpath:myproperties.properties\"\ \n----\n\nEach location is separated by comma.\n\n[[Properties-OverridingBlueprintpropertyplaceholdersoutsideCamelContext]]\n\ Overriding Blueprint property placeholders outside CamelContext\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \n*Available as of Camel 2.10.4*\n\nWhen using Blueprint property placeholder\ \ in the Blueprint XML file, you\ncan declare the properties directly in the\ \ XML file as shown below:\n\nNotice that we have a `` which refers to\ \ one of the properties. And\nin the Camel route we refer to the other using\ \ the `{{` and `}}` notation.\n\nNow if you want to override these Blueprint\ \ properties from an unit\ntest, you can do this as shown below:\n\nTo do this\ \ we override and implement the\n`useOverridePropertiesWithConfigAdmin` method.\ \ We can then put the\nproperties we want to override on the given props parameter.\ \ And the\nreturn value *must* be the `persistence-id` of the\n``\ \ tag, which you define in the blueprint XML\nfile.\n\n[[Properties-Using.cfgor.propertiesfileforBlueprintpropertyplaceholders]]\n\ Using .cfg or .properties file for Blueprint property placeholders\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \n*Available as of Camel 2.10.4*\n\nWhen using Blueprint property placeholder\ \ in the Blueprint XML file, you\ncan declare the properties in a `.properties`\ \ or `.cfg` file. If you use\nApache ServieMix / Karaf then this container has\ \ a convention that it\nloads the properties from a file in the etc directory\ \ with the naming\n`etc/pid.cfg`, where `pid` is the `persistence-id`.\n\nFor\ \ example in the blueprint XML file we have the\n`persistence-id=\"stuff\"`,\ \ which mean it will load the configuration file\nas `etc/stuff.cfg`.\n\nNow\ \ if you want to unit test this blueprint XML file, then you can\noverride the\ \ `loadConfigAdminConfigurationFile` and tell Camel which\nfile to load as shown\ \ below:\n\nNotice that this method requires to return a `String[]` with 2 values.\ \ The\n1st value is the path for the configuration file to load.\nThe 2nd value\ \ is the `persistence-id` of the ``\ntag.\n\nThe `stuff.cfg`\ \ file is just a plain properties file with the property\nplaceholders such\ \ as:\n\n[source]\n----\n## this is a comment\ngreeting=Bye\n----\n\n[[Properties-Using.cfgfileandoverridingpropertiesforBlueprintpropertyplaceholders]]\n\ Using .cfg file and overriding properties for Blueprint property placeholders\n\ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \nYou can do both as well. Here is a complete example. First we have the\nBlueprint\ \ XML file:\n\nAnd in the unit test class we do as follows:\n\nAnd the `etc/stuff.cfg`\ \ configuration file contains\n\n[source]\n----\ngreeting=Bye\necho=Yay\ndestination=mock:result\n\ ----\n\n[[Properties-BridgingSpringandCamelpropertyplaceholders]]\nBridging\ \ Spring and Camel property placeholders\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.10*\n\nThe Spring Framework does not allow 3rd party\ \ frameworks such as Apache\nCamel to seamless hook into the Spring property\ \ placeholder mechanism.\nHowever you can easily bridge Spring and Camel by\ \ declaring a Spring\nbean with the type\n`org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer`,\ \ which\nis a Spring\n`org.springframework.beans.factory.config.PropertyPlaceholderConfigurer`\n\ type.\n\nTo bridge Spring and Camel you must define a single bean as shown below:\n\ \n*Bridging Spring and Camel property placeholders*\n\nYou *must not* use the\ \ spring namespace\nat the same time; this is\ \ not possible.\n\nAfter declaring this bean, you can define property placeholders\ \ using\nboth the Spring style, and the Camel style within the \ \ tag\nas shown below:\n\n*Using bridge property placeholders*\n\nNotice how\ \ the hello bean is using pure Spring property placeholders\nusing the `${ }`\ \ notation. And in the Camel routes we use the Camel\nplaceholder notation with\ \ `{{` and `}}`.\n\n[[Properties-ClashingSpringpropertyplaceholderswithCamelslanguage]]\n\ Clashing Spring property placeholders with Camels link:simple.html[Simple] language\n\ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ \nTake notice when using Spring bridging placeholder then the spring `${ }`\n\ syntax clashes with the link:simple.html[Simple] in Camel, and therefore\ntake\ \ care. For example:\n\n[source,xml]\n----\n\n {{file.rootdir}}/${in.header.CamelFileName}\n\n\ ----\n\nclashes with Spring property placeholders, and you should use `$simple{\ \ }`\nto indicate using the link:simple.html[Simple] language in Camel.\n\n\ [source,xml]\n----\n\n {{file.rootdir}}/$simple{in.header.CamelFileName}\n\ \n----\n\nAn alternative is to configure the `PropertyPlaceholderConfigurer`\ \ with\n`ignoreUnresolvablePlaceholders` option to `true`.\n\n[[Properties-OverridingpropertiesfromCameltestkit]]\n\ Overriding properties from Camel test kit\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ \n*Available as of Camel 2.10*\n\nWhen link:testing.html[Testing] with Camel\ \ and using the\nlink:properties.html[Properties] component, you may want to\ \ be able to\nprovide the properties to be used from directly within the unit\ \ test\nsource code. +\nThis is now possible from Camel 2.10 onwards, as the\ \ Camel test kits, eg\n`CamelTestSupport` class offers the following methods\n\ \n* `useOverridePropertiesWithPropertiesComponent`\n* `ignoreMissingLocationWithPropertiesComponent`\n\ \nSo for example in your unit test classes, you can override the\n`useOverridePropertiesWithPropertiesComponent`\ \ method and return a\n`java.util.Properties` that contains the properties which\ \ should be\npreferred to be used.\n\n*Providing properties from within unit\ \ test source*\n\nThis can be done from any of the Camel Test kits, such as\ \ camel-test,\ncamel-test-spring, and camel-test-blueprint.\n\nThe `ignoreMissingLocationWithPropertiesComponent`\ \ can be used to\ninstruct Camel to ignore any locations which was not discoverable,\ \ for\nexample if you run the unit test, in an environment that does not have\n\ access to the location of the properties.\n\n[[Properties-UsingPropertyInject]]\n\ Using @PropertyInject\n^^^^^^^^^^^^^^^^^^^^^\n\n*Available as of Camel 2.12*\n\ \nCamel allows to inject property placeholders in POJOs using the\n`@PropertyInject`\ \ annotation which can be set on fields and setter\nmethods.\n\nFor example\ \ you can use that with `RouteBuilder` classes, such as shown\nbelow:\n\n[source,java]\n\ ----\npublic class MyRouteBuilder extends RouteBuilder {\n\n @PropertyInject(\"\ hello\")\n private String greeting;\n\n @Override\n public void configure()\ \ throws Exception {\n from(\"direct:start\")\n .transform().constant(greeting)\n\ \ .to(\"{{result}}\");\n }\n\n}\n----\n\nNotice we have annotated\ \ the greeting field with `@PropertyInject` and\ndefine it to use the key `\"\ hello\"`. Camel will then lookup the property\nwith this key and inject its\ \ value, converted to a String type.\n\nYou can also use multiple placeholders\ \ and text in the key, for example\nwe can do:\n\n[source,java]\n----\n @PropertyInject(\"\ Hello {{name}} how are you?\")\n private String greeting;\n----\n\nThis will\ \ lookup the placeholder with they key `\"name\"`.\n\nYou can also add a default\ \ value if the key does not exists, such as:\n\n[source,java]\n----\n @PropertyInject(value\ \ = \"myTimeout\", defaultValue = \"5000\")\n private int timeout;\n----\n\ \n[[Properties-Usingoutoftheboxfunctions]]\nUsing out of the box functions\n\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n*Available as of Camel 2.14.1*\n\nThe??link:properties.html[Properties]?\ ?component includes the following\nfunctions out of the box\n\n* `env` - A function\ \ to lookup the property from OS environment variables\n* `sys` - A function\ \ to lookup the property from Java JVM system\nproperties\n* `service` - A function\ \ to lookup the property from OS environment\nvariables using the service naming\ \ idiom\n* `service.name` - **Camel 2.16.1:??**A function to lookup the\nproperty?\ ?from OS environment variables using the service naming idiom\nreturning the\ \ hostname part only\n* `service.port`??- **Camel 2.16.1:??**A function to lookup\ \ the\nproperty??from OS environment variables using the service naming idiom\n\ returning the port part only\n\nAs you can see these functions is intended to\ \ make it easy to lookup\nvalues from the environment. As they are provided\ \ out of the box, they\ncan easily be used as shown below:\n\n[source,xml]\n\ ----\n \n\n\ \ \n \n \n \n \n \n\ ----\n\nYou can use default values as well, so if the property does not exists,\n\ you can define a default value as shown below, where the default value\nis a\ \ `log:foo` and `log:bar` value.\n\n[source,xml]\n----\n \n\n \n \n \n \n \n \n\ ----\n\n??\n\nThe service function is for looking up a service which is defined\ \ using\nOS environment variables using the service naming idiom, to refer to\ \ a\nservice location using `hostname : port`\n\n* __NAME__**_SERVICE_HOST**\n\ * __NAME__**_SERVICE_PORT**\n\nin other words the service uses `_SERVICE_HOST`\ \ and `_SERVICE_PORT` as\nprefix. So if the service is named FOO, then the OS\ \ environment\nvariables should be set as\n\n[source]\n----\nexport $FOO_SERVICE_HOST=myserver\n\ export $FOO_SERVICE_PORT=8888\n----\n\n??\n\nFor example if the FOO service\ \ a remote HTTP service, then we can refer\nto the service in the Camel endpoint\ \ uri, and use\nthe??link:http.html[HTTP]??component to make the HTTP call:\n\ \n[source,xml]\n----\n \n\n \n \n \n \n \n----\n\n??\n\nAnd we can use default values\ \ if the service has not been defined, for\nexample to call a service on localhost,\ \ maybe for unit testing etc\n\n[source,xml]\n----\n \n\n \n \n \n \n \n----\n\n[[Properties-Usingcustomfunctions]]\n\ Using custom functions\n^^^^^^^^^^^^^^^^^^^^^^\n\n*Available as of Camel 2.14.1*\n\ \nThe link:properties.html[Properties] component allow to plugin 3rd party\n\ functions which can be used during??parsing of the property placeholders.\n\ These functions are then able to do custom logic to resolve the\nplaceholders,\ \ such as looking up in databases, do custom computations,\nor whatnot. The\ \ name of the function becomes the prefix used in the\nplaceholder. This is\ \ best illustrated in the example code below\n\n[source,xml]\n----\n \n\n \n \n \n \n\n \n \n \n \n \n \n----\n\nHere we have a\ \ Camel XML route where we have defined the\n`` to use\ \ a custom function, which we refer to be the\nbean id - eg the `beerFunction`.\ \ As the beer function uses `\"beer\"` as its\nname, then the placeholder syntax\ \ can trigger the beer function by\nstarting with `beer:value`.\n\nThe implementation\ \ of the function is only two methods as shown below:\n\n[source,java]\n----\n\ \ public static final class MyBeerFunction implements PropertiesFunction\ \ {\n\n @Override\n public String getName() {\n return\ \ \"beer\";\n }\n\n @Override\n public String apply(String\ \ remainder) {\n return \"mock:\" + remainder.toLowerCase();\n \ \ }\n }\n----\n\nThe function must implement\nthe??`org.apache.camel.component.properties.PropertiesFunction`\n\ interface. The method??`getName` is ??the name of the function, eg beer.\nAnd\ \ the??`apply` method is where we implement the custom logic to do. As\nthe\ \ sample code is from an unit test, it just returns a value to refer\nto a mock\ \ endpoint.\n\nTo register a custom function from Java code is as shown below:\n\ \n[source,java]\n----\n PropertiesComponent pc = context.getComponent(\"\ properties\", PropertiesComponent.class);\n pc.addFunction(new MyBeerFunction());\n\ ----\n\n??\n\n[[Properties-SeeAlso]]\nSee Also\n~~~~~~~~\n\n* link:properties.html[Properties]\ \ component\n\n[[Properties-SeeAlso.1]]\nSee Also\n^^^^^^^^\n\n* link:configuring-camel.html[Configuring\ \ Camel]\n* link:component.html[Component]\n* link:endpoint.html[Endpoint]\n\ * link:getting-started.html[Getting Started]\n\n* link:jasypt.html[Jasypt] for\ \ using encrypted values (eg passwords) in\nthe properties\n"