public class GemSpoolHandler extends java.lang.Object implements java.io.Serializable, MessageResponseInterface, SystemHandlerInterface, StateChangeNotification
Modifier and Type | Class and Description |
---|---|
static class |
GemSpoolHandler.JSONMessage
Save the message to a JSON structure using the existing JSSONEncode/Decode methods.
|
Modifier and Type | Field and Description |
---|---|
static int |
debugLevel |
cvsRev
cvsRev
cvsRev
Constructor and Description |
---|
GemSpoolHandler()
Required default constructor for GSON.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Initialize the spooler variable and send the activated event report.
|
void |
changeStateProposed(int oldState,
int newState)
Implement the state change notification to know when to activate the spooler.
|
void |
deactivate()
Set the spooler variables and send the deactivated event report.
|
boolean |
deSpool()
Send the data.
|
void |
destroy() |
int |
getCurrentBlockTransmitCount() |
SecsMsg |
getCurrentlyDespooling() |
java.util.Map<java.lang.Integer,java.util.BitSet> |
getLocallyRegisteredRequests() |
int |
getMaxSpoolTransmit() |
int |
getSpoolCountTotal() |
java.util.Date |
getSpoolFullTime() |
static GemSpoolHandler |
getSpoolHandler(java.lang.String equipmentName)
Returns the persistent instance of the spool handler or null if one has
not been created for the provided equipment name.
|
static GemSpoolHandler |
getSpoolHandler(java.lang.String equipmentName,
SecsFormat3x5x activateCEID,
SecsFormat3x5x deactivateCEID,
SecsFormat3x5x spoolingTransmitFailure)
Returns the persistent instance of the spool handler.
|
static GemSpoolHandler |
getSpoolHandler(java.lang.String equipmentName,
SecsFormat3x5x activateCEID,
SecsFormat3x5x deactivateCEID,
SecsFormat3x5x spoolingTransmitFailure,
boolean createNew)
Returns the persistent instance of the spool handler.
|
int |
getSpoolHead() |
java.util.Date |
getSpoolStartTime() |
int |
getSpoolTail() |
static java.lang.String |
init(java.lang.String name,
boolean delete)
Initialize the disk.
|
boolean |
isActive()
Returns true if spooling is active
|
boolean |
isEnabled()
Returns true if spooling is enabled.
|
boolean |
isOverWriteSpool() |
boolean |
isSpoolFull() |
boolean |
isSpoolingEnabled() |
static GemSpoolHandler |
loadFromDisk(java.lang.String equipmentName,
SecsFormat3x5x activateCEID,
SecsFormat3x5x deactivateCEID,
SecsFormat3x5x spoolingTransmitFailure)
Returns the persistent instance of the spool handler.
|
static GemSpoolHandler |
loadFromXML(java.lang.String equipmentName,
SecsFormat3x5x activateCEID,
SecsFormat3x5x deactivateCEID,
SecsFormat3x5x spoolingTransmitFailure)
This will load the last saved persistence file.
|
void |
purge()
Purge the spool queue.
|
void |
register(int stream)
Spool all messages in the stream.
|
void |
register(int stream,
int function)
Register to spool the particular stream/function.
|
boolean |
responseReceived(int status,
SecsMsg primary,
SecsMsg response)
The MsgResponseInterface.
|
boolean |
S2F43(SecsMsg msg)
This method receives an S2F43 and sends an S2F44.
|
boolean |
S6F23(SecsMsg msg)
Process the S6F23 message.
|
void |
setCurrentBlockTransmitCount(int currentBlockTransmitCount) |
void |
setCurrentlyDespooling(SecsMsg currentlyDespooling) |
void |
setEnabled(boolean flag)
Enable spooling.
|
void |
setEnabled(ValueChangedEvent event)
This is the target of the called back for the EnableSpooling DVNAME.
|
void |
setLocallyRegisteredRequests(java.util.Map<java.lang.Integer,java.util.BitSet> locallyRegisteredRequests) |
void |
setMaxSpoolTransmit(int maxSpoolTransmit) |
void |
setOverWriteSpool(boolean overWriteSpool) |
void |
setSpoolCountTotal(int spoolCountTotal) |
void |
setSpoolFull(boolean spoolFull) |
void |
setSpoolFullTime(java.util.Date spoolFullTime) |
void |
setSpoolHead(int spoolHead) |
void |
setSpoolingEnabled(boolean spoolingEnabled) |
void |
setSpoolStartTime(java.util.Date spoolStartTime) |
void |
setSpoolTail(int spoolTail) |
void |
showSpool(java.lang.String header,
int debug)
Show the spool for the only spooler.
|
boolean |
spoolMessage(SecsMsg msg)
This will accept spool requests and determine how to handle them.
|
void |
store()
Store the object to it's persistent form.
|
void |
storeToXML()
Save the handler object.
|
boolean |
verifyMessage(SecsMsg msg)
This checks to see if we need to spool the message.
|
public void activate()
public void changeStateProposed(int oldState, int newState) throws DeclinedStateChangeException
changeStateProposed
in interface StateChangeNotification
DeclinedStateChangeException
public void deactivate()
public boolean deSpool()
public void destroy()
public int getCurrentBlockTransmitCount()
public SecsMsg getCurrentlyDespooling()
public java.util.Map<java.lang.Integer,java.util.BitSet> getLocallyRegisteredRequests()
public int getMaxSpoolTransmit()
public int getSpoolCountTotal()
public java.util.Date getSpoolFullTime()
public static GemSpoolHandler getSpoolHandler(java.lang.String equipmentName)
public static GemSpoolHandler getSpoolHandler(java.lang.String equipmentName, SecsFormat3x5x activateCEID, SecsFormat3x5x deactivateCEID, SecsFormat3x5x spoolingTransmitFailure) throws java.io.IOException
equipmentName
- TODOjava.io.IOException
public static GemSpoolHandler getSpoolHandler(java.lang.String equipmentName, SecsFormat3x5x activateCEID, SecsFormat3x5x deactivateCEID, SecsFormat3x5x spoolingTransmitFailure, boolean createNew) throws java.io.IOException
createNew
- forces the creation of a new handler even if a persistent
copy exists.java.io.IOException
public int getSpoolHead()
public java.util.Date getSpoolStartTime()
public int getSpoolTail()
public static java.lang.String init(java.lang.String name, boolean delete) throws java.io.IOException
delete
- cleans the directory if true.java.io.IOException
- if there is some error creating a directory with the
name "spool".public boolean isActive()
public boolean isEnabled()
public boolean isOverWriteSpool()
public boolean isSpoolFull()
public boolean isSpoolingEnabled()
public static GemSpoolHandler loadFromDisk(java.lang.String equipmentName, SecsFormat3x5x activateCEID, SecsFormat3x5x deactivateCEID, SecsFormat3x5x spoolingTransmitFailure)
equipmentName
- the equipment name. This is not part of the persistance but must be valid so is provided here.activateCEID
- the activate CEID. This is not part of the persistance but must be valid so is provided here.deactivateCEID
- the deactivate CEID. This is not part of the persistance but must be valid so is provided here.spoolingTransmitFailure
- the CEID triggered on a spool transmit failure. This is not part of the persistance but must be valid so is provided here.public static GemSpoolHandler loadFromXML(java.lang.String equipmentName, SecsFormat3x5x activateCEID, SecsFormat3x5x deactivateCEID, SecsFormat3x5x spoolingTransmitFailure)
equipmentName
- the equipment name. This is not part of the persistance but must be valid so is provided here.activateCEID
- the activate CEID. This is not part of the persistance but must be valid so is provided here.deactivateCEID
- the deactivate CEID. This is not part of the persistance but must be valid so is provided here.spoolingTransmitFailure
- the CEID triggered on a spool transmit failure. This is not part of the persistance but must be valid so is provided here.public void purge() throws java.io.IOException
java.io.IOException
public void register(int stream)
public void register(int stream, int function)
public boolean responseReceived(int status, SecsMsg primary, SecsMsg response)
responseReceived
in interface MessageResponseInterface
public boolean S2F43(SecsMsg msg)
public boolean S6F23(SecsMsg msg)
public void setCurrentBlockTransmitCount(int currentBlockTransmitCount)
public void setCurrentlyDespooling(SecsMsg currentlyDespooling)
public void setEnabled(boolean flag)
flag
- true to enable spooling false to disable spooling.public void setEnabled(ValueChangedEvent event)
public void setLocallyRegisteredRequests(java.util.Map<java.lang.Integer,java.util.BitSet> locallyRegisteredRequests)
public void setMaxSpoolTransmit(int maxSpoolTransmit)
public void setOverWriteSpool(boolean overWriteSpool)
public void setSpoolCountTotal(int spoolCountTotal)
public void setSpoolFull(boolean spoolFull)
public void setSpoolFullTime(java.util.Date spoolFullTime)
public void setSpoolHead(int spoolHead)
public void setSpoolingEnabled(boolean spoolingEnabled)
public void setSpoolStartTime(java.util.Date spoolStartTime)
public void setSpoolTail(int spoolTail)
public void showSpool(java.lang.String header, int debug)
public boolean spoolMessage(SecsMsg msg)
MessageSpooledException
- if the message is spooledpublic void store()
public void storeToXML()
public boolean verifyMessage(SecsMsg msg) throws SecsException
verifyMessage
in interface SystemHandlerInterface
SecsException
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.