private void customizeTenant()

in src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java [404:436]


    private void customizeTenant(final Resource tenantRes, final Tenant tenant, boolean isCreate) {

        // call tenant setup handler
        Map<String, Object> tenantProps = tenantRes.adaptTo(ModifiableValueMap.class);
        if (tenantProps == null) {
            log.warn(
                "create({}): Cannot get ModifiableValueMap for new tenant; will not store changed properties of TenantCustomizers",
                tenant.getId());
            tenantProps = new HashMap<String, Object>();
        }

        for (TenantCustomizer ts : getTenantHandlers()) {
            try {
                Map<String, Object> props = ts.setup(tenant, tenantRes.getResourceResolver());
                if (props != null) {
                    tenantProps.putAll(props);
                }
            } catch (Exception e) {
                log.info("addTenant/updateTenant: Unexpected problem calling TenantCustomizer " + ts, e);
            }
        }
        // call tenant hooks
        for (TenantManagerHook ts : getHooks()) {
            try {
                Map<String, Object> props = (isCreate ? ts.setup(tenant) : ts.change(tenant));
                if (props != null) {
                    tenantProps.putAll(props);
                }
            } catch (Exception e) {
                log.info("addTenant/updateTenant: Unexpected problem calling TenantManagerHook " + ts, e);
            }
        }
    }