com.datatorrent.api.annotation.InputPortFieldAnnotation Java Examples
The following examples show how to use
com.datatorrent.api.annotation.InputPortFieldAnnotation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogicalPlan.java From attic-apex-core with Apache License 2.0 | 5 votes |
@Override public void addInputPort(InputPort<?> portObject, Field field, InputPortFieldAnnotation portAnnotation, AppData.QueryPort adqAnnotation) { if (!OperatorMeta.this.inputStreams.isEmpty()) { for (Map.Entry<LogicalPlan.InputPortMeta, LogicalPlan.StreamMeta> e : OperatorMeta.this.inputStreams.entrySet()) { LogicalPlan.InputPortMeta pm = e.getKey(); if (pm.operatorMeta == OperatorMeta.this && pm.fieldName.equals(field.getName())) { //LOG.debug("Found existing port meta for: " + field); inPortMap.put(portObject, pm); markInputPortIfHidden(pm.getPortName(), pm, field.getDeclaringClass()); return; } } } InputPortMeta metaPort = new InputPortMeta(); metaPort.operatorMeta = OperatorMeta.this; metaPort.fieldName = field.getName(); metaPort.portAnnotation = portAnnotation; metaPort.adqAnnotation = adqAnnotation; inPortMap.put(portObject, metaPort); markInputPortIfHidden(metaPort.getPortName(), metaPort, field.getDeclaringClass()); if (metaPort.getStreamCodec() == null) { metaPort.setStreamCodec(portObject.getStreamCodec()); } else if (portObject.getStreamCodec() != null) { LOG.info("Operator {} input port {} attribute {} overrides codec {} with {} codec", metaPort.getOperatorMeta().getName(), metaPort.getPortName(), STREAM_CODEC.getSimpleName(), portObject.getStreamCodec(), metaPort.getStreamCodec()); } }
Example #2
Source File: Operators.java From attic-apex-core with Apache License 2.0 | 5 votes |
@Override public void addInputPort(Operator.InputPort<?> port, Field field, InputPortFieldAnnotation portAnnotation, AppData.QueryPort adqAnnotation) { if (!inputPorts.containsKey(field.getName())) { inputPorts.put(field.getName(), new PortContextPair<InputPort<?>>(port)); } }
Example #3
Source File: Operators.java From attic-apex-core with Apache License 2.0 | 5 votes |
public static void describe(GenericOperator operator, OperatorDescriptor descriptor) { for (Class<?> c = operator.getClass(); c != Object.class; c = c.getSuperclass()) { Field[] fields = c.getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); InputPortFieldAnnotation inputAnnotation = field.getAnnotation(InputPortFieldAnnotation.class); OutputPortFieldAnnotation outputAnnotation = field.getAnnotation(OutputPortFieldAnnotation.class); AppData.QueryPort adqAnnotation = field.getAnnotation(AppData.QueryPort.class); AppData.ResultPort adrAnnotation = field.getAnnotation(AppData.ResultPort.class); try { Object portObject = field.get(operator); if (portObject instanceof InputPort) { descriptor.addInputPort((Operator.InputPort<?>)portObject, field, inputAnnotation, adqAnnotation); } else { if (inputAnnotation != null) { throw new IllegalArgumentException("port is not of type " + InputPort.class.getName() + ": " + field); } } if (portObject instanceof OutputPort) { descriptor.addOutputPort((Operator.OutputPort<?>)portObject, field, outputAnnotation, adrAnnotation); } else { if (outputAnnotation != null) { throw new IllegalArgumentException("port is not of type " + OutputPort.class.getName() + ": " + field); } } } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } }
Example #4
Source File: Operators.java From attic-apex-core with Apache License 2.0 | votes |
void addInputPort(Operator.InputPort<?> port, Field field, InputPortFieldAnnotation portAnnotation, AppData.QueryPort adqAnnotation);