2.
Literature Survey
2.1 Java Swings
ava Swing tutorial is a part of Java Foundation Classes (JFC) that
is used to create window-based applications. It is built on the top of
AWT (Abstract Windowing Toolkit) API and entirely written in java.
Unlike AWT, Java Swing provides platform-independent and
lightweight components.
The javax.swing package provides classes for java swing API such
as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu,
JColorChooser etc.
2.2 Hierarchy of Swings Classes
2.3 Commonly used Methods of Component class
Method Description
public void add(Component c) add a component on another component.
public void setSize(int width,int sets size of the component.
height)
public void setLayout(LayoutManager sets the layout manager for the component.
m)
public void setVisible(boolean b) sets the visibility of the component. It is by
default false.
2.4 Amazon RDS
2.4.1 Overview of Amazon RDS
Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to
set up, operate, and scale a relational database in the cloud. It provides cost-efficient,
resizable capacity for an industry-standard relational database and manages common
database administration tasks.
Why do you want a managed relational database service? Because Amazon RDS
takes over many of the difficult or tedious management tasks of a relational
database:
When you buy a server, you get CPU, memory, storage, and IOPS, all
bundled together. With Amazon RDS, these are split apart so that you can
scale them independently. If you need more CPU, less IOPS, or more
storage, you can easily allocate them.
Amazon RDS manages backups, software patching, automatic failure
detection, and recovery.
To deliver a managed service experience, Amazon RDS doesn't provide shell
access to DB instances, and it restricts access to certain system procedures
and tables that require advanced privileges.
You can have automated backups performed when you need them, or
manually create your own backup snapshot. You can use these backups to
restore a database. The Amazon RDS restore process works reliably and
efficiently.
You can get high availability with a primary instance and a synchronous
secondary instance that you can fail over to when problems occur. You can
also use MySQL, MariaDB, or PostgreSQL Read Replicas to increase read
scaling.
You can use the database products you are already familiar with: MySQL,
MariaDB, PostgreSQL, Oracle, Microsoft SQL Server.
In addition to the security in your database package, you can help control who
can access your RDS databases by using AWS Identity and Access
Management (IAM) to define users and permissions. You can also help
protect your databases by putting them in a virtual private cloud.
2.4.2 DB Instances
The basic building block of Amazon RDS is the DB instance. A DB instance is an
isolated database environment in the cloud. A DB instance can contain multiple
user-created databases, and you can access it by using the same tools and
applications that you use with a stand-alone database instance. You can create and
modify a DB instance by using the AWS Command Line Interface, the Amazon RDS
API, or the AWS Management Console.
Each DB instance runs a DB engine. Amazon RDS currently supports the MySQL,
MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server DB engines. Each DB
engine has its own supported features, and each version of a DB engine may include
specific features. Additionally, each DB engine has a set of parameters in a DB
parameter group that control the behavior of the databases that it manages.
The computation and memory capacity of a DB instance is determined by its DB
instance class. You can select the DB instance that best meets your needs. If your
needs change over time, you can change DB instances.
DB instance storage comes in three types: Magnetic, General Purpose (SSD), and
Provisioned IOPS (PIOPS). They differ in performance characteristics and price, allowing
you to tailor your storage performance and cost to the needs of your database. Each DB
instance has minimum and maximum storage requirements depending on the storage type
and the database engine it supports. It’s important to have sufficient storage so that your
databases have room to grow and that features for the DB engine have room to write
content or log entries.
You can run a DB instance on a virtual private cloud using the Amazon Virtual Private Cloud
(VPC) service. When you use a virtual private cloud, you have control over your virtual
networking environment: you can select your own IP address range, create subnets, and
configure routing and access control lists. The basic functionality of Amazon RDS is the
same whether it is running in a VPC or not; Amazon RDS manages backups, software
patching, automatic failure detection, and recovery. There is no additional cost to run your
DB instance in a VPC.
2.4.3 Security
A security group controls the access to a DB instance. It does so by allowing access
to IP address ranges or Amazon EC2 instances that you specify.
Amazon RDS uses DB security groups, VPC security groups, and EC2 security
groups. In simple terms, a DB security group controls access to a DB instance that is
not in a VPC, a VPC security group controls access to a DB instance inside a VPC,
and an Amazon EC2 security group controls access to an EC2 instance and can be
used with a DB instance.
2.4.4 Regions and Availability Zones
Amazon cloud computing resources are housed in highly available data center
facilities in different areas of the world (for example, North America, Europe, or Asia).
Each data center location is called a region.
Each region contains multiple distinct locations called Availability Zones, or AZs.
Each Availability Zone is engineered to be isolated from failures in other Availability
Zones, and to provide inexpensive, low-latency network connectivity to other
Availability Zones in the same region. By launching instances in separate Availability
Zones, you can protect your applications from the failure of a single location.
You can run your DB instance in several Availability Zones, an option called a Multi-
AZ deployment. When you select this option, Amazon automatically provisions and
maintains a secondary standby DB instance in a different Availability Zone. Your
primary DB instance is synchronously replicated across Availability Zones to the
secondary instance to provide data redundancy, failover support, eliminate I/O
freezes, and minimize latency spikes during system backups.
2.4.5 Monitoring an Amazon RDS DB Instance
There are several ways that you can track the performance and health of a DB instance. You
can use the free Amazon CloudWatch service to monitor the performance and health of a
DB instance; performance charts are shown in the Amazon RDS console. You can subscribe
to Amazon RDS events to be notified when changes occur with a DB instance, DB
Snapshot, DB parameter group, or DB security group.
2.4.6 Amazon RDS Interfaces
The AWS Management Console is a simple web-based user interface. You can manage
your DB instances from the console with no programming required. To access the Amazon
RDS console, sign in to the AWS Management Console and open the Amazon RDS console
at https://console.aws.amazon.com/rds/.
You can use the AWS Command Line Interface (AWS CLI) to access the Amazon RDS API
interactively.
For application development, we recommend that you use one of the AWS Software
Development Kits (SDKs). The AWS SDKs handle low-level details such as authentication,
retry logic, and error handling, so that you can focus on your application logic. AWS SDKs
are available for a wide variety of languages.
For application development, we recommend that you use one of the AWS Software
Development Kits (SDKs). The AWS SDKs handle low-level details such as authentication,
retry logic, and error handling, so that you can focus on your application logic. AWS SDKs
are available for a wide variety of languages.
2.5 Amazon Simple Queue Service
Amazon Simple Queue Service (Amazon SQS) offers a secure, durable, and available
hosted queue that lets you integrate and decouple distributed software systems and
components. Amazon SQS offers common constructs such as dead-letter queues and cost
allocation tags. It provides a generic web services API and it can be accessed by any
programming language that the AWS SDK supports.
2.5.1 What Are the Main Benefits of Amazon SQS?
Security – You control who can send messages to and receive messages
from an Amazon SQS queue.
Server-side encryption (SSE) lets you transmit sensitive data by protecting the
contents of messages in queues using keys managed in AWS Key
Management Service (AWS KMS).
Durability – To ensure the safety of your messages, Amazon SQS stores
them on multiple servers. Standard queues support at-least-once message
delivery, and FIFO queues support exactly-once message processing.
Availability – Amazon SQS uses redundant infrastructure to provide highly-
concurrent access to messages and high availability for producing and
consuming messages.
Scalability – Amazon SQS can process each buffered request independently,
scaling transparently to handle any load increases or spikes without any
provisioning instructions.
Reliability – Amazon SQS locks your messages during processing, so that
multiple producers can send and multiple consumers can receive messages
at the same time.
Customization – Your queues don't have to be exactly alike—for example,
you can set a default delay on a queue. You can store the contents of
messages larger than 256 KB using Amazon Simple Storage Service
(Amazon S3) or Amazon DynamoDB, with Amazon SQS holding a pointer to
the Amazon S3 object, or you can split a large message into smaller
messages.
2.5.2 Creating an Amazon SQS Queue
Sign in to the Amazon SQS console.
Choose Create New Queue.
On the Create New Queue page, ensure that you're in the correct
region and then type the Queue Name.
Note
The name of a FIFO queue must end with the .fifo suffix.
Standard is selected by default. Choose FIFO.
Create your queue.
To create your queue with the default parameters,
choose Quick-Create Queue.
To configure your queue's parameters, choose Configure
Queue. When you finish configuring the parameters,
choose Create Queue.
The Queue Type column helps you distinguish standard queues from
FIFO queues at a glance.
2.6 Amazon Simple Notification Service
Amazon Simple Notification Service (Amazon SNS) is a web service that
coordinates and manages the delivery or sending of messages to
subscribing endpoints or clients. In Amazon SNS, there are two types of
clients—publishers and subscribers—also referred to as producers and
consumers. Publishers communicate asynchronously with subscribers
by producing and sending a message to a topic, which is a logical
access point and communication channel. Subscribers (i.e., web
servers, email addresses, Amazon SQS queues, AWS Lambda functions)
consume or receive the message or notification over one of the
supported protocols (i.e., Amazon SQS, HTTP/S, email, SMS, Lambda)
when they are subscribed to the topic.
When using Amazon SNS, you (as the owner) create a topic and control access to it by
defining policies that determine which publishers and subscribers can communicate with the
topic. A publisher sends messages to topics that they have created or to topics they have
permission to publish to. Instead of including a specific destination address in each
message, a publisher sends a message to the topic. Amazon SNS matches the topic to a list
of subscribers who have subscribed to that topic, and delivers the message to each of those
subscribers. Each topic has a unique name that identifies the Amazon SNS endpoint for
publishers to post messages and subscribers to register for notifications. Subscribers
receive all messages published to the topics to which they subscribe, and all subscribers to
a topic receive the same messages.
2.6.1 Setting Up Access for Amazon SNS
1. Sign in to the AWS Identity and Access Management console.
2. Choose Users, Add user.
3. Type a User name, such as AmazonSNSAdmin.
4. Select Programmatic access and AWS Management Console access.
5. Set a Console password and then choose Next: Permissions.
6. On the Set permissions page, choose Attach existing policies directly.
7. Type AmazonSNS into the filter, choose AmazonSNSFullAccess, and then
choose Next: Tags.
8. On the Add tags (optional) page, choose Next: Review.
9. On the Review page, choose Create user.
The IAM user is created and the Access key ID is displayed, for example:
AKIAIOSFODNN7EXAMPLE
10. To display your Secret access key, choose Show, for example:
wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Important
You can view or download your secret access key only when you create your
credentials (however, you can create new credentials at any time).
11. To download your credentials, choose Download .csv. Keep this file in a
secure location.
Now that you're prepared to work with Amazon SNS, get started by creating a topic,
creating a subscription for the topic, publishing a message to the topic, and deleting
the subscription and topic.
2.6.2 Getting Started with Amazon SNS
This section helps you become more familiar with Amazon SNS by showing you how to
manage topics, subscriptions, and messages using the AWS Management Console.
Step 1: Create a Topic
1. Sign in to the Amazon SNS console.
2. In the Create topic section, enter a Topic name, for example MyTopic.
3. Choose Create topic.
The topic is created and the MyTopic page is displayed.
The topic's Name, ARN, (optional) Display name, and Topic owner's AWS
account ID are displayed in the Details section.
4. Copy the topic ARN to the clipboard, for example:
arn:aws:sns:us-east-2:123456789012:MyTopic
Step 2: Create a Subscription for an Endpoint to the Topic
1. On the navigation panel, choose Subscriptions.
2. On the Subscriptions page, choose Create subscription.
3. On the Create subscription page, do the following:
a. Enter the Topic ARN of the topic you created earlier, for example:
arn:aws:sns:us-east-2:123456789012:MyTopic
Note
To see a list of the topics in the current AWS account, choose
the Topic ARN field.
b. For Protocol, select an endpoint type, for example Email.
c. For Endpoint, enter an email address that can receive notifications, for
example:
[email protected]
Note
After your subscription is created, you must confirm it. Only HTTP/S
endpoints, email addresses, and AWS resources in other AWS
accounts require confirmation. (Amazon SQS queues and Lambda
functions in the same AWS account—as well as mobile endpoints —
don't require confirmation.)
d. Choose Create subscription.
The subscription is created and the Subscription: 1234a567-bc89-012d-
3e45-6fg7h890123i page is displayed.
The subscription's ARN, Endpoint, Topic, Status (Pending
confirmation at this stage), and Protocol are displayed in
the Details section.
4. In your email client, check the email address that you specified and
choose Confirm subscription in the email from Amazon SNS.
5. In your web browser, a subscription confirmation with your subscription ID is
displayed.
Step 3: Publish a Message to the Topic
1. On the navigation panel, choose Topics.
2. On the Topics page, choose the topic you created earlier and then
choose Publish message.
3. On the Publish message to topic page, do the following:
a. In the Message details section, enter the (optional) Subject, for
example:
Hello from Amazon SNS!
b. In the Message body section, enter the message, for example:
If you receive this message, publishing a message to an Amazon SNS
topic works.
c. In the Message attributes section, add any attributes that you want
Amazon SNS to match with the subscription attribute FilterPolicy to
decide whether the subscribed endpoint is interested in the published
message. For more information, see Amazon SNS Message Attributes.
d. Choose Publish message.
The message is published to the topic and the MyTopic page is
displayed.
The topic's Name, ARN, (optional) Display name, and Topic owner's
AWS account ID are displayed in the Details section.
4. In your email client, check the email address that you specified earlier and
read the email from Amazon SNS.
Step 4: Delete the Subscription and Topic
1. On the navigation panel, choose Subscriptions.
2. On the Subscriptions page, choose a confirmed subscription and then
choose Delete.
Note
You can't delete a pending confirmation. After 3 days, Amazon SNS deletes it
automatically.
3. In the Delete subscription dialog box, choose Delete.
The subscription is deleted.
4. On the navigation panel, choose Topics.
5. On the Topics page, choose a topic and then choose Delete.
Important
When you delete a topic, you also delete all subscriptions to the topic.
6. On the Delete topic MyTopic dialog box, enter delete me and then
choose Delete.
The topic is deleted.