Mailet Proposal Specification
Introduction
This draft specification is for the proposed inter-container mailet specification. It is a work in progress. The specification describes the contract between Mailets and Mailet containers.
Definitions
Mailet - a Java object which is annotated with @org.apache.mailet.annotations.Mailet and complies with the "MailetContract" specified below.
- Service - a service provided by the mailet container that may be injected into the mailet.
- Specification Service - a service whose contract is defined in this specification
- User-provided Service - a service whose contract is not specified in this specification
- Mailet Attribute - an injected value.
- Dependency - an attribute annotated with Attribute(..., depends=true) which helps define the order in which mailets are started
Non-technical Goals
- Create a "marketplace" for mailets similar to that which exists for Java Portlets
Technical Goals
- Create a set of annotations and interfaces for use by mailet authors and container implementors
- Create a set of contracts by which compliant containers and mailets can maintain compatibility
Design Principles
JavaAnnotations are favored over interfaces for mailets
JavaInterfaces are favored over annotations for Specification Services.
- Injection is preferred over "pull" APIs
- Underlying structures for Mail objects should be masked for compatibility
- Deployment and packaging should be seperate from configuration
Mailet User Contract
Mailets must use JavaBeans method naming conventions
- Mailets must expose an interface and a class
Mailet classes may expose 1 or more public constructors which may only take JavaPrimitive type parameters or none at all.
- Mailet interfaces must define 1 service method which returns a Mail object and takes a Mail object (NOTE: revise this)
- Mailet classes may implement their interface
- Mailet classes must implement all attributes, and the service method defined in their associated interface
- Mailet interfaces must be annotated with org.apache.mailet.annotation.Mailet
- Attributes must be annotated with org.apache.mailet.annotation.Attribute
- Constructors must be annotated with org.apache.mailet.annotation.Constructor
- The service method must be annotated with org.apache.mailet.annotation.Service