@Override public void visit(BLangStreamAction streamAction) { streamActionClause = new StringBuilder("insert into "); String streamName = "stream" + streamAction.getInvokableBody().getFunctionNode().getName().getValue(); streamName = streamName.replaceAll("\\$", "_"); streamActionClause.append(streamName); }
(List<AnnotationAttachmentNode>) resourceNode.getAnnotationAttachments(); List<BLangRecordLiteral.BLangRecordKeyValue> annVals = new ArrayList<>(); int count = 0; dlog.logDiagnostic(Diagnostic.Kind.ERROR, resourceNode.getPosition(), "There cannot be more than one resource annotations"); } else if (count == 1) { .getValue().equals("webSocketUpgrade")) { if (annVals.size() > 1) { dlog.logDiagnostic(Diagnostic.Kind.ERROR, resourceNode.getPosition(), "Invalid configurations for WebSocket upgrade resource"); } else if (((BLangRecordLiteral) keyValue.valueExpr).keyValuePairs.size() == 1) { if (!((BLangSimpleVarRef) (((BLangRecordLiteral) keyValue.valueExpr).keyValuePairs).get( 0).key.expr).variableName.getValue().equals("upgradeService")) { dlog.logDiagnostic(Diagnostic.Kind.ERROR, resourceNode.getPosition(), "An upgradeService need to be specified for the WebSocket upgrade " + "resource"); dlog.logDiagnostic(Diagnostic.Kind.ERROR, resourceNode.getPosition(), "An upgradeService need to be specified for the WebSocket upgrade " + "resource");
private static Message getRequestMessage(FunctionNode resourceNode) throws GrpcServerException { if (!(!resourceNode.getParameters().isEmpty() || resourceNode.getParameters().size() < 4)) { throw new GrpcServerException("Service resource definition should contain more than one and less than " + "four params. but contains " + resourceNode.getParameters().size()); } BType requestType = getMessageParamType(resourceNode.getParameters()); return generateMessageDefinition(requestType); }
private static boolean isServerStreaming(FunctionNode resourceNode) { boolean serverStreaming = false; for (AnnotationAttachmentNode annotationNode : resourceNode.getAnnotationAttachments()) { if (!ANN_RESOURCE_CONFIG.equals(annotationNode.getAnnotationName().getValue())) { continue; } if (annotationNode.getExpression() instanceof BLangRecordLiteral) { List<BLangRecordLiteral.BLangRecordKeyValue> attributes = ((BLangRecordLiteral) annotationNode .getExpression()).getKeyValuePairs(); for (BLangRecordLiteral.BLangRecordKeyValue attributeNode : attributes) { String attributeName = attributeNode.getKey().toString(); String attributeValue = attributeNode.getValue() != null ? attributeNode.getValue().toString() : null; if (ANN_ATTR_RESOURCE_SERVER_STREAM.equals(attributeName)) { serverStreaming = attributeValue != null && Boolean.parseBoolean(attributeValue); } } } } return serverStreaming; }
@Override public void process(FunctionNode functionNode, List<AnnotationAttachmentNode> annotations) { for (AnnotationAttachmentNode attachmentNode : annotations) { String annotationKey = attachmentNode.getAnnotationName().getValue(); try { AnnotationProcessorFactory.getAnnotationProcessorInstance(annotationKey).processAnnotation (functionNode, attachmentNode); } catch (KubernetesPluginException e) { dlog.logDiagnostic(Diagnostic.Kind.ERROR, functionNode.getPosition(), e.getMessage()); } } }
private static Message getResponseMessage(FunctionNode resourceNode) throws GrpcServerException { org.wso2.ballerinalang.compiler.semantics.model.types.BType responseType; BLangInvocation sendExpression = getInvocationExpression(resourceNode.getBody()); if (sendExpression != null) { responseType = getReturnType(sendExpression); } else { // if compiler plugin could not find responseType = new BNilType(); } return generateMessageDefinition(responseType); }
BType responseType = null; for (AnnotationAttachmentNode annotationNode : resourceNode.getAnnotationAttachments()) { if (!ServiceProtoConstants.ANN_RESOURCE_CONFIG.equals(annotationNode.getAnnotationName().getValue())) { continue;
String functionName = functionNode.getName().getValue();
(BLangSimpleVariable) lambdaFunction.getFunctionNode().getParameters().get(0); outputEventType = ((BArrayType) outputFuncArg.type).eType;
if (ON_MESSAGE_RESOURCE.equals(resourceNode.getName().getValue())) { requestMessage = requestMessage == null ? getRequestMessage(resourceNode) : requestMessage; Message respMsg = responseMessage == null ? getResponseMessage(resourceNode) : responseMessage; if (ON_COMPLETE_RESOURCE.equals(resourceNode.getName().getValue())) { Message respMsg = responseMessage == null ? getResponseMessage(resourceNode) : responseMessage; if (respMsg != null && !(MessageKind.EMPTY.equals(respMsg.getMessageKind()))) {
Method resourceMethod = Method.newBuilder(resourceNode.getName().getValue()) .setClientStreaming(false) .setServerStreaming(serverStreaming)