public abstract class GenericGateway extends java.lang.Object implements Gateway
You can derive from this class, and it will take care of the basic mechanics of implementing a gateway. Your class must implement at least the following gateway operations: startGateway(), stopGateway(), and outgoingMessage().
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String[] |
listeners |
protected int |
status |
| Constructor and Description |
|---|
GenericGateway(java.lang.String gatewayID)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getGatewayID()
Return the ID that uniquely defines the gateway instance.
|
protected GatewayServices |
getGatewayServices()
Provide access to the ColdFusion GatewayServices object.
|
GatewayHelper |
getHelper()
Override this function if you want to provide a helper class for your gateway.
|
protected java.lang.String[] |
getListeners()
Return the listeners for this gateway.
|
int |
getStatus()
Return the status of the gateway.
|
void |
restart()
Restart this gateway.
|
protected boolean |
sendMessage(CFEvent msg)
Send an event to the ColdFusion event gateway service.
|
void |
setCFCListeners(java.lang.String[] listeners)
Set the CFClisteners list.
|
void |
setGatewayID(java.lang.String id)
Set the ID that uniquely defines the gateway instance.
|
void |
start()
Start the gateway.
|
protected abstract void |
startGateway()
Gateway startup method.
|
void |
stop()
Stop the gateway.
|
protected abstract void |
stopGateway()
Gateway shutdown method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitoutgoingMessagepublic GenericGateway(java.lang.String gatewayID)
If your gateway defines its own constructor (to process a configuration
file, for example), include a call to this constructor in your
gateway constructor:
super(gatewayID).
gatewayID - The gateway ID string, provided by the ColdFusion MX
Administrator.public java.lang.String getGatewayID()
This function does not typically need to be overridden.
getGatewayID in interface Gatewaypublic void setGatewayID(java.lang.String id)
This function does not typically need to be overridden.
setGatewayID in interface Gatewayid - Gateway ID stringpublic void setCFCListeners(java.lang.String[] listeners)
This function does not typically need to be overridden.
setCFCListeners in interface Gatewaylisteners - A list of file system paths to ColdFusion components
that listen for event messages from this gateway.public GatewayHelper getHelper()
Return a CFC helper class (if any) so that a CFC can invoke gateway-specific utility functions that might be useful to the CFML developer. The helper class must implement the GatewayHelper marker interface.
Called by the CFML function getGatewayHelper(gatewayID).
getHelper in interface Gatewaypublic int getStatus()
This function might need to be overridden if the resource can change status asynchronously from the gateway.
public void start()
This implementation handles the mantenance of the gateway status only.
It calls which is
where you should implement your gateway-specific starting code.
startGateway
Any exceptions thrown from startGateway() will be logged in the
eventgateway.log file.
start in interface Gatewaystop,
startGatewaypublic void stop()
This implementation handles the maintenance of the gateway status.
It calls , which is where
you should implement your gateway-specific code.
stopGateway
The method logs any exceptions thrown by stopGateway()
in the eventgateway.log file.
stop in interface Gatewaystart,
stopGatewaypublic void restart()
Implemented as a call to stop() and then start().
You might override this to optimize processing, depending on the service the gateway communicates with.
restart in interface Gatewaystart,
stop,
Gateway in Livedocsprotected abstract void startGateway()
throws java.lang.Exception
You must implement this method with the startup code for your gateway.
java.lang.Exceptionstartprotected abstract void stopGateway()
throws java.lang.Exception
You must implement this method with the shutdown code for your gateway.
java.lang.Exceptionstopprotected boolean sendMessage(CFEvent msg)
msg - The event structure to pass to ColdFusion.protected GatewayServices getGatewayServices()
protected java.lang.String[] getListeners()