I am writing a ColdFusion component for LDAP Active Directory interactions for my company. This is my first ColdFusion component and I want to ensure that I get the init (initialization) function done correctly. Essentially, I am looking for an okay that I have not violated a best practice or appropriate guideline. I have multiple networks which I will need to draw Active Directory information from. Each network has its own set of server variables (address, username etc.) so I want to specify which network I will be connecting to upon the invoking of an object of this type. I am utilizing the CreateObject method of invoking objects as I have read that it is no different than cfinvoke. At any rate, the beginning of my component is below any feedback would be greatly appreciated.
Code:
<cfcomponent displayname="LDAP Active Directory Interaction" hint="This component handles all LDAP AD transactions.">
<!--- allows component to be referenced w/o specifying .init call on component invoke --->
<!--- making <cfset computerObject = CreateObject("component", "components.ldap_ad")> valid and defaulting to tinytim --->
<!--- to specify which network use <cfset computerObject = CreateObject("component", "components.ldap_ad").init("X")> --->
<cfscript>
init();
</cfscript>
<cffunction name="init" access="public" returntype="ldap_ad" output="false">
<!--- sets default argument for network for invoke w/o .init("X") specified --->
<cfargument name="network" type="string" default="tinytim">
<cfif network eq "tinytim">
<cfset serverAddr = "tinytim.christmas.org">
<cfset port = "636">
<cfset userName = "christmas\cratchitTinyTim">
<cfset password = "fezziwig">
<cfset secure = "CFSSL_BASIC">
<cfelseif network eq "martha">
<cfset serverAddr = "martha.christmas.org">
<cfset port = "636">
<cfset userName = "christmas\cratchitMartha">
<cfset password = "belle">
<cfset secure = "CFSSL_BASIC">
<cfelseif network eq "bob">
<cfset serverAddr = "bob.christmas.org">
<cfset port = "636">
<cfset userName = "christmas\cratchitBob">
<cfset password = "scrooge">
<cfset secure = "CFSSL_BASIC">
</cfif>
<!--- returns built object of type ldap_ad --->
<cfscript>
return this;
</cfscript>
</cffunction>
<!--- componenent methods go here --->
</cfcomponent>