Package org.teiid.runtime
Class EmbeddedServer
- java.lang.Object
-
- org.teiid.runtime.AbstractVDBDeployer
-
- org.teiid.runtime.EmbeddedServer
-
- All Implemented Interfaces:
ConnectorManagerRepository.ExecutionFactoryProvider,EventDistributorFactory
public class EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ConnectorManagerRepository.ExecutionFactoryProvider
A simplified server environment for embedded use. Needs to be started prior to use with a call tostart(EmbeddedConfiguration)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceEmbeddedServer.ConnectionFactoryProvider<T>protected classEmbeddedServer.ProviderAwareConnectorManagerRepositorystatic classEmbeddedServer.SimpleConnectionFactoryProvider<T>
-
Field Summary
Fields Modifier and Type Field Description protected BufferServiceImplbufferServiceprotected ConnectorManagerRepositorycmrprotected DQPCoredqpprotected AbstractEventDistributorFactoryServiceeventDistributorFactoryServiceprotected LogonImpllogonprotected MaterializationManagermaterializationMgrprotected ObjectReplicatorreplicatorprotected VDBRepositoryrepoCustom vdb repository that will immediately throw exceptions for metadata validation errorsprotected ScheduledExecutorServiceschedulerprotected ClientServiceRegistryImplservicesprotected SessionServiceImplsessionServiceprotected booleanthrowMetadataErrorsprotected TransactionServerImpltransactionServiceprotected ArrayList<SocketListener>transportsprotected booleanuseCallingThreadprotected booleanwaitForLoad-
Fields inherited from class org.teiid.runtime.AbstractVDBDeployer
ALLOW_INFORMATION_SCHEMA, repositories
-
-
Constructor Summary
Constructors Constructor Description EmbeddedServer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionFactory(String name, Object connectionFactory)Adds the object as the named connection factory to replace the default JNDI lookup strategy.voidaddConnectionFactoryProvider(String name, EmbeddedServer.ConnectionFactoryProvider<?> connectionFactoryProvider)Adds theEmbeddedServer.ConnectionFactoryProviderwith the given connection name to replace the default JNDI lookup strategy.voidaddTranslator(Class<? extends ExecutionFactory> clazz)Adds a definition of theExecutionFactoryusing the default name either from theTranslatorannotation or the class name.voidaddTranslator(String name, String type, Map<String,String> properties)Add an override translatorvoidaddTranslator(String name, ExecutionFactory<?,?> ef)Add a namedExecutionFactory.protected booleanallowOverrideTranslators()protected voidcacheMetadataFactory(VDBMetaData vdb, ModelMetaData model, MetadataFactory schema)static voidcreatePreParser(VDBMetaData deployment)voiddeployVDB(InputStream is)Deploy a vdb.xml file.voiddeployVDB(InputStream is, boolean ddl)Deploy a vdb.xml file.voiddeployVDB(String name, ModelMetaData... models)Deploy the given set of models as vdb name.1protected voiddeployVDB(VDBMetaData vdb, VDBResources resources)voiddeployVDBZip(URL url)Deploy a vdb zip file.AdmingetAdmin()protected BufferServicegetBufferService()protected MetadataFactorygetCachedMetadataFactory(VDBMetaData vdb, ModelMetaData model)protected EmbeddedConfigurationgetConfiguration()protected ConcurrentHashMap<String,EmbeddedServer.ConnectionFactoryProvider<?>>getConnectionFactoryProviders()TeiidDrivergetDriver()EventDistributorgetEventDistributor()Get anEventDistributorthat will distribute events to all members.ExecutionFactory<Object,Object>getExecutionFactory(String name)protected MaterializationManagergetMaterializationManager()protected MetadataRepository<?,?>getMetadataRepository(String repoType)intgetPort(int transport)Return the bound port for the transport numberprotected SessionAwareCache<PreparedPlan>getPpcCache()protected SessionAwareCache<CachedResults>getRsCache()StringgetSchemaDdl(String vdbName, String schemaName)Get the effective ddl text for the given schemaprotected TranslatorRepositorygetTranslatorRepository()protected VDBRepositorygetVDBRepository()protected booleanretryLoad(VDBMetaData vdb, ModelMetaData model, Runnable job)Return true if we can retry the loadprotected voidrunMetadataJob(VDBMetaData vdb, ModelMetaData model, Runnable job)voidstart(EmbeddedConfiguration config)voidstop()Stops the server.voidundeployVDB(String vdbName)voidundeployVDB(String vdbName, String version)-
Methods inherited from class org.teiid.runtime.AbstractVDBDeployer
addMetadataRepository, assignMetadataRepositories, createMetadataFactory, getConnectorManagers, loadMetadata
-
-
-
-
Field Detail
-
dqp
protected DQPCore dqp
-
repo
protected VDBRepository repo
Custom vdb repository that will immediately throw exceptions for metadata validation errors
-
throwMetadataErrors
protected boolean throwMetadataErrors
-
sessionService
protected SessionServiceImpl sessionService
-
replicator
protected ObjectReplicator replicator
-
bufferService
protected BufferServiceImpl bufferService
-
transactionService
protected TransactionServerImpl transactionService
-
waitForLoad
protected boolean waitForLoad
-
services
protected ClientServiceRegistryImpl services
-
logon
protected LogonImpl logon
-
cmr
protected ConnectorManagerRepository cmr
-
eventDistributorFactoryService
protected AbstractEventDistributorFactoryService eventDistributorFactoryService
-
useCallingThread
protected boolean useCallingThread
-
transports
protected ArrayList<SocketListener> transports
-
scheduler
protected ScheduledExecutorService scheduler
-
materializationMgr
protected MaterializationManager materializationMgr
-
-
Method Detail
-
addConnectionFactoryProvider
public void addConnectionFactoryProvider(String name, EmbeddedServer.ConnectionFactoryProvider<?> connectionFactoryProvider)
Adds theEmbeddedServer.ConnectionFactoryProviderwith the given connection name to replace the default JNDI lookup strategy.- Parameters:
name-connectionFactoryProvider-- See Also:
for a basic wrapper
-
addConnectionFactory
public void addConnectionFactory(String name, Object connectionFactory)
Adds the object as the named connection factory to replace the default JNDI lookup strategy.- Parameters:
name-connectionFactory-
-
start
public void start(EmbeddedConfiguration config)
-
getBufferService
protected BufferService getBufferService()
-
getMaterializationManager
protected MaterializationManager getMaterializationManager()
-
addTranslator
public void addTranslator(Class<? extends ExecutionFactory> clazz) throws TranslatorException
Adds a definition of theExecutionFactoryusing the default name either from theTranslatorannotation or the class name. OnlyExecutionFactoryclasses with aTranslatorannotation can be referenced byaddTranslator(String, String, Map)- Parameters:
clazz-- Throws:
TranslatorException
-
addTranslator
public void addTranslator(String name, String type, Map<String,String> properties) throws TranslatorException
Add an override translator- Parameters:
name-type- the name of an existing translator to overrideproperties-- Throws:
TranslatorException
-
addTranslator
public void addTranslator(String name, ExecutionFactory<?,?> ef)
Add a namedExecutionFactory. NOTE: Only this single instance will be shared for all usage. SeeaddTranslator(String, String, Map)oraddTranslator(Class)- Parameters:
name-ef- the already started ExecutionFactory
-
deployVDB
public void deployVDB(String name, ModelMetaData... models) throws ConnectorManagerRepository.ConnectorManagerException, VirtualDatabaseException, TranslatorException
Deploy the given set of models as vdb name.1- Parameters:
name-models-- Throws:
ConnectorManagerRepository.ConnectorManagerExceptionVirtualDatabaseExceptionTranslatorException
-
deployVDB
public void deployVDB(InputStream is) throws VirtualDatabaseException, ConnectorManagerRepository.ConnectorManagerException, TranslatorException, IOException
Deploy a vdb.xml file. The name and version will be derived from the xml.- Parameters:
is- which will be closed by this deployment- Throws:
TranslatorExceptionConnectorManagerRepository.ConnectorManagerExceptionVirtualDatabaseExceptionIOException
-
deployVDB
public void deployVDB(InputStream is, boolean ddl) throws VirtualDatabaseException, ConnectorManagerRepository.ConnectorManagerException, TranslatorException, IOException
Deploy a vdb.xml file. The name and version will be derived from the xml.- Parameters:
is- which will be closed by this deploymentddl- true if the file contents are DDL- Throws:
TranslatorExceptionConnectorManagerRepository.ConnectorManagerExceptionVirtualDatabaseExceptionIOException
-
deployVDBZip
public void deployVDBZip(URL url) throws VirtualDatabaseException, ConnectorManagerRepository.ConnectorManagerException, TranslatorException, IOException, URISyntaxException
Deploy a vdb zip file. The name and version will be derived from the xml.
-
allowOverrideTranslators
protected boolean allowOverrideTranslators()
-
deployVDB
protected void deployVDB(VDBMetaData vdb, VDBResources resources) throws ConnectorManagerRepository.ConnectorManagerException, VirtualDatabaseException, TranslatorException
-
getMetadataRepository
protected MetadataRepository<?,?> getMetadataRepository(String repoType) throws VirtualDatabaseException
- Overrides:
getMetadataRepositoryin classAbstractVDBDeployer- Throws:
VirtualDatabaseException
-
cacheMetadataFactory
protected void cacheMetadataFactory(VDBMetaData vdb, ModelMetaData model, MetadataFactory schema)
- Specified by:
cacheMetadataFactoryin classAbstractVDBDeployer
-
getCachedMetadataFactory
protected MetadataFactory getCachedMetadataFactory(VDBMetaData vdb, ModelMetaData model)
- Specified by:
getCachedMetadataFactoryin classAbstractVDBDeployer
-
retryLoad
protected boolean retryLoad(VDBMetaData vdb, ModelMetaData model, Runnable job)
Description copied from class:AbstractVDBDeployerReturn true if we can retry the load- Specified by:
retryLoadin classAbstractVDBDeployer- Returns:
-
runMetadataJob
protected void runMetadataJob(VDBMetaData vdb, ModelMetaData model, Runnable job) throws TranslatorException
- Specified by:
runMetadataJobin classAbstractVDBDeployer- Throws:
TranslatorException
-
undeployVDB
public void undeployVDB(String vdbName)
-
getConfiguration
protected EmbeddedConfiguration getConfiguration()
-
stop
public void stop()
Stops the server. Once stopped it cannot be restarted.
-
getDriver
public TeiidDriver getDriver()
-
getEventDistributor
public EventDistributor getEventDistributor()
Description copied from interface:EventDistributorFactoryGet anEventDistributorthat will distribute events to all members.- Specified by:
getEventDistributorin interfaceEventDistributorFactory- Returns:
-
getExecutionFactory
public ExecutionFactory<Object,Object> getExecutionFactory(String name) throws ConnectorManagerRepository.ConnectorManagerException
- Specified by:
getExecutionFactoryin interfaceConnectorManagerRepository.ExecutionFactoryProvider- Returns:
- the named
ExecutionFactoryor throw aConnectorManagerRepository.ConnectorManagerExceptionif it does not exist - Throws:
ConnectorManagerRepository.ConnectorManagerException
-
getVDBRepository
protected VDBRepository getVDBRepository()
- Specified by:
getVDBRepositoryin classAbstractVDBDeployer
-
getSchemaDdl
public String getSchemaDdl(String vdbName, String schemaName)
Get the effective ddl text for the given schema- Parameters:
vdbName-schemaName-- Returns:
- the ddl or null if the vdb/schema does not exist
-
getPort
public int getPort(int transport)
Return the bound port for the transport number- Parameters:
transport-- Returns:
-
getTranslatorRepository
protected TranslatorRepository getTranslatorRepository()
-
getConnectionFactoryProviders
protected ConcurrentHashMap<String,EmbeddedServer.ConnectionFactoryProvider<?>> getConnectionFactoryProviders()
-
getRsCache
protected SessionAwareCache<CachedResults> getRsCache()
-
getPpcCache
protected SessionAwareCache<PreparedPlan> getPpcCache()
-
getAdmin
public Admin getAdmin()
-
createPreParser
public static void createPreParser(VDBMetaData deployment) throws TeiidException
- Throws:
TeiidException
-
-