Mailet Proposal Specification


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.


  1. Mailet - a Java object which is annotated with @org.apache.mailet.annotations.Mailet and complies with the "MailetContract" specified below.

  2. Service - a service provided by the mailet container that may be injected into the mailet.
  3. Specification Service - a service whose contract is defined in this specification
  4. User-provided Service - a service whose contract is not specified in this specification
  5. Mailet Attribute - an injected value.
  6. Dependency - an attribute annotated with Attribute(..., depends=true) which helps define the order in which mailets are started

Non-technical Goals

  1. Create a "marketplace" for mailets similar to that which exists for Java Portlets

Technical Goals

  1. Create a set of annotations and interfaces for use by mailet authors and container implementors
  2. Create a set of contracts by which compliant containers and mailets can maintain compatibility

Design Principles

  1. JavaAnnotations are favored over interfaces for mailets

  2. JavaInterfaces are favored over annotations for Specification Services.

  3. Injection is preferred over "pull" APIs
  4. Underlying structures for Mail objects should be masked for compatibility
  5. Deployment and packaging should be seperate from configuration

Mailet User Contract

  1. Mailets must use JavaBeans method naming conventions

  2. Mailets must expose an interface and a class
  3. Mailet classes may expose 1 or more public constructors which may only take JavaPrimitive type parameters or none at all.

  4. Mailet interfaces must define 1 service method which returns a Mail object and takes a Mail object (NOTE: revise this)
  5. Mailet classes may implement their interface
  6. Mailet classes must implement all attributes, and the service method defined in their associated interface
  7. Mailet interfaces must be annotated with org.apache.mailet.annotation.Mailet
  8. Attributes must be annotated with org.apache.mailet.annotation.Attribute
  9. Constructors must be annotated with org.apache.mailet.annotation.Constructor
  10. The service method must be annotated with org.apache.mailet.annotation.Service

ProposedMailetSpec (last edited 2009-09-20 22:58:11 by localhost)