Skip to content

Instantly share code, notes, and snippets.

@saulovenancio
Forked from cpilsworth/gist:4482792
Created March 11, 2014 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saulovenancio/9496093 to your computer and use it in GitHub Desktop.
Save saulovenancio/9496093 to your computer and use it in GitHub Desktop.
package com.sample.osgi;
import java.util.Map;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Modified;
import org.apache.felix.scr.annotations.Property;
@Component(label = "Service Label", description = "Service Description", metatype = true, immediate = true)
public class ConfigurableService {
@Property(value="default value", label = "Sample Parameter", description = "Example of a component parameter")
private static final String SAMPLE_PARAM_NAME = "param.one";
@Activate
protected void activate(final Map<String, Object> props) {
this.update(props);
}
@Modified
protected void update(final Map<String, Object> props) {
System.out.println(props.get(SAMPLE_PARAM_NAME));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment