Class: Service

Source Location: /sys/service.php.inc

Class Overview


The base class for all SiteFusion services

The Service class is the parent class for all SiteFusion services. Extending classes should always define an init($arguments) method. This method is called when the service process has initialized, and thus is the place to setup your basic service functionality.




Variables

Methods


Class Variables

$callHandlers = array()

access:  public
Type:   mixed

$globalEventHandlers = array()

access:  public
Type:   mixed



Class Methods


method fireGlobalEvent() [line 177]

void fireGlobalEvent( Event|string $event, [array $data = NULL])

Fires a global event

This method fires a global event that will reach all SiteFusion processes within the same application group.


access:  public

Parameters:

Event|string   $event   Event name or object
array   $data   Event parameters

[ Top ]

method getEventGroups() [line 220]

void getEventGroups( )

Get a list of joined Event Groups

Applications and services that have joined the same event groups will receive each other's global events


access:  public

[ Top ]

method handleCall() [line 70]

void handleCall( $name, $args)

access:  public

Parameters:

   $name  
   $args  

[ Top ]

method handleGlobalEvent() [line 139]

Event handleGlobalEvent( Event $event, array $data)

[INTERNAL FUNCTION] Handles incoming global events

This function is called by the ApplicationProcess when it receives a global event from the daemon.


return:  event object
access:  public

Parameters:

Event   $event   Event object
array   $data   Event parameters

[ Top ]

method joinEventGroup() [line 194]

void joinEventGroup( string $group)

Joins an Event Group

Applications and services that have joined the same event groups will receive each other's global events


access:  public

Parameters:

string   $group   Name of the group

[ Top ]

method partEventGroup() [line 208]

void partEventGroup( string $group)

Parts an Event Group

Applications and services that have joined the same event groups will receive each other's global events


access:  public

Parameters:

string   $group   Name of the group

[ Top ]

method removeCallHandler() [line 66]

void removeCallHandler( $name)

access:  public

Parameters:

   $name  

[ Top ]

method removeGlobalEventHandler() [line 114]

void removeGlobalEventHandler( string $event, object|string $obj, string $method)

Remove a handler for a global event

Removes a handler for the given global event with the same syntax as setGlobalEventHandler


access:  public

Parameters:

string   $event   The event name
object|string   $obj   Handler object or class
string   $method   Name of the handler method on the handler object or class

[ Top ]

method setCallHandler() [line 62]

void setCallHandler( $name, $obj, $method)

access:  public

Parameters:

   $name  
   $obj  
   $method  

[ Top ]

method setDefaultEventGroup() [line 56]

void setDefaultEventGroup( )

access:  public

[ Top ]

method setGlobalEventHandler() [line 96]

void setGlobalEventHandler( string $event, object|string $obj, string $method)

Set a handler for a global event

Global events originate from other SiteFusion processes. A global event will only reach your service when it was fired from an application or service in the same application group. Global events are similar to local events, and can also carry additional data inside the Event object. The handler will receive the event object as the first argument, and event parameters as additional arguments.


access:  public

Parameters:

string   $event   The event name
object|string   $obj   Handler object or class
string   $method   Name of the method to call on the handler object or class

[ Top ]

method setInterval() [line 261]

SiteFusionTimer setInterval( int $timeout, object|string $obj, string $func)

Sets a server-based interval callback

This function is similar to the JavaScript window.setInterval() function. It dispatches a timer for a certain amount of milliseconds, and fires the handler method when the timer expires. The timer then resets and recycles, until it is cancelled by calling the cancel() method on the returned timer object.


return:  Timer object created
access:  public

Parameters:

int   $timeout   Timeout in milliseconds
object|string   $obj   Object or class name
string   $func   Method to call on the object or class when the timer expires

[ Top ]

method setTimeout() [line 239]

SiteFusionTimer setTimeout( int $timeout, object|string $obj, string $func)

Sets a server-based timeout callback

This function is similar to the JavaScript window.setTimeout() function. It dispatches a timer for a certain amount of milliseconds, and fires the handler method when the timer expires. The timer can be cancelled by calling the cancel() method on the returned timer object.


return:  Timer object created
access:  public

Parameters:

int   $timeout   Timeout in milliseconds
object|string   $obj   Object or class name
string   $func   Method to call on the object or class when the timer expires

[ Top ]


Documentation generated on Mon, 07 Apr 2014 00:52:12 +0200 by phpDocumentor 1.4.3