Fundamental
Concepts of Java
As of SAP Web
Application Server 6.20, you have the option of using Java as well as The ABAP
programming language. You should therefore familiarize yourself with the Fundamental
concepts of the Java environment.
The
Java programming language was first introduced in 1995 by Sun Microsystems Inc.™.
Java is an object-oriented and platform-independent programming language that
has spread across many areas. The powerful concept of Java allows the development
of a large number of different types of application - from the classic application
using applets implemented in Web pages to client/server applications.
Java
has been designed to be platform independent. This means that the same Java
program
can be executed on any system for which a Java Runtime Environment (JRE)
is available. In particular, Java applications can run on different systems
that are based on different hardware. Java can be used to create programs for
UNIX, Microsoft Windows, Linux, MacOS, or OS/2, for workstations or servers;
for x86, MIPS, Alpha, or Sparc; for computers, organizers, or cell phones, and
for the microcomputers built into household and industry devices, such as
washing machines, video recorders, cars, and traffic lights.
Properties of Java
You
need to differentiate between two basic types of Java programs: applications and
applets.
• Applications
Java
applications are computer programs with the full functional range also provided
by other programming languages. Applications can run as local programs on the user’s
computer or as client/server systems across the Internet or using an Intranet,
or as server programs (servlets, CGI programs) on a Web
server.
• Applets
The term applet
essentially means "little application". It usually means a Java applet,
a small computer program that runs in a Web browser and is written in the Java
programming language. Java applets are intended for execution within the Java
Runtime Environment of a browser. They are transferred (as is also the case,
for example, with embedded images) with the HTML page using the HTTP protocol,
and then executed on the client computer. Special security guidelines apply to
Java applets; that is, they are not permitted to perform everything on the client
that locally-installed programs are permitted to. In this way, for example, they
can only create network connections to the host from which they were downloaded.
Note : JavaScript is completely unrelated to
Java. JavaScript is a script language that can be embedded in HTML and, with
some Web browsers (Netscape, Microsoft Internet Explorer), produces the
execution of certain functions and actions within the Web browser. JavaScript
was developed with the intention of dynamically organizing static HTML pages.
Unlike server-side script languages such as Perl or PHP, JavaScript is executed
on the client. In contrast to Java, JavaScript is not an independent
programming language, is not independent of the browser version, and does not
have the required security mechanisms.
ABAP & JAVA are programming languages that are
implemented platform independently.
JVM (JAVA VERTUAL
MACHINE) executes the
platform independent byte code generated by the java compiler on the relevant
hardware.
Initially, Java is a
programming language like any other. Unlike traditional compilers for a
programming language, which generate machine code for a specific platform (see the
Compiled Programming Languages figure),
Figure 1: Compiled
Programming Languages
Virtual machines play
an important role nowadays. The Java compiler produces program code for a
virtual machine (the Java Virtual Machine). This is known as byte code. Virtual
machine is a model of a processor (which often does not exist as real hardware)
and the associated system architecture. It is a computer program that emulates
a processor. The virtual machine is therefore viewed as the interface between
Java and the actual hardware.
Figure 2: Concept of
the Java Virtual Machine
The interpretation
causes speed problems, since the identification, decoding, and
execution of the
commands takes time. The technology of the Just In Time (JIT) compiler
alleviates the problem.
Java Development Kit
(JDK) is required to
write platform-independent Java programs. The Java Development Kit includes the
software required to create and test Java applications and applets, it also includes
the Java compiler, the Java Runtime Environment (the Java Virtual Machine) for
running applications.
Java Standard Edition (Java SE). The standard edition is the normal software environment
and defines the Java™
SE Development Kit (JDK). This includes the Java SE Runtime Environment
(JRE).
Java Enterprise
Edition (Java EE).
The enterprise edition builds on the JDK and integrates additional packages
such as Enterprise JavaBeans (EJB), servlets, Java Server Pages (JSP), Java
Mail API, and Java Transaction Service (JTS). The Java EE SDK (Software
Development Kit) includes the Sun Java System Application Server and requires a
JDK.
Java Micro Edition (Java ME). The micro edition is a small runtime environment for
small devices such as Personal Digital Assistants (PDAs) or telephones.
Programming in Java
When creating Java
programs, the developer first creates a source file in the format
“MyProgram.java”Java executables
(java.exe, jar.exe) on the d: drive and in the directory SYS/Exe/jvm. The Java
compiler generates a separate file for each class from the source file
that contains the bytecode for this class. The file name is then the name of
the class with the extension “.class”, and therefore has the format “MyProgram.class”.
Lesson: Java Cluster
Architecture
This lesson describes
the architecture of SAP NetWeaver AS Java.
After completing
this lesson, you will be able to:
1 Explain the term
Central Services of SAP NetWeaver AS Java
2 Understand and use
concepts such as Java instance, ICM, and server
1 Explain the term
Central Services of SAP NetWeaver AS Java
The Central Services,
which contain a message server and an enqueue server.
Central Services
The Central Services
run on one host and form a separate Java instance. They consist of the
1 Java Message service.
2 Java Enqueue service.
The Central Services
provide the basis for communication and synchronization for the Java cluster:
[(Java cluster: All Java components of an SAP system
are known as Java Cluster.)
A Java Cluster Consist
of :
1.
A
Java instance with an ICM & at least one Server
process.
2. The Central services, which
contains a Mesg Server & Enqueue Server.
3. A database for the central storage of data.
4.
Optionally
additional Java Instance. ]
Message Service
The message service is
an individual program used to communicate between the elements of a Java
cluster. The message service knows all active Java instances.
The message service administers
a list of the ICM and the server processes of the Java cluster. It represents
the infrastructure for data & load balancing between a large number of Java
instances, it also provides the load balancing information for the SAP Web
Dispatcher.
The message service
performs the following tasks in the Java cluster:
•
Communication between different services
•
Forwarding of messages and requests to all participants (broadcast)
•
Prepare logon information for the SAP Web Dispatcher
•
Guaranteed message transmission
Enqueue Service
The enqueue service
runs on the Central Services instance of the Java cluster. It manages the lock
table in the main memory and receives requests for setting or releasing locks.
It uses the tried and tested SAP lock concept
The enqueue service has
the following tasks:
•
Internally, it is used for synchronization within the Java cluster
•
The applications can lock objects are release locks again. The enqueue service processes these requests and manages
the lock table with the existing locks.
2
Understand and use concepts such as Java instance, ICM, and server
The Java Instance
Concept
SAP NetWeaver
Application Server Java takes the instance concept of SAP Basis, which combines
multiple components that are monitored, started, and stopped together into an
administrative unit.
The following components
are part of a Java instance:
2 (a) The server
processes provide the infrastructure in which the Java™ EE 6 applications
run.
2 (b) The Internet
Communication Manager distributes the client requests to the free server
processes of the instance.
è
An
instance always runs on one physical server, but there can be multiple
instances on one server.
è Within an SAP system, an instance is
defined using the system ID (SID) of the SAP system and the instance number.
è An SAP system consists of a database
and one or more instances.
è
These
instances can either be purely ABAP or Java instances, or instances with ABAP
and Java infrastructure, there is no system that has ABAP instances (without
Java) and Java instances (without ABAP).
NOTE The terms central instance and dialog
instance no longer apply as of 7.1 & New terms PAS and AAS introduced now.
PAS Primary Application Server Instance.
AAS Additional Application Server
Instance.
ICM concept
Client requests to SAP
NetWeaver AS Java are received by ICM. It selects a free server process to
process the request and creates the connection between the client and the
server process. The ICM distributes new incoming requests to the available server
processes using a “round
robin”
algorithm. If a connection to the client exists, the request is forwarded to the
server process that is already processing requests for this client.
Server concept
The server process of
the SAP NetWeaver Application Server Java runs the Java applications. The
server processes are implemented as multi-threaded servers and can therefore
process multiple requests in parallel.
The Internal
Structure of SAP NetWeaver AS Java
Objectives
to get familiar the
following terms
è
important
managers of the SAP NetWeaver AS
è
important
services of the SAP NetWeaver AS
SAP NetWeaver AS Java
consists internally of several managers and services. The internal
structure of SAP NetWeaver AS Java is divided into three logical levels
•
SAP Java Enterprise Runtime - provides fundamental functions of the
runtime environment, such as class loading, cluster communication, management
of configuration data.
•
AS Java System Components - contain interfaces, libraries, services and facades.
•
Applications Layer - relates to the applications that are deployed and
run in SAP NetWeaver Application Server Java.
Figure: Internal
Structure of SAP NetWeaver AS Java
The following general
rule applies to the interaction between these three logical entities in SAP
NetWeaver AS Java: higher-level components can use the functions of the
lower-level layers. On the other hand, the lower levels are not aware of the
higher levels and cannot therefore use their functions.
First, the runtime
environment is started, then the services are started, and then the
applications are started.
Communication between
the individual components takes place using defined Application Programming
Interfaces (APIs).
1# SAP Java
Enterprise Runtime
The SAP Java Enterprise
Runtime provides the core functions of the system are called managers.
#
Managers of SAP NetWeaver AS Java
•
Log Manager: manages the process of logging system events. It configures
the logging routines of the kernel. The Log Manager is the first manager that
is started during the startup of SAP NetWeaver Application Server Java.
•
Application Thread Manager: manages inbound client requests. Searches
for free threads to process inbound requests. If no threads are free, the
requests are buffered in a request queue.
•
Thread Manager: manages threads in which internal operations of SAP
NetWeaver AS Java are executed.
•
Locking Manager: Represents the interface between the server process and
the enqueue service.
•
Configuration Manager: Allows SAP NetWeaver AS Java to store and access
data in a relational database. Uses the Open SQL for Java Framework to do this.
•
Class loading Manager: Central location for the registration and removal
of loaders and references between them.
•
Cluster Manager: Manages the elements of a cluster (server processes)
and is responsible for the communication in the cluster. It updates information
about the status of the individual elements of a cluster and the services that
are provided by it.
•
Service Manager: Represents a container in which all services in the
cluster are executed.
2#
AS Java System Components
The AS Java System
components form the second level within the three-level structure of SAP NetWeaver
AS Java. Four types of AS Java System components can be classified:
•
Interfaces: Agreements that define how different components of SAP
NetWeaver AS Java work together. They do not provide any runtime functions
themselves, but rather are used by services that provide their implementation.
•
Libraries: They provide names, classes, and objects within SAP NetWeaver
AS Java. These objects are created by the system when it loads the library, or
when an
object is first
requested.
•
Services: The services that SAP NetWeaver AS Java provides for
processing requests are defined and configured using the Services. Service components
can access and utilize functions of the runtime environment through the
Framework API. They are the most important of these four types of AS Java
System components.
•
Facades: The facades are special APIs that the Java EE API and SAP API
use to access libraries, interfaces and services.
#
Services of SAP NetWeaver AS Java
•
Security Provider: Administration of users and groups and authorization
administration. Controls access to resources or applications deployed in SAP
NetWeaver AS Java.
•
Monitoring Service: Allows access to information about the current
system status. Provides general and statistical information, among other things,
about the nodes in the cluster, memory utilization, performance, applications,
and user connections.
•
Log Configurator service: Manages the configuration of the logging and
tracing mechanism of SAP NetWeaver AS Java.
•
Deploy Service: Manages the deployment of Java applications.
•
EJB Container Service:
Manages all Enterprise Java Beans (session beans, entity beans, and message-driven
beans), which are executed in the EJB Container of SAP
NetWeaver AS Java.
•
HTTP Provider: Is
responsible for processing HTTP requests.
Applications Layer
The applications form
the third level within the architecture of SAP NetWeaver AS Java. The boundary
between the applications and the AS Java System components is defined by the
Java EE API’s. Applications use these APIs to utilize the functions of the AS
Java System components.
An enterprise
application can contain different types of application components:
•
Servlet: A program
module written in the Java programming language, which is used to respond to
requests to a Web server in such a way that the content of the returned HTML
Web page is dynamically generated. Servlets are standardized in the context of
the Java™
EE 6 specification.
•
Java Server Pages (JSP):
Technology for dynamically generating HTML and XML output of a Web server. This
technology enables Java code and specific JSP actions to be embedded in static
content. The advantage of this technology is that the logic can be implemented
independent of the design. Java Server Pages are converted to Java source code,
which corresponds to a Java servlet, using a special JSP compiler.
•
Enterprise Java Beans (EJB):
Used for the standardized, simplified development of business applications
using Java. They are part of the central elements of the Java™ EE 6
specification.
•
Java Database Connectivity (JDBC):
Uniform interface to databases from different vendors, defined specifically for
relational databases. The tasks of JDBC include creating and managing database
connections, forwarding SQL queries to the database, and converting the results
into a format that is usable for Java and making them available to the program.