Web Safety
Web Safety updates will be sent to tools and adapters specified by the BroadcastSafetyListeners in the SwmanParameters.properties file.
The data being broadcast out includes all the fields found in the database view SWMAN_SAFETY_DOCS_LIST. Note that this data is also used to update each NMS user's Safety Document List. This database view should be kept to a minimal size so as not to flood the network with unnecessary data.
 
Java MDB Implementation
When defining your Java MDB, you'll need to implement interface class OMSListener. Here's a Web Switching example of the methods that will need to be implemented. The same would be required for a Web Safety adapter. This example simply prints the data as it is received. It will be up to you to determine how you want to process that data.
@Override
public String getName() {
return "MyWebSwitchingAdapter";
}
 
@Override
public void onSelection(CMMSelection cmms) {
// Do nothing. Not used in this example, but still required.
}
 
@Override
public void onHLMessage(HLMessage message) {
if ("UPDATE_ENTRIES".equals(message.getMessage())) {
if (Logger.HLMESSAGE.isDebugEnabled())
Logger.HLMESSAGE.debug("Sheet Adapter - Message: " + message.toString());
Object hlmObject = ((HLProcessedMessage)message).getProcessedMessage();
if (hlmObject instanceof EJBResultSet){
try {
EJBResultSet resultSet = (EJBResultSet)hlmObject;
for (Object[] selection_set : resultSet.selection_set) {
String sheetData = "Sheet - ";
for (int j = 0; j < resultSet.column_names.length; j++) {
sheetData += resultSet.column_names[j] + ": ";
sheetData += selection_set[j] + ", ";
}
System.out.println(sheetData);
}
} catch (Exception ex) {
Logger.HLMESSAGE.error("Failed to process sheet updates: ", ex);
}
}
}
}
 
 
The key point is that the adapter should listen for UPDATE_ENTRIES messages. This is true for the Web Switching and the Web Safety messages. If you plan to process both Web Safety and Web Switching updates, you will need a separate Java MDB for each.
The getName() method that you implemented above has to return a name that matches up with the adapter name you specified in your BroadcastSwitchingListeners or BroadcastSafetyListeners configuration parameter. The same adapter name should not be specified in both parameters.
 
 
Within your Java MDB class, you will also need to add the following variable and method call in your PostConstruct method.
private final BaseMessageHelper messageHelper = new BaseMessageHelper();
 
@PostConstruct
public void init()
{
messageHelper.addOMSListener(this, getName());
}