Archit ITS Report
Archit ITS Report
CSE/IT/AI&DS
Certificate
Acknowledgement
Work. We are grateful to our respected Dr. IC Sharma, Principal GIT for guiding
support and timely guidance, the completion of our Practical Training would have
Abstract
This Industrial Training Seminar (ITS) report provides an overview of the
extensive handsome experience gained during the third year of the Bachelor of
The report outlines the practical applications of these technologies through real
world projects, emphasizing their role in Backend and the opportunities they
create inbuilding next-generation applications. The training has not only equipped
the student withinvaluable technical skills but has also fostered a deeper
for further growth and exploration in the field oftechnology and its impact on the
Table Of Contents
Chapter – 1 ............................................................................................................ 1
Basics ................................................................................................................... 1
1.1 Datatypes ........................................................................................................ 1
1.2 Variables ......................................................................................................... 1
1.3 Conditionals .................................................................................................... 1
1.4 Methods ....................................................................................................... 1
1.5 Loops .............................................................................................................. 1
Object Oriented Programming ............................................................................. 2
2.1 Inheritance ..................................................................................................... 2
2.2 Polymorphism ............................................................................................... 2
2.3 Abstraction .................................................................................................... 2
2.4 Encapsulation ................................................................................................. 2
Interfaces................................................................................................................ 3
Exception Handling .............................................................................................. 4
Multithreading ...................................................................................................... 5
Spring .................................................................................................................... 6
Spring Boot ............................................................................................................7
Fine - Grained Authentication .............................................................................. 8
Conclusion ...............................................................................14
Chapter – 1
Basics
Introduction
1.1 Datatypes
Data types in Java are of different sizes and values that can be
stored in the variable that is made as per convenience and
circumstances to cover up all test cases. Java has two categories in
which data types are segregated
Primitive Data Type: such as boolean, char, int, short, byte, long,
float, and double. The Boolean with uppercase B is a wrapper class
for the primitive data type boolean in Java.
Non-Primitive (Reference) Data Types
The Non-Primitive (Reference) Data Types will contain a
memory address of variable values because the reference types
won’t store the variable value directly in memory. They are strings,
objects, arrays, etc.
1. Strings
1.2 Conditions
The Java if statement is the most simple decision-making
statement. It is used to decide whether a certain statement or block
of statements will be executed or not i.e. if a certain condition is
true then a block of statements is executed otherwise not.
Example:
1.3 Variables
Variables are the containers for storing the data values or you can
also call it a memory location name for the data. Every variable has
a:
Data Type – The kind of data that it can hold. For example,
int, string, float, char, etc.
Variable Name – To identify the variable uniquely within the
scope.
Value – The data assigned to the variable.
There are three types of variables in Java – Local, Instance,
and Static.
How to Initialize Java Variables?
It can be perceived with the help of 3 components explained -
Example:
// Declaring float variable
float simpleInterest;
‘To use the Scanner we need to import the Scanner class from the
util package as
import java.util.Scanner;
1.4 Methods
Jav Met
The method in Java or Methods of Java is a collection of statements that perform
some specific tasks and return the result to the caller. A Java method can perform
some specific tasks without returning anything. Java Methods allows us to reuse the
code without retyping the code. In Java, every method must be part of some class that
is different from languages like C, C++, and Python.
A method is like a function i.e. used to expose the behavior of an object.
It is a set of codes that perform a particular task.
Syntax of Method:
<access_modifier> <return_type>
<method_name>( list_of_parameters)
{
//body
}
Advantage of Method:
Code Reusability
Code Optimization
Note: Methods are time savers and help us to reuse the code without retyping the
code.
Method Declaration
1.5 Loops
Loops in Java come into use when we need to repeatedly execute
a block of statements. Java for loop provides a concise way of
writing the loop structure. The for statement consumes the
initialization, condition, and increment/decrement in one line
thereby providing a shorter, easy-to-debug structure of looping. Let
us understand Java for loop with Examples.
Syntax:
for (initialization expr; test expr; update exp)
{
// body of the loop
// statements we want to execute
}
1. Initialization Expression
3. Update Expression:
Chapter – 2
Object Oriented Programming
Object-Oriented Programming or Java OOPs concept refers to
languages that use objects in programming, they use objects as a
primary source to implement what is to happen in the code. Objects
are seen by the viewer or user, performing tasks you assign.
Object-oriented programming aims to implement real-world
entities like inheritance, hiding, polymorphism, etc. in
programming. The main aim of OOPs is to bind together the data
and the functions that operate on them so that no other part of the
code can access this data except that function.
Object-Oriented Programming is the backbone of Java. Mastering
OOP concepts like inheritance, encapsulation, and polymorphism is
critical for writing scalable Java code.
Inheritance
8
//derived class or child class or base class
9
class B extends A{ //Inherits parent class methods
10
//child class methods
11
void method3(){}
12
void method4(){}
13
}
Polymorphism
Types of Polymorphism
Polymorphism in Java is mainly of 2 types as mentioned below:
1. Method Overloading
2. Method Overriding
Method Overloading and Method Overriding
1. Method Overloading: Also, known as compile-time
polymorphism, is the concept of Polymorphism where more than
one method share the same name with different
signature(Parameters) in a class. The return type of these methods
can or cannot be same.
2. Method Overriding: Also, known as run-time polymorphism, is
the concept of Polymorphism where method in the child class has
the same name, return-type and parameters as in parent class. The
child class provides the implementation in the method already
written.
Encapsulation
Abstraction
Java Classes
A class in Java is a set of objects which shares common
characteristics/ behavior and common properties/ attributes. It is a
user-defined blueprint or prototype from which objects are created.
For example, Student is a class while a particular student named
Ravi is an object.
Java Objects
An object in Java is a basic unit of Object-Oriented Programming and
represents real-life entities. Objects are the instances of a class that
are created to use the attributes and methods of a class. A typical
Java program creates many objects, which as you know, interact by
invoking methods. An object consists of :
1. State : It is represented by attributes of an object. It also
reflects the properties of an object.
2. Behavior : It is represented by the methods of an object. It
also reflects the response of an object with other objects.
3. Identity : It gives a unique name to an object and enables one
object to interact with other objects.
Example of an object: dog
Ch -4 Interfaces
Class Interface
Ch –5 Exception Handling
Exception Handling in Java is one of the effective means to handle runtime errors so
that the regular flow of the application can be preserved. Java Exception Handling is a
mechanism to handle runtime errors such as ClassNotFoundException, IOException,
SQLException, RemoteException, etc.
Let us discuss the most important part which is the differences between Error and
Exception that is as follows:
Error: An Error indicates a serious problem that a reasonable application
should not try to catch.
Exception: Exception indicates conditions that a reasonable application might
try to catch.
Ch – 6 Multithreading
2
Threads are the backbone of multithreading. We are living in a real world which in
itself is caught on the web surrounded by lots of applications. With the advancement
in technologies, we cannot achieve the speed required to run them simultaneously
unless we introduce the concept of multi-tasking efficiently. It is achieved by the
concept of thread.
Real-life Example of Java Multithreading
Suppose you are using two tasks at a time on the computer, be it using Microsoft
Word and listening to music. These two tasks are called processes . So you start
typing in Word and at the same time start music app, this is called multitasking . Now
you committed a mistake in a Word and spell check shows exception, this means Word
is a process that is broken down into sub-processes. Now if a machine is dual-core
then one process or task is been handled by one core and music is been handled by
another core.
In the above example, we come across both multiprocessing and multithreading.
These are somehow indirectly used to achieve multitasking. In this way the
mechanism of dividing the tasks is called multithreading in which every process or
task is called by a thread where a thread is responsible for when to execute, when to
stop and how long to be in a waiting state. Hence, a thread is the smallest unit of
processing whereas multitasking is a process of executing multiple tasks at a time.
notifyA
It gives out a notification to all the thread in the waiting state
ll()
Streams in Java
Ch - 9 Spring Boot
What is Spring Boot?
Spring Boot is an open-source Java framework used to create a
Micro Service. Spring boot is developed by Pivotal Team, and it
provides a faster way to set up and an easier, configure, and run
both simple and web-based applications. It is a combination of
Spring Framework and Embedded Servers. The main goal of Spring
Boot is to reduce development, unit test, and integration test time
and in Spring Boot, there is no requirement for XML configuration.
💡
Then open the code in your Java IDE. I used JetBrains for
all my work.
## Dependencies
```groovy
dependencies {
implementation
'org.springframework.boot:spring-boot-
starter-web'
implementation 'org.springdoc:springdoc-
openapi-starter-webmvc-ui:2.3.0'
developmentOnly
'org.springframework.boot:spring-boot-
devtools'
testImplementation
'org.springframework.boot:spring-boot-
starter-test'
testRuntimeOnly
'org.junit.platform:junit-platform-launcher'
// Add this line to install the Permit.io Java SDK in your project
implementation 'io.permit:permit-sdk-
java:2.0.0'
}
package com.boostmytool.store.config;
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Creates a Permit client bean with custom configuration
* @return Permit client instance
*/
@Bean
.withPdpAddress( pdpUrl)
// Set the PDP address
.withDebugMode(true) //
Enable debug mode for detailed logging
.build()
// Build the PermitConfig object
);
}
}
package com.boostmytool.store.service;
import com.boostmytool.store.exception.ForbiddenAccessException;
import com.boostmytool.store.exception.UnauthorizedException;
import io.permit.sdk.Permit;
import io.permit.sdk.api.PermitApiError;
import io.permit.sdk.api.PermitContextError;
import io.permit.sdk.enforcement.Resource;
import io.permit.sdk.enforcement.User;
import org.springframework.stereotype.Service;
import java.io.IOException;
/**
* Simulates user login by creating and returning a Permit User
object.
*
* @param key User's unique key
* @return User object
*/
/**
* Handles user signup by creating and syncing a new Permit User.
*
* @param key User's unique key
* @return Created and synced User object
*/
permit.api.users.sync(user); // Syncs
the new user with the Permit service
IOException e) {
return user;
}
/**
* Assigns a role to the user within the "default" environment.
*
* @param user User object to assign the role to
* @param role Role to be assigned
*/
public void assignRole(User user, String role) {
try {
permit.api.users.assignRole(user.getKey(), role,
"default"); // Assigns role in the "default" environment
IOException e) {
/**
* Checks if the user is authorized to perform a specific action on a
resource.
*
* @param user User object requesting authorization
* @param action Action to be authorized
* @param resource Resource on which the action will be performed
* @throws UnauthorizedException if user is not logged in
* @throws ForbiddenAccessException if user is denied access
*/
if (user == null) {
try {
permitted = permit.check(user,
var
}
}
Conclusion
This industrial training seminar has equipped me with not just
technical skills, but a profound understanding of the entire
Spring boot ecosystem. It bridges the gap between the client-
facing interface and the server-side logic, empowering me as a
Java Dev. Beyond the technical aspects, this training has
emphasized the significance of collaboration, version control,
and adhering to best practices—a combination that is
indispensable when working within a development team.