Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Flex and ColdFusion Hybrid Application with ServiceFactory
Levering ColdFusion ServiceFactory to get work done

Whether it's in factories or workshops, in mines or forests, in offices or homes, or even in our sacred ColdFusion Administrator, anything that impairs the efficiency of workers is always worthy of improvements in the process or changing the way of doing things.

Levering ColdFusion ServiceFactory to get work done is one example. Figure 1 is a screenshot of an example Flex-ColdFusion hybrid application that allows manipulation of ColdFusion mapping without having (or even needing) access to the ColdFusion Administrator.

Look at the code. The Flex UI code is shown in Listing 1. The initialize attribute in the main MXML file calls the getIP() function during initialization of the Flex application. This function triggers a RemoteObject invocation of the roMapping.getVisitorIP() method. The getVisitorIP() method is the first function shown in Listing 2. ( Listing 2 can be downloaded from the online version of this article at http://coldfusion.sys-con.com.) By examining the IP address of the user, we can programmatically allow Flex to decide if the CFC mapping utility is visible. This is a way to limit CFC mapping changes to users on your internal network. For instance, in the Flex code, the getVisitorIP_handler has a conditional that ensures that only IP addresses on an internal network that start with 192.168 can call the RemoteObject's method, roMapping.getMappings(). Of course, you can change that to whatever your internal network's IP addresses start with once you download the code. Speaking of the code, the full source code is available at http://labs.insideflex.com/flextraining/cfmapping/bin/srcview/index.html.

Provided the user is coming from the appropriate IP address, the RemoteObject method, roMapping.getMappings(), instantiates a factory object and calls the ColdFusion servers ServiceFactory getMappings method:

<cfset factory=createObject("java","coldfusion.server.ServiceFactory")>
<cfset mappings = factory.runtimeService.getMappings()>

A structure of arrays stores the mapping information returned from the ServiceFactory and is returned to the Flex UI as a structure:

<cfset stMapping = structNew()>
<cfset aLogicalPath = ArrayNew(1)>
<cfset aDirectoryPath = ArrayNew(1)>
<cfloop collection="#mappings#" item="thismapping">
    <cfscript>
       ArrayAppend(aLogicalPath, thismapping);
       ArrayAppend(aDirectoryPath, mappings[thismapping]);
    </cfscript>
</cfloop>
<cfscript>
       StructInsert(stMapping, "logicalpath", aLogicalPath);
       StructInsert(stMapping, "directorypath", aDirectoryPath);
</cfscript>
<cfreturn stMapping/>

Methods for creating, updating, and deleting mappings are also included in the CFC.

Warning
Updating or deleting ColdFusion mappings should be done with caution, especially on shared ColdFusion servers.

Flex Form validation is used and shown in Figure 2 and Figure 3.

For additional information, my Flex Cookbook post, "Get a Client IP Address with a RemoteObject Call," demonstrates limiting access to Flex content on your internal network or by selected IP addresses. It uses the ColdFusion CFML CGI.Remote_Addr variable passed to the Flex UI via AMF. www.adobe.com/cfusion/communityengine/index.cfm?
event=showdetails&postId=3462&productId=2
.

I hope you found this article useful. If you have any follow-up questions, feel free to contact me.

About Michael Givens
Mike Givens is the CTO of U Saw It Enterprises, a Web technology consulting firm based in Marietta, GA. He is an Adobe Corporate Champion known to share his experience and evangelism of all things Adobe. Certified in both ColdFusion 5 and as an Advanced CFMX Developer, he has been using ColdFusion since the days of Allaire Spectra. For the last 11 years, he has been seen with his head down - deep in the code.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
Citrix has opened up a beta of its CloudStack 3, the first release of the open source cloud platform under the Citrix brand. Citrix acquired the Java-based cloud management last year when it bought Cloud.com. A full production version of the branded stuff is supposed to be avai...
EMC and VMware are going into the cloud business with Atos, the big, publicly owned, Paris-based global IT services firm, intending to take an equity position in Canopy, an end-to-end cloud company Atos is setting up using EMC and VMware technology. The companies said Wednesday...
A Tel Aviv start-up called Porticor that’s just hit the radar says it’s got a way to secure the cloud, any cloud. Fancy that, a trustworthy cloud. And Porticor delivers its data encryption solution to IaaS and PaaS users through the cloud in minutes. Fancy that. It’s supposed...
Rackspace Hosting, the service leader in cloud computing, on Thursday announced its acquisition of SharePoint911, an industry leader in SharePoint consulting, training, and "JumpStart" services within SharePoint. The unification of both companies provides capabilities to deliver ...
"The volume of data we're generating now from machines pales in comparison to the volume of data we'll soon generate from our own bodies," says data security expert Dave Asprey. Writing in a Trend Micro blog, Asprey - who is one of the leaders in the emerging Quantified Self move...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
Cut the Rope, the worldwide phenomenon created by global gaming and entertainment company ZeptoLab, ...