complete project on cloud computing
TRANSCRIPT
-
7/28/2019 complete project on cloud computing
1/86
1.1 INTRODUCTION
The two main issues that we address in context of such response policies are that of
policy matching, and policy administration. For the policy matching problem, we propose two
algorithms that efficiently search the policy database for policies that match an anomalous
request. We also extend the Postgre SQL DBMS with our policy matching mechanism, and
report experimental results. The experimental evaluation shows that our techniques are very
efficient. The other issue that we address is that of administration of response policies to prevent
malicious modifications to policy objects from legitimate users. We propose a novel Joint
Threshold Administration Model (JTAM) that is based on the principle of separation of duty.
The key idea in JTAM is that a policy object is jointly administered by at least k database
administrator (DBAs), that is, any modification made to a policy object will be invalid unless it
has been authorized by at least k DBAs. We present design details of JTAM which is based on a
cryptographic threshold signature scheme, and show how JTAM prevents malicious
modifications to policy objects from authorized users.
-
7/28/2019 complete project on cloud computing
2/86
1.2 ABOUT THE PROJECT
PROJECT PURPOSE
With greater data integration, aggregation and disclosure, preventing data theft, from both
inside and outside organizations, has become a major challenge.StandardDatabase security
mechanisms, such as access control, authentication, and encryption, are not of much help when it
comes to preventing data theft from insiders [5]. Such threats have thus forced organizations to
reevaluate securitystrategies for their internal databases [4]. Database to detect potential
intrusions, intrusion detection (ID), is a crucial technique that has to be part of any
comprehensive security solution for high-assurance database security.
PROJECT SCOPE
A response policy is required by the database security administrator to specify
appropriate response actions for different circumstances. In this paper, we proposea high-level
language for the specification of such policies which makes it very easy to specify and modify
them. The two main issues that we address in the context of such response policies are that of
policy matching and policy administration. Policy matching is the problem of searching for
policies applicable to an anomalous request.
PRODUCT FEATURE
We present a framework for specifying intrusion response policies in the context of a
DBMS. We present a novel administration model called JTAM for administration of response
policies. implement JTAM in the PostgreSQL DBMS, and report experimental results on the
efficiency of our techniques. When an anomaly is detected, the response system must search
through the policy database and find policies that match theanomaly.
1.3 EXISTING SYSTEM
Standard database security mechanisms, such as access control, authentication, andencryption, are not of much help when it comes to preventing data theft from insiders.
The Intrusion Detection systems that are developed are not customized for a DatabaseManagement System (DBMS).
-
7/28/2019 complete project on cloud computing
3/86
1.4 DRAWBACKS OF THE EXISTING SYSTEM
There are three main types of response actions that we refer to, respectively, asconservative actions, fine-grained actions, and aggressive actions, the key issue to
address is which response measure to take under a given situation.
-
7/28/2019 complete project on cloud computing
4/86
2.1 PROBLEM DEFINITION
The fundamental problem in such administration model is that of conflict-of-interest. The
main issue is essentially that of insider threats, that is, how to protect a response policy object
from malicious modifications made by a database user that has legitimate access rights to the
policy object.
2.2 PROPOSED SYSTEM
Two main elements which is specifically customized to a DBMS is used: an anomalydetection (AD) system and an anomaly response system.
The first element is based on the construction of database access profiles of roles andusers, and on the use of such profiles for the AD task.
The second element takes some actions once an anomaly is detected.
Advantages:
Interactive response policy language is used which makes it very easy for the databaseadministrators to specify appropriate response actions for different circumstances
depending upon the nature of the anomalous request.
Two main issues are addressed: policy matching, and policy administration
2.3 SOFTWARE REQUIREMENTS
Front End : Java
Operating System : Windows
2.4 HARDWARE REQUIREMENTS
Process :PENTIUM 2.6 GHz
RAM :256Mb and aboveHard Disk :10GB
Monitor :VGA and High Resolution Monitor
-
7/28/2019 complete project on cloud computing
5/86
2.5 FUNCTIONAL REQUIREMENTS
INTRODUCTION
Provide an overview of the system and some additional information to place the system
in context. A software requirements specification (SRS) is a comprehensive description of the
intended purpose and environment for software under development. The SRS fully describes
what the software will do and how it will be expected to perform.
An SRS minimizes the time and effort required by developers to achieve desired goals
and also minimizes the development cost. A good SRS defines how an application will interact
with system hardware, other programs and human users in a wide variety of real-world
situations. Parameters such as operating speed, response time, availability, portability,
maintainability, footprint, security and speed of recovery from adverse events are evaluated.
PURPOSE
Provide an overall description of the FRD, its purpose. Reference the system name and
identifying information about the system to be implemented.
SCOPE
Discuss the scope of the document and how it accomplishes its purpose of the project.
BACKGROUND
Describe the organization and its overall responsibilities. Describe who is producing the
document and why.
REFERENCES
List references and controlling documents, including: meeting summaries, white papers,
other deliverables, etc.
-
7/28/2019 complete project on cloud computing
6/86
ASSUMPTIONS AND CONSTRAINTS
Provide a list of contractual or task level assumptions and/or constraints that are
preconditions to preparation of the FRD. Assumptions are future situations beyond the control
of the project, whose outcomes influence the success of a project.
ASSUMPTIONS
Examples of assumptions include: availability of a technical platform, legal changes and
policy decisions.
CONSTRAINTS
Constraints are boundary conditions on how the system must be designed and
constructed. Examples include: legal requirements, technical standards, strategic decisions.
Constraints exist because of real business conditions. For example, a delivery date is a constraint
only if there are real business consequences that will happen as a result of not meeting the date.
If failing to have the subject application operational by the specified date places the organization
in legal default, the date is a constraint. Preferences are arbitrary. For example, a date chosen
arbitrarily is a preference. Preferences, if included in the FRD, should be noted as such.
DOCUMENT OVERVIEW
Provide a description of the document organization.
USER REQUIREMENTS
Provide requirements of the system, user or business, taking into account all major
classes/categories of users. Provide the type of security or other distinguishing characteristics of
each set of users. List the functional requirements that compose each user requirement. As the
functional requirements are decomposed, the highest level functional requirements are traced to
the user requirements. Inclusion of lower level functional requirements is not mandatory in the
traceability to user requirements if the parent requirements are already traced to them.
User requirement information can be in text or process flow format for each major user
class that shows what inputs will initiate the system functions, system interactions, and what
-
7/28/2019 complete project on cloud computing
7/86
outputs are expected to be generated by the system. The scenarios should be comprehensive, to
the extent that all user types and all major functions are covered. Give each user requirement a
unique number. Typically, user requirements have a numbering system that is separate from the
functional requirements. Requirements may be labeled with a leading U or other label
indicating user requirements.
DATA FLOW DIAGRAMS
Decompose the context level diagrams to determine the functional requirements. Data
flow diagrams should be decomposed down to the functional primitive level. These diagrams
are further decomposed during design.
LOGICAL DATA MODEL/DATA DICTIONARY
Create the initial Logical Data Model. Describe data requirements by providing data
entities, decomposition, and definitions in a data dictionary. The data requirements describe the
business data needed by the application system. Data requirements do not describe the physical
database and are not at the level of identifying field names.
NON FUNCTIONAL REQUIREMENTS
Non-Functional Requirements are not really requirements at all. Rather, they are
constraints on implementing the functional requirements as defined in the use case documents
and other documents or models. However, for the purposes of requirements management they
are considered to be requirements and, as such, need to be tested. The first rule of defining non-
functional requirements, therefore, is to ensure that they are testable. A requirement that cannot
be tested may as well not be included as a requirement. The best way to ensure that non-
functional requirements can be tested is to think about how they might be tested when they are
written. If it is not obvious then ask a test developer how they would test it.Other guidelinesshould include whether they are written in a way that is unambiguous and easy to understand.
Some of the requirements may be very technical in nature so not all can be expected to be
understood by non-technical people. However, those who will have to implement them and those
who will have to test them should be able to understand them easily and completely.Non-
functional requirements may be present in other documents and models where they have been
-
7/28/2019 complete project on cloud computing
8/86
added as notes or as high-level requirements. These include the stakeholder needs list, the project
overview, the business process model, and the use case documents
PROJECT OVERVIEW
The chapter 1 one contain the Project Overview summary of known major technical
constraints. Add these to the non-functional requirements document and update the project
overview with references to them.
STAKEHOLDER NEEDS LIST
These are single line statements of needs gather early in the project from all stakeholders.
Scan through the list and look for those needs that would not have been included in the use case
documents. Add them to the appropriate section of the non-functional requirements documents
as single sentence statements. Update the stakeholder needs list with the reference to the
requirement in the non-functional requirements document.
BUSINESS PROCESS MODEL
When the business process model is created notes may have been added to the processes
as attachment to activities on activity diagrams regarding stakeholder requirements as they have
been mentioned by the stakeholder representative or process owner. Search all relevant activities
for notes relating to non-functional requirements and add them to the non-functional
requirements document. Update the activity notes with the reference to the requirement in the
non-functional requirements document.
USE CASE DOCUMENTS
Use Case Documents have a specific section for non-functional requirements. These
should normally apply specifically to the use case in question. It may be, however, that
requirements that apply across more than one use case have been included. If so, add the
requirements to the non-functional requirements document and reference them in the use case
document.
-
7/28/2019 complete project on cloud computing
9/86
USABILITY
Resist making statements such as The system shall be user friendly. It is entirely
insufficient. The non-functional requirements document template breaks the section down into
seven subsections and prompts for completion of each section. Be specific about the mechanism
by which each aspect will be met. For example, in the section Learnability say whether the user
is expected to learn how to use the system by looking up the help or using a tutorial or whether
the system can be put into a learner mode whereby it guides a learner user through a use case
by offering detailed prompts at every step. If there is to be no documentation at all and the
system is to be learnt from the developers demonstrating it to the users, then say so.
RELIABILITY
Reliability is notoriously difficult to test before the system goes live as it relies on
continuous use and metrics. Some guidance here on what is realistic to expect should be sought
in consultation with stakeholders. Figures should be defined on the basis of the metrics available
for existing systems and the expectations for improvement or relaxation of these values. It will
only be known if the system meets these requirements if proper metrics and requirements
gathering are put in place. Notes to this effect should be included. If no serious attempt is to be
made to do this, then write None in each section.
PERFORMANCE
Performance can and should be tested early on the development as part of the
architectural development phase. Care needs to be taken to specify throughput and response
times in terms of the creation and processing of major data entities with reference to specific use
cases in the use case model. Ensure that the requirements are written in such a way that the
testing of them will be straightforward. If the system is to share infrastructure resources with
other systems specify what proportion of those resources must be available if the response timesare to be met. Also include any dependencies on outside systems and specify how these are
expected to respond if resource and throughput targets are to be met.
-
7/28/2019 complete project on cloud computing
10/86
SECURITY
Security includes all steps that are to be taken to secure the system against both voluntary
and involuntary corruption. This includes management of usernames and passwords; encryption
of data transfers both internally and across external systems such as the internet; firewalls and
protection against viruses, Trojans, worms and all kinds of malicious code attacks including
denial of service. It may be useful to refer to the standards specified in section 8.3 under
implementation constraints.
SUPPORTABILITY
Specify ease of installation, configuration and testing in terms both of the time to achieve
the goal and specific means for achieving it. Consider, for example, installation software and
scripts, use cases for configuration and automatic self-testing. Think carefully about how each of
these requirements will actually be tested.
INFRASTRUCTURE REQUIREMENTS
These should include description of existing or new hardware, software and networks on
which the system is expected to run. Create a deployment diagram, or equivalent which shows
all processing nodes, peripherals and communication links. Specify the required capacity for
each of these, or, where the system runs on existing infrastructure, the amount of capacity that
needs to be available for the system to meet its performance requirements. Also specify any
external systems of services upon which this system will depend in terms of the performance that
is required of these systems if this system is to meet its performance targets.
IMPLEMENTATION CONSTRAINTS
A constraint is a requirement which leaves no design option. Implementation constraints,
rather than describing what the system will do, describe constraints on the design by which what
it is to do will be achieved. If there is no constraint in a section, e.g. the developers could use any
language they like then say so. Otherwise describe just the constraint.
When referring to system interfaces, legacy systems and databases refer to the design
documentation for these. Add important diagrams to Appendix A and refer to them in the text. If
-
7/28/2019 complete project on cloud computing
11/86
there is insufficient information about these external systems then mention that this information
will need to be completed for the purposes of the development of this system.
2.6 ANALYSIS
MODULE SPECIFICATION
Anomalous Request Intrusion Detection.
Policy Matching. Policy Administration.
Protection Data Transmission. Intrusion Response.
MODULE DESCRIPTIONS:
Anomalous Request :
Interactive response policy language makes it very easy for the database administrators to
specify appropriate response actions for different circumstances depending upon the nature of the
anomalous request. The conservative actions, such as sending an alert, allow the anomalous
request to go through, whereas the
aggressive actions can effectively block the anomalous request. Recall that a response policy is
created to select a response action to be executed in the event of an anomalous request.
Intrusion Detection :
Monitoring a database to detect potential intrusions, intrusion detection (ID), is a crucial
technique that has to be part of any comprehensive security solution for high-assurance database
security. We present a framework for specifying intrusion
response policies in the context of a DBMS.
The two main issues that we address in context of such response policies are that of policy
matching, and policy administration.
-
7/28/2019 complete project on cloud computing
12/86
Policy Matching:
Policy matching is the problem of searching for policies applicable to an anomalous
request. When an anomaly is detected, the response system must search through the policy
database and find policies that match the anomaly. Our ID mechanism is a real-time intrusion
detection and response system; thus efficiency of the policy search procedure is crucial.
Policy Administration :
The main issue in the administration of response policies is how to protect a policy from
malicious modifications made by a DBA that has legitimate access rights to the policy object.
.Propose an administration model referred to as the JTAM. The threat scenario that we assume is
that a DBA has all the privileges in the DBMS, and thus it is able to execute arbitrary SQL
insert, update, and delete commands tomake malicious modifications to the policies.
Protection Data Transmission :
Data protection must deal with two general problems. First, data must be protected from
unauthorized access and tampering. This is the problem of data security. Second, data must be
protected from errors by authorized system users. Concern for data security will take different
forms in different system applications. Individual users may be concerned with personal privacy,
and wish to limit access to private data files. Corporate organizations may seek to protect data
related to proprietary interests.
Intrusion Response:
A condition is specified on the attributes of the detected anomaly. An action is the
response action executed by the engine Our implementation of the response system can be
configured to include/exclude other user-defined anomaly attributes. we address is that of
administration of response policies to prevent malicious modifications to policy objects from
legitimate users.
-
7/28/2019 complete project on cloud computing
13/86
FEASIBILITY STUDY
Objectives:
In project development and feasibility studies stage of the SDLC, software engineers and
developers should be able to:
Identify the Business Value
Developing a software is not just creating a good software and presenting them to the
market with hopes that someone will actually use or buy it. Before the software is even created,
the idea will be evaluated again and again. This objective has to be fulfilled by the companys
researchers. They will be presenting the current market situation, current users need or World
Wide Web that software engineers can fill.
Estimate Investment and Reward on the Project
In project planning, the investment on a certain project has to be revealed. This will be the
backbone of every project. For one, investment will dictate how much the company will spend to
create certain software. This is even truer for companies that usually hire project based
developers. Investment will dictate how many people will be working for the project. Aside from
investment, project planning and feasibility studies should show how much the company will
earn once the project is created. If its just a tool for businesses, it should show how it can
increase the productivity of the employees and its actual impact in financial sense.Analyze Feasibility
Researchers or proponents of the software will actually show why the software is needed
in the actual business sense. Statistical data will always play a crucial role in proving why the
particular software is good for public use. Most of the time, researchers will be interviewing
individuals in order to get their opinion if they will use if that software is available in the market.
It will also take a look at the possible competition and how will the software be different
compared to other companies.
-
7/28/2019 complete project on cloud computing
14/86
3.1DESIGN METHDOLOGIES
This document play a vital role in the development of life cycle (SDLC) as it describes
the complete requirement of the system. It means for use by developers and will be the basic
during testing phase. Any changes made to the requirements in the future will have to go
through formal change approval process.
SPIRAL MODEL was defined by Barry Boehm in his 1988 article, A spiral Model of
Software Development and Enhancement. This model was not the first model to discuss
iterative development, but it was the first model to explain why the iteration models.
As originally envisioned, the iterations were typically 6 months to 2 years long. Each
phase starts with a design goal and ends with a client reviewing the progress thus far.
Analysis and engineering efforts are applied at each phase of the project, with an eye toward
the end goal of the project.
The steps for Spiral Model can be generalized as follows:
The new system requirements are defined in as much details as possible. This usuallyinvolves interviewing a number of users representing all the external or internal users
and other aspects of the existing system.
A preliminary design is created for the new system. A first prototype of the new system is constructed from the preliminary design. This
is usually a scaled-down system, and represents an approximation of the
characteristics of the final product.
A second prototype is evolved by a fourfold procedure:1. Evaluating the first prototype in terms of its strengths, weakness, and risks.2. Defining the requirements of the second prototype.3. Planning an designing the second prototype.4. Constructing and testing the second prototype.
-
7/28/2019 complete project on cloud computing
15/86
At the customer option, the entire project can be aborted if the risk is deemed toogreat. Risk factors might involved development cost overruns, operating-cost
miscalculation, or any other factor that could, in the customers judgment, result in a
less-than-satisfactory final product.
The existing prototype is evaluated in the same manner as was the previous prototype,and if necessary, another prototype is developed from it according to the fourfold
procedure outlined above.
The preceding steps are iterated until the customer is satisfied that the refinedprototype represents the final product desired.
The final system is constructed, based on the refined prototype. The final system is thoroughly evaluated and tested. Routine maintenance is carried
on a continuing basis to prevent large scale failures and to minimize down time.
The following diagram shows how a spiral model acts like:
Fig -Spiral Model
-
7/28/2019 complete project on cloud computing
16/86
ADVANTAGES
Estimates(i.e. budget, schedule etc .) become more relistic as work progresses,because important issues discoved earlier.
It is more able to cope with the changes that are software development generallyentails.
Software engineers can get their hands in and start woring on the core of a projectearlier.
APPLICATION DEVELOPMENT
N-TIER APPLICATIONS
N-Tier Applications can easily implement the concepts of Distributed Application Design
and Architecture. The N-Tier Applications provide strategic benefits to Enterprise Solutions.
While 2-tier, client-server can help us create quick and easy solutions and may be used for Rapid
Prototyping, they can easily become a maintenance and security night mare
The N-tier Applications provide specific advantages that are vital to the business continuity of
the enterprise. Typical features of a real life n-tier may include the following:
Security Availability and Scalability Manageability Easy Maintenance Data Abstraction
The above mentioned points are some of the key design goals of a successful n-tier application
that intends to provide a good Business Solution.
-
7/28/2019 complete project on cloud computing
17/86
DEFINITION
Simply stated, an n-tier application helps us distribute the overall functionality into
various tiers or layers:
Presentation Layer Business Rules Layer Data Access Layer Database/Data Store
Each layer can be developed independently of the other provided that it adheres to the standards
and communicates with the other layers as per the specifications.
This is the one of the biggest advantages of the n-tier application. Each layer can potentially
treat the other layer as a Block-Box.
In other words, each layer does not care how other layer processes the data as long as it sends the
right data in a correct format.
Fig -N-Tier Architecture
-
7/28/2019 complete project on cloud computing
18/86
THE PRESENTATION LAYER
Also called as the client layer comprises of components that are dedicated to
presenting the data to the user. For example: Windows/Web Forms and buttons, edit
boxes, Text boxes, labels, grids, etc.
1. THE BUSINESS RULES LAYERThis layer encapsulates the Business rules or the business logic of the
encapsulations. To have a separate layer for business logic is of a great advantage. This is
because any changes in Business Rules can be easily handled in this layer. As long as the
interface between the layers remains the same, any changes to the processing logic in this
layer can be made without impacting the others. A lot of client-server apps failed to
implement successfully as changing the business logic was a painful process.
2. THE DATA ACCESS LAYERThis layer comprises of components that help in accessing the Database. If used in
the right way, this layer provides a level of abstraction for the database structures. Simply
put changes made to the database, tables, etc do not affect the rest of the application
because of the Data Access layer. The different application layers send the data requests
to this layer and receive the response from this layer.
3. THE DATABASE LAYERThis layer comprises of the Database Components such as DB Files, Tables,
Views, etc. The Actual database could be created using SQL Server, Oracle, Flat files,
etc. In an n-tier application, the entire application can be implemented in such a way that
it is independent of the actual Database. For instance, you could change the Database
Location with minimal changes to Data Access Layer. The rest of the Application should
remain unaffected.
-
7/28/2019 complete project on cloud computing
19/86
3.2 UML DIAGRAMS
UsecaseDiagram
INTRUDER DETECTED
BROWSE FILE
SEND FILE
INSERT RECORD
VIEW
SENDERSYSTEM
DETECTION DETAILS
-
7/28/2019 complete project on cloud computing
20/86
Sequence Diagram
: SENDER : SYSTEM
BROWSE
BROWSING
FILE DISPLAYED
SEND FILE
SENDING
INTRUDER DETECTED
INSERT FILE
INSERTING
VIEW
DISPLAYS CONTENT OF THE FILE
DETECTION DETAILS
ANALYZING
PROCESSING
DISPLAYS ATTACKS AT EACH LAYER
-
7/28/2019 complete project on cloud computing
21/86
Activity Diagram
Start
BROWSE AFILE
SEND A FILE
INTRUSION RESPONSE
SYSTEM
SINK
End
YES
NO
-
7/28/2019 complete project on cloud computing
22/86
Class diagram Technology Description
class Class Model
JFrame
Detector1
~ clien t_1: Socket
~ clien t_2: Socket
~ temp: long
+ Detector1()
+ Detector2()
+ Detector3()
- initial izeComponent() : void
+ mai n(String[]) : void
+ server() : void
JFrame
Detector2
~ clien t_1: Socket
~ clien t_2: Socket
- contentPane: JPanel
~ dis: DataInputStream
~ temp: long
- addComponent(Container, Component, int, int, int, int) : void
+ Detector2()
- initial izeComponent() : void
- jButton1_actionPerformed(ActionEvent) : void
- jT abbedPane1_stateChanged(ChangeEven t) : void
+ mai n(String[]) : void
+ server() : void
+ Sink2()
JFrame
Detector3
~ clien t_1: Socket
~ clien t_2: Socket
- jT extArea1: JTextArea
~ length: int
~ length1: int
~ sen: String = ""
~ server_1 : ServerSocket
~ socket_1: Socket
~ temp: long
- addComponent(Container, Component, int, int, int, int) : void+ Detector3()
- initial izeComponent() : void
- jButton1_actionPerformed(ActionEvent) : void
- jT abbedPane1_stateChanged(ChangeEvent) : void
+ mai n(String[]) : void
+ server() : void
JFrame
Sink1
- contentPane: JPanel
~ destination : String
~ i: int = 1
~ Recieved1: String
~ rr: String = ""
~ server_1: ServerSocket
~ socket_1 : Socket
- transferTim e: JLabel
- addComponent(Container, Component, int, int, int, int) : void
- initial izeComponent() : void
- jButton 1_actionPerformed(ActionE vent) : void
- jTabbe dPane1_stateChanged(ChangeEvent) : void
+ mai n(String[]) : void
+ server() : void
+ Sink1()
JFrame
Sink2
- contentPane: JPanel
~ destination : String
~ i: in t = 1
- jButton1: JButton
- jLabel1: JLabel
- jPanel1: JPanel
- jPanel2: JPanel
- jScrollPane1: JScrollPane
- jScrollPane2: JScrollPane
- jTabbed Pane1: JTabbedPane
- jT extArea1: JTextArea
- jT extArea2: JTextArea
~ Recieved1: String
~ rr: String = ""
~ server_1: ServerSocket
~ socket_1 : Socket
- addComponent(Container, Component, int, int, int, int) : void
- initial izeComponent() : void
- jButton1_actio nPerformed(ActionEven t) : void
- jT abbed Pane1_ stateChanged(ChangeEvent) : void
+ mai n(String[]) : void+ server() : void
+ Sink2()
+ Sink3()JFrame
Sink3
- contentPane: JPanel
~ destination : String
~ i: int = 1
- jButton1: JButton
- jLabel1: JLabel
- jPanel1: JPanel
~ socket_1: Socket
- addComponent(Container, Component, int, int, int, int) : void
- initial izeComponent() : void
- jButton1_actionPerformed(ActionEvent) : void
- jT abbedPane1_stateChanged(ChangeEven t) : void
+ mai n(String[]) : void
+ server() : void
+ Sink3()
JFrame
Source1
~ a: String ([]) = {"Select","Prob...
~ b: String ([]) = {"Graph","probe ...
- contentPane: JPanel
~ d: double
~ dest1: String
~ destination : String
- Detect: JButton
- filepath: JLabel
- jButton 2_actionPerformed(ActionE vent) : void
- jButton 3_actionPerformed(ActionE vent) : void
- jCombo Box1_actionPerformed(ActionE vent) : void
- jTextField1_actionPerformed(ActionEvent) : void
+ mai n(String[]) : void
+ pai nt(Graphics) : void
+ sendData(String, int, String) : void
+ setDest(String) : String
+ Source1()
+ view_actionperformed(ActionEvent) : void
-
7/28/2019 complete project on cloud computing
23/86
JAVA
Java was designed to meet all the real world requirements with its key features, which are
explained in the following paragraph.
SIMPLE AND POWERFUL
Java was designed to be easy for the professional programmer to learn and use
efficiently. Java makes itself simple by not having surprising features. Since it exposes the inner
working of a machine, the programmer can perform his desired actions without fear. Unlike
other programming systems that provide dozens of complicated ways to perform a simple task,
Java provides a small number of clear ways to achieve a given task.
SECURE
Today everyone is worried about safety and security. People feel that conducting
commerce over the Internet is a safe as printing the credit card number on the first page of a
Newspaper. Threatening of viruses and system hackers also exists. To overcome all these fears
java has safety and security as its key design principle.
Using Java Compatible Browser, anyone can safely download java applets without the
fear of viral infection or malicious intent. Java achieves this protection by confining a java
program to the java execution environment and by making it inaccessible to other parts of the
computer. We can download applets with confidence that no harm will be done and no security
will be breached.
PORTABLE
In java, the same mechanism that gives security also helps in portability. Many types of
computers and operating systems are in use throughout the world and are connected to the
internet. For downloading programs through different platforms connected to the internet, some
portable, executable code is needed. Javas answer to these problems is its well designed
architecture.
-
7/28/2019 complete project on cloud computing
24/86
OBJECT-ORIENTED
Java was designed to be source-code compatible with any other language. Java team
gave a clean, usable, realistic approach to objects. The object model in java is simple and easy to
extend, while simple types, such as integers, are kept as high-performance non -objects.
DYNAMIC
Java programs carry with them extensive amounts of run-time information that is used to
verify and resolve accesses to objects at run-time. Using this concept it is possible to
dynamically link code. Dynamic property of java adds strength to the applet environment, in
which small fragments of byte code may be dynamically updated on a running system.
NEWLY ADDDED FEATURES IN JAVA 2
SWING is a set of user interface components that is entirely implemented in java the usercan use a look and feel that is either specific to a particular operating system or uniform
across operating systems.
Collections are a group of objects. Java provides several types of collection, such aslinked lists, dynamic arrays, and hash tables, for our use. Collections offer a new way to
solve several common programming problems.
Various tools such as javac, java and javadoc have been enhanced. Debugger and profilerinterfaces for the JVM are available.
Performance improvements have been made in several areas. A JUST-IN-TIME (JIT)compiler is included in the JDK.
Digital certificates provide a mechanism to establish the identity of a user, which can bereferred as electronic passports.
Various security tools are available that enable the user to create the user to create andstore cryptographic keys ad digital certificates, sign Java Archive(JAR) files, and check
the signature of a JAR file.
-
7/28/2019 complete project on cloud computing
25/86
SWINGS
Swing components facilitate efficient graphical user interface (GUI) development. These
components are a collection of lightweight visual components. Swing components contain a
replacement for the heavyweight AWT components as well as complex user interface
components such as Trees and Tables.
Swing components contain a pluggable look and feel (PL & F). This allows all
applications to run with the native look and feel on different platforms. PL & F allows
applications to have the same behaviour on various platforms. JFC contains operating system
neutral look and feel. Swing components do not contain peers. Swing components allow
mixing AWT heavyweight and Swing lightweight components in an application.
The major difference between lightweight and heavyweight components is that
lightweight components can have transparent pixels while heavyweight components are
always opaque. Lightweight components can be non-rectangular while heavyweight
components are always rectangular.
Swing components are JavaBean compliant. This allows components to be used
easily in a Bean aware application building program. The root of the majority of the Swing
hierarchy is the JComponent class. This class is an extension of the AWT Container class.
Swing offers a number of advantages, which include
Wide variety of Components Pluggable Look and Feel MVC Architecture Keystroke Handling Action Objects Nested Containers Virtual Desktops Compound Borders Customized Dialogues Standard Dialog Classes
-
7/28/2019 complete project on cloud computing
26/86
Structured Table and Tree Components Powerful Text Manipulation Generic Undo Capabilities Accessibility Support
JAVA DATABASE CONNECTIVITY (JDBC)
JDBC AND ODBC IN JAVA:
Most popular and widely accepted database connectivity called Open Database Connectivity
(ODBC) is used to access the relational databases. It offers the ability to connect to almost all the
databases on almost all platforms. Java applications can also use this ODBC to communicate
with a database. Then we need JDBC why? There are several reasons:
1. ODBC API was completely written in C language and it makes anextensive use of pointers. Calls from Java to native C code have a
number of drawbacks in the security, implementation, robustness and
automatic portability of applications.
2. ODBC is hard to learn. It mixes simple and advanced features together,and it has complex options even for simple queries.
Structured Query Language (SQL):
SQL (Pronounced Sequel) is the programming language that defines and
manipulates the database. SQL databases are relational databases; this means simply the data
is store in a set of simple relations. A database can have one or more table. You can define
and manipulate data in a table with SQL commands. You use the data definition language
(DDL) commands to creating and altering databases and tables.
You can update, delete or retrieve data in a table with data manipulation
commands (DML). DML commands include commands to alter and fetch data.
The most common SQL commands include commands is the SELECT command,which allows you to retrieve data from the database.
In addition to SQL commands, the oracle server has a procedural language called
PL/SQL. PL/SQL enables the programmer to program SQL statement. It allows you to
control the flow of a SQL program, to use variables, and to write error-handling procedures.
-
7/28/2019 complete project on cloud computing
27/86
3.3 CODE DESIGN
Class1:
/****************************************************************/
/* Source1 *//* */
/****************************************************************/import java.awt.*;
import java.awt.event.*;
import javax.swing.*;import java.io.*;
import java.net.*;
import java.sql.*;
/**
* Summary description for Source1**/
public class Source1 extends JFrame
{
// Variables declaration
String fp;
Double fs;Double tt;
Double rt;
Long ls;
JTextArea jtr;private JLabel jLabel1;
private JLabel jLabel2;
private JLabel jLabel3;private JLabel filesize;
private JLabel jfileSize;
private JLabel transferTime;private JLabel jtransferTime;
private JLabel filepath;
private JLabel Jfilepath;
private JLabel readTime;private JLabel JreadTime;
private JTextArea show;
private Long los;private JComboBox graph;//private JLabel
private JButton view,insert;
long loss;
-
7/28/2019 complete project on cloud computing
28/86
String str;
//private JTextField JfileSize;private JTextField jTextField1;
private JComboBox jComboBox1;
private JTextArea jTextArea1;private JScrollPane jScrollPane1,jsp,jsp1,jsp2,jsp3;private JButton jButton1;
private JButton jButton2;
private JButton jButton3;private JPanel contentPane;
private JButton Detect;
private int lossspace;
JScrollPane js;Object o;
//private JComboBox graph;//private JButton Detect;
String dest1;
int len;
double d;double time;
long read;
double rd;private String r="";
String msg="";
int flag=1;
int flag1=1;Socket n1_client;
String destination;
int limit;String a[]={"Select","Probe","Dos","R2L","U2R","Normal"};
//int len;
int packets;int rem;
String b[]={"Graph","probe","DOS","R2L","U2R"};
//int d;
FileInputStream fis=null;Image im;
// End of variables declaration
public Source1()
{
super();
-
7/28/2019 complete project on cloud computing
29/86
initializeComponent();
//
// TODO: Add any constructor code after initializeComponent call//
this.setVisible(true);try{FileInputStream f=new FileInputStream(".//Detector.txt");
while((d=f.read())!=-1)
{r+=(char)d;
}
}catch(Exception ex){ex.printStackTrace();}
}
/**
* This method is called from within the constructor to initialize the form.* WARNING: Do NOT modify this code. The content of this method is always
regenerated
* by the Windows Form Designer. Otherwise, retrieving design might not work properly.
* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent(){
jLabel1 = new JLabel();
jLabel2 = new JLabel();
jLabel3 = new JLabel();jTextField1 = new JTextField();
filesize=new JLabel();
jfileSize=new JLabel();transferTime=new JLabel();
jtransferTime=new JLabel();
filepath=new JLabel();Jfilepath=new JLabel();
readTime=new JLabel();
JreadTime=new JLabel();
jLabel1.setFont(new Font("Arial",Font.BOLD,15));show=new JTextArea(70,80);
jComboBox1 = new JComboBox(a);
jTextArea1 = new JTextArea();
jScrollPane1 = new JScrollPane();jButton1 = new JButton();
jButton2 = new JButton();
jButton3 = new JButton();view=new JButton("View");
-
7/28/2019 complete project on cloud computing
30/86
graph=new JComboBox(b);
insert=new JButton("Insert");
Detect=new JButton("Detection");jtr=new JTextArea();
js=new JScrollPane();
// im=Toolkit.getDefaultToolkit().createImage("d:/sin.png");contentPane = (JPanel)this.getContentPane();
//// jLabel1
//
jLabel1.setText("SOURCE1");filepath.setText("lossSpace:");
//jLabel1.setForeground(new Color(0, 0, 102));
// jLabel2
//
jLabel2.setText("LayersNo");
//
readTime.setText("ReadTime:");
// jLabel3
//jLabel3.setText("Status
Information");
filesize.setBackground(new Color(255, 255, 255));
filesize.setText("FileSize:");transferTime.setBackground(new Color(255,255,255));
transferTime.setText("TransferTime:");
//
// jTextField1
//jTextField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{jTextField1_actionPerformed(e);
-
7/28/2019 complete project on cloud computing
31/86
}
});//
// jComboBox1
//jComboBox1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e)
{
jComboBox1_actionPerformed(e);}
});
Detect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
Detect_actionperformed(e);
}
});//
// jTextArea1
////
// jScrollPane1
//
jScrollPane1.setViewportView(jTextArea1);js.setViewportView(jtr);
//
// jButton1//
jButton1.setBackground(new Color(255, 255, 255));
jButton1.setText("Browse");jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);}
});
//// jButton2
//
jButton2.setBackground(new Color(255, 255, 255));jButton2.setText("Send");
-
7/28/2019 complete project on cloud computing
32/86
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{jButton2_actionPerformed(e);
}
});insert.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{insert_actionperformed(e);
}
});
view.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
view_actionperformed(e);
}
});//
// jButton3
//// Color colr = new Color(0, 0, 255);
//jButton3.setBackground(new Color(92,172,238));
jButton3.setText("Exit");
jButton3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e)
{
jButton3_actionPerformed(e);}
});graph.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{graph_actionPerformed(ae);
}
});
//// contentPane
//
contentPane.setLayout(null);Color colr = new Color(210,105,30);
-
7/28/2019 complete project on cloud computing
33/86
//contentPane.setBackground(new Color(0, 0, 255));
contentPane.setBackground(colr);
// jLabel1.setBackground(Color.red);jLabel1.setForeground(colr);
addComponent(contentPane, jLabel1, 158,14,136,28);
addComponent(contentPane, jLabel2, 100,149,60,18);addComponent(contentPane, jLabel3, 165,180,118,23);addComponent(contentPane, jTextField1, 41,80,252,20);
addComponent(contentPane, jComboBox1, 180,147,100,22);
addComponent(contentPane, jScrollPane1, 60,200,295,246);addComponent(contentPane, jButton1, 317,78,83,28);
addComponent(contentPane, jButton2, 317,147,83,28);
addComponent(contentPane, jButton3, 317,450,83,28);
addComponent(contentPane,filepath,60,500,136,28);addComponent(contentPane,Jfilepath,150,500,280,28);
addComponent(contentPane,filesize,310,500,140,28);
addComponent(contentPane,jfileSize,390,500,136,28);addComponent(contentPane,transferTime,60,550,136,28);
addComponent(contentPane,jtransferTime,180,550,136,28);
addComponent(contentPane,readTime,310,550,136,28);
addComponent(contentPane,JreadTime,390,550,136,28);addComponent(contentPane,insert,30,600,136,28);
addComponent(contentPane,view,80,600,136,28);
addComponent(contentPane,graph,250,600,100,28);addComponent(contentPane,Detect,350,600,103,28);
addComponent(contentPane,jtr,350,300,400,200);
jtr.setVisible(false);
//// Source1
//
this.setTitle("Source1 - extends JFrame");this.setLocation(new Point(66, 48));
this.setSize(new Dimension(783, 635));
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,intheight)
{
c.setBounds(x,y,width,height);
container.add(c);}
//// TODO: Add any appropriate code in the following Event Handling Methods
-
7/28/2019 complete project on cloud computing
34/86
//
private void jTextField1_actionPerformed(ActionEvent e)
{System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jComboBox1_actionPerformed(ActionEvent e)
{
System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");o = jComboBox1.getSelectedItem();
destination=""+o;
flag=0;
}
private void jButton1_actionPerformed(ActionEvent e)
{ System.out.println("\njButton1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
try
{int b;
Long l=0L;
msg="";FileDialog fd=new FileDialog(this,"Open",FileDialog.LOAD);
JFileChooser jf=new JFileChooser();
int s=jf.showOpenDialog(null);
File f1=jf.getSelectedFile();str=f1.getPath();
File f=new File(str);
long size1=f1.getTotalSpace();long freespace=f1.getFreeSpace();
loss=size1-freespace;
FileInputStream fos=new FileInputStream(str);// File le=new File(fos);
long length=f.length();
// lossspace=(int)freespace;
int sizedata=fos.available();int n=sizedata/4;
// jTextArea1.append("Reading First::"+n+"\n\n");
//fd.show();
// File f=new File(fd);
//FileInputStream fos=newFileInputStream(fd.getDirectory()+fd.getFile());
-
7/28/2019 complete project on cloud computing
35/86
//String str=fd.getDirectory();
//FileInputStream fos=new FileInputStream(str);
//jTextField1.setText(fd.getDirectory()+fd.getFile());// jTextField1.setText(""+fd.getSize());
jTextField1.setText(str);
while((b=fos.read())!=-1){msg+=(char)b;
l+=b;
}byte by[]=new byte[fos.available()];
String sbyte=new String(by);
jTextArea1.setText("Size");
fos.read(by);
fos.close();
flag1=0;len=msg.length();
d=len/1024;
time=d/60;
read=l/1024;rd=read/60;
// los=Long.toString(loss);
// n=fos.available()/2;String source=jTextField1.getText();
System.out.println(""+System.currentTimeMillis());
// jTextArea1.append();
// jTextArea1.setText("");
jTextArea1.append("\n\nSource1 Address::"+source+"\n\n");
jTextArea1.append("Selected File Path"+""+fd.getDirectory()+fd.getFile()+""+"\n\n");
jTextArea1.append("Total Size::"+len+"bytes"+"\n\n");
jTextArea1.append("Total space::"+size1+"bytes"+"\n\n");jTextArea1.append("Total Freespace::"+freespace+"bytes"+"\n\n");
jTextArea1.append("Reading Files:"+l+"bytes"+"\n\n");
//jTextArea1.append("Currnt Time"+time);
//jTextArea1.append("Byte to kb"+d+"Kbytes");// jtransferTime.setText(""+time+"sec");
jfileSize.setText(""+d+"Kb");
Jfilepath.setText(""+loss);
JreadTime.setText(""+rd+"Sec");
-
7/28/2019 complete project on cloud computing
36/86
}
//jTextArea1.append("Size";
catch (Exception ex)
{
ex.printStackTrace();} }public void insert_actionperformed(ActionEvent e)
{
// if(e.getSource()=="view")// {
// chart c=new chart(rd,time);
try
{Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion");
Statement stm=con.createStatement();
String ss="insert into
sour1(layerports,filePath,fileSize,transferTime,readTime,lossSpace)values('"+jComboBox1.getSelectedItem()+"','"+str+"',"+d+","+time+","+rd+","+loss+")";
// String ss="insert into
sour2(filePath,fileSize,transferTime,readTime)values('"+str+"',"+d+","+time+","+rd+")";
stm.executeUpdate(ss);
JOptionPane.showMessageDialog(null,"Record Inserted");
//System.out.println(str+d+time+rd+loss);System.out.println("record inserted");
}
catch(Exception ex)
{
ex.printStackTrace();}}
public void view_actionperformed(ActionEvent e)
{
addComponent(contentPane,show,280,600,236,58);
// if(e.getSource()=="view")
// {
// chart c=new chart(rd,time);try
{
System.out.println("retrieved************");Class.forName("oracle.jdbc.driver.OracleDriver");
-
7/28/2019 complete project on cloud computing
37/86
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion
");Statement stm=con.createStatement();
ResultSet rs=stm.executeQuery("select * from sour1");
String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"};String stab[][]=new String[50][50];// int i=0;
for(int i=0;rs.next();i++)
{
stab[i][0]=rs.getString(1);
stab[i][1]=rs.getString(2);stab[i][2]=Double.toString(rs.getDouble(3));
stab[i][3]=Double.toString(rs.getDouble(4));
stab[i][4]=Double.toString(rs.getDouble(5));stab[i][5]=Double.toString(rs.getDouble(6));
// stab[i][6]=rs.getString(6);
//String ss=Double.toString(rs.getDouble(4));
//ps.executeUpdate();// JOptionPane.showMessageDialog(null,"Record Inserted");
//System.out.println(str+d+time+rd+loss);
System.out.println("record inserted");}
JTable jt=new JTable(stab,tb);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;JScrollPane jsp=new JScrollPane(jt,v,h);
addComponent(contentPane,jsp,500,450,436,158);
//
show.append("FilePath"+"\t"+"FileSize"+"\t"+"TransferTime"+"\t"+"ReadTime"+"\t"+"LossSpa
ce"+"\n");//
show.append("==========================================================
======================="+"\n");
// show.append(fp+"\t\t"+fs+"\t\t"+tt+"\t\t"+rt+"\t\t"+ls+"\t\t");
}
catch(Exception ex){
}
}
-
7/28/2019 complete project on cloud computing
38/86
public void graph_actionPerformed(ActionEvent ae)
{
//if(a[1].)Object o1=graph.getSelectedItem();
dest1=""+o1;
System.out.println("a[3]="+a[3]+"a[4]="+a[4]);if(dest1.equalsIgnoreCase(a[1])){
final probe1chart demo = new probe1chart("Probe1 Layer");
demo.pack();demo.setLocation(200,200);
// RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connectioncon=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion
");
Statement stm=con.createStatement();
String str="select* from sour1 where layerports='"+a[1]+"'";ResultSet rs=stm.executeQuery(str);
String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"};
String stab[][]=new String[50][50];
for(int i=0;rs.next();i++)
{
stab[i][0]=rs.getString(1);
stab[i][1]=rs.getString(2);stab[i][2]=Double.toString(rs.getDouble(3));
stab[i][3]=Double.toString(rs.getDouble(4));
stab[i][4]=Double.toString(rs.getDouble(5));stab[i][5]=Double.toString(rs.getDouble(6));
}
JTable p=new JTable(stab,tb);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp=new JScrollPane(p,v,h);
addComponent(contentPane,jsp,500,250,436,158);
jsp1.setVisible(false);jsp2.setVisible(false);
jsp3.setVisible(false);
// for(int i=0;rs.next();i++)
-
7/28/2019 complete project on cloud computing
39/86
// {probe1","DOS","R2L","U2R"
// final probechart demo = new probechart("probe1");
//demo.pack();//demo.setLocation(200,200);
// RefineryUtilities.centerFrameOnScreen(demo);
//demo.setVisible(true);
// } }
catch(Exception ex){
}
else if(dest1.equalsIgnoreCase(a[2]))
{final Doschart1 demo = new Doschart1("Dos1 Layer");
demo.pack();
demo.setLocation(200,200);// RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
try
{Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion");
Statement stm=con.createStatement();
String str="select* from sour1 where layerports='"+a[2]+"'";
ResultSet rs=stm.executeQuery(str);String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"};
String stab[][]=new String[50][50];
for(int i=0;rs.next();i++)
{
stab[i][0]=rs.getString(1);
stab[i][1]=rs.getString(2);
stab[i][2]=Double.toString(rs.getDouble(3));stab[i][3]=Double.toString(rs.getDouble(4));
stab[i][4]=Double.toString(rs.getDouble(5));
stab[i][5]=Double.toString(rs.getDouble(6));
}
JTable p=new JTable(stab,tb);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-
7/28/2019 complete project on cloud computing
40/86
jsp1=new JScrollPane(p,v,h);
addComponent(contentPane,jsp1,500,250,436,158);
jsp.setVisible(false);jsp2.setVisible(false);
jsp3.setVisible(false);
// for(int i=0;rs.next();i++)// {probe1","DOS","R2L","U2R"// final probechart demo = new probechart("probe1");
//demo.pack();
//demo.setLocation(200,200);// RefineryUtilities.centerFrameOnScreen(demo);
//demo.setVisible(true);
// }}
catch(Exception ex)
{
}}
else if(dest1.equalsIgnoreCase(a[3])){
final R2Lchart1 demo = new R2Lchart1("R2L Layer");
demo.pack();demo.setLocation(200,200);
// RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connectioncon=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion
");
Statement stm=con.createStatement();String str="select* from sour1 where layerports='"+a[3]+"'";
ResultSet rs=stm.executeQuery(str);
String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"};
String stab[][]=new String[50][50];
for(int i=0;rs.next();i++)
{
stab[i][0]=rs.getString(1);
stab[i][1]=rs.getString(2);stab[i][2]=Double.toString(rs.getDouble(3));
-
7/28/2019 complete project on cloud computing
41/86
stab[i][3]=Double.toString(rs.getDouble(4));
stab[i][4]=Double.toString(rs.getDouble(5));
stab[i][5]=Double.toString(rs.getDouble(6));
}
JTable p=new JTable(stab,tb);int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp2=new JScrollPane(p,v,h);addComponent(contentPane,jsp2,500,250,436,158);
jsp1.setVisible(false);
jsp.setVisible(false);
jsp3.setVisible(false);// for(int i=0;rs.next();i++)
// {probe1","DOS","R2L","U2R"
// final probechart demo = new probechart("probe1");//demo.pack();
//demo.setLocation(200,200);
// RefineryUtilities.centerFrameOnScreen(demo);
//demo.setVisible(true);
// } }
catch(Exception ex)
{
}}
else if(dest1.equalsIgnoreCase(a[4]))
{System.out.println("U2RChart**************");
final U2Rchart1 demo = new U2Rchart1("U2R Layer");
demo.pack();demo.setLocation(200,200);
// RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion");
Statement stm=con.createStatement();
String str="select* from sour1 where layerports='"+a[4]+"'";ResultSet rs=stm.executeQuery(str);
-
7/28/2019 complete project on cloud computing
42/86
String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"};
String stab[][]=new String[50][50];
for(int i=0;rs.next();i++)
{
stab[i][0]=rs.getString(1);
stab[i][1]=rs.getString(2);
stab[i][2]=Double.toString(rs.getDouble(3));stab[i][3]=Double.toString(rs.getDouble(4));
stab[i][4]=Double.toString(rs.getDouble(5));
stab[i][5]=Double.toString(rs.getDouble(6));
}
JTable p=new JTable(stab,tb);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp3=new JScrollPane(p,v,h);
addComponent(contentPane,jsp3,500,250,436,158);
jsp1.setVisible(false);jsp2.setVisible(false);
jsp.setVisible(false);
}
catch(Exception ex)
{}
}
}public void paint(Graphics g)
{
// Draw the previously loaded image to Component.g.drawImage(im, 0, 0, null);
// Draw sprites, and other things.
// ....}
private void Detect_actionperformed(ActionEvent ae)
{try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
-
7/28/2019 complete project on cloud computing
43/86
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion
");Statement stm=con.createStatement();
String sa1="select * from sour1 where layerports='"+a[1]+"'";
String sa2="select * from sour1 where layerports='"+a[2]+"'";String sa3="select * from sour1 where layerports='"+a[3]+"'";String sa4="select * from sour1 where layerports='"+a[4]+"'";
//Probe
ResultSet rs=stm.executeQuery(sa1);
double s6=0,s8=0,s9=0;
int i=1;while(rs.next())
{
String s1=rs.getString(1);String s2=rs.getString(2);
double s3=rs.getDouble(3);
s6=rs.getDouble(4)+s6;
s8=rs.getDouble(5)+s8;double s4=rs.getDouble(6);
i++;
// double r=rs.getDouble(4);
System.out.println("TransferTime"+r);
}
double s7=s6/i;s9=s8/i;
System.out.println("pobe transferTime="+s7+"\t"+"ReadTime"+s9);
//rs.close();//Dos
rs=stm.executeQuery(sa2);
double st=0,sr=0,at,ar;int j=1;
while(rs.next())
{
String s1=rs.getString(1);String s2=rs.getString(2);
double s3=rs.getDouble(3);
st=rs.getDouble(4)+st;
sr=rs.getDouble(5)+sr;double s4=rs.getDouble(6);
j++;
// double r=rs.getDouble(4);
-
7/28/2019 complete project on cloud computing
44/86
// System.out.println("TransferTime"+r);
}
at=st/j;ar=sr/j;
System.out.println("Dos transferTime="+at+"\t"+"ReadTime"+ar);
rs.close();//System.out.println("s6"+s6+"ddddd"+s7);
//R2L
rs=stm.executeQuery(sa3);double st1=0,sr1=0,at1,ar1;
int k=1;
while(rs.next())
{String s1=rs.getString(1);
String s2=rs.getString(2);
double s3=rs.getDouble(3);st1=rs.getDouble(4)+st1;
sr1=rs.getDouble(5)+sr1;
double s4=rs.getDouble(6);
k++;
// double r=rs.getDouble(4);
// System.out.println("TransferTime"+r);}
at1=st1/k;
ar1=sr1/k;
System.out.println("R2L transferTime="+at1+"\t"+"ReadTime"+ar1);//rs2.close();
//U2R
rs=stm.executeQuery(sa4);
double st2=0,sr2=0,at2,ar2;int l=1;
while(rs.next())
{
String s1=rs.getString(1);String s2=rs.getString(2);
double s3=rs.getDouble(3);
st2=rs.getDouble(4)+st2;
sr2=rs.getDouble(5)+sr2;double s4=rs.getDouble(6);
l++;
// double r=rs.getDouble(4);
-
7/28/2019 complete project on cloud computing
45/86
// System.out.println("TransferTime"+r);
}
at2=st2/l;ar2=sr2/l;
System.out.println("U2R transferTime="+at2+"\t"+"ReadTime"+ar2);
//rs3.close();
jtr.append("Name"+"\tAvgTransferTime"+"\t"+"AvgReadTime"+"\n");
jtr.append("===================================================================================\n");
jtr.append("Probe"+"\t"+(Math.abs(s7))+"\t"+""+Math.abs(s9)+"\n");
jtr.append("Dos"+"\t"+Math.abs(at)+"\t"+""+Math.abs(ar)+"\n");
jtr.append("R2L"+"\t"+Math.abs(at1)+"\t"+""+Math.abs(ar1)+"\n");jtr.append("U2R"+"\t"+Math.abs(at2)+"\t"+""+Math.abs(ar2)+"\n");
jtr.setVisible(true);
//int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;// int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
// JScrollPane jsp1=new JScrollPane(jtr,v,h);
LineChartDemo6 ld=new LineChartDemo6("Detection",s7,s9,at,ar,at1,ar1,at2,ar2);ld.setSize(300,300);
ld.setVisible(true);
}catch(Exception ex)
{
ex.printStackTrace();
}
}
private void jButton2_actionPerformed(ActionEvent e){
System.out.println("\njButton2_actionPerformed(ActionEvent e) called.");
jtransferTime.setText(""+time);// TODO: Add any handling code here
String dest;
if(flag==0)
{if(destination.equalsIgnoreCase(a[0]))
{
JOptionPane.showMessageDialog(null,"Select the Destination!..");
}else if(destination.equalsIgnoreCase(a[1]))
{
//dba1 code
-
7/28/2019 complete project on cloud computing
46/86
JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction
need authentication from 4 DBAs");
String dba1sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature ofDBA 1 ");
System.out.println("dba1sign : "+dba1sign);
if(dba1sign!=null&&!dba1sign.equals("")){int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is it Conformed?");System.out.println("dba1conform : "+dba1conform);
if(dba1conform!=0){
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not conformed signaturethis transaction is failed. Response Action : ShutDown");
System.exit(0);
}
}else{JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted / not
entered signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}
//dba2code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : Thistransaction need authentication from 4 DBAs");
String dba2sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of
DBA 2 ");System.out.println("dba2sign : "+dba2sign);
if(dba2sign!=null&&!dba2sign.equals("")){
int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is it Conformed?");
System.out.println("dba2conform : "+dba2conform);if(dba2conform!=0){
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not conformed
signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
}else{JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted / not entered
signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}//dba2code
//dba3code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need
authentication from 4 DBAs");String dba3sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of
DBA 3 ");
System.out.println("dba3sign : "+dba3sign);if(dba3sign!=null&&!dba3sign.equals("")){
-
7/28/2019 complete project on cloud computing
47/86
int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is it Conformed?");
System.out.println("dba3conform : "+dba3conform);
if(dba3conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not conformed
signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted / not
entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
//dba4code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");
String dba4sign=JOptionPane.showInputDialog("JTAM : Enter q Threshold Signatureof DBA 4 ");
System.out.println("dba4sign : "+dba4sign);
if(dba4sign!=null&&!dba4sign.equals("")){
int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Isit Conformed?");
System.out.println("dba4conform : "+dba4conform);
if(dba4conformJOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not conformed signature this t
ransaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted / not entered
signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
JOptionPane.showMessageDialog(null,"Now you can insert details of a fileinto Database ");
dest=setDest(a[1]);
sendData(r,111,dest);
}
else if(destination.equalsIgnoreCase(a[2]))
{JOptionPane.showMessageDialog(null,"This Is From Dos Layer");
dest=setDest(a[2]);
int a;sendData(r,111,dest);
-
7/28/2019 complete project on cloud computing
48/86
}
else if(destination.equalsIgnoreCase(a[3])){
JOptionPane.showMessageDialog(null,"This Is From R2L layer");
//dba1 codeJOptionPane.showMessageDialog(null,"This Is From PROBE
Layer : This transaction need authentication from 4 DBAs");
String dba1sign=JOptionPane.showInputDialog("JTAM : EnterThreshold Signature of DBA 1 ");
System.out.println("dba1sign : "+dba1sign);
if(dba1sign!=null&&!dba1sign.equals("")){
int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is itConformed?");
System.out.println("dba1conform : "+dba1conform);
if(dba1conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
//dba2code// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");
String dba2sign=JOptionPane.showInputDialog("JTAM : EnterThreshold Signature of DBA 2 ");
System.out.println("dba2sign : "+dba2sign);
if(dba2sign!=null&&!dba2sign.equals("")){int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is it
Conformed?");
System.out.println("dba2conform : "+dba2conform);
if(dba2conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
-
7/28/2019 complete project on cloud computing
49/86
}
//dba2code //dba3code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : Thistransaction need authentication from 4 DBAs");
String dba3sign=JOptionPane.showInputDialog("JTAM : Enter
Threshold Signature of DBA 3 ");System.out.println("dba3sign : "+dba3sign);if(dba3sign!=null&&!dba3sign.equals("")){
int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is it
Conformed?");System.out.println("dba3conform : "+dba3conform);
if(dba3conform!=0){
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not
conformed signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
}else{JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}//dba4code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");
String dba4sign=JOptionPane.showInputDialog("JTAM : Enter
Threshold Signature of DBA 4 ");System.out.println("dba4sign : "+dba4sign);
if(dba4sign!=null&&!dba4sign.equals("")){
int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Is itConformed?");
System.out.println("dba4conform : "+dba4conform);
if(dba4conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}
-
7/28/2019 complete project on cloud computing
50/86
JOptionPane.showMessageDialog(null,"Now you can insert details of a file into Database
");
dest=setDest(a[3]);
sendData(r,222,dest);
}else if(destination.equalsIgnoreCase(a[4]))
{
JOptionPane.showMessageDialog(null,"This Is From U2RLayer");
//dba1 codeJOptionPane.showMessageDialog(null,"This Is From PROBE
Layer : This transaction need authentication from 4 DBAs");
String dba1sign=JOptionPane.showInputDialog("JTAM : EnterThreshold Signature of DBA 1 ");
System.out.println("dba1sign : "+dba1sign);
if(dba1sign!=null&&!dba1sign.equals("")){
int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is itConformed?");
System.out.println("dba1conform : "+dba1conform);
if(dba1conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
//dba2code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");
String dba2sign=JOptionPane.showInputDialog("JTAM : EnterThreshold Signature of DBA 2 ");
System.out.println("dba2sign : "+dba2sign);
if(dba2sign!=null&&!dba2sign.equals("")){
int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is itConformed?");
System.out.println("dba2conform : "+dba2conform);
if(dba2conform!=0){
-
7/28/2019 complete project on cloud computing
51/86
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}
}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted /not entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
//dba2code //dba3code// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");
String dba3sign=JOptionPane.showInputDialog("JTAM : Enter
Threshold Signature of DBA 3 ");System.out.println("dba3sign : "+dba3sign);
if(dba3sign!=null&&!dba3sign.equals("")){
int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is itConformed?");
System.out.println("dba3conform : "+dba3conform);
if(dba3conform!=0){
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 notconformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);
}}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}
//dba4code
// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This
transaction need authentication from 4 DBAs");String dba4sign=JOptionPane.showInputDialog("JTAM : Enter
Threshold Signature of DBA 4 ");
System.out.println("dba4sign : "+dba4sign);
if(dba4sign!=null&&!dba4sign.equals("")){int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Is it
Conformed?");
System.out.println("dba4conform : "+dba4conform);
if(dba4conform!=0){JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not
conformed signature this transaction is failed. Response Action : ShutDown");
System.exit(0);}
-
7/28/2019 complete project on cloud computing
52/86
}else{
JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted /
not entered signature this transaction is failed. Response Action : ShutDown");System.exit(0);
}
JOptionPane.showMessageDialog(null,"Now you can insert details of a file into Database");
dest=setDest(a[4]);
sendData(r,222,dest);}
else if(destination.equalsIgnoreCase(a[5]))
{
JOptionPane.showMessageDialog(null,"This Is From Normal");dest=setDest(a[5]);
sendData(r,222,dest);
}}
else
JOptionPane.showMessageDialog(null,"Load the File OR Select the
Destination!..");}
private void jButton3_actionPerformed(ActionEvent e){
System.out.println("\njButton3_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
//
// TODO: Add any method code to meet your needs in the following area//
public void sendData(String name,int port,String dest){
try
{
n1_client=new Socket(name,port);
DataOutputStream out=new
DataOutputStream(n1_client.getOutputStream());
if(out!=null)
{
out.flush();}
-
7/28/2019 complete project on cloud computing
53/86
int outgoing=0;
byte buffer[]=msg.getBytes();
int len=buffer.length;int tlength=buffer.length/48;
int length11=buffer.length%48;
int len1=len;if(length11!=0){
tlength++;
}out.writeInt(tlength);
out.writeUTF(destination);
int st=0;
int end=48;jTextArea1.append("Packet Length:"+len+"\n");
String prefinal="";
String finalst="";if(len48){
len1-=48;
if(len1
-
7/28/2019 complete project on cloud computing
54/86
}else
{
System.out.println("else than 48");
int sp=end+48;
jTextArea1.append("Packet:
"+"\t"+(++outgoing)+"\t"+msg.substring(end,sp)+"\n");out.writeUTF(dest+msg.substring(end,sp));
end=sp;
}}
}
}catch (Exception exp)
{
exp.printStackTrace();
}}
public String setDest(String Destname)
{String Destinationname="";
if(Destname.equalsIgnoreCase(a[1]))
{
Destinationname="Source1-->D1";}
else if(Destname.equalsIgnoreCase(a[2]))
{Destinationname="Source1-->D2";
}else if(Destname.equalsIgnoreCase(a[3]))
{
Destinationname="Source1-->D3";
}else if (Destname.equalsIgnoreCase(a[4]))
{
Destinationname="Source1-->D4";
}else if (Destname.equalsIgnoreCase(a[5]))
{
Destinationname="Source1-->D5";}
-
7/28/2019 complete project on cloud computing
55/86
return Destinationname;
}
//============================= Testing
================================////= =////= The following main method is just for testing this class you built.=//
//= After testing,you may simply delete it. =//
//======================================================================//
public static void main(String[] args)
{
new Source1();
}
//= End of Testing =
}
Class2:
/****************************************************************/
/* Sink1 *//* */
/****************************************************************/
import java.awt.*;
import java.awt.event.*;import javax.swing.*;
import javax.swing.event.*;
import java.io.*;import java.net.*;
/**
* Summary description for Sink1*
*/
public class Sink1 extends JFrame
{// Variables declaration
private JLabel jLabel1;
private JTabbedPane jTabbedPane1;
private JButton jButton1;private JPanel contentPane;
//-----
private JTextArea jTextArea1;private JScrollPane jScrollPane1;
-
7/28/2019 complete project on cloud computing
56/86
private JPanel jPanel1;
private JLabel transferTime;
private JLabel JtransferTime;
//-----
private JTextArea jTextArea2;private JScrollPane jScrollPane2;private JPanel jPanel2;
//-----
String Recieved1;
ServerSocket server_1;
Socket socket_1;
int i=1;String destination;
String rr="";
//-----// End of variables declaration
public Sink1(){
super();
initializeComponent();try
{
server_1=new ServerSocket(101);
}catch (Exception exp)
{
exp.printStackTrace();}
//
// TODO: Add any constructor code after initializeComponent call//
this.setVisible(true);
}
/*** This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
regenerated* by the Windows Form Designer. Otherwise, retrieving design might not work properly.
-
7/28/2019 complete project on cloud computing
57/86
* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
* to retrieve your design properly in future, before revising this method.
*/private void initializeComponent()
{
jLabel1=new JLabel();jLabel1.setFont(new Font("Serief",Font.BOLD,16));jTabbedPane1 = new JTabbedPane();
jButton1 = new JButton();
contentPane = (JPanel)this.getContentPane();//-----
jTextArea1 = new JTextArea();
jScrollPane1 = new JScrollPane();
jPanel1 = new JPanel();jTabbedPane1.setForeground(Color.white);
jTabbedPane1.setForeground(new Color(210,105,30));
transferTime=new JLabel();JtransferTime=new JLabel();
transferTime.setText("TransferTime");
//-----jTextArea2 = new JTextArea();
jScrollPane2 = new JScrollPane();
jPanel2 = new JPanel();
//-----
jLabel1.setForeground(Color.white);
jTextArea1.setText("\t**********THIS IS FROM PORTPROBE*************\n\n");
//-----
//
jTextArea2.setText("\t**********THIS IS FROM PORT
DoS1**************\n\n");// jTabbedPane1
//
jTabbedPane1.addTab("Dest1", jPanel1);
jTabbedPane1.addTab("Dest2", jPanel2);jTabbedPane1.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e)
{
jTabbedPane1_stateChanged(e);}
});//
-
7/28/2019 complete project on cloud computing
58/86
//
// jLabel1
//jLabel1.setText("Sink1");
//
// jButton1//jButton1.setText("Exit");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
jButton1_actionPerformed(e);
}
});
//
// contentPane//
contentPane.setLayout(null);
contentPane.setBackground(new Color(210,105,30));
addComponent(contentPane, jLabel1, 232,9,193,38);addComponent(contentPane, jTabbedPane1, 21,44,473,374);
addComponent(contentPane, jButton1, 228,425,88,32);
addComponent(contentPane,transferTime,50,500,193,38);addComponent(contentPane,JtransferTime,100,500,193,38);
//
// jTextArea1//
//
// jScrollPane1//
jScrollPane1.setViewportView(jTextArea1);
//// jPanel1
//
jPanel1.setLayout(null);
addComponent(jPanel1, jScrollPane1, 23,19,418,301);//
// jTextArea2
//
//// jScrollPane2
//
jScrollPane2.setViewportView(jTextArea2);//
-
7/28/2019 complete project on cloud computing
59/86
// jPanel2
//
jPanel2.setLayout(null);addComponent(jPanel2, jScrollPane2, 22,19,416,302);
//
// jTextArea3////
// jScrollPane3
////jScrollPane3.setViewportView(jTextArea3);
//
// jPanel3
////jPanel3.setLayout(null);
//addComponent(jPanel3, jScrollPane3, 30,18,414,305);
//// Sink1
//
this.setTitle("Sink1 - extends JFrame");
this.setLocation(new Point(0, 0));this.setSize(new Dimension(544, 494));
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int
height)
{c.setBounds(x,y,width,height);
container.add(c);
}
//
// TODO: Add any appropriate code in the following Event Handling Methods//
private void jTabbedPane1_stateChanged(ChangeEvent e)
{
System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");// TODO: Add any handling code here
}
private void jButton1_actionPerformed(ActionEvent e)
{
System.out.println("\njButton1_actionPerformed(ActionEvent e) called.");// TODO: Add any handling code here
-
7/28/2019 complete project on cloud computing
60/86
}
//
// TODO: Add any method code to meet your needs in the following area
//
public void server()
{
try{
String rr="";
socket_1=server_1.accept();
DataInputStream dis=newDataInputStream(socket_1.getInputStream());
int length=dis.readInt();
. String destination=dis.readUTF();while(length>0)
{
rr=dis.readUTF();
if(destination.equalsIgnoreCase("probe"))
{
jTextArea1.append("Packet "+i+"\t"+rr+" Recieved...\n");
}
else if (destination.equalsIgnoreCase("Dos1")){
jTextArea2.append("Packet "+i+"\t"+rr+" Recieved...\n");}
else
JOptionPane.showMessageDialog(null,"No Packets Received");length--;
i++;
}
i=1;
}
catch (Exception exp){
-
7/28/2019 complete project on cloud computing
61/86
exp.printStackTrace();
}
}
//============================= Testing================================//
//= =//
//= The following main method is just for t