com.bytex.snamp.connector.dataStream.groovy.GroovyNotificationParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of data-stream Show documentation
Show all versions of data-stream Show documentation
Framework for writing connectors based on message processing
The newest version!
package com.bytex.snamp.connector.dataStream.groovy;
import com.bytex.snamp.SpecialUse;
import com.bytex.snamp.connector.dataStream.NotificationParser;
import com.bytex.snamp.connector.dataStream.NotificationParserChain;
import com.bytex.snamp.connector.notifications.NotificationBuilder;
import com.bytex.snamp.instrumentation.measurements.*;
import com.bytex.snamp.instrumentation.measurements.jmx.MeasurementNotification;
import com.bytex.snamp.instrumentation.measurements.jmx.SpanNotification;
import com.bytex.snamp.instrumentation.measurements.jmx.TimeMeasurementNotification;
import com.bytex.snamp.instrumentation.measurements.jmx.ValueMeasurementNotification;
import com.bytex.snamp.scripting.groovy.Scriptlet;
import javax.management.Notification;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
/**
* Represents notification parser written in Groovy language.
* @author Roman Sakno
* @version 2.0
* @since 2.0
*/
public abstract class GroovyNotificationParser extends Scriptlet implements NotificationParserChain {
private static final String COMPONENT_NAME = "componentName";
private static final String INSTANCE_NAME = "componentInstance";
/**
* Represents notification supplier.
*/
@FunctionalInterface
private interface NotificationFactory extends Supplier {
}
/**
* Represents DSL starter.
* @param Type of object used in DSL pipeline.
*/
@FunctionalInterface
protected interface DSLStarter{
/**
* Starts DSL pipeline.
* @return DSL pipeline.
*/
T start();
}
@FunctionalInterface
protected interface DSLFinalizer{
T terminate();
}
@FunctionalInterface
protected interface MeasurementFinalizer extends DSLFinalizer{
@Override
M terminate();
}
private final class NotificationBuilderStarter implements DSLStarter{
@Override
public NotificationBuilder start() {
final NotificationBuilder builder = new NotificationBuilder();
builder.setSource(GroovyNotificationParser.this);
getNotifications().add(builder::get);
return builder;
}
}
private final class MeasurementFinalizerImpl implements MeasurementFinalizer{
private final Function
© 2015 - 2024 Weber Informatics LLC | Privacy Policy