Tabnine Logo
Annotation.getElements
Code IndexAdd Tabnine to your IDE (free)

How to use
getElements
method
in
org.wso2.siddhi.query.api.annotation.Annotation

Best Java code snippets using org.wso2.siddhi.query.api.annotation.Annotation.getElements (Showing top 20 results out of 315)

origin: wso2/siddhi

if (annotation != null) {
  Element element = null;
  for (Element aElement : annotation.getElements()) {
    if (elementName == null) {
      if (aElement.getKey() == null) {
origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.core

/**
 * Traverse annotations and returns the name
 *
 * @param annotations
 * @return
 */
private static String getName(List<Annotation> annotations) {
  String name = UUID.randomUUID().toString();
  if (annotations != null) {
    for (Annotation annotation : annotations) {
      if (annotation.getName().equals(EventProcessorConstants.NAME)) {
        name = annotation.getElements().get(0).getValue();
      }
    }
  }
  return name;
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

/**
 * Generates AnnotationConfig String for the given Siddhi Annotation
 * @param annotation    Siddhi Annotation
 * @return              String representing the Annotation
 */
public String generateAnnotationConfig(Annotation annotation) {
  StringBuilder annotationConfig = new StringBuilder();
  annotationConfig.append("@");
  annotationConfig.append(annotation.getName());
  annotationConfig.append("(");
  List<String> annotationMembers = new ArrayList<>();
  for (Element element : annotation.getElements()) {
    annotationMembers.add(element.toString());
  }
  for (Annotation innerAnnotation : annotation.getAnnotations()) {
    annotationMembers.add(generateAnnotationConfig(innerAnnotation));
  }
  annotationConfig.append(String.join(", ", annotationMembers));
  annotationConfig.append(")");
  preserveCodeSegment(annotation);
  return annotationConfig.toString();
}
origin: org.wso2.extension.siddhi.io.file/siddhi-io-file

protected void init(StreamDefinition streamDefinition, OptionHolder optionHolder,
          ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
  this.siddhiAppContext = siddhiAppContext;
  uriOption = optionHolder.validateAndGetOption(Constants.FILE_URI);
  String append = optionHolder.validateAndGetStaticValue(Constants.APPEND, Constants.TRUE);
  properties = new HashMap<>();
  properties.put(Constants.ACTION, Constants.WRITE);
  if (Constants.TRUE.equalsIgnoreCase(append)) {
    properties.put(Constants.APPEND, append);
  }
  String mapType = streamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0)
      .getValue();
  addEventSeparator = optionHolder.isOptionExists(Constants.ADD_EVENT_SEPARATOR) ?
      Boolean.parseBoolean(optionHolder.validateAndGetStaticValue(Constants.ADD_EVENT_SEPARATOR)) :
      !mapType.equalsIgnoreCase("csv");
}
origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb

return indices.getElements().stream().map(index -> {
  Matcher matcher = indexBy.matcher(index.getValue());
  if (matcher.matches() && attributeNames.contains(matcher.group(1))) {
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

for (Annotation annotation : sourceStream.getValue().getAnnotations()) {
  if (annotation.getName().equalsIgnoreCase(Constants.KAFKA_SOURCE)) {
    for (Element sourceElement : annotation.getElements()) {
      if (sourceElement.getKey().equalsIgnoreCase(Constants.KAFKA_SOURCE_TOPIC_LIST)) {
        sourceList.add(sourceElement.getValue());
    for (Element sinkElement : annotation.getElements()) {
      if (sinkElement.getKey().equalsIgnoreCase(Constants.KAFKA_SINK_TOPIC)) {
        sinkList.add(sinkElement.getValue());
origin: org.wso2.extension.siddhi.io.http/siddhi-io-http

/**
 * The initialization method for {@link Sink}, which will be called before other methods and validate
 * the all configuration and getting the intial values.
 *
 * @param outputStreamDefinition containing stream definition bind to the {@link Sink}
 * @param optionHolder           Option holder containing static and dynamic configuration related
 *                               to the {@link Sink}
 * @param configReader           to read the sink related system configuration.
 * @param siddhiAppContext       the context of the {@link org.wso2.siddhi.query.api.SiddhiApp} used to
 *                               get siddhi related utilty functions.
 */
@Override
protected void init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder,
          ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
  //read configurations
  this.messageIdOption = optionHolder.validateAndGetOption(HttpConstants.MESSAGE_ID);
  this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID);
  this.httpHeaderOption = optionHolder.getOrCreateOption(HttpConstants.HEADERS, HttpConstants.DEFAULT_HEADER);
  this.mapType = outputStreamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0)
      .getValue();
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

/**
 * Obtain query name of each siddhi app elements
 */
private void loadQueryName(List<Annotation> queryAnnotations, SiddhiAppElements siddhiAppElements) {
  for (Annotation annotation : queryAnnotations) {
    for (Element element : annotation.getElements()) {
      siddhiAppElements.setQueryName(element.getValue());
    }
  }
  if (siddhiAppElements.getQueryName() == null) {
    siddhiAppElements.setQueryName(Constants.DEFAULT_QUERY_NAME);
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

/**
 * Generates MapperPayloadOrAttribute object, with the given Siddhi Annotation
 * @param attributesOrPayloadAnnotation         Siddhi Annotation, denoting @attribute or @payload
 * @return                                      MapperPayloadOrAttribute object
 */
private MapperPayloadOrAttribute generateMapperPayloadOrAttributes(Annotation attributesOrPayloadAnnotation) {
  List<PayloadOrAttributeElement> elements = new ArrayList<>();
  for (Element element : attributesOrPayloadAnnotation.getElements()) {
    elements.add(generatePayloadOrAttributesElement(element));
  }
  MapperPayloadOrAttributeType mapperPayloadOrAttributesType = getMapperAttributeOrPayloadType(elements);
  if (mapperPayloadOrAttributesType == MapperPayloadOrAttributeType.MAP) {
    return generateMapperMapAttribute(attributesOrPayloadAnnotation.getName(), elements);
  }
  return generateMapperListAttribute(attributesOrPayloadAnnotation.getName(), elements);
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

  public StoreConfig generateStoreConfig(Annotation storeAnnotation) throws DesignGenerationException {
    String type = null;
    Map<String, String> options = new HashMap<>();
    for (Element element : storeAnnotation.getElements()) {
      if (element.getKey().equalsIgnoreCase("TYPE")) {
        type = element.getValue();
      } else {
        options.put(element.getKey(), element.getValue());
      }
    }
    if (type == null) {
      throw new DesignGenerationException("Can not find type for the Store");
    }
    StoreConfig storeConfig = new StoreConfig(type, options);
    preserveAndBindCodeSegment(storeAnnotation, storeConfig);

    return storeConfig;
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

/**
 * Loads App level Annotations from the Siddhi app
 *
 * @return A reference to this object
 */
public EventFlowBuilder loadAppAnnotations() {
  String siddhiAppName = "";
  String siddhiAppDescription = "";
  List<String> appAnnotations = new ArrayList<>();
  AnnotationConfigGenerator annotationConfigGenerator = new AnnotationConfigGenerator();
  for (Annotation annotation : siddhiApp.getAnnotations()) {
    if (annotation.getName().equalsIgnoreCase("NAME")) {
      siddhiAppName = annotation.getElements().get(0).getValue();
      annotationConfigGenerator.preserveCodeSegment(annotation);
    } else if (annotation.getName().equalsIgnoreCase("DESCRIPTION")) {
      siddhiAppDescription = annotation.getElements().get(0).getValue();
      annotationConfigGenerator.preserveCodeSegment(annotation);
    } else {
      appAnnotations.add(
          "@App:" + annotationConfigGenerator.generateAnnotationConfig(annotation).split("@")[1]);
    }
  }
  siddhiAppConfig.setSiddhiAppName(siddhiAppName);
  siddhiAppConfig.setSiddhiAppDescription(siddhiAppDescription);
  siddhiAppConfig.setAppAnnotationList(appAnnotations);
  siddhiAppConfig.addElementCodeSegments(annotationConfigGenerator.getPreservedCodeSegments());
  return this;
}
origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms

/**
 * Util method which validates the elements from an annotation to verify that they comply to the accepted standards.
 *
 * @param annotation the annotation to be validated.
 */
public static void validateAnnotation(Annotation annotation) {
  if (annotation == null) {
    return;
  }
  List<Element> elements = annotation.getElements();
  for (Element element : elements) {
    if (isEmpty(element.getValue())) {
      throw new RDBMSTableException("Annotation '" + annotation.getName() + "' contains illegal value(s). " +
          "Please check your query and try again.");
    }
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

/**
 * Generates config for a Mapper
 * @param mapAnnotation                     Siddhi annotation that contains details of a Siddhi Mapper
 * @return                                  MapperConfig object
 * @throws DesignGenerationException        Error while generating MapperConfig
 */
private MapperConfig generateMapperConfig(Annotation mapAnnotation) throws DesignGenerationException {
  String type = null;
  List<String> options = new ArrayList<>();
  for (Element element : mapAnnotation.getElements()) {
    if (element.getKey().equalsIgnoreCase(TYPE)) {
      type = element.getValue();
    } else {
      options.add(element.toString());
    }
  }
  if (type == null) {
    throw new DesignGenerationException("Unable to find 'type' of the mapper");
  }
  MapperPayloadOrAttribute payloadOrAttribute = null;
  if (!mapAnnotation.getAnnotations().isEmpty()) {
    payloadOrAttribute = generateMapperPayloadOrAttributes(mapAnnotation.getAnnotations().get(0));
  }
  MapperConfig mapperConfig = new MapperConfig(type, options, payloadOrAttribute);
  preserveAndBindCodeSegment(mapAnnotation, mapperConfig);
  return mapperConfig;
}
origin: org.wso2.extension.siddhi.map.text/siddhi-map-text

for (Element el : streamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements()) {
  if (el.getKey().contains(REGULAR_EXPRESSION_GROUP)) {
    regexGroupMap.put(el.getKey()
origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

String correlationId = null;
List<String> options = new ArrayList<>();
for (Element element : sourceOrSinkAndConnectedElement.getKey().getElements()) {
  if (element.getKey().equalsIgnoreCase(TYPE)) {
    type = element.getValue();
origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms

if (primaryKeys != null) {
  primaryKeysEnabled = true;
  primaryKeys.getElements().forEach(elem -> {
    for (int i = 0; i < this.attributes.size(); i++) {
      if (this.attributes.get(i).getName().equalsIgnoreCase(elem.getValue())) {
origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb

/**
 * Utility method which can be used to check if the given primary key is valid i.e. non empty
 * and is made up of attributes and return an index model when PrimaryKey is valid.
 *
 * @param primaryKey     the PrimaryKey annotation which contains the primary key attributes.
 * @param attributeNames List containing names of the attributes.
 * @return List of String with primary key attributes.
 */
public static IndexModel extractPrimaryKey(Annotation primaryKey, List<String> attributeNames) {
  if (primaryKey == null) {
    return null;
  }
  Document primaryKeyIndex = new Document();
  primaryKey.getElements().forEach(
      element -> {
        if (!isEmpty(element.getValue()) && attributeNames.contains(element.getValue())) {
          primaryKeyIndex.append(element.getValue(), 1);
        } else {
          throw new SiddhiAppCreationException("Annotation '" + primaryKey.getName() + "' contains " +
              "value '" + element.getValue() + "' which is not present in the attributes of the " +
              "Event Table.");
        }
      }
  );
  return new IndexModel(primaryKeyIndex, new IndexOptions().unique(true));
}
origin: org.wso2.siddhi/siddhi-query-api

if (annotation != null) {
  Element element = null;
  for (Element aElement : annotation.getElements()) {
    if (elementName == null) {
      if (aElement.getKey() == null) {
origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

/**
 * Load sink related data
 */
private void loadSinks(SiddhiApp siddhiApp, SiddhiAppRuntime siddhiAppRuntime, List<SiddhiAppElements>
    listOfSiddhiAppElements, String
                siddhiAppString) {
  for (List<Sink> sinks : siddhiAppRuntime.getSinks()) {
    for (Sink sink : sinks) {
      for (Annotation annotation : sink.getStreamDefinition().getAnnotations()) {
        for (Element element : annotation.getElements()) {
          if (Objects.equals(element.getValue(), sink.getType())) {
            SiddhiAppElements siddhiAppElements = new SiddhiAppElements();
            siddhiAppElements.setInputStreamId(sink.getStreamDefinition().getId());
            loadInputData(siddhiApp, siddhiAppRuntime, sink.getStreamDefinition().getId(),
                siddhiAppString,
                siddhiAppElements);
            siddhiAppElements.setOutputStreamId(sink.getType());
            siddhiAppElements.setOutputStreamType(Constants.SINK_TYPE);
            siddhiAppElements.setOutputStreamSiddhiApp(getDefinition(annotation, siddhiAppString));
            listOfSiddhiAppElements.add(siddhiAppElements);
          }
        }
      }
    }
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

/**
 * Load source related data
 */
private void loadSources(SiddhiApp siddhiApp, SiddhiAppRuntime siddhiAppRuntime, List<SiddhiAppElements>
    listOfSiddhiAppElements, String siddhiAppString) {
  for (List<Source> sources : siddhiAppRuntime.getSources()) {
    for (Source source : sources) {
      for (Annotation annotation : source.getStreamDefinition().getAnnotations()) {
        for (Element element : annotation.getElements()) {
          if (Objects.equals(element.getValue(), source.getType())) {
            SiddhiAppElements siddhiAppElements = new SiddhiAppElements();
            siddhiAppElements.setOutputStreamId(source.getStreamDefinition().getId());
            siddhiAppElements.setInputStreamId(source.getType());
            siddhiAppElements.setInputStreamType(Constants.SOURCE_TYPE);
            loadOutputData(siddhiApp, siddhiAppRuntime, source.getStreamDefinition().getId(),
                siddhiAppString,
                siddhiAppElements);
            siddhiAppElements.setInputStreamSiddhiApp(getDefinition(annotation, siddhiAppString));
            listOfSiddhiAppElements.add(siddhiAppElements);
          }
        }
      }
    }
  }
}
org.wso2.siddhi.query.api.annotationAnnotationgetElements

Popular methods of Annotation

  • getElement
  • getName
  • getAnnotations
  • <init>
  • annotation
  • element
  • getQueryContextEndIndex
  • getQueryContextStartIndex
  • toString

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JFileChooser (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now