11.07.2015 Views

System Introspection for System Analysis on Mobile Devices

System Introspection for System Analysis on Mobile Devices

System Introspection for System Analysis on Mobile Devices

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

elements available <str<strong>on</strong>g>for</str<strong>on</strong>g> logging cycles.After parsing the c<strong>on</strong>figurati<strong>on</strong> the XMPPCommunicator is created. This establishesthe communicati<strong>on</strong> with the details of the ServerC<strong>on</strong>fig. On successfulc<strong>on</strong>nect to the communicati<strong>on</strong> server, all comp<strong>on</strong>ent threads are created andstarted by using the list of comp<strong>on</strong>ent threads from the ServerC<strong>on</strong>fig class.Each comp<strong>on</strong>ent thread gets a reference to the communicator, a reference tothe comp<strong>on</strong>ent holder and is added to the observers of the list of all c<strong>on</strong>nectedclients. Initialized comp<strong>on</strong>ent threads are stored inside a map <str<strong>on</strong>g>for</str<strong>on</strong>g> further processing.When all comp<strong>on</strong>ent threads are initialized, the MainDispatcher,Comp<strong>on</strong>entDispatcher and the LogDispatcher are created. By using thedifferent dispatchers the communicati<strong>on</strong> flow between the corresp<strong>on</strong>ding subelements and the client can be c<strong>on</strong>trolled. Elements can <strong>on</strong>ly be requestedby calling these dispatcher classes. Each dispatcher gets a reference to thelist of c<strong>on</strong>nected clients and observes the communicator. For sending messagesa reference to the communicator is passed. The LogDispatcher and theComp<strong>on</strong>entDispatcher need some additi<strong>on</strong>al references. The LogDispatchergets a reference to the comp<strong>on</strong>ent holder and the server c<strong>on</strong>figurati<strong>on</strong>. Thereference to the Comp<strong>on</strong>entHolder is <str<strong>on</strong>g>for</str<strong>on</strong>g>warded <strong>on</strong> request to each createdLoggingCycle. The ServerC<strong>on</strong>fig is used to create a list of available loggingcomp<strong>on</strong>ents. The Comp<strong>on</strong>entDispatcher gets the map of all initializedcomp<strong>on</strong>ents <str<strong>on</strong>g>for</str<strong>on</strong>g> c<strong>on</strong>trolling the communicati<strong>on</strong> between clients and comp<strong>on</strong>entthreads.MainDispatcherThe MainDispatcher class handles all the communicati<strong>on</strong> with the clients. Toreceive commands and send messages the MainDispatcher holds a referenceto the Communicator. The MainDispatcher observes the communicati<strong>on</strong>interface <str<strong>on</strong>g>for</str<strong>on</strong>g> new commands send by clients. All possible commands are definedas c<strong>on</strong>stants in the C<strong>on</strong>stants class and represented as enumerati<strong>on</strong>s.The MainDispatcher c<strong>on</strong>trols the list of all c<strong>on</strong>nected clients by using theClients class referenced <strong>on</strong> creati<strong>on</strong>. Whenever a client sends a c<strong>on</strong>nect command,the MainC<strong>on</strong>troller adds the new client to this list or removes theclient <strong>on</strong> receiving a disc<strong>on</strong>nect command. To m<strong>on</strong>itor the c<strong>on</strong>necti<strong>on</strong> to ac<strong>on</strong>nected clients, the MainDispatcher is running a loop process checking thelist of c<strong>on</strong>nected clients and exchanging a beac<strong>on</strong> with each client (see chapter5.1). Inside the loop the MainDispatcher checks the beac<strong>on</strong> count <str<strong>on</strong>g>for</str<strong>on</strong>g> everyc<strong>on</strong>nected client. If the beac<strong>on</strong> count is below a count <str<strong>on</strong>g>for</str<strong>on</strong>g> maximum missingbeac<strong>on</strong>s, a new beac<strong>on</strong> message is created and <str<strong>on</strong>g>for</str<strong>on</strong>g>warded to that client. If thecount equals a maximum count the client is removed from the list. Removinga client from the list triggers a notify <strong>on</strong> all listeners. This principle allows to37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!