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 interface
EmbeddedServer.ConnectionFactoryProvider<T>
protected class
EmbeddedServer.ProviderAwareConnectorManagerRepository
static class
EmbeddedServer.SimpleConnectionFactoryProvider<T>
-
Field Summary
Fields Modifier and Type Field Description protected BufferServiceImpl
bufferService
protected ConnectorManagerRepository
cmr
protected DQPCore
dqp
protected AbstractEventDistributorFactoryService
eventDistributorFactoryService
protected LogonImpl
logon
protected MaterializationManager
materializationMgr
protected ObjectReplicator
replicator
protected VDBRepository
repo
Custom vdb repository that will immediately throw exceptions for metadata validation errorsprotected ScheduledExecutorService
scheduler
protected ClientServiceRegistryImpl
services
protected SessionServiceImpl
sessionService
protected boolean
throwMetadataErrors
protected TransactionServerImpl
transactionService
protected ArrayList<SocketListener>
transports
protected boolean
useCallingThread
protected boolean
waitForLoad
-
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 void
addConnectionFactory(String name, Object connectionFactory)
Adds the object as the named connection factory to replace the default JNDI lookup strategy.void
addConnectionFactoryProvider(String name, EmbeddedServer.ConnectionFactoryProvider<?> connectionFactoryProvider)
Adds theEmbeddedServer.ConnectionFactoryProvider
with the given connection name to replace the default JNDI lookup strategy.void
addTranslator(Class<? extends ExecutionFactory> clazz)
Adds a definition of theExecutionFactory
using the default name either from theTranslator
annotation or the class name.void
addTranslator(String name, String type, Map<String,String> properties)
Add an override translatorvoid
addTranslator(String name, ExecutionFactory<?,?> ef)
Add a namedExecutionFactory
.protected boolean
allowOverrideTranslators()
protected void
cacheMetadataFactory(VDBMetaData vdb, ModelMetaData model, MetadataFactory schema)
static void
createPreParser(VDBMetaData deployment)
void
deployVDB(InputStream is)
Deploy a vdb.xml file.void
deployVDB(InputStream is, boolean ddl)
Deploy a vdb.xml file.void
deployVDB(String name, ModelMetaData... models)
Deploy the given set of models as vdb name.1protected void
deployVDB(VDBMetaData vdb, VDBResources resources)
void
deployVDBZip(URL url)
Deploy a vdb zip file.Admin
getAdmin()
protected BufferService
getBufferService()
protected MetadataFactory
getCachedMetadataFactory(VDBMetaData vdb, ModelMetaData model)
protected EmbeddedConfiguration
getConfiguration()
protected ConcurrentHashMap<String,EmbeddedServer.ConnectionFactoryProvider<?>>
getConnectionFactoryProviders()
TeiidDriver
getDriver()
EventDistributor
getEventDistributor()
Get anEventDistributor
that will distribute events to all members.ExecutionFactory<Object,Object>
getExecutionFactory(String name)
protected MaterializationManager
getMaterializationManager()
protected MetadataRepository<?,?>
getMetadataRepository(String repoType)
int
getPort(int transport)
Return the bound port for the transport numberprotected SessionAwareCache<PreparedPlan>
getPpcCache()
protected SessionAwareCache<CachedResults>
getRsCache()
String
getSchemaDdl(String vdbName, String schemaName)
Get the effective ddl text for the given schemaprotected TranslatorRepository
getTranslatorRepository()
protected VDBRepository
getVDBRepository()
protected boolean
retryLoad(VDBMetaData vdb, ModelMetaData model, Runnable job)
Return true if we can retry the loadprotected void
runMetadataJob(VDBMetaData vdb, ModelMetaData model, Runnable job)
void
start(EmbeddedConfiguration config)
void
stop()
Stops the server.void
undeployVDB(String vdbName)
void
undeployVDB(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.ConnectionFactoryProvider
with 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 theExecutionFactory
using the default name either from theTranslator
annotation or the class name. OnlyExecutionFactory
classes with aTranslator
annotation 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.ConnectorManagerException
VirtualDatabaseException
TranslatorException
-
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:
TranslatorException
ConnectorManagerRepository.ConnectorManagerException
VirtualDatabaseException
IOException
-
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:
TranslatorException
ConnectorManagerRepository.ConnectorManagerException
VirtualDatabaseException
IOException
-
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:
getMetadataRepository
in classAbstractVDBDeployer
- Throws:
VirtualDatabaseException
-
cacheMetadataFactory
protected void cacheMetadataFactory(VDBMetaData vdb, ModelMetaData model, MetadataFactory schema)
- Specified by:
cacheMetadataFactory
in classAbstractVDBDeployer
-
getCachedMetadataFactory
protected MetadataFactory getCachedMetadataFactory(VDBMetaData vdb, ModelMetaData model)
- Specified by:
getCachedMetadataFactory
in classAbstractVDBDeployer
-
retryLoad
protected boolean retryLoad(VDBMetaData vdb, ModelMetaData model, Runnable job)
Description copied from class:AbstractVDBDeployer
Return true if we can retry the load- Specified by:
retryLoad
in classAbstractVDBDeployer
- Returns:
-
runMetadataJob
protected void runMetadataJob(VDBMetaData vdb, ModelMetaData model, Runnable job) throws TranslatorException
- Specified by:
runMetadataJob
in 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:EventDistributorFactory
Get anEventDistributor
that will distribute events to all members.- Specified by:
getEventDistributor
in interfaceEventDistributorFactory
- Returns:
-
getExecutionFactory
public ExecutionFactory<Object,Object> getExecutionFactory(String name) throws ConnectorManagerRepository.ConnectorManagerException
- Specified by:
getExecutionFactory
in interfaceConnectorManagerRepository.ExecutionFactoryProvider
- Returns:
- the named
ExecutionFactory
or throw aConnectorManagerRepository.ConnectorManagerException
if it does not exist - Throws:
ConnectorManagerRepository.ConnectorManagerException
-
getVDBRepository
protected VDBRepository getVDBRepository()
- Specified by:
getVDBRepository
in 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
-
-