All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.sling.scripting.sightly.extension.RuntimeExtension Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
/*******************************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 ******************************************************************************/
package org.apache.sling.scripting.sightly.extension;

import org.apache.sling.scripting.sightly.render.RenderContext;

import org.osgi.annotation.versioning.ConsumerType;

/**
 * A {@code RuntimeExtension} represents a HTL runtime construct that provides some processing capabilities for the various
 * {@code data-sly-*} block elements.
 */
@ConsumerType
public interface RuntimeExtension {

    /**
     * 

* The name of the runtime function that will process string * formatting. The function will receive the following parameters: *

*
    *
  1. the format String (e.g. 'Hello {0}, welcome to {1}')
  2. *
  3. an array of objects that will replace the format placeholders
  4. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#122-format. *

*/ String FORMAT = "format"; /** *

* The name of the runtime function that will process * i18n. The function will receive the following parameters: *

*
    *
  1. the String to translate
  2. *
  3. optional: locale information
  4. *
  5. optional: hint information
  6. *
  7. optional (not part of the specification): basename information; for more details see * {@link java.util.ResourceBundle#getBundle(String, java.util.Locale)}
  8. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#123-i18n. *

*/ String I18N = "i18n"; /** *

* The name of the runtime function that will process * join operations on arrays. The function will receive the following parameters: *

*
    *
  1. the array of objects to join (e.g. [1, 2, 3])
  2. *
  3. the join string (e.g. ';')
  4. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#124-array-join. *

*/ String JOIN = "join"; /** *

* The name of the runtime function that will provide * URI manipulation support. The function will receive the following parameters: *

*
    *
  1. optional: a URI string to process
  2. *
  3. optional: a Map containing URI manipulation options
  4. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#125-uri-manipulation. *

*/ String URI_MANIPULATION = "uriManipulation"; /** *

* The name of the runtime function that will provide * XSS escaping and filtering support. The function will receive the following parameters: *

*
    *
  1. the original string to escape / filter
  2. *
  3. the context to be applied
  4. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#121-display-context. *

*/ String XSS = "xss"; /** *

* The name of the runtime function that will perform * script execution delegation. The function will receive the following parameters: *

*
    *
  1. optional: the relative or absolute path of the script to execute
  2. *
  3. optional: a Map of options to perform script include processing
  4. *
*

* For more details about the supported options check * https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#228-include. *

*/ String INCLUDE = "include"; /** *

* The name of the runtime function that will perform * resource inclusion in the rendering process. The function will receive the following parameters: *

*
    *
  1. optional: a relative or absolute path of the resource to be included
  2. *
  3. optional: a Map containing the resource processing options
  4. *
*

* For more details about the supported options check * https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#229-resource. *

*/ String RESOURCE = "includeResource"; /** *

* The name of the runtime function that will provide * the support for loading Use-API objects. The function will receive the following parameters: *

*
    *
  1. an identifier that allows to discover the Use-API object that needs to be loaded
  2. *
  3. optional: a Map of the arguments that are passed to the Use-API object for initialisation or to provide context
  4. *
*

* For more details check https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.2/SPECIFICATION.md#221-use. *

*/ String USE = "use"; /** * For OSGi environments this is the name of the service registration property indicating the {@code RuntimeExtension} name. */ String NAME = "org.apache.sling.scripting.sightly.extension.name"; /** * Call the {@code RuntimeExtension} * * @param renderContext the runtime context * @param arguments the call arguments * @return an extension instance */ Object call(RenderContext renderContext, Object... arguments); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy