Search in sources :

Example 1 with NodeTupleTranslator

use of org.apache.asterix.metadata.entitytupletranslators.NodeTupleTranslator in project asterixdb by apache.

the class MetadataNode method addNode.

@Override
public void addNode(JobId jobId, Node node) throws MetadataException, RemoteException {
    try {
        NodeTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getNodeTupleTranslator(true);
        ITupleReference tuple = tupleReaderWriter.getTupleFromMetadataEntity(node);
        insertTupleIntoIndex(jobId, MetadataPrimaryIndexes.NODE_DATASET, tuple);
    } catch (HyracksDataException e) {
        if (e.getComponent().equals(ErrorCode.HYRACKS) && e.getErrorCode() == ErrorCode.DUPLICATE_KEY) {
            throw new MetadataException("A node with name '" + node.getNodeName() + "' already exists.", e);
        } else {
            throw new MetadataException(e);
        }
    } catch (ACIDException e) {
        throw new MetadataException(e);
    }
}
Also used : ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) NodeTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.NodeTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) ACIDException(org.apache.asterix.common.exceptions.ACIDException)

Aggregations

ACIDException (org.apache.asterix.common.exceptions.ACIDException)1 NodeTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.NodeTupleTranslator)1 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)1