/** * Add a ServiceMonitorFilter to this MonitorFilter * * @param serviceMonitorFilter Service Specific Filter * @exception MonitorFilterException * @return ServiceMonitorFilter Modified Filter to the capabilities of the service */ public ServiceMonitorFilter addServiceMonitorFilter(ServiceMonitorFilter serviceMonitorFilter) throws MonitorFilterException { ModuleClassID moduleClassID = serviceMonitorFilter.getModuleClassID(); if (serviceMonitorFilters.get(moduleClassID) != null) throw new MonitorFilterException( "Attempt to add a second Monitor Filter for: " + moduleClassID); serviceMonitorFilters.put(moduleClassID, serviceMonitorFilter); return serviceMonitorFilter; }
/** {@inheritDoc} */ public void serializeTo(Element element) throws DocumentSerializationException { DocumentSerializableUtilities.addString(element, "description", description); for (Iterator i = serviceMonitorFilters.values().iterator(); i.hasNext(); ) { ServiceMonitorFilter serviceMonitorFilter = (ServiceMonitorFilter) i.next(); Element serviceElement = DocumentSerializableUtilities.createChildElement(element, "service"); DocumentSerializableUtilities.addString( serviceElement, "moduleClassID", serviceMonitorFilter.getModuleClassID().toString()); DocumentSerializableUtilities.addDocumentSerializable( serviceElement, "serviceFilter", serviceMonitorFilter); } }