Difference between revisions of "GNUrc"

From ProgClub
Jump to: navigation, search
(link to dir structure...)
(→‎Software layers: adding links...)
Line 116: Line 116:
 
| function libraries
 
| function libraries
 
|-
 
|-
| objects
+
| [[#/src/2-obj|objects]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/2-obj/?root=remotecontrol /src/2-obj]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/2-obj/?root=remotecontrol /src/2-obj]
 
| Model
 
| Model
 
|-
 
|-
| Data Access Layer (DAL)
+
| [[#/src/3-dal|Data Access Layer (DAL)]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/3-dal/?root=remotecontrol /src/3-dal]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/3-dal/?root=remotecontrol /src/3-dal]
 
| Model
 
| Model
 
|-
 
|-
| Object/Relational Mapping (ORM)
+
| [[#/src/4-orm|Object/Relational Mapping (ORM)]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/4-orm/?root=remotecontrol /src/4-orm]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/4-orm/?root=remotecontrol /src/4-orm]
 
| Model
 
| Model
 
|-
 
|-
| Business Object Model (BOM)
+
| [[#/src/5-bom|Business Object Model (BOM)]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/5-bom/?root=remotecontrol /src/5-bom]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/5-bom/?root=remotecontrol /src/5-bom]
 
| Model
 
| Model
 
|-
 
|-
| views
+
| [[#/src/6-view|views]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/6-view/?root=remotecontrol /src/6-view]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/src/6-view/?root=remotecontrol /src/6-view]
 
| View
 
| View
 
|-
 
|-
| controllers
+
| [[#/web|controllers]]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/web/?root=remotecontrol /web]
 
| [http://svn.savannah.gnu.org/viewvc/branches/development/jj5-mvc/web/?root=remotecontrol /web]
 
| Controller
 
| Controller

Revision as of 08:57, 9 April 2015

GNUrc is the GNU Remote Control software. That's the software that aids in the maintenance of your thermostats. For other projects see projects.

Status

v1.1 released, v2.0 under development.

Motivation

To seek operational efficiencies in air-conditioners thereby saving electricity and improving comfort.

Administration

Contributors

Members who have contributed to this project. Newest on top.

All contributors have agreed to the terms of the Contributor License Agreement. This excludes any upstream contributors who tend to have different administrative frameworks.

Upstream (GNU) contributors: GNU Remote Control Contributors

Copyright

Copyright 2015, Contributors.

License

Licensed under the AGPL.

Resources

Downloads

See the home page for downloads.

Source code

See the home page for source code.

Links

Specifications

Jargon

Following are definitions for abbreviations and acronyms that we use:

svn
Subversion version control software
i18n
intl
Internationalization/translation
SQL
Structured Query Language
API
Application Programming Interface
ORM
Object/Relational Mapping
BOM
Business Object Model
HTML
HyperText Markup Language
HTTP
Hypertext Transfer Protocol

Functional specification

The functional specification describes what the project does.

Administration dashboard

The administration dashboard is an administrator's home page. From the administration dashboard an administrator can access:

  1. User administration
  2. Language administration
  3. Group administration
  4. Error reporting

User administration

Language administration

Group administration

Error reporting

Error logging
Error log testing

Technical specification

The technical specification describes how the project works.

Software layers

The GNUrc software is layered:

Layer Directory MVC role
modules /src/1-lib function libraries
objects /src/2-obj Model
Data Access Layer (DAL) /src/3-dal Model
Object/Relational Mapping (ORM) /src/4-orm Model
Business Object Model (BOM) /src/5-bom Model
views /src/6-view View
controllers /web Controller

Each level depends on (up to) all of the previous levels. So controllers use views, BOM, ORM, DAL, objects, and modules. Views use BOM, ORM, DAL, objects, and modules. The BOM uses the ORM, DAL, objects, and modules. And so on. Generally controllers should call on the services of the BOM rather than calling on the services of the DAL directly, so the BOM encapsulates business logic and mediates it into the DAL. If higher layers can encapsulate functionality in lower layers that is a good thing to do.

Directory structure

The software has the following directory structure starting in the base:

/

The base directory is /path/to/your/gnurc.

  • .svn-ignore -- files for Subversion (svn) to ignore
    e.g.: $ svn propset svn:ignore -RF .svn-ignore .
  • config.example.php -- an example config file
  • config.php -- the production config file
    e.g.: $ cp config.example.php config.php; vim config.php

/dat

The /dat directory is for data files.

/etc

The /etc directory is for miscellaneous scripts.

/etc/dbscripts

The /etc/dbscripts directory is an svn:externals for the database scripts:

svn://svn.sv.gnu.org/remotecontrol/branches/development/dbscripts

/src

The /src directory is for most of the source code.

  • include.php -- the main include file for loading the GNUrc software components.
  • test.php -- the main include file for use by PHPUnit unit tests.

/src/1-lib

The /src/1-lib directory contains function modules.

/src/2-obj

The /src/2-obj directory contains PHP classes used by GNUrc that do not fit in another category.

Managing errors

The error management subsystem is comprised of the /src/2-obj/GrcError.php class and the 'err' and 'Error' functions in /src/1-lib/01-api.php 01-api.php.

Errors are managed in to modes. First they are 'declared' and second they are 'raised'.

Declaring error numbers

To declare a possible error call the err()->define function. The first argument is the name of the error known as the error const. The error const has 6 parts separated by double-underscore (__):

  1. 'ERROR'
  2. type (e.g. 'LIB', 'OBJ', etc.)
  3. module/class (e.g. 'API', 'VALIDATION')
  4. function name
  5. variable name
  6. state (e.g. 'NOT_NULL', 'INVALID')

The second argument is the error message. The error messages will be translated if necessary and can include variables using the '%variable%' notation of the i18n subsystem.

Raising particular errors

After you have declared an error like this:

err()->define( 'ERROR__LIB__EXAMPLE', 'An error with %param% occurred.' );

you can raise it like this:

throw Error( ERROR__LIB__EXAMPLE, 'param', 'value', intl_context, previous_exception );

where intl_context is an i18n translation context and previous_exception is a previous exception if any.

Web interface

admin-home.php

The admin-home.php

Notes

Notes for implementers

If you are interested in incorporating this software into your project, here's what you need to know:

Notes for developers

If you're looking to set up a development environment for this project here's what you need to know:

Tasks

TODO

Things to do, in rough order of priority:

  • Document system design
  • Generate task list
  • Allocate tasks to developers

Done

Stuff that's done. Latest stuff on top.

  • JE 2015-04-01: created project page