@Override public String stringValue() { return typeValue.toString(); }
@Override public int hashCode() { return Objects.hash(type.toString()); }
@Override public int hashCode() { return super.toString().hashCode(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(elementType.toString()); if (sb.indexOf("[") != -1) { return size != -1 ? sb.insert(sb.indexOf("["), "[" + size + "]").toString() : sb.insert(sb.indexOf("["), "[]").toString(); } else { return size != -1 ? sb.append("[").append(size).append("]").toString() : sb.append("[]").toString(); } }
public void setBValue(BValue bValue, BType bType) { type = bType.toString(); value = getStringValue(bValue); }
@Override public String toString() { StringJoiner sj = new StringJoiner(" "); for (int i = 0; i < varRegs.length; i++) { sj.add(types[i].toString()); sj.add(String.valueOf(pkgRefs[i])); sj.add(String.valueOf(varRegs[i])); } return Mnemonics.getMnem(opcode) + " " + sj.toString(); } }
@Override public String toString() { StringJoiner sj = new StringJoiner(" "); for (int i = 0; i < varRegs.length; i++) { sj.add(types[i].toString()); sj.add(String.valueOf(pkgRefs[i])); sj.add(String.valueOf(varRegs[i])); } return Mnemonics.getMnem(opcode) + " " + sj.toString(); } }
private void addTypesToStreamDefinitionQuery(StringBuilder streamDefinition, BField structField) { streamDefinition.append(structField.fieldName).append(" "); String type = structField.fieldType.toString(); //even though, type defined as int, actual value is a long. To handle this case in Siddhi, type is defined //as long. if (type.equalsIgnoreCase("int")) { type = "long"; } else if (type.equalsIgnoreCase("float")) { type = "double"; } else if (type.equalsIgnoreCase("boolean")) { type = "bool"; } streamDefinition.append(type); } }
@Override public String toString() { if (constraint == null) { return super.toString(); } else { return "json" + "<" + constraint.getName() + ">"; } }
@Override public String toString() { if (constraint == BTypes.typeAny) { return super.toString(); } else { return "stream" + "<" + constraint.getName() + ">"; } }
@Override public String toString() { if (constraint == BTypes.typeAny) { return super.toString(); } else { return "map" + "<" + constraint.getName() + ">"; } }
public void setBValue(BValue bValue) { if (bValue == null) { type = "null"; value = "null"; return; } type = bValue.getType().toString(); value = getStringValue(bValue); }
public WebSocketService(Service service) { this.service = service; for (Resource resource : service.getResources()) { resourceMap.put(resource.getName(), resource); } Annotation configAnnotation = WebSocketUtil.getServiceConfigAnnotation(service); Struct configAnnotationStruct = null; if (configAnnotation != null && (configAnnotationStruct = configAnnotation.getValue()) != null) { negotiableSubProtocols = findNegotiableSubProtocols(configAnnotationStruct); idleTimeoutInSeconds = findIdleTimeoutInSeconds(configAnnotationStruct); maxFrameSize = findMaxFrameSize(configAnnotationStruct); } ParamDetail param = service.getResources()[0].getParamDetails().get(0); if (param != null && WebSocketConstants.WEBSOCKET_CALLER_NAME.equals(param.getVarType().toString())) { basePath = findFullWebSocketUpgradePath(configAnnotationStruct); } }
@Override public void execute(Context context) { Service service = BLangConnectorSPIUtil.getServiceRegistered(context); Struct serviceEndpoint = BLangConnectorSPIUtil.getConnectorEndpointStruct(context); HTTPServicesRegistry httpServicesRegistry = getHttpServicesRegistry(serviceEndpoint); WebSocketServicesRegistry webSocketServicesRegistry = getWebSocketServicesRegistry(serviceEndpoint); ParamDetail param; if (service.getResources().length > 0 && (param = service.getResources()[0].getParamDetails().get(0)) != null) { String callerType = param.getVarType().toString(); if (HttpConstants.HTTP_CALLER_NAME.equals(callerType)) { httpServicesRegistry.registerService(service); } else if (WebSocketConstants.WEBSOCKET_CALLER_NAME.equals(callerType)) { WebSocketService webSocketService = new WebSocketService(service); webSocketServicesRegistry.registerService(webSocketService); } } else { httpServicesRegistry.registerService(service); } context.setReturnValues(); } }
/** * Start observability for the asynchronous function/action invocations. * * @param strand callee strand * @param parentCtx parent observer context */ public static void startCallableObservation(Strand strand, ObserverContext parentCtx) { if (!enabled) { return; } ObserverContext newObContext = new ObserverContext(); newObContext.setParent(parentCtx); newObContext.setStarted(); String connectorName = strand.currentFrame.callableUnitInfo.attachedToType != null ? strand.currentFrame.callableUnitInfo.attachedToType.toString() : "ballerina:worker"; newObContext.setConnectorName(connectorName); newObContext.setActionName(strand.currentFrame.callableUnitInfo.getName()); newObContext.setServiceName(getServiceName(strand)); strand.currentFrame.observerContext = newObContext; strand.respCallback.setObserverContext(newObContext); observers.forEach(observer -> observer.startClientObservation(newObContext)); }
@Override public void execute(Context context) { Service service = BLangConnectorSPIUtil.getServiceRegistered(context); Struct serviceEndpoint = BLangConnectorSPIUtil.getConnectorEndpointStruct(context); HTTPServicesRegistry httpServicesRegistry = getHttpServicesRegistry(serviceEndpoint); WebSocketServicesRegistry webSocketServicesRegistry = getWebSocketServicesRegistry(serviceEndpoint); ParamDetail param; if (service.getResources().length > 0 && (param = service.getResources()[0].getParamDetails().get(0)) != null) { String callerType = param.getVarType().toString(); if (HttpConstants.HTTP_CALLER_NAME.equals(callerType)) { httpServicesRegistry.registerService(service); } else if (WebSocketConstants.WEBSOCKET_CALLER_NAME.equals(callerType)) { WebSocketService webSocketService = new WebSocketService(service); webSocketServicesRegistry.registerService(webSocketService); } } else { httpServicesRegistry.registerService(service); } // TODO: 11/24/18 failure need to be validated in the compile time if (!isConnectorStarted(serviceEndpoint)) { startServerConnector(serviceEndpoint, httpServicesRegistry, webSocketServicesRegistry); } context.setReturnValues(); }