@Test public void testPrepareWrapper() throws ClassNotFoundException, InstantiationException, IllegalAccessException { VSensorLoader loader = new VSensorLoader(); MockWrapper wrapper = (MockWrapper) loader.createWrapper(addressing[0]); assertNotNull(wrapper); }
public AbstractWrapper createWrapper(AddressBean addressBean) throws InstantiationException, IllegalAccessException { if ( Main.getWrapperClass ( addressBean.getWrapper ( ) ) == null ) { logger.error ( "The wrapper >" + addressBean.getWrapper ( ) + "< is not defined in the >" + WrappersUtil.DEFAULT_WRAPPER_PROPERTIES_FILE + "< file." ); return null; } AbstractWrapper wrapper = ( AbstractWrapper ) Main.getWrapperClass ( addressBean.getWrapper ( ) ).newInstance ( ); wrapper.setActiveAddressBean ( addressBean ); boolean initializationResult = wrapper.initialize_wrapper ( ); if ( initializationResult == false ) return null; try { logger.debug("Wrapper name: "+wrapper.getWrapperName()+ " -- view name "+ wrapper.getDBAliasInStr()); if (!Main.getWindowStorage().tableExists(wrapper.getDBAliasInStr(),wrapper.getOutputFormat())) Main.getWindowStorage().executeCreateTable ( wrapper.getDBAliasInStr ( ) , wrapper.getOutputFormat ( ),wrapper.isTimeStampUnique() ); } catch ( Exception e ) { try{ wrapper.releaseResources(); }catch (SQLException sql){ logger.error ( sql.getMessage ( ) , sql ); } logger.error ( e.getMessage ( ) , e ); return null; } return wrapper; }
VSensorLoader extends Thread { public AbstractWrapper createWrapper(AddressBean addressBean) throws InstantiationException, IllegalAccessException { if ( Main.getWrapperClass ( addressBean.getWrapper ( ) ) == null ) { logger.error ( "The wrapper >" + addressBean.getWrapper ( ) + "< is not defined in the >" + WrappersUtil.DEFAULT_WRAPPER_PROPERTIES_FILE + "< file." ); return null; } AbstractWrapper wrapper = ( AbstractWrapper ) Main.getWrapperClass ( addressBean.getWrapper ( ) ).newInstance ( ); wrapper.setActiveAddressBean ( addressBean ); boolean initializationResult = wrapper.initialize_wrapper ( ); if ( initializationResult == false ) return null; try { logger.debug("Wrapper name: "+wrapper.getWrapperName()+ " -- view name "+ wrapper.getDBAliasInStr()); if (!Main.getWindowStorage().tableExists(wrapper.getDBAliasInStr(),wrapper.getOutputFormat())) Main.getWindowStorage().executeCreateTable ( wrapper.getDBAliasInStr ( ) , wrapper.getOutputFormat ( ),wrapper.isTimeStampUnique() ); } catch ( Exception e ) { try{ wrapper.releaseResources(); }catch (SQLException sql){ logger.error ( sql.getMessage ( ) , sql ); } logger.error ( e.getMessage ( ) , e ); return null; } return wrapper; } }
VSensorLoader extends Thread { public AbstractWrapper createWrapper(AddressBean addressBean) throws InstantiationException, IllegalAccessException { if ( Main.getWrapperClass ( addressBean.getWrapper ( ) ) == null ) { logger.error ( "The wrapper >" + addressBean.getWrapper ( ) + "< is not defined in the >" + WrappersUtil.DEFAULT_WRAPPER_PROPERTIES_FILE + "< file." ); return null; } AbstractWrapper wrapper = ( AbstractWrapper ) Main.getWrapperClass ( addressBean.getWrapper ( ) ).newInstance ( ); wrapper.setActiveAddressBean ( addressBean ); boolean initializationResult = wrapper.initialize_wrapper ( ); if ( initializationResult == false ) return null; try { logger.debug("Wrapper name: "+wrapper.getWrapperName()+ " -- view name "+ wrapper.getDBAliasInStr()); if (!Main.getWindowStorage().tableExists(wrapper.getDBAliasInStr(),wrapper.getOutputFormat())) Main.getWindowStorage().executeCreateTable ( wrapper.getDBAliasInStr ( ) , wrapper.getOutputFormat ( ),wrapper.isTimeStampUnique() ); } catch ( Exception e ) { try{ wrapper.releaseResources(); }catch (SQLException sql){ logger.error ( sql.getMessage ( ) , sql ); } logger.error ( e.getMessage ( ) , e ); return null; } return wrapper; } VSensorLoader();  VSensorLoader( String pluginsPath ); }
VSensorLoader extends Thread { public AbstractWrapper createWrapper(AddressBean addressBean) throws InstantiationException, IllegalAccessException { if ( Main.getWrapperClass ( addressBean.getWrapper ( ) ) == null ) { logger.error ( "The wrapper >" + addressBean.getWrapper ( ) + "< is not defined in the >" + WrappersUtil.DEFAULT_WRAPPER_PROPERTIES_FILE + "< file." ); return null; } AbstractWrapper wrapper = ( AbstractWrapper ) Main.getWrapperClass ( addressBean.getWrapper ( ) ).newInstance ( ); wrapper.setActiveAddressBean ( addressBean ); boolean initializationResult = wrapper.initialize_wrapper ( ); if ( initializationResult == false ) return null; try { logger.debug("Wrapper name: "+wrapper.getWrapperName()+ " -- view name "+ wrapper.getDBAliasInStr()); if (!Main.getWindowStorage().tableExists(wrapper.getDBAliasInStr(),wrapper.getOutputFormat())) Main.getWindowStorage().executeCreateTable ( wrapper.getDBAliasInStr ( ) , wrapper.getOutputFormat ( ),wrapper.isTimeStampUnique() ); } catch ( Exception e ) { try{ wrapper.releaseResources(); }catch (SQLException sql){ logger.error ( sql.getMessage ( ) , sql ); } logger.error ( e.getMessage ( ) , e ); return null; } return wrapper; } VSensorLoader();  VSensorLoader( String pluginsPath ); void addVSensorStateChangeListener(VSensorStateChangeListener listener); void removeVSensorStateChangeListener(VSensorStateChangeListener listener); boolean fireVSensorLoading(VSensorConfig config); boolean fireVSensorUnLoading(VSensorConfig config); static VSensorLoader getInstance(String path); void startLoading(); void run( ); synchronized void loadVirtualSensor(String vsConfigurationFileContent, String fileName); static String getVSConfigurationFilePath(String fileName); synchronized void loadPlugin(); synchronized boolean loadPlugin(String fileFilterName); boolean isVirtualSensorValid(VSensorConfig configuration); void removeAllVSResources( VirtualSensor pool ); void releaseStreamSource(StreamSource streamSource); static Modifications getUpdateStatus(String virtualSensorsPath); static Modifications getUpdateStatus(String virtualSensorsPath, String filterFileName); boolean createInputStreams( VirtualSensor pool ); AbstractWrapper createWrapper(AddressBean addressBean); boolean prepareStreamSource( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource  ); boolean prepareStreamSource( StreamSource streamSource ,DataField[] outputformat, AbstractWrapper wrapper ); void stopLoading( ); }
VSensorLoader extends Thread { public AbstractWrapper createWrapper(AddressBean addressBean) throws InstantiationException, IllegalAccessException { if ( Main.getWrapperClass ( addressBean.getWrapper ( ) ) == null ) { logger.error ( "The wrapper >" + addressBean.getWrapper ( ) + "< is not defined in the >" + WrappersUtil.DEFAULT_WRAPPER_PROPERTIES_FILE + "< file." ); return null; } AbstractWrapper wrapper = ( AbstractWrapper ) Main.getWrapperClass ( addressBean.getWrapper ( ) ).newInstance ( ); wrapper.setActiveAddressBean ( addressBean ); boolean initializationResult = wrapper.initialize_wrapper ( ); if ( initializationResult == false ) return null; try { logger.debug("Wrapper name: "+wrapper.getWrapperName()+ " -- view name "+ wrapper.getDBAliasInStr()); if (!Main.getWindowStorage().tableExists(wrapper.getDBAliasInStr(),wrapper.getOutputFormat())) Main.getWindowStorage().executeCreateTable ( wrapper.getDBAliasInStr ( ) , wrapper.getOutputFormat ( ),wrapper.isTimeStampUnique() ); } catch ( Exception e ) { try{ wrapper.releaseResources(); }catch (SQLException sql){ logger.error ( sql.getMessage ( ) , sql ); } logger.error ( e.getMessage ( ) , e ); return null; } return wrapper; } VSensorLoader();  VSensorLoader( String pluginsPath ); void addVSensorStateChangeListener(VSensorStateChangeListener listener); void removeVSensorStateChangeListener(VSensorStateChangeListener listener); boolean fireVSensorLoading(VSensorConfig config); boolean fireVSensorUnLoading(VSensorConfig config); static VSensorLoader getInstance(String path); void startLoading(); void run( ); synchronized void loadVirtualSensor(String vsConfigurationFileContent, String fileName); static String getVSConfigurationFilePath(String fileName); synchronized void loadPlugin(); synchronized boolean loadPlugin(String fileFilterName); boolean isVirtualSensorValid(VSensorConfig configuration); void removeAllVSResources( VirtualSensor pool ); void releaseStreamSource(StreamSource streamSource); static Modifications getUpdateStatus(String virtualSensorsPath); static Modifications getUpdateStatus(String virtualSensorsPath, String filterFileName); boolean createInputStreams( VirtualSensor pool ); AbstractWrapper createWrapper(AddressBean addressBean); boolean prepareStreamSource( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource  ); boolean prepareStreamSource( StreamSource streamSource ,DataField[] outputformat, AbstractWrapper wrapper ); void stopLoading( ); static final String VSENSOR_POOL; static final String STREAM_SOURCE; static final String INPUT_STREAM; }