(mOSAIC) Redesigning the Dehems system over Mosaic platform

About Dehems

From About the Dehems project:

Logical Dehems architecture

original-architecture.png

Redesigned Dehems arcitecture

Notes:

(The following image can also be viewed in the scalable PDF format: mosaic-architecture.pdf.)

mosaic-architecture.png

Simple deployment descriptor

Notes:

   1 <deployment>
   2 	
   3 	<modules>
   4 		
   5 		<module>
   6 			<identifier>http_sensor_reading_decoder</identifier>
   7 			<code>
   8 				<type>java_single_threaded_module</type>
   9 				<classpath>...</classpath>
  10 				<class>HttpSensorReadingDecoder</class>
  11 				...
  12 			</code>
  13 			<resources>
  14 				<queue-consumer>http_sensor_reading_requests</queue-consumer>
  15 				<queue-publisher>inbound_sensor_readings</queue-publisher>
  16 			</resources>
  17 		</module>
  18 		
  19 		<module>
  20 			<identifier>udp_sensor_reading_decoder</identifier>
  21 			...
  22 		</module>
  23 		
  24 		<module>
  25 			<identifier>inbound_sensor_reading_handler</identifier>
  26 			<code>
  27 				<type>python_single_threaded_module</type>
  28 				<pythonpath>...</pythonpath>
  29 				...
  30 			</code>
  31 			<resources>
  32 				<queue-consumer>inbound_sensor_readings</queue-consumer>
  33 				<key-value-store-writer>sensor_readings</key-value-store-writer>
  34 			</resources>
  35 		</module>
  36 		
  37 	</modules>
  38 	
  39 	<resources>
  40 		
  41 		<queue>
  42 			<identifier>http_sensor_reading_requests</identifier>
  43 			<capabilities>
  44 				<mandatory>true</mandatory>
  45 				<persistent>false</persistent>
  46 				...
  47 			</capabilities>
  48 		</queue>
  49 		
  50 		<queue>
  51 			<identifier>udp_sensor_reading_packets</identifier>
  52 			<capabilities>
  53 				<persistent>false</persistent>
  54 				<mandatory>false</mandatory>
  55 				...
  56 			</capabilities>
  57 		</queue>
  58 		
  59 		<queue>
  60 			<identifier>inbound_sensor_readings</identifier>
  61 			...
  62 		</queue>
  63 		
  64 		<column-store>
  65 			<identifier>sensor_readings</identifier>
  66 			<capabilities>
  67 				<range-queries>true</range-queries>
  68 				<persistent>true</persistent>
  69 				...
  70 			</capabilities>
  71 		</column-store>
  72 		
  73 	</resources>
  74 	
  75 	<end-points>
  76 		
  77 		<http-server>
  78 			<identifier>sensors-http-receiver</identifier>
  79 			<domain>sensors...</domain>
  80 			<port>8080</port>
  81 			<requests>
  82 				<queue>http_sensor_reading_requests</queue>
  83 				<timeout>1</timeout>
  84 				...
  85 			</requests>
  86 		</http-server>
  87 		
  88 		<udp-receiver>
  89 			<identifier>sensors-udp-receiver</identifier>
  90 			<domain>sensors...</domain>
  91 			<port>1932</port>
  92 			<packets>
  93 				<queue>udp_sensor_reading_packets</queue>
  94 			</packets>
  95 		</udp-receiver>
  96 		
  97 	</end-points>
  98 	
  99 </deployment>
deployment.xml

Simple code snippets

Notes:

   1 public class UdpSensorReadingDecoder
   2 		extends GenericSensorReadingDecoder<UdpSensorReadingDecoder.State>
   3 		implements QueueConsumer<UdpPacket>
   4 {
   5 	public State initialize (Context context)
   6 	{
   7 		State state = new State ();
   8 		
   9 		super.initialize (context, state);
  10 		
  11 		state.packetsQueue = context.resolveQueue ("udp_sensor_reading_packets");
  12 		state.packetsConsumer = state.packetsQueue.registerConsumer (this);
  13 		
  14 		return state;
  15 	}
  16 	
  17 	public void consumeMessage (State state, UdpPacket packet)
  18 	{
  19 		SensorReading reading = this.decode (packet);
  20 		this.publish (state, reading);
  21 	}
  22 	
  23 	protected SensorReading decode (UdpPacket request)
  24 	{
  25 		...
  26 	}
  27 	
  28 	public static class State extends GenericSensorReadingDecoder.State
  29 	{
  30 		public Queue packetsQueue;
  31 		public QueueConsumer<UdpPacket> packetsConsumer;
  32 	}
  33 }
UppSensorReadingDecoder.java;
   1 public class GenericSensorReadingDecoder<_State_ extends GenericSensorReadingDecoder.State>
   2 		implements Module<_State_>
   3 {
   4 	protected void initialize (Context context, _State_ state)
   5 	{
   6 		state.readingsQueue = context.resolveQueue ("inbound_sensor_readings");
   7 	}
   8 	
   9 	public void terminate (_State_ state)
  10 	{
  11 		return null;
  12 	}
  13 	
  14 	public Object upgrade (_State_ state)
  15 	{
  16 		return null;
  17 	}
  18 	
  19 	public State upgrade (Context context, Object oldState)
  20 	{
  21 		return this.initialize (context);
  22 	}
  23 	
  24 	protected void publish (_State_ state, SensorReading reading)
  25 	{
  26 		state.readingsQueue.publish (reading);
  27 	}
  28 	
  29 	public static class State
  30 	{
  31 		public Queue readingsQueue;
  32 	}
  33 }
GenericSensorReadingDecoder.java;

Attachments

  • [get | view] (2012-05-23 07:57:57, 0.7 KB) [[attachment:GenericSensorReadingDecoder.java]]
  • [get | view] (2012-05-23 07:57:57, 0.9 KB) [[attachment:HttpSensorReadingDecoder.java]]
  • [get | view] (2012-05-23 07:57:57, 0.2 KB) [[attachment:SensorReading.java]]
  • [get | view] (2012-05-23 07:57:57, 0.8 KB) [[attachment:UppSensorReadingDecoder.java]]
  • [get | view] (2012-05-23 07:57:57, 2.0 KB) [[attachment:deployment.xml]]
  • [get | view] (2012-05-23 07:57:57, 7.5 KB) [[attachment:mosaic-architecture.dia]]
  • [get | view] (2012-05-23 07:57:57, 9.3 KB) [[attachment:mosaic-architecture.pdf]]
  • [get | view] (2012-05-23 07:57:57, 86.7 KB) [[attachment:mosaic-architecture.png]]
  • [get | view] (2012-05-23 07:57:57, 48.0 KB) [[attachment:original-architecture.png]]
 All files | Selected Files: delete move to page