Search in sources :

Example 1 with GenericAdapter

use of org.apache.asterix.external.dataset.adapter.GenericAdapter in project asterixdb by apache.

the class GenericAdapterFactory method createAdapter.

/**
     * Runs on each node controller (after serialization-deserialization)
     */
@Override
public synchronized IDataSourceAdapter createAdapter(IHyracksTaskContext ctx, int partition) throws HyracksDataException {
    INCServiceContext serviceCtx = ctx.getJobletContext().getServiceContext();
    INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext();
    try {
        restoreExternalObjects(serviceCtx, appCtx.getLibraryManager());
    } catch (Exception e) {
        LOGGER.log(Level.INFO, "Failure restoring external objects", e);
        throw HyracksDataException.create(e);
    }
    if (isFeed) {
        if (feedLogManager == null) {
            feedLogManager = FeedUtils.getFeedLogManager(ctx, partition, feedLogFileSplits);
        }
        feedLogManager.touch();
    }
    IDataFlowController controller = DataflowControllerProvider.getDataflowController(recordType, ctx, partition, dataSourceFactory, dataParserFactory, configuration, indexingOp, isFeed, feedLogManager);
    if (isFeed) {
        return new FeedAdapter((AbstractFeedDataFlowController) controller);
    } else {
        return new GenericAdapter(controller);
    }
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) INCServiceContext(org.apache.hyracks.api.application.INCServiceContext) GenericAdapter(org.apache.asterix.external.dataset.adapter.GenericAdapter) FeedAdapter(org.apache.asterix.external.dataset.adapter.FeedAdapter) IDataFlowController(org.apache.asterix.external.api.IDataFlowController) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)

Aggregations

INcApplicationContext (org.apache.asterix.common.api.INcApplicationContext)1 IDataFlowController (org.apache.asterix.external.api.IDataFlowController)1 FeedAdapter (org.apache.asterix.external.dataset.adapter.FeedAdapter)1 GenericAdapter (org.apache.asterix.external.dataset.adapter.GenericAdapter)1 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)1 INCServiceContext (org.apache.hyracks.api.application.INCServiceContext)1 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1