Class GenericServiceDetectorFactory<T extends ServiceDetector>
- java.lang.Object
-
- org.opennms.netmgt.provision.support.GenericServiceDetectorFactory<T>
-
- All Implemented Interfaces:
ServiceDetectorFactory<T>
public class GenericServiceDetectorFactory<T extends ServiceDetector> extends Object implements ServiceDetectorFactory<T>
-
-
Constructor Summary
Constructors Constructor Description GenericServiceDetectorFactory(Class<T> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterDetect(DetectRequest request, DetectResults results, Integer nodeId)Optional implementation.DetectRequestbuildRequest(String location, InetAddress address, Integer port, Map<String,String> attributes)Builds the request that will be used to invoke the detector.TcreateDetector(Map<String,String> properties)Instantiates a new detector and set bean properties.Class<T>getDetectorClass()Used by the detector registry to track and index the detector types.voidsetBeanProperties(ServiceDetector detector, Map<String,String> properties)Set detector attributes as bean properties.
-
-
-
Method Detail
-
createDetector
public T createDetector(Map<String,String> properties)
Description copied from interface:ServiceDetectorFactoryInstantiates a new detector and set bean properties. One of the ways to set bean properties is using Spring @BeanWrapper
Detectors are treated as protoypes and should only be used for a single call to "isServiceDetected".BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(serviceDetector); wrapper.setPropertyValues(properties);- Specified by:
createDetectorin interfaceServiceDetectorFactory<T extends ServiceDetector>- Parameters:
properties- are used to set properties on detector bean.
-
getDetectorClass
public Class<T> getDetectorClass()
Description copied from interface:ServiceDetectorFactoryUsed by the detector registry to track and index the detector types.- Specified by:
getDetectorClassin interfaceServiceDetectorFactory<T extends ServiceDetector>
-
buildRequest
public DetectRequest buildRequest(String location, InetAddress address, Integer port, Map<String,String> attributes)
Description copied from interface:ServiceDetectorFactoryBuilds the request that will be used to invoke the detector.- Specified by:
buildRequestin interfaceServiceDetectorFactory<T extends ServiceDetector>- Parameters:
location- name of the location in which the detector will be invokedaddress- address of the agent against which the detector will be invokedport- port of the agent against which the detector will be invoked- Returns:
- a new
DetectRequest
-
afterDetect
public void afterDetect(DetectRequest request, DetectResults results, Integer nodeId)
Description copied from interface:ServiceDetectorFactoryOptional implementation.- Specified by:
afterDetectin interfaceServiceDetectorFactory<T extends ServiceDetector>- Parameters:
request-DetectRequestresults-DetectResultsnodeId-OnmsNode.getNodeId()
-
setBeanProperties
public void setBeanProperties(ServiceDetector detector, Map<String,String> properties)
Set detector attributes as bean properties.- Parameters:
detector-ServiceDetectorproperties- detector attributes from foreign source configuration
-
-