*/
interface HandleableTask extends Handleable {
/**
- * Registers a task with a task handler. This method throws a
- * TaskAlreadyRegisteredException if the task has already been registered
+ * Searches a task by given instance
+ *
+ * @param $taskInstanc An instanceof a Taskable class
+ * @return $taskName Name of the task as used while registration
+ */
+ function searchTask (Taskable $taskInstance);
+
+ /**
+ * Registers a task with a task handler.
*
* @param $taskName A task name to register the task on
* @param $taskInstance The instance we should register as a task
function registerTask ($taskName, Visitable $taskInstance);
/**
- * Checks whether tasks are left including idle task.
+ * Checks whether tasks are left including idle task
*
* @return $tasksLeft Whether there are tasks left to handle
*/
* @return void
*/
function handleTasks ();
+
+ /**
+ * Shuts down all tasks and the task handler itself. This method should be
+ * called from a corresponding filter class.
+ *
+ * @return void
+ */
+ function doShutdown ();
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * An interface for sources
+ *
+ * @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/>.
+ */
+interface Source extends FrameworkInterface {
+}
+
+// [EOF]
+?>
+++ /dev/null
-<?php
-/**
- * An interface for sources
- *
- * @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/>.
- */
-interface Sourceable extends FrameworkInterface {
- /**
- * "Getter" or generator for a message
- *
- * @return $message A message from our source
- */
- function generateMessageFromSource ();
-}
-
-// [EOF]
-?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for unit sources
+ *
+ * @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/>.
+ */
+interface UnitSource extends Source {
+ /**
+ * "Getter" or generator for a message
+ *
+ * @return $message A message from our source
+ */
+ function generateMessageFromSource ();
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for URL sources
+ *
+ * @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/>.
+ */
+interface UrlSource extends Source {
+}
+
+// [EOF]
+?>
* Creates an instance of a configurable and singleton unit source
*
* @param $unitType Type of the unit source
- * @return $sourceInstance A Sourceable class instance
+ * @return $sourceInstance A UnitSource class instance
*/
public static final function createUnitSourceInstance ($unitType) {
// Do we have cache?
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for URL sources
+ *
+ * @author Roland Haeder <webmaster@ship-simu.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.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 UrlSourceObjectFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Returns a singleton (registry-based) UrlSource instance
+ *
+ * @param $taskInstance An instance of a class with an Taskable interface
+ * @return $sourceInstance An instance of a UrlSource class
+ */
+ public static final function createUrlSourceInstance (Taskable $taskInstance) {
+ // Get new factory instance
+ $factoryInstance = new UrlSourceObjectFactory();
+
+ // Get task handler instance
+ $handlerInstance = Registry::getRegistry()->getInstance('task_handler');
+
+ // The default node-mode is from our configuration
+ $sourceType = $handlerInstance->searchTask($taskInstance);
+
+ // Only let registered tasks pass
+ assert(!empty($sourceType));
+
+ // If there is no handler?
+ if (Registry::getRegistry()->instanceExists('node_' . $sourceType)) {
+ // Get handler from registry
+ $sourceInstance = Registry::getRegistry()->getInstance('node_' . $sourceType);
+ } else {
+ // Now convert the source type into a class name
+ $className = $factoryInstance->convertToClassName($sourceType);
+
+ // Get the node instance
+ $sourceInstance = ObjectFactory::createObjectByName($className);
+
+ // Add it to the registry
+ Registry::getRegistry()->addInstance('node_' . $sourceType, $sourceInstance);
+ }
+
+ // Return the instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
self::createDebugInstance(__CLASS__)->debugOutput('TASK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Removing task ' . $taskData['id'] . ' from queue - FINISHED');
}
+ /**
+ * Searches a task by given instance
+ *
+ * @param $taskInstanc An instanceof a Taskable class
+ * @return $taskName Name of the task as used while registration
+ */
+ public function searchTask (Taskable $taskInstance) {
+ // Default is an empty (not found) task name
+ $taskName = '';
+
+ // Get whole list
+ $taskList = $this->getListInstance()->getArrayFromList('tasks');
+
+ // Search all instances
+ foreach ($taskList as $currentTask) {
+ // Does it match given task instance?
+ if ($currentTask['task_instance']->equals($taskInstance)) {
+ // Found it
+ $taskName = $currentTask['id'];
+
+ // Abort here
+ break;
+ } // END - if
+ } // END - foreach
+
+ // Return found name
+ return $taskName;
+ }
+
/**
* Registers a task with a task handler.
*
* 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 ???Source extends BaseSource implements Sourceable {
+class ???Source extends BaseSource implements Source!!! {
/**
* Protected constructor
*
/**
* Creates an instance of this class
*
- * @return $sourceInstance An instance of a Sourceable class
+ * @return $sourceInstance An instance of a Source class
*/
public final static function create???Source () {
// Get new instance
// Return the prepared instance
return $sourceInstance;
}
-
- /**
- * "Getter" or generator for a message
- *
- * @return $message A message from our source
- * @todo 0% done
- */
- public function generateMessageFromSource () {
- $this->partialStub('Please implement this method.');
- }
}
// [EOF]
* 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 TestUnitSource extends BaseSource implements Sourceable, Registerable {
+class TestUnitSource extends BaseSource implements UnitSource, Registerable {
/**
* Protected constructor
*
/**
* Creates an instance of this class
*
- * @return $sourceInstance An instance of a Sourceable class
+ * @return $sourceInstance An instance of a Source class
*/
public final static function createTestUnitSource () {
// Get new instance
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? URL source class 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 CrawlerUrlSource??? extends BaseSource implements UrlSource, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ public final static function createCrawlerUrlSource??? () {
+ // Get new instance
+ $sourceInstance = new CrawlerUrlSource???();
+
+ // Return the prepared instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A FoundRss URL source class 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 CrawlerUrlSourceFoundRss extends BaseSource implements UrlSource, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ public final static function createCrawlerUrlSourceFoundRss () {
+ // Get new instance
+ $sourceInstance = new CrawlerUrlSourceFoundRss();
+
+ // Return the prepared instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? URL source class 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 CrawlerUrlSourceLocalStart extends BaseSource implements UrlSource, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ public final static function createCrawlerUrlSourceLocalStart () {
+ // Get new instance
+ $sourceInstance = new CrawlerUrlSourceLocalStart();
+
+ // Return the prepared instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A RssStart URL source class 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 CrawlerUrlSourceRssStart extends BaseSource implements UrlSource, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ public final static function createCrawlerUrlSourceRssStart () {
+ // Get new instance
+ $sourceInstance = new CrawlerUrlSourceRssStart();
+
+ // Return the prepared instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A UploadedList URL source class 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 CrawlerUrlSourceUploadedList extends BaseSource implements UrlSource, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $sourceInstance An instance of a Source class
+ */
+ public final static function createCrawlerUrlSourceUploadedList () {
+ // Get new instance
+ $sourceInstance = new CrawlerUrlSourceUploadedList();
+
+ // Return the prepared instance
+ return $sourceInstance;
+ }
+}
+
+// [EOF]
+?>
* Executes the task
*
* @return void
- * @todo 0%
*/
public function executeTask () {
- $this->partialStub('Unimplemented task.');
+ // Get the URL source instance and announce us
+ UrlSourceObjectFactory::createUrlSourceInstance($this)->processStack();
}
}
* Executes the task
*
* @return void
- * @todo 0%
*/
public function executeTask () {
- $this->partialStub('Unimplemented task.');
+ // Get the URL source instance and announce us
+ UrlSourceObjectFactory::createUrlSourceInstance($this)->processStack();
}
}
* Executes the task
*
* @return void
- * @todo 0%
*/
public function executeTask () {
- $this->partialStub('Unimplemented task.');
+ // Get the URL source instance and announce us
+ UrlSourceObjectFactory::createUrlSourceInstance($this)->processStack();
}
}
* Executes the task
*
* @return void
- * @todo 0%
*/
public function executeTask () {
- $this->partialStub('Unimplemented task.');
+ // Get the URL source instance and announce us
+ UrlSourceObjectFactory::createUrlSourceInstance($this)->processStack();
}
}
* Executes the task
*
* @return void
- * @todo 0%
*/
public function executeTask () {
- $this->partialStub('Unimplemented task.');
+ // Get the URL source instance and announce us
+ UrlSourceObjectFactory::createUrlSourceInstance($this)->processStack();
}
}
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+http://mxchange.org
+++ /dev/null
-Deny from all
+++ /dev/null
-http://mxchange.org