Upload
erica-jones
View
219
Download
0
Tags:
Embed Size (px)
Citation preview
Migrating from ColdFusion 5 to CF MX
Sandra Clark
Shayna Productions
www.shayna.com
2
Agenda
ColdFusion Code Compatibility Analyzer Migration Plan Definite Code Breaking Changes Possible Code Breaking Changes Subtle Changes Session Management and Locking Questions and Answers
3
ColdFusion Code Compatibility Analyzer
Located in the ColdFusion Administrator Will check for the following issues
– Obsolete and Deprecated Features– Items which might produce different results in
ColdFusion MX
Good starting point Code still needs to be gone through by
thorough testing.
4
Migration Plan
What is a Migration Plan– A structured strategy to ensure that items running smoothly on CF5
run smoothly when ported to CF MX
Migration Plan Steps– Archive and Deploy a CF 5 Application to a Test Server running CF5– Test Application to make sure it runs correctly– Install CF MX onto the test server– Use the ColdFusion Code Compatibility Analyzer– Using the results of the Code Compatibility Analyzer and the
Migration Guide, determine what needs to be fixed.– Use a source code control system while making changes to source.– Test under Load!!!
5
Definite Code Breaking Changes
Advanced Security CFLOG Database Changes Scoping
6
Advanced Security and CFLOG
Advanced Security– ColdFusion MX is now based on a totally new security model than
ColdFusion 5– All Tags and functions having to do with the security model are obsolete.
CFAUTHENTICATE, CFIMPERSONATE, AUTHENTICATEDCONTEXT(), AUTHENTICATEDUSER(), ISAUTHENTICATED(), ISAUTHORIZED(), ISPROTECTED()
CFLOG– Thread, date and time attributes are deprecated.– All of these attributes default to Yes. Setting any of these attribute values to
No will cause a runtime exception.
Log files no longer supported– Executive.log, Remote.log, Proxy.log, cfadmin.log, Install.log– Server.stdout, Rdsservice.stdout
7
Database Changes – Generic
ColdFusion MX now uses the JDBC Drivers instead of ODBC or Native Drivers
All dbtypes except for “query” are obsolete dbserver, dbname, connectstring, provider and
providerdsn attributes are obsolete No more dsnless connections CFUSION_DBCONNECTIONS_FLUSH is obsolete.
8
Database Changes – Generic
CFPROCPARAM– Ignores the dbvarname attribute for all drivers.
If your CF 5 application depends on this, specify a CFPROCPARAM in the correct positional order.
QUERY OF QUERIES– Will not let you use Reserved SQL words (date, size, etc) as field
names. Alias the names in your first SQL query and then use the aliased
names instead in the query of queries.
CFREPORT– No longer manages ODBC connection for Crystal Reports. Passes
datasource, username and password attributes to Crystal Reports for it to handle the ODBC connection directly.
9
Database Changes – Generic
CFQUERY– No longer allows SQL reserved words as variable or column names.
QUERYADDNEW()– An invalid name passed in will throw an error.
CF 5 – just continued.
10
Database Changes – Access
Memo fields Does not work correctly with the default settings in ColdFusion
Administrator. By default the CLOB and BLOB fields are unchecked. Check
both of these fields in the datasource Administrator to re-enable Access Memo Fields
11
Database Changes – Oracle
Maxrows attribute is obsolete– Use CFPROCRESULT instead if you have ref cursors in packages or
stored procedures. This will cause DataDirect JDBC to place Oracle ref cursors into a result set.
12
Database Changes – Oracle
Problems using the Secure Oracle Connection– Problem: When using the encryption/security features of Oracle, CF5
will connect correctly, CF MX will not. – Situation: While the Oracle thin client supports encryption, it does so
only when using the JDBC driver manager directly. ColdFusion MX uses the datasource object to connect which doesn’t support the encryption.
– Solution: Use Oracles JDBC oci driver, which requires the oci libraries. This driver will pick up the encryption properties from the sqlnet.ora file. Download the driver and libraries from oracle. Use Type other to configure the driver in ColdFusion MX. The class name is oracle.jdbc.driver.OracleDriver and a sample url is jdbc:oracle:oci8:@oracle_server
13
Scoping
All Client, Session, Server, Request and Attributes scopes must be called with their appropriate scope.
– Client.CFID instead of CFID– MX will no longer search the scopes for variables– Variables scope is the only exception for prefacing.
The url variable requesttimeout is no longer supported.– Use <CFSETTING requesttimeout=“”> instead.– Quick Fix <CFSETTING requesttimeout = “#url.requesttimeout#”>
14
Possible Code Breaking Changes
CFLDAP CFGRAPH CFAPPLICATION CFREGISTRY CFDIRECTORY CFHTTP CFSERVLET CFSETTING CFX TAGS
STRUCTKEYLIST() FORM.FIELDNAMES DATEDIFF() ERROR HANDLING VERITY
15
CFLDAP and CFGRAPH
CFLDAP– Sort attribute is deprecated– When action=“query” and dn is in the list of attributes.
CFLDAP will consistently return each dn (distinguished name) with a comma followed by a space.
CFGRAPH– CFGRAPH and CFGRAPHDATA are deprecated and will be
obsoleted. Use CFCHART, CFCHARTDATA and CFCHARTSERIES instead.
– Renders graphs slightly differently than in CF5
16
CFAPPLICATION and CFREGISTRY
CFAPPLICATION– ClientStorage = “registry” is deprecated and will be obsolete in
later Unix versions of CF MX
CFREGISTRY– Unix
Deprecated and will be obsolete in future versions– Windows
Do not use CFREGISTRY to read CF Server settings from the registry.
Much of the information is no longer stored in the registry or are stored in different areas of the registry.
17
CFDIRECTORY
CFDIRECTORY– In Windows versions of CF MX
CFDIRECTORY will no longer return “.” or “..” Sorting will only be supported on the ReadOnly and Hidden
Attributes.
– Unix, Linux versions When action=list, only the ReadOnly and Hidden attributes will
be reported.
18
CFHTTP
CFHTTP– Response headers now returned in Mixed Case.– Response headers now returned in random order– Status Code 200 now followed by “OK”
CF5 returned “Success”
19
CFSERVLET CFSETTING, CFX Tags
CFSERVLET– Deprecated– Using CFSERVLET to call methods on servlets will be obsolete in
future versions.– You can only call servlets which were created in JRUN version 3.1
CFSETTING– catchExceptionsByPattern Attribute is obsoleted.
CFX Tags– Java CFX tags must have the class files in:
<ColdFusion MX Installation Directory>/wwwroot/WEB-INF/classes.
CF 5 the class files were in <ColdFusion 5 Installation Directory/Java/classes
20
STRUCTKEYLIST(), Forms
STRUCTKEYLIST()– Returns Struct Keys in the order in which they were created,
not in alphabetical order– Returns in the case they were created in.
Form.FieldNames– Returns Form.Fieldnames in the order in which they were
created and not in All Uppercase.
21
Error Handling
CFERROR– type=“monitor” is now obsolete– Must now specify a template handler as a path relative to the
web root directory \error.cfm for web_root\error.cfm– Do not use the full path
CFCATCH– Message variable gets the current values every time an
exception is thrown.– CF MX ignores any cfset assignment to a cfcatch object
member such as cfcatch.message.– CFCATCH can no longer be used to catch function validation
errors.
22
Verity
CFCollection– Action attribute is now optional, its default value is “list” a
new value – A new attribute, “name” is required when action=“list”. This
retrieves a query object with the properties of every Verity collection registered by CF MX or the K2Server
CFINDEX– Key Attribute can be used for the query attribute, type-file or
type=path– Action=“Optimize” is now obsolete.– External attribute is no longer necessary.
23
Subtle Changes
Locale Formatting CFX Libraries Server Variables Form Variables Database Changes
Date Changes Null Values PI Regular Expressions
24
Locale Formatting
LS Formatting works differently from CF 5 to CF MX
– MX uses Java locale standards in its locale specific functions– Previous versions of ColdFusion used either Windows or Unix locale-
specific rules depending on the platform. – By using Java standards, consistency is achieved across all platforms.
However, this means that lsParseDateTime will now produce slightly different results than previous versions.
– Listing of Java DateTime Formats http://www.inter-locale.com/demos/locales.jsp
LSDATEFORMAT()– doesn’t support mmm-dd-yyyy mask except in english locales
25
CFX Libraries
Do not need to be recompiled. It does not matter where you place the libraries as long
as the location is set in the LD_LIBRARY_PATH. – This can be set in the cfstart.sh script ini "neo/bin" – LD_LIBRARY_PATH=/opt/neo/lib:/opt/neo/verity/_solaris/bin:/opt/
mylibraries; export LD_LIBRARY_PATH
26
Server Variables
Certain Server Variables are giving different information between CF 5 and CF MX
– Server.OS.Name for Windows 2000 Gives Windows NT for CF 5 Gives Windows 2000 for CF MX
– Server.OS.AdditionalInformation Gives Service Pack Info for CF5 Gives nothing for CF MX
– Server.OS.BuildNumber Gives Build Number for CF5 Gives nothing for CF MX
27
Forms
Case– CF MX now preserves case in form.fieldnames instead of forcing
them to upper case. – Case is still ignored when evaluating field names. – Use FINDNOCASE() or LISTFINDNOCASE() when searching
form.fieldnames instead of the case sensitive alternatives
28
Database Changes
QueryColumn Object– Acts more like an array
Query Result Appearances– data being returned with space characters appended to end
Query Column Names– CF MX preserves case of column names.
CF5 forced column names to lowercase.
29
Date Changes
Date Pivot for 2 digit years– CF MX uses 20 as the date pivot for calculating the century– CF5 used 29– Certain locales use 28 as the date pivot.
Milliseconds– are no longer stripped off date/time objects.
DATEDIFF()– One less second in a minute when calculating a negative difference in
CF 5
30
Null Values
CF 5– converted all null values to an empty string
CF MX– preserves null values, but converts them to an empty string when
used as simple values
31
PI and Operands
PI– Defined with a slightly different precision then CF5. – Would only cause slightly different results when using trigonometric
functions.
Operands– Exponent results will differ.
For 0^3– CF5 will return an error– CF MX will return a 1
32
Regular Expressions
Now recognizes accented letters Must escape the \ backslash character even if it is
inside a character class []
33
Session Management
J2EE Sessions– by default session management relies on j2ee session management,
which uses jrunsessionid as the session cookie. It is a session cookie, when user close the browser, the cookie goes away, therefore the session is terminated right there.
– If Application has client management turned off and session management is turned on using J2EE sessions you may not have CFID and CFToken variables.
34
Session Management Compatibility Fixes
Delete the lines in your code that use cfcookie to reset the age,
– no longer needed.
Uncheck use J2EE session in the server settings page on CF Admin.
– This will place CF MX in a compatible mode with the way CF5 operated.
This change requires a server restart
35
Variable Changes
Structures– Now preserves the case of a structKey– Different cases DO NOT create different keys
– <cfset x.foo = 1> will now create a structure x with a key “foo” without having to explicitly create x as structNew()
Duplicate URL Parameters– Now come across as a comma delimited list of values– CF 5 only the last value is passed.
36
ThisTag Changes
CF5 – allowed changes to the system values in the ThisTag Scope that
persisted throughout the execution of the tag.
CF MX– Setting thisTag.hasend or thisTag.executionmode throws an
exception.
37
Locking
While MX uses Java Data Structures that are designed to be thread safe, it is still considered best practices to lock
– Code that is correctly locked could (assuming it is otherwise correct) be proved to do what it's intended to do. Code that is not correctly locked may give different results depending on what other requests may be concurrently modifying shared data; no theorem can account for this.
– Code that is correctly locked can be run on a CF MX installation or a CF5 installation.
– The <CFLOCK> tag has low overhead. Must continue to lock for race conditions
– Application.incrementvariable = Application.Incrementvariable + 1
38
Questions and Answers
Where to get more information– Macromedia CF MX Migrating ColdFusion 5 Applications– MX Release Notes:
http://www.macromedia.com/support/coldfusion/releasenotes/mx/releasenotes_mx.html
– MX Doc Updates: http://www.macromedia.com/v1/Handlers/index.cfm?ID=22811&Method=Full
– MX Doc Additions: http://www.macromedia.com/v1/handlers/index.cfm?id=22993&method=full
– MX LiveDocs: http://livedocs.macromedia.com/cfmxdocs/
– Macromedia Designer & Developer Center: http://www.macromedia.com/desdev/mx/coldfusion/
39
Extras
40
Changed Tags and Functions
Obsoleted Deprecated Changed
41
Obsolete Tags and Functions
CFAUTHENTICATE CFIMPERSONATE
AUTHENTICATEDCONTEXT(), AUTHENTICATEDUSER(), ISAUTHENTICATED(), ISAUTHORIZED(), ISPROTECTED()
42
Obsolete Internal Functions
CF_GETDATASOURCEUSERNAME() CF_ISCOLDFUSIONDATASOURCE() CF_SETDATASOURCEPASSWORD() CF_SETDATASOURCEUSERNAME() CFUSION_DBCONNECTIONS_FLUSH() CFUSION_DISABLE_DBCONNECTIONS() CFUSION_GETODBCDSN() CFUSION_GETODBCINI() CFUSION_SETODBCINI() CFUSION_SETTINGS_REFRESH() CFUSION_VERIFYMAIL()
43
Deprecated Tags and Functions
CFGRAPH CFGRAPHDATA CFREGISTRY
– (UNIX systems only)
CFSERVLET CFSERVLETPARAM
GETSETTINGS() GETTEMPLATEPATH() PARAMETEREXISTS()
44
Changed Tags
CFFORM– CFAPPLET– CFFORM
Error Handling– CFCATCH– CFERROR
Verity– CFCOLLECTION– CFINDEX
MiscellaneousCFAPPLICATIONCFCACHECFDIRECTORYCFHTTPCFLOGCFLOOPCFMAILCFPARAMCFREGISTRYCFREPORTCFSETTINGCFSWITCHCFQUERY
45
Changed Tags 2
DatabaseCFINSERT
CFQUERY
CFUPDATE
CFSTOREDPROC
CFLDAP
CPROCPARAM
46
Changed Functions
Arrays– ARRAYAVG()– ARRAYMIN()– ARRAYMAX()– ARRAYSUM()– ISARRAY()
Dates– DATEDIFF()– DATEFORMAT()– LSPARSEDATETIME()– PARSEDATETIME()
Lists– LISTSETAT()– LISTSORT()
47
Change Functions 2
Miscellaneous– DELETECLIENTVARIABLES()– GETBASETAGLIST()– GETLOCALE()– ISCURRENCYFORMAT()– GETTEMPDIRECTORY()– ISWDDX()– LEN()– REREPLACE()– REREPLACENOCASE()– STRUCTKEYLIST()