Masters portal

The author's abstract on a theme:
Developing and researching client-server system for connecting mobile devices with server using Java tecnology

Executed by Sheludenkov A. V.


  Actuality
  Introduction
     1. Architecture "client-server"
     2. Models of interaction the client-server
     3. Advantages of architecture the client-server
     4. Functions of a server
     5. Java a platform
       5.1 Object-orientation
       5.2 Reliability
       5.3 Security
       5.4 Independence of architecture
       5.5 High efficiency
     6. CGI and Java technologists
     The conclusion
     Literature
Actuality

Presently practically in all spheres of a life of a human society those or other systems of data processing are applied. It can be bank systems, industrial program complexes, means of automation of trade and many other things appendices. Constant expansion of scopes of computer facilities and escalating complexity of solved problems demand perfection of methods of creation of modern information systems.
From the beginning of 90th years of XX century such technology of realization of program appendices as architecture "client-server" is known. Its basic feature consists that the appendix shares on two levels - data presentation (client) and a data storage (a server of a DB). Processing of the information occurs on the client, on a server inquiries are sent and data obtained in reply to them are processed.
With the advent of multi-platform technologies of programming and telecommunication systems there was an opportunity of introduction of architecture the client-server in portable devices.
Within the limits of the given work will advantages of this architecture to mobile devices with use of technology Java are considered.
Introduction

The architecture the client-server assumes the server of databases representing the appendix, carrying out a complex of actions on management of data - performance of inquiries, storage and reserve copying of data, tracking of reference integrity, check of the rights and privileges of users, conducting magazine of transactions.
One of the major advantages of client-server information systems in comparison with their analogues is decrease in the network traffic at performance of inquiries.
The second advantage of architecture the client-server is an opportunity of storage business-corrected on a server that allows to avoid duplication of a code in the various appendices using the general database. Besides in this case any editing of data including editing by supernumerary means, can be made only within the limits of these rules.
Besides the listed opportunities, modern server database management system possess ample opportunities of management of the user privileges and access rights to various objects of a database, reserve copying and archiving of data, and it is frequent also optimization of performance of inquiries. They also, as a rule, give an opportunity of parallel data processing, especially in case of use of multiprocessing computers as a server of databases.
So, the client-server information system consists in the elementary case of two basic components:
• The server of databases operating a data storage, access and protection, the reserve copying, tracing integrity of data according to business-rules and, the most important, carrying out inquiries of the client;
• The client giving the interface of the user, carrying out logic of the appendix, checking an admissibility of the data, sending inquiries to a server and receiving answers from it;
1. Architecture "client-server"

As a rule, computers and the programs which are a part of information system, are not equal in rights. Some of them own resources (file system, the processor, the printer, a database, etc.), others have an opportunity to address to these resources. A computer (or the program), operating a resource, name a server of this resource (a file-server, a server of a database, a computing server...). The client and a server of any resource can be both within the limits of one computing system, and on the various computers connected by a network.
•The main principle of technology "client-server" consists in division of functions of the appendix into three groups:
•Input and display of data (interaction with the user);
•Applied functions, characteristic for the given subject domain;
•Functions of resource management (file system, a database, etc.)
•Therefore, in any appendix following components are allocated:
•Component of data presentation
•Applied component
•Component of management of a resource
•Communication between components is carried out by the certain rules which name " the report of interaction ".
2. Models of interaction the client-server

Historically the first has appeared model of the distributed data presentation which was realized on the universal COMPUTER with the nonintellectual terminals connected by it. Management of data and interaction with the user thus were united in one program, the "picture" generated on the central computer was transferred to the terminal only.
Then, with the advent of personal computers (personal computer) and local networks, have been realized models of access to the removed database. Some time for networks of the personal computer the architecture of a file server was base. Thus one of computers is a file server, on clients appendices in which the component of representation and an applied component are combined are carried out. The report of an exchange thus represents a set lowlevel calls of operations of file system. Such architecture sold, as a rule, has obvious lacks - the high network traffic and absence of the unified access to resources.
With the advent of the first special-purpose servers of databases there was a possibility of other realization of pattern of access to the removed database. In this case kernel DB functions on a server, the report of an exchange is provided by means of language SQL. Such approach in comparison with a file server conducts to reduction of loading of a network and unification of the interface "client-server". However, the network traffic remains rather high besides - previous adequate administration of appendices as in one program various functions are combined is impossible.
Later the concept of an active server which used the mechanism saved procedures has been developed. It has allowed to transfer a part of an applied component on Server (pattern of the distributed appendix). Procedures are stored in the dictionary of a database, divided between several clients and carried out on the same computer, as a SQL-server. Advantages of such approach: probably centralized administration of applied functions, significantly decreases the network traffic (since SQL-inquiries, and calls saved procedures are transferred not). Lack - limitation of means of development saved procedures in comparison with languages of a general purpose.
In practice now are usually used the mixed approach: the elementary applied functions are carried out saved by procedures on a server; more complex are realized on the client directly in the applied program.
Now a number of suppliers commercial DB has declared plans of realization of mechanisms of performance saved procedures with use of language Java. It conforms to the concept of " the thin client " which function there is only a display of data (pattern of the removed data presentation).
Recently also the tendency to increasing use of model of the distributed appendix is observed. Characteristic feature of such appendices is logic division of the appendix into two and more parts, each of which can be carried out on a separate computer. The allocated parts of the appendix cooperate with each other, communicating in advance coordinated format. In this case two-link architecture the client-server becomes three-link, and in some cases, it can include and more parts (Figure 1).

CGI
Figure 1 - 3-level client-server architecture
3. Advantages of architecture the client-server

The force promoting development of systems with architecture the client-server, that connection to inexpensive servers of inexpensive personal computers will allow to receive an optimum parity of the price and productivity serves. More often this assumption is true.
Using set of small computers, developers of systems the client-server can emulate computing capacity of greater COMPUTERS, distributing an applied problem in various microcomputers and servers.
Each of them incurs the part of computing loading, using the information together with other processors of a network. An essence of idea that to raise capacity of system, not increasing productivity of one computer, and summarizing means of many.
Speed - a major factor of expediency of system engineering for architecture the client-server. Technologists of servers of databases it becomes easier in use and it is combined in one systems with means RAD. Thus, it is expected, that by means of this high-speed and practically protected platform time necessary for preparation and transfer of the applied program to the user will be reduced.
Appeal GUI (the graphic interface of the user) - one more factor declining users to application of architecture the client-server. Simplicity of use and convenience concern to advantages of applied programs the client-server the users working with such GUI, as Windows 3.1, Windows 95, Windows NT and OS/2 Warp also. Users feel more comfortably and means of viewing Internet (browsers) and spreadsheets, and similar to them work more productively with such applied programs, such as word-processors.
Finally, the client-server is the technology giving more of independence to users. Applied programs and data are on small, more available systems, instead of in bowels of the mini computer and powerful computer centers.
The most simple form of architecture the client-server is a division of computing loading between two separate processes: the client and a server. Though both the client, and a server can be on the same computer, the majority of systems of this architecture start client process on one computer, and process-server on other, using for information interchange network communications. In this model one process can work irrespective of another, carry out the certain tasks and to divide computing loading.
Usually as the client the desktop personal computer which is carrying out the software of the end user serves. The software (ON) the end user (front-end software) is any applied program or a package, capable to direct inquiries on a network to a server and to process the information received in the answer. The server, in turn, receives inquiries and undertakes actions on behalf of the client.
Intermediate maintenance (middleware) gives the general interface for ON the end user and a server, getting through layers GUI, OS, the computer network and own drivers of a database by means of the general calls. For end of operation the server of a database carries out inquiry and transfers the client the demanded data for processing by their program of the client.
4. Functions of a server

Servers of databases are engaged not only service of data. In them mechanisms of blocking and elements of management are stipulated by the multiuser access which provide protection of data against danger of parallel access also. Besides the server of databases should protect data from not authorized access, to optimize inquiries to a database, to provide cashing and to give a place for accommodation of the dictionary of data.
Two other important features to which it is necessary to pay attention, - ability of a server to provide integrity of reference data and the mutual control of end of transaction. Reference integrity of data (referential integrity) is the mechanism, a corresponding primary key providing to everyone external key. The mutual control of end of transactions (two-phase commit) - a guarantee of that your data will not be damaged even at hardware failure.
By means of saved procedures, triggers and rules developers can make the program of directly server of databases and, thus, there is one more place for accommodation of logic of the program. Saved procedures (stored procedures) is a group of offers in language SQL and procedural logic, which developers can compile and store on a server of databases as objects. . Programs-clients are capable to carry out saved procedures, also as well as other type saved procedures or triggers, by sends messages to a server of databases.
Triggers (triggers) is saved procedures which become more active automatically as soon as to a server of databases there is an event connected with data. The rule (rule) is a special type of the trigger which checks data before their entering into a database.
The most part existing at the moment saved procedures, triggers and rules possesses very narrow specialization and differing possibilities. SQL Server is capable to start only one trigger operations of an insert while CA-OpenIngres ensures the functioning into several triggers. Moreover, expansions of procedures SQL at different manufacturers different.
5. Java a platform


"It is written once, works everywhere! " Technology Java is an object-oriented, platform-independent, multiline environment of programming.
When the software product written in programming language Java is compiled with use of technology Java, it turns out bytecode. Virtual machine Java can interpret this bytecode on any platform on which virtual machine Java is established. It means, that there is no necessity in programs portation.
In Java opportunities some seldom used, badly understood and complicating work With which bring more problems, than advantages are not included. It was necessary to refuse an overload of operators (but the overload of methods in Java has remained), plural inheritance, automatic expanding reduction of types. The automatic assembly of dust simplifying process of programming, but a little bit complicating system as a whole was added. In With and About management of memory caused always weight of problems, now it is not necessary to care of it much.

5.1 Object-orientation

Java language was from the very beginning projected as object-oriented. The client-server answers problems of the distributed systems an object-oriented paradigm: use of concepts incapsulation, inheritance and polymorphism. Java gives a clear and effective object-oriented platform of development.

5.2 Reliability

Platform Java is developed for creating the highly reliable applied software. The Much attention is given to check of programs at a stage of compilation which the second level - dynamic check (at a stage of performance) follows.
The pattern of management of memory is maximum simple: objects are created by means of the operator new. In Java, unlike With, the mechanism of indexes precludes direct record in memory and damage of data: at work with indexes of operation are strictly typified, there are no arithmetic operations above indexes. Work with files is under the control of operating system. There is an automatic assembly of garbage.
The given pattern of management of memory excludes whole category of mistakes so often arising at programmers on With and S.Programmy on Java it is possible to write, being assured that the car "not will hang" because of mistakes at work with dynamically allocated memory.

5.3 Security

Java it is developed for operating in the distributed environments, it means, that in the foreground there should be safety issues. In network environments the appendices written on Java, are protected from intrusion of not authorized code, trying to introduce a virus or to destroy file system.

5.4 Independence of architecture

Java it is developed for support of the appendices introduced in heterogeneous network environments. In similar environments of the appendix should be executed on various hardware architecture, under control of various operational systems and in cooperation with interfaces of various programming languages. For maintenance of platform-independence of programs compiler Java generates byte-code - the architecturally-neutral intermediate format of the program created for effective transfer of a code on various hardware and program platforms. At performance of the program of byte-code it is interpreted by executing car Java. The Same Java-bytecode will be executed on any platform.

5.5 High efficiency

Productivity always deserves special attention. Java reaches high efficiency owing to specially optimized byte-code easily translated in a machine code. Automatic assembly of garbage is carried out as a background stream with a low priority, providing high probability of availability of required memory that conducts to an increase of productivity. The appendices requiring greater computing resources, can be designed so that those parts which require intensive calculations, have been written in language of the assembler and cooperated with Java a platform. Basically, users feel, that appendices cooperate rapidly in spite of the fact that they are interpreted.
6. CGI and Java technologists

By means of servlets it is possible to take data from databases. The offered approach is actual for a wide spectrum of problems of object-oriented design for construction of object-oriented models ensuring the functioning with databases of the various organizations.
Let's consider a difference between CGI and Fast CGI technologies and work Java based Web Server. When the Web-server receives CGI (Common Gateway Interface) - inquiry, it needs to start the extraneous program, to enable this program to be executed and then to come to the end, and after that to return the text received as a result of performance in a Web-browser. Complicates a situation that the majority of modern Web-appendices assume presence of a certain similarity of access to databases even more. Each time during performance CGI the new reference to a database which borrows some seconds should be created. Process of reception of the answer from CGI a script is represented in figure 2.

CGI
Figure 2 - CGI

Time of working off of a script often comparably in due course creations of new process. Technology FastCGI gives 6-10 multiple increase in productivity in comparison with CGI because the fulfilled process does not leave from memory. Also in FastCGI API-functions by means of which the script uses some resources of a server are stipulated can use, that also raises productivity of system. FastCGI it is represented in figure 3.

FastCGI
Figure 3 - FastCGI

Servlets are objects which form the specific interface by means of which they can be built in freely in Java-focused a Web-server. On fig. 4. Work Java Web Server is shown. We shall note a multithreading in uniform process. Set servlets are carried out in parallel within the limits of one process on a server and on the productivity surpass both CGI, and Fast-CGI appendices. Servlets there is no necessity to reload process at each new inquiry, and it also raises their speed.

Servlet
Figure 4 - Servlet

Servlets are tolerant, platform independent, possess all indispensable qualities, including protection of the data, the simplified access to data and the facilitated way of integration with Servlets Java-applets, forming a part the offered project, have a lot of advantages in comparison with CGI – technologies. The basic advantages servlets are those:
Independence of a platform. Servlets can be carried out on any platform needlessly recompilation or modifications. Scripts on PERL too can migrate from a platform on a platform, however expansions for CGI and the servers, written on languages of a high level of this type With, not so are mobile.
Servlets are loaded only once while programs CGI should be loaded in reply to each new inquiry. Used in servlets the method init () allows the programmer to carry out resource absorb operations (of this type joints with a database) in an instant of loading and to reuse them at repeated references to servlets. In other words, instead of entering into base and back repeatedly, reasonably to connect to it once.
Expansibility. Java is tolerant, well thought over and completely object-oriented language. Special-purpose libraries Java, instrumental means of development and drivers for work with databases replenish constantly and updated. In fact, servlets is a key element for Java Server API (Application Programming Interface) which should work everywhere, since Web-servers and finishing network computers.
Servlets are often used by development of Web-appendices. Application servlets allows to simplify significantly process of dynamic formation of contents Web-of documents. Web the-appendix represents set of following components: Java– servlets, Java Server Page, library of the user descriptors, library of categories Java, a descriptor of delivery, static components (HTML-pages, images, etc.), other resources.
For maintenance of work of data of the appendix any server supporting these components approaches. If the Web-appendix contains servlets, JSP or libraries of the user descriptors the Web-server should be supplied by the special container supporting given components.
It can be or the container specially focused for work with Java- servlets and JSP, or the full-function server intended for maintenance of work of J2EE-appendices, for example, Borland Enterprise Application Server. One of advantages of use of language Java for creation of programs consists that the written and compiled code can be transferred from one platform on another. In ideal case Web-the appendix should represent the independent structure containing all necessary files and defining features of delivery and performance of program components. Thus, the advantages inherent in language Java, are transferred on the whole platform containing correct representation of the information on various servers.
Contents of Web-unit and the Web-appendices placed on them represent a combination static, i.e. not changeable eventually, information and dynamically formed data. The demands assuming formation of the information in view of interests of concrete users are made to Web-units. Besides often, for example, in our case, it is necessary to form Web-pages on the basis of the information containing in databases.
The conclusion

During performance of work of the master on the given subject matter the concept about architecture the client-server and about a role of this technology has been received.
Experimental operating time of the client-server system which are based on Java Servlet and MIDlet technologies have been executed. Transfer of a content between the client and a server, communicating through GPRS is made.
In the long term creating of the portal, capable to accept a wide version of contents, expansion of client base, adaptation of one of existing DB for storage of special-purpose types of the information.
I consider, that the given work can be used as a basis for the further studying the technologies incorporated by the concept a web-servers.
Literature

1. N. Muhamedzanov, Java. Server applications, - Èçäàòåëüñòâî: ÑÎËÎÍ - Ð, 2003

2. Robert Orfaly, Den Harky, "JAVA and CORBA in client server applications"

3. Duglas Camer, Devid L. Stivens, Ñåòè TCP/IP, òîì 3. Ðàçðàáîòêà ïðèëîæåíèé òèïà êëèåíò/ñåðâåð, èçäàòåëüñòâî «Âèëüÿìñ», 2002 ã., 592 ñòð.

4. Flenov M.E., Web-ñåðâåð ãëàçàìè õàêåðà: Ïðîáëåìû áåçîïàñíîñòè Web-ñåðâåðîâ; Îøèáêè â ñöåíàðèÿõ íà PHP, Perl, ASP; SQL-èíúåêöèè

up
Äëÿ îôîðìëåíèè ñàéòà èñïîëüçîâàíû ãðàôè÷åñêèå ôðàãìåíòû èç èãðû Winding Trail, ÷òî ñîãëàñîâàíî ñ å¸ àâòîðàìè