Manual merged of pull request 288

Restructure webinos folder hierarchy.

Jira issue: wp-508
Session variables are again exposed as it limit splitting functionality

- Code divided into smaller classes
- PZP websocket server requires now only 1 server
- It includes addition to run Synchronization Manager
- Separating out RPV code from the session code

Jira Issue: WP-545
Force set device name

Makes it possible to set the device name for a PZP with
--force-device-name=NAME upon startup. This is needed, so it's possible
to start more than one PZP on a single host as the device name will be
based on the hostname by default. The commit changes the various config
methods that are called to pass that custom device name and use it.

It became appearant that sometimes device name and friendly name are mixed
up and can mean the same. This commit changes the code for the PZP to only
use a device name, the friendly name might be only stored in the config
file, but never displayed. For the PZH friendly name is still essentially
the device name.

Also removes some no longer used arguments from the PZP start up script.

Jira-issue: WP-250
Webinos logging mechanism to include only session code.

Logging is based on the webinosName and thus only work for the session code.
Added also mechanism to fetch logs in PZP client testbed page

Messaging and rpc code should have a logging object based on the sessionId.

Jira Issue: WP-526
mdns zeroconf refactoring

Jira Issue: WP-514
Make util work with dependencies.json

Also fix require calls for logging util.

Jira-issue: WP-573
Refactor RPC module loading to util

Code for requiring the api service modules (from in tree) was factored
out into utility code and is not longer part of the rpc code.

Jira-issue: WP-573
Self registering API modules

Add support for API modules that can register one or more RPC services
themself. Modules need to export a "Module" constructor which will be
instantiated by the PZP. "Module" instance are required to have "init"
instance method. This method takes two parameters, a register function and
an unregister function which can be used by the module to register
instantiated RPC services.

This allows API implementations to decide on their own whether to register
a service or not, depending on platform or environment.

Short example for a module implementation:

var MyModule = function(rpcHandler, params) {
	this.rpcHandler = rpcHandler;
	this.params = params;
};

MyModule.prototype.init = function (register, unregister) {
	// instantiate my RPC service, implementd elsewhere
	var service = new MyService(this.rpcHandler, this.params);
	register(service);

	// maybe at some later point in time
	unregister(service);
};

exports.Module = MyModule;

Jira-issue: WP-573
loadservice: clean up required deps, use logger

Use the webinos logger, remove redundant error logging.

Jira-issue: WP-573
Refactor to allow loading one or more modules

loadServiceModules function loads an array of modules while the
loadServiceModule function loads one module. This change refactors both
functions to use the same code.

Jira-issue: wP-573
Add hook for platform logging mechanism

Jira issue: WP-645

This provides a general platform logging hook which allows Android
and other platforms to intercept webinos log messages and direct them
to use a platform-specific mechanism.
Redirect console.[log|error] to platform log if platform log is found.

Jira issue: WP-645

If a platform has a debuglog module, redirect console.log and
console.error to there.
Remove unnecessary getelement() function

Jira Issue: WP-650
MediaContent API to display images, play audio and video.

Addition to the API to display a particular file. Includes test page to test the API.

Remaining issues:
1. Sort mode and filter not implemented
2. Server pushes whole content of the file on the client side. The better approach would be to send in chunks. Client side assembling of the base64 is failing. This needs to be changed to get enhanced performance.

Jira Issue: WP-408
Define command line options once

Combine command line option description and defaults. Always prefer
command line options before options from config file.

Jira-issue: WP-581
Refactoring code for separate PZH web server Enrollment is working from PZH end. From PZH end all data is retrievable. PZH-PZH communication requires notification bit working.

Jira Issue: WP-528
Approve user and PZH-PZH connection

- Temp storage of untrusted certificate
- Make user decision changes
- Service discovery support between pzhs
- Connection between PZHs
- Connected Pzh related fixes.

Jira Issue: WP-528
Add "Seeing is Believing" cross-zone peer authentication Function [2] Integrate PZP peer discovery with SiB [3] Service sharing supports between cross-zone peers [4] UI at PZP landing page to demo the functions

Jira Issue: WP-346
Update per review comments

Jira Issue: WP-346
Handling of service unregistered/registered at PZH web server

 Service are cached for the service registered/unregistered at PZH.
 PZP is restarted those services are not loaded.

Jira Issue: WP-647