namespace Org\Shipsimu\Hub\Generic;
// Import application-specific stuff
-use Org\ShipSimu\Hub\Communicator\Communicator;
use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
-use Org\Shipsimu\Hub\Crawler\Source\Source;
-use Org\Shipsimu\Hub\Handler\Protocol\HandleableProtocol;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
-use Org\Shipsimu\Hub\Information\ShareableInfo;
-use Org\Shipsimu\Hub\Listener\BaseListener;
-use Org\Shipsimu\Hub\Listener\Listenable;
-use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
-use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
-use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\Fragmentable;
-use Org\Shipsimu\Hub\Network\Receive\Receivable;
-use Org\Shipsimu\Hub\Pool\Poolable;
// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
*/
const BOOTSTRAP_NODES_SEPARATOR = ';';
- /**
- * An instance of a node
- */
- private $nodeInstance = NULL;
-
- /**
- * A network package handler instance
- */
- private $packageHandlerInstance = NULL;
-
- /**
- * A Receivable instance
- */
- private $receiverInstance = NULL;
-
- /**
- * Listener pool instance
- */
- private $listenerPoolInstance = NULL;
-
- /**
- * Fragmenter instance
- */
- private $fragmenterInstance = NULL;
-
- /**
- * Info instance
- */
- private $infoInstance = NULL;
-
- /**
- * Listener instance
- */
- private $listenerInstance = NULL;
-
- /**
- * A HandleableProtocol instance
- */
- private $protocolInstance = NULL;
-
/**
* A StorableSocket instance
*/
private $socketInstance = NULL;
- /**
- * An instance of a LocateableNode class
- */
- private $universalNodeLocatorInstance = NULL;
-
- /**
- * An instance of a communicator
- */
- private $communicatorInstance = NULL;
-
- /**
- * An instance of a Source class
- */
- private $sourceInstance = NULL;
-
- /**
- * Package instance
- */
- private $packageInstance = NULL;
-
- /**
- * Name of used protocol
- */
- private $protocolName = 'invalid';
-
/**
* Protected constructor
*
return $isset;
}
- /**
- * Setter for network package handler instance
- *
- * @param $packageHandlerInstance The network package instance we shall set
- * @return void
- */
- protected final function setPackageHandlerInstance (Deliverable $packageHandlerInstance) {
- $this->packageHandlerInstance = $packageHandlerInstance;
- }
-
- /**
- * Getter for network package handler instance
- *
- * @return $packageHandlerInstance The network package handler instance we shall set
- */
- protected final function getPackageHandlerInstance () {
- return $this->packageHandlerInstance;
- }
-
- /**
- * Setter for receiver instance
- *
- * @param $receiverInstance A Receivable instance we shall set
- * @return void
- */
- protected final function setReceiverInstance (Receivable $receiverInstance) {
- $this->receiverInstance = $receiverInstance;
- }
-
- /**
- * Getter for receiver instance
- *
- * @return $receiverInstance A Receivable instance we shall get
- */
- protected final function getReceiverInstance () {
- return $this->receiverInstance;
- }
-
- /**
- * Setter for listener pool instance
- *
- * @param $listenerPoolInstance The new listener pool instance
- * @return void
- */
- protected final function setListenerPoolInstance (Poolable $listenerPoolInstance) {
- $this->listenerPoolInstance = $listenerPoolInstance;
- }
-
- /**
- * Getter for listener pool instance
- *
- * @return $listenerPoolInstance Our current listener pool instance
- */
- public final function getListenerPoolInstance () {
- return $this->listenerPoolInstance;
- }
-
- /**
- * Setter for fragmenter instance
- *
- * @param $fragmenterInstance A Fragmentable instance
- * @return void
- */
- protected final function setFragmenterInstance (Fragmentable $fragmenterInstance) {
- $this->fragmenterInstance = $fragmenterInstance;
- }
-
- /**
- * Getter for fragmenter instance
- *
- * @return $fragmenterInstance A Fragmentable instance
- */
- protected final function getFragmenterInstance () {
- return $this->fragmenterInstance;
- }
-
- /**
- * Setter for info instance
- *
- * @param $infoInstance A ShareableInfo instance
- * @return void
- */
- protected final function setInfoInstance (ShareableInfo $infoInstance) {
- $this->infoInstance = $infoInstance;
- }
-
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- public final function getInfoInstance () {
- return $this->infoInstance;
- }
-
/**
* Setter for node id
*
return $this->getConfigInstance()->getConfigEntry('session_id');
}
- /**
- * Setter for listener instance
- *
- * @param $listenerInstance A Listenable instance
- * @return void
- */
- public final function setListenerInstance (Listenable $listenerInstance) {
- $this->listenerInstance = $listenerInstance;
- }
-
- /**
- * Getter for listener instance
- *
- * @return $listenerInstance A Listenable instance
- */
- public final function getListenerInstance () {
- return $this->listenerInstance;
- }
-
- /**
- * Setter for HandleableProtocol instance
- *
- * @param $protocolInstance An instance of an HandleableProtocol
- * @return void
- */
- public final function setProtocolInstance (HandleableProtocol $protocolInstance) {
- $this->protocolInstance = $protocolInstance;
- }
-
- /**
- * Getter for HandleableProtocol instance
- *
- * @return $protocolInstance An instance of an HandleableProtocol
- */
- public final function getProtocolInstance () {
- return $this->protocolInstance;
- }
-
- /**
- * Getter for protocol name
- *
- * @return $protocolName Name of used protocol
- */
- public final function getProtocolName () {
- return $this->protocolName;
- }
-
- /**
- * Setter for protocol name
- *
- * @param $protocolName Name of used protocol
- * @return void
- */
- protected final function setProtocolName ($protocolName) {
- $this->protocolName = $protocolName;
- }
-
/**
* Setter for socket instance
*
return $this->socketInstance;
}
- /**
- * Setter for UNL instance
- *
- * @para $locatorInstance An instance of a LocateableNode class
- * @return void
- */
- protected final function setUniversalNodeLocatorInstance (LocateableNode $locatorInstance) {
- // Set new UNL data array
- $this->universalNodeLocatorInstance = $locatorInstance;
- }
-
- /**
- * Getter for UNL instance
- *
- * @return $unlData An instance of a LocateableNode class
- */
- public final function getUniversalNodeLocatorInstance () {
- // Return UNL data array
- return $this->universalNodeLocatorInstance;
- }
-
- /**
- * Getter for communicator instance
- *
- * @return $communicatorInstance An instance of a Communicator class
- */
- public final function getCommunicatorInstance () {
- return $this->communicatorInstance;
- }
-
- /**
- * Setter for communicator instance
- *
- * @param $communicatorInstance An instance of a Communicator class
- * @return void
- */
- protected final function setCommunicatorInstance (Communicator $communicatorInstance) {
- $this->communicatorInstance = $communicatorInstance;
- }
-
- /**
- * Setter for a Source instance
- *
- * @param $sourceInstance An instance of a Source class
- * @return void
- */
- protected final function setSourceInstance (Source $sourceInstance) {
- $this->sourceInstance = $sourceInstance;
- }
-
- /**
- * Getter for a Source instance
- *
- * @return $sourceInstance An instance of a Source class
- */
- protected final function getSourceInstance () {
- return $this->sourceInstance;
- }
-
- /**
- * Setter for package instance
- *
- * @param $packageInstance An instance of a DeliverablePackage instance
- * @return void
- */
- public final function setPackageInstance (DeliverablePackage $packageInstance) {
- $this->packageInstance = $packageInstance;
- }
-
- /**
- * Getter for package instance
- *
- * @return $packageInstance An instance of a DeliverablePackage instance
- */
- public function getPackageInstance () {
- return $this->packageInstance;
- }
-
}
use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
use Org\Shipsimu\Hub\Generic\HubInterface;
-use Org\Shipsimu\Hub\Information\ShareableInfo;
use Org\Shipsimu\Hub\Listener\Listenable;
-use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
use Org\Shipsimu\Hub\Pool\Poolable;
// Import framework stuff
*/
private $listenerPoolInstance = NULL;
- /**
- * Info instance
- */
- private $infoInstance = NULL;
-
/**
* A StorableSocket instance
*/
private $socketInstance = NULL;
- /**
- * An instance of a LocateableNode class
- */
- private $universalNodeLocatorInstance = NULL;
-
/**
* Protected constructor
*
return $this->listenerPoolInstance;
}
- /**
- * Setter for info instance
- *
- * @param $infoInstance A ShareableInfo instance
- * @return void
- */
- protected final function setInfoInstance (ShareableInfo $infoInstance) {
- $this->infoInstance = $infoInstance;
- }
-
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- public final function getInfoInstance () {
- return $this->infoInstance;
- }
-
/**
* Setter for socket instance
*
return $this->socketInstance;
}
- /**
- * Setter for UNL instance
- *
- * @para $locatorInstance An instance of a LocateableNode class
- * @return void
- */
- protected final function setUniversalNodeLocatorInstance (LocateableNode $locatorInstance) {
- // Set new UNL data array
- $this->universalNodeLocatorInstance = $locatorInstance;
- }
-
- /**
- * Getter for UNL instance
- *
- * @return $unlData An instance of a LocateableNode class
- */
- public final function getUniversalNodeLocatorInstance () {
- // Return UNL data array
- return $this->universalNodeLocatorInstance;
- }
-
/**
* Setter for node id
*
use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
use Org\Shipsimu\Hub\Generic\HubInterface;
-use Org\Shipsimu\Hub\Information\ShareableInfo;
-use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
use Org\Shipsimu\Hub\Node\Node;
use Org\Shipsimu\Hub\Pool\Poolable;
*/
private $listenerPoolInstance = NULL;
- /**
- * Info instance
- */
- private $infoInstance = NULL;
-
/**
* A StorableSocket instance
*/
private $socketInstance = NULL;
- /**
- * An instance of a LocateableNode class
- */
- private $universalNodeLocatorInstance = NULL;
-
/**
* Node instance
*/
return $this->listenerPoolInstance;
}
- /**
- * Setter for info instance
- *
- * @param $infoInstance A ShareableInfo instance
- * @return void
- */
- protected final function setInfoInstance (ShareableInfo $infoInstance) {
- $this->infoInstance = $infoInstance;
- }
-
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- public final function getInfoInstance () {
- return $this->infoInstance;
- }
-
/**
* Setter for socket instance
*
return $this->socketInstance;
}
- /**
- * Setter for UNL instance
- *
- * @para $locatorInstance An instance of a LocateableNode class
- * @return void
- */
- protected final function setUniversalNodeLocatorInstance (LocateableNode $locatorInstance) {
- // Set new UNL data array
- $this->universalNodeLocatorInstance = $locatorInstance;
- }
-
- /**
- * Getter for UNL instance
- *
- * @return $unlData An instance of a LocateableNode class
- */
- public final function getUniversalNodeLocatorInstance () {
- // Return UNL data array
- return $this->universalNodeLocatorInstance;
- }
-
/**
* Setter for node id
*
// Import application-specific stuff
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
+use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
/**
* A general Decoder class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseDecoder extends BaseHubSystem {
+ /**
+ * A network package handler instance
+ */
+ private $packageHandlerInstance = NULL;
+
/**
* Protected constructor
*
parent::__construct($className);
}
+ /**
+ * Setter for network package handler instance
+ *
+ * @param $packageHandlerInstance The network package instance we shall set
+ * @return void
+ */
+ protected final function setPackageHandlerInstance (Deliverable $packageHandlerInstance) {
+ $this->packageHandlerInstance = $packageHandlerInstance;
+ }
+
+ /**
+ * Getter for network package handler instance
+ *
+ * @return $packageHandlerInstance The network package handler instance we shall set
+ */
+ protected final function getPackageHandlerInstance () {
+ return $this->packageHandlerInstance;
+ }
+
}
use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
use Org\Shipsimu\Hub\Generic\HubInterface;
-use Org\Shipsimu\Hub\Information\ShareableInfo;
use Org\Shipsimu\Hub\Listener\Listenable;
use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
use Org\Shipsimu\Hub\Network\Package\Receiver\Assembler\Assembler;
*/
private $listenerPoolInstance = NULL;
- /**
- * Info instance
- */
- private $infoInstance = NULL;
-
/**
* Node instance
*/
return $this->listenerPoolInstance;
}
- /**
- * Setter for info instance
- *
- * @param $infoInstance A ShareableInfo instance
- * @return void
- */
- protected final function setInfoInstance (ShareableInfo $infoInstance) {
- $this->infoInstance = $infoInstance;
- }
-
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- public final function getInfoInstance () {
- return $this->infoInstance;
- }
-
/**
* Setter for socket instance
*
use Org\Shipsimu\Hub\Factory\State\Peer\PeerStateFactory;
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Helper\BaseHubSystemHelper;
+use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
+use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\Fragmentable;
// Import framework stuff
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
*/
private $currentFinalHash = '';
+ /**
+ * A network package handler instance
+ */
+ private $packageHandlerInstance = NULL;
+
+ /**
+ * Fragmenter instance
+ */
+ private $fragmenterInstance = NULL;
+
/**
* Protected constructor
*
return $class;
}
+ /**
+ * Getter for shuttedDown
+ *
+ * @return $shuttedDown Whether this connection is shutted down
+ */
+ public final function isShuttedDown () {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown));
+ return $this->shuttedDown;
+ }
+
+ /**
+ * Setter for isInitialized
+ *
+ * @param $isInitialized Name of used protocol in this connection
+ * @return void
+ */
+ protected final function setIsInitialized (bool $isInitialized) {
+ $this->isInitialized = $isInitialized;
+ }
+
+ /**
+ * Getter for isInitialized (NOTE: no 'get' prefix for boolean attributes!)
+ *
+ * @return $isInitialized Name of used protocol in this connection
+ */
+ protected final function isInitialized () {
+ return $this->isInitialized;
+ }
+
+ /**
+ * Setter for network package handler instance
+ *
+ * @param $packageHandlerInstance The network package instance we shall set
+ * @return void
+ */
+ private final function setPackageHandlerInstance (Deliverable $packageHandlerInstance) {
+ $this->packageHandlerInstance = $packageHandlerInstance;
+ }
+
+ /**
+ * Getter for network package handler instance
+ *
+ * @return $packageHandlerInstance The network package handler instance we shall set
+ */
+ protected final function getPackageHandlerInstance () {
+ return $this->packageHandlerInstance;
+ }
+
+ /**
+ * Setter for fragmenter instance
+ *
+ * @param $fragmenterInstance A Fragmentable instance
+ * @return void
+ */
+ private final function setFragmenterInstance (Fragmentable $fragmenterInstance) {
+ $this->fragmenterInstance = $fragmenterInstance;
+ }
+
+ /**
+ * Getter for fragmenter instance
+ *
+ * @return $fragmenterInstance A Fragmentable instance
+ */
+ protected final function getFragmenterInstance () {
+ return $this->fragmenterInstance;
+ }
+
/**
* Static "getter" for this connection class' name
*
return $rawData;
}
- /**
- * Setter for isInitialized
- *
- * @param $isInitialized Name of used protocol in this connection
- * @return void
- */
- protected final function setIsInitialized (bool $isInitialized) {
- $this->isInitialized = $isInitialized;
- }
-
- /**
- * Getter for isInitialized (NOTE: no 'get' prefix for boolean attributes!)
- *
- * @return $isInitialized Name of used protocol in this connection
- */
- protected final function isInitialized () {
- return $this->isInitialized;
- }
-
/**
* "Accept" a visitor by simply calling it back
*
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: EXIT!');
}
- /**
- * Getter for shuttedDown
- *
- * @return $shuttedDown Whether this connection is shutted down
- */
- public final function isShuttedDown () {
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown));
- return $this->shuttedDown;
- }
-
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseIpV4ConnectionHelper extends BaseConnectionHelper {
+ /**
+ * Name of used protocol
+ */
+ private $protocolName = 'invalid';
+
/**
* Protected constructor
*
$this->initSocketInstance();
}
+ /**
+ * Setter for protocol name
+ *
+ * @param $protocolName Name of used protocol
+ * @return void
+ */
+ protected final function setProtocolName ($protocolName) {
+ $this->protocolName = $protocolName;
+ }
+
+ /**
+ * Getter for protocol name
+ *
+ * @return $protocolName Name of used protocol
+ */
+ public final function getProtocolName () {
+ return $this->protocolName;
+ }
+
}
namespace Org\Shipsimu\Hub\Helper\Message;
// Import application-specific stuff
+use Org\Shipsimu\Hub\Crawler\Source\Source;
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMessageHelper extends BaseHubSystem {
+ /**
+ * An instance of a Source class
+ */
+ private $sourceInstance = NULL;
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct($className);
}
+ /**
+ * Setter for a Source instance
+ *
+ * @param $sourceInstance An instance of a Source class
+ * @return void
+ */
+ protected final function setSourceInstance (Source $sourceInstance) {
+ $this->sourceInstance = $sourceInstance;
+ }
+
+ /**
+ * Getter for a Source instance
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ protected final function getSourceInstance () {
+ return $this->sourceInstance;
+ }
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable {
+ /**
+ * Listener instance
+ */
+ private $listenerInstance = NULL;
+
/**
* Connection type: 'incoming', 'outgoing', 'server'
*/
private $connectionType = 'invalid';
+ /**
+ * Name of used protocol
+ */
+ private $protocolName = 'invalid';
+
/**
* Protected constructor
*
return $this->getGenericArrayElement('connection', 'dummy', 'dummy', LocateableNode::UNL_PART_PORT);
}
+ /**
+ * Getter for protocol name
+ *
+ * @return $protocolName Name of used protocol
+ */
+ public final function getProtocolName () {
+ return $this->protocolName;
+ }
+
+ /**
+ * Setter for protocol name
+ *
+ * @param $protocolName Name of used protocol
+ * @return void
+ */
+ protected final function setProtocolName (string $protocolName) {
+ $this->protocolName = $protocolName;
+ }
+
+ /**
+ * Setter for listener instance
+ *
+ * @param $listenerInstance A Listenable instance
+ * @return void
+ */
+ public final function setListenerInstance (Listenable $listenerInstance) {
+ $this->listenerInstance = $listenerInstance;
+ }
+
+ /**
+ * Getter for listener instance
+ *
+ * @return $listenerInstance A Listenable instance
+ */
+ public final function getListenerInstance () {
+ return $this->listenerInstance;
+ }
+
}
*/
private $poolInstance = NULL;
+ /**
+ * Name of used protocol
+ */
+ private $protocolName = 'invalid';
+
/**
* Protected constructor
*
return $this->poolInstance;
}
+ /**
+ * Getter for protocol name
+ *
+ * @return $protocolName Name of used protocol
+ */
+ public final function getProtocolName () {
+ return $this->protocolName;
+ }
+
+ /**
+ * Setter for protocol name
+ *
+ * @param $protocolName Name of used protocol
+ * @return void
+ */
+ protected final function setProtocolName (string $protocolName) {
+ $this->protocolName = $protocolName;
+ }
+
/**
* Registeres the given socket resource for "this" listener instance. This
* will be done in a seperate class to allow package writers to use it
use Org\Shipsimu\Hub\Factory\Handler\Network\NetworkPackageHandlerFactory;
use Org\Shipsimu\Hub\Factory\Network\NetworkPackageFactory;
use Org\Shipsimu\Hub\Listener\Listenable;
-use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
use Org\Shipsimu\Hub\Network\Networkable;
// Import framework stuff
$this->protocolName = $protocolName;
}
- /**
- * Setter for UNL instance
- *
- * @param $locatorInstance An instance of a LocateableNode class
- * @return void
- */
- protected final function setUniversalNodeLocatorInstance (LocateableNode $locatorInstance) {
- throw new UnsupportedOperationException('This method should not be called.');
- }
-
/**
* Getter for listen address
*
$this->partialSub('Please implement this method.');
}
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- public function getInfoInstance () {
- $this->partialSub('Please implement this method.');
- }
-
/**
* Getter for node id
*
return $this->protocolName;
}
- /**
- * Getter for UNL instance
- *
- * @return $unlData An instance of a LocateableNode class
- * @throws UnsupportedOperationException If this method is called
- */
- public final function getUniversalNodeLocatorInstance () {
- throw new UnsupportedOperationException('This method should not be called.');
- }
-
}
+++ /dev/null
-
- /**
- * Adds extra tasks to the given handler for this node
- *
- * @param $handlerInstance An instance of a HandleableTask class
- * @return void
- * @todo 0% done
- */
- public function addExtraTasks (HandleableTask $handlerInstance) {
- $this->partialStub('Please add some tasks or empty this method.');
- }
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
use Org\Shipsimu\Hub\Network\Receive\Receivable;
+use Org\Shipsimu\Hub\Pool\Poolable;
use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
use Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine;
use Org\Shipsimu\Hub\Tools\HubTools;
*/
private $acceptDhtBootstrap = FALSE;
+ /**
+ * Listener pool instance
+ */
+ private $listenerPoolInstance = NULL;
+
/**
* Protected constructor
*
return $nodeData;
}
+ /**
+ * Setter for listener pool instance
+ *
+ * @param $listenerPoolInstance The new listener pool instance
+ * @return void
+ */
+ protected final function setListenerPoolInstance (Poolable $listenerPoolInstance) {
+ $this->listenerPoolInstance = $listenerPoolInstance;
+ }
+
+ /**
+ * Getter for listener pool instance
+ *
+ * @return $listenerPoolInstance Our current listener pool instance
+ */
+ public final function getListenerPoolInstance () {
+ return $this->listenerPoolInstance;
+ }
+
}
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
use Org\Shipsimu\Hub\Handler\Network\PackageCode\UnsupportedPackageCodeHandlerException;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
+use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\PackageFragmenter;
*/
private $callbacks = array();
+ /**
+ * A network package handler instance
+ */
+ private $packageHandlerInstance = NULL;
+
/**
* Protected constructor
*
return $assemblerInstance;
}
+ /**
+ * Clears pending data
+ *
+ * @return void
+ */
+ public function clearPendingData () {
+ // Clear it
+ $this->pendingData = '';
+ }
+
+ /**
+ * Setter for network package handler instance
+ *
+ * @param $packageHandlerInstance The network package instance we shall set
+ * @return void
+ */
+ protected final function setPackageHandlerInstance (Deliverable $packageHandlerInstance) {
+ $this->packageHandlerInstance = $packageHandlerInstance;
+ }
+
+ /**
+ * Getter for network package handler instance
+ *
+ * @return $packageHandlerInstance The network package handler instance we shall set
+ */
+ protected final function getPackageHandlerInstance () {
+ return $this->packageHandlerInstance;
+ }
+
/**
* Checks whether the input buffer (stacker to be more preceise) is empty.
*
return $isCompleted;
}
- /**
- * Assembles the content from $packageContent. This method does only
- * initialize the whole process by creating a call-back which will then
- * itself (99.9% of all cases) "explode" the decoded data stream and add
- * it to a chunk assembler queue.
- *
- * If the call-back method or this would attempt to assemble the package
- * chunks and (maybe) re-request some chunks from the sender, this would
- * take to much time and therefore slow down this node again.
- *
- * @param $packageInstance An instance of a DeliverablePackage class
- * @return void
- * @throws UnsupportedPackageCodeHandlerException If the package code handler is not implemented
- */
- public function chunkPackageInstance (DeliverablePackage $packageInstance) {
- // Construct call-back name from package error code
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
- $this->callbacks[$packageInstance->getErrorCode()] = 'handlePackageBy' . self::convertToClassName($packageInstance->getErrorCode());
-
- // Init callable array
- $callable = [
- $this,
- $this->callbacks[$packageInstance->getErrorCode()],
- ];
-
- // Abort if the call-back method is not there
- if (!method_exists($callable[0], $callable[1])) {
- // Throw an exception
- throw new UnsupportedPackageCodeHandlerException(array($callable, $packageInstance), self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER);
- }
-
- // Call it back
- call_user_func($callable, $packageInstance);
-
- // Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: EXIT!');
- }
-
- /**************************************************************************
- * Call-back methods for above method *
- **************************************************************************/
-
- /**
- * Call-back handler to handle unhandled package data. This method
- * "explodes" the string with the chunk separator from PackageFragmenter
- * class, does some low checks on it and feeds it into another queue for
- * verification and re-request for bad chunks.
- *
- * @param $packageInstance An instance of a DeliverablePackage class
- * @return void
- */
- private function handlePackageByUnhandledPackage (DeliverablePackage $packageInstance) {
- // Check for some conditions
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
- if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageInstance))) {
- // Last chunk is not valid, so wait for more
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance->rawData()=%d being added to this->peningData ...', strlen($packageInstance->getRawData())));
- $this->pendingData .= $packageInstance->getRawData();
- } else {
- // Debug message
- //* PRINTR-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageInstance=' . print_r($packageInstance, TRUE) . ',chunks='.print_r($chunks, TRUE));
- }
-
- // Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: EXIT!');
- }
-
/**
* Checks whether the assembler's pending data is empty which means it has
* no pending data left for handling ... ;-)
}
/**
- * Clears pending data
+ * Assembles the content from $packageContent. This method does only
+ * initialize the whole process by creating a call-back which will then
+ * itself (99.9% of all cases) "explode" the decoded data stream and add
+ * it to a chunk assembler queue.
*
+ * If the call-back method or this would attempt to assemble the package
+ * chunks and (maybe) re-request some chunks from the sender, this would
+ * take to much time and therefore slow down this node again.
+ *
+ * @param $packageInstance An instance of a DeliverablePackage class
* @return void
+ * @throws UnsupportedPackageCodeHandlerException If the package code handler is not implemented
*/
- public function clearPendingData () {
- // Clear it
- $this->pendingData = '';
+ public function chunkPackageInstance (DeliverablePackage $packageInstance) {
+ // Construct call-back name from package error code
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
+ $this->callbacks[$packageInstance->getErrorCode()] = 'handlePackageBy' . self::convertToClassName($packageInstance->getErrorCode());
+
+ // Init callable array
+ $callable = [
+ $this,
+ $this->callbacks[$packageInstance->getErrorCode()],
+ ];
+
+ // Abort if the call-back method is not there
+ if (!method_exists($callable[0], $callable[1])) {
+ // Throw an exception
+ throw new UnsupportedPackageCodeHandlerException(array($callable, $packageInstance), self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER);
+ }
+
+ // Call it back
+ call_user_func($callable, $packageInstance);
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: EXIT!');
}
+
+ /**************************************************************************
+ * Call-back methods for above method *
+ **************************************************************************/
+
+ /**
+ * Call-back handler to handle unhandled package data. This method
+ * "explodes" the string with the chunk separator from PackageFragmenter
+ * class, does some low checks on it and feeds it into another queue for
+ * verification and re-request for bad chunks.
+ *
+ * @param $packageInstance An instance of a DeliverablePackage class
+ * @return void
+ */
+ private function handlePackageByUnhandledPackage (DeliverablePackage $packageInstance) {
+ // Check for some conditions
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
+ if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageInstance))) {
+ // Last chunk is not valid, so wait for more
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance->rawData()=%d being added to this->peningData ...', strlen($packageInstance->getRawData())));
+ $this->pendingData .= $packageInstance->getRawData();
+ } else {
+ // Debug message
+ //* PRINTR-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageInstance=' . print_r($packageInstance, TRUE) . ',chunks='.print_r($chunks, TRUE));
+ }
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: EXIT!');
+ }
+
}
// Import application-specificl stuff
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
+use Org\Shipsimu\Hub\Listener\Listenable;
use Org\Shipsimu\Hub\Pool\Poolable;
// Import framework stuff
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BasePool extends BaseHubSystem implements Poolable, Visitable {
+ /**
+ * Listener instance
+ */
+ private $listenerInstance = NULL;
+
/**
* A list of pool entries
*/
return $this->poolEntriesInstance;
}
+ /**
+ * Setter for listener instance
+ *
+ * @param $listenerInstance A Listenable instance
+ * @return void
+ */
+ public final function setListenerInstance (Listenable $listenerInstance) {
+ $this->listenerInstance = $listenerInstance;
+ }
+
+ /**
+ * Getter for listener instance
+ *
+ * @return $listenerInstance A Listenable instance
+ */
+ public final function getListenerInstance () {
+ return $this->listenerInstance;
+ }
+
/**
* Accepts the visitor to process the visit "request"
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseProtocolResolver extends BaseHubSystem implements ProtocolResolver {
+ /**
+ * Name of used protocol
+ */
+ private $protocolName = 'invalid';
+
/**
* Protected constructor
*
parent::__construct($className);
}
+ /**
+ * Getter for protocol name
+ *
+ * @return $protocolName Name of used protocol
+ */
+ public final function getProtocolName () {
+ return $this->protocolName;
+ }
+
+ /**
+ * Setter for protocol name
+ *
+ * @param $protocolName Name of used protocol
+ * @return void
+ */
+ protected final function setProtocolName (string $protocolName) {
+ $this->protocolName = $protocolName;
+ }
+
}
*/
function ifStartEndMarkersSet ($data);
- /**
- * Getter for listener pool instance
- *
- * @return $listenerPoolInstance Our current listener pool instance
- */
- function getListenerPoolInstance ();
-
- /**
- * Getter for info instance
- *
- * @return $infoInstance An instance of a ShareableInfo class
- */
- function getInfoInstance ();
-
/**
* Getter for node id
*
*/
function getSocketInstance ();
- /**
- * Getter for UNL instance
- *
- * @return $locatorInstance An instance of a LocateableNode class
- */
- function getUniversalNodeLocatorInstance ();
-
- /**
- * Getter for listener instance
- *
- * @return $listenerInstance A Listenable instance
- */
- function getListenerInstance ();
-
}