congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Element.getValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getValue
method
in
org.wso2.siddhi.query.api.annotation.Element

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

origin: wso2/siddhi

public String getElement(String key) {
  for (Element element : elements) {
    if (element.getKey() != null && element.getKey().equalsIgnoreCase(key)) {
      return element.getValue();
    }
  }
  return null;
}
origin: wso2/siddhi

public Partition addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && queryNameList.contains(name)) {
    throw new SiddhiAppValidationException("Cannot add Query as another Execution Element already uses " +
        "its name=" + name + " within the same Partition",
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  queryNameList.add(name);
  this.queryList.add(query);
  return this;
}
origin: wso2/siddhi

public SiddhiApp addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && executionElementNameList.contains(name)) {
    throw new SiddhiAppValidationException(
        "Cannot add Query as another Execution Element already uses " + "its name=" + name,
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  executionElementNameList.add(name);
  this.executionElementList.add(query);
  return this;
}
origin: wso2/siddhi

public SiddhiApp addPartition(Partition partition) {
  if (partition == null) {
    throw new SiddhiAppValidationException("Partition should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, partition.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && executionElementNameList.contains(name)) {
    throw new SiddhiAppValidationException(
        "Cannot add Partition as another Execution Element already " + "uses its name=" + name,
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  executionElementNameList.add(name);
  this.executionElementList.add(partition);
  return this;
}
origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms

/**
 * Util method used to convert a list of elements in an annotation to a comma-separated string.
 *
 * @param elements the list of annotation elements.
 * @return a comma-separated string of all elements in the list.
 */
public static String flattenAnnotatedElements(List<Element> elements) {
  StringBuilder sb = new StringBuilder();
  elements.forEach(elem -> {
    sb.append(elem.getValue());
    if (elements.indexOf(elem) != elements.size() - 1) {
      sb.append(RDBMSTableConstants.SEPARATOR);
    }
  });
  return sb.toString();
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

/**
 * Get user preference on creating kafka topics from {@link org.wso2.carbon.sp.jobmanager.core.SiddhiAppCreator}.
 * If no value is defined 'true' is returned
 */
private boolean isTransportChannelCreationEnabled(List<Annotation> annotationList) {
  Element element = AnnotationHelper.getAnnotationElement(
      SiddhiTopologyCreatorConstants.TRANSPORT_CHANNEL_CREATION_IDENTIFIER, null, annotationList);
  if (element == null) {
    return true;
  } else {
    return Boolean.valueOf(element.getValue());
  }
}
origin: org.wso2.siddhi/siddhi-query-api

public String getElement(String key) {
  for (Element element : elements) {
    if (element.getKey() != null && element.getKey().equalsIgnoreCase(key)) {
      return element.getValue();
    }
  }
  return null;
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

/**
 * Get parallel value of the execGroup if given by the user unless default parallel.
 * {@link SiddhiTopologyCreatorConstants#DEFAULT_PARALLEL} value is returned
 */
private int getExecGroupParallel(ExecutionElement executionElement) {
  Element element = AnnotationHelper.getAnnotationElement(SiddhiTopologyCreatorConstants.DISTRIBUTED_IDENTIFIER,
      SiddhiTopologyCreatorConstants.PARALLEL_IDENTIFIER, executionElement.getAnnotations());
  if (element == null) {
    return SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL;
  } else {
    return Integer.parseInt(element.getValue());
  }
}
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 a PayloadOrAttributeElement object from the given Siddhi Element object
 * @param element       Siddhi Element object
 * @return              PayloadOrAttributeElement object
 */
private PayloadOrAttributeElement generatePayloadOrAttributesElement(Element element) {
  PayloadOrAttributeElement payloadOrAttributeElement = new PayloadOrAttributeElement();
  payloadOrAttributeElement.key = element.getKey();
  payloadOrAttributeElement.value = element.getValue();
  return payloadOrAttributeElement;
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

/**
 * Get SiddhiAppName if given by the user unless a unique SiddhiAppName is returned.
 *
 * @return String SiddhiAppName
 */
private String getSiddhiAppName() {
  Element element =
      AnnotationHelper.getAnnotationElement(SiddhiTopologyCreatorConstants.SIDDHIAPP_NAME_IDENTIFIER,
          null, siddhiApp.getAnnotations());
  if (element == null) {
    return SiddhiTopologyCreatorConstants.DEFAULT_SIDDHIAPP_NAME + "-" + UUID.randomUUID(); //defaultName
  } else {
    return element.getValue();
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

/**
 * Get execGroup name if given by the user unless a unique execGroup is returned.
 */
private String getExecGroupName(ExecutionElement executionElement, String siddhiAppName,
                String defaultExeGroupName) {
  Element element = AnnotationHelper.getAnnotationElement(SiddhiTopologyCreatorConstants.DISTRIBUTED_IDENTIFIER,
      SiddhiTopologyCreatorConstants.EXECGROUP_IDENTIFIER, executionElement.getAnnotations());
  if (element == null) {
    return defaultExeGroupName;
  } else {
    return siddhiAppName + "-" + element.getValue();
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

/**
 * Get the query element name if given by the user unless a default string is returned.
 * @param executionElement  The query element.
 * @return Name of the query element.
 */
private String getElementName(ExecutionElement executionElement) {
  Element element = AnnotationHelper.getAnnotationElement(SiddhiTopologyCreatorConstants
          .INFO_IDENTIFIER, SiddhiTopologyCreatorConstants.SIDDHIAPP_NAME_IDENTIFIER,
      executionElement.getAnnotations());
  if (element == null) {
    return SiddhiTopologyCreatorConstants.EXECUTION_ELEMENT;
  } else {
    return element.getValue();
  }
}
origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

public String getSiddhiAppName(String siddhiApp) throws SiddhiAppConfigurationException {
  try {
    SiddhiApp parsedSiddhiApp = SiddhiCompiler.parse(siddhiApp);
    Element nameAnnotation = AnnotationHelper.
        getAnnotationElement(SiddhiAppProcessorConstants.ANNOTATION_NAME_NAME,
            null, parsedSiddhiApp.getAnnotations());
    if (nameAnnotation == null || nameAnnotation.getValue().isEmpty()) {
      throw new SiddhiAppConfigurationException("Siddhi App name must " +
          "be provided as @App:name('name').");
    }
    return nameAnnotation.getValue();
  } catch (Throwable e) {
    throw new SiddhiAppConfigurationException("Exception occurred when retrieving Siddhi App Name ", e);
  }
}
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.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.event-processing/org.wso2.carbon.event.processor.core

/**
 * Returns the execution plan name
 *
 * @param executionPlanAsString executionPlan (taken from code mirror) as a string
 * @return execution plan name as given in @Plan:name('MyPlanName'). Returns null in the absence of @Plan:name('MyPlanName')
 */
public static String getExecutionPlanName(String executionPlanAsString) {
  String executionPlanName = null;
  ExecutionPlan executionPlan = SiddhiCompiler.parse(executionPlanAsString);
  executionPlanName = AnnotationHelper.getAnnotationElement(EventProcessorConstants.ANNOTATION_NAME_NAME, null,
      executionPlan.getAnnotations()).getValue();
  return executionPlanName;
}
origin: org.wso2.siddhi/siddhi-query-api

public SiddhiApp addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && executionElementNameList.contains(name)) {
    throw new SiddhiAppValidationException(
        "Cannot add Query as another Execution Element already uses " + "its name=" + name,
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  executionElementNameList.add(name);
  this.executionElementList.add(query);
  return this;
}
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.event-processing/org.wso2.carbon.event.processor.core

public void editInactiveExecutionPlan(String executionPlan, String filename)
    throws ExecutionPlanConfigurationException, ExecutionPlanDependencyValidationException {
  EventProcessorHelper.validateExecutionPlan(executionPlan);
  org.wso2.siddhi.query.api.ExecutionPlan parsedExecutionPlan = SiddhiCompiler.parse(executionPlan);
  String newExecutionPlanName = AnnotationHelper.getAnnotationElement(EventProcessorConstants.ANNOTATION_NAME_NAME, null, parsedExecutionPlan.getAnnotations()).getValue();
  EventProcessorConfigurationFilesystemInvoker.delete(filename);
  EventProcessorConfigurationFilesystemInvoker.save(executionPlan, newExecutionPlanName, filename);
}
org.wso2.siddhi.query.api.annotationElementgetValue

Popular methods of Element

  • getKey
  • <init>
  • toString
  • getQueryContextEndIndex
  • getQueryContextStartIndex

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top 12 Jupyter Notebook extensions
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