@Override public void start() throws TranslatorException { super.start(); }
private void initialize(ExecutionFactory connector, Object connectionFactory, TranslationUtility util) throws TranslatorException { this.connector = connector; this.util = util; this.connectionFactory = connectionFactory; this.connector.start(); }
@Override public void start() throws TranslatorException { super.start(); LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Google Spreadsheet ExecutionFactory Started"); //$NON-NLS-1$ }
@Override public void start() throws TranslatorException { super.start(); this.databaseCalender = new DatabaseCalender(this.databaseTimeZone); if (useCommentsInSourceQuery) { //will throw an exception if not valid new MessageFormat(commentFormat); } }
@Override public void start() throws TranslatorException { super.start(); if(this.databaseTimeZone != null && this.databaseTimeZone.trim().length() > 0) { TimeZone tz = TimeZone.getTimeZone(this.databaseTimeZone); if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) { this.timeZone = tz;; } } }
@Override public void start() throws TranslatorException { super.start(); addPushDownFunction(SALESFORCE, INCLUDES, BOOLEAN, STRING, STRING); addPushDownFunction(SALESFORCE, EXCLUDES, BOOLEAN, STRING, STRING); LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Salesforce ExecutionFactory Started"); //$NON-NLS-1$ }
@Override public void start() throws TranslatorException { super.start(); addPushDownFunction("ns", "func", DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING); } };
public static ExecutionFactory buildExecutionFactory(VDBTranslatorMetaData data) throws TeiidException { ExecutionFactory executionFactory; try { Class<?> executionClass = data.getExecutionFactoryClass(); Object o = executionClass.newInstance(); if(!(o instanceof ExecutionFactory)) { throw new TeiidException(RuntimePlugin.Event.TEIID40024, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40024, executionClass)); } executionFactory = (ExecutionFactory)o; synchronized (executionFactory) { injectProperties(executionFactory, data); ClassLoader orginalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(executionFactory.getClass().getClassLoader()); executionFactory.start(); } finally { Thread.currentThread().setContextClassLoader(orginalCL); } } return executionFactory; } catch (InvocationTargetException e) { throw new TeiidException(RuntimePlugin.Event.TEIID40025, e); } catch (IllegalAccessException e) { throw new TeiidException(RuntimePlugin.Event.TEIID40026, e); } catch (InstantiationException e) { throw new TeiidException(CorePlugin.Event.TEIID10036, e); } }
/** * Adds a definition of the {@link ExecutionFactory} using the default name either from the {@link Translator} annotation or the class name. * Only {@link ExecutionFactory} classes with a {@link Translator} annotation can be referenced by {@link #addTranslator(String, String, Map)} * @param ef * @throws TranslatorException */ public void addTranslator(Class<? extends ExecutionFactory> clazz) throws TranslatorException { try { VDBTranslatorMetaData vdbTranslatorMetaData = TranslatorUtil.buildTranslatorMetadata(clazz.newInstance(), null); if (vdbTranslatorMetaData != null) { translatorRepository.addTranslatorMetadata(vdbTranslatorMetaData.getName(), vdbTranslatorMetaData); } else { //not a well defined translator ExecutionFactory<?, ?> instance = clazz.newInstance(); instance.start(); addTranslator(clazz.getName(), instance); } } catch (InstantiationException | IllegalAccessException e) { throw new TranslatorException(e); } }
@Override public void start() throws TranslatorException { super.start(); addPushDownFunction(SIMPLEDB, EVERY, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING+"[]"); //$NON-NLS-1$ addPushDownFunction(SIMPLEDB, INTERSECTION, TypeFacility.RUNTIME_NAMES.BOOLEAN, TypeFacility.RUNTIME_NAMES.STRING+"[]", TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING); //$NON-NLS-1$ addPushDownFunction(SIMPLEDB, INTERSECTION, TypeFacility.RUNTIME_NAMES.BOOLEAN, TypeFacility.RUNTIME_NAMES.STRING+"[]", TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING); //$NON-NLS-1$ addPushDownFunction(SIMPLEDB, INTERSECTION, TypeFacility.RUNTIME_NAMES.BOOLEAN, TypeFacility.RUNTIME_NAMES.STRING+"[]", TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING); //$NON-NLS-1$ }
@Test public void testPushdownFunctionSupport() throws Exception { ExecutionFactory<Object, Object> ef = new ExecutionFactory<Object, Object>(){ @Override public void start() throws TranslatorException { super.start(); addPushDownFunction("ns", "func", DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING); } }; ef.start(); BasicSourceCapabilities bsc = CapabilitiesConverter.convertCapabilities(ef, "conn"); //$NON-NLS-1$ assertTrue("Did not get expected capabilities", bsc.supportsFunction("ns.func")); //$NON-NLS-1$ //$NON-NLS-2$ }
@Test public void testCTESupport() throws Exception { final AtomicBoolean bool = new AtomicBoolean(false); ExecutionFactory<Object, Object> ef = new ExecutionFactory<Object, Object>(){ @Override public boolean supportsCommonTableExpressions() { return bool.get(); } @Override public boolean supportsRecursiveCommonTableExpressions() { return true; } }; ef.start(); BasicSourceCapabilities bsc = CapabilitiesConverter.convertCapabilities(ef, "conn"); //$NON-NLS-1$ assertFalse(bsc.supportsCapability(Capability.RECURSIVE_COMMON_TABLE_EXPRESSIONS)); bool.set(true); bsc = CapabilitiesConverter.convertCapabilities(ef, "conn"); //$NON-NLS-1$ assertTrue(bsc.supportsCapability(Capability.RECURSIVE_COMMON_TABLE_EXPRESSIONS)); } }
@Override public void start() throws TranslatorException { super.start(); setSupportsInnerJoins(true); setSupportsOrderBy(true); setSupportsSelectDistinct(true); setSupportedJoinCriteria(SupportedJoinCriteria.KEY); setSupportsOuterJoins(true); registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("current_date")); //$NON-NLS-1$ registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("current_time")); //$NON-NLS-1$ }
@Test public void testConverts() throws Exception { ExecutionFactory<Object, Object> ef = new ExecutionFactory<Object, Object>(){ @Override public boolean supportsConvert(int fromType, int toType) { return false; } @Override public List<String> getSupportedFunctions() { return Arrays.asList("convert"); } }; ef.start(); BasicSourceCapabilities bsc = CapabilitiesConverter.convertCapabilities(ef, "conn"); //$NON-NLS-1$ assertTrue(bsc.supportsFunction("convert")); //$NON-NLS-1$ assertFalse(bsc.supportsConvert(TypeFacility.RUNTIME_CODES.BIG_DECIMAL, TypeFacility.RUNTIME_CODES.BIG_INTEGER)); }
@SuppressWarnings("nls") @Override public void start() throws TranslatorException { super.start();