public class GenericServiceDetectorFactory<T extends ServiceDetector> extends Object implements ServiceDetectorFactory<T>
Constructor and Description |
---|
GenericServiceDetectorFactory(Class<T> clazz) |
Modifier and Type | Method and Description |
---|---|
void |
afterDetect(DetectRequest request,
DetectResults results,
Integer nodeId)
Optional implementation.
|
DetectRequest |
buildRequest(String location,
InetAddress address,
Integer port,
Map<String,String> attributes)
Builds the request that will be used to invoke the detector.
|
T |
createDetector(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.
|
void |
setBeanProperties(ServiceDetector detector,
Map<String,String> properties)
Set detector attributes as bean properties.
|
public T createDetector(Map<String,String> properties)
ServiceDetectorFactory
BeanWrapper
BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(serviceDetector);
wrapper.setPropertyValues(properties);
Detectors are treated as protoypes and should only be used for a
single call to "isServiceDetected".createDetector
in interface ServiceDetectorFactory<T extends ServiceDetector>
properties
- are used to set properties on detector bean.public Class<T> getDetectorClass()
ServiceDetectorFactory
getDetectorClass
in interface ServiceDetectorFactory<T extends ServiceDetector>
public DetectRequest buildRequest(String location, InetAddress address, Integer port, Map<String,String> attributes)
ServiceDetectorFactory
buildRequest
in interface ServiceDetectorFactory<T extends ServiceDetector>
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 invokedDetectRequest
public void afterDetect(DetectRequest request, DetectResults results, Integer nodeId)
ServiceDetectorFactory
afterDetect
in interface ServiceDetectorFactory<T extends ServiceDetector>
request
- DetectRequest
results
- DetectResults
nodeId
- OnmsNode.getNodeId()
public void setBeanProperties(ServiceDetector detector, Map<String,String> properties)
detector
- ServiceDetector
properties
- detector attributes from foreign source configurationCopyright © 2020. All rights reserved.