JETERS: The component concept

About JETERS

JETERS (Java Extensible TExt Replacement System) is a toolkit for automated and semi-automated corrections of texts, especially of articles in wikis. It provides basic functionality for accessing MediaWiki systems and performing edits based on regular expressions as well as an intuitive graphical user interface. Custom functionality can easily be implemented due to modular design.

The component system

To allow fast and simple modification of parts of the program, JETERS uses a set of components working together. In most cases, implementing new functionality should only require rewriting one (or perhaps two) components. The following paragraphs describe the four component categories: input, output, replacer and user interface (UI). First, however, we will have a look at the representation of editable texts.

The interface EditableText

JETERS is not restricted to a single type of text. Instead, any class implementing the interface jeters.core.EditableText can be used to represent texts. This interface contains get- and set-methods for the string representing the text itself and for a label describing the text (filename, wiki page title, …).

JETERS itself contains two classes implementing EditableText: jeters.components.PlainText and jeters.components.MediaWikiText). While PlainText meets only the minimum requirements for EditableText (text and label strings), the MediaWikiText includes a comment describing the changes and indicates wheter an edit can be considered minor. This information is applied when changing MediaWiki articles.

Of course, you can write implementations of EditableText yourself if your components need more information about texts. It's a good idea to extend PlainText in order to do this, usually there is no need to create a completely new class tree.

Components working with texts (input, output, replacer) use generic interfaces. When implementing them, they decide what class (implementing EditableText) they use as parameters/return values.

Input components

Input components are used to generate an object representing an editable text. They can use any imaginable source – from an internet encyclopedia to a random text generator (yes, there is a difference …). With JETERS, you get the following input components: jeters.components.UserIO (gets input from the user interface), jeters.components.FileIO (reads a text from a file) and WikiIO (NOT YET IMPLEMENTED). If you have wondered about the O: These classes are output components at the same time (they implement both necessary interfaces).

If you need more input possibilities, you can simply write your own input component. Input components have to implement the jeters.core.InputComponent interface. Note that this interface is generic: You have to specify what kind of text your component produces. If you can provide more information, don't hesitate to choose a more specialized implementation of EditableText. For example, input componenents implementing InputComponent can also feed replacers that need only PlainText (since MediaWikiText extends PlainText). The other direction will obviously not work.

InputComponent_Series

Output components

Replacer components

UI components

JETERS contains two default UI components, DefaultGUI (a graphical user interface) and DefaultCUI (a command line interface).