From bce6e1295dbc1a28fcd3dbd0d7328a34679ad2d3 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Thu, 18 May 2017 23:03:48 +0200
Subject: [PATCH] Rewrites: - new way of launching applications (core update) -
 first namespaces added + imported BaseHubSystem where needed
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder <roland@mxchange.org>
---
 application/hub/class_ApplicationHelper.php   |  80 ++++++----
 .../apt-proxy/class_BaseNodeAptProxy.php      |   9 +-
 .../hub/classes/blocks/class_BaseBlock.php    |   6 +
 .../hub/classes/chat/class_BaseNodeChat.php   |   9 +-
 .../hub/classes/class_BaseHubSystem.php       |   6 +-
 .../communicator/class_BaseCommunicator.php   |   6 +
 ...lass_NetworkPackageCompressorDecorator.php |   6 +
 .../classes/crawler/class_BaseNodeCrawler.php |   6 +
 .../cruncher/class_BaseHubCruncher.php        |   9 +-
 .../hub/classes/decoder/class_BaseDecoder.php |   6 +
 application/hub/classes/dht/class_BaseDht.php |   6 +
 .../classes/dht/node/class_NodeDhtFacade.php  |   6 +
 .../discovery/class_BaseNodeDiscovery.php     |   3 -
 .../socket/class_PackageSocketDiscovery.php   |   6 +
 .../class_NodeMessageAnnouncementHandler.php  |   6 +
 .../class_BaseMessageHandler.php              |   6 +
 .../helper/class_BaseHubSystemHelper.php      |   9 +-
 .../helper/dht/class_DhtBootstrapHelper.php   |   6 +
 .../dht/class_DhtPublishEntryHelper.php       |   6 +
 .../helper/node/class_BaseNodeHelper.php      |   6 +
 .../hub/classes/info/class_BaseInfo.php       |   6 +
 .../hub/classes/menu/class_HubIndexMenu.php   |   3 -
 .../hub/classes/miner/class_BaseHubMiner.php  |   6 +
 .../hub/classes/nodes/class_BaseHubNode.php   |   9 +-
 .../assembler/class_PackageAssembler.php      |   6 +
 .../classes/package/class_NetworkPackage.php  |   6 +
 .../fragmenter/class_PackageFragmenter.php    |   6 +
 .../hub/classes/pools/class_BasePool.php      |   9 +-
 .../classes/recipient/class_BaseRecipient.php |   6 +
 .../recipient/upper/class_UpperRecipient.php  |   6 +
 .../protocol/class_BaseProtocolResolver.php   |   6 +
 .../hub/classes/scanner/class_BaseScanner.php |   6 +
 .../hub/classes/source/class_BaseSource.php   |   6 +
 .../class_ConnectionStatisticsHelper.php      |   6 +
 .../input/class_RawDataInputStream.php        |   6 +
 .../hub/classes/tags/class_BaseTag.php        |   6 +
 .../template/class_BaseXmlTemplateEngine.php  |   3 -
 .../hub/classes/tools/class_HubTools.php      |   6 +
 application/hub/config-local.php-dist         |   3 +
 application/hub/config.php                    |   6 +-
 application/hub/data.php                      |  43 +-----
 application/hub/debug.php                     |   3 -
 application/hub/exceptions.php                |  58 ++++----
 application/hub/init.php                      |  41 +----
 application/hub/loader.php                    |  28 +---
 application/hub/starter.php                   |  57 +------
 contrib/chat-server.php                       |   2 -
 contrib/mhash-benchmark.php                   |   2 -
 contrib/udp-client.php                        |   2 -
 contrib/udp-inc.php                           |   2 -
 contrib/udp-server.php                        |   2 -
 core                                          |   2 +-
 inc                                           |   1 -
 index.php                                     | 140 +++++++++++++-----
 54 files changed, 394 insertions(+), 309 deletions(-)
 delete mode 120000 inc

diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php
index ad4d8626a..921e80961 100644
--- a/application/hub/class_ApplicationHelper.php
+++ b/application/hub/class_ApplicationHelper.php
@@ -1,4 +1,18 @@
 <?php
+// Must be this namespace, else the launcher cannot find the class.
+namespace CoreFramework\Helper\Application;
+
+// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
+use CoreFramework\Configuration\FrameworkConfiguration;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Loader\ClassLoader;
+use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Object\BaseFrameworkSystem;
+use CoreFramework\Registry\Registerable;
+use CoreFramework\Registry\Registry;
+use CoreFramework\Template\CompileableTemplate;
+
 /**
  * A class holding general data about the application and some methods for
  * the management including the entry point.
@@ -144,43 +158,48 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
 	}
 
 	/**
-	 * Launches the hub system
+	 * 1) Setups application data
 	 *
 	 * @return	void
 	 */
-	public final function entryPoint () {
-		// Set this application in registry
-		Registry::getRegistry()->addInstance('app', $this);
-
-		// Is no external address set?
-		if ($this->getConfigInstance()->getConfigEntry('external_address') == '') {
-			// Determine external address
-			$this->getConfigInstance()->setConfigEntry('external_address', HubTools::determineOwnExternalAddress());
-		} // END - if
-
-		// Default response is console
-		$response = self::getResponseTypeFromSystem();
-		$responseType = self::getResponseTypeFromSystem();
+	public function setupApplicationData () {
+		// Set all application data
+		$this->setAppName('Unit tests and more');
+		$this->setAppVersion('0.0.0');
+		$this->setAppShortName('tests');
+	}
 
-		// Create a new request object
-		$requestInstance = ObjectFactory::createObjectByName(self::convertToClassName($response) . 'Request');
+	/**
+	 * 2) Does initial stuff before starting the application
+	 *
+	 * @return	void
+	 */
+	public function initApplication () {
+		// Get config instance
+		$cfg = FrameworkConfiguration::getSelfInstance();
 
-		// Remember request instance here
-		$this->setRequestInstance($requestInstance);
+		// Initialize output system
+		ApplicationHelper::createDebugInstance('ApplicationHelper');
 
-		// Do we have another response?
-		if ($requestInstance->isRequestElementSet('request')) {
-			// Then use it
-			$response = strtolower($requestInstance->getRequestElement('request'));
-			$responseType = $response;
-		} // END - if
+		/*
+		 * This application needs a database connection then simply call init
+		 * method.
+		 */
+		FrameworkBootstrap::initDatabaseInstance();
 
-		// ... and a new response object
-		$responseClass = sprintf('%sResponse', self::convertToClassName($response));
-		$responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
+		// Get own internal address and set it in config
+		$cfg->setConfigEntry('internal_address', HubTools::determineOwnInternalAddress());
+	}
 
-		// Remember response instance here
-		$this->setResponseInstance($responseInstance);
+	/**
+	 * 3) Launches the application
+	 *
+	 * @return	void
+	 */
+	public function launchApplication () {
+		// Get request/response instances
+		$requestInstance  = FrameworkBootstrap::getRequestInstance();
+		$responseInstance = FrameworkBootstrap::getResponseInstance();
 
 		// Get the parameter from the request
 		$commandName = $requestInstance->getRequestElement('command');
@@ -257,6 +276,3 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
 		return 'node_main';
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php
index c372b2e26..babe4473d 100644
--- a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php
+++ b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\AptProxy;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general NodeAptProxy class
  *
@@ -57,6 +63,3 @@ class BaseNodeAptProxy extends BaseHubSystem {
 		return $this->isActive;
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/blocks/class_BaseBlock.php b/application/hub/classes/blocks/class_BaseBlock.php
index 9425bf744..9eba5a4dd 100644
--- a/application/hub/classes/blocks/class_BaseBlock.php
+++ b/application/hub/classes/blocks/class_BaseBlock.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Block;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Block class
  *
diff --git a/application/hub/classes/chat/class_BaseNodeChat.php b/application/hub/classes/chat/class_BaseNodeChat.php
index a7acc995a..03d9fb5f8 100644
--- a/application/hub/classes/chat/class_BaseNodeChat.php
+++ b/application/hub/classes/chat/class_BaseNodeChat.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Chat;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general NodeChat class
  *
@@ -57,6 +63,3 @@ class BaseNodeChat extends BaseHubSystem {
 		return $this->isActive;
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php
index da5841a67..bc5128542 100644
--- a/application/hub/classes/class_BaseHubSystem.php
+++ b/application/hub/classes/class_BaseHubSystem.php
@@ -1,4 +1,7 @@
 <?php
+// Own namespace
+namespace Hub\Generic;
+
 /**
  * A general hub system class
  *
@@ -286,6 +289,3 @@ class BaseHubSystem extends BaseFrameworkSystem {
 		return $this->getConfigInstance()->getConfigEntry('session_id');
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/communicator/class_BaseCommunicator.php b/application/hub/classes/communicator/class_BaseCommunicator.php
index 8be2c2aec..a16daf3df 100644
--- a/application/hub/classes/communicator/class_BaseCommunicator.php
+++ b/application/hub/classes/communicator/class_BaseCommunicator.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Communicator;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general communicator class
  *
diff --git a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php
index 06957ef60..be047df90 100644
--- a/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php
+++ b/application/hub/classes/compressor/decorator/class_NetworkPackageCompressorDecorator.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Package;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A NetworkPackageCompressor decorator class. This decorator can later be
  * easily extended without changing any other code.
diff --git a/application/hub/classes/crawler/class_BaseNodeCrawler.php b/application/hub/classes/crawler/class_BaseNodeCrawler.php
index d5ce4a5d8..71be29186 100644
--- a/application/hub/classes/crawler/class_BaseNodeCrawler.php
+++ b/application/hub/classes/crawler/class_BaseNodeCrawler.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Crawler;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general NodeCrawler class
  *
diff --git a/application/hub/classes/cruncher/class_BaseHubCruncher.php b/application/hub/classes/cruncher/class_BaseHubCruncher.php
index 76feae5d2..3e5bee5c8 100644
--- a/application/hub/classes/cruncher/class_BaseHubCruncher.php
+++ b/application/hub/classes/cruncher/class_BaseHubCruncher.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Cruncher;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general hub cruncher class
  *
@@ -208,6 +214,3 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
 		return;
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/decoder/class_BaseDecoder.php b/application/hub/classes/decoder/class_BaseDecoder.php
index ba2a1e43d..2170964c1 100644
--- a/application/hub/classes/decoder/class_BaseDecoder.php
+++ b/application/hub/classes/decoder/class_BaseDecoder.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Decoder;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Decoder class
  *
diff --git a/application/hub/classes/dht/class_BaseDht.php b/application/hub/classes/dht/class_BaseDht.php
index 5452bc00e..c30d8daee 100644
--- a/application/hub/classes/dht/class_BaseDht.php
+++ b/application/hub/classes/dht/class_BaseDht.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Dht;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general DHT class
  *
diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php
index 18d9addbd..0f3eacf15 100644
--- a/application/hub/classes/dht/node/class_NodeDhtFacade.php
+++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Node\Dht;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A Node DHT facade class
  *
diff --git a/application/hub/classes/discovery/class_BaseNodeDiscovery.php b/application/hub/classes/discovery/class_BaseNodeDiscovery.php
index 72c2dd8e2..8da491940 100644
--- a/application/hub/classes/discovery/class_BaseNodeDiscovery.php
+++ b/application/hub/classes/discovery/class_BaseNodeDiscovery.php
@@ -33,6 +33,3 @@ class BaseNodeDiscovery extends BaseDiscovery implements Discoverable {
 		parent::__construct($className);
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
index 698c44cb1..4bf16c7a4 100644
--- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
+++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Discovery\Socket;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A socket discovery class
  *
diff --git a/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php b/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php
index 6e4b50300..e9ed6af79 100644
--- a/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php
+++ b/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Handler\Node\Message\Announcement;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A NodeMessageAnnouncement handler
  *
diff --git a/application/hub/classes/handler/message-types/class_BaseMessageHandler.php b/application/hub/classes/handler/message-types/class_BaseMessageHandler.php
index 936f0178a..9ecd0ac0d 100644
--- a/application/hub/classes/handler/message-types/class_BaseMessageHandler.php
+++ b/application/hub/classes/handler/message-types/class_BaseMessageHandler.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Handler\Message;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general message handler, this class must be abstract to make the template
  * method pattern working.
diff --git a/application/hub/classes/helper/class_BaseHubSystemHelper.php b/application/hub/classes/helper/class_BaseHubSystemHelper.php
index 38d6a9c5e..482a99d08 100644
--- a/application/hub/classes/helper/class_BaseHubSystemHelper.php
+++ b/application/hub/classes/helper/class_BaseHubSystemHelper.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Helper;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general hub helper class. This class does not extend BaseHelper.
  *
@@ -91,6 +97,3 @@ class BaseHubSystemHelper extends BaseHubSystem implements HubHelper {
 		// Return it
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php
index 1fc25af21..370afe301 100644
--- a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php
+++ b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Helper\Dht\Bootstrap;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A Bootstrap Dht helper class
  *
diff --git a/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php b/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php
index b4cd7cedf..6219ff6cd 100644
--- a/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php
+++ b/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Helper\Dht\Publish;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A PublishingEntry Dht helper class
  *
diff --git a/application/hub/classes/helper/node/class_BaseNodeHelper.php b/application/hub/classes/helper/node/class_BaseNodeHelper.php
index e2a92b051..6882f20e4 100644
--- a/application/hub/classes/helper/node/class_BaseNodeHelper.php
+++ b/application/hub/classes/helper/node/class_BaseNodeHelper.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Helper\Node;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general node helper class
  *
diff --git a/application/hub/classes/info/class_BaseInfo.php b/application/hub/classes/info/class_BaseInfo.php
index 1a24194e9..210ef070d 100644
--- a/application/hub/classes/info/class_BaseInfo.php
+++ b/application/hub/classes/info/class_BaseInfo.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Information;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Info class
  *
diff --git a/application/hub/classes/menu/class_HubIndexMenu.php b/application/hub/classes/menu/class_HubIndexMenu.php
index 2b004eb1b..d4f8612d8 100644
--- a/application/hub/classes/menu/class_HubIndexMenu.php
+++ b/application/hub/classes/menu/class_HubIndexMenu.php
@@ -45,6 +45,3 @@ class HubIndexMenu extends BaseMenu implements RenderableMenu {
 		return $menuInstance;
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/miner/class_BaseHubMiner.php b/application/hub/classes/miner/class_BaseHubMiner.php
index ecdfaa459..823596aab 100644
--- a/application/hub/classes/miner/class_BaseHubMiner.php
+++ b/application/hub/classes/miner/class_BaseHubMiner.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Miner;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general hub miner class
  *
diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php
index c7677c91f..1d349d636 100644
--- a/application/hub/classes/nodes/class_BaseHubNode.php
+++ b/application/hub/classes/nodes/class_BaseHubNode.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Node;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general hub node class
  *
@@ -841,6 +847,3 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
 		} // END - foreac
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php
index 21d7fd110..e85d72c2a 100644
--- a/application/hub/classes/package/assembler/class_PackageAssembler.php
+++ b/application/hub/classes/package/assembler/class_PackageAssembler.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Package\Assembler;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A PackageAssembler class to assemble a package content stream fragemented
  * by PackageFragmenter back to a raw package data array.
diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php
index c60064e4d..4d753b111 100644
--- a/application/hub/classes/package/class_NetworkPackage.php
+++ b/application/hub/classes/package/class_NetworkPackage.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Package;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A NetworkPackage class. This class implements Deliverable and Receivable
  * because all network packages should be deliverable to other nodes and
diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php
index a816686c8..c9337d39e 100644
--- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php
+++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Package\Fragment;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A PackageFragmenter class to fragment package data into smaller chunks for
  * delivery. This class calculates a final hash on the raw input data and
diff --git a/application/hub/classes/pools/class_BasePool.php b/application/hub/classes/pools/class_BasePool.php
index b03caebb8..40f26c4a0 100644
--- a/application/hub/classes/pools/class_BasePool.php
+++ b/application/hub/classes/pools/class_BasePool.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Pool;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general pool class
  *
@@ -185,6 +191,3 @@ class BasePool extends BaseHubSystem implements Visitable {
 		return $isValid;
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/recipient/class_BaseRecipient.php b/application/hub/classes/recipient/class_BaseRecipient.php
index bdcf99319..e0d9f87e8 100644
--- a/application/hub/classes/recipient/class_BaseRecipient.php
+++ b/application/hub/classes/recipient/class_BaseRecipient.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Receipt;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Recipient class
  *
diff --git a/application/hub/classes/recipient/upper/class_UpperRecipient.php b/application/hub/classes/recipient/upper/class_UpperRecipient.php
index 026c6eeae..04daf637c 100644
--- a/application/hub/classes/recipient/upper/class_UpperRecipient.php
+++ b/application/hub/classes/recipient/upper/class_UpperRecipient.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Network\Receipt\Upper;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A Upper recipient
  *
diff --git a/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php b/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php
index 966971b08..09cb6bf88 100644
--- a/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php
+++ b/application/hub/classes/resolver/protocol/class_BaseProtocolResolver.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Resolver\Protocol;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A generic protocol resolver class
  *
diff --git a/application/hub/classes/scanner/class_BaseScanner.php b/application/hub/classes/scanner/class_BaseScanner.php
index a890efa8c..a2f174cb6 100644
--- a/application/hub/classes/scanner/class_BaseScanner.php
+++ b/application/hub/classes/scanner/class_BaseScanner.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Scanner;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Scanner class
  *
diff --git a/application/hub/classes/source/class_BaseSource.php b/application/hub/classes/source/class_BaseSource.php
index d15fd2369..875c8e114 100644
--- a/application/hub/classes/source/class_BaseSource.php
+++ b/application/hub/classes/source/class_BaseSource.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Source;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Source class
  *
diff --git a/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php b/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php
index a624e8dd5..8299f0f5d 100644
--- a/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php
+++ b/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Helper\Connection;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A helper class for maintaining connection statistics, no instance is
  * required to use this class.
diff --git a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php
index dcd58ca37..8ac84ef2d 100644
--- a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php
+++ b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Stream\Input\Raw;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A class for handling incoming (encoded) raw data with start and end markers.
  * The "stream" is being verified by its length (if modulo 4 of it is always
diff --git a/application/hub/classes/tags/class_BaseTag.php b/application/hub/classes/tags/class_BaseTag.php
index 8525941b5..15fc68a7f 100644
--- a/application/hub/classes/tags/class_BaseTag.php
+++ b/application/hub/classes/tags/class_BaseTag.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Tag;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * A general Tags class
  *
diff --git a/application/hub/classes/template/class_BaseXmlTemplateEngine.php b/application/hub/classes/template/class_BaseXmlTemplateEngine.php
index 6fca12e7c..2894b511b 100644
--- a/application/hub/classes/template/class_BaseXmlTemplateEngine.php
+++ b/application/hub/classes/template/class_BaseXmlTemplateEngine.php
@@ -321,6 +321,3 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine {
 		call_user_func_array(array($this, $methodName), array());
 	}
 }
-
-// [EOF]
-?>
diff --git a/application/hub/classes/tools/class_HubTools.php b/application/hub/classes/tools/class_HubTools.php
index 37636f29c..6293e22fe 100644
--- a/application/hub/classes/tools/class_HubTools.php
+++ b/application/hub/classes/tools/class_HubTools.php
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Tools;
+
+// Import hub-specific stuff
+use Hub\Generic\BaseHubSystem;
+
 /**
  * This class contains static helper functions for our hub
  *
diff --git a/application/hub/config-local.php-dist b/application/hub/config-local.php-dist
index 554d7a265..e8f81fb5c 100644
--- a/application/hub/config-local.php-dist
+++ b/application/hub/config-local.php-dist
@@ -1,4 +1,7 @@
 <?php
+// Import framework stuff
+use CoreFramework\Configuration\FrameworkConfiguration;
+
 /**
  * Local configuration entries which you can customize. Please keep the
  * comments starting with CFG: as-is or else, the later configuration wizard
diff --git a/application/hub/config.php b/application/hub/config.php
index 9f6b3ec6d..6d62de918 100644
--- a/application/hub/config.php
+++ b/application/hub/config.php
@@ -1,4 +1,7 @@
 <?php
+// Import framework stuff
+use CoreFramework\Configuration\FrameworkConfiguration;
+
 /**
  * Configuration entries for this application only
  *
@@ -1585,6 +1588,3 @@ $cfg->setConfigEntry('hub_console_cmd_fuse_resolver_class', 'ConsoleCommandResol
 
 // CFG: ENABLE-FEATURE-FUSE
 $cfg->setConfigEntry('enable_feature_fuse', 'N');
-
-// [EOF]
-?>
diff --git a/application/hub/data.php b/application/hub/data.php
index 8ba4cff74..7d6dceec9 100644
--- a/application/hub/data.php
+++ b/application/hub/data.php
@@ -1,43 +1,2 @@
 <?php
-/**
- * Application data
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @author		Roland Haeder <webmaster@shipsimu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @link		http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Get config instance
-$cfg = FrameworkConfiguration::getSelfInstance();
-
-// Get an instance of the helper
-$app = call_user_func_array(
-	array($cfg->getConfigEntry('app_helper_class'), 'getSelfInstance'),
-	array()
-);
-
-// Set application name and version
-$app->setAppName('Generic Object Sharing Hub');
-$app->setAppVersion('0.0.0');
-$app->setAppShortName('hub');
-
-// [EOF]
-?>
+// @DEPRECATED
diff --git a/application/hub/debug.php b/application/hub/debug.php
index 636f4f933..7fe826b60 100644
--- a/application/hub/debug.php
+++ b/application/hub/debug.php
@@ -23,6 +23,3 @@
 
 // Set error reporting
 error_reporting(E_ALL | E_STRICT);
-
-// [EOF]
-?>
diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php
index 8eefa5ea5..d027c51e2 100644
--- a/application/hub/exceptions.php
+++ b/application/hub/exceptions.php
@@ -1,10 +1,14 @@
 <?php
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+use CoreFramework\Object\BaseFrameworkSystem;
+
 /**
- * An include file for setting up the exception handler of the hub
+ * An include file for setting up the exception handler of test suite
  *
  * @author		Roland Haeder <webmaster@shipsimu.org>
- * @version		0.0
- * @copyright	Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @version		0.0.0
+ * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
  * @license		GNU GPL 3.0 or any newer version
  *
  * This program is free software: you can redistribute it and/or modify
@@ -24,7 +28,7 @@
 // The node's own exception handler
 function hub_exception_handler ($exceptionInstance) {
 	// Is it an object and a valid instance?
-	if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof FrameworkException)) {
+	if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof Exception)) {
 		// Init variable
 		$backTrace = '';
 
@@ -33,14 +37,11 @@ function hub_exception_handler ($exceptionInstance) {
 			// Init argument string
 			$argsString = '';
 
-			// Any arguments?
-			if ((isset($traceArray['args'])) && (is_array($traceArray['args'])) && (count($traceArray['args']) > 0)) {
-				// Convert arguments type into human-readable
-				foreach ($traceArray['args'] as $arg) {
-					$argsString .= ', ' . gettype($arg);
-				} // END - foreach
-				$argsString = substr($argsString, 2);
-			} // END - if
+			// Convert arguments type into human-readable
+			foreach ($traceArray['args'] as $arg) {
+				$argsString .= ', ' . gettype($arg);
+			} // END - foreach
+			$argsString = substr($argsString, 2);
 
 			// Set missing file/line
 			if (!isset($traceArray['file']))  $traceArray['file']  = 'unknown';
@@ -76,9 +77,9 @@ Backtrace:
 --------------------------------------------------------------------------------
 %s
 --------------------------------------------------------------------------------\n",
-			trim(html_entity_decode(strip_tags($exceptionInstance->__toString()))),
+			trim(html_entity_decode(strip_tags(get_class($exceptionInstance)))),
 			trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))),
-			$exceptionInstance->getHexCode(),
+			($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode())),
 			$exceptionInstance->getFile(),
 			$exceptionInstance->getLine(),
 			trim($backTrace)
@@ -86,18 +87,21 @@ Backtrace:
 
 		// Output the message
 		print($message);
+	} elseif (is_object($exceptionInstance)) {
+		// Output more details
+		printf('exceptionInstance=%s', print_r($exceptionInstance, true));
 	} else {
 		/*
 		 * Invalid exception instance detected! Do *only* throw exceptions that
 		 * extends our own exception 'FrameworkException' to get such nice
 		 * outputs like above.
 		 */
-		print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.');
+		printf('exceptionInstance[]=%s is invalid! Please inform the core developer team.' . PHP_EOL, gettype($exceptionInstance));
 	}
 }
 
 // Error handler
-function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) {
+function hub_error_handler ($errno, $errstr, $errfile, $errline, array $errcontext) {
 	// Construct the message
 	$message = sprintf('File: %s, Line: %s, Code: %s, Message: %s',
 		basename($errfile),
@@ -111,7 +115,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext)
 } // END - function
 
 // Assertion handler
-function __assertHandler ($file, $line, $code) {
+function hub_assert_handler ($file, $line, $code) {
 	// Empty code?
 	if ($code === '') {
 		$code = '<em>Unknown</em>';
@@ -125,7 +129,6 @@ function __assertHandler ($file, $line, $code) {
 	);
 
 	// Log assert
-	die($message . PHP_EOL);
 	syslog(LOG_WARNING, $message);
 
 	// Throw an exception here
@@ -133,19 +136,14 @@ function __assertHandler ($file, $line, $code) {
 } // END - function
 
 // Set error handler
-//set_error_handler('__errorHandler');
+//set_error_handler('hub_error_handler');
 
-// Set the exception handler
+// Set the new handler
 set_exception_handler('hub_exception_handler');
 
 // Init assert handling
-assert_options(ASSERT_ACTIVE    , TRUE);
-assert_options(ASSERT_WARNING   , FALSE);
-assert_options(ASSERT_BAIL      , TRUE);
-assert_options(ASSERT_QUIET_EVAL, FALSE);
-
-// Set assertion handler
-assert_options(ASSERT_CALLBACK  , '__assertHandler');
-
-// [EOF]
-?>
+assert_options(ASSERT_ACTIVE    , true);
+assert_options(ASSERT_WARNING   , false);
+assert_options(ASSERT_BAIL      , true);
+assert_options(ASSERT_QUIET_EVAL, false);
+assert_options(ASSERT_CALLBACK  , 'hub_assert_handler');
diff --git a/application/hub/init.php b/application/hub/init.php
index 548d5172e..7d6dceec9 100644
--- a/application/hub/init.php
+++ b/application/hub/init.php
@@ -1,41 +1,2 @@
 <?php
-/**
- * Application initializer
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @author		Roland Haeder <webmaster@shipsimu.org>
- * @version		0.0
- * @copyright	Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license		GNU GPL 3.0 or any newer version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Get config instance
-$cfg = FrameworkConfiguration::getSelfInstance();
-
-// Initialize output system
-ApplicationHelper::createDebugInstance('ApplicationHelper');
-
-// This application needs a database connection then we have to simply include
-// the inc/database.php script
-require($cfg->getConfigEntry('base_path') . 'inc/database.php');
-
-// Get own internal address and set it in config
-$cfg->setConfigEntry('internal_address', HubTools::determineOwnInternalAddress());
-
-// [EOF]
-?>
+// @DEPRECATED
diff --git a/application/hub/loader.php b/application/hub/loader.php
index 0cf80532e..7d6dceec9 100644
--- a/application/hub/loader.php
+++ b/application/hub/loader.php
@@ -1,28 +1,2 @@
 <?php
-/**
- * The application's class loader
- *
- * @author		Roland Haeder <webmaster@shipsimu.org>
- * @version		0.0
- * @copyright	Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license		GNU GPL 3.0 or any newer version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Scan for application's classes, exceptions and interfaces
-ClassLoader::scanApplicationClasses();
-
-// [EOF]
-?>
+// @DEPRECATED
diff --git a/application/hub/starter.php b/application/hub/starter.php
index 6abc2e616..7d6dceec9 100644
--- a/application/hub/starter.php
+++ b/application/hub/starter.php
@@ -1,57 +1,2 @@
 <?php
-/**
- * The application launcher
- *
- * @author		Roland Haeder <webmaster@shipsimu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @link		http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Is there an application helper instance? We need the method main() for
-// maining the application
-$app = call_user_func_array(
-	array(
-		FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), 'getSelfInstance'
-	), array()
-);
-
-// Some sanity checks
-if ((empty($app)) || (is_null($app))) {
-	// Something went wrong!
-	ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because the helper class <span class="class_name">%s</span> is not loaded.',
-		$application,
-		FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class')
-	));
-} elseif (!is_object($app)) {
-	// No object!
-	ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because &#39;app&#39; is not an object.',
-		$application
-	));
-} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) {
-	// Method not found!
-	ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because the method <span class="method_name">%s</span> is missing.',
-		$application,
-		FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')
-	));
-}
-
-// Call user function
-call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array());
-
-// [EOF]
-?>
+// @DEPRECATED
diff --git a/contrib/chat-server.php b/contrib/chat-server.php
index 4544db4b2..997b5ad5f 100644
--- a/contrib/chat-server.php
+++ b/contrib/chat-server.php
@@ -163,5 +163,3 @@ while (count($clients) > 0) {
 
 // close the listening socket
 socket_close($main_sock);
-
-?>
diff --git a/contrib/mhash-benchmark.php b/contrib/mhash-benchmark.php
index 41061d39e..ed44183f0 100644
--- a/contrib/mhash-benchmark.php
+++ b/contrib/mhash-benchmark.php
@@ -63,5 +63,3 @@ asort($timers);
 
 print 'Result from mhash() benchmark (in seconds per hasher):' . "\r\n";
 print_r($timers) . "\n";
-
-?>
diff --git a/contrib/udp-client.php b/contrib/udp-client.php
index d5dd3610e..a260db09d 100644
--- a/contrib/udp-client.php
+++ b/contrib/udp-client.php
@@ -171,5 +171,3 @@ if (count($data) > 0) {
 out(__FILE__, __LINE__, 'MIN/AVG/MAX=' . $min . '/' . $avg . '/' . $max . '');
 out(__FILE__, __LINE__, 'INVALID=' . $invalid . '');
 out(__FILE__, __LINE__, 'FAILED=' . $failed . '');
-
-?>
diff --git a/contrib/udp-inc.php b/contrib/udp-inc.php
index 47f2607bf..86e2f076b 100644
--- a/contrib/udp-inc.php
+++ b/contrib/udp-inc.php
@@ -7,5 +7,3 @@ function out ($file, $line, $message, $displayDouble = FALSE) {
 		$GLOBALS['last_message'] = $message;
 	}
 }
-
-?>
diff --git a/contrib/udp-server.php b/contrib/udp-server.php
index 55d58efa1..c4bf936a8 100644
--- a/contrib/udp-server.php
+++ b/contrib/udp-server.php
@@ -65,5 +65,3 @@ do {
 	// Sleep a little
 	if (function_exists('time_nanosleep')) time_nanosleep(0, 500000);
 } while ($pkt !== FALSE);
-
-?>
diff --git a/core b/core
index 1893995b3..afe4936b8 160000
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 1893995b39b02c07012c5f3795654fb9251b5ebd
+Subproject commit afe4936b8a55f38736e1af5191a964a926d7255a
diff --git a/inc b/inc
deleted file mode 120000
index a13f35ca5..000000000
--- a/inc
+++ /dev/null
@@ -1 +0,0 @@
-core/inc/
\ No newline at end of file
diff --git a/index.php b/index.php
index 0a3ef7411..f0f02f6df 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,19 @@
 <?php
+// Own namespace (watch out: core)
+namespace CoreFramework\EntryPoint;
+
+// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
+use CoreFramework\Configuration\FrameworkConfiguration;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Helper\Application\ApplicationHelper;
+use CoreFramework\Localization\LanguageSystem;
+use CoreFramework\Loader\ClassLoader;
+use CoreFramework\Generic\FrameworkException;
+
+// Import SPL stuff
+use \Exception;
+
 /**
  * The main class with the entry point to the whole application. This class
  * "emulates" Java's entry point call. Additionally it covers local
@@ -28,9 +43,9 @@
  */
 final class ApplicationEntryPoint {
 	/**
-	 * Core path
+	 * Framework path
 	 */
-	private static $corePath = '';
+	private static $frameworkPath = '';
 
 	/**
 	 * The application's emergency exit
@@ -42,7 +57,7 @@ final class ApplicationEntryPoint {
 	 * @return	void
 	 * @todo	This method is old code and needs heavy rewrite and should be moved to ApplicationHelper
 	 */
-	public static final function app_exit ($message = '', $code = FALSE, $extraData = '', $silentMode = FALSE) {
+	public static final function app_exit ($message = '', $code = false, $extraData = '', $silentMode = false) {
 		// Is this method already called?
 		if (isset($GLOBALS['app_die_called'])) {
 			// Then output the text directly
@@ -50,7 +65,7 @@ final class ApplicationEntryPoint {
 		} // END - if
 
 		// This method shall not be called twice
-		$GLOBALS['app_die_called'] = TRUE;
+		$GLOBALS['app_die_called'] = true;
 
 		// Is a message set?
 		if (empty($message)) {
@@ -62,13 +77,13 @@ final class ApplicationEntryPoint {
 		$configInstance = FrameworkConfiguration::getSelfInstance();
 
 		// Do we have debug installation?
-		if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === TRUE)) {
+		if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) {
 			// Abort here
 			exit();
 		} // END - if
 
 		// Get some instances
-		$tpl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('html_template_class');
+		$tpl = $configInstance->getConfigEntry('html_template_class');
 		$languageInstance = LanguageSystem::getSelfInstance();
 
 		// Initialize template instance here to avoid warnings in IDE
@@ -84,7 +99,7 @@ final class ApplicationEntryPoint {
 				// Get the template instance from our object factory
 				$templateInstance = ObjectFactory::createObjectByName($tpl);
 			} catch (FrameworkException $e) {
-				exit(sprintf("[Main:] Could not initialize template engine for reason: <span class=\"exception_reason\">%s</span>",
+				exit(sprintf('[Main:] Could not initialize template engine for reason: <span class="exception_reason">%s</span>',
 					$e->getMessage()
 				));
 			}
@@ -105,7 +120,7 @@ final class ApplicationEntryPoint {
 				} // END - if
 
 				// Add the traceback path to the final output
-				$backtrace .= sprintf("<span class=\"backtrace_file\">%s</span>:%d, <span class=\"backtrace_function\">%s(%d)</span><br />\n",
+				$backtrace .= sprintf('<span class="backtrace_file">%s</span>:%d, <span class="backtrace_function">%s(%d)</span><br />' . PHP_EOL,
 					basename($trace['file']),
 					$trace['line'],
 					$trace['function'],
@@ -117,7 +132,7 @@ final class ApplicationEntryPoint {
 			$applicationInstance = NULL;
 
 			// Is the class there?
-			if (class_exists('ApplicationHelper')) {
+			if (class_exists('CoreFramework\Helper\Application\ApplicationHelper')) {
 				// Get application instance
 				$applicationInstance = ApplicationHelper::getSelfInstance();
 
@@ -166,52 +181,109 @@ final class ApplicationEntryPoint {
 	}
 
 	/**
-	 * Determines the correct absolute path for all includes only once per run.
-	 * Other calls of this method are being "cached".
+	 * Determines the correct absolute path for the framework. A set of common
+	 * paths is being tested (first most common for applications, second when
+	 * core tests are being executed and third/forth if the framework has been
+	 * cloned there).
 	 *
-	 * @return	$corePath	Base path (core) for all includes
+	 * @return	$frameworkPath	Path for framework
 	 */
-	protected static final function detectCorePath () {
+	public static final function detectFrameworkPath () {
 		// Is it not set?
-		if (empty(self::$corePath)) {
-			// Auto-detect our core path
-			self::$corePath = str_replace("\\", '/', dirname(__FILE__));
+		if (empty(self::$frameworkPath)) {
+			// Auto-detect core path (first application-common)
+			foreach (array('core', '.', '/usr/local/share/php/core', '/usr/share/php/core') as $possiblePath) {
+				// Create full path for testing
+				$realPath = realpath($possiblePath);
+
+				// Debug message
+				//* NOISY-DEBUG: */ printf('[%s:%d]: realPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($realPath), $realPath);
+
+				// Is it false?
+				if ($realPath === false) {
+					// Then, not found.
+					continue;
+				} // END - if
+
+				// First create full-qualified file name (FQFN) to framework/config-global.php
+				$fqfn = sprintf(
+					'%s%sframework%sconfig-global.php',
+					$realPath,
+					DIRECTORY_SEPARATOR,
+					DIRECTORY_SEPARATOR,
+					$possiblePath
+				);
+
+				// Debug message
+				//* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn);
+
+				// Is it readable?
+				if (is_readable($fqfn)) {
+					// Found one
+					self::$frameworkPath = $realPath . '/framework/';
+
+					// Abort here
+					break;
+				} // END - if
+			} // END - foreach
+
+			// Able to find?
+			if (!is_dir(self::$frameworkPath)) {
+				// Is no directory
+				throw new Exception('Cannot find framework.');
+			} // END - if
 		} // END - if
 
 		// Return it
-		return self::$corePath;
+		return self::$frameworkPath;
 	}
 
 	/**
-	 * The application's main entry point. This class isolates some local
+	 * Getter for root path
+	 *
+	 * @return	$rootPath	Root path
+	 */
+	public static function getRootPath () {
+		// Get __DIR__, really simple and no detection
+		return __DIR__;
+	}
+
+	/**
+	 * The framework's main entry point. This class isolates some local
 	 * variables which shall not become visible to outside because of security
-	 * concerns. We are doing this here to "emulate" the well-known entry
-	 * point in Java.
+	 * concerns. This is done here to "emulate" the well-known entry point in
+	 * Java.
 	 *
 	 * @return	void
 	 */
 	public static final function main () {
-		// Load config file
-		require(self::detectCorePath() . '/inc/config.php');
+		// Load bootstrap file
+		require sprintf('%sbootstrap%sbootstrap.inc.php', self::detectFrameworkPath(), DIRECTORY_SEPARATOR);
 
-		// Load all include files
-		require($cfg->getConfigEntry('base_path') . 'inc/includes.php');
+		/*
+		 * Initial bootstrap is done, continue with initialization of
+		 * framework.
+		 */
+		FrameworkBootstrap::initFramework();
 
-		// Include the application selector
-		require($cfg->getConfigEntry('base_path') . 'inc/selector.php');
-	} // END - main()
-} // END - class
+		// Next initialize the detected application
+		FrameworkBootstrap::prepareApplication();
+
+		/*
+		 * Last step is to start the application, this will also initialize and
+		 * register the application instance in registry.
+		 */
+		FrameworkBootstrap::startApplication();
+	}
+}
 
 // Developer mode active? Comment out if no dev!
-define('DEVELOPER', TRUE);
+define('DEVELOPER', true);
 
 // Log all exceptions (only debug! This option can create large error logs)
-//define('LOG_EXCEPTIONS', TRUE);
+//define('LOG_EXCEPTIONS', true);
 
 //xdebug_start_trace();
 
-// Do not remove the following line:
+// Call above main() method
 ApplicationEntryPoint::main();
-
-// [EOF]
-?>
-- 
2.39.5