@Test public void testPrepareStreamSource() { }
public boolean prepareStreamSource ( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource ) throws InstantiationException, IllegalAccessException { streamSource.setInputStream(inputStream); AbstractWrapper wrapper = null; for ( AddressBean addressBean : streamSource.getAddressing ( ) ) { addressBean.setInputStreamName(inputStream.getInputStreamName()); addressBean.setVirtualSensorName(vsensorConfig.getName()); wrapper = createWrapper(addressBean); try { if (wrapper!=null && prepareStreamSource( streamSource,wrapper.getOutputFormat(),wrapper)) break; else if (wrapper!=null){ wrapper.releaseResources(); } wrapper=null; } catch (Exception e) { if (wrapper!=null){ try{ wrapper.releaseResources(); }catch(SQLException sql){ logger.error(sql.getMessage(),sql); } } logger.error("Preparation of the stream source failed : "+streamSource.getAlias()+ " from the input stream : "+inputStream.getInputStreamName()+". " + e.getMessage(),e); } } return (wrapper!=null); }
VSensorLoader extends Thread { public boolean prepareStreamSource ( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource ) throws InstantiationException, IllegalAccessException { streamSource.setInputStream(inputStream); AbstractWrapper wrapper = null; for ( AddressBean addressBean : streamSource.getAddressing ( ) ) { addressBean.setInputStreamName(inputStream.getInputStreamName()); addressBean.setVirtualSensorName(vsensorConfig.getName()); wrapper = createWrapper(addressBean); try { if (wrapper!=null && prepareStreamSource( streamSource,wrapper.getOutputFormat(),wrapper)) break; else if (wrapper!=null){ wrapper.releaseResources(); } wrapper=null; } catch (Exception e) { if (wrapper!=null){ try{ wrapper.releaseResources(); }catch(SQLException sql){ logger.error(sql.getMessage(),sql); } } logger.error("Preparation of the stream source failed : "+streamSource.getAlias()+ " from the input stream : "+inputStream.getInputStreamName()+". " + e.getMessage(),e); } } return (wrapper!=null); } }
VSensorLoader extends Thread { public boolean prepareStreamSource ( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource ) throws InstantiationException, IllegalAccessException { streamSource.setInputStream(inputStream); AbstractWrapper wrapper = null; for ( AddressBean addressBean : streamSource.getAddressing ( ) ) { addressBean.setInputStreamName(inputStream.getInputStreamName()); addressBean.setVirtualSensorName(vsensorConfig.getName()); wrapper = createWrapper(addressBean); try { if (wrapper!=null && prepareStreamSource( streamSource,wrapper.getOutputFormat(),wrapper)) break; else if (wrapper!=null){ wrapper.releaseResources(); } wrapper=null; } catch (Exception e) { if (wrapper!=null){ try{ wrapper.releaseResources(); }catch(SQLException sql){ logger.error(sql.getMessage(),sql); } } logger.error("Preparation of the stream source failed : "+streamSource.getAlias()+ " from the input stream : "+inputStream.getInputStreamName()+". " + e.getMessage(),e); } } return (wrapper!=null); } VSensorLoader();  VSensorLoader( String pluginsPath ); }
VSensorLoader extends Thread { public boolean prepareStreamSource ( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource ) throws InstantiationException, IllegalAccessException { streamSource.setInputStream(inputStream); AbstractWrapper wrapper = null; for ( AddressBean addressBean : streamSource.getAddressing ( ) ) { addressBean.setInputStreamName(inputStream.getInputStreamName()); addressBean.setVirtualSensorName(vsensorConfig.getName()); wrapper = createWrapper(addressBean); try { if (wrapper!=null && prepareStreamSource( streamSource,wrapper.getOutputFormat(),wrapper)) break; else if (wrapper!=null){ wrapper.releaseResources(); } wrapper=null; } catch (Exception e) { if (wrapper!=null){ try{ wrapper.releaseResources(); }catch(SQLException sql){ logger.error(sql.getMessage(),sql); } } logger.error("Preparation of the stream source failed : "+streamSource.getAlias()+ " from the input stream : "+inputStream.getInputStreamName()+". " + e.getMessage(),e); } } return (wrapper!=null); } 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 boolean prepareStreamSource ( VSensorConfig vsensorConfig,InputStream inputStream , StreamSource streamSource ) throws InstantiationException, IllegalAccessException { streamSource.setInputStream(inputStream); AbstractWrapper wrapper = null; for ( AddressBean addressBean : streamSource.getAddressing ( ) ) { addressBean.setInputStreamName(inputStream.getInputStreamName()); addressBean.setVirtualSensorName(vsensorConfig.getName()); wrapper = createWrapper(addressBean); try { if (wrapper!=null && prepareStreamSource( streamSource,wrapper.getOutputFormat(),wrapper)) break; else if (wrapper!=null){ wrapper.releaseResources(); } wrapper=null; } catch (Exception e) { if (wrapper!=null){ try{ wrapper.releaseResources(); }catch(SQLException sql){ logger.error(sql.getMessage(),sql); } } logger.error("Preparation of the stream source failed : "+streamSource.getAlias()+ " from the input stream : "+inputStream.getInputStreamName()+". " + e.getMessage(),e); } } return (wrapper!=null); } 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; }