COVER STORY                     ColdFusion sollte hier stehen
                                Schlagwort MX 7 Serv...
REVIEWS                           ColdFusion MX 7 Server

                                                                     ColdFusion MX 7 Server

REVIEWS                           ColdFusion MX 7 Server

tional enterprise level features. The next       You can crea...
Upcoming SlideShare
Loading in …5

Coldfusion MX 7 Server


Published on

A review of ColdFusion MX 7 that appeared in Linux Magazine

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Coldfusion MX 7 Server

  1. 1. REVIEWS COVER STORY ColdFusion sollte hier stehen Schlagwort MX 7 Server A look at Macromedia’s new ColdFusion MX 7 Server for Linux COLD NEW TOOL run-time variables that you can tweak to improve overall performance. This fea- ture gives you an easy-to-use interface to manage settings that would require a text file (php.ini) in PHP. The Administrator also allows you to manage data sources, web services, scheduled tasks, tag extensions (more on this later), sandbox security, and more. With ColdFusion, you are discour- aged from going near any configuration files; the configuration options available through the Administrator mean you’ll probably never have to. Rich Content Macromedia is without a doubt the mas- ter of rich content on the Internet. The Flash format [3] for web-based anima- tions, games, and user friendly interfaces is almost the de facto standard. Java Applets and ActiveX controls seem clumsy in comparison. It is no surprise, then, that Macrome- dia have taken advantage of their own Macromedia's new ColdFusion MX 7 Server creates highly available popular Flash technology to enhance the content output options in ColdFusion. and high performance web applications. We'll show you what is new Flash format is an option when render- ing charts and input forms, and Macro- and what is changed with the latest ColdFusion release. media’s new FlashPaper [4] format (Figure 2) is an option when outputting BY LARKIN CUNNINGHAM documents such as reports. Adobe’s PDF (Portable Document Format) is also sup- ported. The choice of PDF and FlashPa- T he release of ColdFusion MX 7 Macromedia has continued to develop per means you can output content that is [1] marks the tenth anniversary ColdFusion and has added major guaranteed to be printable exactly as it of the ColdFusion web develop- enhancements. This latest release has appears in the web browser. ment platform. Originally a C+ Win- + further added to ColdFusion’s arsenal of Support for Flash and PDF on Linux dows application, ColdFusion is now a rich content generation with improved has improved in recent months, meaning J2EE-based development environment charting capabilities, report generation it should not be a major problem to that runs on Linux, AIX, Mac OS X, and using FlashPaper and PDF, and Flash- deploy a ColdFusion intranet application Solaris, as well as Windows. based input forms, allowing for complex on a Linux desktop environment while The ColdFusion platform was created form layouts such as tabbing. offering all the rich content features you and developed by Allaire Corporation. want. The Administrator Macromedia acquired ColdFusion in The CFCHART Tag 2001 and released what would have been ColdFusion comes with a web-based ColdFusion version 6.0, calling the prod- administrator application (Figure 1) to ColdFusion’s CFCHART tag allows you to uct ColdFusion MX to promote a connec- help you manage your ColdFusion envi- output smoothly rendered charts in tion with other products in Macrome- ronment. The admin application allows PNG, JPEG, or Flash format. The Flash dia's MX line, such as Dreamweaver and you to adjust settings for client variable format charts provide a number of addi- Flash. caching, Java / JVM memory, and other tional charting options. such as lines or 38 ISSUE 56 JULY 2005 W W W. L I N U X - M A G A Z I N E . C O M
  2. 2. COVER STORY REVIEWS Schlagwort sollte hier stehen ColdFusion MX 7 Server Figure 1: The ColdFusion Administrator keeps you away from the Figure 2: An example of a FlashPaper document embedded in a web command line and configuration files. page. bars rising from the x-axis to the correct graphing, it has to be said, is more pol- ters to configure your charts in Cold- data point on the graph or pie charts fad- ished, with anti-aliased smooth edges, Fusion. ing into view. Each chart format allows and the native ColdFusion graphing sys- Flash Forms, ActionScript, for clickable area maps, which gives the tem is easier to configure. and Remoting user the power to assign URL values to In Figure 3, you can see an example chart segments. This feature gives you chart showing levels of spam and Flash-based input forms allow for client the possibility of creating drill down viruses in the past 30 days. In Listing 3, side processing, validation, and form charts for Management Information Sys- you will find the CFCHART tags used to rendering. Flash-based input forms tems (MIS) or Decision Support Systems create the chart depicted in Figure 3. exceed the capabilities of standard (DSS). ColdFusion offers many other The CFCHARTSERIES tag is used to HTML and JavaScript and are easier to chart type options. For instance, you can specify each line or bar in a line or bar implement and deploy than Java Applet- choose to include line, bar, pie, and scat- chart and each segment in a pie chart. In based input forms. Not only do Flash ter charts. the example described previously, we forms give you more control over how PHP offers some third party options loop through some queries, creating data is entered to enforce business rules, for creating graphs. Possibly the most many data points with the CFCHART- Flash also makes the user experience popular graph option available with PHP DATA tag. As you can see in Listing 3, much richer. Figure 4 shows an example is JpGraph, which offers a more compre- you can use quite a number of parame- of a Flash form that uses tabbing, a cal- hensive array of chart types than Cold- The Tag-Based Approach Fusion. JpGraph is available free for non-commercial use. ColdFusion’s CFML is a tag based language with your between hashes (#) and included CFML and HTML store in .cfm web between CFML tags or as parameters to Listing 1: empquery.cfm pages. Rather than the traditional script- a CFML tag are interpreted by ColdFu- ing approach used by PHP and ASP, sion. Including the query as a parameter 01 <CFQUERY NAME= qryGetREmps CFML uses tags similar to HTML, with to the CFOUTPUT tag causes the tag con- DATASOURCE= #MyDSN# > opening and closing tags. Not all CFML tents to be repeated for each row in the has to be tag based, however, because query’s result set. 02 SELECT * FROM many tags have script equivalents. List- employees Let's compare this with the PHP5 / ing 1 shows a simple SQL query fol- mysqli [2] equivalent in Listing 2. Excep- 03 </CFQUERY> lowed by the output of the query results. tion catching code has been omitted for 04 Notice how the CFML tags take parame- simplicity. 05 <CFOUTPUT QUERY= qryGetEmps > ters like standard HTML. In the example As you can see from the code snippets, above, the CFQUERY tag was used to CFML can have the advantage of being 06 Name: #qryGetEmps. populate a result set from the database easier to write and easier to read than FirstName# #qryGetEmps. connection created using the MyDSN equivalent PHP code. For a web designer LastName#<br> connection string defined in the Cold- with little or no background in program- 07 Address: #qryGetEmps. Fusion Administrator (more on this later). ming, CFML is easier and quicker to Address1#, #qryGetEmps. Outputting the result set data is easily learn than PHP. CFML lets a relative nov- Address2# achieved using the CFOUTPUT tag. Vari- ice create quite powerful code with just a ables and function calls enclosed few tags. 08 </CFOUTPUT> 39 ISSUE 56 JULY 2005 W W W. L I N U X - M A G A Z I N E . C O M
  3. 3. REVIEWS ColdFusion MX 7 Server the case of CFML custom tags, you can simply create a file containing your cus- tom tag CFML code and place it in a directory in ColdFusion’s custom tag path (similar to a classpath). Java and C++ custom tags (referred to as CFX tags), however, must be explicitly declared using the ColdFusion Adminis- trator. Custom tags can then be used like any other CFML tag, as if they were a part of the core language. This is possi- ble in PHP also, but it usually involves either including other PHP source into your page or recompiling PHP with a new module. Because ColdFusion runs in a J2EE application server, you also have access to Java classes in the JVM’s classpath and in the WEB-INF/lib and WEB-INF/ classes directories (as you would also expect with Tomcat, for example). Using the CFOBJECT tag, you can create objects, allowing access to functions and methods. Access to JavaBeans is also Figure 3: The CFCHART tags allow you to easily create stunning graphs possible. endar control, headings, and additional This allows a separation of business Interoperation between CFML, JSP, layout features. logic from Flash presentation logic. and Servlet pages is also possible. This ActionScript is the scripting language allows you to maintain legacy JSP / Object-Oriented used to interact with Flash MX. You can Programming Database Abstraction use ActionScript in your ColdFusion code to interact with a Flash Remoting While both CFML and PHP are histori- CFML includes, by default, a database server to allow your ColdFusion applica- cally structured programming languages, abstraction layer that allows you to write tion to interact with advanced Flash MX both implement object-oriented features. database-independent applications. The applications and animations. A Flash Neither can be called true object-ori- CFQUERY tag, as an example, only MX developer who doesn’t know CFML ented languages, however, as they do requires the DATASOURCE parameter can still build a server-side ActionScript not implement all of the features of true to be able to connect to a database and that interacts with ColdFusion resources. object-oriented languages such as C++ perform a SQL query. Like ODBC, Cold- Fusion offers a database abstraction or Java. CFML provides what are called Listing 2: empquery.php layer. ColdFusion’s database abstraction ColdFusion Components or CFCs. CFCs layer can support ODBC connections support encapsulation, inheritance, and 01 $dbconn = new mysqli($dbhost, and native database connections using introspection. CFCs are stored in .cfc $dbuser, $dbpass, $dbname); JDBC. Included are drivers for MySQL files rather than .cfm files. (before 4.1), DB2, Informix, SQL Server, 02 Listing 4 shows a sample CFC file that Sybase, Oracle, and J2EE Datasources defines a component called Convert- 03 $result = (using JNDI). Oracle and Sybase drivers Temp, which converts from Celcius to $dbconn->query('SELECT * FROM are only included with the Enterprise Fahrenheit and vice versa. Listing 5 employees'); edition of ColdFusion, however, you can shows some sample CFML code that create data sources using your own 04 invokes the methods in the component. JDBC drivers (typically by copying a 05 while ($row = $result->fetch_ ColdFusion’s object-oriented features JAR file to an appropriate library direc- assoc()) are not quite as elegant as PHP 5’s tory) and specifying the JDBC url and 06 { class name for your driver. You can implementation of object-oriented func- achieve something similar using a JNDI tionality, but ColdFusion gives you what 07 printf( Name: %s resource. you need to create easily maintainable %s<br> , $row['FirstName'], There are ways of incorporating data- component-based applications. $row['LastName']); base abstraction into PHP using ADODB 08 printf( Address: %s, Extending ColdFusion and Pear DB, however, these techniques %s , $row['Address1'], require the installation of additional files You can extend the functionality of Cold- $row['Address2']); and can require you to include addi- Fusion through the use of Custom Tags 09 } tional files into your PHP scripts. written using CFML, Java, or C++. In 40 ISSUE 56 JULY 2005 W W W. L I N U X - M A G A Z I N E . C O M
  4. 4. REVIEWS ColdFusion MX 7 Server ColdFusion server and can be accessed obeying the instructions provided in by multiple ColdFusion instances (by robots.txt and following links specified installing ColdFusion in multiserver in HTML HREF, FRAME, and META mode – more on this below). Using the Refresh / Redirect tags. The capabilities ColdFusion Administrator, you can cre- provided by the Verity Spider allow you ate a Collection. A Collection is a store to create an intelligent search facility on on disk for Verity searchable content. your website. A number of CFML tags are available Editions to index content (for example Plain text, PDF document, and HTML documents) ColdFusion comes in three different edi- and to search the content. You can also tions. The Developer edition can be index content returned from a query. accessed from the local machine running This feature of ColdFusion allows you to ColdFusion and two remote clients. This quickly search through large amounts of makes it possible for a small team of text much faster than using a SQL developers to work on application devel- Figure 4: Flash Forms give you greater SELECT query, where large text fields opment using the same ColdFusion control over how users input their data. (for example the TEXT datatype in instance. The Developer edition contains Servlet applications while converting to MySQL) cannot be indexed. One area all of the functionality in ColdFusion and CFML. You can incorporate CFML func- this technology can be deployed in is a is free to download. tionality into your existing JSP applica- knowledge base. The Standard edition contains just tions, for example, to take advantage of New in ColdFusion MX 7 is the Verity about all of the functionality of ColdFu- ColdFusion’s charting or business report- Spider. The Verity Spider allows you to sion, except for some features concerned ing features. Conversely, if there are cer- index whole directories or websites primarily with performance and avail- tain operations best performed by a JSP dynamically. Unlike the CFINDEX CFML ability. Rather than explaining the fea- or a Servlet page, you can incorporate tag, which allows you create specific tures that the professional edition con- that functionality into CFML applica- indexes for searching, the Verity Spider tains, it is easier to talk about the fea- tions. creates the searchable content dynami- tures only available in the third and final cally. The Verity Spider supports a wide edition of ColdFusion, the Enterprise Search Engine range of document types, including edition. The retail price for Standard Edi- ColdFusion comes with a powerful HTML, PDF, Microsoft Office, Word- tion is US$ 1,299 / EUR 1,299. For a bit search engine called Verity. The Verity Perfect, XML, and others. Verity Spider more money (Enterprise Edition costs engine can run independently of the behaves just like other website spiders, US$ 5,999 / EUR 5,999), you get addi- Listing 4: convertTemp.cfc Listing 3: chart.cfm 01 <cfchart scalefrom=quot;0quot; item=quot;#DateFormat(scan_ 01 <cfcomponent> scaleto=quot;1quot; showlegend=quot;yesquot; date,quot;dd-mmm-yyquot;)# 02 <!--- Celsius to Fahrenheit markersize=quot;4quot; value=quot;#(pspam_sum + bspam_ conversion method. ---> labelformat=quot;percentquot; sum) / total_sum#quot;> 03 <cffunction name=quot;ctofquot; 02 title=quot;Percentage Spam and 08 </cfloop> output=quot;falsequot;> Viruses - Last 30 daysquot; backgr 09 </cfchartseries> 04 <cfargument name=quot;tempquot; oundcolor=quot;##eeeeeequot; 10 <cfchartseries type=quot;linequot; required=quot;yesquot; type=quot;numericquot;> showborder=quot;yesquot; seriescolor=quot;redquot; format=quot;FLASHquot; 05 <cfreturn serieslabel=quot;Virusesquot; xAxisTitle=quot;Datequot; ((temp*9)/5)+32> markerstyle=quot;circlequot;> 03 yAxisTitle=quot;Percentage of 06 </cffunction> 11 <cfloop Overallquot; chartHeight=quot;400quot; 07 query=quot;qry30daysquot;> chartWidth=quot;540quot; show3D=quot;noquot; 08 <!--- Fahrenheit to Celsius 12 <cfchartdata showXGridlines=quot;yesquot; seriesPla conversion method. ---> item=quot;#DateFormat(scan_ cement=quot;clusterquot;> date,quot;dd-mmm-yyquot;)#quot; 09 <cffunction name=quot;ftocquot; 04 value=quot;#virus_sum / total_ output=quot;falsequot;> 05 <cfchartseries type=quot;linequot; sum#quot;> 10 <cfargument name=quot;tempquot; seriescolor=quot;bluequot; 13 </cfloop> required=quot;yesquot; type=quot;numericquot;> serieslabel=quot;Spamquot; 14 </cfchartseries> 11 <cfreturn markerstyle=quot;circlequot;> ((temp-32)*5/9)> 15 06 <cfloop 12 </cffunction> 16 </cfchart> query=quot;qry30daysquot;> 13 </cfcomponent> 07 <cfchartdata 41 ISSUE 56 JULY 2005 W W W. L I N U X - M A G A Z I N E . C O M
  5. 5. REVIEWS ColdFusion MX 7 Server tional enterprise level features. The next You can create custom event gateways other scripting language. And what section describes the Enterprise edition. to interact with mobile devices and ColdFusion cannot do, you can do by instant messaging servers, for example, extending ColdFusion with Java, JSP, or Enterprise Edition Features or any other server application via any Servlets. The Enterprise Manager allows you to networking protocol (using Java sock- The choice of whether you use Cold- manage multiple instances of ColdFu- ets). You can also use the included gate- Fusion will depend on the nature of the sion on a single server. The configura- ways to SMS, XMPP (Extensible Messag- application. For rich content sites using tion is similar to other J2EE application ing and Presence Protocol), Sun’s JMS charts, Flash forms, FlashPaper or PDF, servers like Tomcat, where an applica- (Java Messaging Service) and Lotus ColdFusion is a good choice. For general tion server binary base is shared among Sametime. XMPP [6] is an open source purpose content management systems, multiple private JVMs (Java Virtual instant messaging solution and protocol ColdFusion is also an excellent choice. Machines). This means that multiple from the Jabber [7] Software Founda- For rapid development, ColdFusion applications can enjoy isolation from tion. Lotus Sametime [8] is a product offers an easy-to-learn, tag-based script- each other, providing better security and offered by IBM for instant messaging ing language that allows you to create stability without the requirement of sep- and web conferencing. powerful applications with the minimum arate dedicated servers. You can also The Enterprise edition also lets you of coding effort. For many, this is enough cluster these applications to improve take advantage of a high performance, to justify even the price of the Enterprise performance and availability. multithreaded business reporting engine. edition of ColdFusion, which allows you JRun [5] is included with the Enter- This is ideal for Management Informa- to construct the kind of highly available prise edition, giving you a commercial tion Systems, which can also use the and high-performing environment that alternative to Tomcat. You can combine charting features to create drill down mission critical applications demand. your ColdFusion application code with statistics. For many developers on the Linux JSP or Servlet code in JRun. You can deploy your applications as platform, it will come down to a choice You can deploy your ColdFusion appli- Java bytecode, avoiding the exposure of of PHP, JSP / Servlets, or ColdFusion. cations using your preferred J2EE appli- your source code. This is important if ColdFusion is the only choice requiring cation server. JRun, Weblogic, and Web- you want to protect your intellectual the purchase of a license for deployment sphere are supported by Macromedia. property. in a production environment, though all Security is enhanced for virtual host- are free to download and develop on. Supported Platforms ing environments using sandbox secu- And with an ever growing number of rity. Sandbox security allows you to set ColdFusion is supported on a number of hosting companies offering support for security policies, such as tag, function, platforms, including Linux, Windows, ColdFusion at reasonable prices, you datasource, and IP address restrictions, Solaris, AIX, and Mac OS X (develop- may never need to pay for a license. on directories. Applications running ment only). Red Hat Enterprise Linux In short, if you’re thinking about explor- within the directories have no access to 2.1 and 3.0, SUSE Linux Enterprise ing the benefits of a commercial product, the settings or files of any other applica- Server 8, and TurboLinux 8 (Japanese before you commit to anything else, tions. only) are supported by Macromedia, you should at least investigate Cold- though there should be no issues run- Fusion MX 7. ■ Listing 5: ning on CentOS 3, White Box Linux 3, convTempForm.cfm INFO and many other Linux distributions. In theory, it should be possible to deploy 01 <cfinvoke [1] Macromedia ColdFusion MX 7: ColdFusion on any Java platform. JRun, component=quot;convertTempquot; BEA Weblogic, and IBM Websphere are software/coldfusion/ method=quot;ctofquot; supported by Macromedia, but instruc- [2] PHP 5 and the mysqli module: 02 tions are provided for Tomcat, and there returnvariable=quot;newtempquot; should be few issues deploying on JBoss mysqli.php temp=30> or Resin. [3] Macromedia Flash: http://www. 03 <cfoutput>30 degrees Celsius ColdFusion can run either as a stand- is #newtemp# degrees alone web server or in conjunction with [4] Macromedia FlashPaper: Farenheit.</cfoutput> Apache (1.3.27 or higher, 2.0.43 or higher), iPlanet 6.x, or Sun ONE 6.x. 04 <cfinvoke software/flashpaper/ component=quot;convertTempquot; [5] Macromedia JRun: http://www. Is ColdFusion For You? method=quot;ftocquot; There is no simple answer to the ques- 05 [6] XMPP Protocol: tion of why or when you might benefit returnvariable=quot;newtempquot; [7] Jabber Software Foundation: from using ColdFusion. For some appli- temp=64> cations, PHP or Perl or JSP will be the 06 <cfoutput>64 degrees [8] Lotus Sametime: better choice, and for others, ColdFusion Fahrenheit is #newtemp# is best. There is little you cannot do with degrees Celsius.</cfoutput> product3.nsf/wdocs/homepage/ ColdFusion that you can do with any 42 ISSUE 56 JULY 2005 W W W. L I N U X - M A G A Z I N E . C O M