use of io.atlasmap.v2.Audit in project atlasmap by atlasmap.
the class BaseDefaultAtlasContextTest method printAudit.
protected String printAudit(AtlasSession session) {
StringBuilder buf = new StringBuilder("Audits: ");
for (Audit a : session.getAudits().getAudit()) {
buf.append('[');
buf.append(a.getStatus());
buf.append(", message=");
buf.append(a.getMessage());
buf.append("], ");
}
return buf.toString();
}
use of io.atlasmap.v2.Audit in project atlasmap by atlasmap.
the class TestHelper method printAudit.
public static String printAudit(AtlasSession session) {
StringBuilder buf = new StringBuilder("Audits: ");
for (Audit a : session.getAudits().getAudit()) {
buf.append('[');
buf.append(a.getStatus());
buf.append(", message=");
buf.append(a.getMessage());
buf.append("], ");
}
return buf.toString();
}
use of io.atlasmap.v2.Audit in project atlasmap by atlasmap.
the class AtlasEndpoint method onExchange.
@Override
protected void onExchange(Exchange exchange) throws Exception {
Message incomingMessage = exchange.getIn();
String newResourceUri = incomingMessage.getHeader(AtlasConstants.ATLAS_RESOURCE_URI, String.class);
if (newResourceUri != null) {
incomingMessage.removeHeader(AtlasConstants.ATLAS_RESOURCE_URI);
log.debug("{} set to {} creating new endpoint to handle exchange", AtlasConstants.ATLAS_RESOURCE_URI, newResourceUri);
AtlasEndpoint newEndpoint = findOrCreateEndpoint(getEndpointUri(), newResourceUri);
newEndpoint.onExchange(exchange);
return;
}
AtlasSession atlasSession = getOrCreateAtlasContext(incomingMessage).createSession();
populateSourceDocuments(exchange, atlasSession);
getAtlasContext().process(atlasSession);
List<Audit> errors = new ArrayList<>();
for (Audit audit : atlasSession.getAudits().getAudit()) {
switch(audit.getStatus()) {
case ERROR:
errors.add(audit);
break;
case WARN:
LOG.warn("{}: docId='{}', path='{}'", audit.getMessage(), audit.getDocId(), audit.getPath());
break;
default:
LOG.info("{}: docId='{}', path='{}'", audit.getMessage(), audit.getDocId(), audit.getPath());
}
}
if (!errors.isEmpty()) {
StringBuilder buf = new StringBuilder("Errors: ");
errors.stream().forEach(a -> buf.append(String.format("[%s: docId='%s', path='%s'], ", a.getMessage(), a.getDocId(), a.getPath())));
throw new AtlasException(buf.toString());
}
populateTargetDocuments(atlasSession, exchange);
}
use of io.atlasmap.v2.Audit in project atlasmap by atlasmap.
the class AtlasUtil method addAudit.
public static void addAudit(AtlasSession session, String docId, String message, String path, AuditStatus status, String value) {
Audit audit = new Audit();
audit.setDocId(docId);
audit.setMessage(message);
audit.setPath(path);
audit.setStatus(status);
audit.setValue(value);
session.getAudits().getAudit().add(audit);
}
Aggregations