Site:Interfaces

From Metrixstream
Revision as of 15:16, 16 May 2012 by MetrixAdmin (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

Context Interfaces encapsulate various functionality available to you during integration.

ApplicationContext

The ApplicationContext is at the heart of it all. It is the gateway to all other contexts that might be necessary for execution of a BackendContext.

getLicenseContext()
@return a LicenseContext.
getDatabaseContext()
@return a DatabaseContext.
getGlobalContext()
@return a GlobalContext.
getAuthContext()
@return a AuthContext.
getRenderContext()
@return a RenderContext.

AuthContext

The AuthContext is responsible for providing all necessary functionality for authenticated users and their various access.

isLoggedIn()
@return a boolean on whether or not there is an authenticated user.
hasUser()
@return a boolean on whether or not there is an authenticated user and if that authenticated user is a User object.
isUser(id)
@return a boolean on whether the param:id represents the current authenticated user (if there is an authenticated user).
getUser()
@return a User object for the authenticated user.
hasOwner()
@return a boolean on whether or not there is an authenticated user and if that authenticated user is an Owner object.
getOwner()
@return a Owner object for the authenticated user.
isAdministrator()
@return a boolean on whether or not the authenticated user is an administrator.
isModerator()
@return a boolean on whether or not the authenticated user is a moderator.


BackendContext

getInternalName()
@return the internal name of this context. This value must be hard-coded inside this function and must be unique across all other backend contexts.
getDisplayName()
@return the display name of this context.
getLayoutPosition()
@return the layout position of this context so that it can show up higher/lower in a list of all contexts. The default value of this function is 0 and then sorting is alphabetical in ascending order.
isDependantOnScope(scopeKey)
@return a boolean on whether or not this context is dependent upon this scopeKey. This is important to signal whether or not execute(...) function is dependent upon scope produced by other backend contexts.
getConsumableParams()
@return Array of param names. This function is necessary to properly handle caching of this context. This function also is used by the helper function getParam().
filterParam(paramName, paramValue, whitelist = Array)
@return the filtered value of paramValue. This function should be overridden by each context that processes input params from the URL.
getParam(PageContext page, paramName, default)
@return the proper value for paramName. This is a helper function that properly handles whether or not this value is supported by the context and applies any param whitelisting specified by the PageContext.
execute(ScopeContext scope, PageContext page)
@return RenderOutput. This function must be overridden by each backend context.
getApplicationContext()
@return ApplicationContext. This dependency is injected into each backendcontext upon initialization.

DatabaseContext

The DatabaseContext is responsible for providing the necessary functionality to interact with all relevant databases.

getNames()
@return an Array of the available database names.
closeAll()
closes all of the database connections.
getDB(name)
@return a SQLDB object.
getDBOption(name, option)
@return a database option; options include: backups
getBackDB()
@return a SQLDB object for the backend database; this is equivalent to getDB("back")
getBlobDB()
@return a SQLDB object for the blob database; this is equivalent to getDB("blob")
getStatDB()
@return a SQLDB object for the statistics database; this is equivalent to getDB("stat")


GlobalContext

The GlobalContext is responsible for providing access to information that is constant across all backend contexts.

getSite()
@return a Site object that represents the current site.
getNow()
@return an integer representing the current unix timestamp.
getGeo()
@return a Geo object that reprents the current location (countrycode, regioncode, city) of the request.


LicenseContext

The LicenseContext is responsible for providing information stored within the license.

getId()
@return the license id.
getConfigValue(key)
@return the configuration value that is stored for param:key.
getServerConfigValue(key)
@return the server configuration value that is stored for param:key; the server represents the actual server that is executing this function call... meaning the return value may change depending on which server is executing this function.
isEnabled(option)
@return a boolean on whether or not param:option is supported by the license.
getMerchants()
@return an Array of associative arrays representing all the merchants within the license.
getServers()
@return an Array of associative arrays representing all the servers within the license.

PageContext

The PageContext...

getUrlArgs()
getContextArgs()
getConfigParam()


RenderContext

getRenderOutput()
@return a RenderOutput object.


RenderOutput

setCacheable(value)
sets whether or not this output can be cached.
getHDF()
@return an iHDF object.


ScopeContext

The ScopeContext provides relevant scope to consider during various backend processes. At it's core the ScopeContext is a hash-table of objects.

has(key)
@return a boolean on whether or not this key exists.
get(key, default = "")
@return an object for the relevant key.
set(key, value)
stores param: value under param: key
getKeys()
@return an Array of all keys.


TaskContext

The TaskContext is responsible for providing access to the various requirements of an background task.

getLicenseContext()
@return a LicenseContext.
getDatabaseContext()
@return a DatabaseContext.
Personal tools