Interface Module

All Superinterfaces:
MessagesProvider
All Known Implementing Classes:
ModuleImpl

public interface Module extends MessagesProvider
Author:
Bogdan Stefanescu
  • Method Details

    • getName

      String getName()
    • getRoot

      File getRoot()
    • getRootObject

      Resource getRootObject(WebContext ctx)
    • getEngine

      WebEngine getEngine()
    • flushCache

      void flushCache()
    • getSuperModule

      Module getSuperModule()
    • getTemplateFileExt

      String getTemplateFileExt()
    • getMediaTypeId

      String getMediaTypeId(javax.ws.rs.core.MediaType mt)
    • getMessages

      Map<String,String> getMessages(String language)
      Specified by:
      getMessages in interface MessagesProvider
    • getMessages

      Messages getMessages()
    • getResourceBindings

      List<ResourceBinding> getResourceBindings()
    • getFile

      ScriptFile getFile(String path)
      Gets a file using the configured directory stack. Each directory in the stack is asked for the file until a file is found. If no file is found, returns null.

      Note that the implementation may cache the results. To clear any cached data, you should call the flushCache() method.

      Parameters:
      path - the file path
      Returns:
      null if no file found otherwise the file
    • getSkinResource

      ScriptFile getSkinResource(String path) throws IOException
      Gets a skin resource input stream. This must not cache resources. This method is using the module stacking directory to find the resource.
      Throws:
      IOException
    • loadClass

      Class<?> loadClass(String className) throws ClassNotFoundException
      Loads a class given its name.

      The scripting class loader will be used to load the class.

      Parameters:
      className - the class name
      Returns:
      the class instance
      Throws:
      ClassNotFoundException
    • getType

      ResourceType getType(String typeName)
      Gets a ResourceType instance given its name.

      The web type lookup is performed in the following order:

      1. First the annotated Groovy classes are checked. (web/ directory)
      2. Then the configuration type registry corresponding
      Parameters:
      typeName - the type name
      Returns:
      the web type instance
      Throws:
      WebResourceNotFoundException - if no such web type was defined
    • getTypes

      ResourceType[] getTypes()
      Gets the types registered within this module.
      Returns:
      the types. Cannot be null.
    • getAdapters

      AdapterType[] getAdapters()
      Gets the adapters registered within this module.
      Returns:
      the adapters. Cannot be null.
    • getAdapter

      AdapterType getAdapter(Resource ctx, String name)
      Gets the named adapter definition for the given resource.
      Parameters:
      ctx - the target resource
      name - the adapter name
      Returns:
      the adapter if any adapter with that name applies for that resource otherwise throws an exception
      Throws:
      WebSecurityException - if the adapter exists but cannot be accessed in the context of that resource
      WebResourceNotFoundException - if no such adapter exists for that resource
    • getAdapters

      List<AdapterType> getAdapters(Resource ctx)
      Gets the list of adapters that applies to the given resource.
      Parameters:
      ctx - the context resource
      Returns:
      the list of adapters Cannot be null.
    • getAdapterNames

      List<String> getAdapterNames(Resource ctx)
      Gets the list of adapter names that applies to the given resource.
      Parameters:
      ctx - the context resource
      Returns:
      the list of adapters Cannot be null.
    • getEnabledAdapters

      List<AdapterType> getEnabledAdapters(Resource ctx)
      Gets the list of adapters that are enabled for the given context.

      Enabled adapters are those adapters which can be accessed in the current security context.

      Parameters:
      ctx - the context resource
      Returns:
      the list of adapter.s Cannot be null.
    • getEnabledAdapterNames

      List<String> getEnabledAdapterNames(Resource ctx)
      Gets the list of adapter names that are enabled for the given context.

      Enabled services are those adapters which can be accessed in the current security context.

      Parameters:
      ctx - the context resource
      Returns:
      the list of adapters. Cannot be null.
    • getLinks

      List<LinkDescriptor> getLinks(String category)
    • getActiveLinks

      List<LinkDescriptor> getActiveLinks(Resource context, String category)
    • getSkinPathPrefix

      String getSkinPathPrefix()
      Get the path prefix to be used from templates to prepend to links to static resources.

      This prefix is exposed to templates as ${skinPath}.

      Returns:
      the skin path prefix. never null.
    • isDerivedFrom

      boolean isDerivedFrom(String moduleName)