TraceEventFactorypublic final class TraceEventFactory extends EventAbstractFactory
Fields Summary |
---|
private boolean | notificationsEnabled | private static final TraceEventFactory | instance |
Constructors Summary |
---|
private TraceEventFactory()
super();
EventBuilder.getInstance().addEventFactory(EVENT_TRACE, this);
try {
TraceEventImpl impl = (TraceEventImpl) getMBeanServer().instantiate(
"com.sun.enterprise.admin.selfmanagement.event.TraceEventImpl");
getMBeanServer().registerMBean(impl,TraceEvent.getTraceImplObjectName());
} catch (javax.management.ReflectionException rex) {
_logger.log(Level.WARNING,"smgt.internal_error", rex);
} catch (javax.management.InstanceAlreadyExistsException iex) {
_logger.log(Level.WARNING,"smgt.internal_error", iex);
} catch (Exception ex) {
_logger.log(Level.WARNING,"smgt.internal_error", ex);
}
|
Methods Summary |
---|
private synchronized void | enableNotifications(boolean enable)
if (!notificationsEnabled) {
CallflowEventListener.register();
notificationsEnabled = true;
} else if (!enable) {
CallflowEventListener.unregister();
}
| static com.sun.enterprise.admin.selfmanagement.event.TraceEventFactory | getInstance()
return instance;
| public Event | instrumentEvent(com.sun.enterprise.config.serverbeans.ElementProperty[] properties, java.lang.String description)
enableNotifications(true);
String eventName = "*";
String ipAddress = "*";
String callerPrincipal = "*";
String componentName = "*";
for( int i = 0; i < properties.length; i++ ){
ElementProperty property = properties[i];
String propertyName = property.getName( ).toLowerCase( );
if( propertyName.equals(PROPERTY_TRACE_NAME)) {
eventName = "trace." + property.getValue( ).toLowerCase( );
if (!TraceEvent.isValidType(eventName))
throw new IllegalArgumentException(
sm.getString(PROPERTY_TRACE_NAME,
"selfmgmt_event.invalid_event_property",EVENT_TRACE));
}
if(propertyName.equals(PROPERTY_TRACE_IPADDRESS)) {
ipAddress = property.getValue( ).toLowerCase( );
}
if(propertyName.equals(PROPERTY_TRACE_CALLERPRINCIPAL)) {
callerPrincipal = property.getValue( ).toLowerCase( );
}
if(propertyName.equals(PROPERTY_TRACE_COMPONENTNAME)) {
componentName = property.getValue( ).toLowerCase( );
}
}
return new TraceEvent(eventName,
new TraceEventNotificationFilter(eventName, ipAddress, callerPrincipal, componentName),
description);
|
|