@Test public void testBuildExecutionFactory1() throws Exception { VDBTranslatorMetaData tm = new VDBTranslatorMetaData(); tm.addProperty("someproperty", "correctly-assigned"); tm.setExecutionFactoryClass(MyTranslator1.class); MyTranslator1 my = (MyTranslator1)TranslatorUtil.buildExecutionFactory(tm); assertNull(my.getMyProperty()); assertEquals("correctly-assigned", my.getSomeProperty()); }
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); } }
TranslatorUtil { 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); } } }
TranslatorUtil { 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); } }  }
TranslatorUtil { 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); } }  static ExecutionFactory buildExecutionFactory(VDBTranslatorMetaData data); static ExecutionFactory<Object, Object> buildDelegateAwareExecutionFactory(
            VDBTranslatorMetaData translator, ExecutionFactoryProvider provider); static String getPropertyName(Method method); static Method getSetter(Class<?> clazz, Method method); static String getTranslatorName(ExecutionFactory factory); static VDBTranslatorMetaData buildTranslatorMetadata(ExecutionFactory factory, String moduleName); static VDBTranslatorMetaData buildTranslatorMetadata(ExecutionFactory factory, String moduleName, boolean useNewInstance); static Object getDefaultValue(Object instance, Method method, TranslatorProperty prop); @SuppressWarnings({"rawtypes","unchecked"}) static ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository vdbRepo, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building); }
TranslatorUtil { 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); } }  static ExecutionFactory buildExecutionFactory(VDBTranslatorMetaData data); static ExecutionFactory<Object, Object> buildDelegateAwareExecutionFactory(
            VDBTranslatorMetaData translator, ExecutionFactoryProvider provider); static String getPropertyName(Method method); static Method getSetter(Class<?> clazz, Method method); static String getTranslatorName(ExecutionFactory factory); static VDBTranslatorMetaData buildTranslatorMetadata(ExecutionFactory factory, String moduleName); static VDBTranslatorMetaData buildTranslatorMetadata(ExecutionFactory factory, String moduleName, boolean useNewInstance); static Object getDefaultValue(Object instance, Method method, TranslatorProperty prop); @SuppressWarnings({"rawtypes","unchecked"}) static ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository vdbRepo, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building); static final String DEPLOYMENT_NAME; }