use Org\Shipsimu\Hub\Container\BaseHubContainer;
use Org\Shipsimu\Hub\Factory\Network\Locator\UniversalNodeLocatorFactory;
use Org\Shipsimu\Hub\Factory\Socket\SocketFactory;
+use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Helper\Connection\BaseConnectionHelper;
use Org\Shipsimu\Hub\Helper\Connection\ConnectionHelper;
use Org\Shipsimu\Hub\Information\ShareableInfo;
use Org\Shipsimu\Hub\Listener\BaseListener;
use Org\Shipsimu\Hub\Listener\Listenable;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
-use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
-use Org\Mxchange\CoreFramework\Helper\Helper;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Socket\InvalidSocketException;
use Org\Mxchange\CoreFramework\Socket\NoSocketErrorDetectedException;
use Org\Mxchange\CoreFramework\Socket\SocketConnectionException;
use Org\Mxchange\CoreFramework\Socket\SocketOperationException;
use Org\Mxchange\CoreFramework\Socket\UnsupportedSocketErrorHandlerException;
+use Org\Mxchange\CoreFramework\Traits\Helper\HelperTrait;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
use Org\Mxchange\CoreFramework\Visitor\Visitor;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SocketContainer extends BaseHubContainer implements StorableSocket, Visitable, Registerable {
+ // Load traits
+ use HelperTrait;
+
/**
* Socket protocol:
* - 'tcp' for TCP/IPv4 connections
*/
private $socketResource = false;
- /**
- * A helper instance for the form
- */
- private $helperInstance = NULL;
-
/**
* Protected constructor
*
*/
public function shutdownSocket () {
// Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource() . ' with state ' . $this->getPrintableState() . ' ...');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource() . ' with state ' . $this->getHelperInstance()->getPrintableState() . ' ...');
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_socket_visitor_class');
*/
public function halfShutdownSocket () {
// Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Half-shutting down socket resource ' . $this->getSocketResource() . ' with state ' . $this->getPrintableState() . ' ...');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Half-shutting down socket resource ' . $this->getSocketResource() . ' with state ' . $this->getHelperInstance()->getPrintableState() . ' ...');
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('half_shutdown_socket_visitor_class');
return $this->socketResource;
}
- /**
- * Setter for helper instance
- *
- * @param $helperInstance An instance of a helper class
- * @return void
- */
- protected final function setHelperInstance (Helper $helperInstance) {
- $this->helperInstance = $helperInstance;
- }
-
- /**
- * Getter for helper instance
- *
- * @return $helperInstance An instance of a helper class
- */
- public final function getHelperInstance () {
- return $this->helperInstance;
- }
-
}
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Socket\InvalidSocketException;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait;
use Org\Mxchange\CoreFramework\Traits\Visitor\VisitorTrait;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
$nextPackageInstance = $this->getStackInstance()->popNamed($stackerName);
// Compare both hashes
- if ($nextPackageInstance->getPackageHash() != $packageInstance->getPackageHash()) {
+ //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+ if ($nextPackageInstance->getContentHash() != $packageInstance->getContentHash()) {
// Hash is not matching
- throw new InvalidArgumentException(sprintf('Hashes "%s" and "%s" are mismatching.', $packageInstance->getPackageHash(), $nextPackageInstance->getPackageHash()));
+ throw new InvalidArgumentException(sprintf('Hashes "%s" and "%s" are mismatching.', $packageInstance->getContentHash(), $nextPackageInstance->getContentHash()));
}
// Temporary set the new status
// Import application-specific stuff
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
/**
* A general hub helper class. This class does not extend BaseHelper.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class BaseHubSystemHelper extends BaseHubSystem implements HubHelper {
+abstract class BaseHubSystemHelper extends BaseHubSystem implements HubHelper {
/**
* Recipient id
*/
*/
private $packageTags = [];
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
/**
* Protected constructor
*
$this->packageTags = $packageTags;
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Tries to determine the used protocol for this package (this helper is helping to send out)
*
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Helper\Helper;
+use Org\Mxchange\CoreFramework\Traits\Helper\HelperTrait;
/**
* A general Info class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseInfo extends BaseHubSystem {
- /**
- * A helper instance for the form
- */
- private $helperInstance = NULL;
+ // Load traits
+ use HelperTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for helper instance
- *
- * @param $helperInstance An instance of a helper class
- * @return void
- */
- protected final function setHelperInstance (Helper $helperInstance) {
- $this->helperInstance = $helperInstance;
- }
-
- /**
- * Getter for helper instance
- *
- * @return $helperInstance An instance of a helper class
- */
- public final function getHelperInstance () {
- return $this->helperInstance;
- }
-
}
use Org\Shipsimu\Hub\Producer\Cruncher\BaseCruncherProducer;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Helper\Helper;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Helper\HelperTrait;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general UnitProducer class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseUnitProducer extends BaseCruncherProducer {
+ // Load traits
+ use HelperTrait;
+ use CompileableTemplateTrait;
+
/**
* Work/test unit status
*/
const UNIT_TYPE_TEST_UNIT = 'test_unit';
const UNIT_TYPE_TEST_WORK = 'work_unit';
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
- /**
- * A helper instance for the form
- */
- private $helperInstance = NULL;
-
/**
* Protected constructor
*
parent::__construct($className);
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- protected final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
- /**
- * Setter for helper instance
- *
- * @param $helperInstance An instance of a helper class
- * @return void
- */
- protected final function setHelperInstance (Helper $helperInstance) {
- $this->helperInstance = $helperInstance;
- }
-
- /**
- * Getter for helper instance
- *
- * @return $helperInstance An instance of a helper class
- */
- public final function getHelperInstance () {
- return $this->helperInstance;
- }
-
}
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general communicator state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general crawler state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general cruncher state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general DHT state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general miner state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general node state class
// Import framework stuff
use Org\Mxchange\CoreFramework\State\BaseState;
+use Org\Mxchange\CoreFramework\State\UnexpectedStateException;
/**
* A general peer state class
// Import framework stuff
use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general Tags class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseTag extends BaseHubSystem implements Registerable {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* An array with all tags
*/
private $tags = [];
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
/**
* Protected constructor
*
return $this->tags;
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- protected final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
}
-Subproject commit 2a3f6350600cf6ad214923c57aef772dc5c0cb76
+Subproject commit 6187a6c39a906ce7ae3ae89cdbc4f6a59a69535d