@Test public void testGetCapabilities() throws Exception { final Object cf = new Object(); ExecutionFactory ef = new ExecutionFactory() { public boolean isSourceRequiredForCapabilities() { return true; } }; final Object[] cfHolder = new Object[1]; ConnectorManager cm = new ConnectorManager("FakeConnector","FakeConnector", ef) { public Object getConnectionFactory(){ return cfHolder[0]; } }; cm.start(); try { cm.getCapabilities(); fail(); } catch (TranslatorException e) { } ef = new ExecutionFactory() { public boolean isSourceRequiredForCapabilities() { return true; } @Override public Object getConnection(Object factory, ExecutionContext executionContext) throws TranslatorException { assertEquals(cf, factory); return factory; } @Override public void closeConnection(Object connection, Object factory) { } }; cm = new ConnectorManager("FakeConnector","FakeConnector", ef) { public Object getConnectionFactory(){ return cfHolder[0]; } }; cfHolder[0] = cf; cm.getCapabilities(); }
public SourceCapabilities getCapabilities() throws TranslatorException, TeiidComponentException { if (cachedCapabilities != null) { return cachedCapabilities; } checkStatus(); ExecutionFactory<Object, Object> translator = getExecutionFactory(); synchronized (this) { if (cachedCapabilities != null) { return cachedCapabilities; } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(translator.getClass().getClassLoader()); cachedCapabilities = buildCapabilities(translator); } finally { Thread.currentThread().setContextClassLoader(originalCL); } } return cachedCapabilities; }
ConnectorManager { public SourceCapabilities getCapabilities() throws TranslatorException, TeiidComponentException { if (cachedCapabilities != null) { return cachedCapabilities; } checkStatus(); ExecutionFactory<Object, Object> translator = getExecutionFactory(); synchronized (this) { if (cachedCapabilities != null) { return cachedCapabilities; } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(translator.getClass().getClassLoader()); cachedCapabilities = buildCapabilities(translator); } finally { Thread.currentThread().setContextClassLoader(originalCL); } } return cachedCapabilities; } }
ConnectorManager { public SourceCapabilities getCapabilities() throws TranslatorException, TeiidComponentException { if (cachedCapabilities != null) { return cachedCapabilities; } checkStatus(); ExecutionFactory<Object, Object> translator = getExecutionFactory(); synchronized (this) { if (cachedCapabilities != null) { return cachedCapabilities; } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(translator.getClass().getClassLoader()); cachedCapabilities = buildCapabilities(translator); } finally { Thread.currentThread().setContextClassLoader(originalCL); } } return cachedCapabilities; } ConnectorManager(String translatorName, String connectionName);  ConnectorManager(String translatorName, String connectionName, ExecutionFactory<Object, Object> ef); }
ConnectorManager { public SourceCapabilities getCapabilities() throws TranslatorException, TeiidComponentException { if (cachedCapabilities != null) { return cachedCapabilities; } checkStatus(); ExecutionFactory<Object, Object> translator = getExecutionFactory(); synchronized (this) { if (cachedCapabilities != null) { return cachedCapabilities; } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(translator.getClass().getClassLoader()); cachedCapabilities = buildCapabilities(translator); } finally { Thread.currentThread().setContextClassLoader(originalCL); } } return cachedCapabilities; } ConnectorManager(String translatorName, String connectionName);  ConnectorManager(String translatorName, String connectionName, ExecutionFactory<Object, Object> ef); String getStausMessage(); List<FunctionMethod> getPushDownFunctions(); SourceCapabilities getCapabilities(); ConnectorWork registerRequest(AtomicRequestMessage message); void start(); void stop(); ExecutionFactory<Object, Object> getExecutionFactory(); Object getConnectionFactory(); String getTranslatorName(); String getConnectionName(); List<String> getId(); }
ConnectorManager { public SourceCapabilities getCapabilities() throws TranslatorException, TeiidComponentException { if (cachedCapabilities != null) { return cachedCapabilities; } checkStatus(); ExecutionFactory<Object, Object> translator = getExecutionFactory(); synchronized (this) { if (cachedCapabilities != null) { return cachedCapabilities; } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(translator.getClass().getClassLoader()); cachedCapabilities = buildCapabilities(translator); } finally { Thread.currentThread().setContextClassLoader(originalCL); } } return cachedCapabilities; } ConnectorManager(String translatorName, String connectionName);  ConnectorManager(String translatorName, String connectionName, ExecutionFactory<Object, Object> ef); String getStausMessage(); List<FunctionMethod> getPushDownFunctions(); SourceCapabilities getCapabilities(); ConnectorWork registerRequest(AtomicRequestMessage message); void start(); void stop(); ExecutionFactory<Object, Object> getExecutionFactory(); Object getConnectionFactory(); String getTranslatorName(); String getConnectionName(); List<String> getId();  }