Search in sources :

Example 1 with EventListenerFactory

use of io.prestosql.spi.eventlistener.EventListenerFactory in project hetu-core by openlookeng.

the class PluginManager method installPlugin.

public void installPlugin(Plugin plugin) {
    for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
        log.info("Registering block encoding %s", blockEncoding.getName());
        metadataManager.getFunctionAndTypeManager().addBlockEncoding(blockEncoding);
    }
    for (Type type : plugin.getTypes()) {
        log.info("Registering type %s", type.getTypeSignature());
        metadataManager.getFunctionAndTypeManager().addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
        log.info("Registering parametric type %s", parametricType.getName());
        metadataManager.getFunctionAndTypeManager().addParametricType(parametricType);
    }
    for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
        log.info("Registering connector %s", connectorFactory.getName());
        connectorManager.addConnectorFactory(connectorFactory);
        ConnectorCache.addCatalogConfig(plugin, connectorFactory.getName());
    }
    for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
        log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
        sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
    }
    for (FunctionNamespaceManagerFactory functionNamespaceManagerFactory : plugin.getFunctionNamespaceManagerFactories()) {
        log.info("Registering function namespace manager %s", functionNamespaceManagerFactory.getName());
        metadataManager.getFunctionAndTypeManager().addFunctionNamespaceFactory(functionNamespaceManagerFactory);
    }
    for (ResourceGroupConfigurationManagerFactory configurationManagerFactory : plugin.getResourceGroupConfigurationManagerFactories()) {
        log.info("Registering resource group configuration manager %s", configurationManagerFactory.getName());
        resourceGroupManager.addConfigurationManagerFactory(configurationManagerFactory);
    }
    for (SystemAccessControlFactory accessControlFactory : plugin.getSystemAccessControlFactories()) {
        log.info("Registering system access control %s", accessControlFactory.getName());
        accessControlManager.addSystemAccessControlFactory(accessControlFactory);
    }
    for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
        log.info("Registering password authenticator %s", authenticatorFactory.getName());
        passwordAuthenticatorManager.addPasswordAuthenticatorFactory(authenticatorFactory);
    }
    for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
        log.info("Registering event listener %s", eventListenerFactory.getName());
        eventListenerManager.addEventListenerFactory(eventListenerFactory);
    }
    for (GroupProviderFactory groupProviderFactory : plugin.getGroupProviderFactories()) {
        log.info("Registering group provider %s", groupProviderFactory.getName());
        groupProviderManager.addGroupProviderFactory(groupProviderFactory);
    }
    // Install StateStorePlugin
    for (StateStoreBootstrapper bootstrapper : plugin.getStateStoreBootstrappers()) {
        log.info("Registering  state store bootstrapper");
        stateStoreLauncher.addStateStoreBootstrapper(bootstrapper);
    }
    for (StateStoreFactory stateStoreFactory : plugin.getStateStoreFactories()) {
        log.info("Registering state store %s", stateStoreFactory.getName());
        localStateStoreProvider.addStateStoreFactory(stateStoreFactory);
    }
    for (SeedStoreFactory seedStoreFactory : plugin.getSeedStoreFactories()) {
        log.info("Registering seed store %s", seedStoreFactory.getName());
        seedStoreManager.addSeedStoreFactory(seedStoreFactory);
    }
    for (CubeProvider cubeProvider : plugin.getCubeProviders()) {
        log.info("Registering cube provider %s", cubeProvider.getName());
        cubeManager.addCubeProvider(cubeProvider);
    }
    for (HetuFileSystemClientFactory fileSystemClientFactory : plugin.getFileSystemClientFactory()) {
        log.info("Registering file system provider %s", fileSystemClientFactory.getName());
        fileSystemClientManager.addFileSystemClientFactories(fileSystemClientFactory);
    }
    for (HetuMetaStoreFactory hetuMetaStoreFactory : plugin.getHetuMetaStoreFactories()) {
        log.info("Registering hetu metastore %s", hetuMetaStoreFactory.getName());
        hetuMetaStoreManager.addHetuMetaStoreFactory(hetuMetaStoreFactory);
    }
    for (IndexFactory indexFactory : plugin.getIndexFactories()) {
        log.info("Loading index factory");
        heuristicIndexerManager.loadIndexFactories(indexFactory);
    }
    installFunctionsPlugin(plugin);
}
Also used : ResourceGroupConfigurationManagerFactory(io.prestosql.spi.resourcegroups.ResourceGroupConfigurationManagerFactory) EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) HetuFileSystemClientFactory(io.prestosql.spi.filesystem.HetuFileSystemClientFactory) SeedStoreFactory(io.prestosql.spi.seedstore.SeedStoreFactory) SystemAccessControlFactory(io.prestosql.spi.security.SystemAccessControlFactory) ParametricType(io.prestosql.spi.type.ParametricType) Type(io.prestosql.spi.type.Type) PasswordAuthenticatorFactory(io.prestosql.spi.security.PasswordAuthenticatorFactory) ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) IndexFactory(io.prestosql.spi.heuristicindex.IndexFactory) HetuMetaStoreFactory(io.prestosql.spi.metastore.HetuMetaStoreFactory) ParametricType(io.prestosql.spi.type.ParametricType) CubeProvider(io.prestosql.spi.cube.CubeProvider) FunctionNamespaceManagerFactory(io.prestosql.spi.function.FunctionNamespaceManagerFactory) SessionPropertyConfigurationManagerFactory(io.prestosql.spi.session.SessionPropertyConfigurationManagerFactory) BlockEncoding(io.prestosql.spi.block.BlockEncoding) GroupProviderFactory(io.prestosql.spi.security.GroupProviderFactory) StateStoreBootstrapper(io.prestosql.spi.statestore.StateStoreBootstrapper) StateStoreFactory(io.prestosql.spi.statestore.StateStoreFactory)

Example 2 with EventListenerFactory

use of io.prestosql.spi.eventlistener.EventListenerFactory in project hetu-core by openlookeng.

the class TestHetuEventListenerPlugin method testCreateConnector4.

@Test
public void testCreateConnector4() {
    Plugin plugin = new io.hetu.core.eventlistener.HetuEventListenerPlugin();
    EventListenerFactory factory = getOnlyElement(plugin.getEventListenerFactories());
    EventListener listener = factory.create(ImmutableMap.of("hetu.event.listener.type", "LOGGER", "hetu.event.listener.listen.query.creation", "true"));
}
Also used : EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) BaseEventListener(io.hetu.core.eventlistener.listeners.BaseEventListener) EventListener(io.prestosql.spi.eventlistener.EventListener) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Example 3 with EventListenerFactory

use of io.prestosql.spi.eventlistener.EventListenerFactory in project hetu-core by openlookeng.

the class EventListenerManager method setConfiguredEventListener.

@VisibleForTesting
protected void setConfiguredEventListener(String name, Map<String, String> properties) {
    requireNonNull(name, "name is null");
    requireNonNull(properties, "properties is null");
    log.info("-- Loading event listener --");
    EventListenerFactory eventListenerFactory = eventListenerFactories.get(name);
    checkState(eventListenerFactory != null, "Event listener %s is not registered", name);
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(eventListenerFactory.getClass().getClassLoader())) {
        EventListener eventListener = eventListenerFactory.create(ImmutableMap.copyOf(properties));
        this.configuredEventListener.set(Optional.of(eventListener));
    }
    log.info("-- Loaded event listener %s --", name);
}
Also used : EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) EventListener(io.prestosql.spi.eventlistener.EventListener) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 4 with EventListenerFactory

use of io.prestosql.spi.eventlistener.EventListenerFactory in project hetu-core by openlookeng.

the class TestHetuEventListenerPlugin method testCreateConnector3.

@Test(expectedExceptions = ConfigurationException.class)
public void testCreateConnector3() {
    Plugin plugin = new io.hetu.core.eventlistener.HetuEventListenerPlugin();
    EventListenerFactory factory = getOnlyElement(plugin.getEventListenerFactories());
    EventListener listener = factory.create(ImmutableMap.of("hetu.event.listener.type", "unknown", "hetu.event.listener.listen.query.creation", "true"));
}
Also used : EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) BaseEventListener(io.hetu.core.eventlistener.listeners.BaseEventListener) EventListener(io.prestosql.spi.eventlistener.EventListener) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Example 5 with EventListenerFactory

use of io.prestosql.spi.eventlistener.EventListenerFactory in project hetu-core by openlookeng.

the class TestHetuEventListenerPlugin method testCreateConnector1.

@Test
public void testCreateConnector1() {
    Plugin plugin = new io.hetu.core.eventlistener.HetuEventListenerPlugin();
    EventListenerFactory factory = getOnlyElement(plugin.getEventListenerFactories());
    EventListener listener = factory.create(ImmutableMap.of());
    assertSame(listener, BaseEventListener.SILENT_EVENT_LISTENER, "not silent listener");
}
Also used : EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) BaseEventListener(io.hetu.core.eventlistener.listeners.BaseEventListener) EventListener(io.prestosql.spi.eventlistener.EventListener) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

EventListenerFactory (io.prestosql.spi.eventlistener.EventListenerFactory)6 EventListener (io.prestosql.spi.eventlistener.EventListener)5 BaseEventListener (io.hetu.core.eventlistener.listeners.BaseEventListener)4 Plugin (io.prestosql.spi.Plugin)4 Test (org.testng.annotations.Test)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 BlockEncoding (io.prestosql.spi.block.BlockEncoding)1 ThreadContextClassLoader (io.prestosql.spi.classloader.ThreadContextClassLoader)1 ConnectorFactory (io.prestosql.spi.connector.ConnectorFactory)1 CubeProvider (io.prestosql.spi.cube.CubeProvider)1 HetuFileSystemClientFactory (io.prestosql.spi.filesystem.HetuFileSystemClientFactory)1 FunctionNamespaceManagerFactory (io.prestosql.spi.function.FunctionNamespaceManagerFactory)1 IndexFactory (io.prestosql.spi.heuristicindex.IndexFactory)1 HetuMetaStoreFactory (io.prestosql.spi.metastore.HetuMetaStoreFactory)1 ResourceGroupConfigurationManagerFactory (io.prestosql.spi.resourcegroups.ResourceGroupConfigurationManagerFactory)1 GroupProviderFactory (io.prestosql.spi.security.GroupProviderFactory)1 PasswordAuthenticatorFactory (io.prestosql.spi.security.PasswordAuthenticatorFactory)1 SystemAccessControlFactory (io.prestosql.spi.security.SystemAccessControlFactory)1 SeedStoreFactory (io.prestosql.spi.seedstore.SeedStoreFactory)1 SessionPropertyConfigurationManagerFactory (io.prestosql.spi.session.SessionPropertyConfigurationManagerFactory)1