Skip to content

Instantly share code, notes, and snippets.

@cfmitrah
Created March 11, 2019 07:57
Show Gist options
  • Save cfmitrah/093a3474c9a180b155ca9f07ef456119 to your computer and use it in GitHub Desktop.
Save cfmitrah/093a3474c9a180b155ca9f07ef456119 to your computer and use it in GitHub Desktop.
Demo Lucee Event Gateway - Gateway Component
<cfcomponent extends="Gateway">
<cfset fields=array(
field("Directory","directory","",true,"The directory you want to watch","text")
,field("Watch subdirectories","recurse","true",true,"Should we watch the directory and all subdirectories too","checkbox")
,field("Interval (ms)","interval","60000",true,"The interval between checks, in miliseconds","text")
,field("File filter","extensions","*",true,"The comma separated list of file filters to match (* = all files). Examples: *user*,*.gif,2010*,myfilename.txt","text")
,group("CFC Listener Function Definition","Definition for the CFC Listener Functions, when empty no listener is called",3)
,field("Change","changeFunction","onChange",true,"called when a file change","text")
,field("Add","addFunction","onAdd",true,"called when a file is added","text")
,field("Delete","deleteFunction","onDelete",true,"called when a file is removed","text")
)>
<cffunction name="getClass" returntype="string">
<cfreturn "">
</cffunction>
<cffunction name="getCFCPath" returntype="string">
<cfreturn "lucee.extension.gateway.demoDriver">
</cffunction>
<cffunction name="getLabel" returntype="string" output="no">
<cfreturn "Directory watcher ( Demo )">
</cffunction>
<cffunction name="getDescription" returntype="string" output="no">
<cfreturn "Simply logs the changed file with its time">
</cffunction>
<cffunction name="onBeforeUpdate" returntype="void" output="false">
<cfargument name="cfcPath" required="true" type="string">
<cfargument name="startupMode" required="true" type="string">
<cfargument name="custom" required="true" type="struct">
</cffunction>
<cffunction name="getListenerCfcMode" returntype="string" output="no">
<cfreturn "required">
</cffunction>
<cffunction name="getListenerPath" returntype="string" output="no">
<cfreturn "lucee.extension.gateway.demoGatewayListener">
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment