Search in sources :

Example 11 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getFeedConnections.

@Override
public List<FeedConnection> getFeedConnections(JobId jobId, String dataverseName, String feedName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, feedName);
        FeedConnectionTupleTranslator tupleReaderWriter = new FeedConnectionTupleTranslator(false);
        List<FeedConnection> results = new ArrayList<>();
        IValueExtractor<FeedConnection> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_CONNECTION_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FeedConnectionTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedConnectionTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 12 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getAllDatasets.

public List<Dataset> getAllDatasets(JobId jobId) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = null;
        DatasetTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getDatasetTupleTranslator(false);
        IValueExtractor<Dataset> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Dataset> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.DATASET_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) DatasetTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.DatasetTupleTranslator) ExtensionMetadataDataset(org.apache.asterix.metadata.api.ExtensionMetadataDataset) Dataset(org.apache.asterix.metadata.entities.Dataset) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 13 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getDataverseLibraries.

@Override
public List<Library> getDataverseLibraries(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName);
        LibraryTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getLibraryTupleTranslator(false);
        IValueExtractor<Library> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Library> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.LIBRARY_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) Library(org.apache.asterix.metadata.entities.Library) LibraryTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.LibraryTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 14 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getFeedPolicy.

@Override
public FeedPolicyEntity getFeedPolicy(JobId jobId, String dataverse, String policyName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverse, policyName);
        FeedPolicyTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getFeedPolicyTupleTranslator(false);
        List<FeedPolicyEntity> results = new ArrayList<>();
        IValueExtractor<FeedPolicyEntity> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, searchKey, valueExtractor, results);
        if (!results.isEmpty()) {
            return results.get(0);
        }
        return null;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) FeedPolicyEntity(org.apache.asterix.metadata.entities.FeedPolicyEntity) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) FeedPolicyTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedPolicyTupleTranslator)

Example 15 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getExternalFile.

@Override
public ExternalFile getExternalFile(JobId jobId, String dataverseName, String datasetName, Integer fileNumber) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createExternalFileSearchTuple(dataverseName, datasetName, fileNumber);
        ExternalFileTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getExternalFileTupleTranslator(false);
        IValueExtractor<ExternalFile> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<ExternalFile> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.EXTERNAL_FILE_DATASET, searchKey, valueExtractor, results);
        if (results.isEmpty()) {
            return null;
        }
        return results.get(0);
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) ExternalFileTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.ExternalFileTupleTranslator) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) ExternalFile(org.apache.asterix.external.indexing.ExternalFile) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

MetadataEntityValueExtractor (org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor)27 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)27 ArrayList (java.util.ArrayList)26 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)26 ExtensionMetadataDataset (org.apache.asterix.metadata.api.ExtensionMetadataDataset)4 Dataset (org.apache.asterix.metadata.entities.Dataset)4 DatasetTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.DatasetTupleTranslator)4 Datatype (org.apache.asterix.metadata.entities.Datatype)3 DatatypeTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.DatatypeTupleTranslator)3 IIndex (org.apache.hyracks.storage.common.IIndex)3 ExternalFile (org.apache.asterix.external.indexing.ExternalFile)2 IMetadataIndex (org.apache.asterix.metadata.api.IMetadataIndex)2 DatasourceAdapter (org.apache.asterix.metadata.entities.DatasourceAdapter)2 Dataverse (org.apache.asterix.metadata.entities.Dataverse)2 Feed (org.apache.asterix.metadata.entities.Feed)2 FeedConnection (org.apache.asterix.metadata.entities.FeedConnection)2 FeedPolicyEntity (org.apache.asterix.metadata.entities.FeedPolicyEntity)2 Function (org.apache.asterix.metadata.entities.Function)2 Index (org.apache.asterix.metadata.entities.Index)2 Library (org.apache.asterix.metadata.entities.Library)2