Adobe COLDFUSION 9 Manual page 1330

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
The GenericGateway class
ColdFusion includes a coldfusion.eventgateway.GenericGateway abstract class that implements many of the methods
of ColdFusion Gateway interface and provides some convenience methods for use in your gateway class.
You can derive your gateway class from this class, which handles the basic mechanics of implementing a gateway, such
as the
and
getGatewayID
SetCFCListeners
methods:
(not
startGateway
start
(not
)
stopGateway
stop
outgoingMessage
Your derived gateway class also must implement the following:
• If you support a configuration file, a constructor that takes a configuration file, and configuration loading routines.
• If you use a gatewayHelper class, the
• If the event source status can change asynchronously from the gateway, the
The example JMS gateway is derived from the generic gateway class. The gateway class JavaDocs in the gateway\docs
directory provide documentation for this class. (The CFML Reference does not document this class.)
The EmptyGateway class
The gateway\src\examples\EmptyGateway.java file contains an event gateway template that you can use as a skeleton
for creating your own event gateway. (The gateway directory is in the cf_root directory in the server configuration and
the cf_root\WEB-INF-cfusion directory on J2EE configurations.) This file contains minimal versions of all methods in
the coldfusion.eventgateway.Gateway interface. It defines a skeleton listener thread and initializes commonly used
Gateway properties. The EmptyGateway source code includes comments that describe the additional information that
you must provide to complete an event gateway class.
Building an event gateway
To build a Gateway class, you can start with the EmptyGateway.java file as a template. (In the server configuration, this
file is located in the cf_root/gateway/src/examples/ directory; in the J2EE configuration, the file is in the cf_root/WEB-
INF/cfusion/gateway/src/examples/ directory.) This file defines a nonfunctional event gateway, but has the basic
skeleton code for all Gateway class methods.
Wherever possible, this document uses code based on the sample Socket event gateway to show how to implement
event gateway features. (In the server configuration, this file is
cf_root/gateway/src/examples/socket/SocketGateway.java; in the J2EE configuration, the file is cf_root/WEB-
INF/cfusion/gateway/src/examples/socket/SocketGateway.java.)
Class constructor
An event gateway can implement any of the following constructors:
MyGateway(String gatewayID, String configurationFile)
MyGateway(String gatewayID)
MyGateway()
When ColdFusion starts, it calls the constructor for each event gateway instance that you configure in ColdFusion.
(ColdFusion also calls the gateway
to use the two-parameter constructor.
methods. Your derived class must implement at least the following
)
method.
getHelper
method after the event gateway is instantiated.). ColdFusion first attempts
Start
Last updated 8/5/2010
method.
getStatus
1325

Advertisement

Table of Contents
loading

Table of Contents