[NO ISSUE][TXN] Fix extension datasets tuple translators
Change-Id: Ifb8a8342d0f00468e1561d91eb802c52e66b149d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2908
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDataset.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDataset.java
index d25f488..ebb9cac 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDataset.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDataset.java
@@ -29,16 +29,16 @@
private static final long serialVersionUID = 1L;
private final ExtensionMetadataDatasetId indexId;
- private final transient IMetadataEntityTupleTranslator<T> tupleTranslator;
+ private final transient IMetadataEntityTupleTranslatorFactory<T> tupleTranslatorFactory;
public ExtensionMetadataDataset(MetadataIndexImmutableProperties indexProperties, int numFields, IAType[] keyTypes,
List<List<String>> keyNames, int numSecondaryIndexKeys, ARecordType payloadType, boolean isPrimaryIndex,
int[] primaryKeyIndexes, ExtensionMetadataDatasetId indexId,
- IMetadataEntityTupleTranslator<T> tupleTranslator) {
+ IMetadataEntityTupleTranslatorFactory<T> tupleTranslatorFactory) {
super(indexProperties, numFields, keyTypes, keyNames, numSecondaryIndexKeys, payloadType, isPrimaryIndex,
primaryKeyIndexes);
this.indexId = indexId;
- this.tupleTranslator = tupleTranslator;
+ this.tupleTranslatorFactory = tupleTranslatorFactory;
}
public ExtensionMetadataDatasetId getId() {
@@ -46,6 +46,6 @@
}
public IMetadataEntityTupleTranslator<T> getTupleTranslator() {
- return tupleTranslator;
+ return tupleTranslatorFactory.createTupleTranslator();
}
}
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntityTupleTranslatorFactory.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntityTupleTranslatorFactory.java
new file mode 100644
index 0000000..e472383
--- /dev/null
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntityTupleTranslatorFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.metadata.api;
+
+import java.io.Serializable;
+
+public interface IMetadataEntityTupleTranslatorFactory<T> extends Serializable {
+
+ /**
+ * @return an instance of IMetadataEntityTupleTranslator
+ */
+ IMetadataEntityTupleTranslator<T> createTupleTranslator();
+}