Skip to content

Method support via scripts #385

Description

@krystian-panek-vmltech

as an addition to: #381

it may be hard to predict site content structure (exact tenant/lang/country node levels) so instead of assuming/hardcoding some conventions directly as ready to use APM methods, maybe it would better to give APM users ability to define functions only via scripts; I want to avoid enforcing users to implement own OSGi services to extend APM - that will probably never happen. But just implementing a JS script nearby APM script may bigger chance to happen IMO ;)

example

sites.apm.js

//var args, resolver // predefined (resolver from ootb engine support, see screenshot below) 
var sitePath = args['path'] // or named args (?)

var siteQuery = "SELECT * as s FROM nt:unstructured WHERE ISDESCENDANTNODE('" + sitePath + "')"
var siteIterator = resourceResolver.findResources(siteQuery)
// ... some processing
return sites // [['country': 'us', 'language': 'us', path' '/content/mysite/us/us'], ...]

all.apm

DEF sites = FUNC('sites', {path: '/content/mysite'}) // or sth similar

FOR-EACH sites // ... (as in PR)

*.apm.js should be handled by Javascript Sling script engine
image

https://sling.apache.org/documentation/bundles/scripting.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions