@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 3) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:put() function, " + "required 3 parameters, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if ((attributeExpressionExecutors.length) % 2 == 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:create() function, " + "required 0 or multiple of 2, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:get() function, " + "required 2, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length < 2) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:remove() function, " + "required one or more keys, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:isMap() function, " + "required only one, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if ((attributeExpressionExecutors.length) != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:toJSON() function, " + "required only 1, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length < 2) { throw new ExecutionPlanValidationException("str:concat() function requires at least two arguments, " + "but found only " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if ((attributeExpressionExecutors.length) != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:createFromXML() function, " + "required only 1, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if ((attributeExpressionExecutors.length) != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to map:create() function, " + "required only 1, but found " + attributeExpressionExecutors.length); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to str:hex() function, " + "required 1, but found " + attributeExpressionExecutors.length); } Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType(); if (attributeType != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for the argument of str:hex() function, " + "required " + Attribute.Type.STRING + "but found " + attributeType.toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to str:length() function. " + "Required 1. Found " + attributeExpressionExecutors.length); } else if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException( "Invalid parameter type found for str:length() function, required "+Attribute.Type.STRING+ ", " + "but found "+attributeExpressionExecutors[0].getReturnType()); } }
/** * The initialization method for StringEmptyFunctionExtension, this method will be called before the other methods. * * @param attributeExpressionExecutors the executors of each function parameter * @param executionPlanContext the context of the execution plan */ @Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to string:empty() function, " + "required 1, but found " + attributeExpressionExecutors.length); } Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType(); if (attributeType != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for the argument of math:string() function, " + "required " + Attribute.Type.STRING + ", but found " + attributeType.toString()); } }
/** * The initialization method for StringListSizeFunctionExtension, this method will be called before the other methods. * * @param attributeExpressionExecutors the executors of each function parameter * @param executionPlanContext the context of the execution plan */ @Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to string:listSize() function, " + "required 1, but found " + attributeExpressionExecutors.length); } Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType(); if (attributeType != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for the argument of string:listSize() function, " + "required " + Attribute.Type.STRING + ", but found " + attributeType.toString()); } }
/** * The initialization method for StringSubtractFunctionExtension, this method will be called before the other methods. * * @param attributeExpressionExecutors the executors of each function parameter * @param executionPlanContext the context of the execution plan */ @Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to string:subtract() function, " + "required 2, but found " + attributeExpressionExecutors.length); } Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType(); if (attributeType != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for the argument of string:subtract() function, " + "required " + Attribute.Type.STRING + ", but found " + attributeType.toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to str:lower() function, required 1, " + "but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for str:lower() function, required " +Attribute.Type.STRING+", but found "+attributeExpressionExecutors[0].getReturnType().toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to str:upper() function, required 1, but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for str:upper() function, required " +Attribute.Type.STRING+", but found "+attributeExpressionExecutors[0].getReturnType().toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to math:unhex() function, " + "required 1, but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for the argument of math:unhex() function, " + "required "+Attribute.Type.STRING+" but found "+attributeExpressionExecutors[0].getReturnType().toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException( "Invalid no of arguments passed to str:trim() function, required 1, but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for str:trim() function, required " +Attribute.Type.STRING+", but found "+attributeExpressionExecutors[0].getReturnType().toString()); } }
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 1) { throw new ExecutionPlanValidationException("Invalid no of arguments passed to str:reverse() function, required 1, " + "but found " + attributeExpressionExecutors.length); } if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) { throw new ExecutionPlanValidationException("Invalid parameter type found for str:reverse() function, required " +Attribute.Type.STRING+", but found "+attributeExpressionExecutors[0].getReturnType().toString()); } }
@Override protected List<Attribute> init(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { this.executionPlanContext = executionPlanContext; if (attributeExpressionExecutors.length == 1) { if (attributeExpressionExecutors[0] instanceof VariableExpressionExecutor) { if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.STRING) { expressionExecutor = (VariableExpressionExecutor) attributeExpressionExecutors[0]; } else { throw new ExecutionPlanValidationException("Json Flat Map Event Duplicator stream Processor 1st " + "attribute should be String, but found " + attributeExpressionExecutors[0].getReturnType()); } } else { throw new ExecutionPlanValidationException("Event duplicate stream Processor 1st parameter " + "needs to be dynamic variable but found a constant attribute " + attributeExpressionExecutors[0].getClass().getCanonicalName()); } } else { throw new ExecutionPlanValidationException("Json Flat Map Event Duplicator stream Processor should only " + "have one parameter (<string> jsonString) but found " + attributeExpressionExecutors.length + " input attributes"); } List<Attribute> attributeList = new ArrayList<>(); attributeList.add(new Attribute("key", Attribute.Type.STRING)); attributeList.add(new Attribute("value", Attribute.Type.STRING)); return attributeList; }