You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by am...@apache.org on 2016/01/14 21:31:59 UTC
[05/26] incubator-asterixdb git commit: Feed Fixes and Cleanup
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
index d748ef8..8f4e763 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
@@ -39,7 +39,7 @@ import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Function;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.Library;
@@ -651,7 +651,8 @@ public class MetadataManager implements IMetadataManager {
}
@Override
- public void addFeedPolicy(MetadataTransactionContext mdTxnCtx, FeedPolicy feedPolicy) throws MetadataException {
+ public void addFeedPolicy(MetadataTransactionContext mdTxnCtx, FeedPolicyEntity feedPolicy)
+ throws MetadataException {
try {
metadataNode.addFeedPolicy(mdTxnCtx.getJobId(), feedPolicy);
} catch (RemoteException e) {
@@ -786,10 +787,10 @@ public class MetadataManager implements IMetadataManager {
}
@Override
- public FeedPolicy getFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName)
+ public FeedPolicyEntity getFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName)
throws MetadataException {
- FeedPolicy FeedPolicy = null;
+ FeedPolicyEntity FeedPolicy = null;
try {
FeedPolicy = metadataNode.getFeedPolicy(ctx.getJobId(), dataverse, policyName);
} catch (RemoteException e) {
@@ -844,7 +845,7 @@ public class MetadataManager implements IMetadataManager {
public void dropFeedPolicy(MetadataTransactionContext mdTxnCtx, String dataverseName, String policyName)
throws MetadataException {
- FeedPolicy feedPolicy = null;
+ FeedPolicyEntity feedPolicy = null;
try {
feedPolicy = metadataNode.getFeedPolicy(mdTxnCtx.getJobId(), dataverseName, policyName);
metadataNode.dropFeedPolicy(mdTxnCtx.getJobId(), dataverseName, policyName);
@@ -854,9 +855,9 @@ public class MetadataManager implements IMetadataManager {
mdTxnCtx.dropFeedPolicy(feedPolicy);
}
- public List<FeedPolicy> getDataversePolicies(MetadataTransactionContext mdTxnCtx, String dataverse)
+ public List<FeedPolicyEntity> getDataversePolicies(MetadataTransactionContext mdTxnCtx, String dataverse)
throws MetadataException {
- List<FeedPolicy> dataverseFeedPolicies;
+ List<FeedPolicyEntity> dataverseFeedPolicies;
try {
dataverseFeedPolicies = metadataNode.getDataversePolicies(mdTxnCtx.getJobId(), dataverse);
} catch (RemoteException e) {
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
index ce272fa..ed586aa 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
@@ -50,7 +50,7 @@ import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Function;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.InternalDatasetDetails;
@@ -364,10 +364,12 @@ public class MetadataNode implements IMetadataNode {
dropFeed(jobId, dataverseName, feed.getFeedName());
}
- List<FeedPolicy> feedPolicies = getDataversePolicies(jobId, dataverseName);
- // Drop all feed ingestion policies in this dataverse.
- for (FeedPolicy feedPolicy : feedPolicies) {
- dropFeedPolicy(jobId, dataverseName, feedPolicy.getPolicyName());
+ List<FeedPolicyEntity> feedPolicies = getDataversePolicies(jobId, dataverseName);
+ if (feedPolicies != null && feedPolicies.size() > 0) {
+ // Drop all feed ingestion policies in this dataverse.
+ for (FeedPolicyEntity feedPolicy : feedPolicies) {
+ dropFeedPolicy(jobId, dataverseName, feedPolicy.getPolicyName());
+ }
}
// Delete the dataverse entry from the 'dataverse' dataset.
@@ -1315,7 +1317,7 @@ public class MetadataNode implements IMetadataNode {
}
@Override
- public void addFeedPolicy(JobId jobId, FeedPolicy feedPolicy) throws MetadataException, RemoteException {
+ public void addFeedPolicy(JobId jobId, FeedPolicyEntity feedPolicy) throws MetadataException, RemoteException {
try {
// Insert into the 'FeedPolicy' dataset.
FeedPolicyTupleTranslator tupleReaderWriter = new FeedPolicyTupleTranslator(true);
@@ -1332,14 +1334,14 @@ public class MetadataNode implements IMetadataNode {
}
@Override
- public FeedPolicy getFeedPolicy(JobId jobId, String dataverse, String policyName)
+ public FeedPolicyEntity getFeedPolicy(JobId jobId, String dataverse, String policyName)
throws MetadataException, RemoteException {
try {
ITupleReference searchKey = createTuple(dataverse, policyName);
FeedPolicyTupleTranslator tupleReaderWriter = new FeedPolicyTupleTranslator(false);
- List<FeedPolicy> results = new ArrayList<FeedPolicy>();
- IValueExtractor<FeedPolicy> valueExtractor = new MetadataEntityValueExtractor<FeedPolicy>(
+ List<FeedPolicyEntity> results = new ArrayList<FeedPolicyEntity>();
+ IValueExtractor<FeedPolicyEntity> valueExtractor = new MetadataEntityValueExtractor<FeedPolicyEntity>(
tupleReaderWriter);
searchIndex(jobId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, searchKey, valueExtractor, results);
if (!results.isEmpty()) {
@@ -1418,14 +1420,14 @@ public class MetadataNode implements IMetadataNode {
}
@Override
- public List<FeedPolicy> getDataversePolicies(JobId jobId, String dataverse)
+ public List<FeedPolicyEntity> getDataversePolicies(JobId jobId, String dataverse)
throws MetadataException, RemoteException {
try {
ITupleReference searchKey = createTuple(dataverse);
FeedPolicyTupleTranslator tupleReaderWriter = new FeedPolicyTupleTranslator(false);
- IValueExtractor<FeedPolicy> valueExtractor = new MetadataEntityValueExtractor<FeedPolicy>(
+ IValueExtractor<FeedPolicyEntity> valueExtractor = new MetadataEntityValueExtractor<FeedPolicyEntity>(
tupleReaderWriter);
- List<FeedPolicy> results = new ArrayList<FeedPolicy>();
+ List<FeedPolicyEntity> results = new ArrayList<FeedPolicyEntity>();
searchIndex(jobId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, searchKey, valueExtractor, results);
return results;
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
index b5a689d..3d07a00 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
@@ -23,6 +23,9 @@ import java.util.ArrayList;
import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.common.transactions.JobId;
+import org.apache.asterix.external.dataset.adapter.AdapterIdentifier;
+import org.apache.asterix.external.feed.api.IFeed;
+import org.apache.asterix.external.feed.api.IFeed.FeedType;
import org.apache.asterix.metadata.api.IMetadataEntity;
import org.apache.asterix.metadata.entities.CompactionPolicy;
import org.apache.asterix.metadata.entities.Dataset;
@@ -30,15 +33,11 @@ import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.Feed.FeedType;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Function;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.Library;
import org.apache.asterix.metadata.entities.NodeGroup;
-import org.apache.asterix.metadata.entities.PrimaryFeed;
-import org.apache.asterix.metadata.entities.SecondaryFeed;
-import org.apache.asterix.metadata.feeds.AdapterIdentifier;
/**
* Used to implement serializable transactions against the MetadataCache.
@@ -223,7 +222,7 @@ public class MetadataTransactionContext extends MetadataCache {
return opLog;
}
- public void addFeedPolicy(FeedPolicy feedPolicy) {
+ public void addFeedPolicy(FeedPolicyEntity feedPolicy) {
droppedCache.dropFeedPolicy(feedPolicy);
logAndApply(new MetadataLogicalOperation(feedPolicy, true));
@@ -235,16 +234,10 @@ public class MetadataTransactionContext extends MetadataCache {
}
- public void dropFeed(String dataverseName, String feedName, FeedType feedType) {
+ public void dropFeed(String dataverseName, String feedName, IFeed.FeedType feedType) {
Feed feed = null;
- switch (feedType) {
- case PRIMARY:
- feed = new PrimaryFeed(dataverseName, feedName, null, null, null);
- break;
- case SECONDARY:
- feed = new SecondaryFeed(dataverseName, feedName, null, null);
- break;
- }
+ feed = new Feed(dataverseName, feedName, null, feedType, (feedType == FeedType.PRIMARY) ? feedName : null, null,
+ null);
droppedCache.addFeedIfNotExists(feed);
logAndApply(new MetadataLogicalOperation(feed, false));
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntity.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntity.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntity.java
index bc19f72..2fc846b 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntity.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataEntity.java
@@ -23,13 +23,13 @@ import java.io.Serializable;
import org.apache.asterix.metadata.MetadataCache;
-public interface IMetadataEntity extends Serializable {
+public interface IMetadataEntity<T> extends Serializable {
public static final int PENDING_NO_OP = 0;
public static final int PENDING_ADD_OP = 1;
public static final int PENDING_DROP_OP = 2;
- Object addToCache(MetadataCache cache);
+ public T addToCache(MetadataCache cache);
- Object dropFromCache(MetadataCache cache);
+ public T dropFromCache(MetadataCache cache);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java
index 9d85fb5..242bbe3 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java
@@ -33,7 +33,7 @@ import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Function;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.Library;
@@ -56,7 +56,6 @@ public interface IMetadataManager {
/**
* Initializes the metadata manager, e.g., finds the remote metadata node.
- *
* @throws RemoteException
* If an error occurred while contacting the proxy for finding
* the metadata node.
@@ -65,7 +64,6 @@ public interface IMetadataManager {
/**
* Begins a transaction on the metadata node.
- *
* @return A globally unique transaction id.
* @throws ACIDException
* @throws RemoteException
@@ -74,7 +72,6 @@ public interface IMetadataManager {
/**
* Commits a remote transaction on the metadata node.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @throws ACIDException
@@ -84,7 +81,6 @@ public interface IMetadataManager {
/**
* Aborts a remote transaction running on the metadata node.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @throws ACIDException
@@ -95,7 +91,6 @@ public interface IMetadataManager {
/**
* Locks the metadata in given mode. The lock acquisition is delegated to
* the metadata node. This method blocks until the lock can be acquired.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param lockMode
@@ -107,7 +102,6 @@ public interface IMetadataManager {
/**
* Releases all locks on the metadata held by the given transaction id.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @throws ACIDException
@@ -117,7 +111,6 @@ public interface IMetadataManager {
/**
* Inserts a new dataverse into the metadata.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverse
@@ -129,7 +122,6 @@ public interface IMetadataManager {
/**
* Retrieves all dataverses
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @return A list of dataverse instances.
@@ -139,7 +131,6 @@ public interface IMetadataManager {
/**
* Retrieves a dataverse with given name.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -152,7 +143,6 @@ public interface IMetadataManager {
/**
* Retrieves all datasets belonging to the given dataverse.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -167,7 +157,6 @@ public interface IMetadataManager {
/**
* Deletes the dataverse with given name, and all it's associated datasets,
* indexes, and types.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @return A list of dataset instances.
@@ -178,7 +167,6 @@ public interface IMetadataManager {
/**
* Inserts a new dataset into the metadata.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataset
@@ -190,7 +178,6 @@ public interface IMetadataManager {
/**
* Retrieves a dataset within a given dataverse.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -206,7 +193,6 @@ public interface IMetadataManager {
/**
* Retrieves all indexes of a dataset.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -222,7 +208,6 @@ public interface IMetadataManager {
/**
* Deletes the dataset with given name, and all it's associated indexes.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -238,7 +223,6 @@ public interface IMetadataManager {
/**
* Inserts an index into the metadata. The index itself knows its name, and
* which dataset it belongs to.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param index
@@ -250,7 +234,6 @@ public interface IMetadataManager {
/**
* Retrieves the index with given name, in given dataverse and dataset.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -267,7 +250,6 @@ public interface IMetadataManager {
/**
* Deletes the index with given name, in given dataverse and dataset.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -283,7 +265,6 @@ public interface IMetadataManager {
/**
* Inserts a datatype.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param datatype
@@ -295,7 +276,6 @@ public interface IMetadataManager {
/**
* Retrieves the datatype with given name in given dataverse.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -311,7 +291,6 @@ public interface IMetadataManager {
/**
* Deletes the given datatype in given dataverse.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -327,7 +306,6 @@ public interface IMetadataManager {
/**
* Inserts a node group.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param nodeGroup
@@ -339,7 +317,6 @@ public interface IMetadataManager {
/**
* Retrieves a node group.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param nodeGroupName
@@ -351,7 +328,6 @@ public interface IMetadataManager {
/**
* Deletes a node group.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param nodeGroupName
@@ -364,7 +340,6 @@ public interface IMetadataManager {
/**
* Inserts a node (machine).
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param node
@@ -490,13 +465,12 @@ public interface IMetadataManager {
*/
public void dropFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws MetadataException;
-
- /**
+ /**
* @param ctx
* @param policy
* @throws MetadataException
*/
- public void addFeedPolicy(MetadataTransactionContext ctx, FeedPolicy policy) throws MetadataException;
+ public void addFeedPolicy(MetadataTransactionContext ctx, FeedPolicyEntity policy) throws MetadataException;
/**
* @param ctx
@@ -505,10 +479,9 @@ public interface IMetadataManager {
* @return
* @throws MetadataException
*/
- public FeedPolicy getFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName)
+ public FeedPolicyEntity getFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName)
throws MetadataException;
-
public void initializeDatasetIdFactory(MetadataTransactionContext ctx) throws MetadataException;
public int getMostRecentDatasetId() throws MetadataException;
@@ -524,7 +497,6 @@ public interface IMetadataManager {
/**
* Removes a library , acquiring local locks on behalf of the given
* transaction id.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -540,7 +512,6 @@ public interface IMetadataManager {
/**
* Adds a library, acquiring local locks on behalf of the given
* transaction id.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param library
@@ -567,7 +538,6 @@ public interface IMetadataManager {
/**
* Retireve libraries installed in a given dataverse.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataverseName
@@ -624,7 +594,6 @@ public interface IMetadataManager {
/**
* Get en external file
- *
* @param mdTxnCtx
* @param dataverseName
* @param datasetName
@@ -637,7 +606,6 @@ public interface IMetadataManager {
/**
* update an existing dataset in metadata.
- *
* @param ctx
* MetadataTransactionContext of an active metadata transaction.
* @param dataset
@@ -649,7 +617,6 @@ public interface IMetadataManager {
/**
* Clean up temporary datasets that have not been active for a long time.
- *
* @throws MetadataException
*/
public void cleanupTempDatasets() throws MetadataException;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java
index 59a8f76..0d8818d 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java
@@ -35,7 +35,7 @@ import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Function;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.Library;
@@ -557,7 +557,7 @@ public interface IMetadataNode extends Remote, Serializable {
* @throws MetadataException
* @throws RemoteException
*/
- public void addFeedPolicy(JobId jobId, FeedPolicy feedPolicy) throws MetadataException, RemoteException;
+ public void addFeedPolicy(JobId jobId, FeedPolicyEntity feedPolicy) throws MetadataException, RemoteException;
/**
* @param jobId
@@ -567,7 +567,7 @@ public interface IMetadataNode extends Remote, Serializable {
* @throws MetadataException
* @throws RemoteException
*/
- public FeedPolicy getFeedPolicy(JobId jobId, String dataverse, String policy) throws MetadataException,
+ public FeedPolicyEntity getFeedPolicy(JobId jobId, String dataverse, String policy) throws MetadataException,
RemoteException;
@@ -658,7 +658,7 @@ public interface IMetadataNode extends Remote, Serializable {
* @throws MetadataException
* @throws RemoteException
*/
- public List<FeedPolicy> getDataversePolicies(JobId jobId, String dataverse) throws MetadataException,
+ public List<FeedPolicyEntity> getDataversePolicies(JobId jobId, String dataverse) throws MetadataException,
RemoteException;
/**
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index ab0b79d..aa7f7d5 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.asterix.metadata.bootstrap;
import java.io.File;
@@ -37,14 +36,16 @@ import org.apache.asterix.common.config.AsterixMetadataProperties;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.GlobalConfig;
import org.apache.asterix.common.config.IAsterixPropertiesProvider;
+import org.apache.asterix.common.config.MetadataConstants;
import org.apache.asterix.common.context.BaseOperationTracker;
import org.apache.asterix.common.context.CorrelatedPrefixMergePolicyFactory;
import org.apache.asterix.common.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
+import org.apache.asterix.common.utils.StoragePathUtil;
import org.apache.asterix.external.adapter.factory.GenericAdapterFactory;
import org.apache.asterix.external.api.IAdapterFactory;
+import org.apache.asterix.external.api.IDataSourceAdapter;
+import org.apache.asterix.external.dataset.adapter.AdapterIdentifier;
import org.apache.asterix.external.indexing.ExternalFile;
-import org.apache.asterix.external.runtime.GenericSocketFeedAdapterFactory;
-import org.apache.asterix.external.runtime.SocketClientAdapterFactory;
import org.apache.asterix.metadata.IDatasetDetails;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.MetadataManager;
@@ -57,16 +58,14 @@ import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.DatasourceAdapter;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.InternalDatasetDetails;
import org.apache.asterix.metadata.entities.InternalDatasetDetails.FileStructure;
import org.apache.asterix.metadata.entities.InternalDatasetDetails.PartitioningStrategy;
import org.apache.asterix.metadata.entities.Node;
import org.apache.asterix.metadata.entities.NodeGroup;
-import org.apache.asterix.metadata.feeds.AdapterIdentifier;
import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies;
-import org.apache.asterix.metadata.utils.SplitsAndConstraintsUtil;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.util.AsterixClusterProperties;
@@ -105,7 +104,7 @@ import org.apache.hyracks.storage.common.file.LocalResource;
*/
public class MetadataBootstrap {
private static final Logger LOGGER = Logger.getLogger(MetadataBootstrap.class.getName());
- public static final boolean IS_DEBUG_MODE = false;//true
+ public static final boolean IS_DEBUG_MODE = false;// true
private static IAsterixAppRuntimeContext runtimeContext;
@@ -193,7 +192,7 @@ public class MetadataBootstrap {
}
}
- //#. initialize datasetIdFactory
+ // #. initialize datasetIdFactory
MetadataManager.INSTANCE.initializeDatasetIdFactory(mdTxnCtx);
MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
} catch (Exception e) {
@@ -204,8 +203,8 @@ public class MetadataBootstrap {
MetadataManager.INSTANCE.abortTransaction(mdTxnCtx);
} catch (Exception e2) {
e.addSuppressed(e2);
- //TODO
- //change the exception type to AbortFailureException
+ // TODO
+ // change the exception type to AbortFailureException
throw new MetadataException(e);
}
throw e;
@@ -278,8 +277,8 @@ public class MetadataBootstrap {
// Map.Entry<String, String[]> me = (Map.Entry<String,
// String[]>)im.next();
MetadataManager.INSTANCE.addNode(mdTxnCtx, new Node(iter.next(), 0, 0/*
- * , me . getValue ( )
- */));
+ * , me . getValue ( )
+ */));
}
}
@@ -298,8 +297,7 @@ public class MetadataBootstrap {
}
private static void insertInitialAdapters(MetadataTransactionContext mdTxnCtx) throws Exception {
- String[] builtInAdapterClassNames = new String[] { GenericAdapterFactory.class.getName(),
- GenericSocketFeedAdapterFactory.class.getName(), SocketClientAdapterFactory.class.getName() };
+ String[] builtInAdapterClassNames = new String[] { GenericAdapterFactory.class.getName() };
DatasourceAdapter adapter;
for (String adapterClassName : builtInAdapterClassNames) {
adapter = getAdapter(adapterClassName);
@@ -311,7 +309,7 @@ public class MetadataBootstrap {
}
private static void insertInitialFeedPolicies(MetadataTransactionContext mdTxnCtx) throws Exception {
- for (FeedPolicy feedPolicy : BuiltinFeedPolicies.policies) {
+ for (FeedPolicyEntity feedPolicy : BuiltinFeedPolicies.policies) {
MetadataManager.INSTANCE.addFeedPolicy(mdTxnCtx, feedPolicy);
}
if (LOGGER.isLoggable(Level.INFO)) {
@@ -333,7 +331,7 @@ public class MetadataBootstrap {
private static DatasourceAdapter getAdapter(String adapterFactoryClassName) throws Exception {
String adapterName = ((IAdapterFactory) (Class.forName(adapterFactoryClassName).newInstance())).getAlias();
return new DatasourceAdapter(new AdapterIdentifier(MetadataConstants.METADATA_DATAVERSE_NAME, adapterName),
- adapterFactoryClassName, DatasourceAdapter.AdapterType.INTERNAL);
+ adapterFactoryClassName, IDataSourceAdapter.AdapterType.INTERNAL);
}
private static CompactionPolicy getCompactionPolicyEntity(String compactionPolicyClassName) throws Exception {
@@ -346,7 +344,7 @@ public class MetadataBootstrap {
throws Exception {
ClusterPartition metadataPartition = propertiesProvider.getMetadataProperties().getMetadataPartition();
int metadataDeviceId = metadataPartition.getIODeviceNum();
- String metadataPartitionPath = SplitsAndConstraintsUtil.prepareStoragePartitionPath(
+ String metadataPartitionPath = StoragePathUtil.prepareStoragePartitionPath(
AsterixClusterProperties.INSTANCE.getStorageDirectoryName(), metadataPartition.getPartitionId());
String resourceName = metadataPartitionPath + File.separator + index.getFileNameRelativePath();
FileReference file = ioManager.getAbsoluteFileRef(metadataDeviceId, resourceName);
@@ -413,8 +411,8 @@ public class MetadataBootstrap {
}
public static void startDDLRecovery() throws MetadataException {
- //#. clean up any record which has pendingAdd/DelOp flag
- // as traversing all records from DATAVERSE_DATASET to DATASET_DATASET, and then to INDEX_DATASET.
+ // #. clean up any record which has pendingAdd/DelOp flag
+ // as traversing all records from DATAVERSE_DATASET to DATASET_DATASET, and then to INDEX_DATASET.
String dataverseName = null;
String datasetName = null;
String indexName = null;
@@ -433,7 +431,7 @@ public class MetadataBootstrap {
for (Dataverse dataverse : dataverses) {
dataverseName = dataverse.getDataverseName();
if (dataverse.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
- //drop pending dataverse
+ // drop pending dataverse
MetadataManager.INSTANCE.dropDataverse(mdTxnCtx, dataverseName);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Dropped a pending dataverse: " + dataverseName);
@@ -443,7 +441,7 @@ public class MetadataBootstrap {
for (Dataset dataset : datasets) {
datasetName = dataset.getDatasetName();
if (dataset.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
- //drop pending dataset
+ // drop pending dataset
MetadataManager.INSTANCE.dropDataset(mdTxnCtx, dataverseName, datasetName);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Dropped a pending dataset: " + dataverseName + "." + datasetName);
@@ -454,7 +452,7 @@ public class MetadataBootstrap {
for (Index index : indexes) {
indexName = index.getIndexName();
if (index.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
- //drop pending index
+ // drop pending index
MetadataManager.INSTANCE.dropIndex(mdTxnCtx, dataverseName, datasetName, indexName);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Dropped a pending index: " + dataverseName + "." + datasetName
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataConstants.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataConstants.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataConstants.java
deleted file mode 100644
index a68ea81..0000000
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.bootstrap;
-
-public class MetadataConstants {
-
- // Name of the dataverse the metadata lives in.
- public final static String METADATA_DATAVERSE_NAME = "Metadata";
-
- // Name of the node group where metadata is stored on.
- public final static String METADATA_NODEGROUP_NAME = "MetadataGroup";
-
- // Name of the default nodegroup where internal/feed datasets will be partitioned
- // if an explicit nodegroup is not specified at the time of creation of a dataset
- public static final String METADATA_DEFAULT_NODEGROUP_NAME = "DEFAULT_NG_ALL_NODES";
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
index 9ef9f84..2d5e663 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.asterix.common.config.MetadataConstants;
import org.apache.asterix.common.exceptions.AsterixRuntimeException;
import org.apache.asterix.common.transactions.DatasetId;
import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndexImmutableProperties.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndexImmutableProperties.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndexImmutableProperties.java
index 129bc0c..91d25b3 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndexImmutableProperties.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndexImmutableProperties.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.metadata.bootstrap;
+import org.apache.asterix.common.config.MetadataConstants;
+
public enum MetadataIndexImmutableProperties {
METADATA(MetadataConstants.METADATA_DATAVERSE_NAME, 0, 0),
DATAVERSE("Dataverse", 1, 1),
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
index ce22177..cff5c6b 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.asterix.metadata.declared;
import java.io.File;
@@ -34,6 +33,7 @@ import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.config.GlobalConfig;
+import org.apache.asterix.common.config.MetadataConstants;
import org.apache.asterix.common.context.AsterixVirtualBufferCacheProvider;
import org.apache.asterix.common.context.ITransactionSubsystemProvider;
import org.apache.asterix.common.context.TransactionSubsystemProvider;
@@ -41,27 +41,32 @@ import org.apache.asterix.common.dataflow.AsterixLSMInvertedIndexInsertDeleteOpe
import org.apache.asterix.common.dataflow.AsterixLSMTreeInsertDeleteOperatorDescriptor;
import org.apache.asterix.common.dataflow.IAsterixApplicationContextInfo;
import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.feeds.FeedActivity;
-import org.apache.asterix.common.feeds.FeedActivity.FeedActivityDetails;
-import org.apache.asterix.common.feeds.FeedConnectionId;
-import org.apache.asterix.common.feeds.FeedConstants;
-import org.apache.asterix.common.feeds.FeedPolicyAccessor;
-import org.apache.asterix.common.feeds.api.ICentralFeedManager;
import org.apache.asterix.common.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
import org.apache.asterix.common.ioopcallbacks.LSMBTreeWithBuddyIOOperationCallbackFactory;
import org.apache.asterix.common.ioopcallbacks.LSMInvertedIndexIOOperationCallbackFactory;
import org.apache.asterix.common.ioopcallbacks.LSMRTreeIOOperationCallbackFactory;
import org.apache.asterix.common.transactions.IRecoveryManager.ResourceType;
import org.apache.asterix.common.transactions.JobId;
+import org.apache.asterix.common.utils.StoragePathUtil;
import org.apache.asterix.dataflow.data.nontagged.valueproviders.AqlPrimitiveValueProviderFactory;
import org.apache.asterix.external.adapter.factory.LookupAdapterFactory;
import org.apache.asterix.external.api.IAdapterFactory;
+import org.apache.asterix.external.api.IDataSourceAdapter;
+import org.apache.asterix.external.feed.api.ICentralFeedManager;
+import org.apache.asterix.external.feed.management.FeedConnectionId;
+import org.apache.asterix.external.feed.policy.FeedPolicyAccessor;
+import org.apache.asterix.external.feed.watch.FeedActivity;
+import org.apache.asterix.external.feed.watch.FeedActivity.FeedActivityDetails;
import org.apache.asterix.external.indexing.ExternalFile;
import org.apache.asterix.external.indexing.IndexingConstants;
import org.apache.asterix.external.operators.ExternalBTreeSearchOperatorDescriptor;
+import org.apache.asterix.external.operators.ExternalDataScanOperatorDescriptor;
import org.apache.asterix.external.operators.ExternalLookupOperatorDescriptor;
import org.apache.asterix.external.operators.ExternalRTreeSearchOperatorDescriptor;
+import org.apache.asterix.external.operators.FeedCollectOperatorDescriptor;
+import org.apache.asterix.external.operators.FeedIntakeOperatorDescriptor;
import org.apache.asterix.external.provider.AdapterFactoryProvider;
+import org.apache.asterix.external.util.FeedConstants;
import org.apache.asterix.formats.base.IDataFormat;
import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
import org.apache.asterix.formats.nontagged.AqlLinearizeComparatorFactoryProvider;
@@ -69,25 +74,19 @@ import org.apache.asterix.formats.nontagged.AqlTypeTraitProvider;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.MetadataTransactionContext;
-import org.apache.asterix.metadata.bootstrap.MetadataConstants;
import org.apache.asterix.metadata.dataset.hints.DatasetHints.DatasetCardinalityHint;
import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.DatasourceAdapter;
-import org.apache.asterix.metadata.entities.DatasourceAdapter.AdapterType;
import org.apache.asterix.metadata.entities.Datatype;
import org.apache.asterix.metadata.entities.Dataverse;
import org.apache.asterix.metadata.entities.ExternalDatasetDetails;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.metadata.entities.PrimaryFeed;
import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies;
-import org.apache.asterix.metadata.feeds.ExternalDataScanOperatorDescriptor;
-import org.apache.asterix.metadata.feeds.FeedCollectOperatorDescriptor;
-import org.apache.asterix.metadata.feeds.FeedIntakeOperatorDescriptor;
-import org.apache.asterix.metadata.feeds.FeedUtil;
+import org.apache.asterix.metadata.feeds.FeedMetadataUtil;
import org.apache.asterix.metadata.utils.DatasetUtils;
import org.apache.asterix.metadata.utils.ExternalDatasetsRegistry;
import org.apache.asterix.metadata.utils.SplitsAndConstraintsUtil;
@@ -388,7 +387,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
.getSerializerDeserializer(feedOutputType);
RecordDescriptor feedDesc = new RecordDescriptor(new ISerializerDeserializer[] { payloadSerde });
- FeedPolicy feedPolicy = (FeedPolicy) ((AqlDataSource) dataSource).getProperties()
+ FeedPolicyEntity feedPolicy = (FeedPolicyEntity) ((AqlDataSource) dataSource).getProperties()
.get(BuiltinFeedPolicies.CONFIG_FEED_POLICY_KEY);
if (feedPolicy == null) {
throw new AlgebricksException("Feed not configured with a policy");
@@ -560,7 +559,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
}
}
// TODO Check this call, result of merge from master!
- // ((IGenericAdapterFactory) adapterFactory).setFiles(files);
+ // ((IGenericAdapterFactory) adapterFactory).setFiles(files);
}
return adapterFactory;
@@ -594,9 +593,9 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
}
public Triple<IOperatorDescriptor, AlgebricksPartitionConstraint, IAdapterFactory> buildFeedIntakeRuntime(
- JobSpecification jobSpec, PrimaryFeed primaryFeed, FeedPolicyAccessor policyAccessor) throws Exception {
- Triple<IAdapterFactory, ARecordType, AdapterType> factoryOutput = null;
- factoryOutput = FeedUtil.getPrimaryFeedFactoryAndOutput(primaryFeed, policyAccessor, mdTxnCtx);
+ JobSpecification jobSpec, Feed primaryFeed, FeedPolicyAccessor policyAccessor) throws Exception {
+ Triple<IAdapterFactory, ARecordType, IDataSourceAdapter.AdapterType> factoryOutput = null;
+ factoryOutput = FeedMetadataUtil.getPrimaryFeedFactoryAndOutput(primaryFeed, policyAccessor, mdTxnCtx);
IAdapterFactory adapterFactory = factoryOutput.first;
FeedIntakeOperatorDescriptor feedIngestor = null;
switch (factoryOutput.third) {
@@ -605,7 +604,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
factoryOutput.second, policyAccessor);
break;
case EXTERNAL:
- String libraryName = primaryFeed.getAdaptorName().trim()
+ String libraryName = primaryFeed.getAdapterName().trim()
.split(FeedConstants.NamingConstants.LIBRARY_NAME_SEPARATOR)[0];
feedIngestor = new FeedIntakeOperatorDescriptor(jobSpec, primaryFeed, libraryName,
adapterFactory.getClass().getName(), factoryOutput.second, policyAccessor);
@@ -2084,7 +2083,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
public Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitProviderAndPartitionConstraintsForDataset(
String dataverseName, String datasetName, String targetIdxName, boolean temp) throws AlgebricksException {
FileSplit[] splits = splitsForDataset(mdTxnCtx, dataverseName, datasetName, targetIdxName, temp);
- return SplitsAndConstraintsUtil.splitProviderAndPartitionConstraints(splits);
+ return StoragePathUtil.splitProviderAndPartitionConstraints(splits);
}
public Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitProviderAndPartitionConstraintsForDataverse(
@@ -2140,7 +2139,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
}
}
- public FeedPolicy findFeedPolicy(String dataverse, String policyName) throws AlgebricksException {
+ public FeedPolicyEntity findFeedPolicy(String dataverse, String policyName) throws AlgebricksException {
try {
return MetadataManager.INSTANCE.getFeedPolicy(mdTxnCtx, dataverse, policyName);
} catch (MetadataException e) {
@@ -2193,7 +2192,8 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId, Strin
itemType = MetadataManager.INSTANCE.getDatatype(metadataProvider.getMetadataTxnContext(),
dataset.getDataverseName(), dataset.getItemTypeName()).getDatatype();
- // Create the adapter factory <- right now there is only one. if there are more in the future, we can create a map->
+ // Create the adapter factory <- right now there is only one. if there are more in the future, we can create
+ // a map->
ExternalDatasetDetails datasetDetails = (ExternalDatasetDetails) dataset.getDatasetDetails();
LookupAdapterFactory<?> adapterFactory = AdapterFactoryProvider.getAdapterFactory(
datasetDetails.getProperties(), (ARecordType) itemType, ridIndexes, retainInput, retainNull,
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
index 2e603f1..6f540df 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
@@ -18,12 +18,12 @@
*/
package org.apache.asterix.metadata.declared;
-import org.apache.asterix.common.feeds.FeedId;
-import org.apache.asterix.common.feeds.api.IFeedLifecycleListener.ConnectionLocation;
+import org.apache.asterix.external.feed.api.IFeed;
+import org.apache.asterix.external.feed.api.IFeedLifecycleListener.ConnectionLocation;
+import org.apache.asterix.external.feed.management.FeedId;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.MetadataTransactionContext;
import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.metadata.entities.Feed.FeedType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.util.AsterixClusterProperties;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -33,14 +33,14 @@ public class FeedDataSource extends AqlDataSource {
private Feed feed;
private final FeedId sourceFeedId;
- private final FeedType sourceFeedType;
+ private final IFeed.FeedType sourceFeedType;
private final ConnectionLocation location;
private final String targetDataset;
private final String[] locations;
private final int computeCardinality;
public FeedDataSource(AqlSourceId id, String targetDataset, IAType itemType, AqlDataSourceType dataSourceType,
- FeedId sourceFeedId, FeedType sourceFeedType, ConnectionLocation location, String[] locations)
+ FeedId sourceFeedId, IFeed.FeedType sourceFeedType, ConnectionLocation location, String[] locations)
throws AlgebricksException {
super(id, itemType, dataSourceType);
this.targetDataset = targetDataset;
@@ -75,6 +75,11 @@ public class FeedDataSource extends AqlDataSource {
return feed;
}
+ @Override
+ public IAType[] getSchemaTypes() {
+ return schemaTypes;
+ }
+
public String getTargetDataset() {
return targetDataset;
}
@@ -108,7 +113,7 @@ public class FeedDataSource extends AqlDataSource {
domain = domainForExternalData;
}
- public FeedType getSourceFeedType() {
+ public IFeed.FeedType getSourceFeedType() {
return sourceFeedType;
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/CompactionPolicy.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/CompactionPolicy.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/CompactionPolicy.java
index 39654e9..d71663a 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/CompactionPolicy.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/CompactionPolicy.java
@@ -25,7 +25,7 @@ import org.apache.asterix.metadata.api.IMetadataEntity;
/**
* Metadata describing a compaction policy record.
*/
-public class CompactionPolicy implements IMetadataEntity {
+public class CompactionPolicy implements IMetadataEntity<CompactionPolicy> {
private static final long serialVersionUID = 1L;
@@ -71,12 +71,12 @@ public class CompactionPolicy implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public CompactionPolicy addToCache(MetadataCache cache) {
return cache.addCompactionPolicyIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public CompactionPolicy dropFromCache(MetadataCache cache) {
return cache.dropCompactionPolicy(this);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java
index ae4c742..32456ae 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java
@@ -29,7 +29,7 @@ import org.apache.asterix.metadata.api.IMetadataEntity;
/**
* Metadata describing a dataset.
*/
-public class Dataset implements IMetadataEntity {
+public class Dataset implements IMetadataEntity<Dataset> {
private static final long serialVersionUID = 1L;
@@ -122,12 +122,12 @@ public class Dataset implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Dataset addToCache(MetadataCache cache) {
return cache.addDatasetIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Dataset dropFromCache(MetadataCache cache) {
return cache.dropDataset(this);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/DatasourceAdapter.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/DatasourceAdapter.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/DatasourceAdapter.java
index ac98fb0..5a85327 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/DatasourceAdapter.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/DatasourceAdapter.java
@@ -18,19 +18,15 @@
*/
package org.apache.asterix.metadata.entities;
+import org.apache.asterix.external.api.IDataSourceAdapter.AdapterType;
+import org.apache.asterix.external.dataset.adapter.AdapterIdentifier;
import org.apache.asterix.metadata.MetadataCache;
import org.apache.asterix.metadata.api.IMetadataEntity;
-import org.apache.asterix.metadata.feeds.AdapterIdentifier;
-public class DatasourceAdapter implements IMetadataEntity {
+public class DatasourceAdapter implements IMetadataEntity<DatasourceAdapter> {
private static final long serialVersionUID = 1L;
- public enum AdapterType {
- INTERNAL,
- EXTERNAL
- }
-
private final AdapterIdentifier adapterIdentifier;
private final String classname;
private final AdapterType type;
@@ -42,12 +38,12 @@ public class DatasourceAdapter implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public DatasourceAdapter addToCache(MetadataCache cache) {
return cache.addAdapterIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public DatasourceAdapter dropFromCache(MetadataCache cache) {
return cache.dropAdapter(this);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Datatype.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Datatype.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Datatype.java
index 73015df..0580756 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Datatype.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Datatype.java
@@ -26,7 +26,7 @@ import org.apache.asterix.om.types.IAType;
/**
* Metadata describing a datatype.
*/
-public class Datatype implements IMetadataEntity {
+public class Datatype implements IMetadataEntity<Datatype> {
private static final long serialVersionUID = 1L;
@@ -60,12 +60,12 @@ public class Datatype implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Datatype addToCache(MetadataCache cache) {
return cache.addDatatypeIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Datatype dropFromCache(MetadataCache cache) {
return cache.dropDatatype(this);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataverse.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataverse.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataverse.java
index ef315f4..467e6f5 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataverse.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataverse.java
@@ -25,7 +25,7 @@ import org.apache.asterix.metadata.api.IMetadataEntity;
/**
* Metadata describing a dataverse.
*/
-public class Dataverse implements IMetadataEntity {
+public class Dataverse implements IMetadataEntity<Dataverse> {
private static final long serialVersionUID = 1L;
// Enforced to be unique within an Asterix cluster..
@@ -52,12 +52,12 @@ public class Dataverse implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Dataverse addToCache(MetadataCache cache) {
return cache.addDataverseIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Dataverse dropFromCache(MetadataCache cache) {
return cache.dropDataverse(this);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Feed.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Feed.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Feed.java
index 5419dfa..58aa622 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Feed.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Feed.java
@@ -19,66 +19,68 @@
package org.apache.asterix.metadata.entities;
-import org.apache.asterix.common.feeds.FeedId;
+import java.util.Map;
+
import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.external.feed.api.IFeed;
+import org.apache.asterix.external.feed.management.FeedId;
import org.apache.asterix.metadata.MetadataCache;
import org.apache.asterix.metadata.api.IMetadataEntity;
/**
* Feed POJO
*/
-public class Feed implements IMetadataEntity {
-
+public class Feed implements IMetadataEntity<Feed>, IFeed {
private static final long serialVersionUID = 1L;
/** A unique identifier for the feed */
- protected final FeedId feedId;
-
+ private FeedId feedId;
/** The function that is to be applied on each incoming feed tuple **/
- protected final FunctionSignature appliedFunction;
-
+ private FunctionSignature appliedFunction;
/** The type {@code FeedType} associated with the feed. **/
- protected final FeedType feedType;
-
+ private IFeed.FeedType feedType;
/** A string representation of the instance **/
- protected final String displayName;
-
- public enum FeedType {
- /**
- * A feed that derives its data from an external source.
- */
- PRIMARY,
-
- /**
- * A feed that derives its data from another primary or secondary feed.
- */
- SECONDARY
- }
-
- public Feed(String dataverseName, String datasetName, FunctionSignature appliedFunction, FeedType feedType) {
- this.feedId = new FeedId(dataverseName, datasetName);
+ private String displayName;
+ /** A string representation of the adapter name **/
+ private String adapterName;
+ /** Adapter configuration */
+ private Map<String, String> adapterConfiguration;
+ /** Source primary feed */
+ private String sourceFeedName;
+
+ public Feed(String dataverseName, String feedName, FunctionSignature appliedFunction, IFeed.FeedType feedType,
+ String sourceFeedName, String adapterName, Map<String, String> configuration) {
+ this.feedId = new FeedId(dataverseName, feedName);
this.appliedFunction = appliedFunction;
this.feedType = feedType;
this.displayName = feedType + "(" + feedId + ")";
+ this.adapterName = adapterName;
+ this.adapterConfiguration = configuration;
+ this.sourceFeedName = sourceFeedName;
}
+ @Override
public FeedId getFeedId() {
return feedId;
}
+ @Override
public String getDataverseName() {
return feedId.getDataverse();
}
+ @Override
public String getFeedName() {
return feedId.getFeedName();
}
+ @Override
public FunctionSignature getAppliedFunction() {
return appliedFunction;
}
- public FeedType getFeedType() {
+ @Override
+ public IFeed.FeedType getFeedType() {
return feedType;
}
@@ -105,12 +107,26 @@ public class Feed implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Feed addToCache(MetadataCache cache) {
return cache.addFeedIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Feed dropFromCache(MetadataCache cache) {
return cache.dropFeed(this);
}
+
+ @Override
+ public String getAdapterName() {
+ return adapterName;
+ }
+
+ @Override
+ public Map<String, String> getAdapterConfiguration() {
+ return adapterConfiguration;
+ }
+
+ public String getSourceFeedName() {
+ return sourceFeedName;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicy.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicy.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicy.java
deleted file mode 100644
index 4c2fe23..0000000
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicy.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.entities;
-
-import java.util.Map;
-
-import org.apache.asterix.metadata.MetadataCache;
-import org.apache.asterix.metadata.api.IMetadataEntity;
-
-/**
- * Metadata describing a feed activity record.
- */
-public class FeedPolicy implements IMetadataEntity {
-
- private static final long serialVersionUID = 1L;
-
- private final String dataverseName;
- // Enforced to be unique within a dataverse.
- private final String policyName;
- // A description of the policy
- private final String description;
- // The policy properties associated with the feed dataset
- private Map<String, String> properties;
-
- public FeedPolicy(String dataverseName, String policyName, String description, Map<String, String> properties) {
- this.dataverseName = dataverseName;
- this.policyName = policyName;
- this.description = description;
- this.properties = properties;
- }
-
- public String getDataverseName() {
- return dataverseName;
- }
-
- public String getPolicyName() {
- return policyName;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
- if (!(other instanceof FeedPolicy)) {
- return false;
- }
- FeedPolicy otherPolicy = (FeedPolicy) other;
- if (!otherPolicy.dataverseName.equals(dataverseName)) {
- return false;
- }
- if (!otherPolicy.policyName.equals(policyName)) {
- return false;
- }
- return true;
- }
-
- @Override
- public Object addToCache(MetadataCache cache) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Object dropFromCache(MetadataCache cache) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicyEntity.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicyEntity.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicyEntity.java
new file mode 100644
index 0000000..76f704a
--- /dev/null
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/FeedPolicyEntity.java
@@ -0,0 +1,49 @@
+/*
+ * 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.entities;
+
+import java.util.Map;
+
+import org.apache.asterix.external.feed.policy.FeedPolicy;
+import org.apache.asterix.metadata.MetadataCache;
+import org.apache.asterix.metadata.api.IMetadataEntity;
+
+/**
+ * Metadata describing a feed activity record.
+ */
+public class FeedPolicyEntity extends FeedPolicy implements IMetadataEntity<FeedPolicyEntity> {
+
+ public FeedPolicyEntity(String dataverseName, String policyName, String description,
+ Map<String, String> properties) {
+ super(dataverseName, policyName, description, properties);
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public FeedPolicyEntity addToCache(MetadataCache cache) {
+ return null;
+ }
+
+ @Override
+ public FeedPolicyEntity dropFromCache(MetadataCache cache) {
+ return null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Function.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Function.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Function.java
index cf7a95c..7ff423c 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Function.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Function.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.asterix.metadata.MetadataCache;
import org.apache.asterix.metadata.api.IMetadataEntity;
-public class Function implements IMetadataEntity {
+public class Function implements IMetadataEntity<Function> {
private static final long serialVersionUID = 1L;
public static final String LANGUAGE_AQL = "AQL";
public static final String LANGUAGE_JAVA = "JAVA";
@@ -85,12 +85,12 @@ public class Function implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Function addToCache(MetadataCache cache) {
return cache.addFunctionIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Function dropFromCache(MetadataCache cache) {
return cache.dropFunction(this);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
index 3c0feb9..6d047a2 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
@@ -35,7 +35,7 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
/**
* Metadata describing an index.
*/
-public class Index implements IMetadataEntity, Comparable<Index> {
+public class Index implements IMetadataEntity<Index>, Comparable<Index> {
private static final long serialVersionUID = 1L;
@@ -202,12 +202,12 @@ public class Index implements IMetadataEntity, Comparable<Index> {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Index addToCache(MetadataCache cache) {
return cache.addIndexIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Index dropFromCache(MetadataCache cache) {
return cache.dropIndex(this);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Library.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Library.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Library.java
index 277fdc1..8ffc266 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Library.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Library.java
@@ -21,7 +21,7 @@ package org.apache.asterix.metadata.entities;
import org.apache.asterix.metadata.MetadataCache;
import org.apache.asterix.metadata.api.IMetadataEntity;
-public class Library implements IMetadataEntity {
+public class Library implements IMetadataEntity<Library> {
private static final long serialVersionUID = 1L;
@@ -42,12 +42,12 @@ public class Library implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public Library addToCache(MetadataCache cache) {
return cache.addLibraryIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public Library dropFromCache(MetadataCache cache) {
return cache.dropLibrary(this);
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/NodeGroup.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/NodeGroup.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/NodeGroup.java
index 8ef04e2..e5088aa 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/NodeGroup.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/NodeGroup.java
@@ -27,7 +27,7 @@ import org.apache.asterix.metadata.api.IMetadataEntity;
/**
* Metadata describing a named group of compute nodes.
*/
-public class NodeGroup implements IMetadataEntity {
+public class NodeGroup implements IMetadataEntity<NodeGroup> {
private static final long serialVersionUID = 1L;
@@ -49,12 +49,12 @@ public class NodeGroup implements IMetadataEntity {
}
@Override
- public Object addToCache(MetadataCache cache) {
+ public NodeGroup addToCache(MetadataCache cache) {
return cache.addNodeGroupIfNotExists(this);
}
@Override
- public Object dropFromCache(MetadataCache cache) {
+ public NodeGroup dropFromCache(MetadataCache cache) {
return cache.dropNodeGroup(this);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/PrimaryFeed.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/PrimaryFeed.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/PrimaryFeed.java
deleted file mode 100644
index c70a210..0000000
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/PrimaryFeed.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.entities;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.asterix.common.functions.FunctionSignature;
-import org.apache.asterix.metadata.api.IMetadataEntity;
-
-/**
- * A primary feed is one that derives its data from an external source via an adaptor.
- * This class is a holder object for the metadata associated with a primary feed.
- */
-public class PrimaryFeed extends Feed implements IMetadataEntity {
-
- private static final long serialVersionUID = 1L;
-
- private final String adaptorName;
- private final Map<String, String> adaptorConfiguration;
-
- public PrimaryFeed(String dataverseName, String datasetName, String adaptorName,
- Map<String, String> adaptorConfiguration, FunctionSignature appliedFunction) {
- super(dataverseName, datasetName, appliedFunction, FeedType.PRIMARY);
- this.adaptorName = adaptorName;
- this.adaptorConfiguration = adaptorConfiguration;
- }
-
- public String getAdaptorName() {
- return adaptorName;
- }
-
- public Map<String, String> getAdaptorConfiguration() {
- return adaptorConfiguration;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
- if (!super.equals(other) || !(other instanceof PrimaryFeed)) {
- return false;
- }
-
- PrimaryFeed otherFeed = (PrimaryFeed) other;
- if (!otherFeed.getAdaptorName().equals(adaptorName)) {
- return false;
- }
-
- for (Entry<String, String> entry : adaptorConfiguration.entrySet()) {
- if (!(entry.getValue().equals(otherFeed.getAdaptorConfiguration().get(entry.getKey())))) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "PrimaryFeed (" + adaptorName + ")";
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/SecondaryFeed.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/SecondaryFeed.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/SecondaryFeed.java
deleted file mode 100644
index caa633a..0000000
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/SecondaryFeed.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.entities;
-
-import org.apache.asterix.common.functions.FunctionSignature;
-import org.apache.asterix.metadata.api.IMetadataEntity;
-
-/**
- * A secondary feed is one that derives its data from another (primary/secondary) feed.
- * This class is a holder object for the metadata associated with a secondary feed.
- */
-public class SecondaryFeed extends Feed implements IMetadataEntity {
-
- private static final long serialVersionUID = 1L;
-
- private final String sourceFeedName;
-
- public SecondaryFeed(String dataverseName, String feedName, String sourceFeedName, FunctionSignature appliedFunction) {
- super(dataverseName, feedName, appliedFunction, FeedType.SECONDARY);
- this.sourceFeedName = sourceFeedName;
- }
-
- public String getSourceFeedName() {
- return sourceFeedName;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
- if (!super.equals(other) || !(other instanceof SecondaryFeed)) {
- return false;
- }
-
- SecondaryFeed otherFeed = (SecondaryFeed) other;
- if (!otherFeed.getSourceFeedName().equals(sourceFeedName)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "SecondaryFeed (" + feedId + ")" + "<--" + "(" + sourceFeedName + ")";
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
index c37230d..b0d5f76 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
@@ -26,13 +26,14 @@ import java.io.IOException;
import java.util.Calendar;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.external.api.IDataSourceAdapter;
+import org.apache.asterix.external.api.IDataSourceAdapter.AdapterType;
+import org.apache.asterix.external.dataset.adapter.AdapterIdentifier;
import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
import org.apache.asterix.metadata.bootstrap.MetadataRecordTypes;
import org.apache.asterix.metadata.entities.DatasourceAdapter;
-import org.apache.asterix.metadata.entities.DatasourceAdapter.AdapterType;
-import org.apache.asterix.metadata.feeds.AdapterIdentifier;
import org.apache.asterix.om.base.ARecord;
import org.apache.asterix.om.base.AString;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -76,7 +77,7 @@ public class DatasourceAdapterTupleTranslator extends AbstractTupleTranslator<Da
.getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_NAME_FIELD_INDEX)).getStringValue();
String classname = ((AString) adapterRecord
.getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_CLASSNAME_FIELD_INDEX)).getStringValue();
- AdapterType adapterType = AdapterType.valueOf(((AString) adapterRecord
+ IDataSourceAdapter.AdapterType adapterType = IDataSourceAdapter.AdapterType.valueOf(((AString) adapterRecord
.getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_TYPE_FIELD_INDEX)).getStringValue());
return new DatasourceAdapter(new AdapterIdentifier(dataverseName, adapterName), classname, adapterType);
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e800e6d5/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
index e09928b..00e3e63 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
@@ -35,7 +35,7 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
import org.apache.asterix.metadata.bootstrap.MetadataRecordTypes;
-import org.apache.asterix.metadata.entities.FeedPolicy;
+import org.apache.asterix.metadata.entities.FeedPolicyEntity;
import org.apache.asterix.om.base.AInt32;
import org.apache.asterix.om.base.AMutableString;
import org.apache.asterix.om.base.ARecord;
@@ -52,7 +52,7 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
/**
* Translates a Dataset metadata entity to an ITupleReference and vice versa.
*/
-public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolicy> {
+public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolicyEntity> {
// Field indexes of serialized FeedPolicy in a tuple.
// Key field.
public static final int FEED_POLICY_DATAVERSE_NAME_FIELD_INDEX = 0;
@@ -74,7 +74,7 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
}
@Override
- public FeedPolicy getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException {
+ public FeedPolicyEntity getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException {
byte[] serRecord = frameTuple.getFieldData(FEED_POLICY_PAYLOAD_TUPLE_FIELD_INDEX);
int recordStartOffset = frameTuple.getFieldStart(FEED_POLICY_PAYLOAD_TUPLE_FIELD_INDEX);
int recordLength = frameTuple.getFieldLength(FEED_POLICY_PAYLOAD_TUPLE_FIELD_INDEX);
@@ -84,8 +84,8 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
return createFeedPolicyFromARecord(feedPolicyRecord);
}
- private FeedPolicy createFeedPolicyFromARecord(ARecord feedPolicyRecord) {
- FeedPolicy feedPolicy = null;
+ private FeedPolicyEntity createFeedPolicyFromARecord(ARecord feedPolicyRecord) {
+ FeedPolicyEntity feedPolicy = null;
String dataverseName = ((AString) feedPolicyRecord
.getValueByPos(MetadataRecordTypes.FEED_POLICY_ARECORD_DATAVERSE_NAME_FIELD_INDEX)).getStringValue();
String policyName = ((AString) feedPolicyRecord
@@ -106,12 +106,12 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
policyParamters.put(key, value);
}
- feedPolicy = new FeedPolicy(dataverseName, policyName, description, policyParamters);
+ feedPolicy = new FeedPolicyEntity(dataverseName, policyName, description, policyParamters);
return feedPolicy;
}
@Override
- public ITupleReference getTupleFromMetadataEntity(FeedPolicy feedPolicy) throws IOException, MetadataException {
+ public ITupleReference getTupleFromMetadataEntity(FeedPolicyEntity feedPolicy) throws IOException, MetadataException {
// write the key in the first three fields of the tuple
ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();