Created
November 13, 2017 10:51
-
-
Save aanchalsikka/69c92a3e462f6d681e2c60976830047d to your computer and use it in GitHub Desktop.
Sample Component with DS annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package blog.techrevel.component.impl; | |
import org.osgi.service.component.annotations.Component; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.osgi.service.component.ComponentContext; | |
import org.osgi.service.component.annotations.Activate; | |
import org.osgi.service.component.annotations.Deactivate; | |
@Component(name = "Sample Component", property = { "testProperty=Hello" }) | |
public class SampleComponentImpl { | |
private static final Logger LOGGER = LoggerFactory.getLogger(SampleComponentImpl.class); | |
@Activate | |
protected void activate(ComponentContext componentContext) { | |
LOGGER.info("Registering: " + componentContext.getProperties().get("testProperty").toString()); | |
} | |
@Deactivate | |
protected void deactivate(ComponentContext componentContext) { | |
LOGGER.info("Deregistering: " + componentContext.getProperties().get("testProperty").toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment