Table of Contents
OpenSER Web Interface will be developed in true OOP fashion, meaning compatability will only be with PHP 5.0+. The program will be composed of the traditional three layers: View, Logic, and Data.
Common OOP patters will be employed to solve many of the problems involved with this project. The next three sections will describe the three layers from top-to-bottom, or view-to-data.
View Layer
Front Controller
- Single point of entry, everything goes through index.php
- Easy authentication control and program setup
- Minimize duplication of setup in various pages
Application Controller
- Loads configurations from file or database, holds for program use
- Caches expensive data loads, such as parsing an XML configuration file
- Acts as DB Singleton and holds DB settings
Command Resolver
- Modularizes resolution of commands
- Allows for easier refactoring to support other input methods (HTTP, XML RPC, SOAP, etc.)
Context
- Primary responsible is to pass data to and from commands
- Holds all incoming request data
- Passes return results from commands
- Passes DB handle to commands
Context Interpretor
- Allows multiple sources of input, compare to command resolver (HTTP, XML RPC, SOAP, etc.)
- Builds context for commands to use
- Responsible for filtering dangerous data, but not for validating data
View/Logic
Command
- Creates “real” objects, executes methods, does something
- Acts on contexts
- Responsible for validating form data
- Will return simple status codes, passes returned data back into the context
Logic
Domain Objects
- Are the real objects in the system, i.e. User, VoicemailBox, SipProxy, etc.
- Primary responsiblity is to DO something
Logic/Data
Mappers
- Map Domain Objects to the database or other storage layer
- Domain Objects will be unaware of mappers
- Will support four standard operations: Save, Delete, Load, and Update
- Can load collections of objects from arrays of raw data
- Allow for finding/searching for object, returning a collection of possibilities
Data
Collections with Lazy Load
* Implements PHP Iterator interface * Type specific collection * Given DB result and a Mapper to build collection of objects with
Identity Mapper and Unit of Work
- All Domain Objects are added to this, preventing duplicate objects
- Simplifies database saving, all objects are marked for necessary database operations that are done when the destructor of the mapper is called