Search in sources :

Example 1 with FederatedOperationIterableHandler

use of uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedOperationIterableHandler in project Gaffer by gchq.

the class FederatedAddGraphHandlerParent method addGenericHandler.

protected void addGenericHandler(final FederatedStore store, final Graph graph) {
    for (final Class<? extends Operation> supportedOperation : graph.getSupportedOperations()) {
        // some operations are not suitable for FederatedOperationGenericOutputHandler
        if (!store.isSupported(supportedOperation)) {
            if (Output.class.isAssignableFrom(supportedOperation)) {
                Class<? extends Output> supportedOutputOperation = (Class<? extends Output>) supportedOperation;
                Class outputClass;
                try {
                    outputClass = supportedOutputOperation.newInstance().getOutputClass();
                } catch (final InstantiationException | IllegalAccessException e) {
                    LOGGER.warn("Exception occurred while trying to create a newInstance of operation: " + supportedOperation, e);
                    continue;
                }
                if (CloseableIterable.class.equals(outputClass)) {
                    store.addOperationHandler((Class) supportedOutputOperation, new FederatedOperationIterableHandler());
                } else {
                    LOGGER.warn("No generic default handler can be used for an Output operation that does not return CloseableIterable. operation: " + supportedOutputOperation);
                }
            } else {
                store.addOperationHandler(supportedOperation, new FederatedOperationHandler());
            }
        }
    }
}
Also used : Output(uk.gov.gchq.gaffer.operation.io.Output) FederatedOperationIterableHandler(uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedOperationIterableHandler)

Aggregations

FederatedOperationIterableHandler (uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedOperationIterableHandler)1 Output (uk.gov.gchq.gaffer.operation.io.Output)1