I have a component with properties as follows.
@Component(immediate = true, metatype = true, label = "Conf Details")
@Service(value = { LocationConfigurationUtil.class })
@Properties({
@Property(label = "location blueprint", name = "locationPath", value = "", description = "..."),
@Property(label = "location page template", name = "locationTemplate", value = "", description = "..."),
@Property(label = "basepath live copies", name = "liveCopyRoot", value = "/content/WebRoot", description = "...") })
public class LocationConfigurationUtil {
@Activate
protected void activate(Map<String, Object> mapCreated) {
// some code
}
}
To make it editable properties in a jcr node, I used a non-standard method. I created sling:OsgiConfig
in path /apps/system/config
having properties declared in java code, which is working fine.
But if I just have the same sling:OsgiConfig
inside /etc/myapp/myconfig
, it does not work.
With default settings, JCR Installer Provider does not look for installable bundles and nodes ( sling:OsgiConfig
) in folders other than /libs
and /apps
. so any config in /etc
will not be loaded.
If you want to change this behavior, make a search path entry in "Apache Sling JCR Installer" config in osgi configuration console. But be aware it is not recommended, you should not be putting any sling:osgiconfig
node in /etc
in the first place.
Note that placing configuration nodes under /etc
is a really bad idea.
From a security point of view, /libs
and /apps
are locked down, but with /etc/
you open yourself up to at least two major security holes:
Please reconsider adding the /etc
path to the JCR Installers search path entries and instead deploy your configurations to /apps
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.