Information
This details the recommended structure for Sakai 2.4+ applications (or tools). (powerpoint)
This is the new simplified structure which makes maven2 easier to work with
Application structure
- Basic tool structure
tool -> logic-api -> logic-impl -> dao-api -> dao-impl - Model connection
model -> logic-api, dao-api, etc... - Optional service connection
public-api -> logic-api
NOTE: Ideally the DAO api would not be in shared but the current component model does not allow for this
File Structure
- app-name
- api - project with all interfaces, model objects, and hibernate hbm files
Deploy as a jar to shared [ no dependencies ]
(optional) eclipse .project here (name the project <app-name>-api)- src - includes interfaces, model objects, and hbm files
- test - (optional) may include shared test data and mock objects which help other with tests
- impl - project at this level
Deploy as a jar, include in pack [api]
(optional) eclipse .project here (name the project <app-name>-impl)- src - includes java source for all implementations of apis
- test - includes all unit and integration tests
- pack - project for components stuff needed by Sakai (should just a set of spring config files)
Deploy to components [impl (all in war bundle)] - tool - project for the tool (interface to the user)
Deploy as a war [api]
(optional) eclipse .project here (name the project <app-name>-tool)- src - java src directory
- java - any java code used for the tool only
- webapp
- app-name - JSF jsp files here
- css
- images
- templates - RSF html templates
- tools - Sakai tool.xml files goes in here
- WEB-INF - lots of xml config files here (web.xml, applicationContext.xml, etc...
- src - java src directory
- api - project with all interfaces, model objects, and hibernate hbm files
project.xml hints listed below each directory in italics, dependencies are in []
Note: Applications can also just use one eclipse project for the entire application.
Java structure (packages)
- org.sakaiproject.app-name
- dao
all dao api classes- impl
all dao implementation classes
- impl
- hbm
hibernate mapping files only - logic
all business logic api classes- impl
all business logic implementation classes
- impl
- model
all value object POJOs - service (cannot use public)
all publically accessible api classes related to the app - tool
all java classes related to the tool (backing beans)- jsf, producers, params
presentation specific classes related to the tool
- jsf, producers, params
- dao
Note: You may have your own package base instead of org.sakaiproject
Definitions
- project - a maven project (should have it's own project.xml file)
- app or webapp - the entire application including the tool, apis, impls, etc...
- tool - The part a Sakai user interacts with
- public-api - The api you would make accessible to other programmers (sometimes known as service)
- logic - business logic or application logic (might be the same as the service)
- model - The value objects or the POJOs that store the data for your app
- dao - The data access layer of your app (a.k.a. data access object), talks to a persistent storage mechanism
- (optional) - May not be needed depending on your tool structure