A Real Time Application Integration Solution

4,916 views
4,746 views

Published on

My final project for my BSc. Business Computing degree. The work involved designing a system for a helicopter company operating in the Maltese islands. The design was performed using UML. Prototypes were also drafted to enhance the solution.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,916
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

A Real Time Application Integration Solution

  1. 1. University of Malta Assigned Practical TaskA Real Time Application Integration Solution Lecturer: Mr. T. Spiteri Staines Observer: Profs. A. Leone GanadoPulis MatthewB.Sc. Business and ComputingMay 2005 0
  2. 2. Table of ContentsINTRODUCTION.............................................................................................................. 4 THE CURRENT SYSTEM .............................................................................................................4THE USE OF ERP ............................................................................................................. 5 WHAT IS AN EIS? ...................................................................................................................5 WHAT IS AN ERP? ..................................................................................................................5 WHY AN ERP? .......................................................................................................................5 THE PROBLEMS ASSOCIATED WITH AN ERP ...................................................................................6UNDERSTANDING THE REQUIREMENTS OF THE BUSINESS .......................................... 8 THE BUSINESS DOMAIN............................................................................................................8 ERP INTEGRATION PLANNING ....................................................................................................9 Analysing the Departments ..............................................................................................9 Preparing the Approach ................................................................................................. 10 Implementing the Design .............................................................................................. 12UML MODELLING THE SYSTEM ..................................................................................... 13 WHAT IS UML? ................................................................................................................... 13 WHAT TOOLS DOES UML OFFER? .............................................................................................. 13 AVAILABLE MODELS FOR THE SYSTEM ........................................................................................ 14 THE CLASS DIAGRAM ............................................................................................................. 15 Definition and Purpose of Class Diagram ........................................................................ 15 Use of Class Diagram in this system ............................................................................... 15 Class Diagram ............................................................................................................... 16 THE USE-CASE DIAGRAM ........................................................................................................ 17 Definition and Purpose of Use-Case Diagrams ................................................................. 17 Use of Use Case Diagram in this system ......................................................................... 17 Use-Case Diagrams ....................................................................................................... 18 Definition and Purpose of Sequence Diagram .................................................................. 23 Use of Sequence Diagram in this system ........................................................................ 24 Sequence Diagram ........................................................................................................ 25 STATE CHART DIAGRAMS ........................................................................................................ 30 Definition and Purpose of State Diagram ........................................................................ 30 State Diagram............................................................................................................... 31 1
  3. 3. ACTIVITY DIAGRAM ............................................................................................................... 38 Definition and Purpose of Activity Diagram ..................................................................... 38 Activity Diagram............................................................................................................ 39 COMPONENT AND DEPLOYMENT DIAGRAMS.................................................................................. 51 Definition and Purpose of Component and Deployment Diagram ...................................... 51 Use of both Component and Deployment Diagrams in this system ................................... 51 Component and Deployment Diagram ............................................................................ 52 REASON FOR NOT USING OTHER DIAGRAMS ................................................................................. 53 Object Diagram ............................................................................................................. 53 Collaboration Diagram ................................................................................................... 53MODELLING USING OTHER DIAGRAMS ....................................................................... 54 THE ENTITY RELATIONSHIP DIAGRAM ........................................................................................ 54 Definition and Purpose of E-R Diagram ........................................................................... 54 Use of Entity-Relationship Diagrams in this system .......................................................... 54 Entity-Relationship Diagram ........................................................................................... 55REAL TIME ANALYSIS ................................................................................................... 58 DEFINITION OF REAL TIME ANALYSIS......................................................................................... 58 IMPLEMENTING REAL TIME SITUATIONS IN THIS SYSTEM ................................................................. 58ARCHITECTURE, TECHNOLOGIES AND TOOLS ............................................................. 59 THE INTERNAL NETWORK ....................................................................................................... 59 THE NETWORKING TOPOLOGY.................................................................................................. 60 The Main Network ......................................................................................................... 61 The Protected Network .................................................................................................. 62 The Backup System ....................................................................................................... 63 The Routing .................................................................................................................. 64 TECHNOLOGIES USED ............................................................................................................ 65 MySQL DBMS ................................................................................................................ 65 PHP Scripting Technology .............................................................................................. 65 TOOLS USED ....................................................................................................................... 66PROTOTYPE .................................................................................................................. 67 USER REGISTRATION AND MANAGEMENT MODULE ......................................................................... 67 2
  4. 4. STILL SCREENS .................................................................................................................... 70 DATABASE DESIGN ................................................................................................................ 76 Reason for including the design as well .......................................................................... 76 The Backup Script written in .CGI .................................................................................. 76 SQL Script for Database ................................................................................................ 77CONCLUSION ..............................................................................................................100 PROJECT OVERVIEW ............................................................................................................ 100 FUTURE ENHANCEMENTS ...................................................................................................... 100 NEXT PHASE ...................................................................................................................... 100REFERENCES ...............................................................................................................101DIGITAL MEDIA ..........................................................................................................102 3
  5. 5. IntroductionThe Current SystemThe aim of this system analysis and design is to computerize a helicopter companysystem. In the current system, there is some kind of computerization but thedepartments are working in shadow from each other. The website department, whichhas been created so as to cover this project, will be responsible for the day to dayrunning of the website. Thus the other departments have to ask the website team so asto have access to the database. Where the system was working quite well, it wasdecided that the system will be kept as is, and the new ERP just interface with the othersystem.In other words, the design of this system is to unite all the systems together, allowingfor online booking and also allowing the company managers of each department to haveaccess for reports, which reports can compare data from different departments wherebefore such thing could not have happened unless in a Managers Meeting. 4
  6. 6. The Use of ERPWhat is an EIS?The applications that comprise an enterprises existing system for handling company-wide information. Examples of EISs include: an ERP system, a mainframe transactionprocessing system, and a legacy database system. 1 More or less any kind of computingsystem that is of "enterprise class". This means typically offering high quality of service,dealing with large volumes of data - capable of supporting some large organization ("anenterprise").An Enterprise Information System would typically be operated by professional systemadministrators and be deployed on dedicated servers. It would typically offer networkconnectivity and provide services that supported the operations carried out by theenterprise. 2What is an ERP?ERP (Enterprise Resource Planning) is an industry term for the broad set of activitiessupported by multi-module application software that help a manufacturer or otherbusiness manage the important parts of its business, including product planning, partspurchasing, maintaining inventories, interacting with suppliers, providing customerservice, and tracking orders. ERP can also include application modules for the financeand human resources aspects of a business. Typically, an ERP system uses or isintegrated with a relational database system. 3Why an ERP?ERPs best hope for demonstrating value is as a sort of battering ram for improving theway the company takes a customer order and processes it into an invoice and revenue—otherwise known as the order fulfillment process. That is why ERP is often referred to as1 IBM IIS Glossary : http://publib.boulder.ibm.com/infocenter/adiehelp/topic/com.ibm.wsinted.glossary.doc/topics/glossary.html2 Wikepedia Enterprise Information System : http://en.wikipedia.org/wiki/Enterprise_Information_System3 Masters ITM Club (Glossary of Common IT Terms) : http://www.sauder.ubc.ca/cgs/itm/itm_glossary.html#E 5
  7. 7. back-office software. On the other hand, the system which will be designed in thisassignment handles front selling (booking of flights).People in these different departments all see the same information and can update it.When one department finishes with the order it is automatically routed via the ERPsystem to the next department. ERP can be helpful also to the other major businessprocesses, such as employee benefits or financial reporting.With ERP, the office employees will be taking decisions based on the data the ERP ispresenting them. Is it still worth while for the firm to keep allowing credit terms to thistour-operator? How is the other operator going with sales? Are the sales departmentworking well?, thus are seats being sold more often? The Operations department is itcatering for new flights in peak seasons? These are decisions that office employees,hereinafter will be referred as the Web Team, have never had to make before, and theanswers affect the customer and every other department in the company. But its notjust the Web Team representatives who have to change their duty. People in theOperations Department who used to keep records of the Flights in their own softwarenow need to put that information online. If they dont, the customer-part-website, whowill be representing the sales department will tell the customers that flights do not existsor also that flights are fully-booked. Accountability, responsibility and communicationhave never been tested like this before. 4The Problems associated with an ERPPeople dont like to change, and ERP asks them to change how they do their jobs. Thatis why the value of ERP is so hard to pin down. The software is less important than thechanges companies make in the ways they do business. If the ERP is used to improvethe ways the firm takes bookings, organizes flights, and process bookings, the firm willripe value from the software. If the firm just installs the software without changing theways people do their jobs, the management will not see any value at all—indeed, thenew software could slow the firm down by simply replacing the old software thateveryone knew with new software that no one does.4 Adapted from Enterprise Resource Planning Research Centre : http://www.cio.com/research/erp/edit/erpbasics.html#erp_improve 6
  8. 8. Its critical for the company to figure out if their ways of doing business will fit within theERP package. In this analysis the software was planned to fit the process so as tofacilitate the burden of change. Basically the departments will continue doing theirroutines, just that data has to be inputted onto another software. Until the software hasbeen finished from the implementation stage, when every module is finished, theparticular departments can start using it. However this can introduce dangerous bugsinto the system, thus it is suggested that every data is entered twice, both in the oldproprietary software and onto the new system so as to check system performance.Upgrading the software and/or adding new modules in the proposed system will not bethat hard since the system can be changed quite easily. One must remember that thesystem design will be around the main Database server and interface will almost beusing PHP technology. This will enhance the software in the fact that by combiningHTML and PHP one can create web pages which can interact with the system quiteeasily. A problem which will be troublesome is the backing up of the database serversince all the ERP data will be warehoused on this serverNeedless to say, the move to ERP is a project of breathtaking scope. In addition tobudgeting for software costs, financial executives should plan to cover consulting,process rework, integration testing and a long laundry list of other expenses before thebenefits of ERP start to manifest themselves. Underestimating the price of teachingusers their new job processes can lead to a rude shock down the line, and so can failureto consider data warehouse integration requirements and the cost of extra software toduplicate the old report formats. A few oversights in the budgeting and planning stagecan send ERP costs spiralling out of control faster than oversights in planning almost anyother information system undertaking. 7
  9. 9. Understanding the Requirements of the BusinessThe Business DomainHeliMalta is the leading national helicopter and international helicopter airline and hasbeen operating for these 8 years. Since it’s beginning the company has decided toaccount for online bookings of flights thus launching the website around 7 years ago.From its start, this site has been hugely successful and its usage jumped 291 per centbetween 1999 and 2005. Having seen this high increase in usage, the managementdecided that it is best in Business terms to re-implement the system focusing everythingon the database and all departments sit on a round table passing data to the centre.Another reason which brought forward the idea of re-implement the system is due thatalthough data is being recorded from the website, it still needs re-entering of data fromthe office staff on the proprietary software, thus increasing time and allowing formistakes.The huge increase in demand for the HeliMalta Web site prompted the airline to developtheir fourth generation portal. The new design needed toProvide flexibility to meet new business needsBoost revenuesReduce costsSupport advanced customer relationship management (CRM) initiativesThe aim of this study is to research the industry trends, analyse the business processesand to design and execute plans based on HeliMalta’s business strategy.Tasked also with the integration of the multiple systems for this advanced portal, it willbe needed a robust and extensible middleware solution. This solution had to be: Powerful Reliable – HeliMalta opted for 98% availability threshold Connect to the present software which cannot be changed. Scalable - HeliMalta anticipated major increases in business through the new portal 8
  10. 10. ERP Integration PlanningThe system will be regarded as the main system to which the firm will adapt too. Asexplained earlier, effort has been done to project the system around the particular rolesof each department but in some cases, so as to keep system stability and data validatedin the database, it has been noted that some departments need to alter their day-to-dayrunning procedures.Analysing the DepartmentsThe current firm has the following departments each with a separate system. Followingwill be a list of the current departments which to-date strive for business excellence inobscurity of other departments.Sales Department: This department takes care of sales of tickets. Into this domainfalls the Tour Operators Department which takes care of the Tour Operators. It is up tothe Sales department to chase creditors if bookings have not been made or else that theflights are not being filled up. This department needs to be the front end of thecompany when a client phones for customer support. It is also this department’s role todrop bookings if a customer asks for and it’s also up to this department to reschedule abooking.Marketing Department: This department is responsible for the image of the firm toits surroundings. It is this department responsibility to build trust of the clients to flightwith this company. Such department needs to keep an eye on the whole system fromTop Down view so as to check that all the employees of HeliMalta are making theirutmost effort of depicting the firm as a very serious one. This department is responsibleto media coverage and also to answer any comments, especially attacking ones from themedia. Another task of this department is publicity and advertising. A main task includedin this department portfolio is the Web Site. Care has to be taken that the web site iseasily navigateable, whilst keeping user interface and accessibility at a high rank.Another task of this Department is to use the website as a showcase of the flights whichthe company does, and assign special schemes to different age groups. 9
  11. 11. Human Resources Department: This department is responsible for the employees ofthe firm. The wage increases and other adjustment will be only issued at thediscreteness of this department. Wages have also to be accepted from this Manager’sdepartment. Another task of this department is to keep an updated database list of theemployees working with the firm. Apart from the financial side of this department,another task is the user morale task. This department is in charge of keeping itsemployees with a smile on their job, take care of those employees of have accidents onwork, take care to provide healthy environment and last but not lease offer immediatesupport in any circumstance where the employee has some troubles in his duties.Operations Department: This department is in charge of taking care of organisingflights and must work hand in hand with the sales department. Flight scheduling, thusbooking helipads, scheduling helicopters to flights and making sure that all helicoptersare serviced before departure. Another duty of this department is to work hand in handwith the Human Resources Department and organise the crew for the flights. Accordingto information gathered from this department, the crew scheduled is of the form of 3pilots and 2 Helpers, who in laymen’s words are the normal Steward – Hostesscombination. From this group the reserve pilot and helper will get a normal wage butwill not be covered of extra bonuses.Finance Department: The Finance department, like in every firm is the departmentwhich takes care that expenses don’t run beyond income. This department is also incharge of keeping the cash flow in the business and that the firm is always able to meetliabilities.Preparing the ApproachAn outline has been prepared so as to know to which running software the new systemhas to connect to. Such reports need to be highly free from any bugs since the othersystems will be depending on this ERP.Helipad Booking Software (HeliBOOK)This system is the current system used by HeliMalta so as to book a slot for the HeliPadat the International Airports. Since there are different helipads and each heliport uses itsown system for booking, it is quite useless for the firm to tender the system to be re- 10
  12. 12. implemented. Thus the new ERP needs to be connected to this booking scheme. After aHelipad booking is confirmed from the HeliBOOK system, thus receiving the confirmationfrom the HeliPort of both arrival and departure locations, can the new flight be entered.Thus this implementation has to be done only by the Web Staff. During training period,such explanation need to be delivered to the staff so as to learn and understand thehigh importance of first waiting the confirmation from both Heliports before creating theflight on the ERP System.Accounting Software (SunSystems)This financial and business world-leading software has proved to create a sophisticatedanalytical model of the existing enterprise. The firm has described this process as “WithSunSystems you will have the visibility and insight you need to make key businessdecisions and best position your organisation in relation to your dynamic businessenvironment.”Human Resource Management (HRB)In todays highly competitive and volatile business environment many aspect ofthe companys activities need to be reviewed. Such factors as the increase inlabor efficiency, cost efficiency and the speed of making management decisionscome to the forefront. This system is a new system which has been just installed.More efficient maintenance of company personnel information in a logicallystructured and in a readily accessible manner to easily analyse and plan HRexpenses and to discover new opportunities for increasing cost efficiency.Analyzing the system one can deduce that by direct entry of the on-flight crew, alot of the burden of the HRM system will be removed. Thus, the headache to findthe schedules and flights of all the crew can be ignored now since data can nowbe collected from the roots, thus from the ERP system and passed in bulk to theHRM so as to calculate wages. Depending on what job each person worked asthe HRM needs to calculate only the wage and issue the pay slip. By this system,multiple classification of business processes in the field of Human ResourceManagement. Elimination of multiple entries, optimization of daily operations of 11
  13. 13. employees working at different departments and minimization of routinetransactions that allow the releasing of personnel engaged in those routineactivities and using the resources more efficiently to maximize cost reduction.Implementing the DesignIn this section one can analyse how the data will be passed from the main hub of datato the other running software which the system is enjoying at the moment.Accounting Software (SunSystems)The financial orientated reports which will be prepared from the website can bedownloaded on the disc in a .txt format so as that the office staff just needs to updatethe Accounting software using the xml update from the Database. The text file will havea string of data in the format of row1.colum1, row1.column2, row2.column1 and so on.Such process can be automated in the future but till yet the firm has said that it is betterfor the employees to do it themselves so as to have a feel of what is going on.Human Resource Management (HRB)The report from this system which will cover this department will be prepared in a .xmlformat. Since this software is built on .NET technology, xml will be read without anyproblems. What will be needed from the office staff is to request a report every monthbefore the process of compiling the wages starts. With the xml file, the report will be ina column form like the printout which the user can verify on screen.Both reports will be using SQL constructs so as to reflect the data stored in thedatabase, and there will be no need for the user to compare them to the details on thescreen, since data will be echoed for both reports from the database. Although in theprototype it will not be implemented, the design will include a Printer-Friendly format ofthe report viewed on the screen, and another link which asks for a backup file, whichwill be the file which the other systems will use. 12
  14. 14. UML modelling the SystemWhat is UML?Unified Modelling Language is the industry-standard language for the specification,visualization, construction, and documentation of the components of software systems.UML helps to simplify the process of software design, making a model for constructionwith a number of different views. 5 To organize program code more efficientlyprogrammers often create "objects" that are sets of structured data within programs.UML, which has been standardized by the Object Management Group (OMG), wasdesigned for this purpose. The language has gained enough support that it has becomea standard language for visualizing and constructing software programs. 6What tools does UML offer?The OMGs Unified Modeling Language™ (UML®) helps you specify, visualize, anddocument models of software systems, including their structure and design, in a waythat meets all of these requirements. (You can use UML for business modeling andmodeling of other non-software systems too.) Using any one of the large number ofUML-based tools on the market, you can analyze your future applications requirementsand design a solution that meets them, representing the results using UMLs twelvestandard diagram types.You can model just about any type of application, running on any type and combinationof hardware, operating system, programming language, and network, in UML. Itsflexibility lets you model distributed applications that use just about any middleware.Built upon the MOF™ meta-model which defines class and operation as fundamentalconcepts, its a natural fit for object-oriented languages and environments such as C++,Java, and the recent C#, but you can use it to model non-OO applications as well in, forexample, Fortran, VB, or COBOL. UML Profiles (that is, subsets of UML tailored for5 Network Design and Management : http://authors.phptr.com/morris/glossary.html6 What is UML? http://www.netchico.com/support/glossary/u.html 13
  15. 15. specific purposes) help you model Transactional, Real-time, and Fault-Tolerant systemsin a natural way. In this system design, UML is going to be used as well and theimplementation will be done using PHP. Although PHP does support Classes, it is notvery widely used as such, and the market is waiting for PHP 5 so as to start making full 7use of OO coding.Available Models for the SystemThe heart of object-oriented problem solving is the construction of a model. The modelabstracts the essential details of the underlying problem from its usually complicatedreal world. Several modelling tools are wrapped under the heading of the UML. 8At the centre of the UML are its nine kinds of modelling diagrams, which we describehere. Class diagrams Object diagrams Use case diagrams Sequence diagrams Collaboration diagrams State chart diagrams Activity diagrams Component diagrams Deployment diagrams7 Adapted from Introduction to UML: http://www.omg.org/gettingstarted/what_is_uml.htm8 Adapted from Practical UML™: A Hands-On Introduction for Developers http://bdn.borland.com/article/0,1410,31863,00.html 14
  16. 16. The Class DiagramDefinition and Purpose of Class DiagramA Class diagram gives an overview of a system by showing its classes and therelationships among them. Class diagrams are static -- they display what interacts butnot what happens when they do interact. 9 It identifies classes, relationships, and 10responsibilities for the entities abstracted in the problem solution.UML class diagrams are the mainstay of object-oriented analysis and design. UML 2 classdiagrams show the classes of the system, their interrelationships (including inheritance,aggregation, and association), and the operations and attributes of the classes. Classdiagrams are used for a wide variety of purposes, including both conceptual/domain 11modelling and detailed design modelling.Use of Class Diagram in this systemIn our system, one notes that the database tables are treated as classes. Since PHP’ssupport for Classes is still very immature, the system is regarded as one whole class.The classes depicted in the class diagram following is treating the tables in the databaseas data repository thus treating the data how it is being interacted from one table toanother. Such diagram has been designed upon the guidance of UML certified tutorial ofBorland.com9 and taking close look at the article “Can I use class diagrams to model thelogical database design? “ 12.9 Borland Definition of Class Diagram : http://bdn.borland.com/article/0,1410,31863,00.html10 Glossary of OO/MDA terms : http://pathfinderpeople.blogs.com/hslahman/2004/06/glossary_of_oom.html11 Conceptual Modelling : http://www.agilemodeling.com/artifacts/classDiagram.htm12 JGuru.com : http://www.jguru.com/faq/view.jsp?EID=439975 15
  17. 17. Class Diagram 16
  18. 18. The Use-Case DiagramDefinition and Purpose of Use-Case DiagramsUse case diagrams describe what a system does from the standpoint of an external observer. Theemphasis is on what a system does rather than how. Use case diagrams are closely connected toscenarios. A scenario is an example of what happens when someone interacts with the system.13The Use Case model is about describing what our system will do at a high-level and with a userfocus for the purpose of scoping the project and giving the application some structure. The UseCases are the unit of estimation and also the smallest unit of delivery. Each increment that isplanned and delivered is described in terms of the Use Cases that will be delivered in thatincrement.Use Cases are not a functional decomposition model. Use Cases are not intended to capture all ofthe system requirements. Use Cases do not capture HOW the system will do anything - nor dothey capture anything the actor does that does not involve the system. All of these things arebetter modelled using other modelling techniques that were developed for those purposes. TheObject Model to capture the static structure of the system and the composition of the classes. 14Use of Use Case Diagram in this systemIn this system one can note that the use-cases are split into various departments according tohow data is going to be used by whom. Such use-cases will help to give a clearer view about thesystem from a top-down view where each department is split from the rest of the project and astudy is performed upon.13 Borland Definition of Use-Case Diagram : http://bdn.borland.com/article/0,1410,31863,00.html14 Adapted from Why do we develop the Use Case model? : http://www.zoo.co.uk/~z0001039/PracGuides/pg_use_cases.htm 17
  19. 19. Use-Case DiagramsMarketing DepartmentThis use-case examines the Marketing Department. This department is going to focus on theusers who will make use of the system. Thus this department will be taking care of the userregistering / logging system. 18
  20. 20. Sales DepartmentThis department’s duty will be that of taking care of the sales of the tickets. Besides the actualsale on the site, thus the need to provide an error-free and secure environment for payment,need to provide also a mechanism to counter for bookings dropping and also edits of bookings.Printing of tickets is also another responsibility of this department. 19
  21. 21. Human-Resources DepartmentThis department is going to take care of all the operations related to the crew. Thus addition /deletion of crew members are going to happen here. Crew scheduling is also the responsibility ofthis department. 20
  22. 22. The Operations DepartmentThis department will take care of all the operations related to the helicopters. Thus the mainresponsibilities will be flight scheduling, maintenance scheduling and also helipad bookings. Thisdepartment is in charge of making sure that every helicopter is in the best state to make theflight, make sure that the flights are to the enjoyment of the customers and that everything runssmoothly. 21
  23. 23. Business Relationship DepartmentThis department will be taking care of the tour operators. The duty of this department is tokeep records of all the tour operators and make sure that no operator creates employeesmore than allowed so as to keep system stability. 22
  24. 24. Sequence DiagramDefinition and Purpose of Sequence DiagramA sequence diagram is an interaction diagram that details how operations are carried out -- whatmessages are sent and when. Sequence diagrams are organized according to time. The timeprogresses as you go down the page. The objects involved in the operation are listed from left toright according to when they take part in the message sequence. 15UML sequence diagrams model the flow of logic within your system in a visual manner, enablingyou both to document and validate your logic, and are commonly used for both analysis anddesign purposes. Sequence diagrams are the most popular UML artefact for dynamic modelling,which focuses on identifying the behaviour within your system.Sequence diagrams are typically used to model:Usage scenarios. A usage scenario is a description of a potential way your system is used. Thelogic of a usage scenario may be part of a use case, perhaps an alternate course. It may also beone entire pass through a use case, such as the logic described by the basic course of action or aportion of the basic course of action, plus one or more alternate scenarios. The logic of a usagescenario may also be a pass through the logic contained in several use cases.The logic of methods. Sequence diagrams can be used to explore the logic of a complexoperation, function, or procedure. One way to think of sequence diagrams, particularly highlydetailed diagrams, is as visual object code.The logic of services. A service is effectively a high-level method, often one that can be invokedby a wide variety of clients. This includes web-services as well as business transactionsimplemented by a variety of technologies. 1615 Borland Definition of Sequence Diagram : http://bdn.borland.com/article/0,1410,31863,00.html16 Adapted from UML 2 Sequence Diagrams : http://www.agilemodeling.com/artifacts/sequenceDiagram.htm 23
  25. 25. Use of Sequence Diagram in this systemA lot of the implementation of this system will be using the form subscription method of$PHP_SELF. Thus in notions when there is a sequence diagram of interaction between the userand the system, it is regarded that the system is the PHP page where although it is just physicallyone page (one .php) it can have many iterations due to re-loading the self page to itself. Indevelopment stages one must remember the incursion of the HTTP_SESSION_VARS thedelegation of methods can be made easier. Another change that will be done duringimplementation is where in depicted sequence charts there are other intermediaries between theuser and the system. Such intermediaries will be implemented in a separate .php file so as toincrease readability and debugging steps. These will be implemented using the include() functionof PHP, where a file can be included and the PHP parser will view the code as part of the caller.One could regard the system as can be regarded by the parser, as one whole code, but I decidedto choose this method of design so as when it comes to implementation it will be easier to codeand debug small parts of the more complex systems. 24
  26. 26. Sequence DiagramCreate Booking 25
  27. 27. Create Flight 26
  28. 28. Checking Unpaid Booking 27
  29. 29. Database Backup 28
  30. 30. Scheduled Backup 29
  31. 31. State Chart DiagramsDefinition and Purpose of State DiagramObjects have behaviours and state. The state of an object depends on its current activity orcondition. A state chart diagram shows the possible states of the object and the transitions thatcause a change in state. 17Some objects do and know more things, or at least more complicated things, than other objects.Some objects are incredibly complicated, so complex that developers can have difficultyunderstanding them.UML state diagrams depict the various states that an object may be in and the transitionsbetween those states. A state represents a stage in the behaviour pattern of an object, and likeUML activity diagrams it is possible to have initial states and final states. An initial state, alsocalled a creation state, is the one that an object is in when it is first created, whereas a final stateis one in which no transitions lead out of. A transition is a progression from one state to anotherand will be triggered by an event that is either internal or external to the object. 1817 Borland definition of State Chart : http://bdn.borland.com/article/0,1410,31863,00.html18 Adapted from UML 2 State Machine Diagrams : http://www.agilemodeling.com/artifacts/stateMachineDiagram.htm 30
  32. 32. State DiagramUser Login 31
  33. 33. Creating Booking 32
  34. 34. Edit Booking 33
  35. 35. User Registration 34
  36. 36. Register new Tour Operator 35
  37. 37. Create Helicopter Maintenance 36
  38. 38. Register New Flight 37
  39. 39. Activity DiagramDefinition and Purpose of Activity DiagramAn activity diagram is essentially a fancy flowchart. Activity diagrams and state chart diagramsare related. While a state chart diagram focuses attention on an object undergoing a process (oron a process as an object), an activity diagram focuses on the flow of activities involved in asingle process. The activity diagram shows the how those activities depend on one another. 19Thus, UML activity diagrams are typically used for business process modelling, for modelling thelogic captured by a single use case or usage scenario, or for modelling the detailed logic of abusiness rule. Although UML activity diagrams could potentially model the internal logic of acomplex operation it would be far better to simply rewrite the operation so that it is simpleenough that you don’t require an activity diagram. In many ways UML activity diagrams are theobject-oriented equivalent of flow charts and data flow diagrams (DFDs) from structureddevelopment. 2019 Borland.com definition of Activity diagram : http://bdn.borland.com/article/0,1410,31863,00.html20 Adapted from UML 2 Activity Diagrams : http://www.agilemodeling.com/artifacts/activityDiagram.htm 38
  40. 40. Activity DiagramCreate Booking 39
  41. 41. Insert Booking 40
  42. 42. Register User 41
  43. 43. Register Tour Operator 42
  44. 44. Tour Operator Register New Employee 43
  45. 45. Create Helicopter Maintenance 44
  46. 46. Assign Scheme 45
  47. 47. Insert Flight 46
  48. 48. 47
  49. 49. Assign Crew to flight 48
  50. 50. Request a Report 49
  51. 51. 50
  52. 52. Com ponent and Deploym ent Diagram sDefinition and Purpose of Component and Deployment DiagramA component is a code module. Component diagrams are physical analogies of class diagram.Deployment diagrams show the physical configurations of software and hardware. 21Component-based development (CBD) and object-oriented development go hand-in-hand, and itis generally recognized that object technology is the preferred foundation from which to buildcomponents. Component diagrams are typically used as an architecture-level artefact, either tomodel the business software architecture, the technical software architecture, or more often thannot both of these architectural aspects. Physical architecture issues, in particular hardwareissues, are better addressed via UML deployment diagrams or network diagrams.The initial architectural modelling efforts during the first cycle should focus on identifying theinitial architectural landscape for your system. UML component diagrams are great for doing thisas they enable you to model the high-level software components, and more importantly theinterfaces to those components.Use of both Component and Deployment Diagrams in this systemIt was decided to combine these 2 diagrams in 1 so one can understand which component run onwhich node. Thus the system developer can understand more easily where to have the files andfrom where to call them. Another Important use of such combine is that one can better plan hishardware for the jobs requested by the components which will reside on the system. Going withthis reason is the system awareness of components. Thus if a bug is found the System Engineerscan easily track down to the component and fix the bug in the least time possible. Using suchmethod another advantage can be attained. By referring to this diagram one can easilyunderstand the Component-Interface communication details, thus can implement better how thecomponents of the system interacts with each other. 2221 Borland.com definition of Component and Deployment Diagrams :http://bdn.borland.com/article/0,1410,31863,00.html#component-and-deployment-diagrans22 Combining the two Diagrams(Slide 9) : http://taurus.polito.it/~lioy/01adw/5-uml-physical-asd.pdf 51
  53. 53. Component and Deployment Diagram 52
  54. 54. R eason for not using Other Diagram sObject DiagramSince an object diagram shows how specific instances of a class are linked to each other atruntime, at any moment in time it consists of the same elements as a class diagram; in otherwords, it contains classes and links showing the relationships. However, there is one minordifference. The class diagram shows a class with attributes and methods declared. However, in anobject diagram, these attributes and method parameters are allocated values. 23 Thus, since in theClass diagrams, as explained earlier, in Use of Class Diagram in this system, the classes arenothing more than data repository, there is nothing much to add and useful for an Objectdiagram to be designed.Collaboration DiagramThe Collaboration Diagram in this system was not used for the simple reason that all components,thus .php pages in the system will be treated by the php parser as one component. Thus even ifthey will be different physical files, when using the include() method, the parser virtually insertsthe code of one file to the calling file. Thus the whole scope of Collaboration diagram, which isconveying the same information as sequence diagrams, but the focus is on object roles instead ofthe times that messages are sent. 24 Therefore having all roles of objects treated as self-iterativeis no use in creating a good and understandable Collaboration diagram.23 Elements of an Object Diagram : http://www.developer.com/design/article.php/222355124 Borland.com definition of Collaboration Diagram : http://bdn.borland.com/article/0,1410,31863,00.html#collaboration-diagrams 53
  55. 55. Modelling using other diagramsThe Entity Relationship DiagramDefinition and Purpose of E-R DiagramAn entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationshipsbetween entities in a database. 25 Thus it can be said that the E-R data model views the real worldas a set of basic objects (entities) and relationships among these objects. It is intended primarilyfor the DB design process by allowing the specification of an enterprise scheme. This representsthe overall logical structure of the DB. 26 An E-R diagram at best can only be considered a staticpicture of the "structure" of a database. Nothing is revealed regarding the flow of data, oranything else that relates to how the data changes. However, exploring an entity relationship 27diagram is often a first step in understanding a databases design.Use of Entity-Relationship Diagrams in this systemEntity Relationship Diagrams are a major data modelling tool and will help organize the data inthis project into entities and define the relationships between the entities. This process hasproved to enable the analyst to produce a good database structure so that the data can be storedand retrieved in a most efficient manner. Since I am treating the classes as data repository, inother words as tables, it is in the best of practices that an E-R Diagram is included. Using thisdiagram one can understand better the database which will be considered as the driving featureof this ERP.25 “Entity-Relationship Diagram” : http://databases.about.com/cs/specificproducts/g/er.htm26 The Entity-Relationship Model : http://www.cs.sfu.ca/CC/354/zaiane/material/notes/Chapter2/node1.html27 Understanding Entity Relationship Diagrams : http://folkworm.ceri.memphis.edu/ew/SCHEMA_DOC/comparison/erd.htm 54
  56. 56. Entity-Relationship Diagram 55
  57. 57. 56
  58. 58. 57
  59. 59. Real Time AnalysisDefinition of Real Time AnalysisThe web definition of Real Time Analysis can be said to be: A transmission or data processingmode in which the data is entered in an interactive session where an application can respond fastenough to affect later data input. 28 Thus it can be defined as the capture, processing, andpresentation of data at the time the data is originated. Real time can also refer to eventssimulated by a computer at the same speed that they would occur in real life.Implementing Real Time Situations in this systemThe system is planned to be built so as to respond to input immediately. When the user requestsdata, a select query is promptly fired at the Database asking for information. Speeds are a mustin such a system. It is well known that a user tends to leave the site if the page doesn’t load fast.Another well known fact is that users are less ready to wait for data to load and this would meandata querying needs to be as fast as possible. Hence, the system will be designed using PHP andMySql. MySQL database provides excellent speed and flexibility for web applications. It is also thedatabase of choice when using PHP - with a huge amount of built-in flexibility. 2928 About Speed and Protocols : http://www.quadron.com/speed/speed.html29 Why another language like PHP? : http://www.jatech.ca/php_mysql.shtml 58
  60. 60. Architecture, Technologies and ToolsThe Internal NetworkIn the following diagram one can note that the network is split up into 2 main sub-networks. TheMain Network will be the network which can be accessed from outside. Thus this network willhost the Web-Server and also the Mail Server. Therefore the Database Server will not haveforeign access, just local. This way the DBMS will also be protected from flooding or other DDoSattacks. 59
  61. 61. The Networking Topology 60
  62. 62. The Main NetworkThis split and division in the network is a security measure to protect the database. Since we willstore very sensitive data especially data on our customers and data which can’t be accessed bythe franchise companies we must take a lot of care for the database. Since the Web Server willbe visible to the Internet it will be very vulnerable to suffer attacks. Although the firewallimplemented is a high end firewall we still cannot rest our mind at peace that we will have asecure system. To minimise risks I suggest that we implement the Web Server in a demilitarizedzone (DMZ in short). Another risk magnet is the SMTP server, the server we need to use to sendemails and its brother the POP3 server, the server which we use to receive emails. The threeserver needs to be protected, thus they will be in a sub network which sits between a trustedinternal network, i.e. the private LAN and the external network, i.e. the Internet. To secure thenetwork, we are not going to stop only by installing and configuring the firewall. The serversthemselves have bugs which can be exploited as can be seen in this paper - Flat vs. SegmentedDMZs. “Its a common myth in the business world that placing a firewall in your DMZ is the be alland end all for security. I often see wide open holes that would not prevent attacks. Theimportance of segmentation is to be able isolate your network to the point where it could be farmore easily to identify an attack.” 30 Implementing a second server with tied security will involvemore costs, but this is just for security. This forum thread is headed Co-locating application anddatabase servers and is found at TheServerSide.com, where server administrators discuss theirexperiences. With application servers we understand our HTTPd, SMTP and POP3. By Co-locatingwe understand having a lot of servers sharing the same CPU. We are going to implement theWebServer in a flat DMZ since as one can read from here: “however, it may not be possible toaffect other systems outside of that flat DMZ boundary, given one could host several applicationsin different DMZs but within each application the servers are not segmented.” 31 The advantagehere is that the compromiser can’t access the database with ease since he has to access outsidethis sub-network and there is a high possibility that the firewall will stop him. This is the systemwe propose for the Application Servers:30 Flat vs Segmented DMZs http://honor.trusecure.com/pipermail/firewall-wizards/2002-November/013508.html31 Flat vs Segmented DMZs http://honor.trusecure.com/pipermail/firewall-wizards/2002-November/013508.html 61
  63. 63. Main Office Server (WEB Application Server) - SC733T-450 32CPU: 2.8GHz Xeon 512KB L2 IntegratedRAM: 2*1024 333 MHz SDRam (ECC)Network: eth0 (connected to Router), eth1 (connected to Router – idle)Storage: 2 * 16 GB Raptor SATA Discs (mirrored, Hot Swappable)PSU: 450WOS: SuSE Linux 9.0HTTPd: Apache 2.0 Web Server, PHP 5.01, Java Tomcat, Perl 5.86Additional Software: PhpMyAdminMain Office Server (Mail Application Server) - SC733T-450 33CPU: 2.8GHz Xeon 512KB L2 IntegratedRAM: 2*1024 333 MHz SDRam (ECC)Network: eth0 (connected to Router), eth1 (connected to Router – idle)Storage: 2 * 16 GB Raptor SATA Discs (mirrored, Hot Swappable)PSU: 450WOS: SuSE Linux 9.0Emaild: sendmail, XInet.d : pop3, Cron DaemonThe Protected NetworkIt has been seen how the SuperMicro motherboard performed during online benchmarks and wedeem that it can serve its duties for the upcoming years. I tend to agree with this review at Tom’sHardware.net a must read when it comes to Hardware. “With its unbeaten feature set,Supermicros X6DA8-G2 is definitely meant for professional usage and therefore eclipses all otherboards that we tested. Its a unique combination of eight controllable fans, LSI RAID Zero option,Dual Gigabit LAN, IPMI option, SM bus PSU monitoring and the theoretical possibility of extendingthe memory up to 16 GB. While this board is the most expensive out of the bunch, it truly 34deserves our recommendation thanks to its flawless performance. “ Although the motherboard32 SuperMicro SC733T-450 http://www.supermicro.com/products/system/tower/7033/SYS-7033A-T.cfm33 SuperMicro SC733T-450 http://www.supermicro.com/products/system/tower/7033/SYS-7033A-T.cfm34 Quote Extracted from: http://www.tomshardware.com/motherboard/20041111/index.html 62
  64. 64. we plan to install is the SC743T-R760 it is not very different to the one reviewed over there. All ofthe features are found in our model, and one must add that our models can hospitate a newerrevision of the Xeon64 CPU Nonocona version. Following its performance I suggest we install thismotherboard and install high banks of memory due to the process it will face. Caching is veryimportant in DBMS management so we need to let our system work as efficiently as possible. Inmy opinion this is the best setup for the main server:Database Server (Active) - SC743T-R760 35CPU: 2* 3.0GHz Xeon (Nocona) 1MB L2 IntegratedRAM: 4*1024 333 MHz SDRam (ECC)Network: eth0 (connected to Router), eth1 (connected to Router – redundant connection)Storage: 2 * 74 GB Raptor SATA Discs (mirrored, Hot Swappable)PSU: 760WOS: Red Hat Linux ESDBMS: MySQL 4.51The Backup SystemOne can identify the addition of the Redundant Server. Having such a system can’t go withouthaving proper backups. We need a serious Redundancy/Fail-over system. We suggest havinganother powerful server which acts as a backup for both the systems. All the three servers willhave their own backups for the hard discs since we will be mirroring the discs while operation soif one disc fails we have immediately a backup disk available. The Raptor Discs with their extraspeed (calculated in RPM), enhance the throughput. Now the backup server will serve exactly asif the firm has another server running exactly at the same time of the proper servers. We canregard this server as our last hope to keep the customers and the office employees workingwithout disturbing their every-day business. We will deploy a mechanism that when a systemfails, be it the Main Server, be it the Database Server or the Web Server, this new server willenter into operation. It must be said that this system can’t remain in operation for long periods oftime since we will be exposing our servers to attacks and even exploits of data, so this will be just35 SuperMicro SC743T-R760 http://www.supermicro.com/products/system/4U/7044/SYS-7044H-TR.cfm?PID=TWR 63
  65. 65. a temporarily measure until we fix the system downtime. Since this server needs to operatealmost like the main server if the DBMS fails, it is very similar to the other specifications. Anotheroperation required by the redundant server is the backups on Tapes. Having such an elaboratesystem we cannot cope without backing our data. I suggest at 4.30 am every day we keep abackup (after the 3am cron job of backing up the database). I also suggest that we can make useof 15day backup so we can re-use tapes so as to minimize costs. Another measure is that every 2days we take the backup to another location so as to follow the proper ways of backingmentioned in this paper 36. Beside, according to another review, SuperMicro server systems are 37“the sole supplier of new 64-bit Xeon SATA servers” . This is the system I propose:Main Office Server (Redundant) - SC743T-650 38CPU: 2* 2.8GHz Xeon (Nocona) 1MB L2 IntegratedRAM: 4*1024 333 MHz SDRam (ECC)Network: eth0 (connected to Router), eth1 (connected to Router – idle)Storage: 2 * 74 GB Raptor SATA Discs (mirrored, Hot Swappable) for DataBase Server 2 * 16 GB Raptor SATA Discs (mirrored, Hot Swappable) for Web Server 2 * 16 GB Raptor SATA Discs (mirrored, Hot Swappable) for Mail ServerPSU: 650WAdditional Devices: Tape Backup DeviceOS: Red Hat Linux ESDBMS: MySQL 4.51HTTPd: Apache 2.0 Web Server, Java Tomcat, Perl 5.86, PHP 5.01, Cron DaemonE-Mail: sendmail, XInet.d : pop3Additional Software: PhpMyAdminThe RoutingThe biggest headache in a network is definitely the routing. We need to route all the data fromone server to another in the fastest time possible, without data loss and in the securest36 Why even the best Backups Fail? Checklist for Success http://mailman.mit.edu/pipermail/kerberos/2002-September/001664.html37 LinuxElectrons Review on SuperMicro Boards http://www.linuxelectrons.com/article.php/2005012507554288338 SuperMicro SC743T-650 http://www.supermicro.com/products/system/4U/7044/SYS-7044H-T.cfm?PID=TWR 64
  66. 66. environment possible. As we included in the first report on our system, we still keep faith to theCisco 2600 Router. “These new models deliver extended performance, higher density, enhancedsecurity performance, and increased concurrent application support to meet the growingdemands of branch offices.” 39, is exactly what we need. We suggest another re-investment inanother of these modules and place it in the same cabinet where there is the other one.Technologies UsedFollowing are the technologies used in the prototyping phase. Both the scripting language and theDBMS used are Open Source and can be downloaded for free from the internet, thus reducing thetotal cost of development.MySQL DBMSThe MySQL database server embodies an ingenious software architecture that maximises speedand customisability. With its Extensive reuse of pieces of code within the MySQL software and anambition to produce minimalist but functionally rich features have resulted in a databasemanagement system unmatched in speed, compactness, stability and ease of deployment. WithMySQL, the unique separation of the core server from the storage engine makes it possible to runMySQL under strict transaction control or with ultra fast transaction less disk access. 40PHP Scripting TechnologyPHP is an open source Web development language. Along with the Apache Web Server and LinuxOperating System, PHP is among the most widely deployed and used pieces of open sourcesoftware. PHP, according to NetCraft, has surpassed Microsoft ASP, making it the most popularWeb development language and is being utilized on over 15 million Websites today. 41 PHP is nota strictly-typed language which makes it similar to ASPs VBScript/JScript and vastly different from39 Cisco Product Information : http://www.cisco.com/en/US/products/hw/routers/ps259/40 Marketing Campaign of MySQL.com : www.mysql.com41 Extract from Why choose PHP? : http://www.zend.com/solutions/why-php.php 65
  67. 67. Java strictly-typed approach. This in some cases is quite beneficial and in other situations may bean impediment. 42PHP has built-in support for session handling, cookie handling and form handling, and thisfunctionality has been made more secure and improved in the 4.1 release.Tools UsedCron DaemonCron is the name of program that enables unix users to execute commands or scripts (groups ofcommands) automatically at a specified time/date. In this system it will be used to run both thedatabase backup at 3am (have prototype script for this) and Backing up the whole system ontapes at 4.30am.SmartDrawSmartDraw was used to design the UML Diagrams, the ERD and also the Network Design.Although Visio is a powerful product, it is best suited to technical experts. SmartDraw providesample drawing power while remaining easy enough for anyone to use. SmartDraw Is MoreVersatile than Visio: SmartDraw includes more than 60,000 ready-made symbols and templates 43that cover a much broader array of diagram types than Visio.42 What makes PHP special? : http://www.paragoncorporation.com/ArticleDetail.aspx?ArticleID=1043 Choosing SmartDraw over Visio : http://www.corporateangels.com/smartdraw-7-vs-visio.html 66
  68. 68. PrototypeUser R egistration and M anagem ent M oduleThis module is fully functional module. This has been designed using PHP, as stated before.Although the future system will be coded using Sessions, this module lacks support of sessions.No themes and GUI has been coded for this prototype since the main aim was to show how thePHP will interact with the Database. Another idea of this module was to depict the interface of thedifferent components of the system. Since with this module, a Forgotten Password and a LoginPanel have been implemented, one can see that data can be correctly manipulated from the .phppages to the Database. Another aim for this prototyping module is to test the interface with theMail Server. Since both the User Creation and the Forgotten Password needs the support of themail() function of PHP. The User Registration module has fully working these functions:  Image Code Verification  Making sure username is unique  Suggesting new username based first on Country then on Date of Birth  Password comparing  Password hashing in the database  Password generating for forgotten password  User login  Loading Control Panel with options depending on Admin levelImprovements on this module would be enabling the account activation using the E-mail linkwhich is already sent in the email but generating an HTTP[‘SESSION’] so as to handle suchrequests. Another necessary improvement would be to validate data fields since they are notvalidated. Data in the Database is validated using the data types but such validation should takeplace in the user page too. Graphical enhancements is a vital must. 67
  69. 69. User Creation Screen 68
  70. 70. User Logged-in ScreenForgotten Password Screen 69
  71. 71. Still ScreensThis type of protocol is to show how the important parts of the system will be visible to theirparticular user. Once again no attention to user-interface and eye-catching themes has beentaken care of. Since it is a prototype I worked at keeping everything as simple as possible so asthe web-designer can be left free to enhance on the methods. These screens of each section arevery important since such HTML code will be inserted between the SQL queries which will bewritten after the design process. One can notice that such screenshots have something incommon. These are the fields value. The values of each form field are already filled with data,which data is using the PHP echo method to echo results from the database. Such echoes willremain there even in the implementation stage since it is the best way to represent data to theuser from PHP arrays. As one can see in the uploaded online version each .htm page has differentscreens in it. This is on purpose. As explained earlier, PHP code will be entered between thescreens and the particular screen is loaded depends on the IF statement. 70
  72. 72. User Edit Profile Screen 71
  73. 73. Create a Flight 72
  74. 74. Request a Report 73
  75. 75. Create Tour Operator 74
  76. 76. Search for a Flight 75
  77. 77. Database DesignReason for including the design as wellFollowing is a printout of the Database design SQL format. Such a design includes theimplementation of Indices, Constraints and also has a very small data entry which was usedduring prototype testing and table initialising. This printout shows that the database is not inprototype stage but is in finished stage. This is due to the fact that all of the system is builtaround this database. If data has to be altered, then simple SQL constructs executed directly onthe database will ALTER the tables.The Backup Script written in .CGIAfter the printout one could see that another script follows. This script is an enhancement of theCGI script found on The World Community Network 44, an Open-Network web page. I removedthe support for the script to run from the web thus making it more secure. I decided to use a pre-written code since this is a Prototype and the main aim is to have a working test of the system.Besides, I made use of an Open Source project thus code regeneration is allowed by the licence.This CGI script will be run by a cron job at 3am every day. The Backup Script will email theadmin and ftp the backup to the backup server as well. After the CGI script including in theprototype will be the cron config for running the script.44 MySQL Backup : http://worldcommunity.com/opensource/utilities/mysql_backup.html 76
  78. 78. SQL Script for Database-- MySQL-Administrator dump 1.3---- -------------------------------------------------------- Server version 4.1.11-nt-maxSET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;SET NAMES utf8;/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;CREATE DATABASE /*!32312 IF NOT EXISTS*/ `solutio_apt`;USE `solutio_apt`;DROP TABLE IF EXISTS `activity`;CREATE TABLE `activity` ( `id` int(10) unsigned NOT NULL auto_increment, `description` varchar(45) NOT NULL default , `username` varchar(45) NOT NULL default , PRIMARY KEY (`id`), KEY `FK_activity_1` (`username`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `activity` (`id`,`description`,`username`) VALUES(1,Login,),(2,Logoff,),(3,Edit Profile,),(4,Edit Password,),(5,Request Forgotten Password,),(6,Search a flight,),(7,Add Booking,),(8,Edit Booking,),(9,Effect Payment,),(10,Close Account,),(11,Add Employee,),(12,Delete Employee,),(13,Register Tour Operator,),(14,Create a Flight,),(15,Schedule Maintenance,),(16,Request Report,);DROP TABLE IF EXISTS `bookings`;CREATE TABLE `bookings` ( `id` int(10) unsigned NOT NULL auto_increment, `bookingscount` int(10) unsigned NOT NULL default 0, `emptyseats` int(10) unsigned NOT NULL default 0, `paid` char(1) NOT NULL default , `scheme` int(10) unsigned NOT NULL default 0, `flight` int(10) unsigned NOT NULL default 0, `capacity` char(3) NOT NULL default , `price` double NOT NULL default 0, `user` varchar(45) NOT NULL default , 77
  79. 79. PRIMARY KEY (`id`), KEY `FK_bookings_1` (`user`), KEY `FK_bookings_2` (`flight`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;DROP TABLE IF EXISTS `bookings_history`;CREATE TABLE `bookings_history` ( `id` int(10) unsigned NOT NULL auto_increment, `date_of_transaction` datetime NOT NULL default 0000-00-00 00:00:00, `type_of_transaction` varchar(45) NOT NULL default , PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;DROP TABLE IF EXISTS `crew`;CREATE TABLE `crew` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(80) NOT NULL default , `address` varchar(254) NOT NULL default , `tel` varchar(20) default NULL, `rank` varchar(10) NOT NULL default , `country` char(2) default NULL, `email` varchar(80) NOT NULL default , PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `crew` (`id`,`name`,`address`,`tel`,`rank`,`country`,`email`) VALUES(2,Marisa Spiteri,5,rnGiovanni Curmi StrrnPaola,21668749,Pilot,NULL,),(3,Mark Attard,27, Costantine Str Bkara,21449509,Pilot,NULL,),(4,Christian Calleja,15, Pijunieri Str Fgura,21661838,Helper,NULL,),(5,Maria Debattista,14, Guze Caruana Str Marsa,21478975,Helper,NULL,);DROP TABLE IF EXISTS `flight`;CREATE TABLE `flight` ( `id` int(10) unsigned NOT NULL auto_increment, `estimatedduration` time NOT NULL default 00:00:00, `departure_time` datetime NOT NULL default 0000-00-00 00:00:00, `helicopter` varchar(5) NOT NULL default , `helipad_dep` int(10) unsigned NOT NULL default 0, `helipad_arr` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `FK_flight_1` (`helicopter`), KEY `FK_flight_2` (`helipad_dep`), KEY `FK_flight_3` (`helipad_arr`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `flight` (`id`,`estimatedduration`,`departure_time`,`helicopter`,`helipad_dep`,`helipad_arr`) VALUES(1,05:30:00,2005-04-27 17:06:17,001,0,0),(2,02:00:00,2005-04-30 06:10:49,001,0,0),(3,00:45:00,2005-04-22 11:30:00,003,0,0);DROP TABLE IF EXISTS `helicopter`;CREATE TABLE `helicopter` ( `tag` varchar(5) NOT NULL default , `fullname` varchar(45) NOT NULL default , `capacity` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`tag`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `helicopter` (`tag`,`fullname`,`capacity`) VALUES(001,Shark Tale,15),(002,Wide Wings,20),(003,Pointed Arrow,10); 78
  80. 80. DROP TABLE IF EXISTS `helicopter_maintenance`;CREATE TABLE `helicopter_maintenance` ( `id` int(10) unsigned NOT NULL auto_increment, `date` datetime NOT NULL default 0000-00-00 00:00:00, `helicopter` varchar(5) NOT NULL default , PRIMARY KEY (`id`), KEY `FK_helicopter_maintenance_1` (`helicopter`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `helicopter_maintenance` (`id`,`date`,`helicopter`) VALUES(1,2005-05-02 13:00:00,002);DROP TABLE IF EXISTS `helipad`;CREATE TABLE `helipad` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(45) NOT NULL default , `sales_office_tel` varchar(20) NOT NULL default , `location` varchar(45) NOT NULL default , PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO `helipad` (`id`,`name`,`sales_office_tel`,`location`) VALUES(1,Luqa,21678723,Malta),(2,Munxar,21543363,Gozo),(3,Gandalfo,4475341233,Sicily),(4,Hisbar Mario,231147754123,Madrid),(5,Charles de Gaul,8883657112,Paris);DROP TABLE IF EXISTS `leave`;CREATE TABLE `leave` ( `start` date NOT NULL default 0000-00-00, `end` date NOT NULL default 0000-00-00, `crew_id` int(10) unsigned NOT NULL default 0, `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`), KEY `FK_leave_1` (`crew_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;DROP TABLE IF EXISTS `scheme`;CREATE TABLE `scheme` ( `id` int(10) unsigned NOT NULL auto_increment, `type` varchar(45) NOT NULL default , `discount` double NOT NULL default 0, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;DROP TABLE IF EXISTS `tour_operator`;CREATE TABLE `tour_operator` ( `toid` int(10) unsigned NOT NULL default 0, `no_of_users` char(3) NOT NULL default , `shop_name` varchar(45) NOT NULL default , `dateofbirh` date NOT NULL default 0000-00-00, `tel` varchar(25) NOT NULL default , `address` varchar(254) NOT NULL default , `country` char(2) NOT NULL default , `email` varchar(80) NOT NULL default , PRIMARY KEY (`toid`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT=InnoDB free: 4096 kB; (`toid`) REFER `solutio_apt/user`(`id`;INSERT INTO `tour_operator` (`toid`,`no_of_users`,`shop_name`,`dateofbirh`,`tel`,`address`,`country`,`email`) VALUES(4,3,Euro Tours,0000-00-00,,,,), 79
  81. 81. (5,5,Hamilton,0000-00-00,,,,),(12,2,Tour Test,0000-00-00,,,,);DROP TABLE IF EXISTS `user`;CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL auto_increment, `uname` varchar(45) NOT NULL default , `pass` varchar(45) NOT NULL default , `name` varchar(45) default NULL, `address` varchar(254) default NULL, `country` char(2) NOT NULL default , `email` varchar(80) NOT NULL default , `tel` varchar(25) default NULL, `isodate` date NOT NULL default 0000-00-00, `admin` int(3) unsigned default 1, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;INSERT INTO `user` (`id`,`uname`,`pass`,`name`,`address`,`country`,`email`,`tel`,`isodate`,`admin`) VALUES(4,Saxon,856e2e6321ae54f7fb5da44a157336af,William Martin,8,rnCountry LanernNowhere,UK,highflyer3000@hotmail.com,4984843534,1985-05-25,1),(5,twanny,856e2e6321ae54f7fb5da44a157336af,antoine galea,the summitrntriq tumas chetchutirnattard,MT,galeaantoine@msn.com,21415154,1985-08-20,1),(6,Dave,856e2e6321ae54f7fb5da44a157336af,David Galea,The Summitrntriq tumas chetchutirnattard,MT,galeadavid@hotmail.com,21415154,1985-12-12,1),(7,yancho,856e2e6321ae54f7fb5da44a157336af,Matthew Pulis,28, ThistleGuze Pesci StrIklin,MT,matthew@solutions-lab.net,21435659,1984-07-30,3),(10,haNniba1,856e2e6321ae54f7fb5da44a157336af,Patrick Camilleri,St peters flat 1rncardinal rnVittoriosarncsp08,MT,dronetuner@hotmail.com,21807517,1985-03-27,1),(11,Ghox,2cd324f30dc548396570da4e637c53ee,Karel Zahra,skajkfj,AL,k@z.com,1234435,1900-01-01,1),(12,tourop,jasdkfjkajdfkasdjkfdjaskj,Hamilton,sadf,MT,gesu@test.com,234232432,0000-00-00,3);INSERT INTO `user` (`id`,`uname`,`pass`,`name`,`address`,`country`,`email`,`tel`,`isodate`,`admin`) VALUES(13,mikebc,50c927e5f17adb9341381991ac2a999f,mike borg cardona,testing street etc,MO,mborgcardona@hotmail.com,123123123,1923-02-24,3),(14,yancho2,786ddfa71ec39c7922a06aeb47c5b60c,Matthew Pulis,28asdf,MT,matthew@solutions-lab.net,21435659,1984-07-30,1),(15,yancho_MT,786ddfa71ec39c7922a06aeb47c5b60c,Matthew Pulis,,MT,matthew@solutions-lab.net,,1910-10-08,1),(16,B0SS,098f6bcd4621d373cade4e832627b4f6,Ben,aaarnaarnaarnaaaa,MT,bengatt@onvol.net,test,1985-01-21,1),(17,B0SS_MT,d41d8cd98f00b204e9800998ecf8427e,Ben,aaarnaarnaarnaaaa,MT,bengatt@onvol.net,test,1985-01-21,1);DROP TABLE IF EXISTS `weblog`;CREATE TABLE `weblog` ( `id` int(10) unsigned NOT NULL auto_increment, `date` datetime NOT NULL default 0000-00-00 00:00:00, `username` char(45) NOT NULL default , `activity_id` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `FK_weblog_1` (`activity_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED;INSERT INTO `weblog` (`id`,`date`,`username`,`activity_id`) VALUES(1,2005-04-27 17:59:56,yancho,1),(2,2005-04-27 18:00:36,yancho,3);/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 80
  82. 82. MySQL Backup CGI Scriptuse DBI;use POSIX qw(strftime);use Time::Local;use Cwd;use File::Path;no strict refs;$ftp_backup = yes;use Net::FTP;$email_backup = yes;use MIME::Lite;$web_test_database = solutio_apt;@selected_databases = qw[solutio_apt];$process_all_databases = no;@skip_databases = qw[];@skip_tables = qw[];$password_location = cnf;$login_script_name = ;$chmod_backup_file = yes;#..............................................................................# db host information# set $db_host to a remote server if you need to access data# on a different machine.$db_host = localhost;$db_port = 3306;$cnf_file = /cgi-bin/matthew/login.cnf; 81
  83. 83. $cnf_group = client;$user = solutio_mpulis;$password = songoku;# $ENV{MYSQL_UNIX_PORT} = /var/lib/mysql/mysql.sock;$site_name = Helicopter ERP System;$subject = "MySQL Backup Done for $site_name";$mysql_backup_dir = /backup/mysql_backup;# MANDATORY UTILITY PATH SETTINGS# ..................................$find_commands = yes;if ( $find_commands eq no ) { $mysqlshow_cmd = /usr/bin/mysqlshow; $mysqldump_cmd = /usr/bin/mysqldump; $nice_cmd = /bin/nice; $tar_cmd = /bin/tar; $gzip_cmd = /bin/gzip; $bzip2_cmd = /usr/bin/bzip2; $ls_cmd = /bin/ls; }$compress_method = ;$delete_text_files = yes;$use_bzip2 = no;$gzip_args = -9v;$bzip_args = -9v;#################################################################################### OPTIONAL VARIABLES SET UP SECTION# (You may not need to change the vars below)###################################################################################$show_file_list_in_email = no;$print_stdout = no; 82
  84. 84. $date_text = strftime("%Y-%m-%d_%H.%M.%S", localtime);$increments_to_save = 5;$seconds_multiplier = 86400;$increment_type = "Day(s)";$seconds_to_save = $increments_to_save * $seconds_multiplier;$space_line = " " x 5;$ftp_host = apt-backup.solutions-lab.net;$ftp_port = 21;$ftp_passive = 0;$ftp_user = mpulis;$ftp_password = testpassword;$ftp_dir = /backup/mysql;$tar_options = -pv;if ( $show_file_list_in_email eq yes ) { $tar_options .= -v; }# backup file prefix$file_prefix = bak.mysql;# mysqldump variables# ..................................$mysql_dump_file_ext = txt;$backup_type = mysqldump;$backup_field_terminate = |;$backup_field_enclosed_by = ;$backup_line_terminate = ":!:n";$outfile_params = qq~ fields terminated by | lines terminated by :!:n ~;#################################################################################### SCRIPT CODE BELOW#################################################################################### web login routine#..........................................if ( $password_location eq from_web ) { print "Content-type: text/htmlnn"; if ( param(w_user) =~ /w+/ and param(w_password) =~ /w+/ ) { # test for authorized access 83
  85. 85. &connect_to_db($web_test_database); # if we get to here, it means that were authorized print qq~<br> <b><font color="blue" size="+1"> Running MySQL Backup . . . </font></b> <pre> ~; } else { print qq~<br><table width="70%" border="0" align="center" cellpadding="3" cellspacing="3" bgcolor="F0F0F0"> <tr><td colspan="2" bgcolor="darkblue"> <b><font color="white" size="+1"> MySQL Backup Web Login Screen</font></b> <FORM method="post" action="$login_script_name"></td></tr> <tr><td align="right">User Name: </td> <td><input type="text" name="w_user" size="16" maxlength="16"></td></tr> <tr><td align="right">Password: </td> <td><input type="password" name="w_password" size="16" maxlength="16"></td></tr> <tr><td>&nbsp;</td><td><input type="submit" value="Login"></td></tr> <tr><td colspan="2" align="center"> Note: The login will not proceed unless you type a value in both fields.</form></td></tr></table> ~; exit; } }else { # clear the screen if (-e "/dev/tty") { $clear = `clear;pwd;`; print $clear; } }# finish setup of email variables#............................................if ( $send_method eq sendmail ) { $mailprog_or_smtp_host = $mailprog; }elsif ( $send_method eq smtp ) { $mailprog_or_smtp_host = $smtp_host; }else { print qq~Error! You havent setup your email parameters correctly.~; exit; }# automatic utility setup#................................# CMD_ARRAY NOTE (below): 84
  86. 86. # Note that the automatic method of finding the commands that is used here# creates variables names that match the commands. Since the script uses the# default variable names listed in the array, you shouldnt edit the array# unless you also change the var names in the script.# DONT EDIT THIS CMD_ARRAY unless you know what youre doing :-).@cmd_array = qw[mysqlshow mysqldump nice tar gzip bzip2 ls];if ( $find_commands eq yes ) { foreach $command ( @cmd_array ) { if ( $command eq bzip2 and $use_bzip2 ne yes ){next;} $cmd_name = $command . _cmd; ($name, $$cmd_name, $rest) = split / /, `whereis $command`, 3; chomp $$cmd_name; } }# zip variable setup$gzip_file_type = x-gzip;$bzip_file_type = x-bzip2;$gzip_ext = .gz;$bzip_ext = .bz2;$gzip_type = GZip;$bzip_type = BZip2;if ( $use_bzip2 eq yes and $compress_method ne z_switch ) { $gzip_cmd = $bzip2_cmd; $gzip_args = $bzip_args; $gzip_file_type = $bzip_file_type; $gzip_ext = $bzip_ext; $gzip_type = $bzip_type; }# check if each cmd file exists#...................................foreach $command ( @cmd_array ) { if ( $command eq bzip2 and $use_bzip2 ne yes ){next;} $cmd_name = $command . _cmd; unless ( -e $$cmd_name ){&error_message(qq~Error! $$cmd_name wasnt found.~);} }# BEGIN BACKUP PROCESS#....................................$body_text = ;unless ( -e "$mysql_backup_dir" ) { &error_message(qq~Error! $mysql_backup_dir doesnt exist.~); 85
  87. 87. }chdir ("$mysql_backup_dir");# now make a tar sub directory for this backup$tar_dir = $file_prefix . "." . $date_text;mkdir $tar_dir, 0777;# we chmod the directory to 777 since the umask# may be set differently.# The directory needs to be set to 777 so that# mysql can perform a select into outfile in that# directory (since mysql runs as a different user)chmod 0777, $tar_dir;unless ( -e "$mysql_backup_dir/$tar_dir" ) { &error_message(qq~Error! $mysql_backup_dir/$tar_dir wasnt created.~); }chdir ("$tar_dir");$msg = "nProcessing Backups Using " . uc($backup_type) . " inn$mysql_backup_dir/$tar_dirnn";if ( $print_stdout eq no ) { $msg .= qq~Screen Output (STDOUT) is turned OFF, so you wont see much until the script is done.nn ~; }# I use print here, instead of &message,# so that when $print_stdout is set to no,# the script shows that its working.print "$msg";&message(b,"Databases / Tables:n");# test and create the initial database array# first convert the exception database and table arrays# to hashes for speed searching#............................................................................%skip_databases = ();%skip_tables = ();foreach my $database_name ( @skip_databases ) { $skip_databases{$database_name} = $database_name; }foreach my $table_name ( @skip_tables ) { $skip_tables{$table_name} = $table_name; } 86
  88. 88. # test to see if we should process all databasesif ( $process_all_databases eq yes ) { if ( $password_location eq cnf ) { $cmd = qq~$mysqlshow_cmd --defaults-extra-file=$cnf_file --host=$db_host~; } else { $cmd = qq~$mysqlshow_cmd --host=$db_host --user=$user --password=$password~; } &cmd_length($cmd) if $max_cmd > 0; @databases = `$cmd`; chomp ( @databases ); }else { @databases = @selected_databases; }# heres where the backup is actually done#............................................................................foreach $db_main ( @databases ) { if ( $db_main =~ /Databases/ ) {next;} if ( $db_main !~ /w+/ ) {next;} $db_main =~ s/|//g; $db_main =~ s/s+//g; if ( $process_all_databases eq yes and exists $skip_databases{$db_main} ) { &message(b,"nSkipping: [$db_main]n"); next; } # connect to db &connect_to_db($db_main); &message(b,"nDatabase: [$db_main]n"); # now grab table names for this databases # we use show tables to avoid problems with mysqlshow % with older versions # ............................................................................ $sth = $dbh->prepare("show tables") or &error_message(qq~Error!n Cant execute the query: $DBI::errstr~); $rv = $sth->execute or &error_message(qq~Error!n Cant execute the query: $DBI::errstr~); while ( ( $table_name ) = $sth->fetchrow_array ) { if ( exists $skip_tables{$table_name} ) { &message(b,"nSkipping: [$table_name]n"); 87

×