root/coldbox/trunk/src/system/beans/datasourceBean.cfc @ 362

Revision 362, 4.3 kB (checked in by lmajano, 6 years ago)

New formatting

Line 
1<!-----------------------------------------------------------------------
2Copyright 2005 - 2006 ColdBox Framework by Luis Majano
3www.coldboxframework.com | www.coldboxframework.org
4-------------------------------------------------------------------------
5Author   :      Luis Majano
6Date     :      June 30, 2006
7Description :
8        I model a coldfusion datasource connection setting.
9
10Modification History:
11
12----------------------------------------------------------------------->
13<cfcomponent name="datasourceBean" hint="I model a datasource connection setting." output="false">
14
15<!------------------------------------------- CONSTRUCTOR ------------------------------------------->
16        <cfscript>
17                variables.instance = structnew();
18                variables.instance.name = "";
19                variables.instance.dbtype = "";
20                variables.instance.username = "";
21            variables.instance.password = "" ;
22        </cfscript>
23       
24<!------------------------------------------- PUBLIC ------------------------------------------->
25
26        <!--- ************************************************************* --->
27       
28        <cffunction name="init" access="public" output="false" hint="I build a new datasource bean." returntype="any">
29            <!--- ************************************************************* --->
30            <cfargument name="datasourceStruct"         type="struct" required="false" default="#structnew()#" hint="The structure holding the name,dbtype,username,and password variables." >
31            <!--- ************************************************************* --->
32            <cfif not structisEmpty(arguments.datasourceStruct)>
33                    <cfset setInstance(arguments.datasourceStruct)>
34            </cfif>
35            <cfreturn this >
36        </cffunction>
37       
38        <!--- ************************************************************* --->
39       
40        <cffunction name="getInstance" access="public" returntype="any" output="false">
41                <cfreturn variables.instance >
42        </cffunction>
43       
44        <!--- ************************************************************* --->
45       
46        <cffunction name="setInstance" access="public" returntype="void" output="false">
47                <cfargument name="instance" type="struct" required="true">
48                <cfset variables.instance = arguments.instance>
49        </cffunction>
50       
51        <!--- ************************************************************* --->
52       
53        <cffunction name="setname" access="public" return="void" output="false" hint="Set name of the datasource, this maps to the Coldfusion datasource name">
54          <cfargument name="value" type="string" >
55          <cfset variables.instance.name=arguments.value >
56        </cffunction>
57       
58        <!--- ************************************************************* --->
59       
60        <cffunction name="getname" access="public" return="string" output="false" hint="Get the name">
61          <cfreturn variables.instance.name >
62        </cffunction>
63       
64        <!--- ************************************************************* --->
65       
66        <cffunction name="setDBType" access="public" return="void" output="false" hint="Set DBType">
67          <cfargument name="value" type="string" >
68          <cfset variables.instance.dbtype=arguments.value >
69        </cffunction>
70       
71        <!--- ************************************************************* --->
72
73        <cffunction name="getDBType" access="public" return="string" output="false" hint="Get DBType">
74          <cfreturn variables.instance.dbtype >
75        </cffunction>
76       
77        <!--- ************************************************************* --->
78       
79        <cffunction name="setUsername" access="public" return="void" output="false" hint="Set Username">
80          <cfargument name="value" type="string" >
81          <cfset variables.instance.Username=arguments.value >
82        </cffunction>
83       
84        <!--- ************************************************************* --->
85       
86        <cffunction name="getUsername" access="public" return="string" output="false" hint="Get Username">
87          <cfreturn variables.instance.Username >
88        </cffunction>
89       
90        <!--- ************************************************************* --->
91       
92        <cffunction name="setPassword" access="public" return="void" output="false" hint="Set Password">
93          <cfargument name="value" type="string" >
94          <cfset variables.instance.Password=arguments.value >
95        </cffunction>
96       
97        <!--- ************************************************************* --->
98       
99        <cffunction name="getPassword" access="public" return="string" output="false" hint="Get Password">
100          <cfreturn variables.instance.Password >
101        </cffunction>
102       
103        <!--- ************************************************************* --->
104
105</cfcomponent>
Note: See TracBrowser for help on using the browser.