How do I provide two services in an osgi.bnd file? - osgi

I'm using Equinox and I've got an OSGI.BND file which looks like this
Service-Component: DefaultCommunication;\
provide:=com.whatever.service.Communication;\
implementation:=com.whatever.myservice.DefaultCommunication
But now I want to provide two interfaces, Communication and Configuration.
What would the file look like then?

Based on Bnd format specification:
LIST A comma separated list. Items should be quoted with '"' if the
contain commas. In general, a list item can also define attributes and
directives on an item.
Bnd Service Components description:
provide ::= 'provide:=' LIST
In your case:
provide:=com.whatever.service.Communication,com.whatever.service.Configuration

Related

Is it possible to write only specific directives to an XML file

I'm rather new to Sphinx and ReST and I've "inherited" a big project.
The documentation consists of hundreds of pages with how to's, etc. There are several files (one for each class) where the respective functions are described using the ".. py:function::" directive.
So each of these pages is basically like this:
Some description text explaining the class
py:function:: class.myFunction(param1, param2)
parameter description
code example, ...
py:function:: class.myFunction2
parameter description
code example, ...
Now, I'd like to list all functions of all different pages in one single XML file, if possible grouped by their class, but without the descriptions and examples. Is this possible with some built-in Sphinx parser or do I have to write my own? Or is there any other directive or config option that may be helpful?
The XML file should be like this:
<class1>
<function1>
<param1>
<param2>
...
<function2>
...
<class2>
<function1>
...
I found ViewLists and the Parsing directive in the Sphinx documentation but i'm not sure how to correctly use them and if that's the solution to my problem.

Artemis ActiveMQ broker.xml wildcard-addresses configuration reference

I'm currently configuring an Artemis ActiveMQ Broker and need to change the default ''wildcard-addresses''. So I found the ''wildcard-addresses'' tag, but I didn't find the information I need, so I have two questions:
I want to set routing-enabled to true, but just for the tag ''any-words'' and disable the ''single-word'' tag (or just want to know if this is even possible).
I didn't find the answer in the official documentation, so I'm wondering if someone found a good reference which explains the different tags for the ''wildcard-addresses'' configuration, which is in the style of the ''Configuration Reference'', but includes a section about ''wildcard-addresses''.
What I've found so far but does not satisfy me:
Wildcard-syntax
Routing Messages with wildcards
Configuration reference
Thanks in advance,
Alex
There is no way to disable certain match types (i.e. single word or any words), and it's not clear why one would want to.
The wildcard-addresses block is for enabling/disabling wild-card routing and for customizing the wild-card syntax.
Here's the basics (as described in the documentation):
A wildcard expression contains words delimited by the character defined by delimiter (i.e. . by default).
The character defined by any-words (i.e. # by default) means "match any sequence of zero or more words."
The character defined by single-word (i.e. * by default) means "match a single word."

Load only one section from a YAML config file

I have multiple components that each of them needs to load specific definitions for it to run, I want to make one big YAML file divided into sections, that each section will belong to a different component.
So instead of having 4 config files for 4 components I'll have one big config file that divided into sections.
Now I want to load on each component just the relvant section from the yaml config file.
Can I do it? and how?
Update:
Both answers have satisfied me (embedded YAML files in one YAML file and the other answer was to unmarshal the JSON to an object that contains only the relevant section I'm interstring in).
The YAML specification allows to have multiple YAML documents in one file by delimiting them with ---: http://yaml.org/spec/1.2/spec.html#id2760395
You would have to check how the library you're utilizing handles this.

Why should we use yml over properties

If we put spring.datasource.url = url it takes only one line.
However, If we put same thing in .yml it takes 4 lines.
spring :
datasource:
url : url
Yet developers and frameworks(like Spring) prefer .yml over .properties.
Why should we use .yml over .properties file?
Some Googling would have definitely helped you.
Ex : From http://javajee.com/a-quick-comparison-of-yaml-with-properties-file ,
YAML supports Maps, lists and scalar types. YAML is hierarchical and may use consistent spaces to denote hierarchy.
and,
Properties file is mainly used with Java, supports only String types and is non-hierarchical; we can have maps by denoting hierarchies as dots
Another long and descriptive guide is http://hsoienterprises.com/2014/03/10/property-list-vs-json-vs-yaml/ , which I'll leave for you to read.

Apache camel regex pattern for txt files

I would like to use apache camel with regex pattern for txt files, but the problem is the correct pattern and how to use it in from() method. The documentation mentions only about the keyword include and exclude. Which is the easiest way to use a pattern in order to check if filename matches the regex pattern? Thank you in advance.
The easiest might be the one you've mentioned (include parameter on the file endpoint). Example (include every txt):
from("file://input/directory?include=.*\\.txt")
Other option is to implement a GenericFileFilter.
Since you're only checking for the file name, you can do something like this for files appearing in a specific folder and choose what to do with them using a predicate:
from("file://fooFileFolder/")
.choice()
.when(header("CamelFileNameOnly").regex("fooPattern")).to("mock:fooHere")
.otherwise().to("mock:fooThere")
.end();
It's up to you to use the regex suitable for the matching pattern in the currently read file name you're looking to apply the test to. You can also use regex with Camel's Simple dialect.

Resources