53
ISC System

ISC system

Embed Size (px)

Citation preview

Page 1: ISC system

ISC System

Page 2: ISC system

1

2

3

4

5

Background and introduction Requirements

System structure

Interfaces

Testing and Efficiency analyse

Page 3: ISC system

Background and introduction

1

In Flight Sensor(TEXT)

WEA

DATA BASE

XML

Graphic View

Modules

UsersWEA-Controler

Report Pantry Mods Accouting

Weight Hitory ……….

Interface

Page 4: ISC system

Background and introduction

1

Current Work follow

User AUser A

User BUser B

File A

M

Latest FileA

Update fileA to Local

M

Share FolderIntranet

Intranet

Update

M :Modify Weight Engineering ApplicationBy hands

Page 5: ISC system

Background and introduction

1Serialization

WEA

XmlSerializerXML

Objects

Deserialization WEA

XmlSerializerXML

Objects

Page 6: ISC system

Background and introduction

1• Distributed version control system also known as revision control and source control, is the

management of changes to documents, programs, and other information stored as files. It is most commonly used in software development, where a team of people may change the same files. It takes a peer-to-peer approach, as opposed to client-server approach, each peer’s working copy of the file is a bona-fide repository.

• Mercurial Mercurial is a fast, lightweight open source distributed

version control system designed for easy and efficient handling of very large distributed projects. It is easy to learn and use, lightweight, scalable and have multiple interfaces to be extended. With Mercurial we can use a multitude of different workflows. The reason we choose mercurial as our distributed version control system is that it is easy to build a layer above mercurial and have fully control of all the functionalities.

Page 7: ISC system

Background and introduction

1

Application

Service

Service Service

Service Service

•ServiceGenerally a Service is a unit of functionality exposed to the world. In that point, it is the next evolutionary step in the long journey form functions to objects to components to services.

Services can be local or remote, can be designed by multiple parties using any technology and can be executed on different time-lines. Inside a service only prescribed communication patterns are allowed

Page 8: ISC system

Background and introduction

1

•WCFWCF is a software development kit for developing and deploying services on Windows. Generally, WCF is Microsoft’s implementation of a set of industry standards defining service interactions, type conversions, marshalling, and the management of numbers of different protocols. Even services can be builded without WCF, in practice, building services is significantly easier with WCF.

WCF Service

Local Application

Process

MESSAGE

MESSAGE

MESSAGE

Web Pages

MESSAGE

Windows Form

Other WCF Service

MESSAGE

Intermediary message exchange

Machine BMachine A

Machine C

wwwwww

Process 2

Client1Proxy

Proxy Client2

Process 1

Service

Process 3

Client1Proxy

Proxy Client2

Page 9: ISC system

Background and introduction

1

•End pointEach Service is associated with the address that defines where the service is, a binding that defines how to communicate with the service, and a contract that shows what the service does. WCF formalizes this in the form of endpoint. It is a fusion of address, binding and contract.

AddressContract

Binding

The Endpoint

Page 10: ISC system

• To manage different levels of what's downloaded depending on where the user is located.

• To develop this system to access file from the remote server.

• To develop a clever system so that only files changes are uploaded and downloaded.

2 Requirements• The aim for the system is to

enable all files to reside on one a remote server and for the WEA to access the required files when needed. A local version will always be present but will be updated from the remote server when required.

Page 11: ISC system

3 Interfaces

Click to access qantas control

panel

Click to access Weight Engineering Applicaiton

The sidebar icon for ISC system

Page 12: ISC system

3 Interfaces

Click to access qantas control

panel Click to access Weight

Engineering Applicaiton

Click to access Admin window

Click to show the runing log

Click to exit

Right click to show menu

Page 13: ISC system

3 Interfaces

Page 14: ISC system

3 Interfaces

Page 15: ISC system

3 Interfaces

Page 16: ISC system

3 Interfaces

Page 17: ISC system

3 Interfaces

Page 18: ISC system

3 Interfaces

Page 19: ISC system

4 System structure

Page 20: ISC system

4 System structure

Page 21: ISC system

4 System structure

Data_Storage Mercurial Control Layer

NotificationIconWpfCustmize Pop upServerFunction

Service icon

Data serilization

Testing Project

Page 22: ISC system

4 System structure • Data serialization The key responsibility for the Data serialization subproject is to serialize and deserialize objects between program and disk. It is an open source class library, supporting numbers of data type in the disk such as XML file, txt file, configuration file registry file and initialization file. For each kind of file type, it offers an interface. By using this class library, we can simply read and write objects from disk without worrying about actuarial data serialization.

Page 23: ISC system

4 System structure • Data StorageThe key responsibility of the data storage project is to customized

the data serialization subproject create a general class specifically for our ISC system for further use.

Page 24: ISC system

4 System structure • Mercurial control layer The key responsibility of the mercurial control layer is to

communicate with lower level version control software Mercurial. Specifically, it enables other subprojects to run lower level version control command via instance of classes.

Control Layer of Mercurial

ISC System WEA

Mercurial

Control Layer

ISC system

Mercurial Control Layer

Server fuction

Lower Level Mercurial

Hg update Hg Commit Hg Push Hg Pull

Other subprojects

……..

Page 25: ISC system

4 System structure

The basic idea of this control layer is running an executable file with proper parameters via c sharp build in communication classes. There is a base class called command base, each Mercurial command inherit the base command.

Mercurial Control Layer

Base command

update Add Remove Commit …….

Page 26: ISC system

4 System structure • Server Functionserver function plays a pivotal role in the whole ISC system, every

class in this subproject is related to the core logic of our system . It offers key functionalities for WCF service and defines the endpoint which include address, contract and binding in the service.

Page 27: ISC system

4 System structure • E nd Point A Service Endpoint has an Address, a Binding, and a Contract.

Here are the details in ISC system’s service endpoints.

Page 28: ISC system

4 System structure • AddressAn endpoint address is basically an Uri, a network address where

the endpoint resides. It is a unique address for the service and provides the location of the service and the transport protocol used to communicate with the service.

[Transport]://[machine or domain][:optional port]

[Base Address ]/ [optional URI]

Http://localhost:8001Http://localhost:8001/myserviceNet.tcp://localhost:8002/myserviceNet.pipe://localhost/mypipeNet.msmp://localhost/private/myqueue

In our ISC system, we are using http transport and 8080 port as protocol. The address is unique in network and be occupied at the time ISC system running.

Page 29: ISC system

4 System structure • BindingBindings are used to define communications patterns in the

service. For instance, message can follow a synchronous request-reply or asynchronous fire-and-forget pattern, messages can be bidirectional, messages can be delivered immediately or queued.

our ISC system is aiming at offering service to local client in terms of version control operations. However, the final objective for Qantas Weight Engineering Department is to build a client network by holding a controller service on the server side. The decision comes to Wshttpbinding which uses http for transport.

Page 30: ISC system

4 System structure • App.configThe actual binding definition is in a file called app.config which is

the main configuration file of the ISC system. It also defines some other service configuration parameters such as time out, maximum concurrent sessions, DNS and contract name.

Page 31: ISC system

4 System structure • ContractIn WCF, each service has to expose contracts. Basically, the

contract is a standard way of describing what the service does. There are numbers of contacts in WCF such as Service contracts, Data contracts, Fault contract and Message contracts. In our ISC system we only use Service contracts and Data contracts to define our service. • Service contract

In ISC system there are two service contracts, one is Icallback the other is service. Service defines those operations that the client can perform in the service.

Page 32: ISC system

4 System structure • ServiceBasically, the

service contract defines what can this service do and the real implementation of how to do it are defined somewhere else.

Function name Description

add_file It takes the file name as the only parameter. At the time being called, it will add the file to the current repository

which means after the next commit this file will be tracked by the program and be synchronized in each client.

Because there is no need to return a value after calling this function the Isoneway has been set to true.

set_repository_path It takes a program path as the only parameter. At the time being called, it will download all the related files in the

server to the path. And create a local repository if not exist. It happens in the first time local client program

connect to the service and is part of the installation and initialization of the local client. Apparently it is a one

way call and do not need a return value.

Accept It takes a program path as the only parameter. At the time being called, it will create a new duplex cannel

between the local client program and the service. After the cannel has been created, it will start to monitor the

folder that the program resides. It is first time for a local program to connect to the service in an individual

session. Thus, the Isinitiating parameter turns out to be true.

dis_connect There is no parameter for this function. At the time being called, it will close the duplex cannel and stop

monitoring the local program. At that time point, all operations related to this program will be terminated.

Because of this, IsTerminating is set to be true.

Mark_resolve It takes a file name as the only parameter. At the time being called, it will mark this file as resolved. Without this

the whole monitoring system will not keep running if there is any “dirty” file (the file that remains conflicts)

remains.

Remove_file It takes a file name as the only parameter. At the time being called, it will remove the file in the current repository

which means the file will be deleted and at the next commit time and every client will be synchronized after.

Because there is no need to return a value after calling this function the Isoneway has been set to true.

Request_confilict_list It takes no parameters. At time being called, it will return a list of “dirty” filenames stored in an object called

messageX that we will introduced in data contract section. Because there is a value after calling this function the

Isoneway has been set to false.

Page 33: ISC system

4 System structure • Data ContractThe data contract is like a formal agreement between a service and

a client that abstractly describes the data to be exchanged. That is, for communication purpose, the client and the service do not have to share the same types but the same contracts.

Page 34: ISC system

4 System structure

• ICallbackThe Icallback contract’s

responsibility is to enable the ISC system calling clients at the time some events happen.

Function name Description

conflicts_onhappen It is supposed to be implemented in the client program

side and takes a list of conflicts file as parameter. The

list is packaged in an object called messageX. At the

time being called, it will invoke proper local method in

client side to handle the conflict.

update_onhappen It is supposed to be implemented in the client program

side and takes no parameters. It will invoke related

functions in the local client program to handle the case

of at the time of updating.

confirmAccept In order to inform the client that the channel has been

successfully created and invoke proper client functions.

update_end In order to inform the client that the update has been

successfully finished and invoke proper client

functions.

Page 35: ISC system

4 System structure • Implementation contractThe functions class implements service contract is one of the core classes of business logic, we will start from the program work flow in order to gives a better understanding of the class structure.

Page 36: ISC system

4 System structure • Accept In our ISC system, it build the connection initially by calling the

function called accept. It takes one string as the only parameter which indicated the program name.

Accept

INFORMATION SERVICE CENTER

(ISC)

CLIENTPROGRAM

MASTER PREPO

CLOUD

Start monitoring folder

Y

Open ProgramBuild connection

Connection cannel created

Checking Dirty file NO Waiting for

resolving

Initialized program info

Accept

Instance of function

INFORMATION SERVICE CENTER

(ISC)

CLIENTPROGRAM

Open ProgramCalling accept

Instance of function created

Create Instance of intiallizer

Create Program_Controler

Call start

Calling this.checking

resolve

Y

Dirty files

Page 37: ISC system

4 System structure • Program controler At the time the object of program_controller has been created, it will

initialize the object using its constructor. As the figure shows, in the initialization part, the object will get the path from initializer and set all the locks to false. Also, it will locate the local repository using the path in order to perform lower level Mercurial operations. Program_Controller

INFORMATION SERVICE CENTER

(ISC)

Object of program_controller

Initialization

Set repo_path

Create Monitor from accept

Initialize all locks

Locate repository

Call Monitor folder

Page 38: ISC system

4 System structure • Timer Timer is a system class that allows us to set a time interval to execute

an event after that interval continuously.

Multi- threading

Commit_Timer

auto_detect_close_moni

tor

Monitor_Timer BackgroundWorker Internal Timer

Restart_lockRestart_lockProgram_statusProgram_status

Run_backrounderworker auto_commit Auto_end_co

mmit Make_commit

Commit_lockCommit_lock

Auto_upadte

TF

T T F

Thread

Method

Page 39: ISC system

4 System structure • Multi-threadingThe actual monitoring starts with a function call called monitor folder.

And will invoke several threads.Multi- threading

Commit_Timer

auto_detect_close_moni

tor

Monitor_Timer BackgroundWorker Internal Timer

Restart_lockRestart_lockProgram_statusProgram_status

Run_backrounderworker auto_commit Auto_end_co

mmit Make_commit

Commit_lockCommit_lock

Auto_upadte

TF

T T F

Thread

Method

Monitor Timer

Detect close

Every half second

Background_worker

Program_statusProgram_status

check

Background_worker

Start a new round auto_commit

Restart lockRestart lockcheck Unlocked

ReturnLocked

New round auto_commit

Internal Timer

Auto_commit_end

One time after one minute

Auto_update

Commit Timer

Commit

Every second

Page 40: ISC system

4 System structure

• Make commit Now, we already have the basic idea about the workflow. In the next following sections, we’ll focus on auto_update and commit to lift the veil of how the real communication happens. Make_commit

True

Set commit_lock to true

False

checkCommit_lockCommit_lock

checkMissing fileMissing file

Recover missing filesTrue

Run hg commit

False

Set commit_lock to false

New changes

check

YEs

NO

at the beginning of a single commit call, it will check whether other commit is still running by checking the commit_lock which is a bool value. If there is a running commit function, this function will be aborted. On the other hand, if there is no current running commit it will check the missing files by calling lower level mercurial command “hg status” and do proper recovery by “hg revert”.

Page 41: ISC system

4 System structure

• Hg status

Detect new local changes

Hg status

M A R C !?

Page 42: ISC system

4 System structure • Auto_update at the beginning of the

auto_update, it will check whether the internet connection is built. If not, it is no need to perform any update connection. It will also check whether there is an existing running commitment thread. If that is the case, the function will be aborted. After all check success, the system will connect to server and check is there any new incoming and outgoing changes. Here the incoming changes means changes which is new to the local client. Relatively, the outgoing changes means changes that is new to the server. If both of changes exist, there is a chance to have conflicts which means changes are in the same files and unfortunately in the same line. That is the reason why we check is there any conflict when both changes exist. If there is no conflict, the inside Mercurial merging system will automatically merge the changes. Relatively, if it do have a conflict, the function will be aborted and inform the local program to resolve.

Page 43: ISC system

4 System structure • Hg resolve

Local app

Hg resolve

Hg resolve

Confilcits file listnothing Inform

Page 44: ISC system

4 System structure • Set_repository_pa

th at the start of the call

of set_repository_path, it stores the path of the local program. It only happens at the first time of the connection. After that, it creates the local repository set the configuration hgrc files which include the user name and server path for the program.

Set_repository_path

Local app Store path

Program PathCall

Create repository Hg init

Write to hgrc config file

Page 45: ISC system

4 System structure • Add file at the start of the

add_file call, it simply executes “hg add” with the file name. This functions occurs when the local program generate a new file that need to be synchronized for all the clients.

Add_file

Local app Hg add +”file name”

File name

Mark_resolve

Local app Hg resolve -m +”file name”

File nameCall

• Mark_resloveAfter conflict files has

been resolved by the local program, this functions will be called to tell the ISC system mark the files as “cleaned” file. This can be done by executes “hg resolve –m “where m means mark.

Page 46: ISC system

4 System structure • Request conflict

list it enables the local

client to ask which and where are “dirty” files. At the calling time, it executes “hg resolve” to request the file list and using call back to pass the list to local client

• Removefileit enables the local

client to remove a specific file by passing the file name to the ISC system. It executes “hg remove” in the backend and will delete that file permanently in this local client and will be synchronized for all clients.

Request conflict list

Local app Hg resolve Conflict list

Call

Removefile

Local app Hg remove+ filename

filenameCall

Page 47: ISC system

4 System structure • Customized pop up and Notification WPF The key responsibility of those two subproject are to make a proper

tray icon and pop up for other subproject to use. It is a purely backend class and offer a large numbers of different lay out base on windows presentation foundation technology.

Data_Storage Mercurial Control Layer

NotificationIconWpfCustmize Pop upServerFunction

Service icon

Data serilization

Testing Project

Page 48: ISC system

4 System structure • Service icon The service icon project is the highest level subproject in the ISC

system which means the whole system starts with this subproject and it invokes the chain of the system. It is the host program of the service and mainly focus on all user interactions and GUI design.

Data_Storage Mercurial Control Layer

NotificationIconWpfCustmize Pop upServerFunction

Service icon

Data serilization

Testing Project

Page 49: ISC system

4 System structure • Server set upThe actual master repository sits in the remote windows 2008 server

and has been proper cconfiged

Page 50: ISC system

4 System structure • Graph view Graph view are provided in the server side and can be directly

accessed by browser.

Page 51: ISC system

• The longest common subsequence (LCS) algorithmGiven two string X and Y, the longest common subsequence(LCS)

is to find a longest subsequence common to both X and Y.

5 Testing and Efficiency analyse

The overall running time is O(nm) which is much efficient than O(n3) that is the way Mercurial use to extract changes

Page 52: ISC system

• Memory use testingTen minutes testing for both ISC system and dropbox

5 Testing and Efficiency analyse

ISC system

Dropbox

Page 53: ISC system

Thank you