// CFG: CRAWLER-SHUTDOWN-FILTER
$cfg->setConfigEntry('crawler_shutdown_filter', 'CrawlerShutdownFilter');
+// CFG: CRAWLER-NODE-COMMUNICATOR-CLASS
+$cfg->setConfigEntry('crawler_node_communicator_class', 'CrawlerNodeCommunicator');
+
+// CFG: CRAWLER-INIT-STATE-CLASS
+$cfg->setConfigEntry('crawler_init_state_class', 'CrawlerInitState');
+
+// CFG: CRAWLER-BOOTING-STATE-CLASS
+$cfg->setConfigEntry('crawler_booting_state_class', 'CrawlerBootingState');
+
+// CFG: COMMUNICATOR-INIT-STATE-CLASS
+$cfg->setConfigEntry('communicator_init_state_class', 'CommunicatorInitState');
+
+// CFG: CRAWLER-NODE-COMMUNICATOR-TASK-CLASS
+$cfg->setConfigEntry('crawler_node_communicator_task_class', 'CrawlerNodeCommunicatorTask');
+
+// CFG: TASK-CRAWLER-NODE-COMMUNICATOR-STARTUP-DELAY
+$cfg->setConfigEntry('task_crawler_node_communicator_startup_delay', 500);
+
+// CFG: TASK-CRAWLER-NODE-COMMUNICATOR-INTERVAL-DELAY
+$cfg->setConfigEntry('task_crawler_node_communicator_interval_delay', 250);
+
+// CFG: TASK-CRAWLER-NODE-COMMUNICATOR-MAX-RUNS
+$cfg->setConfigEntry('task_crawler_node_communicator_max_runs', 0);
+
+// CFG: CRAWLER-LOCAL-URL-FETCHER-TASK-CLASS
+$cfg->setConfigEntry('crawler_local_url_fetcher_task_class', 'CrawlerLocalUrlFetcherTask');
+
+// CFG: TASK-CRAWLER-LOCAL-URL-FETCHER-STARTUP-DELAY
+$cfg->setConfigEntry('task_crawler_local_url_fetcher_startup_delay', 1500);
+
+// CFG: TASK-CRAWLER-LOCAL-URL-FETCHER-INTERVAL-DELAY
+$cfg->setConfigEntry('task_crawler_local_url_fetcher_interval_delay', 50);
+
+// CFG: TASK-CRAWLER-LOCAL-URL-FETCHER-MAX-RUNS
+$cfg->setConfigEntry('task_crawler_local_url_fetcher_max_runs', 0);
+
+// CFG: CRAWLER-REMOTE-URL-FETCHER-TASK-CLASS
+$cfg->setConfigEntry('crawler_remote_url_fetcher_task_class', 'CrawlerRemoteUrlFetcherTask');
+
+// CFG: TASK-CRAWLER-REMOTE-URL-FETCHER-STARTUP-DELAY
+$cfg->setConfigEntry('task_crawler_remote_url_fetcher_startup_delay', 1500);
+
+// CFG: TASK-CRAWLER-REMOTE-URL-FETCHER-INTERVAL-DELAY
+$cfg->setConfigEntry('task_crawler_remote_url_fetcher_interval_delay', 50);
+
+// CFG: TASK-CRAWLER-REMOTE-URL-FETCHER-MAX-RUNS
+$cfg->setConfigEntry('task_crawler_remote_url_fetcher_max_runs', 0);
+
///////////////////////////////////////////////////////////////////////////////
// HTTP Configuration
///////////////////////////////////////////////////////////////////////////////
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for communicators
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core 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/>.
+ */
+interface Communicator extends Executor {
+}
+
+// [EOF]
+?>
* @return $isActive Whether the crawler is active
*/
function isActive ();
+
+ /**
+ * Initializes this crawler instance
+ *
+ * @param $stateInstance An instance of a Stateable class
+ * @return void
+ */
+ function initCrawler (Stateable $stateInstance);
}
// [EOF]
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Executor extends FrameworkInterface {
+ /**
+ * Initializes the executor, whatever it does.
+ *
+ * @return void
+ */
+ function initExecutor (Stateable $stateInstance);
}
// [EOF]
* @param $stateInstance An instance of a Stateable instance
* @return void
*/
- function prepareUnitProduction (Stateable $stateInstance);
+ function initUnitProduction (Stateable $stateInstance);
}
// [EOF]
*/
private $nodeInstance = NULL;
+ /**
+ * An instance of a communicator
+ */
+ private $communicatorInstance = NULL;
+
+ /**
+ * An instance of a crawler
+ */
+ private $crawlerInstance = NULL;
+
/**
* An instance of a cruncher
*/
$this->nodeInstance = $nodeInstance;
}
+ /**
+ * 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;
+ }
+
+ /**
+ * Getter for crawler instance
+ *
+ * @return $crawlerInstance An instance of a Crawler class
+ */
+ public final function getCrawlerInstance () {
+ return $this->crawlerInstance;
+ }
+
+ /**
+ * Setter for crawler instance
+ *
+ * @param $crawlerInstance An instance of a Crawler class
+ * @return void
+ */
+ protected final function setCrawlerInstance (Crawler $crawlerInstance) {
+ $this->crawlerInstance = $crawlerInstance;
+ }
+
/**
* Getter for cruncher instance
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ???->node communicator class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 !!! Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class ???NodeCommunicator extends BaseCommunicator implements Communicator {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $communicatorInstance An instance of a Communicator class
+ */
+ public final static function create???NodeCommunicator () {
+ // Get new instance
+ $communicatorInstance = new ???NodeCommunicator();
+
+ // Return the prepared instance
+ return $communicatorInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general communicator class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class BaseCommunicator extends BaseHubSystem {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Init state which sets the state to 'init'
+ $this->initState();
+ }
+
+ /**
+ * Initializes the node's state which sets it to 'init'
+ *
+ * @return void
+ */
+ private function initState() {
+ // Get the state factory and create the initial state.
+ CommunicatorStateFactory::createCommunicatorStateInstanceByName('init', $this);
+ }
+
+ /**
+ * Initializes the executor, whatever it does.
+ *
+ * @return void
+ */
+ public function initExecutor (Stateable $stateInstance) {
+ $this->partialStub('Unfinished method with state ' . $this->getPrintableState() . '.');
+
+ // This communicator is now fully initialized so change the state
+ $stateInstance->communicatorHasInitialized();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A crawler->node communicator class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class CrawlerNodeCommunicator extends BaseCommunicator implements Communicator, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $communicatorInstance An instance of a Communicator class
+ */
+ public final static function createCrawlerNodeCommunicator () {
+ // Get new instance
+ $communicatorInstance = new CrawlerNodeCommunicator();
+
+ // Return the prepared instance
+ return $communicatorInstance;
+ }
+}
+
+// [EOF]
+?>
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
+
+ // Init state which sets the state to 'init'
+ $this->initState();
+ }
+
+ /**
+ * Initializes the node's state which sets it to 'init'
+ *
+ * @return void
+ */
+ private function initState() {
+ // Get the state factory and create the initial state.
+ CrawlerStateFactory::createCrawlerStateInstanceByName('init', $this);
+ }
+
+ /**
+ * Initializes this crawler instance
+ *
+ * @param $stateInstance An instance of a Stateable class
+ * @return void
+ * @todo 0% done
+ */
+ public function initCrawler (Stateable $stateInstance) {
+ // Please implement
+ $this->partialStub('Unfinished method.');
}
/**
// Output all lines
self::createDebugInstance(__CLASS__)->debugOutput(' ');
- self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - A distributed crawler');
+ self::createDebugInstance(__CLASS__)->debugOutput('Distributed Crawler v' . $app->getAppVersion());
self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2014 Crawler Developer Team');
self::createDebugInstance(__CLASS__)->debugOutput(' ');
self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
* to show up.
*
* In this method we already know that the in-buffer is going depleted so
- * we don't need to double-check it here.
+ * no need to double-check it here.
*
* @return void
*/
* to show up.
*
* In this method we already know that the in-buffer is going depleted so
- * we don't need to double-check it here.
+ * no need to double-check it here.
*
* @return void
*/
// Init all stackers
$this->initStacks();
- /*
- * Get the state factory and create the initial state, we don't need
- * the state instance here
- */
+ // Get the state factory and create the initial state.
DhtStateFactory::createDhtStateInstanceByName('init', $this);
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for communicator
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core 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/>.
+ */
+class CommunicatorFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Returns a singleton communicator instance. If no instance is found, it fill
+ * be generated and stored in registry, else the communicator from the
+ * registry will be returned.
+ *
+ * @param $configEntry A configuration entry naming the real class' name
+ * @parasm $communicatorType Type of the communicator, can currently be 'node'
+ * @return $communicatorInstance A communicator instance
+ */
+ public static final function createCommunicatorInstance ($configEntry, $communicatorType) {
+ // If there is no communicator?
+ if (Registry::getRegistry()->instanceExists($communicatorType . '_communicator')) {
+ // Get communicator from registry
+ $communicatorInstance = Registry::getRegistry()->getInstance($communicatorType . '_communicator');
+ } else {
+ // Get the communicator instance
+ $communicatorInstance = self::createObjectByConfiguredName($configEntry);
+
+ // Add it to the registry
+ Registry::getRegistry()->addInstance($communicatorType . '_communicator', $communicatorInstance);
+ }
+
+ // Return the instance
+ return $communicatorInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for communicator states
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core 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/>.
+ */
+class CommunicatorStateFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of a configurable communicator state and sets it in the
+ * given communicator instance.
+ *
+ * @param $stateName Name of the state
+ * @param $communicatorInstance A Communicator class instance
+ * @return $stateInstance A Stateable class instance
+ */
+ public static final function createCommunicatorStateInstanceByName ($stateName, Communicator $communicatorInstance) {
+ // Then construct the class' configuraton entry
+ $className = 'communicator_' . $stateName . '_state_class';
+
+ // Get a class from that configuration entry
+ $stateInstance = self::createObjectByConfiguredName($className, array($communicatorInstance));
+
+ // Debug message
+ self::createDebugInstance(__CLASS__)->debugOutput('COMMUNICATOR-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Communicator state has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
+
+ // Once we have that state, set it in the communicator instance
+ $communicatorInstance->setStateInstance($stateInstance);
+
+ // Update communicator data
+ $communicatorInstance->updateCommunicatorData();
+
+ // For any purposes, return the state instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for crawler states
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core 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/>.
+ */
+class CrawlerStateFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of a configurable crawler state and sets it in the
+ * given crawler instance.
+ *
+ * @param $stateName Name of the state
+ * @param $crawlerInstance A Crawler class instance
+ * @return $stateInstance A Stateable class instance
+ */
+ public static final function createCrawlerStateInstanceByName ($stateName, Crawler $crawlerInstance) {
+ // Then construct the class' configuraton entry
+ $className = 'crawler_' . $stateName . '_state_class';
+
+ // Get a class from that configuration entry
+ $stateInstance = self::createObjectByConfiguredName($className, array($crawlerInstance));
+
+ // Debug message
+ self::createDebugInstance(__CLASS__)->debugOutput('CRAWLER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Crawler state has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
+
+ // Once we have that state, set it in the crawler instance
+ $crawlerInstance->setStateInstance($stateInstance);
+
+ // Update crawler data
+ $crawlerInstance->updateCrawlerData();
+
+ // For any purposes, return the state instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
/*
* Register all tasks:
*
- * 1) ...
+ * 1) "Communicator" for crawler->node communication
*/
- //$taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_???_task_class');
- //$handlerInstance->registerTask('crawler_???', $taskInstance);
+ $taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_node_communicator_task_class');
+ $handlerInstance->registerTask('crawler_node_communicator', $taskInstance);
+
+ // 2) Local URL fetcher (fetches URLs locally and adds them to the analyzer's input stack)
+ $taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_local_url_fetcher_task_class');
+ $handlerInstance->registerTask('crawler_local_url_fetcher', $taskInstance);
+
+ // 3) Remote URL fetcher (let fetch URLs by other crawler nodes and also adds them to the stack)
+ $taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_remote_url_fetcher_task_class');
+ $handlerInstance->registerTask('crawler_remote_url_fetcher', $taskInstance);
// Put the task handler in registry
Registry::getRegistry()->addInstance('task_handler', $handlerInstance);
* @return void
*/
private function initState() {
- /*
- * Get the state factory and create the initial state, we don't need
- * the state instance here
- */
+ // Get the state factory and create the initial state.
PeerStateFactory::createPeerStateInstanceByName('init', $this);
}
* to show up.
*
* In this method we already know that the in-buffer is going depleted so
- * we don't need to double-check it here.
+ * no need to double-check it here.
*
* @return void
*/
* to show up.
*
* In this method we already know that the in-buffer is going depleted so
- * we don't need to double-check it here.
+ * no need to double-check it here.
*
* @return void
*/
* @return void
*/
private function initState() {
- /*
- * Get the state factory and create the initial state, we don't need
- * the state instance here
- */
+ // Get the state factory and create the initial state.
NodeStateFactory::createNodeStateInstanceByName('init', $this);
}
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . BaseRawDataHandler::SOCKET_ERROR_UNHANDLED . ')');
assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == BaseRawDataHandler::SOCKET_ERROR_UNHANDLED);
- // Remove the last chunk SEPARATOR (because it is being added and we don't need it)
+ // Remove the last chunk SEPARATOR (because there is no need for it)
if (substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) {
// It is there and should be removed
$decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1);
* @return void
* @todo ~60% done
*/
- public function prepareUnitProduction (Stateable $stateInstance) {
+ public function initUnitProduction (Stateable $stateInstance) {
// First get a database wrapper because we want to permanently store test units
$wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('cruncher_unit_db_wrapper_class');
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A active communicator state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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/>.
+ */
+class CommunicatorActiveState extends BaseCommunicatorState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructo
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('active');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $communicatorInstance An instance of a Communicator class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public static final function createCommunicatorActiveState (Communicator $communicatorInstance) {
+ // Get new instance
+ $stateInstance = new CommunicatorActiveState();
+
+ // Set the communicator instance
+ $stateInstance->setCommunicatorInstance($communicatorInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? communicator state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class Communicator???State extends BaseCommunicatorState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('!!!');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $communicatorInstance An instance of a Communicator class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public final static function createCommunicator???State (Communicator $communicatorInstance) {
+ // Get new instance
+ $stateInstance = new Communicator???State();
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
+
+ // Set the communicator instance
+ $stateInstance->setCommunicatorInstance($communicatorInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general communicator state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Core 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/>.
+ */
+class BaseCommunicatorState extends BaseState {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Validates whether the state is 'active' or throws an exception if
+ * it is every other state.
+ *
+ * @return void
+ * @throws InvalidStateException If the state is not 'active'
+ */
+ public function validateCommunicatorStateIsActive () {
+ // Just compare it...
+ if (!$this instanceof CommunicatorActiveState) {
+ // Throw the exception
+ throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A init communicator state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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/>.
+ */
+class CommunicatorInitState extends BaseCommunicatorState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructo
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('init');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $communicatorInstance An instance of a Communicator class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public static final function createCommunicatorInitState (Communicator $communicatorInstance) {
+ // Get new instance
+ $stateInstance = new CommunicatorInitState();
+
+ // Set the communicator instance
+ $stateInstance->setCommunicatorInstance($communicatorInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A active crawler state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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/>.
+ */
+class CrawlerActiveState extends BaseCrawlerState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructo
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('active');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $crawlerInstance An instance of a Crawler class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public static final function createCrawlerActiveState (Crawler $crawlerInstance) {
+ // Get new instance
+ $stateInstance = new CrawlerActiveState();
+
+ // Set the crawler instance
+ $stateInstance->setCrawlerInstance($crawlerInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+
+ /**
+ * Executes the state with given Executor instance
+ *
+ * @param $executorInstance An instance of a Executor class
+ * @return void
+ * @todo 0% done
+ */
+ public function executeState (Executor $executorInstance) {
+ $this->partialStub('Unfinished method, executorInstance=' . $executorInstance->__toString());
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+
+ /**
+ * State change if the communicator has fully initialized.
+ *
+ * @return void
+ * @todo ~30% done
+ */
+ public function communicatorHasInitialized () {
+ // Please implement
+ $this->partialStub('Unfinished method.');
+
+ // Change state to 'active'
+ CrawlerStateFactory::createCrawlerStateInstanceByName('active', $this->getCrawlerInstance());
+ }
--- /dev/null
+<?php
+/**
+ * A booting crawler state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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/>.
+ */
+class CrawlerBootingState extends BaseCrawlerState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructo
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('booting');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $crawlerInstance An instance of a Crawler class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public static final function createCrawlerBootingState (Crawler $crawlerInstance) {
+ // Get new instance
+ $stateInstance = new CrawlerBootingState();
+
+ // Set the crawler instance
+ $stateInstance->setCrawlerInstance($crawlerInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+
+ /**
+ * Executes the state with given Executor instance
+ *
+ * @param $executorInstance An instance of a Executor class
+ * @return void
+ * @todo 0% done
+ */
+ public function executeState (Executor $executorInstance) {
+ $this->partialStub('Unfinished method, executorInstance=' . $executorInstance->__toString());
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? crawler state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class Crawler???State extends BaseCrawlerState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('!!!');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $crawlerInstance An instance of a Crawler class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public final static function createCrawler???State (Crawler $crawlerInstance) {
+ // Get new instance
+ $stateInstance = new Crawler???State();
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
+
+ // Set the crawler instance
+ $stateInstance->setCrawlerInstance($crawlerInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general crawler state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler 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/>.
+ */
+class BaseCrawlerState extends BaseState {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Validates whether the state is 'active' or throws an exception if
+ * it is every other state.
+ *
+ * @return void
+ * @throws InvalidStateException If the state is not 'active'
+ */
+ public function validateCrawlerStateIsActive () {
+ // Just compare it...
+ if (!$this instanceof CrawlerActiveState) {
+ // Throw the exception
+ throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A init crawler state class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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/>.
+ */
+class CrawlerInitState extends BaseCrawlerState implements Stateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructo
+ parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('init');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $crawlerInstance An instance of a Crawler class
+ * @return $stateInstance An instance of a Stateable class
+ */
+ public static final function createCrawlerInitState (Crawler $crawlerInstance) {
+ // Get new instance
+ $stateInstance = new CrawlerInitState();
+
+ // Set the crawler instance
+ $stateInstance->setCrawlerInstance($crawlerInstance);
+
+ // Return the prepared instance
+ return $stateInstance;
+ }
+
+ /**
+ * Executes the state with given Executor instance
+ *
+ * @param $executorInstance An instance of a Executor class
+ * @return void
+ */
+ public function executeState (Executor $executorInstance) {
+ // Initialize the executor (can be a Communicator instance)
+ $executorInstance->initExecutor($this);
+ }
+
+ /**
+ * State change if the communicator has fully initialized.
+ *
+ * @return void
+ * @todo ~30% done
+ */
+ public function communicatorHasInitialized () {
+ // Please implement
+ $this->partialStub('Unfinished method.');
+
+ // Change state to 'booting'
+ CrawlerStateFactory::createCrawlerStateInstanceByName('booting', $this->getCrawlerInstance());
+ }
+}
+
+// [EOF]
+?>
* @return void
*/
public function executeState (Executor $executorInstance) {
- // Now prepare the unit production to maybe become 'virgin' or 'active' if work/test units are there
- $executorInstance->prepareUnitProduction($this);
+ // Initialize the unit production to maybe become 'virgin' or 'active' if work/test units are there
+ $executorInstance->initUnitProduction($this);
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? task for crawlers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class Crawler???Task extends BaseTask implements Taskable, Visitable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $taskInstance An instance of a Visitable class
+ */
+ public final static function createCrawler???Task () {
+ // Get new instance
+ $taskInstance = new Crawler???Task();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to process the visitor
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo Maybe visit some sub-objects
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ * @todo 0%
+ */
+ public function executeTask () {
+ $this->partialStub('Unimplemented task.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A NodeCommunicator task for crawlers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class CrawlerNodeCommunicatorTask extends BaseTask implements Taskable, Visitable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $taskInstance An instance of a Visitable class
+ */
+ public final static function createCrawlerNodeCommunicatorTask () {
+ // Get new instance
+ $taskInstance = new CrawlerNodeCommunicatorTask();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to process the visitor
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo Maybe visit some sub-objects
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ */
+ public function executeTask () {
+ // Get the communicator instance
+ $communicatorInstance = CommunicatorFactory::createCommunicatorInstance('crawler_node_communicator_class', 'node');
+
+ // Get the current crawler state from registry
+ $stateInstance = Registry::getRegistry()->getInstance('crawler')->getStateInstance();
+
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString());
+
+ // We can now invoke that state instance and pass our communicator instance for generating some test units
+ $stateInstance->executeState($communicatorInstance);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A LocalUrlFetcher task for crawlers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class CrawlerLocalUrlFetcherTask extends BaseTask implements Taskable, Visitable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $taskInstance An instance of a Visitable class
+ */
+ public final static function createCrawlerLocalUrlFetcherTask () {
+ // Get new instance
+ $taskInstance = new CrawlerLocalUrlFetcherTask();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to process the visitor
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo Maybe visit some sub-objects
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ * @todo 0%
+ */
+ public function executeTask () {
+ $this->partialStub('Unimplemented task.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A RemoteUrlFetcher task for crawlers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2014 Crawler Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.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/>.
+ */
+class CrawlerRemoteUrlFetcherTask extends BaseTask implements Taskable, Visitable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $taskInstance An instance of a Visitable class
+ */
+ public final static function createCrawlerRemoteUrlFetcherTask () {
+ // Get new instance
+ $taskInstance = new CrawlerRemoteUrlFetcherTask();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to process the visitor
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo Maybe visit some sub-objects
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ * @todo 0%
+ */
+ public function executeTask () {
+ $this->partialStub('Unimplemented task.');
+ }
+}
+
+// [EOF]
+?>