Search code examples
aemosgi-bundle

Bundle is not Configurable


I am creating a OSGI bundle with scheduler. When installed am not able to configure the bundle via system console in CQ5/AEM.

Below is the Annotation am using.

@Component(immediate = true, metatype = false, label = "SiteMap manager Service")
@Service(value = Runnable.class)
@Properties({
    @Property(name = "scheduler.expression", value = "0 0/2 * * * ?"),
    @Property(name = "scheduler.concurrent", boolValue = false),
    @Property(name = "prop.enabled", boolValue = false),
    @Property(name = "inputPath", value = "changeme"),
    @Property(name = "outputPath", value = "changeme"),
    @Property(name = "username", value = "changeme"),
    @Property(name = "password", value = "changeme") })
public class SiteMapManager implements Runnable {
    private static final Logger LOGGER = LoggerFactory
            .getLogger(SiteMapManager.class);

    private String inboundDirectory;
    private String extractionDirectory;
    private String failDirectory;
    private String username;
    private String password;
    private Boolean enabled;

    private static AtomicBoolean runningInstances = new AtomicBoolean(false);

    @Reference
    private SlingRepository repository;

    @Reference
    ResourceResolverFactory factory;

    @Reference
    private Replicator replicator;
    protected void activate(ComponentContext componentContext) {
        LOGGER.debug("Start Article Ingestor Configuration");
        configure(componentContext.getProperties());
    }

    public void configure(Dictionary<?, ?> properties) {
        this.username = PropertiesUtil.toString(properties.get("username"),null);
        this.password = PropertiesUtil.toString(properties.get("password"),
                null);
        this.enabled = PropertiesUtil.toBoolean(properties.get("prop.enabled"),false);
    }

    public void  run() {
        LOGGER.debug("Running");    
    }
}

Solution

  • it's plain and simple:

    metatype = true

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