|
Perhaps another term, rather than gateway
CFC, is CFC service. In my CFSQLTool, is a wizard called CFC Service Designer.
It purpose it to construct a CFC that is used to open other CFCs. There are several
reasons to use a CFC to open other CFCs. The CFC service encapsulates access to
it’s worker CFCs. In the case of CFSQLTool, worker CFCs provide CRUD functions
at the data access layer. The service CFC, in turn, provides a common
namespace for the invoking application. When the application invokes the
service CFC with a function call for a worker, CFC service functions initialize
the worker CFCs. Another reason is that service CFC and worker CFCs can have
different inherence structures. (See: http://www.switch-box.org/images/Cfcservice.png
) A scenario might be a contact database
with tables for contact names, addresses and phones. In application, the
contact may be known as customer. One way to build the data access object is to
use a service CFC invoked as customer that uses data access layer contact
worker CFCs. In the application then, customer.name, can be used as a
namespace. Another application may have contacts for suppliers. In this case,
use a service CFC invoked as supplier that uses the same contact worker CFCs. <cfcomponent
displayname="Customer_serv"
hint="{ts '2005-07-13 18:18:54'}; Kontact1; Objects:
tAccount,tContact,tContactPhone,tContactStreetAddress" > <!--- ****************** Data
Access Layer (DAL): Usually in the wrapper folder Customer.DAL.
****************** ---> <cffunction name="init"
returntype="struct" hint="Init for Customer_serv"
output="no">
<cfreturn this> </cffunction> <!---
************************************************************ ---> <cffunction name="SetInit"
returntype="boolean" hint="SetInit for Customer_serv"
output="no">
<cfargument name="DSN" type="string"
default=""> <cfset
this.DSN = Arguments.DSN >
<cfreturn TRUE> </cffunction> <!---
************************************************************ ---> <cfscript>
Variables.Account = "tAccount_wrap";
Variables.Name = "tContact_wrap";
Variables.Phone = "tContactPhone_wrap";
Variables.Address = "tContactStreetAddress_wrap"; </cfscript> <!---
************************************************************
Use SetObject to instance a one of the DAL wrappers as an object.
************************************************************ ---> <cffunction name="SetObject"
returntype="struct" hint="SetInit for the CFC"
output="no">
<cfargument name="obj" type="string"
required="yes">
<cfobject name="this.#Arguments.obj#"
component="#Variables[Arguments.obj]#">
<cfset this[Arguments.obj].SetInit(this.DSN) >
<cfreturn this[Arguments.obj]> </cffunction> <!---
************************************************************
Use getVars to build a structure of the $ variables of a CFC object.
************************************************************ ---> <cffunction name="GetVars"
returntype="struct" hint="Get instance vars for the CFC"
output="no"> <cfargument
name="obj" type="string" required="yes">
<cfset var keylist = StructKeyList(this[Arguments.obj])>
<cfset var key = "" >
<cfset var varname = StructNew() >
<cfloop index="key" list="#keylist#">
<cfif Mid(key, 1, 1) EQ "$" >
<cfset varname[key] = this[Arguments.obj][key] >
</cfif >
</cfloop>
<cfreturn varname> </cffunction> </cfcomponent> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of [EMAIL PROTECTED] What are gateway CFCs? What’s their
purpose? What goes into a gateway CFC? Is there a best way to
construct them? Thanks - Tom You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected] |
- RE: [CFCDev] gateway CFCs tom.schreck
- Re: [CFCDev] gateway CFCs Salvatore Fusto
- Re: [CFCDev] gateway CFCs Barry Beattie
- Re: [CFCDev] gateway CFCs Bill Rawlinson
- RE: [CFCDev] gateway CFCs Kerry
- RE: [CFCDev] gateway CFCs Joseph Flanigan
- RE: [CFCDev] gateway CFCs Nando
- RE: [CFCDev] gateway CFCs Seth MacPherson
- RE: [CFCDev] gateway CFCs tom.schreck
- RE: [CFCDev] gateway CFCs Nando
- Re: [CFCDev] gateway CFCs Barry Beattie
- RE: [CFCDev] gateway CFCs Nando
- Re: [CFCDev] gateway CFCs Barry Beattie
- [CFCDev] Handling NULL's in a... Callum McGillivray
- RE: [CFCDev] Handling NUL... Jeff Anderson
- Re: [CFCDev] Handling NUL... Callum McGillivray
