项目作者: sshephard2

项目描述 :
Cloud Computing coursework
高级语言: Java
项目地址: git://github.com/sshephard2/cloud-computing.git
创建时间: 2016-12-02T07:19:59Z
项目社区:https://github.com/sshephard2/cloud-computing

开源协议:

下载


Smart Camera application for Cloud Computing Assignment

This coursework assignment was the design and implementation of a simulated Smart Speed Camera application using Microsoft Azure cloud services, specifically:

  • Azure Service Bus topics and subscriptions
  • Azure Table storage

Design

See the design here.

Installation

The Azure services are set up and configured using Python scripts. Before running these, the module AzureCredentials.py must be configured with the Microsoft Azure Service Bus and Table Account login details:

  1. # ServiceBusService credentials
  2. svcbus_namespace = <your namespace>
  3. svcbus_keyname = <your namespace key name>
  4. svcbus_keyvalue = <your namespace key value>
  5. # TableService credentials
  6. table_accountname = <your table account name>
  7. table_accountkey = <your table account key>

To set up the Camera topic and subscriptions for the first time, run the Python script:

  1. CreateAzureServiceBus.py

To set up the Azure table storage, run the Python script:

  1. CreateAzureTableStorage.py

In addition there are a series of Python scripts that can perform simple tests to validate that the topic and subscriptions have been created correctly, by sending and consuming messages.

  1. SendTestAzureServiceBus.py
  2. RecAllTestAzureServiceBus.py
  3. RecVehCheckTestAzureServiceBus.py
  4. RecSpeedingTestAzureServiceBus.py

Before building the Smart Camera applications, the config.properties file under src/main/resources must be configured with the Microsoft Azure Service Bus and Table Account login details:

  1. # Service Bus API config details
  2. ServiceBusNamespace = <your namespace>
  3. ServiceBusKey = <your namespace key>
  4. Topic = cameratopic
  5. ReceiveTimeout = 5
  6. TableAccountName = <your table account name>
  7. TableAccountKey = <your table account key>

The applications may then be built using Maven:

  1. mvn clean package

After this, there is a bug in the Microsoft Azure libraries that causes a duplicate config file to be added to the jar file produced. Open the jar file and remove the smaller version of com.microsoft.windowsazure.core.Builder$Exports from the META-INF\services\ directory.

Running

To start up a Smart Camera and pass in the command line parameters camera id, street, town/city, speed limit, rate of traffic (vehicles per minute):

  1. java -cp target\SmartCam-0.0.1-SNAPSHOT-jar-with-dependencies.jar uk.ac.ncl.smartcam.SmartCam id street town speedlimit rate

To start the NoSQL Consumer worker application on a virtual machine:

  1. java -cp target/SmartCam-0.0.1-SNAPSHOT-jar-with-dependencies uk.ac.ncl.smartcam.NoSqlConsumer

To start the Police Monitor worker application on a virtual machine:

  1. java -cp target/SmartCam-0.0.1-SNAPSHOT-jar-with-dependencies uk.ac.ncl.smartcam.PoliceMonitor

Queries

The queries are implemented in Python.

To query for all camera registrations use:

  1. CameraRegistrationsQuery.py

To query for all sightings of all priority speeding vehicles use:

  1. PriorityVehiclesQuery.py