@Test public void testStart() throws TranslatorException { es.addTranslator(MyEF.class); assertTrue(started); }
public synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config) { if (running != null) { throw new IllegalStateException(); } this.dqp.setLocalProfile(this.embeddedProfile); this.shutdownListener.setBootInProgress(true); this.config = config; System.setProperty("jboss.node.name", config.getNodeName()==null?"localhost":config.getNodeName()); this.cmr.setProvider(this); this.scheduler = Executors.newScheduledThreadPool(config.getMaxAsyncThreads(), new NamedThreadFactory("Asynch Worker")); this.replicator = config.getObjectReplicator(); this.eventDistributorFactoryService = new EmbeddedEventDistributorFactoryService(); this.eventDistributorFactoryService.start(); this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor()); if (config.getTransactionManager() == null) { LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); } })); } else { this.transactionService.setDetectTransactions(true); this.transactionService.setTransactionManager(config.getTransactionManager()); } if (config.getCacheFactory() == null) { String infinispanConfig = config.getInfinispanConfigFile(); CacheFactory cacheFactory = null; try { Class<?> clazz = Class.forName("org.teiid.cache.infinispan.EmbeddedInfinispanCacheFactoryBuilder"); Method m = clazz.getMethod("buildCacheFactory", String.class, TransactionManager.class); cacheFactory = (CacheFactory) m.invoke(null, infinispanConfig, config.getTransactionManager()); } catch (Throwable t) { if (infinispanConfig != null) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40168, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40168)); } try { cacheFactory = (CacheFactory)ReflectionHelper.create("org.teiid.cache.caffeine.CaffeineCacheFactory", null, Thread.currentThread().getContextClassLoader()); } catch (TeiidException e) { } if (cacheFactory == null) { LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40169) + ": " + t.getMessage()); } } if (cacheFactory == null) { cacheFactory = new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 256); } @Override public void destroy() { } }; } config.setCacheFactory(cacheFactory); } if (config.getSecurityHelper() != null) { this.sessionService.setSecurityHelper(config.getSecurityHelper()); } else { this.sessionService.setSecurityHelper(new DoNothingSecurityHelper()); } if (config.getSecurityDomain() != null) { this.sessionService.setSecurityDomain(config.getSecurityDomain()); } else { this.sessionService.setSecurityDomain("teiid-security"); } this.sessionService.setVDBRepository(repo); setBufferManagerProperties(config); this.bufferService.setSessionService(this.sessionService); this.dqp.setSessionService(this.sessionService); BufferService bs = getBufferService(); this.dqp.setBufferManager(bs.getBufferManager()); startVDBRepository(); rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); rs.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setResultsetCache(rs); ppc.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setPreparedPlanCache(ppc); this.dqp.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, this.transactionService, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader())); this.dqp.start(config); this.sessionService.setDqp(this.dqp); this.services.setSecurityHelper(this.sessionService.getSecurityHelper()); if (this.config.getAuthenticationType() != null) { this.services.setAuthenticationType(this.config.getAuthenticationType()); this.sessionService.setAuthenticationType(this.config.getAuthenticationType()); } this.sessionService.start(); this.services.setVDBRepository(this.repo); this.materializationMgr = getMaterializationManager(); this.repo.addListener(this.materializationMgr); this.repo.setAllowEnvFunction(this.config.isAllowEnvFunction()); this.logon = new LogonImpl(sessionService, null); services.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY); DQP dqpProxy = DQP.class.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQP.class}, new SessionCheckingProxy(dqp, LogConstants.CTX_DQP, MessageLevel.TRACE))); services.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP); initDriver(); List<SocketConfiguration> transports = config.getTransports(); if ( transports != null && !transports.isEmpty()) { for (SocketConfiguration socketConfig:transports) { SocketListener socketConnection = startTransport(socketConfig, bs.getBufferManager(), config.getMaxODBCLobSizeAllowed()); if (socketConfig.getSSLConfiguration() != null) { try { socketConfig.getSSLConfiguration().getServerSSLEngine(); } catch (Exception e) { throw new TeiidRuntimeException(e); } } this.transports.add(socketConnection); } } this.shutdownListener.setBootInProgress(false); this.shutdownListener.started(); this.jmxService = new JMXService(this.dqp, this.bufferService, this.sessionService); this.jmxService.registerBeans(); running = true; }
EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ExecutionFactoryProvider { public synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config) { if (running != null) { throw new IllegalStateException(); } this.dqp.setLocalProfile(this.embeddedProfile); this.shutdownListener.setBootInProgress(true); this.config = config; System.setProperty("jboss.node.name", config.getNodeName()==null?"localhost":config.getNodeName()); this.cmr.setProvider(this); this.scheduler = Executors.newScheduledThreadPool(config.getMaxAsyncThreads(), new NamedThreadFactory("Asynch Worker")); this.replicator = config.getObjectReplicator(); this.eventDistributorFactoryService = new EmbeddedEventDistributorFactoryService(); this.eventDistributorFactoryService.start(); this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor()); if (config.getTransactionManager() == null) { LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); } })); } else { this.transactionService.setDetectTransactions(true); this.transactionService.setTransactionManager(config.getTransactionManager()); } if (config.getCacheFactory() == null) { String infinispanConfig = config.getInfinispanConfigFile(); CacheFactory cacheFactory = null; try { Class<?> clazz = Class.forName("org.teiid.cache.infinispan.EmbeddedInfinispanCacheFactoryBuilder"); Method m = clazz.getMethod("buildCacheFactory", String.class, TransactionManager.class); cacheFactory = (CacheFactory) m.invoke(null, infinispanConfig, config.getTransactionManager()); } catch (Throwable t) { if (infinispanConfig != null) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40168, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40168)); } try { cacheFactory = (CacheFactory)ReflectionHelper.create("org.teiid.cache.caffeine.CaffeineCacheFactory", null, Thread.currentThread().getContextClassLoader()); } catch (TeiidException e) { } if (cacheFactory == null) { LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40169) + ": " + t.getMessage()); } } if (cacheFactory == null) { cacheFactory = new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 256); } @Override public void destroy() { } }; } config.setCacheFactory(cacheFactory); } if (config.getSecurityHelper() != null) { this.sessionService.setSecurityHelper(config.getSecurityHelper()); } else { this.sessionService.setSecurityHelper(new DoNothingSecurityHelper()); } if (config.getSecurityDomain() != null) { this.sessionService.setSecurityDomain(config.getSecurityDomain()); } else { this.sessionService.setSecurityDomain("teiid-security"); } this.sessionService.setVDBRepository(repo); setBufferManagerProperties(config); this.bufferService.setSessionService(this.sessionService); this.dqp.setSessionService(this.sessionService); BufferService bs = getBufferService(); this.dqp.setBufferManager(bs.getBufferManager()); startVDBRepository(); rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); rs.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setResultsetCache(rs); ppc.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setPreparedPlanCache(ppc); this.dqp.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, this.transactionService, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader())); this.dqp.start(config); this.sessionService.setDqp(this.dqp); this.services.setSecurityHelper(this.sessionService.getSecurityHelper()); if (this.config.getAuthenticationType() != null) { this.services.setAuthenticationType(this.config.getAuthenticationType()); this.sessionService.setAuthenticationType(this.config.getAuthenticationType()); } this.sessionService.start(); this.services.setVDBRepository(this.repo); this.materializationMgr = getMaterializationManager(); this.repo.addListener(this.materializationMgr); this.repo.setAllowEnvFunction(this.config.isAllowEnvFunction()); this.logon = new LogonImpl(sessionService, null); services.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY); DQP dqpProxy = DQP.class.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQP.class}, new SessionCheckingProxy(dqp, LogConstants.CTX_DQP, MessageLevel.TRACE))); services.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP); initDriver(); List<SocketConfiguration> transports = config.getTransports(); if ( transports != null && !transports.isEmpty()) { for (SocketConfiguration socketConfig:transports) { SocketListener socketConnection = startTransport(socketConfig, bs.getBufferManager(), config.getMaxODBCLobSizeAllowed()); if (socketConfig.getSSLConfiguration() != null) { try { socketConfig.getSSLConfiguration().getServerSSLEngine(); } catch (Exception e) { throw new TeiidRuntimeException(e); } } this.transports.add(socketConnection); } } this.shutdownListener.setBootInProgress(false); this.shutdownListener.started(); this.jmxService = new JMXService(this.dqp, this.bufferService, this.sessionService); this.jmxService.registerBeans(); running = true; } }
EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ExecutionFactoryProvider { public synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config) { if (running != null) { throw new IllegalStateException(); } this.dqp.setLocalProfile(this.embeddedProfile); this.shutdownListener.setBootInProgress(true); this.config = config; System.setProperty("jboss.node.name", config.getNodeName()==null?"localhost":config.getNodeName()); this.cmr.setProvider(this); this.scheduler = Executors.newScheduledThreadPool(config.getMaxAsyncThreads(), new NamedThreadFactory("Asynch Worker")); this.replicator = config.getObjectReplicator(); this.eventDistributorFactoryService = new EmbeddedEventDistributorFactoryService(); this.eventDistributorFactoryService.start(); this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor()); if (config.getTransactionManager() == null) { LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); } })); } else { this.transactionService.setDetectTransactions(true); this.transactionService.setTransactionManager(config.getTransactionManager()); } if (config.getCacheFactory() == null) { String infinispanConfig = config.getInfinispanConfigFile(); CacheFactory cacheFactory = null; try { Class<?> clazz = Class.forName("org.teiid.cache.infinispan.EmbeddedInfinispanCacheFactoryBuilder"); Method m = clazz.getMethod("buildCacheFactory", String.class, TransactionManager.class); cacheFactory = (CacheFactory) m.invoke(null, infinispanConfig, config.getTransactionManager()); } catch (Throwable t) { if (infinispanConfig != null) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40168, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40168)); } try { cacheFactory = (CacheFactory)ReflectionHelper.create("org.teiid.cache.caffeine.CaffeineCacheFactory", null, Thread.currentThread().getContextClassLoader()); } catch (TeiidException e) { } if (cacheFactory == null) { LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40169) + ": " + t.getMessage()); } } if (cacheFactory == null) { cacheFactory = new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 256); } @Override public void destroy() { } }; } config.setCacheFactory(cacheFactory); } if (config.getSecurityHelper() != null) { this.sessionService.setSecurityHelper(config.getSecurityHelper()); } else { this.sessionService.setSecurityHelper(new DoNothingSecurityHelper()); } if (config.getSecurityDomain() != null) { this.sessionService.setSecurityDomain(config.getSecurityDomain()); } else { this.sessionService.setSecurityDomain("teiid-security"); } this.sessionService.setVDBRepository(repo); setBufferManagerProperties(config); this.bufferService.setSessionService(this.sessionService); this.dqp.setSessionService(this.sessionService); BufferService bs = getBufferService(); this.dqp.setBufferManager(bs.getBufferManager()); startVDBRepository(); rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); rs.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setResultsetCache(rs); ppc.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setPreparedPlanCache(ppc); this.dqp.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, this.transactionService, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader())); this.dqp.start(config); this.sessionService.setDqp(this.dqp); this.services.setSecurityHelper(this.sessionService.getSecurityHelper()); if (this.config.getAuthenticationType() != null) { this.services.setAuthenticationType(this.config.getAuthenticationType()); this.sessionService.setAuthenticationType(this.config.getAuthenticationType()); } this.sessionService.start(); this.services.setVDBRepository(this.repo); this.materializationMgr = getMaterializationManager(); this.repo.addListener(this.materializationMgr); this.repo.setAllowEnvFunction(this.config.isAllowEnvFunction()); this.logon = new LogonImpl(sessionService, null); services.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY); DQP dqpProxy = DQP.class.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQP.class}, new SessionCheckingProxy(dqp, LogConstants.CTX_DQP, MessageLevel.TRACE))); services.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP); initDriver(); List<SocketConfiguration> transports = config.getTransports(); if ( transports != null && !transports.isEmpty()) { for (SocketConfiguration socketConfig:transports) { SocketListener socketConnection = startTransport(socketConfig, bs.getBufferManager(), config.getMaxODBCLobSizeAllowed()); if (socketConfig.getSSLConfiguration() != null) { try { socketConfig.getSSLConfiguration().getServerSSLEngine(); } catch (Exception e) { throw new TeiidRuntimeException(e); } } this.transports.add(socketConnection); } } this.shutdownListener.setBootInProgress(false); this.shutdownListener.started(); this.jmxService = new JMXService(this.dqp, this.bufferService, this.sessionService); this.jmxService.registerBeans(); running = true; } EmbeddedServer(); }
EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ExecutionFactoryProvider { public synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config) { if (running != null) { throw new IllegalStateException(); } this.dqp.setLocalProfile(this.embeddedProfile); this.shutdownListener.setBootInProgress(true); this.config = config; System.setProperty("jboss.node.name", config.getNodeName()==null?"localhost":config.getNodeName()); this.cmr.setProvider(this); this.scheduler = Executors.newScheduledThreadPool(config.getMaxAsyncThreads(), new NamedThreadFactory("Asynch Worker")); this.replicator = config.getObjectReplicator(); this.eventDistributorFactoryService = new EmbeddedEventDistributorFactoryService(); this.eventDistributorFactoryService.start(); this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor()); if (config.getTransactionManager() == null) { LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); } })); } else { this.transactionService.setDetectTransactions(true); this.transactionService.setTransactionManager(config.getTransactionManager()); } if (config.getCacheFactory() == null) { String infinispanConfig = config.getInfinispanConfigFile(); CacheFactory cacheFactory = null; try { Class<?> clazz = Class.forName("org.teiid.cache.infinispan.EmbeddedInfinispanCacheFactoryBuilder"); Method m = clazz.getMethod("buildCacheFactory", String.class, TransactionManager.class); cacheFactory = (CacheFactory) m.invoke(null, infinispanConfig, config.getTransactionManager()); } catch (Throwable t) { if (infinispanConfig != null) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40168, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40168)); } try { cacheFactory = (CacheFactory)ReflectionHelper.create("org.teiid.cache.caffeine.CaffeineCacheFactory", null, Thread.currentThread().getContextClassLoader()); } catch (TeiidException e) { } if (cacheFactory == null) { LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40169) + ": " + t.getMessage()); } } if (cacheFactory == null) { cacheFactory = new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 256); } @Override public void destroy() { } }; } config.setCacheFactory(cacheFactory); } if (config.getSecurityHelper() != null) { this.sessionService.setSecurityHelper(config.getSecurityHelper()); } else { this.sessionService.setSecurityHelper(new DoNothingSecurityHelper()); } if (config.getSecurityDomain() != null) { this.sessionService.setSecurityDomain(config.getSecurityDomain()); } else { this.sessionService.setSecurityDomain("teiid-security"); } this.sessionService.setVDBRepository(repo); setBufferManagerProperties(config); this.bufferService.setSessionService(this.sessionService); this.dqp.setSessionService(this.sessionService); BufferService bs = getBufferService(); this.dqp.setBufferManager(bs.getBufferManager()); startVDBRepository(); rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); rs.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setResultsetCache(rs); ppc.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setPreparedPlanCache(ppc); this.dqp.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, this.transactionService, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader())); this.dqp.start(config); this.sessionService.setDqp(this.dqp); this.services.setSecurityHelper(this.sessionService.getSecurityHelper()); if (this.config.getAuthenticationType() != null) { this.services.setAuthenticationType(this.config.getAuthenticationType()); this.sessionService.setAuthenticationType(this.config.getAuthenticationType()); } this.sessionService.start(); this.services.setVDBRepository(this.repo); this.materializationMgr = getMaterializationManager(); this.repo.addListener(this.materializationMgr); this.repo.setAllowEnvFunction(this.config.isAllowEnvFunction()); this.logon = new LogonImpl(sessionService, null); services.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY); DQP dqpProxy = DQP.class.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQP.class}, new SessionCheckingProxy(dqp, LogConstants.CTX_DQP, MessageLevel.TRACE))); services.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP); initDriver(); List<SocketConfiguration> transports = config.getTransports(); if ( transports != null && !transports.isEmpty()) { for (SocketConfiguration socketConfig:transports) { SocketListener socketConnection = startTransport(socketConfig, bs.getBufferManager(), config.getMaxODBCLobSizeAllowed()); if (socketConfig.getSSLConfiguration() != null) { try { socketConfig.getSSLConfiguration().getServerSSLEngine(); } catch (Exception e) { throw new TeiidRuntimeException(e); } } this.transports.add(socketConnection); } } this.shutdownListener.setBootInProgress(false); this.shutdownListener.started(); this.jmxService = new JMXService(this.dqp, this.bufferService, this.sessionService); this.jmxService.registerBeans(); running = true; } EmbeddedServer(); void addConnectionFactoryProvider(String name,
            ConnectionFactoryProvider<?> connectionFactoryProvider); void addConnectionFactory(String name, Object connectionFactory); synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config); void addTranslator(Class<? extends ExecutionFactory> clazz); void addTranslator(String name, String type, Map<String, String> properties); void addTranslator(String name, ExecutionFactory<?, ?> ef); void deployVDB(String name, ModelMetaData... models); void deployVDB(InputStream is); void deployVDB(InputStream is, boolean ddl); void deployVDBZip(URL url); void undeployVDB(String vdbName); void undeployVDB(String vdbName, String version); synchronized void stop(); TeiidDriver getDriver(); @Override EventDistributor getEventDistributor(); @SuppressWarnings("unchecked") @Override ExecutionFactory<Object, Object> getExecutionFactory(String name); String getSchemaDdl(String vdbName, String schemaName); int getPort(int transport); Admin getAdmin(); static void createPreParser(VDBMetaData deployment); }
EmbeddedServer extends AbstractVDBDeployer implements EventDistributorFactory, ExecutionFactoryProvider { public synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config) { if (running != null) { throw new IllegalStateException(); } this.dqp.setLocalProfile(this.embeddedProfile); this.shutdownListener.setBootInProgress(true); this.config = config; System.setProperty("jboss.node.name", config.getNodeName()==null?"localhost":config.getNodeName()); this.cmr.setProvider(this); this.scheduler = Executors.newScheduledThreadPool(config.getMaxAsyncThreads(), new NamedThreadFactory("Asynch Worker")); this.replicator = config.getObjectReplicator(); this.eventDistributorFactoryService = new EmbeddedEventDistributorFactoryService(); this.eventDistributorFactoryService.start(); this.dqp.setEventDistributor(this.eventDistributorFactoryService.getReplicatedEventDistributor()); if (config.getTransactionManager() == null) { LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); this.transactionService.setTransactionManager((TransactionManager) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {TransactionManager.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { throw new UnsupportedOperationException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40089)); } })); } else { this.transactionService.setDetectTransactions(true); this.transactionService.setTransactionManager(config.getTransactionManager()); } if (config.getCacheFactory() == null) { String infinispanConfig = config.getInfinispanConfigFile(); CacheFactory cacheFactory = null; try { Class<?> clazz = Class.forName("org.teiid.cache.infinispan.EmbeddedInfinispanCacheFactoryBuilder"); Method m = clazz.getMethod("buildCacheFactory", String.class, TransactionManager.class); cacheFactory = (CacheFactory) m.invoke(null, infinispanConfig, config.getTransactionManager()); } catch (Throwable t) { if (infinispanConfig != null) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40168, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40168)); } try { cacheFactory = (CacheFactory)ReflectionHelper.create("org.teiid.cache.caffeine.CaffeineCacheFactory", null, Thread.currentThread().getContextClassLoader()); } catch (TeiidException e) { } if (cacheFactory == null) { LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40169) + ": " + t.getMessage()); } } if (cacheFactory == null) { cacheFactory = new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 256); } @Override public void destroy() { } }; } config.setCacheFactory(cacheFactory); } if (config.getSecurityHelper() != null) { this.sessionService.setSecurityHelper(config.getSecurityHelper()); } else { this.sessionService.setSecurityHelper(new DoNothingSecurityHelper()); } if (config.getSecurityDomain() != null) { this.sessionService.setSecurityDomain(config.getSecurityDomain()); } else { this.sessionService.setSecurityDomain("teiid-security"); } this.sessionService.setVDBRepository(repo); setBufferManagerProperties(config); this.bufferService.setSessionService(this.sessionService); this.dqp.setSessionService(this.sessionService); BufferService bs = getBufferService(); this.dqp.setBufferManager(bs.getBufferManager()); startVDBRepository(); rs = new SessionAwareCache<CachedResults>("resultset", config.getCacheFactory(), SessionAwareCache.Type.RESULTSET, config.getMaxResultSetCacheStaleness()); ppc = new SessionAwareCache<PreparedPlan>("preparedplan", config.getCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, 0); rs.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setResultsetCache(rs); ppc.setTupleBufferCache(bs.getTupleBufferCache()); this.dqp.setPreparedPlanCache(ppc); this.dqp.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, this.transactionService, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader())); this.dqp.start(config); this.sessionService.setDqp(this.dqp); this.services.setSecurityHelper(this.sessionService.getSecurityHelper()); if (this.config.getAuthenticationType() != null) { this.services.setAuthenticationType(this.config.getAuthenticationType()); this.sessionService.setAuthenticationType(this.config.getAuthenticationType()); } this.sessionService.start(); this.services.setVDBRepository(this.repo); this.materializationMgr = getMaterializationManager(); this.repo.addListener(this.materializationMgr); this.repo.setAllowEnvFunction(this.config.isAllowEnvFunction()); this.logon = new LogonImpl(sessionService, null); services.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY); DQP dqpProxy = DQP.class.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {DQP.class}, new SessionCheckingProxy(dqp, LogConstants.CTX_DQP, MessageLevel.TRACE))); services.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP); initDriver(); List<SocketConfiguration> transports = config.getTransports(); if ( transports != null && !transports.isEmpty()) { for (SocketConfiguration socketConfig:transports) { SocketListener socketConnection = startTransport(socketConfig, bs.getBufferManager(), config.getMaxODBCLobSizeAllowed()); if (socketConfig.getSSLConfiguration() != null) { try { socketConfig.getSSLConfiguration().getServerSSLEngine(); } catch (Exception e) { throw new TeiidRuntimeException(e); } } this.transports.add(socketConnection); } } this.shutdownListener.setBootInProgress(false); this.shutdownListener.started(); this.jmxService = new JMXService(this.dqp, this.bufferService, this.sessionService); this.jmxService.registerBeans(); running = true; } EmbeddedServer(); void addConnectionFactoryProvider(String name,
            ConnectionFactoryProvider<?> connectionFactoryProvider); void addConnectionFactory(String name, Object connectionFactory); synchronized void start(@SuppressWarnings("hiding") EmbeddedConfiguration config); void addTranslator(Class<? extends ExecutionFactory> clazz); void addTranslator(String name, String type, Map<String, String> properties); void addTranslator(String name, ExecutionFactory<?, ?> ef); void deployVDB(String name, ModelMetaData... models); void deployVDB(InputStream is); void deployVDB(InputStream is, boolean ddl); void deployVDBZip(URL url); void undeployVDB(String vdbName); void undeployVDB(String vdbName, String version); synchronized void stop(); TeiidDriver getDriver(); @Override EventDistributor getEventDistributor(); @SuppressWarnings("unchecked") @Override ExecutionFactory<Object, Object> getExecutionFactory(String name); String getSchemaDdl(String vdbName, String schemaName); int getPort(int transport); Admin getAdmin(); static void createPreParser(VDBMetaData deployment);  }