tracker.open();
}
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
public void blueprintEvent(BlueprintEvent event) {
EventAdmin eventAdmin = (EventAdmin) tracker.getService();
if (eventAdmin == null) {
return;
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(EventConstants.TYPE, event.getType());
props.put(EventConstants.EVENT, event);
props.put(EventConstants.TIMESTAMP, event.getTimestamp());
props.put(EventConstants.BUNDLE, event.getBundle());
props.put(EventConstants.BUNDLE_SYMBOLICNAME, event.getBundle().getSymbolicName());
props.put(EventConstants.BUNDLE_ID, event.getBundle().getBundleId());
props.put(EventConstants.BUNDLE_VERSION, JavaUtils.getBundleVersion(event.getBundle()));
props.put(EventConstants.EXTENDER_BUNDLE, event.getExtenderBundle());
props.put(EventConstants.EXTENDER_BUNDLE_ID, event.getExtenderBundle().getBundleId());
props.put(EventConstants.EXTENDER_BUNDLE_SYMBOLICNAME, event.getExtenderBundle().getSymbolicName());
props.put(EventConstants.EXTENDER_BUNDLE_VERSION, JavaUtils.getBundleVersion(event.getExtenderBundle()));
if (event.getCause() != null) {
props.put(EventConstants.CAUSE, event.getCause());
}
if (event.getDependencies() != null) {
props.put(EventConstants.DEPENDENCIES, event.getDependencies());
}
String topic;
switch (event.getType()) {
case BlueprintEvent.CREATING:
topic = EventConstants.TOPIC_CREATING;
break;
case BlueprintEvent.CREATED:
topic = EventConstants.TOPIC_CREATED;
break;
case BlueprintEvent.DESTROYING:
topic = EventConstants.TOPIC_DESTROYING;
break;
case BlueprintEvent.DESTROYED:
topic = EventConstants.TOPIC_DESTROYED;
break;
case BlueprintEvent.FAILURE:
topic = EventConstants.TOPIC_FAILURE;
break;
case BlueprintEvent.GRACE_PERIOD:
topic = EventConstants.TOPIC_GRACE_PERIOD;
break;
case BlueprintEvent.WAITING:
topic = EventConstants.TOPIC_WAITING;
break;
default:
throw new IllegalStateException("Unknown blueprint event type: " + event.getType());
}
eventAdmin.postEvent(new Event(topic, props));
}