Martini Package Directory Structure
Overview
Martini packages, essential to the functionality and organization within the Martini platform, follow a standardized directory structure. This structure facilitates the management and modularization of various package components.
Standard Directory Structure
A typical Martini package contains the following directory layout:
1 2 3 4 5 6 7 8 9 10 |
|
Directory Descriptions
code
This directory houses service source files and their corresponding byte code files. Adherence to Java naming conventions (as per Java Language Specification 6.2) is mandatory for all files and directories under code
. This ensures clarity and maintainability of the codebase.
conf
The conf
directory contains configuration files crucial for the package. This includes the package.xml
file, which stores package metadata, and various .properties
files for detailed configuration settings.
lib
The lib
directory is intended for additional .jar
files that your package might require. Classes within these JAR files are accessible through your package's classloader, thereby extending the functionality available in your code.
solr
For packages utilizing embedded Solr cores, this directory holds the necessary schema files, allowing for sophisticated data indexing and search capabilities within the package.
web
This directory is designated for Java web application resources. It becomes particularly important when hosting web applications via Martini's embedded Tomcat server. Note that the web
directory can be created only for packages that are loaded but not started; modifications are restricted once the package is started.
Creating Custom Directories
You can add custom or optional directories to a Martini package by right-clicking the package and selecting New > Folder. This flexibility allows for tailored package structures to suit specific project requirements.
Package Configuration XML File
Essential Configuration
The package.xml
file, located in the conf
directory, is pivotal. It holds metadata about the package, defines Martini endpoints, lists custom Solr cores, specifies Spring context files, and outlines JMS destinations.
Modifying package.xml
Direct modifications to package.xml
can be reflected based on the package.config-cache-strategy
setting. The three possible settings are:
- directory-watcher-cache
: Monitors changes using a directory watcher.
- last-modified-cache
: Checks the last modified time, suitable for development but not recommended for production.
- simple-map-cache
: Ignores runtime changes, requiring a restart to reflect modifications. Recommended for production environments.
Example XML Document
An example of a package.xml
.
Section Placeholder
This section is to be updated before publishing.
Notes
- Custom Package Path: The package home path can be customized via the
package.home
application property. - File Types and Counterparts: Groovy (
.groovy
) and Java (.java
) files in thecode
directory typically have.class
file counterparts.