Class ScriptApi


  • public class ScriptApi
    extends Object
    ScriptApi provides functions which are called from the configuration scripts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      javax.script.ScriptEngine engine  
      java.util.Stack<java.io.File> includeStack  
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptApi()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object addInjectableObject​(Object object)
      Registers the object as an object which can be injected later into an uninitialized property.
      Object include​(String fileName)
      Include another configuration file.
      void injectMissingPropertyValues​(Object object, java.util.List<String> initializedProperties)
      Initializes the properties that has not got a value explicitly and are annotated with @Inject annotation with default objects selected from the set of injectable objects.
      Object manage​(Object object)
      Registers objects created by the configuration script for lifecycle management, which includes calling methods marked with PostConstruct and PreDestroy annotations.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • engine

        public javax.script.ScriptEngine engine
      • includeStack

        public final java.util.Stack<java.io.File> includeStack
    • Constructor Detail

      • ScriptApi

        public ScriptApi()
    • Method Detail

      • include

        public Object include​(String fileName)
                       throws java.io.IOException,
                              javax.script.ScriptException
        Include another configuration file.
        Parameters:
        fileName - the path to the script file to be included. Relative paths are resolved against the mireka.home directory.
        Returns:
        the result of the included file, in case of JavaScript, this is the result of the last statement.
        Throws:
        java.io.IOException - thrown if the file cannot be opened
        javax.script.ScriptException - thrown if the script in the included file cannot be run because of a syntactic or semantic error
      • manage

        public Object manage​(Object object)
        Registers objects created by the configuration script for lifecycle management, which includes calling methods marked with PostConstruct and PreDestroy annotations.
        Parameters:
        object - the object which may have a lifecycle annotation.
        Returns:
        the object argument
        See Also:
        Lifecycle
      • addInjectableObject

        public Object addInjectableObject​(Object object)
        Registers the object as an object which can be injected later into an uninitialized property.
        Parameters:
        object - The object which can be injected
        Returns:
        the object argument
        See Also:
        DependencyInjection.addInjectable(Object)
      • injectMissingPropertyValues

        public void injectMissingPropertyValues​(Object object,
                                                java.util.List<String> initializedProperties)
        Initializes the properties that has not got a value explicitly and are annotated with @Inject annotation with default objects selected from the set of injectable objects.
        Parameters:
        object - The object that may have uninitialized properties
        initializedProperties - The list of properties which were explicitly initialized.
        See Also:
        DependencyInjection.injectDependencies(Object, List)