rsfs doc
TRANSCRIPT
-
8/2/2019 RSFS Doc
1/73
Project Report Remote System File Search
1.1 INTRODUCTION TO THE PROJECT:
As for as network file system concerned, NFS used only to share the
file on the same file systems of the network. In the NFS we share the
file from one file system of the computer to the same file system of
another system.
If we want to share the file from one file system of the system
to the different file system of another system, in this situation we have
to use the java network file system.
In this RSFS, we may share the file from one file system of the
system to the different file system of the system in the network. Thats
why we have to implement the java to network file system.
Then if we want to share the file from one Operating System
to different Operating System, we have not to use the network file
system. So we have to use RSFS.
In the RSFS implementation of the network, we may share the
file from one operating system of the network to different operating
system of the network.
Suppose we use the Network File System in the Network, if
one system has the FAT 16 File system, we do not share the file from
FAT 16 to FAT 32 or NTFS for recover this problem we have to use
RSFS, in the RSFS network we may share the file from FAT 16 file
system of the system to FAT 32 or NTFS file system of the system.
1.2 LITERATURE REVIEW:
Due to rapid advances in the network communication technologies
and the increased demand for various kinds of communication
services, many new Network Computers, or NCS are low cost, easy
to use network computing devices". The concept of the NC was
introduced to address the costs and complexities of owning and
maintaining personal computers. The two central tenets of the NCare
to be cheaper and easier to maintain and use than PCS, and to
1
-
8/2/2019 RSFS Doc
2/73
Project Report Remote System File Search
provide access to corporate networks and the Internet. They are
cheaper because they don't provide local storage, and lack the
processing and video capabilities (as well as the other bells and
whistles) that are standard on today's PCS. They are easier to
maintain because servers control the software management, including
downloading applications as they are needed, primarily using Sun's
platform independent Java applications in networks require more
interoperability and security. Since many computers of different file
systems are connected in the network communication, there is a need
of accessing files between them. So we ensure java network file
system in order to provide interoperability between different file
systems and to improve good security. Therefore, the issue of
accessing files between different file systems has become more and
more important.
In the past, only there were one type of file system say FAT 12.Later
on different file systems like FAT 16, FAT 32, NTFS came in to
existence. So the accessing of files between different file systems is
not possible. So our project deals the problem by making the
accessing of files between different file systems. We focus on the
design of network communication using java which we try to improve
the interoperability and to providegood security.
In this project, we present a native code conversion method. The
native code conversion provides good security and efficient way of
accessing of files between different file systems in a complex network
communication.
The file system client since uses native code concept it runs on all
network computers. Since a number of vendors are shipping several
different types of NCS, it would be efficient to develop a single client
that works on all of them. It also provides some authentication and
access control to ensure that unauthorized users could not gain access
to files. Mainly, the file server is interoperable with other types of file
systems, so its performance had become reasonably good.
The main advantages are :
2
-
8/2/2019 RSFS Doc
3/73
Project Report Remote System File Search
Since the RSFS provides interoperability, problem can be
easily handled by using native code conversion.
Native code conversions operations, such as conversion fromone file system format to its machine code are very easy to implement.
Implementation of authentication protocol based on Access
Control List provides good security than NFS for granting access to
files.
1.3 EXISTING SYSTEM:
The existing system is platform independent but it has some
limitations such as the independency is applicable only among certain
group of operating systems. (e.g., independency among windows
alone).
The existing system does not support interoperability. (ie. in existing
system, file system in client had to run on all network computers.
Since a number of vendors are shipping several different types of
NCs, it is not possible to develop a single client that works on all of
them).
Disadvantages:
The system can be platform independent among only certain
group of operating systems.
The system does not support the more interoperability.
Good security is not provided by the existing system.
1.4 PROPOSED SYSTEM:
3
-
8/2/2019 RSFS Doc
4/73
Project Report Remote System File Search
Interoperability with other file systems is provided because RSFS
runs on top of a native file system. Thus, RSFS can provide access
to files served over both local file systems such as NTFS or a UNIX
local file system, as well as network file systems such as NFS or
DFS.
A Java implementation of RSFS ensures that it will work on all NC
compliant devices, ie., more platform independent than NFS.
Implementation of authentication protocol based on Access Control
List provides good security than NFS for granting access to files.
Advantages:
The proposed system provides more interoperability with
other file systems.
This system is more platform independent than the existing
system.
Good security is provided by the implementation of
authentication protocol based on Access Control
2.1 SYSTEM ANALYSIS:
4
-
8/2/2019 RSFS Doc
5/73
Project Report Remote System File Search
System analysis is the process of studying systematically a given
system to find how a system functions, its components and the
interactions and interrelationships between them. Through system
analysis an analyst may come to know how a business functions and
its objective, drawbacks if any and with these details he/she may make
improvements to enhance the business systems performance.
2.1.1 IDENTIFICATION OF NEED:
Accessing of files between heterogeneous file systems is not possible.
Since the network computers have different file systems that are
important to have a common file system for accessing heterogeneous
file system.
Problem Definition:
Java network file system is on system side program that share
and access the file from one operating system of the computer system
to the different operating system of the operating system. The system
side program developed under GUI environment which share the file
between the different operating system of the systems.
The system side program has to develop under the Network
file system, Java Network file system.
Network File System:
In the Network file system, we share the file from one file
system of the Network to the same file system of the Network.
Java Network File System:
5
-
8/2/2019 RSFS Doc
6/73
Project Report Remote System File Search
In the java Network file system we share the file from one file
system of the Network the different file system of the network and
share access the file from one operating system of the system to the
different operating system of the systems in the Network.
2.1.2 PRELIMINARY INVESTIGATION:
Preliminary investigation is to evaluate project requests. It is
not a design study, nor does it include the collection of details to
completely describe the business system. Rather, it is the collecting of
information that permits committee members to evaluate the merits of
the project and make the feasibility of the proposed project.
Clarify and understand the project request and Determine the
size.
Access costs and benefits of alternative approaches.
Determine the technical and operational feasibility of
alternative approaches.
Report the findings to management, with recommendation
outlining the acceptance or rejection of the proposal.
2.1.2.1 Reviewing Organization Documents:
The analysis conducting the investigation first learns about the
organization involved in or affected by the project. For example, to
review an inventory systems proposal means knowing first how the
inventory department operates and who the managers and supervisors
are. Analysis can usually learn these details by examining
organization charts and studying written operating procedures. The
procedures describe how the inventory process should operate and
identify the most important steps involved in receiving, managing, and
dispensing stock.
6
-
8/2/2019 RSFS Doc
7/73
Project Report Remote System File Search
2.1.2.2 On-site Observations:
Another important technique to collect data is on-site
observation. In this method, the analysts observe the activities of the
system directly. One purpose of on-site observation is to get as close
as possible to the real system being studied. During on-site
observation, the analysts can see the office environment, work load of
the system and the users, methods of work and the facilities provided
by the organization to the users.
2.1.2.3 Conducting Interviews:
Written documents tell the analysts how the systems should
operate, but they may not include enough detail to allow a decision to
be made about the merits of a systems proposal, nor do they present
user views about current operations. To learn these details, analysts
use interviews.
Interviews allow analysts to learn about the nature of the
project request and the reason for submitting it. To accomplish the
purpose of the interview, analysts must be sure to emphasize the
request and the problem it addresses. In other words, interviews
should provide details that further explain the project and show
whether assistance is merited economically, operationally, and
technically. Working out a solution to the situation comes later during
the detailed investigation. Usually, preliminary investigation
interviews involve only management and supervisory personnel.
2.2. FEASIBILITY STUDY:
Feasibility is the determination of whether or not a project is
worth doing. The process followed is making this determination is
called feasibility study. This type of study determines if a project can
and should be taken. Once it has been determined that a project is
feasible, the analyst can go ahead and prepare the project specification
7
-
8/2/2019 RSFS Doc
8/73
Project Report Remote System File Search
which finalizes project requirements. Generally, feasibility studies are
undertaken within tight time constraints and normally culminate in a
written and oral feasibility report. The contents and recommendations
of such a study will be used as a sound basis for deciding whether to
proceed, postpone or cancel the project. Thus, since the feasibility
study may lead to the commitment of large resources, it becomes
necessary that it should be conducted competently and that no
fundamental errors of judgement are made.
This is the initial phase of SDLC, during which the system analyst
studies the objectives of the system and prepares a report called
Feasibility Report. It is report that decides whether the automation can
be carried out for the existing system. The preparation of feasibility
report mainly deals with the cost-benefit analysis. The analyst should
not bias while making decisions and is required to reflect based in the
CB analysis output. Based on the advice given by the analyst, the top
management decides whether to show a green signal. The result of the
feasibility study is a formal proposal. This is simply a report- a formal
document dealing the nature and scope of the proposed solution. The
proposal summarizes what is going to be done.
Statement of the problem
Summary of findings and recommendations.
Details of findings.
Recommendations and conclusions.
2.2.1 TECHNICAL FEASIBILTY:
This is concerned with specifying equipment and software that
will successfully satisfy the user requirement. The technical needs of
the system may vary considerably, but might include
The facility to produce outputs in a given time.
Response time under certain conditions.
Ability to process a certain conditions.
Facility to communicate data to distant location.
8
-
8/2/2019 RSFS Doc
9/73
-
8/2/2019 RSFS Doc
10/73
Project Report Remote System File Search
2.2.2 ECONOMICAL FEASIBILITY:
Economical analysis is the most frequently used technique for
evaluating the effectiveness of a proposed system. More commonly
known as cost/benefit analysis, the procedure is to determine the
benefits and savings that are expected from a proposed system and
compare them with costs.
If benefits outweigh costs, a decision is taken to design and implement
the system. Otherwise, further justification or alternative in the
proposed system will have to be made if it is to have a chance of being
approved. This is an ongoing effort that improves in accuracy at each
phase of the system life cycle. Financial benefits must equal or exceed
the costs. The analysts raise various financial and economic questions
during the preliminary investigation.
The cost to conduct a full systems investigation.
The cost of hardware and software for the class of application
being considered.
The benefits in the form of reduced costs or fewer costly
errors.
The cost if nothing changes.
To be judged feasible, a proposal for the specific project must pass all
these tests.
2.2.3 OPERATIONAL FEASIBILITY:
It is mainly related to human organizational and political
aspects. The points to be considered
What changes will be brought with the system?
What organizational structures are disturbed?
What new skills will be required?
10
-
8/2/2019 RSFS Doc
11/73
Project Report Remote System File Search
Do the existing staff members have these skills? If not, can
they be trained in due course of time?
Generally the project will not be rejected simply because of
operational unfeasibility but such considerations are likely to criticallyaffect the nature and scope of the eventual recommendations. This
feasibility study is carried out by a small group of people who are
familiar with information system techniques, who understand the parts
of the business that are relevant to the project and are skilled in system
in system analysis and design process.
Proposed projects are beneficial only if they can be turned into
information systems that will meet the operating requirements of the
organization. This test of feasibility asks if the system will work when
it is developed and installed. Are there major barriers to
implementation? Some of the important questions that are useful to
test the operational feasibility of a project are given below:
Is there sufficient support for the project from the
management? From users? If the present system is well liked and used
to the extent that persons will not be able to see reasons for a change,
there may be resistance.
Are current business methods acceptable to the users? If they
are not, Users may welcome a change that will bring about a more
operational and useful system.
Have the users been involved in the planning and development
of the project? If they are involved at the earliest stage of project
development, the chances of resistance can be possibly reduced.
Will the proposal system cause harm? Will it produce poorer
result in any case or area? Will the performance of staff member fall
down after implementation?
11
-
8/2/2019 RSFS Doc
12/73
Project Report Remote System File Search
2.3 SOFTWARE REQUIREMENTS:
PLATFORM : JAVA with RMI
DOCUMENTATION : MS-WORD-2003
OPERATING SYSTEM : MS-DOS/WINDOWSXP
LINUX/UNIX/WINNT
FILE SYSTEM : FAT32/NTFS
PROTOCALS USED : TCP/IP
INTERFACE REQUIREMENTS : CLIENT/SERVER
INTERFACE
2.4 HARDWARE REQUIREMENTS:
MAIN PROCESSOR : INTEL PENTIUM
PROCESSOR
CO-PROCESSOR : ATTACHED
BASE MEMORY SIZE : 128MB SDRAM
HARD DISK CAPACITY` : 40GB
FLOPPY DISK CAPACITY : 1.44MB FDD
MONITOR : 16 VGA COLOR
12
-
8/2/2019 RSFS Doc
13/73
Project Report Remote System File Search
MOUSE ATTACHED
NETWORK ENVIRONMENT : LAN
(ETHERNET/TOKEN RING)
DATA TRANSFER RATE : 10 - 100 MBPS
13
-
8/2/2019 RSFS Doc
14/73
Project Report Remote System File Search
INTRODUCTION:
Design is what virtually every engineer wants to do. It is the place
where customer requirements, business needs, and technical
considerations all come together in the formulation of a product or
system. Design creates a representation or model of the software, but
unlike model (that focuses on describing required data, function, and
behavior), the design model provides detail about software data
structures, architecture, interfaces, and components that are necessary
to implement the system. Design is a solution, a how to approach to
the creation of a new system.
Design depicts the software in a number of ways. First, the
architecture of the system or product must be represented. Then, the
interfaces that the software to end-users, to other systems and devices,
and to its own constituent components is modeled. Finally, the
software components that are used to construct the system are
designed. Each of these views represents a different design action, but
all must conform to a set of basic design concepts that guide all
software design work.
A design model that encompasses architectural, interface, component-
level, and deployment representation is the primary work product that
is produced during software design. One of our basic design
objectives is to provide the user goodness of GUI accompanying the
completeness of a hard-core technology from the every aspect of the
project.
3.1 USE CASE DIAGRAM:
Use- case describes the manner in which an actor (in the
context of user interface design, an actor is always a person) interacts
with a system. It shows how an end-user performs some specific work
related task.
14
-
8/2/2019 RSFS Doc
15/73
Project Report Remote System File Search
The use case diagram shows the interactive operations
between user and the system.
The user enters the user name and password.
Then after getting the authentication permission, the user is
allowed to access the files.
The user selects the file which the user wants to select the files
to access.
The user uses the event log to check the transfer of files
between different file systems.
3.2 FLOW CHART:
The purpose of flow chart diagrams is to provide a semantic bridge
between users and systems developers. It is a graphical
representation. It is used to represent the flow of data from server to
client and vice versa.
Enter the user name
and password
Selects file from
remote or local
Opens the file
Selects the eventlog
15
-
8/2/2019 RSFS Doc
16/73
Project Report Remote System File Search
start
Type username
& password
Access the remote
machine
Server makes machine
to listen
Native code conversion
Files are accessed
stop
16
-
8/2/2019 RSFS Doc
17/73
-
8/2/2019 RSFS Doc
18/73
Project Report Remote System File Search
3.4.1 MODULES EXPLANATION:
3.4.1.1 Authentication:
The server will be in listening mode to access the remote
Machine.
We use the rmi port numer 1099.
Once the server got request from client, it invoke the Server
port.
The RSFS Login checks the username and password in the
18
-
8/2/2019 RSFS Doc
19/73
Project Report Remote System File Search
Server and then provides the connection to RSFS server.
3.4.1.2 Accessing of Files:
The server can able to access the files both in remote and its
locally.
It uses Local list Listener to fetch the local files from it.
For accessing the files in the remote machine it will be using
the remote list listener.
Remote List Listener will fetch the file from it and then it will
transfer the file to the Server accordingly by converting into its native
code.
3.4.1.3 Native code conversion:
This is the main module which converts the file system of
different format, so that it can access files between the heterogeneous
file systems. To do this conversion it involves the following steps:
The system of heterogeneous file system will be connected by
using the socket concept.
To access the file system from server to client namely FAT16
to FAT32 (vice-versa), we will be implementing the RSFS on top ofnative file.
Locallist
Listener
RSFS Server Fetch the remote files
RSFS Server Fetch the local files
Remote
ListListener
19
-
8/2/2019 RSFS Doc
20/73
-
8/2/2019 RSFS Doc
21/73
Project Report Remote System File Search
The user logins by entering the user name and password.
Soon after entering, the user name and password authenticate
by server.
The authorized user is allowed to access the files.
The server accessing of files from client.
The Client responses to Server.
The file from one file system format to another is converted to
another by using the native code conversion.
Thus the accessing of file between the different file systems
takes place.
3.4.1.5 Event Log:
All the information about the transferring of files will be
stored in the database.
It stores details like information about to which system the
files is trasferrred, its size and time etc.
This module actually used to displays all these information.
It uses this to maintain the Log about the systems connected in
the network.
It will be mainly used for future reference.
21
-
8/2/2019 RSFS Doc
22/73
Project Report Remote System File Search
3.5 DATA FLOW DIAGRAM:
22
Granted
File sent through Transfer
Control Protocol
Shared
folder
source
files
Authorize
d user
Authe
nticati
on
User
Remo
te
Server
JVM
of
sourc
e
machi
ne
Remote
System
File
Search
JVMof
remot
e
machi
ne
Serverprogram
to convert
into native
file system
Remote
systems
shared
folder
Java File
System
File log
OPERA
TINGSYSTE
M
1
2
3 5
4
6
7 8
9
1
0
1
11
2
1
3
1
4
.
1
1
4
.
2
1
5
1
6
1
7
1
8
1
9
-
8/2/2019 RSFS Doc
23/73
Project Report Remote System File Search
The implementation activity encompasses a set of coding and testing
tasks that lead to operational software that is ready for delivery to the
customer or end-user. The primary goal of implementation is to write
source code and internal documentation so that conformance of the
code to its specification can be very easily verified, thereby
debugging, testing and modification are made easy. In modern
software engineering work, coding may be:
The direct creation of programming source code;
The automatic generation of source code using an intermediate
design like representation of the component to be built;
The automatic generation of executable code using a fourth
generation programming language(e.g. Visual C++)
Coding Principles:
Constrain your algorithms by following structured
programming practice.
Select data structures that will meet the needs of the design.
Understand the software architecture and create interfaces that
are consistent with it.
Keep conditional logic as simple as possible
Create nested loops in way that makes them easily testable.
Select meaningful variable names and follow other localcoding standards.
Write coding that is self-documenting.
Create a visual-layout that aids understanding.
23
-
8/2/2019 RSFS Doc
24/73
Project Report Remote System File Search
IMPLEMENTATION TOOLS :
CREATION OF JAVA:
Java was conceived by James Gosling, Patrick Naughton, Chris
Warth, Ed Frank and Mike Sheridan at SUN Micro Systems Inc
Corporation in 1991. It took 18months to develop the first working
version. This language was initially called "OAK", but was renamed
JAVA" in 1995. Before the initial implementation of OAK in 1992
and the public announcement of Java in1995, many more contributed
to the design and evolution of the language.
JAVA OVERVIEW:
Java is powerful but lean on Object Oriented programming language.
It has generated a lot of excitement because it makes it possible to
program for Internet by creating applets, programs that can be
embedded in web page. The context of an applet is limited only by
one's imagination. For example, an applet can be an animation with
sound, an interactive game or a ticker tape with constantly updated
stock prices. Applets can be just little decorations to liven up web
page, or they can be serious applications like word processors or
spreadsheet.
But Java is more than a programming language for writing
applets. It is being used more and more for writing standalone
applications as well. It is becoming so popular that many people
believe it will become standard language for both general purpose and
Internet programming.
There are many buzzwords associated with Java, but because
of its spectacular growth in popularity, a new buzz word has appeared
ambiguous, indeed, all indications are that it will soon be everywhere.
Java builds on the strength of C++. It has taken the best
features of C++ and discarded the more problematic and error prone
parts. To this lean core, it has added garbage collection (automatic
24
-
8/2/2019 RSFS Doc
25/73
Project Report Remote System File Search
memory management), multithreading (the capacity for one program
to do more than one thing at a time), security capabilities. The result
is that Java is simple, elegant, powerful and easy to use.
Java is actually a platform consisting of three components:
1. Java programming language.
2. Java is library of classes and interfaces.
3. Java is a Virtual Machine.
JAVAs MAGIC: The Byte Code:
The key that allows java to solve both the security and the
portability problems just described is that, the output of the java
compiler is not an executable code. Rather, it is Byte Code. Byte Code
is a highly optimized set of instructions designed to be executed by
virtual machine that the java Run-time system emulates. However, the
fact that a java program is interpreted helps solve the major problems
associated with downloading the program over the Internet.
Here is why java was designed to be interpreted language.
Because java programs are interpreted rather than compiled .It is
easier to run them in wide variety of environments. Only the java
runtime system needs to be implemented for each platform. Once the
runtime package exists for a given system any java program can run
on it. If java were a compiled language then different versions of the
same program will have to exist for each type of CPU connected to
the Internet. Thus interpretation is the easiest way to create truly
portable programs. Although java was designed to be interpreted,
there is technically nothing about java that prevents on the fly
compilation of Byte Code into native code. However, even if dynamic
compilation were applied to Byte Code, the portability and safety
would still apply, because the run time system would still be in change
of the execution environment.
25
-
8/2/2019 RSFS Doc
26/73
Project Report Remote System File Search
THE JAVA BUZZ WORDS:
No discussion of the genesis of java is complete without a look at
the java buzzwords. Although the fundamentals that necessitated the
invention of java are portability and security, there are other factors
that played an important role on molding the final form of the
language. The java in the following list of buzzwords summed up the
key considerations.
Simple
Portable
Object-oriented
Robust
Multithreaded
Architectural-neutral
High performance
Distributed
Dynamic
OBJECT ORIENTED PROGRAMMING AND JAVA:
Object-oriented Programming was developed because of limitations
found in earlier approaches of programming. In order appreciate what
OOP does, we need to understand the limitations present in the
traditional programming.
Procedural Languages:
26
-
8/2/2019 RSFS Doc
27/73
Project Report Remote System File Search
The procedural languages include Pascal, C, Basic, FORTRAN, and
some other similar languages. Each statement in these languages tells
the computer to perform some operation. A program in a procedural
language is a list of instructions.
For very small programs no other organizing principle (often called a
paradigm) is needed. The programmer creates the list of instructions,
and the computer carries them out.
Division into Functions:
When programs become larger, a single list of instructions becomes
unwieldy. Few programmers can comprehend a program of more than
a few hundred statements unless it is broken down into smaller units.
For this reason the function was adopted as a way to make programs
more comprehensible to their human creators. (The term function is
used in C++ and C. In other languages the same concept may be
referred to as a subroutine, a subprogram, or a procedure.) A program
is divided into functions, and (ideally, at least) each function has a
clearly defined purpose and a clearly defined interface to the other
functions in the program.
The idea of breaking a program into functions can be further extended
by grouping a number of functions together into a larger entity called
a module, but the principle is similar: grouping a number of
components that carry out specific tasks.
Dividing a program into functions and modules is one of the
cornerstones of structured programming, the somewhat loosely
defined discipline that has influenced programming organization for
more than a decade.
Problems with Structured Programming:
27
-
8/2/2019 RSFS Doc
28/73
Project Report Remote System File Search
As programs grow ever larger and more complex, even the structured
programming approach begins to show signs of strain. You may have
heard about the problems involved in program development. The
project is too complex, the schedule slips, more programmers are
added, complexity increases, costs skyrocket, the schedule slips
further, and disaster ensues. Analyzing the reasons for these failures
reveals that there are weaknesses in the procedural paradigm itself.
No matter how well the structured programming approach is
implemented, large programs become excessively complex. The
reasons for this failure of procedural languages are mainly because of
the role played by data.
Relationship to the Real World:
Procedural programs are often difficult to design. The problem is that
their chief components--functions and data structures--don't model the
real world very well. For example, suppose you are writing a program
to create the elements of a graphics user interface: menus, windows,
and so on. Quick now, what functions will you need? What data
structures? The answers are not obvious, to say the least. It would be
better if windows and menus corresponded more closely to actual
program elements.
New Data Types:
There are other problems with traditional languages. One is
the difficulty of creating new data types. Computer languages
typically have several built-in data types: integers, floating-point
numbers, characters, and so on. What if you want to invent your own
data type? Perhaps you want to work with complex numbers, or two
dimensional coordinates, or datesquantities the built-in data types
dont handle easily. Being able to create your own types is called
extensibility; you can extend the capabilities of the language.
Traditional languages are not usually extensible. Without unnatural
28
-
8/2/2019 RSFS Doc
29/73
Project Report Remote System File Search
convolutions, you cant bundle together both X and Y coordinates into
a single variable called Point, and then add and subtract values of this
type. The result is that traditional programs are more complex to
write and maintain.
The object oriented approach:
The fundamental idea behind object-oriented languages is to
combine into a single unit both data and the functions that operate on
that data. Such a unit is called an object.
An objects functions, called member methods in Java,
typically provide the only way to access its data. If you want to read
the item and return the value to you, you call a member function in the
object. It will read the item and return the value to you. You cant
access the data directly. The data is hidden, so it is safe from
accidental modification. Data and its functions are said to be
encapsulated into a single entity. Data encapsulation and data hiding
are key terms in the description of object oriented languages.
A Java program typically consists of a number of objects,
which communicate with each other by calling one anothers members
functions. We should mention that what are called member functions
in C++ are called methods in Java. Also, data items are referred to as
instance variables. Calling an objects member function is referred to
as sending a message to the object.
JAVA IS PORTABLE:
29
-
8/2/2019 RSFS Doc
30/73
Project Report Remote System File Search
One of the biggest advantages Java offers is that it is portable.
An application written in Java will run on all the major platforms. Any
computer with a Java based browser can run the applications or
applets written in the Java programming language. A programmer no
longer has to write one program to run on a Macintosh, another
program to run on a Windows machine, still another to run on a UNIX
machine, and so on. In other words, with Java, developers write their
programs only once. The Virtual Machine is what gives Java its cross
platform capabilities. Rather than being compiled into Machine
language, which is different for each operating systems and computer
architecture, Java code is compiled into byte codes.
With other languages, the program code is compiled into a
language that the computer can understand. The problem is that other
computers with different machine instruction set cannot understand
that language. Java code, on the other hand is compiled into byte
codes rather than a machine language. These byte codes go to the Java
Virtual Machine, which executes them directly or translates them into
the language that is understood by the machine running it.
With JDBC API extending Java, a programmer writing Java
code can access all the major relational databases on any platform that
supports the Java Virtual Machine.
JAVA IS OBJECT-ORIENTED:
30
-
8/2/2019 RSFS Doc
31/73
Project Report Remote System File Search
The Java programming language is object oriented, which
makes program design focus on what you are dealing with rather than
on how you are going to do something. This makes it more useful for
programming in sophisticated projects because one can break the
things down into understandable components. A big benefit is that
these components can then be reused.
Object oriented languages use the paradigm of classes. In
simplest term, a class includes both the data and the functions to
operate on the data. You can create an instance of a class, also called
an object, which will have all the data members and functionality of
its class. Because of this, you can think of a class as being like a
template, with each object being a specific instance of a particular
type of class.
The class paradigm allows one to encapsulate data so that
specific data values are those using the data can not see function
implementation. Encapsulation makes it possible to make the changes
in code without breaking other programs that use that code. If for
example the implementation of a function is changed, the change is
invisible to the another programmer who invokes that function, and it
does not affect his/her program, except hopefully to improve it.
Java includes inheritance, or the ability to derive new classes
from existing classes. The derived class, also called a subclass,
inherits all the data and the functions of the existing class, referred to
as the parent class. A subclass can add new data members to those
inherited from the parent class. As far as methods are concerned, the
subclass can reuse the inherited methods, as it is, change them, and/or
add its own new methods.
JAVA MAKES IT EASY TO WRITE CORRECT CODE:
31
-
8/2/2019 RSFS Doc
32/73
Project Report Remote System File Search
In addition to being portable and object oriented, Java
facilitates writing correct code. Programmers spend less time writing
Java code and a lot less time debugging it. In fact, developers have
reported slashing development time by as much as two thirds. The
following is a list of some of Java's features that make it easier to
write correct code:
GARBAGE COLLECTION:
Automatically takes care of allocating and de allocating
memory, a huge potential source of errors. If an object is no longer
being used (has no references to it), then it is automatically removed
from memory, or "Garbage Collected". Programmers don't have to
keep track of what has been allocated and de allocated themselves,
which makes their job a lot easier, but, more importantly it stops
memory leaks.
NO POINTERS:
Eliminates big source errors. By using object references
instead of many pointers, problems with pointer arithmetic are
eliminated, and problems with inadvertently accessing the wrong
memory address are greatly reduced.
STRONG TYPING:
Cuts down on runtime errors. Because Java enforces strong
type checking, many errors are caught when code is compiled.
Dynamic binding is possible and often very useful, but static binding
with strict type checking is used when possible.
SIMPLICITY:
32
-
8/2/2019 RSFS Doc
33/73
Project Report Remote System File Search
Java is made easier to learn and use correctly. Java keeps it
simple by having just one way to do something instead of having
several alternatives, as in some languages. Java also stays lean by not
including multiple inheritance, which eliminates the errors and
ambiguity that arise when you create a subclass that inherits from two
or more classes. To replace capabilities, multiple inheritance provides
Java lets you add functionality to a class throw the use of interfaces.
JAVA INCLUDES A LIBRARY OF CLASSES AND
INTERFACES:
The Java platform includes an extensive class library so that
programmers can use already existing classes as it is, create subclasses
to modify existing classes, or implement interfaces to augment the
capabilities of classes.
Both classes and interfaces contain data members (fields) and
functions (methods), but there are major differences. In a class, fields
may be either variable or constant, and methods are fully
implemented. In an interface, fields must be constants, and methods
are just prototypes with no further implementations. The prototypes
give the method signature (the return type, the function name, and the
number of parameters, with the type for each parameter), but the
programmer must supply implementations. To use an interface, a
programmer defines a class, declares that it implements the interface,
and then implements all the methods in that interface as part of the
class.
These methods are implemented in a way that is appropriate
for the class in which the methods are being used. Interfaces let one
add functionality to a class and give a great deal of flexibility in doing
it. In other words interfaces provide most of the advantages of
multiple inheritances without its disadvantages.
A package is a collection of related Java classes and interfaces.
The following list, though not complete, gives examples of some Java
packages and what they cover.
33
-
8/2/2019 RSFS Doc
34/73
Project Report Remote System File Search
Java.lang -- This package is so basic that it is automatically
included in any Java program. It includes classes dealing with
numeric, strings, objects, runtime, security and threads.
Java.io -- Classes that manage reading data from input streams and
writing data to the output streams.
Java.util -- Miscellaneous utility classes, including generic data
structures, bit sets, time, date, the string manipulation, random number
generation, system properties, notification and enumeration of data
structures.
Java.net -- Classes for network support.
Java.awt --Classes that manage user interface components such as
windows, dialog boxes, buttons, check boxes, lists, menus, scrollbars,
and text fields; the "AWT" stands Abstract Window Toolkit.
Java.awt.image -- Classes for managing image data, including color
models, dropping, color filtering, setting pixel values, and grabbing
snapshots.
Java.applet -- The Applet class, which provides the ability to write
applets, this package also includes several interfaces that connect an
applet to its document and to resources for playing audio.
Java.sql -- The JDBC API, classes and interfaces that access
databases and send SQL statements.
The first three packages listed, java.lang, java.io, and java.util form
the foundation, they are the basic classes and interfaces for general-
purpose programming. Java Development Kit Version1.1 added some
new packages, with
34
-
8/2/2019 RSFS Doc
35/73
Project Report Remote System File Search
JDBC is being one of them. Other new packages include such things
as Remote Method Invocation, Security and Java Beans the new API
for creating reusable components.
JAVA IS EXTENSIBLE:
A big plus for Java is the fact it can be extended. It was
purposely written to be lean with the emphasis on doing what it does
very well; instead of trying to do everything from the beginning, it
was return so that extending it is very easy. Programmers can modify
existing classes or write their own new classes or they can write a
whole new package. The JDBC API, the java.sql package, is one
example of a foundation upon which extensions are being built. Other
extensions are being added or worked on in area such as multimedia,
Internet Commerce, conferencing, and Telephony.
In addition to extensions there are also main tools being
developed to make existing capabilities easier to use. For example,
there is already a tool that greatly simplifies creating and laying out
Graphical User Interfaces such as menus, dialog boxes and buttons.
JAVA IS SECURE:
It is important that a programmer unable to write subversive
code for applications or applets. This is especially true with the
Internet being used more and more extensively for services such as
electronic commerce and electronic distribution of software and
multimedia contents. The Java platform builds security in four ways.
The way memory is allocated and laid out: In Java an object's
location in memory is not determined until the runtime, as opposed to
C and C++, where the compiler makes memory layout decisions. As a
result, a programmer not looks at a class definition and figure out how
it might be laid in memory.
2. The way incoming code is checked: The Java Virtual Machine
doesn't trust any incoming code and subjects it to what is called Byte
35
-
8/2/2019 RSFS Doc
36/73
Project Report Remote System File Search
Code Verification. The byte code verifier, part of the virtual machine,
checks that
a: The format of incoming code is correct
b: Incoming code doesn't forge pointers
c: It doesn't violate access restrictions
d: It accesses objects as what they are
3. The way classes are loaded: The Java byte code loader, another part
of the virtual machine, checks whether classes loaded during program
execution are local or from across a network. Imported classes cannot
be substituted for built in classes, and built in classes cannot
accidentally reference classes bring in over a network.
4. The way access is restricted for untested code: The Java security
manager allows user to restrict untested Java applets so that they
cannot access the local network, local files and other resources.
JAVA PERFORMS WELL:
Java's performance is better than one might expect. Java's
many advantages, such as having built in security and being
interpreted as well as compiled, do have a cost attached to them.
However, various optimizations have been built in, and the byte code
interpreter can run very fast the cost it doesn't have to do any
checking. As a result, Java has done quite respectably in performance
tests. Its performance numbers for interpreted byte codes are usually
more than adequate to run interactive graphical end user applications.
For situations that require unusually high performance, byte
codes can be translated on the fly, generating the final machine code
for the particular CPU on which the application is running at run time.
High level interpreted scripting languages generally offer great
portability and fast prototyping but poor performance. Low level
compiled languages like C and C++ offer great performance but
require large amounts of time for writing and debugging code because
36
-
8/2/2019 RSFS Doc
37/73
Project Report Remote System File Search
of problems with areas such as memory management, pointers and
multiple inheritance. Java offers good performance with the
advantages of high level languages but without the disadvantages of C
and C++. In the world of design trade-off, you can think of Java as
providing a very attractive middle ground.
JAVA IS ROBUST:
The multi platform environment of the WEB places
extraordinary demands on a program, because it must execute reliably
in a variety of systems. Thus the ability to create robust programs was
given a high priority in the design of Java. To gain reliability, Java
restricts you in a few key areas to force you to find your mistakes
early in program developments. At the same time, Java frees you
from having to worry about many of the most common causes of
programming errors. Because Java is strictly typed language, it checks
your code at compile time. However, it also checks your code at run
time. In fact, many hard to track down bugs that often turn up in hard
to reproduce runtime situations are simply impossible to create in
Java. Knowing that what you have written will behave in a
predictable way under diverse conditions is a key feature of Java.
To understand how Java is robust, consider two main reasons
for program failure:
Memory management mistakes and mishandled exceptional
conditions (run time errors). Memory management can be difficult,
tedious task in traditional programming environments. For example
in C/C++ the programmer must manually allocate and free all
dynamic memory. This sometimes leads to problems. For example
some programmers sometimes forget to free memory that has been
previously allocated. Or worse, they may free some memory that
another part of their code is still using.
Java virtually eliminates these problems by managing memory
allocations and de allocations. Java helps in this area by providing
37
-
8/2/2019 RSFS Doc
38/73
Project Report Remote System File Search
object oriented exception handling. In a well-written Java program a
program should manage all run time errors.
JAVA SCALES WELL:
Java platform is designed to scale well, from portable
consumer electronic devices to powerful desktop and server machines.
The Virtual Machine takes a small footprint and Java byte code is
optimized to be small and compact. As a result, Java accommodates
the need for low storage and for low bandwidth transmission over the
Internet. In addition the Java Operating System offers a standalone
Java platform that eliminates host operating system overhead while
still supporting the full Java platform API. This makes Java ideal for
low cost network computers whose sole purpose is to access the
Internet.
CLASSES:
In OOP we say that objects are members of classes. What does this
mean? Lets look at an analogy. Almost all computer languages
have built-in data types. For instance, a data type int, meaning integer
is pre-defined in Java. You can declare as many variables of type int
as you need in your program:
Int day;
Int count;
Int divisor;
Int answer;
A class serves as a plan, or template. It specifies what data, and what
functions will be included in objects of that class. Defining the class
doesnt create any objects, just as the mere existence of a type int
doesnt create any variables.
A class is thus a collection of similar objects. This fits our non-
technical understanding of the word class, Prince, sting etc., are
members of the class of rock musicians. There is no person called
38
-
8/2/2019 RSFS Doc
39/73
Project Report Remote System File Search
rock musician but specific people with specific names are members of
this class if they possess certain characteristics.
ABSTRACTION:
An essential element of object-oriented programming is abstraction.
Humans manage complexity through abstraction. For example,
people do not think of a car as a set of tens of thousands of individual
parts. They think of it as a well-defined object with its own unique
behavior. This abstraction allows people to use a car to drive to the
grocery store without being overwhelmed by the complexity of the
parts that form the car. They can ignore the details of how the engine,
transmission, and braking systems work. Instead they are free to
utilize the object as a whole.
A powerful way to manage abstraction is through the use of
hierarchical classifications. This allows you to layer the semantics of
complex systems, breaking them into more manageable pieces. From
the outside, the car is a single object. Once inside, you see that the car
consists of several subsystems: steering, brakes, sound system, seat
belts, heating, cellular phone, and so on. In turn, each of these
subsystems is made up of more specialized units. For instance, the
sound system consists of a radio, a CD player, and/or a tape player.
The point is that you manage the complexity of the car(or any other
complex system) through the use of hierarchical abstractions.
Hierarchical abstractions of complex systems can also be applied to
computer programs. The data from a traditional process-oriented
program can be transformed by abstraction into its component objects.
A sequence of process steps can become a collection of messages
between these objects. Thus, each of each object describes its own
unique behavior. You can treat these objects as concrete entities that
respond to messages telling them to do something. This is the essence
of object-oriented programming.
39
-
8/2/2019 RSFS Doc
40/73
Project Report Remote System File Search
Object-oriented concepts form the heart of Java just as they
form the basis for human understanding. It is important that you
understand how these concepts translate into programs. As you will
see, object-oriented programming is a powerful and natural paradigm
for creating programs that survive the inevitable changes
accompanying the life cycle of any major software project, including
conception, growth, and aging. For example, once you have a well
defined objects and clean, reliable interfaces to those objects, you can
gracefully decommission or replace parts of an older system without
fear.
ENCAPSULATION:
Encapsulation is the process of binding the code and the data,
thus providing security from the outside interface. The other way of
defining encapsulation is by providing the code and data with a
protective wrapper, thus preventing them from being accessed by the
code present outside the wrapper. Access to the code and data inside
the wrapper is tightly controlled through a well defined interface. In
Java the basis of encapsulation is the class. A class defines the
structure and behavior (data and code) that will be shared by a set of
objects. Each object of a given class contains the structure and
behavior defined by the class. For this reason, objects are sometimes
referred to as instances of a class. Thus, a class is a logical construct;
an object has physical reality.
Specifically, the data defined by the class are referred to as member
variables or instance variables. The code that operates on that data is
referred to as member methods or just methods. Since the purpose of a
class is to encapsulate complexity, there are mechanisms for hiding
the complexity of the implementation inside the class. Each method
or variable in a class may be marked private or public. The public
interface of a class represents everything that external users of the
class need to know, or may know. The private methods and data can
only be accessed by code that is a member of the class. Therefore,
40
-
8/2/2019 RSFS Doc
41/73
Project Report Remote System File Search
any other code that is not a member of the class cannot access a
private method or variable. Since the private members of a class may
only be accessed by other parts of your program through the class
public methods, you can ensure that no improper actions take place.
Of course, this means that the public interface should be carefully
designed not to expose too much of the inner workings of a class.
INHERITANCE:
Inheritance is the process by which one object acquires the properties
of another object. This is important because it supports the concept of
hierarchical classification. As mentioned earlier, most knowledge is
made manageable by hierarchical (that is, top-down) classifications.
For example, a Golden Retriever is part of the classification dog,
which in turn is part of the mammal class, which is under the larger
class animal. Without the use of hierarchies, each object would need
to define all of its characteristics explicitly. However, by use of
inheritance, an object need only define those qualities that make it
unique within its class. It can inherit its general attributes from its
parent. Thus, it is the inheritance mechanism that makes it possible
for one object to be a specific instance of a more general case.
Most people naturally view the world as made up of objects
that are related to each other in a hierarchical way, such as animals,
mammals, and dogs. If you wanted to describe animals in an abstract
way, you would say they have some attributes, such as size,
intelligence, and type of skeletal system. Animals also have certain
behavioral aspects; they hear, breathe, and sleep. This description of
attributes and behavior is the class definition for animals.
If you wanted to describe a more specific class of animals,
such as mammals, they would have more specific attributes, such as
type of teeth, and mammary glands. This is known as a subclass of
animals, where animals are referred to as mammals super class.
41
-
8/2/2019 RSFS Doc
42/73
Project Report Remote System File Search
Since mammals are simply more precisely specified animals, they
inherit all of the attributes from animals. A deeply inherited subclass
inherits all of the attributes from each of its ancestors in the class
hierarchy.
Inheritance interacts with encapsulation as well. If a given
class encapsulates some attributes, then any subclass will have the
same attributes plus any that it adds as part of its specialization. This
is a key concept, which lets object-oriented programs grow in
complexity linearly rather than geometrically. A new subclass
inherits all of the attributes of all of its ancestors. It does not have
unpredictable interactions with the majority of the rest of the code in
the system.
POLYMORMISM:
Polymorphism (from the Greek, meaning many forms) is a feature
that allows one interface to be used for a general class of actions. The
specific action is determined by the exact nature of the situation.
Consider a stack (which is a last-in, first-out list). You might have a
program that requires three types of stack. One stack is used for
integer values, one for floating-point values, and one for characters.
The algorithm that implements each stack is the same, even though
the data being stored differs. In a non-object-oriented language, you
would be required to create three difference sets of stack routines,
with each set using different names. However, because of
polymorphism, in Java you can specify a general set of stack routines
that all share the same names. More generally, the concept of
polymorphism is often expressed by the phrase one interface,
multiple methods. This means that it is possible to design a generic
interface to a group of related activities. This helps reduce complexity
by allowing the same interface to be used to specify a general class of
action. It is the compilers job to select the specific action (that is,
method) as it applies to each situation.
42
-
8/2/2019 RSFS Doc
43/73
Project Report Remote System File Search
Polymorphism, Encapsulation, and Inheritance Work Together:
When properly applied, polymorphism, encapsulation, and inheritance
combine to produce a programming environment that supports the
development of far more robust and scaleable programs than does the
process-oriented model. A well-designed hierarchy of classes is the
basis for reusing the code in which you have invested time and effort
developing and testing. Encapsulation allows you to migrate your
implementations over time without breaking the code that depends on
the public interface of your classes. Polymorphism allows you to
create clean, sensible, readable, and resilient code.
JAVA IS MULTITHREADED:
Multithreading is simply the ability of a program to do more
than one thing at a time. For example an application could be faxing a
document at the same time it is printing another document. Or a
program could process new inventory figures while it maintains a feed
for current prices. Multithreading is particularly important in
multimedia: a multimedia program might often be running a movie,
running a audio track and displaying text all at the same time.
The Internet helped catapult Java to the forefront of
programming and Java in turn has had a profound effect on the
Internet. The reason is simple: Java expands the universe of objects
that can move about freely in cyberspace. In a network, there are two
broad categories of objects transmitted between the Server and your
Personal Computer: Passive Information and Dynamic, Active
Programs. For example, when you read your e-mail, you are viewing
passive data. Even when you download a program, the program's
code is still only passive data until you execute it. However, there is
a second type of object that can be transmitted to your computer: a
dynamic, self-executing program. Such a program would be an active
agent on the Client computer, yet the Server would initiate it.
43
-
8/2/2019 RSFS Doc
44/73
Project Report Remote System File Search
As desirable as dynamic, networked programs are, they also present
serious problems in the areas of security and portability. Prior to Java
cyberspace was effectively closed to half the entities that now live
there. Java addresses these concerns and doing so, has opened the
door to an exiting a new form of program:
INTRODUCTION TO RMI:
Remote Method Invocation (RMI) facilitates object function
calls between Java Virtual Machines (JVMs). JVMs can be located on
separate computers - yet one JVM can invoke methods belonging to
an object stored in another JVM. Methods can even pass objects that a
foreign virtual machine has never encountered before, allowing
dynamic loading of new classes as required. Remote method
invocation allows applications to call object methods located
remotely, sharing resources and processing load across systems.
Unlike other systems for remote execution which require that only
simple data types or defined structures be passed to and from
methods, RMI allows any Java object type to be used - even if the
client or server has never encountered it before. Any object that can be
invoked this way must implement the Remote interface. When such an
object is invoked, its arguments are ``marshaled'' and sent from the
local virtual machine to the remote one, where the arguments are
unmarshalled''. When the method terminates, the results are
marshaled from the remote machine and sent to the caller's virtual
machine. If the method invocation results in an exception being
thrown, the exception is indicated to caller.
Locate Remote Objects:
Applications can use one of two mechanisms to obtain
references to remote objects. An application can register its remote
objects with RMI's simple naming facility, the rmiregistry, or the
44
-
8/2/2019 RSFS Doc
45/73
Project Report Remote System File Search
application can pass and return remote object references as part of its
normal operation.
Communicate with remote objects:
Details of communication between remote objects are handled
by RMI; to the programmer, remote communication looks like a
standard Java method invocation.
Load class byte codes for objects that are passed:
Because RMI allows a caller to pass objects to remote objects,
RMI provides the necessary mechanisms for loading an object's code,
as well as for transmitting its data. The server calls the registry to
associate (or bind) a name with a remote object. The client looks up
the remote object by its name in the server's registry and then invokes
a method on it.
Advantages of RMI:
One of the important features of RMI is its ability to download the
byte codes (or simply code) of an object's class even though the class
is not defined in the receiver's virtual machine. The type and behavior
of an object, previously available only in a single virtual machine, can
be transmitted to another, virtual machine. RMI passes objects by
their true type, and hence the behavior of those objects is not changed,
when they are sent to another virtual machine. This allows new types
to be introduced into a remote virtual machine, thus extending the
behavior of an application dynamically.
RMI is made up of interfaces and classes. The methods used in RMI
are defined using the interfaces which are implemented by the classes.
In a distributed application some of the implementations are assumed
to reside in different virtual machines.
Objects that have methods that can be called across virtual
machines are remote objects. An object becomes remote by
implementing a remote interface, which has the following
characteristics. A remote interface extends the interface
45
-
8/2/2019 RSFS Doc
46/73
Project Report Remote System File Search
java.rmi.Remote. When the object is passed from one virtual machine
to another, Instead of making a copy of the implementation object in
the receiving virtual machine, RMI passes a remote stub for a remote
object. The stub acts as the local representative, or proxy.
The caller invokes a method on the local stub, which is responsible for
carrying out the method call on the remote object. A stub for a remote
object implements the same set of remote interfaces that the remote
object implements. This allows a stub to be cast to any of the
interfaces that the remote object implements. However, this also
means that only those methods defined in a remote interface are
available to be called in the receiving virtual machine.
Design and Implement the Application Components:
Defining the remote interfaces:
A remote interface specifies the methods that can be invoked
remotely by a client. Clients program to remote interfaces, not to the
implementation classes of those interfaces. Part of the design of such
interfaces is the determination of any local objects that will be used as
parameters and return values for these methods. In case of any of
these interfaces or classes being not available, the user has to define
them.
Implementing the remote objects:
Remote objects must implement one or more remote
interfaces. The remote object class may include implementations of
other interfaces (either local or remote) and other methods (which are
available only locally). If any local classes are to be used as
parameters or return values to any of these methods, they must be
implemented as well.
Implementing the clients:
46
-
8/2/2019 RSFS Doc
47/73
Project Report Remote System File Search
Clients that use remote objects can be implemented at any
time after the remote interfaces are defined, including after the remote
objects has been deployed.
Compile Sources and Generate Stubs:
This is a two-step process. In the first step the user uses the
javac compiler to compile the source files, that contain the
implementation file, interfaces, the server program and the client
program. In the second step you use the rmic compiler to create stubs
for the remote objects. RMI uses a remote object's stub class as a
proxy in clients so that clients can communicate with a particular
remote object.
Introduction to Runtime Class:
Every Java application has a single instance of class Runtime
that allows the application to interface with the environment in which
the application is running. The current runtime can be obtained from
the getRuntime method. which retrieves the current Java Runtime
Environment. That is the only way to obtain a reference to the
Runtime object. With that reference, the user can The class
java.lang.Runtime features a static method called getRuntime(), run
external programs by invoking the Runtime class's exec() method.
Developers often call this method to launch a browser for displaying a
help page in HTML.
There are four overloaded versions of the exec() command:
public Process exec(String command);
public Process exec(String [] cmdArray);
public Process exec(String command, String [] envp);
public Process exec(String [] cmdArray, String [] envp);
For each of these methods, a command -- and possibly a set of
arguments -- is passed to an operating-system-specific function call.
47
-
8/2/2019 RSFS Doc
48/73
Project Report Remote System File Search
This subsequently creates an operating-system-specific process (a
running program) with a reference to a Process class returned to the
Java VM. The Process class is an abstract class, because a specific
subclass of Process exists for each operating system.
The user can pass three possible input parameters into these methods:
1 A single string that represents both the program to execute and
any arguments to that program
2 An array of strings that separate the program from its
arguments
3 An array of environment variables
Class java.lang.Process:
The exec methods return an instance of a subclass of Process
that can be used to control the process and obtain information about it.
The sub process is not killed when there are no more references to the
Process object, but rather the sub process continues executing
asynchronously. The Runtime. exec methods create a native process
and return an instance of a subclass of Process that can be used to
control the process and obtain information about it. The class Process
provides methods for performing input from the process, performing
output to the process, waiting for the process to complete, checking
the exit status of the process, and destroying (killing) the process.
The Runtime.exec methods may not work well for special
processes on certain native platforms, such as native windowing
processes, daemon processes, Win16/DOS processes on Win32, or
shell scripts. The created sub process does not have its own terminal
or console. All its standard io (i.e. stdin, stdout, stderr) operations will
be redirected to the parent process through three
streams(Process.getOutputStream(),Process.getInputStream(),Process.
getErrorStream()). The parent process uses these streams to feed input
to and get output from the sub process. Because some native platforms
only provide limited buffer size for standard input and output streams,
failure to promptly write the input stream or read the output stream of
48
-
8/2/2019 RSFS Doc
49/73
Project Report Remote System File Search
the sub process may cause the sub process to block, and even
deadlock.
The sub process is not killed when there are no more
references to the Process object, but rather the sub process continues
executing asynchronously. There is no requirement that a process
represented by a Process object execute asynchronously or
concurrently with respect to the Java process that owns the Process
object.
Introduction to IOStream:
Streams were created to abstract the concept of exchanging
information between these various devices and provide a consistent
interface for programmers to interact with different sources of I/O in
their programs. The basic idea of a stream is that data enters one end
of a data channel in a particular sequence and comes out the other end
in the same sequence-a first-in-first-out (FIFO) scheme. The very
nature of streams is a perfect match for an object-oriented language
such as Java. In addition, the built-in Java stream classes can be
extended through inheritance to provide the same operations as those
used for the primitive data types for your own user-defined types.
Java's implementation of streams begins with two abstract classes:
InputStream and OutputStream.
InputStream:
InputStream includes several methods that
provide the basic input needs for all the input streams to come. Each
of the read() methods extract one or more bytes of data from the
stream and move the current position in the stream along according to
how many bytes are read. Each read() and skip() method will also
block until at least some data is available to process.
OutputStream:
Like InputStream, the abstract class OutputStream provides thefundamental methods used by all its derived stream classes. Also like
49
-
8/2/2019 RSFS Doc
50/73
Project Report Remote System File Search
the InputStream read() methods, the write() methods will block until
the data is actually written to the output object or device. An
IOException is thrown if any of the OutputStream methods encounter
an error.
ByteArrayInputStream:
Derived from InputStream, a ByteArrayInputStream object allows you
to perform input stream style operations on an ordinary byte array.
This can be valuable when you are working with a sequence of data in
the form of a byte array and want to read single or multiple bytes,
skip, or jump around within the array. Using streams in this fashion
extends the built-in array access methods of subscripting by providing
a more powerful and flexible framework.
ByteArrayInputStream offers two constructors: one that takes a byte
array as a parameter and the other that accepts a byte array, an offset
to the first byte to start reading, and the length of the byte array as
parameters.
ByteArrayOutputStream:
This class is the complement of ByteArrayInputStream in that
it allows you to write data into an array of bytes. Except with this
output version, the class internally creates and maintains the byte
array for you. In fact, it even will expand the byte array as needed. Of
course, it also has methods to retrieve the internal byte array at any
point as a byte array, string, or Unicode string.FileInputStream:
50
-
8/2/2019 RSFS Doc
51/73
Project Report Remote System File Search
From the input side, FileInputStream provides basic input
stream capabilities for dealing with files. A FileInputStream object
can be created using one of three constructors that accept the name of
a file, a File object, or a FileDescriptor object, respectively.
FileOutputStream:
The FileOutputStream class is very similar to
FileInputStream in that it can be created by either a filename passed
as a string, File object, orFileDescriptor.
BufferedInputStream:
The BufferedInputStream's contribution to its attached stream
is the addition of a buffer, or cache, to the stream. This has the effect
of improving the performance of some input streams, especially those
bound to slower sources like a file or network connection.
The user can specify the size of the buffer used by
BufferedInputStream when it is created or accept the default of 2048
bytes. It then intercepts your calls to the read methods and attempts to
satisfy your request with data in its buffer. If the data in the buffer is
not sufficient, a read to the next input stream in the chain is done to
fill the buffer and return the data requested. Anytime a read request
can be satisfied from the buffer, you have saved a potentially slow
read from the attached stream. BufferedInputStream also supports
marking and ensures that the mark limit set remains valid.
BufferedOutputStream:
BufferedOutputStream provides the same performance gains that
BufferedInputStream does for input streams, but its buffer is used for
an output stream. The basic concept is the same. Requests to write to
an output stream are cached in an internal buffer. When the internal
51
-
8/2/2019 RSFS Doc
52/73
Project Report Remote System File Search
buffer reaches capacity it is flushed from the buffer to the output
stream. The size of the internal buffer defaults to 512 bytes but can be
overridden by calling the appropriate constructor with the desired size.
Because the use of a BufferedOutputStream is so similar to that of
BufferedInputStream, an example will not be presented.
Functional Requirements:
Functional requirements specify which output should be
produced from the given input. They describe the relationship
between the data and the methods to obtain the output. This includes
specifying the valid IP address and the desired operation i.e. to beperformed on the remote system.
The Administrator should be able to inform the user before
performing the terminal operations on the users system. Incase of the
user not being available on that system, the administrator can
abnormally terminate the system.
The Administrator should be able to search the files by specifying the
valid IP address, drive in which the file has to be searched and also the
type file that has to be searched. These files are to be listed in a table.
The administrator can be able to download the desired file and can
also be able to upload the file.
Use of Java in this Project:
The concerns for Java security is bound with the power of Java. With
Java Applet we can download executable content from open network
which brings both exciting advantage and dangerous risk to us. The
original Java security model is called sandbox model, which creates a
restricted working environment for entrusted code obtained from the
52
-
8/2/2019 RSFS Doc
53/73
Project Report Remote System File Search
open network. To create such a sandbox we need cooperation from
Java language itself, run time class library, and web browser.
Using Java with World Wide Web provides not only pure data to
users but also executable content as well. Users can download a Java
Applet through the Internet and make it run on his own computer.
Since you have some code which written by someone else other
yourself executing on your computer, security issues are a
fundamental concern from the very beginning.
Because Java is a fully featured programming language, and Java
applications can read and write files on local computer, communicate
with various devices, connect to sockets, and so on, the Java security
issues discussed in this essay concerns only Java Applet.
File System Alternatives for Network Computers:
There are several alternatives to NFS that provide some form of file
system support on an NC. We briefly discuss each below:
Remote method invocation:
53
-
8/2/2019 RSFS Doc
54/73
Project Report Remote System File Search
Remote method invocation (RMI), is a mechanism for invoking an
object's methods, even though the object is executing on a foreign
Java Virtual Machine (JVM). RMI is similar to remote procedure calls
(RPCs), but has an added advantage - method signatures can contain
Java objects as well as primitive data types. Even objects that a
foreign JVM has never encountered before can be used, so new tasks
and methods can be passed across a network.
The use of Server Socket or Datagram Socket in this system:
Datagram Socket allows a server to accept UDP packets, whereas
Server Socket allows an application to accept TCP connections. It
depends on the protocol you're trying to implement. If you're creating
a new protocol, here's a few tips
Datagram Sockets communicate using UDP packets. These
packets don't guarantee delivery - you'll need to handle missing
packets in your client/server.
Server Sockets communicate using TCP connections. TCP
guarantees delivery, so all you need to do is have your applications
read and write using a socket's Input Stream and Output Stream.
How do I get the IP address of a machine from its hostname:
The InetAddress class is able to resolve IP addresses for you. Obtain
an instance of InetAddress for the machine, and call the
getHostAddress() method,which returns a string in the address form.
InetAddressinet = InetAddress.getByName("www.davidreilly.com");
System.out.println ("IP : " + inet.getHostAddress());
WINDOWS XP:
54
-
8/2/2019 RSFS Doc
55/73
Project Report Remote System File Search
Windows XP Professional has great capability in the behind-the-
scenes running of your computer. Overall security has been improved,
making it even safer for you to shop and browse on the Internet. You
can also communicate with other people on other networks without
worrying about compromising your privacy or your personal data
files. Performance is at an all-time high, allowing you to use more
programs and have them run faster than ever. Windows XP
Professional is dependable and stable, so you can always rely on the
performance and effectiveness of your computer. Best of all,
compatibility with other programs is better than ever. Remote Desktop
allows you to access your Windows session from another computer,
just as if you were in front of your computer. The Search Companion
has been enhanced to help you find what you're looking for more
quickly.
Features like Windows File Protection and System Restore will keep
you from accidentally deleting important files, and will return your
computer to its previous state if something goes wrong. If you
encounter a system or program error, you can send a report to
Microsoft, and you can use NetMeeting for virtual meetings with
anyone, anywhere. In the event of a system problem, you can restore
your computer to a previous state without losing your personal data
files (such as documents, Internet favorites, and your e-mail). System
Restore monitors changes to your computer, and periodically makes
easily identifiable restore points. These restore points allow you to
revert your system back to a previous state. You can also create and
name your own restore points at any time.
e.g.: For Accessing files between Linux and windows9x
involves following procedures:
Let us consider the accessing of files between a client and
server of heterogeneous file systems.
55
-
8/2/2019 RSFS Doc
56/73
Project Report Remote System File Search
The Client (say windows xp) will be in listening mode and
waits till it gets the permission for authentication from server(say
Linux).
After getting permission, sharing of files is allowed. Thus
RSFS allows to share the files of heterogeneous file systems.
IMPLEMENTATION:
The main implementation of our project RSFS is to
access the heterogeneous file system. To do this the overall process to
be done is as follows:
Select the network computers in which the file to be
accessed of different heterogeneous file system. As soon as selected
make the server to the listening mode until it gets the authentication.
Then see to that the client is ready to access the files between the
server by pressing the yes or no. If it says ok the server and the client
can able to access the files. Because it may be of different file format
it should be converted to its native code. It wont be transferred by its
native file system instead the RSFS will be using that particular file
and using the StringTokenizer it converts the whole file to tokens.
Then it actually compiles at that time it actually converted as class file
so that all machine can access even though it is of different file
system.
5. PERFORMANCE EVALUATION/TESTING:
Testing is the process of detecting the errors present in the
project. It does not stop with just detecting, but continues with the
56
-
8/2/2019 RSFS Doc
57/73
Project Report Remote System File Search
correction of errors. Tes