Package lumis.portal.monitor
Class MonitorHelper
- java.lang.Object
-
- lumis.portal.monitor.MonitorHelper
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class MonitorHelper extends java.lang.Object implements java.lang.AutoCloseable
Monitor helper class responsible for providing an easy way to add and remove values in the currentIMonitorContext
.
The basic usage for this class is:
try(MonitorHelper monitorHelper = new MonitorHelper()) { monitorHelper.addWebResourceValues(myWebResource); // for example // do things with web resource values in monitor context } // at this point, web resource values are not in context any more
If a more granular control is required, a block like this can be made:
try(MonitorHelper monitorHelper = new MonitorHelper()) { monitorHelper.addWebResourceValues(myWebResource); // for example // do things with web resource values in monitor context IMonitorValuesProvider myServiceInstanceValueProvider = monitorHelper.addServiceInstanceValues(String serviceInstanceId); // for example // do things with service instance in monitor context monitorHelper.removeAddedValues(myServiceInstanceValueProvider); // no needed to be performed in try-finally because the monitor helper will auto remove all values in #close() // at this point service instance values are not in monitor context any more } // at this point, web resource values are not in context any more
Each instance of this class must be used only in the thread it was created.- Since:
- 9.0.0
- Version:
- $Revision: 26156 $ $Date: 2024-01-13 10:26:46 -0300 (Sat, 13 Jan 2024) $
-
-
Constructor Summary
Constructors Constructor Description MonitorHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMonitorValuesProvider
addMonitorUserValuesByTrackId(java.lang.String trackId)
Adds a value provider related toMonitorUser
with the given track identifier.IMonitorValuesProvider
addMonitorUserValuesByUserId(java.lang.String userId)
Adds a value provider related toMonitorUser
with the given user identifier.IMonitorValuesProvider
addServerValues()
Add a value provider related to the server.IMonitorValuesProvider
addServiceInstanceValues(java.lang.String serviceInstanceId)
Add a value provider related to the given service instance.IMonitorValuesProvider
addServiceInstanceValues(ServiceInstanceConfig serviceInstanceConfig)
Add a value provider related to the given service instance.IMonitorValuesProvider
addServiceInterfaceInstanceValues(ServiceInterfaceInstanceConfig serviceInterfaceInstanceConfig)
Add a value provider related to the given interface instance.IMonitorValuesProvider
addServiceValues(java.lang.String serviceId)
Add a value provider related to the given service.IMonitorValuesProvider
addSessionValues(SessionConfig sessionConfig, HttpSession httpSession)
Adds a value provider related toSessionConfig
andHttpSession
.void
addValues(java.lang.String fieldId, java.io.Serializable... values)
Adds the given value as a value provider.void
addValues(IMonitorValuesProvider valuesProvider)
Adds the given provider in the context.IMonitorValuesProvider
addWebResourceValues(WebResource webResource)
Add a value provider related to the given web resource.void
close()
void
removeAddedValues(IMonitorValuesProvider provider)
Removes the given provider from context.
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
removeAddedValues
public void removeAddedValues(IMonitorValuesProvider provider)
Removes the given provider from context.- Parameters:
provider
- the provider.- Since:
- 9.0.0
-
addValues
public void addValues(IMonitorValuesProvider valuesProvider)
Adds the given provider in the context.- Parameters:
valuesProvider
- the provider.- Since:
- 9.0.0
-
addValues
public void addValues(java.lang.String fieldId, java.io.Serializable... values)
Adds the given value as a value provider.- Parameters:
fieldId
- the field idvalues
- the values- Since:
- 16.1.0
-
addWebResourceValues
public IMonitorValuesProvider addWebResourceValues(WebResource webResource)
Add a value provider related to the given web resource.- Parameters:
webResource
- the web resource.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInstanceValues
public IMonitorValuesProvider addServiceInstanceValues(ServiceInstanceConfig serviceInstanceConfig)
Add a value provider related to the given service instance.- Parameters:
serviceInstanceConfig
- the service instance.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInstanceValues
public IMonitorValuesProvider addServiceInstanceValues(java.lang.String serviceInstanceId)
Add a value provider related to the given service instance.- Parameters:
serviceInstanceId
- the service instance identifier.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServerValues
public IMonitorValuesProvider addServerValues()
Add a value provider related to the server.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceValues
public IMonitorValuesProvider addServiceValues(java.lang.String serviceId)
Add a value provider related to the given service.- Parameters:
serviceId
- the service identifier.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInterfaceInstanceValues
public IMonitorValuesProvider addServiceInterfaceInstanceValues(ServiceInterfaceInstanceConfig serviceInterfaceInstanceConfig)
Add a value provider related to the given interface instance.- Parameters:
serviceInterfaceInstanceConfig
- the interface instance.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addSessionValues
public IMonitorValuesProvider addSessionValues(SessionConfig sessionConfig, HttpSession httpSession) throws PortalException
Adds a value provider related toSessionConfig
andHttpSession
.- Parameters:
sessionConfig
- the LumisXP user session.httpSession
- the application server http session.- Returns:
- the created values provider.
- Throws:
PortalException
- Since:
- 11.0.0
-
addMonitorUserValuesByUserId
public IMonitorValuesProvider addMonitorUserValuesByUserId(java.lang.String userId)
Adds a value provider related toMonitorUser
with the given user identifier.- Parameters:
userId
- the monitor user identifier.- Returns:
- the created values provider.
- Since:
- 12.0.0
-
addMonitorUserValuesByTrackId
public IMonitorValuesProvider addMonitorUserValuesByTrackId(java.lang.String trackId)
Adds a value provider related toMonitorUser
with the given track identifier.- Parameters:
trackId
- the monitor user track identifier.- Returns:
- the created values provider.
- Since:
- 12.0.0
-
-