abdullah alamoudi has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1096
Change subject: Enable Extensions Through EntryPoints
......................................................................
Enable Extensions Through EntryPoints
This change enable an instance with its implementations of entry points
to add extensions programmatically.
Change-Id: I363df794c48644ca806958f583a05aea10a93166
---
M
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
M
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
M
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
3 files changed, 30 insertions(+), 16 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/96/1096/1
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
index 3ebe873..c76af73 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
@@ -21,6 +21,8 @@
import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -33,6 +35,7 @@
import org.apache.asterix.common.cluster.ClusterPartition;
import org.apache.asterix.common.config.AsterixBuildProperties;
import org.apache.asterix.common.config.AsterixCompilerProperties;
+import org.apache.asterix.common.config.AsterixExtension;
import org.apache.asterix.common.config.AsterixExtensionProperties;
import org.apache.asterix.common.config.AsterixExternalProperties;
import org.apache.asterix.common.config.AsterixFeedProperties;
@@ -134,9 +137,10 @@
private final ILibraryManager libraryManager;
private final NCExtensionManager ncExtensionManager;
- public AsterixNCAppRuntimeContext(INCApplicationContext
ncApplicationContext, int metadataRmiPort)
- throws AsterixException, InstantiationException,
IllegalAccessException, ClassNotFoundException,
- IOException {
+ public AsterixNCAppRuntimeContext(INCApplicationContext
ncApplicationContext, int metadataRmiPort,
+ List<AsterixExtension> extensions) throws AsterixException,
InstantiationException, IllegalAccessException,
+ ClassNotFoundException, IOException {
+ List<AsterixExtension> allExtensions = new ArrayList<>();
this.ncApplicationContext = ncApplicationContext;
// Determine whether to use old-style asterix-configuration.xml or
new-style configuration.
// QQQ strip this out eventually
@@ -159,8 +163,11 @@
AsterixClusterProperties.INSTANCE.getCluster());
this.metadataRmiPort = metadataRmiPort;
libraryManager = new ExternalLibraryManager();
- ncExtensionManager = new NCExtensionManager(
- new
AsterixExtensionProperties(propertiesAccessor).getExtensions());
+ if (extensions != null) {
+ allExtensions.addAll(extensions);
+ }
+ allExtensions.addAll(new
AsterixExtensionProperties(propertiesAccessor).getExtensions());
+ ncExtensionManager = new NCExtensionManager(allExtensions);
}
@Override
@@ -180,15 +187,14 @@
metadataMergePolicyFactory = new PrefixMergePolicyFactory();
- ILocalResourceRepositoryFactory
persistentLocalResourceRepositoryFactory =
- new PersistentLocalResourceRepositoryFactory(ioManager,
ncApplicationContext.getNodeId(),
- metadataProperties);
+ ILocalResourceRepositoryFactory
persistentLocalResourceRepositoryFactory = new
PersistentLocalResourceRepositoryFactory(
+ ioManager, ncApplicationContext.getNodeId(),
metadataProperties);
localResourceRepository = (PersistentLocalResourceRepository)
persistentLocalResourceRepositoryFactory
.createRepository();
- IAsterixAppRuntimeContextProvider asterixAppRuntimeContextProvider =
- new AsterixAppRuntimeContextProviderForRecovery(this);
+ IAsterixAppRuntimeContextProvider asterixAppRuntimeContextProvider =
new AsterixAppRuntimeContextProviderForRecovery(
+ this);
txnSubsystem = new
TransactionSubsystem(ncApplicationContext.getNodeId(),
asterixAppRuntimeContextProvider,
txnProperties);
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index cf57174..1e40d837 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -47,6 +47,7 @@
import org.apache.asterix.app.external.ExternalLibraryUtils;
import org.apache.asterix.common.api.AsterixThreadFactory;
import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
+import org.apache.asterix.common.config.AsterixExtension;
import org.apache.asterix.common.config.AsterixExternalProperties;
import org.apache.asterix.common.config.AsterixMetadataProperties;
import org.apache.asterix.common.library.ILibraryManager;
@@ -96,8 +97,7 @@
ExternalLibraryUtils.setUpExternaLibraries(libraryManager, false);
AsterixAppContextInfo.initialize(appCtx,
getNewHyracksClientConnection(), GlobalRecoveryManager.instance(),
libraryManager);
- ccExtensionManager = new CompilerExtensionManager(
-
AsterixAppContextInfo.getInstance().getExtensionProperties().getExtensions());
+ ccExtensionManager = new CompilerExtensionManager(getExtensions());
AsterixAppContextInfo.getInstance().setExtensionManager(ccExtensionManager);
if (System.getProperty("java.rmi.server.hostname") == null) {
@@ -126,6 +126,10 @@
ccAppCtx.setMessageBroker(messageBroker);
}
+ protected List<AsterixExtension> getExtensions() {
+ return
AsterixAppContextInfo.getInstance().getExtensionProperties().getExtensions();
+ }
+
protected List<Server> configureServers() throws Exception {
AsterixExternalProperties externalProperties =
AsterixAppContextInfo.getInstance().getExternalProperties();
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 5abe6bc..8129d86 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -29,6 +29,7 @@
import org.apache.asterix.app.nc.AsterixNCAppRuntimeContext;
import org.apache.asterix.common.api.AsterixThreadFactory;
import org.apache.asterix.common.api.IAsterixAppRuntimeContext;
+import org.apache.asterix.common.config.AsterixExtension;
import org.apache.asterix.common.config.AsterixMetadataProperties;
import org.apache.asterix.common.config.AsterixTransactionProperties;
import org.apache.asterix.common.config.IAsterixPropertiesProvider;
@@ -96,11 +97,10 @@
}
if (System.getProperty("java.rmi.server.hostname") == null) {
- System.setProperty("java.rmi.server.hostname",
- ((NodeControllerService) ncAppCtx.getControllerService())
- .getConfiguration().clusterNetPublicIPAddress);
+ System.setProperty("java.rmi.server.hostname",
((NodeControllerService) ncAppCtx.getControllerService())
+ .getConfiguration().clusterNetPublicIPAddress);
}
- runtimeContext = new AsterixNCAppRuntimeContext(ncApplicationContext,
metadataRmiPort);
+ runtimeContext = new AsterixNCAppRuntimeContext(ncApplicationContext,
metadataRmiPort, getExtensions());
AsterixMetadataProperties metadataProperties =
((IAsterixPropertiesProvider) runtimeContext)
.getMetadataProperties();
if
(!metadataProperties.getNodeNames().contains(ncApplicationContext.getNodeId()))
{
@@ -154,6 +154,10 @@
}
}
+ protected List<AsterixExtension> getExtensions() {
+ return null;
+ }
+
private void startReplicationService() throws InterruptedException {
//Open replication channel
runtimeContext.getReplicationChannel().start();
--
To view, visit https://asterix-gerrit.ics.uci.edu/1096
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I363df794c48644ca806958f583a05aea10a93166
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>