Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updating examples to use new external factory feature and be slightly…

… more realistic
  • Loading branch information...
commit 7c5da972faa17569ab3bdc450307e55880b9a0b4 1 parent 888247f
@atuttle authored
View
4 examples/api_both/Application.cfc
@@ -7,7 +7,7 @@ component extends="taffy.core.api" {
//do your onApplicationStart stuff here
function applicationStartEvent(){
application.beanFactory = createObject("component", "coldspring.beans.DefaultXMLBeanFactory");
- application.beanFactory.loadBeans('/taffy/examples/api_coldspring/config/coldspring.xml');
+ application.beanFactory.loadBeans('/taffy/examples/api_both/config/coldspring.xml');
}
//do your onRequestStart stuff here
@@ -22,7 +22,7 @@ component extends="taffy.core.api" {
//called when taffy is initializing or when a reload is requested
void function configureTaffy(){
- setBeanFactory(application.beanfactory, "artfartCollection");
+ setBeanFactory(application.beanfactory);
setDebugKey("debug");
setReloadKey("reload");
setReloadPassword("true");
View
2  examples/api_both/config/coldspring.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans>
- <bean id="configBean" class="coldspring.examples.quickstart.components.ConfigBean" />
+ <bean id="fakeData" class="taffy.examples.shared.fakeData" />
</beans>
View
13 examples/api_both/resources/artfartCollection.cfc
@@ -1,18 +1,13 @@
<cfcomponent extends="taffy.core.restapi" taffy_uri="/artfarts">
<cffunction name="get" access="public" output="false">
-
-<cfset var tmp = application.beanFactory.getBeanDefinitionList() />
-<cfdump var="#tmp#">
-<cfdump var="#tmp[1].getBeanClass()#"><cfabort>
-
- <cfreturn representationOf(this.configBean).withStatus(200) />
+ <cfreturn representationOf(variables.fakeData.getData()).withStatus(200) />
</cffunction>
<!--- this will be called by the bean factory's autowire functionality --->
- <cffunction name="setConfigBean" access="public" output="false" returnType="void">
- <cfargument name="configBean" type="any" required="true" hint="configBean object" />
- <cfset this.configBean = arguments.configBean />
+ <cffunction name="setFakeData" access="public" output="false" returnType="void">
+ <cfargument name="fakeDataObj" type="any" required="true" hint="Shared FakeData object" />
+ <cfset variables.fakeData = arguments.fakeDataObj />
</cffunction>
</cfcomponent>
View
2  examples/api_coldspring/Application.cfc
@@ -22,7 +22,7 @@ component extends="taffy.core.api" {
//called when taffy is initializing or when a reload is requested
void function configureTaffy(){
- setBeanFactory(application.beanfactory, "artfartCollection");
+ setBeanFactory(application.beanfactory);
setDebugKey("debug");
setReloadKey("reload");
setReloadPassword("true");
View
6 examples/api_coldspring/config/coldspring.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans>
- <bean id="configBean" class="coldspring.examples.quickstart.components.ConfigBean" />
+ <bean id="fakeData" class="taffy.examples.shared.fakeData" />
<bean id="artfartCollection" class="taffy.examples.api_coldspring.stuff.artfartCollection">
- <property name="configBean">
- <ref bean="configBean" />
+ <property name="fakeData">
+ <ref bean="fakeData" />
</property>
</bean>
View
12 examples/api_coldspring/stuff/artfartCollection.cfc
@@ -1,17 +1,13 @@
<cfcomponent extends="taffy.core.restapi" taffy_uri="/artfarts">
<cffunction name="get" access="public" output="false">
-
-<cfset var tmp = application.beanFactory.getBeanDefinitionList() />
-<cfdump var="#tmp[1].getBeanClass()#"><cfabort>
-
- <cfreturn representationOf(this.configBean).withStatus(200) />
+ <cfreturn representationOf(variables.fakeData.getData()).withStatus(200) />
</cffunction>
<!--- this will be called by the bean factory's autowire functionality --->
- <cffunction name="setConfigBean" access="public" output="false" returnType="void">
- <cfargument name="configBean" type="any" required="true" hint="configBean object" />
- <cfset this.configBean = arguments.configBean />
+ <cffunction name="setFakeData" access="public" output="false" returnType="void">
+ <cfargument name="fakeDataObj" type="any" required="true" hint="Shared FakeData object" />
+ <cfset variables.fakeData = arguments.fakeDataObj />
</cffunction>
</cfcomponent>
View
14 examples/shared/fakeData.cfc
@@ -0,0 +1,14 @@
+<cfcomponent output="false">
+
+ <cffunction name="getData" output="false" access="public">
+ <cfset var qry = queryNew("id,foo", "integer,varchar") />
+ <cfset var i = 0 />
+ <cfloop from="1" to="15" index="i">
+ <cfset tmp = queryAddRow(qry) />
+ <cfset tmp = querySetCell(qry, "id", i) />
+ <cfset tmp = querySetCell(qry, "foo", toBase64(hash("bar" & i), "utf-8")) />
+ </cfloop>
+ <cfreturn qry />
+ </cffunction>
+
+</cfcomponent>
Please sign in to comment.
Something went wrong with that request. Please try again.