Extending Field — the Extensions Directory

In the standard Field installation you'll see, parallel to the main Field application an extensions directory. Field looks to this directory to contain things that extend it. If you want to extend Field in Java or integrate Field into your own code-base, this is one of your routes in. See the plugin manager for a visual way of turning on and off these extensions.

Field's classloader understands two kinds of things in this directory: .jar files, and .mf files:

  • Jar files are easy, if they are in the extensions directory then they get put on the classpath for Field when it's running. Additionally if their manifest file has a Field-PluginClass: classname entry, then class classname is declared as a plugin for Field.
  • .mf files are naked manifest files (they're just like manifest files, in syntax, found in jar archives, only they are not in actually in a jar). In addition to a Field-PluginClass: classname entry they can also have a Field-RedirectionPath: path. In this case, path gets put onto the classpath for Field. This is ideal if you want to point Field to the top of your current, live, code base. Paths can be absolute or relative (to the extensions directory).
  • In both cases the manifest files (inside jars or naked) can also set Field system properties, using keys of the following syntax: Field-Property-x — sets a property x; and Field-Property-Append-x — appends a property (making it semicolon separated). This is useful, for example, for extending the property java.source.paths to include additional places for Field to look for java sources. Note also, that since '.'s are forbidden in manifest file keys, you should use '-'s instead. So that's:
Field-Property-Append-java-source-paths: /users/someone/somebodiescodebase/src/
Field-RedirectionPath: /users/someone/somebodiescodebase/classes/
  • .py files are Python files. They come in two slightly different varieties. If it's just a plain Python file called banana.py then you can, inside the text editor, type import banana and have it do what you'd expect. If the first line of the file contains #field-library then the whole text of the file is automatically executed upon loading a sheet. Both ways are pure convenience — you can add a new file to this directory from within the text editor (just right click to get these options). It's a good way to take a piece of Python that you've developed in one sheet and have it available throughout your workspace.