Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Method call of OSGi components which implements the same interface

Avatar

Avatar
Validate 1
Level 2
Srinin
Level 2

Like

1 like

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 2
Srinin
Level 2

Like

1 like

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Srinin
Level 2

01-05-2017

Hi,

I have two OSGI Component classes with implementing the same interface.

Class WordsValidatorImpl implements ContentValidators {

    void validate() {}
}
Class ActivationValidatorImpl implements ContentValidators {
    void validate() {}
}

I need call the validate() method on both the classes. How to do that?

@Reference ContentValidators contentValidators;

If I call contentValidators.validate() only method in one component is getting called, instead of two. 

thanks

Srini

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

01-05-2017

See this article - it will show you what to do. 

http://scottsdigitalcommunity.blogspot.ca/2017/03/managing-adobe-experience-manager-osgi.html

You need to use target - as discussed in that article. 

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
erichw86385412
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
erichw86385412
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
erichw86385412
Level 1

01-05-2017

One way would be to create a contentValidatorManager service that keeps track of all the contentValidators as they are registered. Then instead of referencing contentValidators you reference contentValidatorsManager and call a new validatorAllValidators() that would loop through all registered validators.

References

http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html...

https://architectslog.wordpress.com/2013/02/18/multiple-cardinality-osgi-references-using-scr-annota...

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/ad...