ieee chapter

Upload: niranjan-hn

Post on 04-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 IEEE Chapter

    1/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Chapter 2

    LITERATURE SURVEY

    We have used java programming language for implementing this project. The

    description of Java, its features, components and functions are described below.

    2.1Why Java platform?

    Work on Java originally began with the goal of creating a platform-independent

    language and operating system for consumer electronics.

    Java facilitates the building of distributed applications by a collection of classes for

    use in networked applications. By using Java's URL (Uniform Resource Locator) class, an

    application can easily access a remote server. Classes also are provided for establishing

    socket-level connections.

    Features of the Java Language:

    Simple

    Object-Oriented

    Distributed

    Interpreted

    Robust

    Secure

    Architecture-Neutral

    Portable

    High-Performance

    Multithreaded

    Dynamic

    Dept of CSE, SJCIT 5 2007-2008

  • 7/29/2019 IEEE Chapter

    2/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    The Java Foundations Classes

    Java Foundations Classes (JFC) is a set of APIs for building the GUI-related

    components of Java applets and applications. The APIs included with JFC include thefollowing:

    The Abstract Windowing Toolkit

    Swing

    Java 2D

    Drag and Drop

    Accessibility

    Swing components provide a pluggable look and feel, which is easy to substitute

    another appearance and behavior for an element. The Swing related classes are contained in

    javax.swing and its sub packages, such as javax.swing.tree.

    Features of Swing components:

    Swing buttons and labels can display images instead of, or in addition to text.

    User can easily add or change the borders drawn around most swing components.

    Users can easily change the behavior or appearance of a swing component by either

    invoking methods on it or creating a subclass of it.

    Swing components dont have to be rectangular, buttons, for e.g., can be round.

    Assistive technologies such as screen renders can get information from swing

    components.

    Swing lets to specify which look and feel a programs GUI uses.

    Swing components are implemented with no native code and arent restricted to the

    least common denominator.

    The Swing API is flexible, powerful and immense. It is available in two forms:

    1. As a core part of the Java2 platform

    2. JFC1.1

    Dept of CSE, SJCIT 6 2007-2008

  • 7/29/2019 IEEE Chapter

    3/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    In our project we are making use of the JFCs.

    For implementing this project we have mainly used Swing that is nothing but a set

    of class that provides more powerful and flexible components. The classes of the Swing

    which we have used for this project are described below. The classes of the Swing which we

    have used for this project are described below.

    JButton:

    JButton is a push button used to fire action events when they activated. When we

    enter the required parameters into the text field of login window and click on login button an

    event is generated, the actionlistener listens to the event generated and performs the action of

    logging into the system.

    JPanel:

    JPanel class is used for creating the panel to login window.

    JTextField:

    JTextField class is used for entering the input into the username, number of nodes in

    the network etc., into the textfield.

    JPasswordField:

    JPasswordField is used for entering the password into the edit field in the login

    window.

    JTextArea:

    JTextArea class displays multiple lines of text in a single font and style. In this project

    this class is used to create the status window which shows the status of the operation being

    performed in this project.

    JLable:

    JLable class is used for naming the windows and textboxes that we created in our

    project.

    Dept of CSE, SJCIT 7 2007-2008

  • 7/29/2019 IEEE Chapter

    4/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    JScrollPane:

    Here we are using the JScrollPane class to view contents of the tables if it exceeds the

    default size, the scrollbar shows up so that we can view the contents of the table by scrolling

    upwards or downwards.

    JTabbedPane:

    We have used JTabbedPane class for switching from one text field to another or from

    one button to another very quickly.

    JOptionPane:

    In this application if the username and password are not entered properly, it is wrong

    and if the information about the nodes are incorrect then this class creates popup windows as

    Invalid name and password .This class is mainly used for creating various window.

    JScrollPane:

    In this application if we want to calculate the ranks for 12 or more than 12 nodes in

    the network then this class will create an automatic vertical scrollbar in the nodes parameter

    table for viewing parameters of the nodes together.

    JInternalFrame:

    In this application this class is used to add the columns named IP

    Address,Portnumber,Distance,Energy and Link Quality in the parameter entry

    table. It also adds the END and Send To all button to the table also. This class is also

    used to create the icons also in the application. It also resize the tables depending upon the

    nodes entered by the user.

    JTable:

    In this application this class is mainly used to create the tables of this application.

    Dept of CSE, SJCIT 8 2007-2008

  • 7/29/2019 IEEE Chapter

    5/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    2.2 Need of Our Project:-

    The Scalable Wireless Ad-hoc Network Simulation project is mainly intended to

    demonstrate the advantages that are obtained by using the XTC Algorithm over the other

    multicasting algorithms such as expanded ring search algorithm, Core resolution algorithms

    etc.... So the need of this project arises to make adhoc network more scalable, more

    convenient to use and for smooth data transfer by reducing the network congestion.

    Other prominent feature that this project demonstrates are listed below:-

    No existing infrastructure is required

    Mobile users can easily communicate

    High Bandwidth, quality, reliability and variance

    Energy conservation very less

    Wonderful Scalability

    Quality of Service

    Simplicity and ease of implementation

    Efficient computing

    QoS support

    OBJECT ORIENTED PROGRAMMING:

    Object-oriented programming is an approach that provides a way of

    modularizing programs by creating partitioned memory area for both data and functions

    that can be used as templates for creating copies of such modules on demand.

    Object-oriented programming is at the core of Java. In fact, all Java

    programs are object-oriented-this isnt an option the way that is in C++. The major

    objective of object-oriented approach is to eliminate some of the flaws encountered in

    the procedural approach. OOP treats data as a critical element in the program

    development and does not allow it to flow freely around the system. It ties data more

    closely to the functions that operate on it and protects it from unintentional modification

    Dept of CSE, SJCIT 9 2007-2008

  • 7/29/2019 IEEE Chapter

    6/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    by other functions. OOP allows us to compose a problem into a number of entities called

    Objects and then build data and functions around these entities. The combination of data

    and methods make up an object.

    According to Grady Booch, a leading exponent of the object-oriented

    approach, an object has the following characteristics.

    It has state.

    It may display a behavior.

    It has a unique identity.

    THREE OOP PRINCIPLES:

    Encapsulation

    Inheritance

    Polymorphism

    Encapsulation:

    The Wrapping up of data and methods into a single unit (called Class) is

    known as encapsulation.

    Inheritance:

    Inheritance is the process by which objects of one class acquire the

    properties of objects of another class.

    Polymorphism:

    Polymorphism means the ability to take more than one form. For Example,

    an operation may exhibit different behavior in different instances.

    ADVANTAGES OF OBJECT- ORIENTATION:

    Dept of CSE, SJCIT 10 2007-2008

  • 7/29/2019 IEEE Chapter

    7/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Realistic Modeling.

    Reusability.

    Resilience to change.

    Realistic Modeling:

    Since we live in a world of objects, it logically follows that the object-

    oriented approach models the real world more accurately than the conventional,

    procedural approach.

    Reusability:

    In the object-oriented approach, you build classes, which can then be used

    by several applications. The benefit of reusability translates to a saving in time and effort,

    which in turn results in cost benefits.

    Resilience to change:

    Through the object-oriented approach, system can be allowed to evolve.

    When a change is suggested, the old system need not be completely abandoned and

    rebuilt from scratch.

    Resilience to change, results in ease of maintenance. For the same reason,

    even during construction, paths of the system under development can be refined without

    any major change to other parts.

    JAVA HISTORY:

    James Gosling, Patrick Naughton, Chris Warth, Ed Franck, and Mike

    Sheridan conceived JAVA, at Sun Micro Systems, Inc. in 1991. This language was

    initially called OAK but was renamed JAVA in 1995. Bill Joy, Arthur Van Hoff,

    Jonathan Payne, Franck Yellin, and Tim Lindholm were key contributors to the maturing

    of the original prototype.

    Dept of CSE, SJCIT 11 2007-2008

  • 7/29/2019 IEEE Chapter

    8/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    The original impetus for Java was not the Internet! Instead, the primary

    motivation was the need for a platform-independent language that could be used to create

    software to be embedded in various consumer electronic devices, such as microwave

    ovens and remote controls. As you can probably guess, many different types of CPUs are

    used as controllers. The trouble with C and C++ is that they are designed to compile for a

    specific target. Although it is possible to compile a c++ program for just about any type

    of CPU, to do so requires a full c++ compiler targeted for that CPU. The problem is that

    compilers are expensive and time consuming to create. An Easier and more cost-

    efficient solution were needed. In an attempt to find such a solution, Gosling and others

    began work on a portable, platform-independent language that could be used to produce

    code that would run on a variety of CPUs under different environments. This effort

    ultimately led to the creation of JAVA.

    JAVA FEATURES:

    Sun micro systems officially describes Java with the following attributes:

    Compiled and interpreted. Platform - independent and portable.

    Object-oriented.

    Robust and secure.

    Distributed.

    Familiar, simple and small.

    Multithreaded and Interactive.

    High performance.

    Dynamic and extensible.

    Compiled and Interpreted:

    Java combines both this approaches thus making Java a two-stage system.

    First, Java compiler translates source code into what is known as byte code Instructions.

    Dept of CSE, SJCIT 12 2007-2008

  • 7/29/2019 IEEE Chapter

    9/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    In the second stage, Java interpreter generates machine code that can be directly executed

    by the machine that is running the Java program.

    Platform-Independent and Portable:

    The most significant contribution of Java over other languages is its

    portability. Changes and upgrades in operating systems, processors and system resources

    will not force any changes in Java programs.

    Java ensures portability in two ways. First, a Java compiler generates byte

    code instructions that can be implemented on any machine. Secondly, the sizes of the

    primitive data types are machine-independent.

    Object-oriented:

    Java is a true object-oriented language. Almost everything in Java is an

    object. All program code data reside within object and classes. Java comes with an

    extensive set of classes, arranged in packages, that we can use in our programs by

    inheritance. The object model in Java is simple and easy to extend.

    Robust and Secure:

    Java is a robust language. It provides many safeguards to ensure reliable

    code. It has strict compile time and runtime checking for data types. It is designed as a

    garbage-collected language relieving the programmers virtually all memory management

    problems. Java also incorporates the concept of exception handling, which captures series

    errors and eliminates any risk of crashing the system.

    Security becomes an important issue for a language that is used for

    programming on Internet. Threat of viruses and abuse of resources is everywhere. Java

    systems not only verify all memory access but also ensure that no viruses are

    communicated with an applet. The absence of pointers in Java ensures that programs

    cannot gain access to memory locations without proper authorization.

    Distributed:

    Dept of CSE, SJCIT 13 2007-2008

  • 7/29/2019 IEEE Chapter

    10/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Java is designed as a distributed language for creating applications on

    networks. It has the ability to share both data and programs. Java applications can open

    and access remote objects on Internet as easily as they can do in a local system. This

    enables multiple programmers at multiple remote locations to collaborate and work

    together on a single project.

    Simple, small and familiar:

    Java is a small and simple language. Many features of C and C++ that are

    either redundant or sources of unreliable code are not part of Java. For example, Java

    does not use pointers, preprocessor header files, go to statement and many others. It

    also eliminates operator overloading and multiple inheritance.

    Familiarity is another striking feature of Java. To make the language look

    familiar to the existing programmers, it was modeled on C and C++ languages. Java uses

    many constructs of C and C++ and therefore, Java code looks like a C++ code. In fact,

    Java is simplified version of C++.

    Multithreaded and interactive:Multithreaded means handling multiple tasks simultaneously. Java supports

    multithreaded programs. This means that we need not wait for the application to finish

    one task before beginning another. This feature greatly improves the interactive

    performance of graphical applications. The Java runtime comes with tools that support

    multiprocessors synchronization and constructs smoothly running interactive systems.

    High performance:

    Java performance is impressive for an interpreted language, mainly due to

    the use of intermediate byte code. According to sun, Java speed is comparable to the

    native C/C++. Java architecture is also designed to reduce overheads during runtime.

    Further, the incorporation of multithreaded enhances the overall execution speed of Java

    programs.

    Dynamic and extensible:

    Dept of CSE, SJCIT 14 2007-2008

  • 7/29/2019 IEEE Chapter

    11/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Java is a dynamic language. Java is capable of dynamically linking in new

    class libraries, methods and objects. Java can also determine the type of class through a

    query, making it possible to either dynamically link or abort the program, depending on

    the response.

    Java programs support functions written in other languages such as C and

    C++. These functions are known as native methods. This facility enables the

    programmers to use the efficient functions available in these languages. Native methods

    are linked dynamically at runtime.

    JAVA AND INTERNET

    Internet helped catapult Java to the forefront of programming, and Java, in

    turn has had a profound effect on the Internet. The reason for this is quite simple: Java

    expands the universe of objects that can move about freely in cyberspace. In a network

    too very broad categories of objects are transmitted between the server and your personal

    computer: passive information and dynamic, active programs.

    As desirable as dynamic, networked programs are, they also present serious

    problems in the area of security and portability. Prior to Java, cyberspace was effectivelyclosed to half the entities that now live there. As you will see, Java address those concerns

    and, by doing so, has opened the door to an exciting new form of program: the applet.

    JAVAS MAGIC: THE BYTECODE:

    The key that allows Java to solve both the security and the portability

    problems just described is that the output of a Java compiler is not executable code.

    Rather, it is Byte code. Byte code isa highly optimized set of instruction designed to

    be executed by the Java runtime system, which is called the Java Virtual Machine

    (JVM). That is, in its standard form, the JVM is an interpreter byte code. In fact, most

    modern languages are designed to compiled, not interpreted mostly because of

    performance concerns. The fact that a Java program is executed by the JVM helps

    solve the major problems associated with downloading programs over the Internet.

    Dept of CSE, SJCIT 15 2007-2008

  • 7/29/2019 IEEE Chapter

    12/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Translating a Java program into Byte code makes it much easier to run a

    program in a wide variety of environments. The reason is straightforward: only the

    JVM need to be implemented for each platform. Once the runtime package exists for a

    given system, any Java program can run on it. Remember, although the details of the

    Java program were compiled to native code, then different versions of the same

    program would have to exist for each type of CPU connected to the Internet. This is,

    of course, not a feasible solution. Thus the interpretation of byte code is the easiest

    way to create truly portable programs.

    The fact that a Java programs is interpreted also helps to make it secure.

    Because the execution of every Java program is under the control of the JVM, the

    JVM can contain the program and prevent it from generating side effects outside of

    the system. As you will see, safety is also enhanced by certain functions that exist in

    the Java language.

    When a program is interpreted, it generally runs substantially slower

    than it would run if compiled to executable code. However, with Java, the differential

    between the two is not great. The use of byte code enables the Java, runtime system toexecute programs much faster.

    Java was designed for interpretation; there is technically nothing about

    Java that prevents on-the-fly compilation of byte code into native code. Along these

    lines, Sun supplies its Just in Time (JIT) compiler for byte code, which is included in

    the Java 2 release. When the JIT compiler is part of the JVM, it compiles byte code

    into executable code in real time, on a piece-by-piece, demand basis. It is important to

    understand that it is not possible to compile an entire Java program into executable

    code all at once, because Java performs various runtime checks that can be done only

    at runtime. Instead, the JIT compiles code, as it is needed, during execution. However,

    the Just-In-Time approach still yields a significant performance boost. Even when

    dynamic compilation is applied to byte code, the probability and safety features still

    apply, because the runtime system still is in charge of the environment. Whether your

    java program is actually interpreted in the traditional way or compiled On-The-Fly, its

    functionality is the same.

    Dept of CSE, SJCIT 16 2007-2008

  • 7/29/2019 IEEE Chapter

    13/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    HOT JAVA:

    Hot java is the web browser from Sun Microsystems that enables the

    display of interactive content on the Web, using the java language. Its biggest draw is

    that it was the first Web browser to provide support for the Java language, thus

    making the web more dynamic and interactive.

    HARDWARE AND SOFTWARE REQUIREMENTS:

    Java is currently supported on Windows 95, Windows NT, Sun Solaris,

    Macintosh, and UNIX machines. Though, the programs and examples in this book

    were tested under Windows 95, the most popular operating system today, they can

    implemented on any of the above systems.

    The minimum hardware and software requirements for Windows 2000

    version of Java are follows:

    IBM - compatible 486 system.

    Minimum of 8 MB memory Windows 2000 software

    A Windows-compatible and sound card, if necessary.

    A Hard drive.

    A CD-ROM drive.

    A Microsoft-compatible mouse.

    JAVA ENVIRONMENT:

    Java environment includes a large number of development tools and

    hundreds of classes and methods. The development tools are part of the system known

    as Java Development Kit (JDK) and the classes and methods are part of the Java

    Standard Library (JSL), also known as the Application Programming Interface (API).

    JAVA DEVELOPMENT KIT:

    Dept of CSE, SJCIT 17 2007-2008

  • 7/29/2019 IEEE Chapter

    14/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    The Java Development Kit comes with a collection of tools that are used

    for developing and running Java programs. They include:

    Applet viewer (for viewing Java applets)

    Javac (Java compiler)

    Java (java interpreter)

    Javap (java disassembler)

    Javah (for C header files)

    Javadoc (for creating HTML documents)

    Jdb (Java debugger)

    JAVA DEVELOPMENT TOOLS

    Tools Description

    Applet viewer Enables us to run Java applets (without actually

    using a Java-compatible browser).

    Java Java interpreter, which runs applets and application by

    reading and interpreting byte code files.

    Dept of CSE, SJCIT 18 2007-2008

  • 7/29/2019 IEEE Chapter

    15/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Javac The Java compiler, which translates Java source code to

    byte code files that the interpreter can understand.

    Javadoc Creates HTMLformat documentation from Java source

    code files.

    Javah Produces header files for use with native methods.

    Javap Java disassembler, which enables us to convert byte code

    files into a program description.

    Jdb Java debugger, which helps us to find errors in our

    programs.

    The way these tools are applied to build and run application program is

    illustrated in the following figure.

    Dept of CSE, SJCIT 19 2007-2008

    Text Editor

    Java

    Source

    JavadocHTML

    Header

    Files

    Javac

    Java

    ClassJavah

    Java Jdb

  • 7/29/2019 IEEE Chapter

    16/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Figure: Process of building and running Java application programs

    To create a Java program, we need to create a sourcecode file using a text editor. The source code is then compiled usingthe Java compiler javac and executed using the Java interpreter

    java. The java debugger jdb is used to find errors, if any, in thesource code.

    APPLICATION PROGRAMMING INTERFACE:

    The java standard library (or API) includes hundreds of classes and methods

    grouped into several functional packages. Most commonly used packages are:

    Language Support Package :

    A collection of classes and methods required for implementing basic features of

    Java.

    Utilities Packages :

    A collection of classes to provide utility functions such as

    date and time functions.Input/Output Packages:

    A collection of classes required for input/output manipulation.

    Networking Packages:

    A collection of classes for communicating with other computers via internet.

    AWT Package:

    The Abstract Window Tool package contains classes that implements platform-

    independent graphical user interface.

    Applet Package:

    This includes a set of classes that allows us to create Java applets. The use of these

    library classes will become evident when start developing java programs.

    Dept of CSE, SJCIT 20 2007-2008

    Java

    Program

    Output

  • 7/29/2019 IEEE Chapter

    17/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    JAVA PROGRAMS:

    A few type of java applications are listed below:

    Applications that do not use Graphical User Interface (GUI):

    They are similar to traditional programs written in C and C++.Applications using GUI

    These are similar to the applications described above, but they have graphical

    user interfaces. These applications are used in the Windows environment.

    Applets

    These programs run on a web page and require a java-enabled browser like

    Internet explorer or Netscape navigator. Applets are the programs that you running

    on web page.

    ServletsServlets do not have graphical user interfaces. They are widely used to extend

    the functionality of web servers.

    Packages

    Packages are collections of classes that can be shared by applications and applets.

    Dept of CSE, SJCIT 21 2007-2008

  • 7/29/2019 IEEE Chapter

    18/18

    Scalable Wireless Ad-hoc Network Simulation Literature Survey

    Dept of CSE, SJCIT 22 2007-2008