Skip to content

Instantly share code, notes, and snippets.

@saulovenancio
Forked from cpilsworth/gist:4482792
Last active August 29, 2015 14:08
Show Gist options
  • Save saulovenancio/5bf5a1a0dfe54588a626 to your computer and use it in GitHub Desktop.
Save saulovenancio/5bf5a1a0dfe54588a626 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