Script Component

Version 14.1 by Thomas Mortagne on 2021/03/17 16:21

brick_addVery easily register fast components defined using scripts
TypeJAR
Category
Developed by

Thomas Mortagne

Active Installs4
Rating
1 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This tool allows registering components in a wiki page by defining a class in script and standard XWiki component annotations like you would in Java.

To do that you need to:

  • add a XWiki.ScriptComponentClass object to a page
  • select the script language you are going to use (default choices currently are Groovy or Python)
  • choose where it's going to be registered (for the current whole wiki, only for the author, for the whole farm)
  • write the component and indicate the role, hint and dependency using the Java annotations (@Component, @Named, @Inject)
  • save and your component is automatically registered

Not that the author of the script needs programming right to use this feature.

object.png

See Component Module for more details about XWiki Components.

Use it in an extension

If you plan to use this feature in an extension you should add the module in your extension dependencies.

In Maven, you can add the following to your pom.xml file:

    <dependency>
     <groupId>org.xwiki.contrib</groupId>
     <artifactId>scriptcomponent</artifactId>
     <version>1.0</version>
   </dependency>

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.contrib:scriptcomponent 1.0):

Get Connected