Doug Hughes, Alagad Inc. Drinkin’ Cold Coffee -or- How to use Java Objects from ColdFusion.

Slides:



Advertisements
Similar presentations
Question examples. Session 1 Objectives Why certify? Positioning of the non-technical version What is Java? Key advantages of Java Java Applications vs.
Advertisements

Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
Designing Reusable Frameworks for Test Automation
Web Services in ColdFusion 7 JaxFusion November, 2006.
Rick Root.  It just doesn’t seem right to have a slide with bullet points that prompt me to talk about myself.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
Perl Practical Extraction and Report Language Senior Projects II Jeff Wilson.
Modules and Objects Introduction to Computing Science and Programming I.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Week 5 IBS 520. ColdFusion Variables CF uses variables to store data in memory. There are many different types of variables; each has its own.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 14 Applets, Images,
ASP.NET Programming with C# and SQL Server First Edition
Week 2 IBS 685. Project Site Upload assignments to your project site that you will create for IBS 685.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L05 (Chapter 16) Applets.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
MIT AITI 2003 Lecture 7 Class and Object - Part I.
Object-based Programming in JavaScript By Katie Horn.
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
Building + Consuming WebServices CF Style Kevin Penny MMCP (4.5/5/MX6)
Oğuz Demirkapı Sr. Application Developer, TeraTech 1.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
Flash Remoting Chafic Kazoun Senior Flash Developer - B-Line Express Work: Play:
Exploring Real-time apps with ColdFusion and Blaze DS / Live Cycle Data Services ES Dan Blackman
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
P Object type and wrapper classes p Object methods p Generic classes p Interfaces and iterators Generic Programming Data Structures and Other Objects Using.
The Evils of Copy and Paste Presented by Daniel Daugherty
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Troy Pullis - 12/3/03 MAX Conference 2003 Twin Cities CFUG.
ColdFusion 9 and Flex 4: Application Development Ryan Stewart Platform Evangelist, Adobe Systems
HTML_Generators WB_HTML_Generators. What method are you going to choose to build your web page? MethodWrite Convert Html IssuesHTML HTML Editors Tool.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
ColdFusion MX Rob Filardo and Lindsay Matteo A Brief History ColdFusion 1.0 was created in 1995 by Adam Berrey in order to help HTML programmers create.
Introduction to ColdFusion Yu Fu 2003 MEC Candidate.
Flex Data Communications Nick Kwiatkowski, Michigan State University.
1 ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1 Building Portlets with ColdFusion Pete Freitag Foundeo, Inc.
GEMVC. The Setup Folders Views Value Objects (VOs) Custom Events Service CFCs Controller Model Application Main MXML.
Parsing java with XML. XML (Extensible Markup language). What is XML? a comprehensive, but difficult superset of HTML to allow you to define and manipulate.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Reading External Files By: Greg Patterson APCS 2010.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
CF101: Welcome to ColdFusion Simon Horwith CTO, Etrilogy Ltd.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Introduction to JavaScript CS101 Introduction to Computing.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
©John Samuel 2008 Introduction to PHP. ©John Samuel 2008 Objectives At the end of this class the student will be able to; Create and run a simple php.
Working With Objects Tonga Institute of Higher Education.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
CFUNITED – The premier ColdFusion conference ColdFusion Components Ajay Sathuluri Based on presentation.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
ColdFusion MX 7 “Blackstone” Macromedia, Inc. macromedia 2005 Living With Today’s Internet Chronic problems continue to exist for users and developers.
1 A Very Brief Introduction to Relational Databases.
Plug-In Architecture Pattern. Problem The functionality of a system needs to be extended after the software is shipped The set of possible post-shipment.
Using Structures With CFCs By Selene Bainum. June 27 th - 30 th 2007www.cfunited.com Why Am I here? Familiar with structures Familiar with ColdFusion.
BlueDragon Editions and Advantages Lori Pacheco New Atlanta.
CF Eclipse Nick Kwiatkowski Michigan State University, Physical Plant 8/8/2006.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
CF101: Welcome to ColdFusion
Knowledge Byte In this section, you will learn about:
Zip Archives and ColdFusion
Deepak Shenoy Agni Software
F II 1. Background Objectives
Java Programming Language
String Objects & its Methods
Presentation transcript:

Doug Hughes, Alagad Inc. Drinkin’ Cold Coffee -or- How to use Java Objects from ColdFusion.

Doug Hughes, Alagad Inc. What are you going to learn? Why you might want to use Java objects from ColdFusion. Why you might want to use Java objects from ColdFusion. How to instantiate Java objects from ColdFusion MX. How to instantiate Java objects from ColdFusion MX. How to call the constructors of Java objects. How to call the constructors of Java objects. How to call methods on Java objects. How to call methods on Java objects. The advantages of using Java (as opposed to CFX tags, etc) The advantages of using Java (as opposed to CFX tags, etc) Potential problems and their solutions. Potential problems and their solutions.

Doug Hughes, Alagad Inc. What can you do with Java? Use strong encryption. Use strong encryption. Manipulate Images. Manipulate Images. Edit audio clips. Edit audio clips. Zip and Unzip files. Zip and Unzip files. Create network socket connections. Create network socket connections. Low level programming. Low level programming. Almost anything you can do with the Java language. Almost anything you can do with the Java language.

Doug Hughes, Alagad Inc. Why do you care about Java? ColdFusion is written in Java ColdFusion is written in Java Macromedia has been pushing CF deployment on J2EE servers Macromedia has been pushing CF deployment on J2EE servers In short, an easy way to write J2EE applications. In short, an easy way to write J2EE applications. In short, ColdFusion is a friendly version of Java. In short, ColdFusion is a friendly version of Java. ColdFusion provides an easy way to use Java without requiring extensive knowledge of Java. ColdFusion provides an easy way to use Java without requiring extensive knowledge of Java. Blackstone may deploy ColdFusion applications as WAR files on J2EE. Blackstone may deploy ColdFusion applications as WAR files on J2EE.

Doug Hughes, Alagad Inc. Where to find the Java Docs dex.html dex.html dex.html dex.html The hardest part of using Java is learning how to read the documentation. The hardest part of using Java is learning how to read the documentation.

Doug Hughes, Alagad Inc. How to invoke Java objects CreateObject() CreateObject() <cfobjecttype="Java"action="Create"class="java.util.zip.ZipFile" name="myZip" />

Doug Hughes, Alagad Inc. Typing in Java vs. ColdFusion Java is a strongly typed language Java is a strongly typed language This means the language always knows what type a variable is This means the language always knows what type a variable is ColdFusion is a typeless language. ColdFusion is a typeless language. This means any variable can be a string, integer, query, whatever. This means any variable can be a string, integer, query, whatever. Because ColdFusion is typeless, CF has to guess what type of data you are passing into Java object methods. Because ColdFusion is typeless, CF has to guess what type of data you are passing into Java object methods. If ColdFusion passes an incorrect type into a Java method you will get errors. If ColdFusion passes an incorrect type into a Java method you will get errors.

Doug Hughes, Alagad Inc. An example typing error

Doug Hughes, Alagad Inc. Use JavaCast() to type CF variables You can use JavaCast() to type data being passed into Java methods. You can use JavaCast() to type data being passed into Java methods. Casts data from ColdFusion to Java. Casts data from ColdFusion to Java. Intended for calling overloaded Java Methods. Intended for calling overloaded Java Methods. Syntax: Syntax: JavaCast(type, variable)

Doug Hughes, Alagad Inc. How to init Java objects Most Java objects require that you call a constructor to configure objects for use. Most Java objects require that you call a constructor to configure objects for use. Use “.init()” to call constructors on Java objects. Use “.init()” to call constructors on Java objects.

Doug Hughes, Alagad Inc. Calling Object Constructors To instantiate a Java zipFile object you have to call one of three constructors To instantiate a Java zipFile object you have to call one of three constructors File.html File.html File.html File.html Example: Example:

Doug Hughes, Alagad Inc. What happens when you don’t init an object?

Doug Hughes, Alagad Inc. What happens when you don’t init an object?

Doug Hughes, Alagad Inc. What happens when there are other problems initing your object?

Doug Hughes, Alagad Inc. Calling Java Object methods We can call methods of the myZip object to perform various actions. We can call methods of the myZip object to perform various actions. util/zip/ZipFile.html#getInputStream(java.util. zip.ZipEntry) util/zip/ZipFile.html#getInputStream(java.util. zip.ZipEntry) util/zip/ZipFile.html#getInputStream(java.util. zip.ZipEntry) util/zip/ZipFile.html#getInputStream(java.util. zip.ZipEntry) For instance: For instance: The Zip File "#myZip.getName()#" contains #myZip.size()# files.

Doug Hughes, Alagad Inc. Another (more complex) example Get a list of files in the myZip object Get a list of files in the myZip object <cfoutput>#myZipEntry.getName()# (#myZipEntry.getSize()# Bytes) (#myZipEntry.getSize()# Bytes) </cfoutput></cfloop>

Doug Hughes, Alagad Inc. Results so far <cfoutput> The Zip File "#myZip.getName()#" contains #myZip.size()# files. The Zip File "#myZip.getName()#" contains #myZip.size()# files. </cfoutput> <cfoutput> #myZipEntry.getName()# (#myZipEntry.getSize()# Bytes) #myZipEntry.getName()# (#myZipEntry.getSize()# Bytes) </cfoutput></cfloop>

Doug Hughes, Alagad Inc. Using to get more information on Java Objects You can use on any ColdFusion variable. You can use on any ColdFusion variable. If the variable a Java object you get: If the variable a Java object you get: The object type name The object type name The object’s methods The object’s methods The object’s properties The object’s properties Example: Example:

Doug Hughes, Alagad Inc. Results from the dump Can be helpful in figuring out what an object is and what methods it provides. Can be helpful in figuring out what an object is and what methods it provides. Helps support the Java documentation. Helps support the Java documentation. Another dump example: romCF/cfdump.cfm Another dump example: romCF/cfdump.cfm romCF/cfdump.cfm romCF/cfdump.cfm

Doug Hughes, Alagad Inc. Wrapping Java in CFCs You can use CFCs to wrap Java objects. You can use CFCs to wrap Java objects. Provides easier access to complex Java objects. Provides easier access to complex Java objects. Extremely reusable and cross platform. Extremely reusable and cross platform.

Doug Hughes, Alagad Inc. Let’s look at a simple Zip CFC Create Zip files Create Zip files Add files to Zip files Add files to Zip files Return a query of all the files in a Zip file Return a query of all the files in a Zip file Name Name If the entry is a directory If the entry is a directory Uncompressed size Uncompressed size Compressed size Compressed size Extract files from the zip Extract files from the zip

Doug Hughes, Alagad Inc. Alagad Image Component A good example of wrapping Java in CFCs. A good example of wrapping Java in CFCs. 100% native ColdFusion Component (CFC) used to create and manipulate image files by invoking and calling methods on Java objects. 100% native ColdFusion Component (CFC) used to create and manipulate image files by invoking and calling methods on Java objects. Over 60 methods for working with Images. Over 60 methods for working with Images. Platform independent. Platform independent. Makes lots of use of Java from within ColdFusion. Makes lots of use of Java from within ColdFusion

Doug Hughes, Alagad Inc. Advantages of using Java in ColdFusion Cross Platform Cross Platform Write code on any platform and deploy to any platform. Write code on any platform and deploy to any platform. The power of Java at your fingertips. The power of Java at your fingertips. It’s Free! It’s Free! It’s not CFX! It’s not CFX!

Doug Hughes, Alagad Inc. What did you learn? Why you might want to use Java objects from ColdFusion. Why you might want to use Java objects from ColdFusion. How to instantiate Java objects from ColdFusion MX. How to instantiate Java objects from ColdFusion MX. How to call the constructors of Java objects. How to call the constructors of Java objects. How to call methods on Java objects. How to call methods on Java objects. The advantages of using Java (as opposed to CFX tags, etc) The advantages of using Java (as opposed to CFX tags, etc) Potential problems and their solutions. Potential problems and their solutions. That you really need to by the Alagad Image Component. That you really need to by the Alagad Image Component.