use of io.atlasmap.v2.CustomAction in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionService method findActionProcessor.
@Override
public ActionProcessor findActionProcessor(Action action, FieldType sourceType) throws AtlasException {
CustomAction customAction = null;
if (action instanceof CustomAction) {
customAction = (CustomAction) action;
if (customAction.getClassName() == null || customAction.getMethodName() == null) {
throw new AtlasException("The class name and method name must be specified for custom FieldAction: " + customAction.getName());
}
}
List<ActionProcessor> matches = new ArrayList<>();
Lock readLock = actionProcessorsLock.readLock();
try {
readLock.lock();
for (ActionProcessor processor : actionProcessors) {
if (customAction != null) {
ActionDetail detail = processor.getActionDetail();
if (customAction.getClassName().equals(detail.getClassName()) && customAction.getMethodName().equals(detail.getMethod())) {
matches.add(processor);
break;
}
} else if (processor.getActionClass() == action.getClass()) {
matches.add(processor);
}
}
} finally {
readLock.unlock();
}
return findBestActionProcessor(matches, sourceType);
}
Aggregations