Download CMS (Computers Monitor System) General

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Final Report
Computer monitoring system
For EE faculty
Semester spring, 2006
Denis Zakrevsky
And
Yaroslav Ross
Supervisor: Victor Kulikov
1
Table of contents
2....................... ................................ ................................ ................................ TABLE OF CONTENTS
3........................... ................................ ................................ ................................ TABLE OF FIGURES
4................................. ................................ CMS (COMPUTERS MONITOR SYSTEM) GENERAL.
5............................ ................................ ................................ INTRODUCTION TO TECHNOLOGIES
5......................................... ................................ ................................ MICROSOFT .NET FRAMEWORK
5............ ................................ ................................ ................................ ................................ ADO.NET
5...................................... ................................ ................................ ................................ ASP.NET 2.0
5..................... ................................ ................................ ................................ ................................ SQL
5................................... ................................ ................................ ................................ TRANSACT SQL
6.................. ................................ ................................ ................................ ................................ HTML
6......................................... ................................ ................................ ................................ JAVASCRIPT
7................................. ................................ ................................ ................................ SYSTEM DESIGN
10............. ................................ ................................ ................................ ................................ WEB SITE
10...................... ................................ ................................ ................................ PRESENTATION LAYER
11.................... ................................ ................................ ................................ BUSINESS LOGIC LAYER
12............. ................................ ................................ ................................ DATA ACCESS LAYER (DAL)
14......................................... ................................ ................................ ................................ DATA BASE
14....................................... ................................ ................................ ................................ TABLES LIST
14....................... ................................ ................................ ................................ TABLES' DESCRIPTION
16.................................... ................................ ................................ ................................ PROCEDURES
17............... ................................ ................................ ................................ ................................ SERVICE
18................ ................................ ................................ ................................ WEBSITE USER MANUAL
18....................................... ................................ ................................ ................................ HOME PAGE
18....................................... ................................ ................................ ................................ LOGIN PAGE
19............ ................................ ................................ ................................ PASSWORD MANAGER PAGE
20.................................... ................................ ................................ COMPUTERS MANAGEMENT PAGE
21....................................... ................................ ................................ BUILDINGS MANAGEMENT PAGE
22............... ................................ ................................ ................................ USER MANAGEMENT PAGE
23....................................... ................................ ................................ SYSTEM CONFIGURATION PAGE
24.................................. ................................ ................................ ................................ HELP TOOL TIP
26.......................... ................................ ................................ ................................ DESIGN PATTERNS
26.............................. SINGLETON (CREATIONAL PATTERN):
26................................. OBSERVER (BEHAVIORAL PATTERN):


28........... ................................ ................................ ................................ POSSIBLE IMPROVEMENTS
28..................................... ................................ ................................ SOURCES AND USEFUL LINKS
2
Table of figures
7 ................................................................................... Figure 1: System architecture
7 ........................................................................................... Figure 2: System Design
8 ...................................................................................... Figure 3: Use case diagram
10 ...................................................................................... Figure 4: Website Layers
11 ................................................................................................ Figure 5: BLL clases
13 ....................................................................................... Figure 6: Website Dataset
13 .......................................................................... Figure 7: Website Class Diagram
16 ................................................................................... Figure 8: Database diagram
17 ........................................................................... Figure 9: Monitor Class Diagram
17 ...................................................................................... Figure 10: Monitor Dataset
18 ............................................................................................. Figure 11: Home page
19 .............................................................................................. Figure 12: Login page
19 ..................................................................... Figure 13: Password Manager Page
20 ................................................................................ Figure 14: Computers Search
21 ........................................................................................ Figure 15: Add Computer
22 .................................................................................. Figure 16: Manage Buildings
22 ...................................................................................... Figure 17: Manage Rooms
23 ...................................................................................... Figure 18: Users manager
24 ...................................................................... Figure 19: System Configurations 1
24 ...................................................................... Figure 20: System Configurations 2
25 .......................................................................................... Figure 21: Help Tool Tip
26 ...................................................................... Figure 22: Observer Design Pattern
27 ...................................................................... Figure 23: Observer in CMS project
3
CMS (Computers Monitor System) General.
The purpose of this project was to create a web application that will
give the authorized faculty staff an opportunity to check the status of
computers in electric engineering faculty in order to prevent their
disappearance.
It gives possibility to insert and store information about faculty computers,
system users and other management information and checking computers
state (monitoring) every period of time.
The project was written in C# programming language, with additions
of JavaScript, HTML, and Transact-SQL. MS SQL Server 2005, .NET 2.0,
ADO.NET and ASP.NET 2.0 technologies were also used.
The educational aim was to experience in software system design, database
design, and web development.
4
Introduction to technologies
Microsoft .NET Framework
The Microsoft .NET Framework is a software component that can be added
to or is included with the Microsoft Windows operating system. It provides a
large body of pre-coded solutions to common program requirements, and
manages the execution of programs written specifically for the framework.
The .NET Framework is a key Microsoft offering, and is intended to be used
by most new applications created for the Windows platform.
ADO.NET
ADO.NET is a set of computer software components that can be used by
programmers to access data and data services. It is a part of the base class
library that is included with the Microsoft .NET Framework. It is commonly
used by programmers to access and modify data stored in relational database
systems, though it can also be used to access data in non-relational sources.
ADO.NET is sometimes considered an evolution of ActiveX Data Objects
(ADO) technology, but was changed so extensively that it can be conceived of
as an entirely new product.
ASP.NET 2.0
ASP.NET is a set of Web application development technologies that enables
programmers to build dynamic Web sites, web applications, and XML Web
services. It is part of Microsoft's .NET platform and is the successor to
Microsoft's Active Server Pages (ASP) technology.
ASP.NET is built on the Common Language Runtime, meaning programmers
can write ASP.NET code using any Microsoft .NET language.
SQL
Structured Query Language is a computer language designed for the retrieval
and management of data in relational database management systems,
database schema creation and modification, and database object access
control management. SQL has been standardized by both ANSI and ISO.
Transact SQL
Transact-SQL is Microsoft's and Sybase's proprietary extension to the SQL
language. Microsoft's implementation ships in the Microsoft SQL Server product.
5
Sybase uses the language in its Adaptive Server Enterprise, the successor to
Sybase SQL Server.
In order to make it more powerful, SQL has been enhanced with additional features
such as: Control-of-flow language, local variables, various support functions for string
processing, date processing, mathematics, etc.
HTML
HTML, short for Hypertext Markup Language, is the predominant markup
language for the creation of web pages. It provides a means to describe the
structure of text-based information in a document — by denoting certain text
as headings, paragraphs, lists, and so on — and to supplement that text with
interactive forms, embedded images, and other objects
JavaScript
JavaScript is a scripting language most often used for client-side web
development. Major use of web-based JavaScript is to write functions that are
embedded in or included from HTML pages and interact with the Document
Object Model (DOM) of the page to perform tasks not possible in HTML alone.
Some common examples of this usage are:
Opening or popping up a new window with programmatic control over the
size, position and 'look' of the new window (i.e. whether the menus, toolbars,
etc. are visible).
Validation of web form input values to make sure that they will be accepted
before they are submitted to the server.
Changing images as the mouse cursor moves over them: This effect is often
used to draw the user's attention to important links displayed as graphical
elements.
6
System Design
The monitoring system has the following structure:
Microsoft SQL server
2005
Database
Microsoft Windows
Service
.Net 2.0
Web Site
ASP .Net 2.0
Figure 1: System architecture
Database (MS SQL SERVER 2005): stores all the information about system
users, computers and their properties.
MS service (monitor): monitors the computers, sets the computers status in
database and notifies the administrator if needed by sending email.
Web Site: is used to set and change data in the base, set the monitor settings
and view the information stored in data base.
Web Site Server
DB
User
End Station
Administrator
Windows Server
Service
Faculty PC
Faculty PC
Figure 2: System Design
7
Faculty PC
Faculty PC
Use Cases
A use case defines a goal-oriented set of interactions between external actors
and the system under consideration.
Actors are parties outside the system that interact with the system.
An actor may be a class of users, roles users can play, or other systems.
EE Monitoring System
Change Password
Login
«uses»
User
Monitor
Check Computer
Status
Change computer
status
Change system
settings
Update Database
Add Update-Delete user
Add Update-Delete computer
Add Update-Delete Building
Add Update-Delete Room
Figure 3: Use case diagram
8
Administrator
1. Use Case: Change password
Description: Changes login password
Actors: User, Administrator
Assumptions: Actor previously logged in.
2. Use Case: Login
Description: Login to the system.
Actors: User, Administrator
Assumptions: no
3. Use Case: Check computer status
Description: status of the computers can be checked.
Actors: User, Administrator
Assumptions: Actor previously logged in.
4. Use Case: Change computer status
Description: status of the computers can be changed.
Actors: Administrator
Assumptions: Actor previously logged in.
5. Use Case: Change system settings
Description: Settings of system monitor can be changed.
Actors: Administrator
Assumptions: Actor previously logged in and has the appropriate
permission to perform the action.
6. Use Case: Add-Update-Delete User
Description: Performs the following actions on Users database: Add User,
Delete User, Edit and update user.
Actors: Administrator
Assumptions: Actor previously logged in and has the appropriate
permission to perform the action.
7. Use Case: Add-Update-Delete Computer
Description: Performs the following actions on Computers database:
Add Computer, Delete Computer, Edit, and update Computer.
Actors: Administrator
Assumptions: Actor previously logged in and has the appropriate
permission to perform the action.
8. Use Case: Add-Update-Delete Building
Description: Performs the following actions on Buildings database:
Add Building, Delete Building, Edit and update Building.
Actors: Administrator
Assumptions: Actor previously logged in and has the appropriate
permission to perform the action.
9. Use Case: Add-Update-Delete Room
Description: Performs the following actions on Buildings Room database:
Add Room, Delete Room, Edit and update Room.
Actors: Administrator
Assumptions: Actor previously logged in and has the appropriate
permission to perform the action.
9
Web Site
The Web Site consists of three layers:
1) Presentation Layer.
2) Business Logic Layer (BLL).
3) Data Access Layer (DAL).
Figure 4: Website Layers
Presentation Layer
Presentation layer contains all user interface part of CMS system. It is
collection of Web Pages and Web Controls.
Web Controls are created using ASP.NET 2.0, on C# language. They
used to enable reuse of custom controls in web different pages without
need to create them every time from beginning. Example of such reuse
could be seen "PagingNumberControl.ascx" (will be shown during
presentation).
Web Pages are created using ASP.NET 2.0, on C# language also. All web
pages are based on master page, that using Cascading Style Sheet (CSS)
in order to give unity for all pages and prevent code duplication, for
controls that used in every page. Another technology that was used for
pages is Java Script. It was used for additional custom controls that were
created by third part organizations (tool tip control). Java Script was also
used to write help files for all pages, it allows modularity and if page help is
changed no need to change the page code but only JS file.
On web pages all system data can be presented or edited. Interface with
BLL is also implemented in this layer.
Another important feature that implemented in web pages is user session
variables, which are stored all time that web browser is running and
logout hadn't been done, it allows to user, authenticate himself only on
logon and use all pages.
10
Business Logic Layer
Business Logic Layer (BLL) serves as an intermediary for data exchange
between the presentation layer and the DAL. In "real world" application
this layer can contain large functionality like: security constraints for data
based on user permissions, data operations and other business logic. In
CMS the main functionality of BLL is to transfer data from Presentation
Layer to DAL. Small amount of logic and some minor data operations. This
layer created mostly as contribution to right design of such application and
it makes easier future application development and improvement. The
number of classes in BLL is as a number of logic entities in the system.
These classes are presented in figure bellow:
Business Logic Layer (BLL)
Buildings
BLL
Rooms
BLL
Computers
BLL
Settings
BLL
Configuration
BLL
Permissions
BLL
PC
Status
BLL
Users
BLL
Figure 5: BLL clases
11
Data Access Layer (DAL)
The MS recommended approach, for right software architecture
of Websites is to separate the data access logic from the
presentation layer. All code that is related to data source – such
as creating a connection to the database, issuing SELECT,
INSERT, UPDATE, and DELETE commands, and so on – is located
in the DAL. The presentation layer should not contain any
references to such data access code, but should instead make
calls into the DAL (via BLL in our case) for all data requests. Data
Access Layers contains methods for accessing the database data.
The DAL is written at C# language and strongly uses ADO.NET (2.0). The
DAL is based on collection of strongly-typed objects, (strongly-typed
object is one whose schema is rigidly defined at compile time),
data tables that collected in CMS dataset. Table Adapters also included
in CMS dataset. Table Adapters are classes with methods for
populating the dataset's data tables and propagating
modifications within the data tables back to the database. All
methods, which used in table adapters, call Store Procedures that exists in
CMS database, instead of writing embedded SQL queries. It allows
modularity, changing store procedures functionality in database, without
changing the website code. These methods names are self-commenting.
The CMS dataset is presented in figure bellow:
12
Figure 6: Website Dataset
Figure 7: Website Class Diagram
13
Data base
The data base contains of several tables, some of them have connections.
Tables List
I.
II.
III.
IV.
V.
VI.
VII.
VIII.
IX.
EE_Buildings
EE_Config
EE_ConnectionsLookup
EE_Pc_Connection_Status
EE_Permissions
EE_Rooms
EE_UsersCMS
EE_PcStatus
EE_Computers
Tables' description
a) EE_Buildings.
Description: This table contains the buildings, faculty computers are
stored in.
Columns: - Building ID
- Building Name
b) EE_Config.
Description: This table stores the configuration of monitor
(MS service)
Columns:
- Configuration ID
- Repeat Time – time in seconds *10^ (-6) between monitor
cycles.
- Email – email address for sending mails in case of computer
disappearance.
- Mail server – the mail server email will be sent from.
- Description – short string description of configuration.
c) EE_ConnectionsLookup.
Description: Contains all the ports that monitor must try to connect
during the check.
Columns:
- Connection ID
- Connection Type – Description of port protocol (FTP, email port
etc.)
- Connection Port – Port number.
d) EE_Pc_Connection_Status.
Description: Stores the connection status (succeeded/failed to connect)
for each computer for each connection type.
Columns:
- ID
14
Pc ID – the ID in of the appropriate computer in EE_Computers
table.
- Connection ID – the ID of appropriate connection in
EE_ConnectionsLookup.
- Status – 1 when succeeded to connect, else 0.
- Description – reserved for short description.
EE_PcStatus.
Description: Contains all possible statuses for computers (missing,
repaired, on line).
Columns:
- Status ID
- Status Name
EE_Permissions.
Description: Contains all possible permissions for users’ access.
Columns:
- Permission ID.
- Permission name.
EE_Rooms.
Description: contains the information about the rooms that have
computers.
Columns:
- Room ID.
- Room Number.
- Building ID - the ID of the building the room is placed, in
EE_Buildings table.
EE_UsersCMS.
Description: contains the information about users.
Columns:
- User ID
- User Name
- User Password
- User worker number – for users working in EE faculty
- Faculty
- First Name
- Last Name
- Address
- Email
- Phone number
- Cell phone number
- Permission ID – from EE_ Permissions table.
EE_ Computers.
Description: Holds all the computers information.
Columns:
- PC ID
- PC Name
- Room ID – from EE_ Rooms table
- PC IP – IP address of PC
- Status ID – PC status from EE_PcStatus table.
-
e)
f)
g)
h)
i)
15
Figure 8: Database diagram
Procedures
All the tables have a set of stored procedures for INSERT, DELETE, and EDIT
actions. There is always set of actions that done by entity ID, but for some entities
there are additional sets (by name, by building and etc.).
16
Service
The Monitor Service is part of CMS project that responsible of
scheduled, faculty PCs, monitoring. It is implemented as Windows Service
and need to be installed, on server. The service created using ADO.NET on
C# language.
Monitor contains dataset (DAL), based on ADO.NET, that all data
manipulations done through it. The dataset contains strongly-typed data
tables and table adapters, which calling the store procedures from database,
and transferring\receiving data.
The service activity depends on timer control that invokes, every period
of time, monitor run (this period of timed stored in database and can be
changed via the website). The monitor walks over all existing PCs in
database, which should be online, sends pings and trying to create socket
connections on different ports that define in system settings. If none of
connections is successful, mail about such PC sent to system administrator
(must be defined in system settings via website). The mail sending procedure
is quite "expensive" in time concept, and not depends on the monitoring itself,
so this is done in separate thread, using multithreading mechanism that .Net
provides.
Test application is also added to monitor, in order to run application
without installation. The test application implemented as Windows Form,
which invokes the timer\monitor.
Figure 9: Monitor Class Diagram
Figure 10: Monitor Dataset
17
Website User Manual
Home page
The first page that opens when the user browses to CMS website is home page. This page
contains greeting and link to login page. From the left of the screen, link to all pages are
given, but until the user doesn’t authorize him no page, beside “Password Manager” will not
be open. To start using website the user must go to login screen and to authorize him, all
other links will redirect the user to home page.
Figure 11: Home page
Login page
In order to continue using website user needs to login to the web site. Only authorized
persons can view the information the system contains and only the users that have the
permission of administrator can change the information in the site.
If user is authorized and has username and password, he should enter them to required fields
and click “Log in” button.
If it is a new user that interested to use the site, he should contact the SW lab administration
to get the permission.
If user forgot his password he should click “Change or Recover Password” link in order to go
to “Password Manager” page.
18
Figure 12: Login page
Password Manager Page
Password manager page is used for two tasks:
a. To recover the forgotten password.
b. To change the existing password.
In order to recover the forgotten password, user should enter his username in appropriate
field and press “Submit” button. His password will be sent to email that was given on
registration.
In order to change the password, user should enter current username, password, new
password and the confirmation of a new password in appropriate fields of “Change your
password” control. If error message is shown after you press “Change password” button,
check should be done that username and password are valid and the new password is equal
to its confirmation.
Figure 13: Password Manager Page
19
Computers Management Page
Computers management gives all the users the opportunity to view the computers that belong
to EE department. The opportunity to edit and delete the computers is given only to
administrator.
Filters give user ability to select specific groups of computers.
The list of computers can be arranged by the following categories:
a. All the computers in specific building.
b. All the computers in specific room.
c. All the computers with IP address in specified range.
d. Computer with specific IP address.
All the filters that are not filled will be ignored.
If all the filters are empty, the full list of computers will be shown.
The following options are given to administrator only:
When computer list is shown to administrator two buttons are shown in the right side of each
computer:
Delete: is used to delete the appropriate entry in the list. After the confirmation the computer
will be removed from the list.
Edit: is used to edit the appropriate entry in the list.
An additional option is add new computer to the list.
Pressing “add computer” button will show additional fields and buttons, filling all the required
fields and saving, using “save” button, will add computer to CMS (figure 12).
If user wants to add computer in building or room that does not exist in list, he should first to
add this room or building to the list using “Buildings Manager” menu in the left side.
On editing or adding computer, IP field are validated and if not valid IP the computer will not
be stored. In the computers grid, at every line icon is drawn, bringing mouse on this icon will
show tool tip with the PC status (online, offline and etc’) and what checks are failed or
succeeded (figure 11).
Figure 14: Computers Search
20
Figure 15: Add Computer
Buildings Management Page
Buildings manager allows administrator to manage rooms and buildings lists.
a. Add building.
If user wants to add a new building to the existing list, he should press “Add building”
button, enter Building name in “Building” field and press “Save” button.
b. Add room.
User should press “Add room” button and enter the room number in appropriate field.
Choosing the building the room belongs, is done using the dropdown control. If the
building is not in list, user should add it first using “Add building” option.
c. View Buildings.
User should press “View buildings” button. The list of existing buildings will be shown.
d. View Rooms.
User should press “View rooms” button. The list of existing rooms will be shown.
e. Delete building.
Use “View buildings” option as described above. “Delete” button will be shown next to
each entry of the list. User has to press it and confirm the deletion.
f. Delete room.
Using “View rooms” option as described above. “Delete” button will be shown next to
each entry of the list. Pressing it and confirming this operation will delete room. Note
that building will not be deleted from Buildings list even if all the rooms of this building
were deleted, to delete building see previous section.
21
Figure 16: Manage Buildings
Figure 17: Manage Rooms
User Management Page
Users’ manager can be used only by administrator to manage user list. The options are:
a. Find user.
Users can be found by different criteria: ID, Permissions, and Last Name.
b. View full users list.
The list is shown automatically when you enter the manager.
c. Delete user.
“Delete” button is shown next to each entry of users table. Press it and confirm.
d. Edit user.
“Edit” button is shown next to each entry of users table. Press it and do the changes
you want in the entry
e. Add new user.
Press “Add user” button. Fill all the fields. Fields marked with * are mandatory.
The ID number must be exactly 9 digits long. Email address must be a valid address.
Available permissions are user and administrator. Press save to store the new entry
at the table. All fields are validated, if field doesn’t pass validation appropriate
message will be shown and the user will not be saved.
22
Figure 18: Users manager
System Configuration Page
System manager gives administrator the opportunity to define system options.
a. Monitoring service.
Defines the set of job rules by following options:
- Repeat time: Time interval between job activations. The time is set in mille
seconds resolution. Job activation causes the check of all the computers in list.
- Email: The mail address that will receive messages about computer status
changes.
- Mail server: The mail server all the mails will be sent from.
- Description: General description of set
The administrator has an opportunity to define several different sets of rules but only one of
them will be used. By default only the rules in the first line will be used.
b. Ports to run checks.
The system gives the opportunity to check the status of computer by connecting to
different ports. The ports for check are defined by administrator.
- Connection port is a port number.
- Connection type is general description of port.
“Edit” and “Delete” buttons next to each entry are used to edit and delete
connections.
c.
User permission types.
Each system user has permission. Two permissions are given by default: user and
administrator. However administrator has an option to add a new kind of permission by
typing its name and pressing “Add permission” button. Permissions can also be edited
and deleted by appropriate buttons next to entry.
d. PC status types.
Each PC has its status. Two statuses are given by default: Online and Repaired.
Computers with Online status are checked during job run while Repaired are not.
However administrator has an option to add a new status by typing its name and
pressing “Add status” button. Status can also be edited and deleted by appropriate
buttons next to entry.
23
Figure 19: System Configurations 1
Figure 20: System Configurations 2
Help Tool Tip
On every page user can bring mouse over
icon and it will pop up tool tip with
help for current page. This help is written in JavaScript file and can be modified,
without project compilation.
24
Figure 21: Help Tool Tip
25
Design Patterns
Design pattern is a general repeatable solution to a commonly occurring
problem in software design. A design pattern is not a finished design that
can be transformed directly into code. It is a description or template for
how to solve a problem that can be used in many different situations.
 Singleton (Creational pattern):
The singleton pattern is implemented by creating a class with a method
that creates a new instance of the class if one does not exist. If an
instance already exists, it simply returns a reference to that object
Singleton
-singleton : Singleton
-Singleton()
+getInstance() : Singleton
In CMS project singleton used in:
Class MonitorUtils (Lazy Initialization)
Table adapters in BLL
ADO.NET connection to SQL database is built as singleton

Observer (behavioral pattern):
The observer pattern is a design pattern used in computer programming to observe
the state of an object in a program. This pattern is mainly used to implement a
distributed event handling system. The essence of this pattern is that one or more
objects (called observers or listeners) are registered (or register themselves) to
observe an event which may be raised by the observed object (the subject). (The
object which may raise an event generally maintains a collection of the observers.)
Figure 22: Observer Design Pattern
26
In CMS project singleton used in:
Timer in Monitor service (easy to show).
Built in for many web controls and pages (Buttons, combo boxes and etc).
serviceBase
*
Timer
1
+elapsedEventHandler()
+elapsed()
Monitor
+timer1_elapsed()
Figure 23: Observer in CMS project
27
Possible improvements




Multithreading can be used in monitor in order to improve performance.
The system can inform the administrator not only by email, but also by
SMS.
AJAX technology can be used to improve site performance.
Using ASP.NET membership to receive a built in way for validating and
storing user credentials.
Sources and useful links





Introducing Microsoft .Net, J.Richter.
Design Patterns: Elements of Reusable Object-Oriented Software
(Addison-Wesley Professional Computing Series), E. Gamma
ASP.NET
wikipedia.org
www.w3schools.com/html/
28