Skip to content

Coding guidelines

Nikos Kefalakis edited this page Nov 24, 2015 · 8 revisions

Namespaces

Trunk and branches

Sources must be prefixed by the following namespaces.

  • Java: org.openiot
  • Bundles symbolic names: org.openiot
  • JMX ObjectNames for end-to-end management: org.openiot:type=component,name=concern
  • XML (XML Schema) : urn:org:openiot
  • WebServices (WSDL, ...) : TODO

Sandboxes

  • Java : org.openiot.sandbox
  • Bundles symbolic names : org.openiot.sandbox
  • XML (XML Schema) : urn:org:openiot
  • WebServices (WSDL, ...) : TODO

Sub project group and maven artifact ids

Names and ids must be prefixed by the following namespaces.

  • Group ID: org.openiot
  • Artifact Id: [module].[functionality] (i.e. scheduler.core)
  • Bundle Name : [groupId].[artifactId]
  • Project Name: [artifactId]

Files

Two mandatory files (NOTICE and LICENSE) must be provided in each project directory

  • NOTICE contains the description of the dependencies and their licenses.
  • LICENSE contains the license text.

Those files should automatically added in the artifact after the package phase

NOTICE file

Example of a Notice File

Copyright 2011-2014 OpenIoT Project
https://github.com/OpenIotOrg/openiot/wiki  

I. Included Software

This product includes software developed at
The OpenIoT Consortium (http://openiot.eu/).
Licensed under the LGPL v3.0.

II. Used Software

This product uses software developed at
the FooBar project (http://code.foo.org/bar).
licensed under the Apache License 2.0.

This product uses software developed at
the TicTac project (http://code.tic.org/tac).
licensed under the LGPL v2.1.

III. License Summary
- LGPL v3.0

LICENSE file

A copy of the license file that should be provided with every OpenIoT library distribution Details are provided in the chapter below.

Beginning comments

All source files (Java, XML, ...) must begin with the comments shown in the following code sample below.

Code obligatory notices:

/**
 * Copyright (c) 2011-2014, OpenIoT
 *
 * …………License Disclaimer……………..
 *
 * Contact: OpenIoT mailto: info@openiot.eu
 */

/**
*
*<File Documentation/Description>
*
 * @author <AuthorName> (<author alias>) e-mail: <author_e-mail>@mailserver.com
 *
 */

Checkstyle

TODO

License Disclaimers

OpenIoT uses LGPL 3.0 so it should provide these terms and conditions . To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found

/**
*    Copyright (c) 2011-2014, OpenIoT
*    
*    This file is part of OpenIoT.
*
*    OpenIoT is free software: you can redistribute it and/or modify
*    it under the terms of the GNU Lesser General Public License as published by
*    the Free Software Foundation, version 3 of the License.
*
*    OpenIoT is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Lesser General Public License for more details.
*
*    You should have received a copy of the GNU Lesser General Public License
*    along with OpenIoT.  If not, see <http://www.gnu.org/licenses/>.
*
*     Contact: OpenIoT mailto: info@openiot.eu
*/

If you have copied code from other programs covered by the same license, copy their copyright notices too. Put all the copyright notices together, right near the top of each file.

You should also include a copy of the license itself in the distribution of your program (attached) usually in the first folder of your project, usually in a file called COPYING.LESSER.txt. Please note that, since the LGPL is a set of additional permissions on top of the GPL, it's important to include both licenses so users have all the materials they need to understand their rights COPYING.txt

Code Structure and Branching

OpenIoT Repository

The OpenIoT repository is divided into branches. The branches are divided into two thematic categories. One is the “Documentation” (i.e., site storage hosted at the “gh-pages” and Wiki). The other one is the “Open IoT source code” branch. The source code category is then divided in two branch types which are:

  • Main branches with an infinite lifetime:
    • Master branch
    • Develop branch
  • Supporting branches:
    • Feature branches
    • Release branches
    • Hotfix branches

Source code Structure

The OpenIoT source code is divided in functionality themes. For example all utilities are under the “utils” folder and all user interfaces under the “ui” folder. The code structure (which is available here is provided below:

  • demo: provides executables and data that can help a user to run a demo
    • data
    • sensors
  • doc: provides all the related documents with the platform.
  • Modules: provides the core modules of the platform
    • x-gsn
    • scheduler
      • scheduler.core
      • scheduler.client
    • sdum
      • sdum.core
      • sdum.client
    • lsm-light
      • lsm-light.client
      • lsm-light.server
    • security
      • security-client
      • security-server
      • security-management
    • CUPUS
    • QoSManager
  • sandbox: provides space for developers to store their test code/apps (developers “playground”).
  • ui: provides all the modules related to the User Interface
    • ui.requestDefinition
    • ui.requestPresentation
    • Integrated Development Environment (IDE)
    • ui.schemaeditor
    • ui.requestCommons
    • CUPUSMobileApplication
  • utils: provides utilities related with the platform
    • demoData
    • lib
    • utils.commons

Git Repository Branching

OpenIoT is using the branching model proposed by Mr. Vincent Driessen "A successful Git branching model" described in details here

Clone this wiki locally