Search in sources :

Example 6 with Library

use of org.apache.asterix.metadata.entities.Library in project asterixdb by apache.

the class MetadataTransactionContext method dropLibrary.

public void dropLibrary(String dataverseName, String libraryName) {
    Library library = new Library(dataverseName, libraryName);
    droppedCache.addLibraryIfNotExists(library);
    logAndApply(new MetadataLogicalOperation(library, false));
}
Also used : Library(org.apache.asterix.metadata.entities.Library)

Example 7 with Library

use of org.apache.asterix.metadata.entities.Library in project asterixdb by apache.

the class MetadataNode method getLibrary.

@Override
public Library getLibrary(JobId jobId, String dataverseName, String libraryName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, libraryName);
        LibraryTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getLibraryTupleTranslator(false);
        List<Library> results = new ArrayList<>();
        IValueExtractor<Library> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.LIBRARY_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) 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)

Aggregations

Library (org.apache.asterix.metadata.entities.Library)7 ArrayList (java.util.ArrayList)3 ACIDException (org.apache.asterix.common.exceptions.ACIDException)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)3 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)3 IOException (java.io.IOException)2 RemoteException (java.rmi.RemoteException)2 AsterixException (org.apache.asterix.common.exceptions.AsterixException)2 ExternalLibrary (org.apache.asterix.external.library.ExternalLibrary)2 LibraryFunction (org.apache.asterix.external.library.LibraryFunction)2 MetadataTransactionContext (org.apache.asterix.metadata.MetadataTransactionContext)2 DatasourceAdapter (org.apache.asterix.metadata.entities.DatasourceAdapter)2 Dataverse (org.apache.asterix.metadata.entities.Dataverse)2 Function (org.apache.asterix.metadata.entities.Function)2 LibraryTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.LibraryTupleTranslator)2 MetadataEntityValueExtractor (org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor)2 File (java.io.File)1 FunctionSignature (org.apache.asterix.common.functions.FunctionSignature)1 AdapterIdentifier (org.apache.asterix.external.dataset.adapter.AdapterIdentifier)1 LibraryAdapter (org.apache.asterix.external.library.LibraryAdapter)1