Difference between revisions of "Assembly line objects"

From Apibot
Jump to: navigation, search
m (8 replacements)
(deleted old info, started filling up the new one (a lot is to be filled yet))
Line 1: Line 1:
The Assembly line objects are the entities (PHP objects) that form an assembly line.
+
All Assembly line objects share some common features. They inherit those from the Line_Slot class, from which all their classes ultimately descend.
  
== Types ==
+
== Public properties ==
  
Every assembly line object belongs to one of the following types:
+
* <code>$explicit name</code> - in addition to the slot name, which is specific for the objects class, you can assign an explicit name, specific to each object from the same class. Added to the slot name, it forms the full name of the object, and is written in the Apibot logs and some error messages. Default: none.
 +
* <code>$default_data_key</code> - the key to the signals data block that will be considered default by this object, and processed by it. Default: "*".
 +
* <code>$preserve_slot_signal_params</code> - typically the object will take parameters from signal parameters group that is named for the object full name, slot name or type name (in that precedence), and will delete the parameters group. If this property is set to <code>false</code>, the parameters group will not be deleted. If the property is set to a string, the parameters group will be renamed to "type." plus this string, if it was named for the object type, to "name." plus this string, if it was named for the object slot name, and to "object." plus this string, if it was named for the object full name.
  
* [[Assembly line feeders|Feeders]] - supply data to the assembly line
+
== Public methods ==
* [[Assembly line fetchers|Fetchers]] - fetch full wiki objects by some identificator (eg. pages by titles)
 
* [[Assembly line filters|Filters]] - let through only data that matches given criteria, or reorder the data
 
* [[Assembly line sigmods|Signal modifiers]] - modify signals and their properties in some way
 
* [[Assembly line workers|Workers]] - process the data in one way or another
 
* [[Assembly line writers|Writers]] - write the processed data (back to the wiki, or to a file, etc.)
 
  
For each of those types there is a subtree named after it, inside the <code>/line</code> subdirectory in the bot.
 
  
In addition, there data the assembly line objects fetch, process and write is passed between them attached to special objects - [[Assembly line signals|signals]]. These cannot be attached to the line, and are not considered as proper assembly line objects.
+
== See also ==
  
== Line structure and creation ==
+
* [[Assembly line feeders]]
 +
* [[Assembly line fetchers]]
 +
* [[Assembly line filters]]
 +
* [[Assembly line workers]]
 +
* [[Assembly line writers]]
  
An assembly line typically starts with a feeder object and ends with a writer object, typically with some other objects (writers etc) in between.
+
* [[Assembly line interface]]
  
Objects are strung one to another via two procedures:
+
* [[Main Page]]
* <code>$worker->link_to ( $feeder );</code> will link $worker ''after'' $feeder in the line.
 
* <code>$worker->link_with ( $writer );</code> will link $worker ''before'' $writer in the line.
 
 
 
Several objects can be linked after and / or before one object:
 
<pre>
 
$filter1->link_to ( $feeder );
 
$filter2->link_to ( $feeder );
 
$filter3->link_to ( $feeder );
 
 
 
$worker->link_to ( $filter1 );
 
$worker->link_to ( $filter2 );
 
$worker->link_to ( $filter3 );
 
</pre>
 
In this line, <code>$worker</code> must get from <code>$feeder</code> data that match any of three completely different conditions, so three different filters must be connected in parallel.
 
 
 
All line objects require at least one parameter - the bot <code>$mains</code> object - on creation. Most require and / or can take more parameters.
 
 
 
[[Assembly_line_examples|You can see some examples on how to use them here.]]
 
 
 
== Writing new Assembly line objects classes ==
 
 
 
The line objects are designed so as to be easily written and modified. Anyone with some PHP knowledge will be able to create new object classes, either based on existing ones, or from the ground up.
 
 
 
All new object classes must derive from the <code>Line_Slot</code> class, found in the <code>line/_line_slot.php</code> file. In addition, classes of a certain type should best derive from its generic class, typically found in the file <code>_generic.php</code> in the object type subpath in <code>line</code>.
 

Revision as of 04:54, 5 November 2014

All Assembly line objects share some common features. They inherit those from the Line_Slot class, from which all their classes ultimately descend.

Public properties

  • $explicit name - in addition to the slot name, which is specific for the objects class, you can assign an explicit name, specific to each object from the same class. Added to the slot name, it forms the full name of the object, and is written in the Apibot logs and some error messages. Default: none.
  • $default_data_key - the key to the signals data block that will be considered default by this object, and processed by it. Default: "*".
  • $preserve_slot_signal_params - typically the object will take parameters from signal parameters group that is named for the object full name, slot name or type name (in that precedence), and will delete the parameters group. If this property is set to false, the parameters group will not be deleted. If the property is set to a string, the parameters group will be renamed to "type." plus this string, if it was named for the object type, to "name." plus this string, if it was named for the object slot name, and to "object." plus this string, if it was named for the object full name.

Public methods

See also