60
1 Technology Concepts PROCEDURAL LANGUAGE/STRUCTURED QUERY LANGUAGE (PL/SQL)..................................... 6 WHAT IS PL/SQL (PROCEDURAL LANGUAGE/STRUCTURED QUERY LANGUAGE)? .......................................... 6 WHAT IS A CURSOR? WHY CURSOR IS REQUIRED? .......................................................................................... 6 WHAT IS THE DIFFERENCE BETWEEN EXPLICIT CURSOR AND IMPLICIT CURSOR?.............................................. 6 WHAT ARE THE CURSOR ATTRIBUTES USED IN PL/SQL? ................................................................................. 7 WHAT IS A DATABASE TRIGGER? NAME SOME USAGES OF DATABASE TRIGGER? ............................................... 7 WHAT IS THE BASIC STRUCTURE OF PL/SQL BLOCK? .................................................................................... 8 DIFFERENCE BETWEEN FUNCTION AND PROCEDURE? ................................................................................... 9 WHAT IS THE DIFFERENCE BETWEEN INNER JOIN & OUTER JOIN ................................................................. 10 JAVA DATABASE CONNECTIVITY (JDBC) .......................................................................................... 11 WHAT IS JDBC?......................................................................................................................................... 11 WHAT IS JDBC DRIVER INTERFACE? .......................................................................................................... 14 WHAT IS DATASOURCE AND ITS ADVANTAGES OVER DRIVERMANAGER ? ....................................................... 14 WHAT IS CONNECTION POOLING? ............................................................................................................... 15 CORE JAVA ................................................................................................................................................ 16 WHAT ARE JAVA PRIMITIVE TYPES? ............................................................................................................. 16 WHAT IS A CLASS?....................................................................................................................................... 16 WHAT IS A METHOD? .................................................................................................................................. 16 WHAT IS AN INHERITANCE? ......................................................................................................................... 16 WHAT IS AN INTERFACE? ............................................................................................................................ 16 DIFFERENCE BETWEEN INTERFACE AND ABSTRACT CLASS ........................................................................... 17 WHEN WE GO FOR ABSTRACT AND INTERFACES?.......................................................................................... 17 DETERMINING ACCESS TO CLASS MEMBERS ................................................................................................ 17 WHAT ARE OVERRIDDEN AND OVERLOADED METHODS? .............................................................................. 18 HOW DOES SYNCHRONIZATION WORK? ........................................................................................................ 20 HOW DOES SERIALIZATION WORK? .............................................................................................................. 20

Technology Concepts

Embed Size (px)

Citation preview

Page 1: Technology Concepts

1

Technology Concepts

PROCEDURAL LANGUAGE/STRUCTURED QUERY LANGUAGE (PL/SQL) ..................................... 6

WHAT IS PL/SQL (PROCEDURAL LANGUAGE/STRUCTURED QUERY LANGUAGE)? .......................................... 6

WHAT IS A CURSOR? WHY CURSOR IS REQUIRED? .......................................................................................... 6

WHAT IS THE DIFFERENCE BETWEEN EXPLICIT CURSOR AND IMPLICIT CURSOR? .............................................. 6

WHAT ARE THE CURSOR ATTRIBUTES USED IN PL/SQL? ................................................................................. 7

WHAT IS A DATABASE TRIGGER? NAME SOME USAGES OF DATABASE TRIGGER? ............................................... 7

WHAT IS THE BASIC STRUCTURE OF PL/SQL BLOCK? .................................................................................... 8

DIFFERENCE BETWEEN FUNCTION AND PROCEDURE? ................................................................................... 9

WHAT IS THE DIFFERENCE BETWEEN INNER JOIN & OUTER JOIN ................................................................. 10

JAVA DATABASE CONNECTIVITY (JDBC) .......................................................................................... 11

WHAT IS JDBC? ......................................................................................................................................... 11

WHAT IS JDBC DRIVER INTERFACE? .......................................................................................................... 14

WHAT IS DATASOURCE AND ITS ADVANTAGES OVER DRIVERMANAGER ? ....................................................... 14

WHAT IS CONNECTION POOLING? ............................................................................................................... 15

CORE JAVA ................................................................................................................................................ 16

WHAT ARE JAVA PRIMITIVE TYPES? ............................................................................................................. 16

WHAT IS A CLASS? ....................................................................................................................................... 16

WHAT IS A METHOD? .................................................................................................................................. 16

WHAT IS AN INHERITANCE? ......................................................................................................................... 16

WHAT IS AN INTERFACE? ............................................................................................................................ 16

DIFFERENCE BETWEEN INTERFACE AND ABSTRACT CLASS ........................................................................... 17

WHEN WE GO FOR ABSTRACT AND INTERFACES? .......................................................................................... 17

DETERMINING ACCESS TO CLASS MEMBERS ................................................................................................ 17

WHAT ARE OVERRIDDEN AND OVERLOADED METHODS? .............................................................................. 18

HOW DOES SYNCHRONIZATION WORK? ........................................................................................................ 20

HOW DOES SERIALIZATION WORK? .............................................................................................................. 20

Page 2: Technology Concepts

2

WHAT ARE THE DIFFERENCES BETWEEN AWT AND SWING ............................................................................ 20

HOW CAN YOU DO MULTIPLE INHERITANCE IN JAVA ..................................................................................... 20

WHAT IS REFLECTION API? HOW ARE THEY IMPLEMENTED? ........................................................................ 20

WHAT IS HEAP IN JAVA ................................................................................................................................ 21

IN JAVA, HOW ARE OBJECTS / VALUES PASSED AROUND ................................................................................. 21

WHAT IS PHANTOM MEMORY? ..................................................................................................................... 21

WHAT ARE THE OTHER WAYS TO CREATE AN OBJECT OTHER THAN CREATING AS NEW OBJECT? ....................... 21

WHAT DO YOU MEANT BY PRIVATE CONSTRUCTOR? WHY SOMEBODY DECLARE ONLY PRIVATE CONSTRUCTOR? 21

HOW HASHTABLE IS SYNCHRONIZED? WHY HASHMAP IS NOT SYNCHRONIZED? CAN WE MAKE HASHMAP

SYNCHRONIZED? ......................................................................................................................................... 21

EXPLAIN THE IMPORTANCE OF "STATIC" KEYWORD? .................................................................................... 21

WHAT ARE UTILITY CLASSES? ..................................................................................................................... 21

WHAT IS THE INTERFACE OF THREAD? ......................................................................................................... 21

WHAT IS THE DIFFERENCE BETWEEN ENUMERATION AND ITERATOR? ........................................................... 22

WHAT IS SYNCHRONIZATION AND WHY IS IT IMPORTANT? .............................................................................. 22

WHAT HAPPENS WHEN A THREAD CANNOT ACQUIRE A LOCK ON AN OBJECT? ................................................. 22

IMPORTANT THREAD METHODS .................................................................................................................... 23

CREATING THREADS .................................................................................................................................... 23

IF THE RUN() METHOD IS CALLED DIRECTLY, THE CODE IN IT IS EXECUTED BY THE CURRENT THREAD AND NOT

BY THE NEW THREAD. .................................................................................................................................. 24

WHAT ARE THE DIFFERENCES BETWEEN ARRAYLIST AND A VECTOR? ............................................................ 24

WHAT IS THE DIFFERENCE BETWEEN TREESET & HASHSET? ........................................................................ 25

SERVLET .................................................................................................................................................... 27

WHAT IS A SERVLET? .................................................................................................................................. 27

DIFFERENCE BETWEEN SINGLE THREAD AND MULTI THREAD MODEL SERVLET .............................................. 27

WHAT IS REQUEST DISPATCHER AND HOW DOES IT WORK? ........................................................................... 27

DIFFERENCE BETWEEN FORWARD AND SENDREDIRECT? .............................................................................. 28

WHAT ARE SERVLET FILTERS? ..................................................................................................................... 28

Page 3: Technology Concepts

3

WHAT’S THE POINT OF JDOM (JAVA DOCUMENT OBJECT MODEL), AND WHY DO DEVELOPERS NEED IT? ..... 29

WHAT ARE THE DIFFERENCES BETWEEN GET AND POST SERVICE METHODS? ............................................. 29

WHAT IS THE ACTUAL DIFFERENCE BETWEEN MVC AND MVC MODEL2? ..................................................... 29

JAVA SERVER PAGES (JSP) ................................................................................................................... 30

WHAT IS A OUTPUT COMMENT? ................................................................................................................... 30

WHAT IS A HIDDEN COMMENT? .................................................................................................................. 30

WHAT IS A EXPRESSION? ............................................................................................................................. 30

WHAT IS A DECLARATION? .......................................................................................................................... 31

WHAT IS A SCRIPTLET? ............................................................................................................................... 31

WHAT ARE IMPLICIT OBJECTS? LIST THEM? ................................................................................................. 31

WHAT ARE THE DIFFERENT SCOPE VALUES FOR THE <JSP:USEBEAN>? ........................................................ 31

EXPLAIN THE LIFE-CYCLE METHODS IN JSP? ............................................................................................... 32

HOW DO I PREVENT THE OUTPUT OF MY JSP OR SERVLET PAGES FROM BEING CACHED BY THE BROWSER? ... 32

HOW CAN I IMPLEMENT A THREAD-SAFE JSP PAGE? .................................................................................... 32

HOW DOES JSP HANDLE RUN-TIME EXCEPTIONS? ........................................................................................ 32

HOW ARE THE IMPLICIT OBJECT MADE AVAILABLE IN THE JSP FILE? WHERE ARE THEY DEFINED? ................. 33

WHAT IS THE DIFFERENCE BETWEEN JSP FORWARD AND SERVLET FORWARD METHODS? .............................. 33

WHAT IS THE DIFFERENCE BETWEEN PAGE, APPLICATION AND SESSION IMPLICIT OBJECTS OF JSP? .... 33

WHAT IS THE DIFFERENCE BETWEEN SENDREDIRECT() AND FORWARD? ...................................................... 33

WEB SERVICE ........................................................................................................................................... 35

EVOLUTION OF WEB SERVICES .................................................................................................................... 35

DESIGN OF WS & BPEL WAS TO ................................................................................................................. 35

WHAT IS WEB SERVICE? ............................................................................................................................. 36

WSDL ABSTRACT ....................................................................................................................................... 36

SAMPLE W-S-D-L DOCUMENT .................................................................................................................... 37

WSDL ELEMENTS DESCRIBED ..................................................................................................................... 38

PATTERNS OF OPERATION / MESSAGE EXCHANGE PATTERNS ....................................................................... 39

WSDL AND UDDI ...................................................................................................................................... 41

Page 4: Technology Concepts

4

WHAT IS UDDI .......................................................................................................................................... 41

WHAT IS UDDI BASED ON? ........................................................................................................................ 41

UDDI BENEFITS ........................................................................................................................................ 41

HOW CAN UDDI BE USED ........................................................................................................................... 42

WHO IS SUPPORTING UDDI? ..................................................................................................................... 42

BUSINESS PROCESS EXECUTION LANGUAGE (BPEL) ................................................................... 43

WHAT IS BPEL? ......................................................................................................................................... 43

WHAT IS A WORKFLOW? ............................................................................................................................. 43

WHAT IS AN ORACLE BPEL PROCESS MANAGER (OBPM)? ......................................................................... 44

ARCHITECTURE OF THE BPEL PROCESS MANAGER ..................................................................................... 44

CORE BPEL ENGINE SUPPORTS ................................................................................................................. 44

BPEL CONSOLE ......................................................................................................................................... 45

WHAT ARE BPEL ACTIVITIES? .................................................................................................................... 46

WHAT ARE STRUCTURED ACTIVITIES? ......................................................................................................... 47

SYNCHRONOUS WEB SERVICE ..................................................................................................................... 48

ASYNCHRONOUS WEB SERVICE ................................................................................................................... 49

PARTNER LINK PROPERTY ........................................................................................................................... 49

FAULT HANDLING ...................................................................................................................................... 53

TRANSACTIONS IN BPEL ....................................................................................................................... 55

XA (DISTRIBUTED TRANSACTION PROCESSING) AND NON-XA TRANSACTIONS ............................................... 55

ORACLE SERVICE BUS (OSB) & MEDIATOR ...................................................................................... 56

ORACLE SERVICE BUS (OSB) ...................................................................................................................... 56

BPEL VS. OSB / MEDIATOR ....................................................................................................................... 57

OSB VS. MEDIATOR ................................................................................................................................... 57

OSB: SERVICE POOLING ............................................................................................................................ 58

WHEN SHOULD BE USE MEDIATOR & ORALCE SERVICE BUS? ...................................................................... 58

SERVICE ORIENTED ARCHITECTURE (SOA) .................................................................................... 59

WHAT IS SOA? ........................................................................................................................................... 59

Page 5: Technology Concepts

5

SERVICE COMPONENT ARCHITECTURE (SCA) ................................................................................ 60

WHAT IS SCA? ........................................................................................................................................... 60

Page 6: Technology Concepts

6

Procedural Language/Structured Query Language (PL/SQL)

What is PL/SQL (Procedural Language/Structured Query Language)?

PL/SQL is a procedural language that has both interactive SQL and procedural programming

language constructs such as iteration, conditional branching.

What is a cursor? Why Cursor is required?

The Oracle server uses works areas called private SQL area.

Cursor is a named private SQL area from where information can be accessed. Cursors are

required to process rows individually for queries returning multiple rows.

There are two types of cursor

1. Implicit cursor

2. Explicit cursor

Implicit cursor

- Here all the DML statement is executed and to processing statement.

- Implicit cursor is open for all DML statement. After execute the statement

cursor is automatically closed.

- Implicit cursor is a system defined cursor.

Explicit cursor

- Explicit cursor is a user defined cursor.

- Explicit cursor is created by programmer.

- Explicit cursor is needed when Query returns more than one rows.

- In that case, programmer creates explicit cursor.

o Open the cursor.

o then fetch the value from the active set, after fetching all the value,

o Cursor is closed by programmer.

PL/SQL uses Implicit Cursors for queries.

User defined cursors are called Explicit Cursors

What is the difference between explicit cursor and implicit cursor?

When a single insert, delete or update statement is executed within PL/SQL program then

oracle creates an implicit cursor for the same, executes the statement, and closes the cursor. You can

check the result of execution using SQL%ROWCOUNT function.

Explicit cursors are created programmatically. The cursor type variable is declared and associated

with SQL query. The program then opens a cursor; fetches column information into variables or record

type variable, and closes cursor after all records are fetched. To check whether cursor is open or not

Page 7: Technology Concepts

7

use function SQL%ISOPEN and to check whether there are any records to be fetched from the

cursor use function SQL%FOUND.

What are the cursor attributes used in PL/SQL?

%ISOPEN - to check whether cursor is open or not

% ROWCOUNT - number of rows fetched/updated/deleted.

% FOUND - to check whether cursor has fetched any row. True if rows are fetched.

% NOT FOUND - to check whether cursor has fetched any row. True if no rows are fetched.

These attributes are proceded with SQL for Implicit Cursors and with Cursor name for

Explicit Cursors.

What is a database trigger? Name some usages of database trigger?

Database trigger is stored PL/SQL program unit associated with a specific database table or

view.

The code in the trigger defines the action the database needs to perform whenever

some database manipulation (INSERT, UPDATE and DELETE) takes place.

Unlike the stored procedure and functions, which have to be called explicitly,

the database triggers are fires (executed) or called implicitly whenever the table is affected by any

of the above said DML operations.

Till oracle 7.0 only 12 triggers could be associated with a given table, but in higher versions of

Oracle there is no such limitation. A database trigger fires with the privileges of owner not that of

user.

A database trigger has three parts

1. A triggering event

2. A trigger constraint (Optional)

3. Trigger action

A triggering event can be an

- insert,

- update, or

- delete statement or

- A instance shutdown or startup etc.

The trigger fires automatically when any of these events occur.

A trigger constraint specifies a Boolean expression that must be true for the trigger to fire.

This condition is specified using the WHEN clause.

The trigger action is a procedure that contains the code to be executed when the trigger

fires.

Usages are

Page 8: Technology Concepts

8

- Audit data modifications,

- Log events transparently,

- Enforce complex business rules,

- Derive column values automatically,

- Implement complex security authorizations.

- Maintain replicate tables.

What is the basic Structure of PL/SQL block?

Basic code structure

PL/SQL uses block structure as its basic structure.

Anonymous blocks are the basis of standalone PL/SQL scripts, and have the following structure:

<<label>>

DECLARE

TYPE / item / FUNCTION / PROCEDURE declarations

BEGIN

Statements

EXCEPTION

EXCEPTION handlers

END label;

The <<label>> and the DECLARE and EXCEPTION sections are optional.

Exceptions, errors which arise during the execution of the code, have one of two types:

1. Predefined exceptions

2. User-defined exceptions.

User-defined exceptions are always raised explicitly by the programmers, using

the RAISE or RAISE_APPLICATION_ERROR commands, in any situation where they have determined

that it is impossible for normal execution to continue. RAISE command has the syntax:

RAISE <exception name>;

Oracle Corporation has pre-defined several exceptions

like NO_DATA_FOUND, TOO_MANY_ROWS, etc. Each exception has a SQL Error Number and SQL

Page 9: Technology Concepts

9

Error Message associated with it. Programmers can access these by using

the SQLCODE and SQLERRM functions.

The DECLARE section defines and (optionally) initializes variables. If not initialized specifically, they

default to NULL.

Functions

Functions in PL/SQL are a collection of SQL and PL/SQL statements that perform a task and should

return a value to the calling environment.

CREATE OR REPLACE FUNCTION <function_name> [(input/output variable declarations)]

RETURN return_type

<IS|AS>

[declaration block]

BEGIN

<PL/SQL block WITH RETURN statement>

[EXCEPTION

EXCEPTION block]

END;

Procedures

Procedures are the same as Functions, in that they are also used to perform some task with the

difference being that procedures cannot be used in a SQL statement and although they can have

multiple out parameters they do not return a value.

Difference between Function and Procedure?

Functions only take IN Parameter.

Procedures take IN & OUT Parameters.

Functions must have a return type

Procedures do not return a value.

Functions can be written in both SQL & Pl/SQL statements.

Procedures cannot be used in SQL Statements.

Page 10: Technology Concepts

10

What is the difference between Inner Join & Outer Join

Definition 1

Inner join displays only the records which are satisfying the joining condition,

Where as in an outer join it displays the records which are satisfying the condition and also which are

not satisfying the condition also.

For example take Emp and dept table.

Inner Join query:

select empno, ename, sal, dept.deptno, dname, loc from emp Inner join dept

on(emp.deptno=dept.deptno)

Outer Join query:

Select empno, ename, sal, dept.deptno, dname, loc from emp right Outer Join dept on

(emp.deptno=dept.deptno).

In Inner Join it displays only 10, 20 & 30 departments.

In Outer Join it displays 10, 20, 30 and 40 departments.

Definition 2

Inner Join: Displays only matching record from 2 tables

Outer Join:

Left outer join Display all the records from 1st table, even if don‟t have matching record

in 2nd table

Right outer join Display all the record from the 2nd table, even if there is not matching

record in 1st table.

Page 11: Technology Concepts

11

Java Database Connectivity (JDBC)

What is JDBC?

Definition 1

JDBC is a layer of abstraction that allows users to choose between databases. It allows you to change

to a different database engine and to write to a single API. JDBC allows you to write database

applications in Java without having to concern yourself with the underlying details of a particular

database.

Definition 2

JDBC (Java Database Connectivity) is an application program interface (API) specification for

connecting programs written in Java to the data in popular databases.

The four types are:

► Type 1: JDBC-ODBC Bridge

► Type 2: Native-API/partly Java driver

► Type 3: Net-protocol/all-Java driver

► Type 4: Native-protocol/all-Java driver

► Type 1: JDBC-ODBC Bridge

The type 1 driver, JDBC-ODBC Bridge, translates all JDBC calls into ODBC (Open DataBase

Connectivity) calls and sends them to the ODBC driver. As such, the ODBC driver, as well as,

in many cases, the client database code must be present on the client machine.

Figure 1 shows a typical JDBC-ODBC Bridge environment.

Figure 1. Type 1: JDBC-ODBC Bridge

Pros

The JDBC-ODBC Bridge allows access to almost any database, since the database's ODBC drivers are

already available. Type 1 drivers may be useful for those companies that have an ODBC driver already

installed on client machines.

Page 12: Technology Concepts

12

Cons

► The performance is degraded since the JDBC call goes through the bridge to the ODBC

driver, then to the native database connectivity interface. The result comes back through the

reverse process. Considering the performance issue, type 1 drivers may not be suitable for

large-scale applications.

► The ODBC driver and native connectivity interface must already be installed on the client

machine. Thus any advantage of using Java applets in an intranet environment is lost, since the

deployment problems of traditional applications remain.

Type 2: Native-API/partly Java driver

JDBC driver type 2 -- the native-API/partly Java driver -- converts JDBC calls into database-

specific calls for databases such as SQL Server, Informix, Oracle, or Sybase. The type 2 driver

communicates directly with the database server; therefore it requires that some binary code be

present on the client machine.

Figure 2. Type 2: Native-API/partly Java driver

► Pros

Type 2 drivers typically offer significantly better performance than the JDBC-ODBC Bridge.

► Cons

The vendor database library needs to be loaded on each client machine. Consequently, type 2

drivers cannot be used for the Internet. Type 2 drivers show lower performance than type 3

and type 4 drivers.

Type 3: Net-protocol/all-Java driver

JDBC driver type 3 -- the net-protocol/all-Java driver -- follows a three-tiered approach whereby the

JDBC database requests are passed through the network to the middle-tier server. The middle-tier

server then translates the request (directly or indirectly) to the database-specific native-

connectivity interface to further the request to the database server. If the middle-tier server is

written in Java, it can use a type 1 or type 2 JDBC drivers to do this.

Figure 3. Type 3: Net-protocol/all-Java driver

Page 13: Technology Concepts

13

► Pros

The net-protocol/all-Java driver is server-based, so there is no need for any vendor database library

to be present on client machines. Further, there are many opportunities to optimize portability,

performance, and scalability. Moreover, the net protocol can be designed to make the client JDBC

driver very small and fast to load. Additionally, a type 3 driver typically provides support for features

such as caching (connections, query results, and so on).

► Cons

Type 3 drivers require database-specific coding to be done in the middle tier. Additionally,

traversing the recordSet may take longer, since the data comes through the backend server.

Type 4: Native-protocol/all-Java driver

The native-protocol/all-Java driver (JDBC driver type 4) converts JDBC calls into the

vendor-specific database management system (DBMS) protocol so that client applications can

communicate directly with the database server. Level 4 drivers are completely implemented in Java to

achieve platform independence and eliminate deployment administration issues.

Type 4: Native-protocol/all-Java driver

► Pros

Since type 4 JDBC drivers don't have to translate database requests to ODBC or a native

connectivity interface or to pass the request on to another server, performance is typically

quite good. Moreover, the native-protocol/all-Java driver boasts better performance than

types 1 and 2. Also, there's no need to install special software on the client or server.

Further, these drivers can be downloaded dynamically.

► Steps for getting connection Using JDBC

Page 14: Technology Concepts

14

1. Load the Driver.

2. Defines the Connection URL.

3. Establish the Connection.

4. Create a statement object.

5. Execute a query.

6. Process the results.

7. Close the Connection.

What is JDBC Driver interface?

The JDBC Driver interface provides vendor-specific implementations of the abstract classes provided

by the JDBC API. Each vendors driver must provide implementations of the java.sql.Connection,

Statement, PreparedStatement, CallableStatement, ResultSet and Driver.

What is DataSource and its advantages over DriverManager ?

A DataSource object is the representation of a data source in the Java programming

language. In basic terms, a data source is a facility for storing data.

Applications access a data source using a connection, and a DataSource object can be thought

of as a factory for connections to the particular data source that the DataSource instance

represents. The DataSource interface provides two methods for establishing a connection with a data

source.

Using a DataSource object is the preferred alternative to using the DriverManager for establishing a

connection to a data source. They are similar to the extent that theDriverManager class

and DataSource interface both have methods for creating a connection, methods for getting and

setting a timeout limit for making a connection, and methods for getting and setting a stream for

logging.

Their differences are more significant than their similarities, however.

- Unlike the DriverManager, a DataSource object has properties that identify and

describe the data source it represents.

- Also, a DataSource object works with a JavaTM Naming and Directory

InterfaceTM (JNDI) naming service and is created, deployed, and managed

separately from the applications that use it.

- A driver vendor will provide a class that is a basic implementation of

the DataSource interface as part of its JDBC 2.0 or 3.0 driver product.

- Being registered with a JNDI naming service gives a DataSource object two

major advantages over the DriverManager.

- First, an application does not need to hardcode driver information, as it does

with the DriverManager. A programmer can choose a logical name for the data

source and register the logical name with a JNDI naming service. The application

uses the logical name, and the JNDI naming service will supply

Page 15: Technology Concepts

15

the DataSource object associated with the logical name. The DataSource object

can then be used to create a connection to the data source it represents.

- The second major advantage is that the DataSource facility allows developers to

implement a DataSource class to take advantage of features like connection

pooling and distributed transactions.

o Connection pooling can increase performance dramatically by reusing

connections rather than creating a new physical connection each time a

connection is requested.

o The ability to use distributed transactions enables an application to do

the heavy duty database work of large enterprises.

Context ctx = new InitialContext();

DataSource ds = (DataSource)ctx.lookup("jdbc/AcmeDB");

Connection con = ds.getConnection("genius", "abracadabra");

What is Connection Pooling?

Connection pooling is a mechanism to solve the problem regarding DRIVER MANAGER

class, so in connection pooling we are using DataSource object ... that is used to stablished

the no of connection

Page 16: Technology Concepts

16

Core Java

What are Java Primitive Types?

Data Type Bits

byte 8

short 16

int 32

long 64

float 32

double 64

char 16

Boolean false

What is a class?

A class is the template or blueprint from which individual objects are actually created.

When you construct an object from a class you are said to have created an “instance” of the

class.

What is a Method?

A body of executable code that belongs to a class and that can be applied to (invoked on) a

specific object or class itself.

What is an Inheritance?

The Concept of extending a class to obtain another class is called “Inheritance”.

What is an Interface?

Definition 1: Interface is a way of describing “What” classes should do, without specifying “How”

they should do it.

Definition 2: Interface provide more sophisticated ways to organize and control objects in your

system.

Page 17: Technology Concepts

17

Difference between Interface and Abstract Class

1) Interface is used to “Implements”; whereas Abstract Class is used to “extends”.

2) Interface contains methods that must be abstract; whereas Abstract Class may contain both

abstract & non-abstract (Concrete) methods.

3) Interface contains variables that must be static and final; whereas Abstract Class may

contain non-final and final variables.

4) Interface Methods must NOT be “Static”.

5) Because Interface methods are abstract, they cannot be marked “final”, “strictfp” or

“native”; whereas Abstract Class cannot be marked as both “abstract and “final”.

6) Members in an Interface are public by default; whereas Abstract class may contain non-

public members

7) Interface can be used to achieve multiple inheritances; whereas Abstract class can be used

as Single Inheritance.

8) Interface can “extends” another Interface; whereas Abstract Class can “extends” another

class and “implements” multiple interface;

9) Interface is more flexible than Abstract Class because one class can only “extends” one

supler class, but “implements” multiple Interface.

10) An Interface having no methods is called a “Marker Interface”.

When we go for Abstract and Interfaces?

We go for Abstract when –

If we are having TWO classes, both classes need a method with same business logic (definition). Then

we can go for an abstract class. In this abstract class we can define the method with functionality.

And the two classes will extend this abstract class.

We go for Interface when –

In other case if two different classes want two different functionalities with same method name,

then we go for an interface with abstract declaration of method. And the two classes will implement

the interface and override the method with different business logic.

Determining Access to Class Members

Visibility Public Protected Default Private

From the same class Yes Yes Yes Yes

From any class in the same

package

Yes Yes Yes No

From a subclass in the same

package

Yes Yes Yes No

Page 18: Technology Concepts

18

From a subclass outside the same

package

Yes Yes, through

inheritance

No No

From any non-subclass class

outside the package

Yes No No No

What are overridden and Overloaded Methods?

Overridden Methods

The rules for overriding a method are as follows:

1. The argument list must exactly match that of the overridden method. If they don't match,

you can end up with an overloaded method you didn't intend.

2. The return type must be the same as, or a subtype of, the return type declared in the original

overridden method in the superclass. (More on this in a few pages when we discuss covariant

returns.)

3. The access level can't be more restrictive than the overridden method's.

4. The access level CAN be less restrictive than that of the overridden method.

5. Instance methods can be overridden only if they are inherited by the subclass. A subclass

within the same package as the instance's superclass can override any superclass method

that is not marked private or final. A subclass in a different package can override only those

non-final methods marked public or protected (since protected methods are inherited by the

subclass).

6. The overriding method CAN throw any unchecked (runtime) exception, regardless of whether

the overridden method declares the exception. (More in Chapter 5.)

7. The overriding method must NOT throw checked exceptions that are new or broader than

those declared by the overridden method. For example, a method that declares a

FileNotFoundException cannot be overridden by a method that declares a SQLException,

Exception, or any other non-runtime exception unless it's a subclass of

FileNotFoundException.

8. The overriding method can throw narrower or fewer exceptions. Just because an overridden

method "takes risks" doesn't mean that the overriding subclass' exception takes the same

risks. Bottom line: an overriding method doesn't have to declare any exceptions that it will

never throw, regardless of what the overridden method declares.

9. You cannot override a method marked final.

10. You cannot override a method marked static. We'll look at an example in a few pages when we

discuss static methods in more detail.

11. If a method can't be inherited, you cannot override it. Remember that overriding implies that

you're reimplementing a method you inherited! For example, the following code is not legal,

Page 19: Technology Concepts

19

and even if you added an eat() method to Horse, it wouldn't be an override of Animal's eat()

method.

public class TestAnimals {

public static void main (String [] args) {

Horse h = new Horse();

h.eat(); // Not legal because Horse didn't inherit eat()

} }

class Animal {

private void eat() {

System.out.println("Generic Animal Eating Generically");

} }

class Horse extends Animal { }

} }

Overloaded Methods

The rules are simple:

1. Overloaded methods MUST change the argument list.

2. Overloaded methods CAN change the return type.

3. Overloaded methods CAN change the access modifier.

4. Overloaded methods CAN declare new or broader checked exceptions.

5. A method can be overloaded in the same class or in a subclass.

a. In other words, if class A defines a doStuff(int i) method, the subclass B could

define a doStuff(String s) method without overriding the superclass version that

takes an int. So two methods with the same name but in different classes can still be

considered overloaded, if the subclass inherits one version of the method and then

declares another overloaded version in its class definition.

Legal Overloads

Let's look at a method we want to overload:

public void changeSize(int size, String name, float pattern) { }

The following methods are legal overloads of the changeSize() method:

public void changeSize(int size, String name) { }

public int changeSize(int size, float pattern) { }

public void changeSize(float pattern, String name) throws IOException { }

Page 20: Technology Concepts

20

How does Synchronization work?

Synchronization work with locks

There is one built-in lock per each java object

If one thread picks up the lock, no other thread can enter the synchronized code.

A method or a code block could be synchronized.

How does serialization work?

Serialization is nothing but save the object state in persistent media like database, files, etc.

Serialization works by converting the object to be saved into a stream of bytes and writing it

to a disk or a file.

ObjectOutputStream makes an object so that it can be converted as bytes and then it

connects to another stream FileOutputStream which makes bytes to be written to file.

Basically Serialization is used to maintain the state of an object

Serialization is needed in Remote Method Invocation.

What are the differences between AWT and Swing

AWT - Heavy weight component. Every graphical units it will invoke native methods.

AWT occupies more memory space unlike Swings which occupies less memory space.

SWING - Light weight component. It doesn't invoke native methods.

SWING is based on MVC architecture (Model view Controller) and that‟s why its look and feel is

independent of hardware and OS

Whereas AWT look and feel depends upon the platform.

How can you do multiple inheritance in Java

For getting multiple Inheritance, Java introduced the concept of interfaces. So we can create

a class by extending one class or we can implement any number of interfaces for it. But the

restriction is that we have to implement / describe every method existing in the interfaces

In java, multiple inheritance not supports, but using keyword 'implements', its allow to

inherits multiple interface separated by comma

What is reflection API? How are they implemented?

Reflection is a feature of the Java programming language. It allows an executing Java

program to examine or "introspect" upon itself, and manipulate internal properties of the

program.

Reflection is the process of introspecting the features and state of a class at runtime and

dynamically manipulate at run time. This is supported using Reflection API with built-in

classes like Class, Method, Fields, Constructors, etc.,

Page 21: Technology Concepts

21

What is heap in Java

Heap is the memory area where memory allocated to objects.

In Java, how are objects / values passed around

In Java Object are passed by reference and Primitive data is always pass by value.

What is phantom memory?

Phantom memory is false memory. Memory that does not exist in reality.

What are the other ways to create an object other than creating as new object?

String s= "hello" is a valid way.

What do you meant by private constructor? why somebody declare only private constructor?

You can have a single instance of the class at a time.

To implement singleton design pattern, you can declare a constructor private.

How HashTable is synchronized? Why HashMap is not synchronized? Can we make HashMap

synchronized?

HashTable is a legacy class. Every legacy class provides synchronization. We can make HashMap

synchronized but it calls extra method. HashMap is not synchronized but it part of collections and it

enter null values.

Explain the importance of "static" keyword?

Static keyword means only one copy per class if you have a static block or static method it will run

first then only other statements like constructor will run. It doesn‟t need an object to access its

method .Though u can access it using object you can access it using class names using object is

eliminated.

What are Utility Classes?

A utility class is a class which contains, at least, one non-private field or method.

BENEFITS

A utility class only contains "static" methods and "static" fields. Since the utility class is not designed

to be instantiated, all of the constructors should be "private".

What is the interface of thread?

Thread can be used in two ways

1. By implementing Runnable interface

2. By Extends Thread class

Page 22: Technology Concepts

22

What is the difference between Enumeration and Iterator?

The functionality of Enumeration interface is duplicated by the Iterator interface.

Enumeration and Iterator is that Iterator has a remove() method while Enumeration doesn't.

In Enumeration we can‟t modify the elements. where as in iterator we can modify the

elements.

What is synchronization and why is it important?

Synchronization is a process of letting one thread to access the method while all other

thread are waiting, which avoids deadlock.

Threads share monitor (critical section) and only one thread can have monitor at a time.

Hence synchronization is important so that no other thread attempt to hold the monitor.

What happens when a thread cannot acquire a lock on an object?

If a thread attempts to execute a synchronized method or synchronized statement and is

unable to acquire an object's lock, it enters the waiting state until the lock becomes available.

Why do threads block on I/O?

Threads block on I/O, that is enters the waiting state, so that other threads may execute

while the I/O Operation is performed.

What state does a thread enter when it terminates its processing

When a thread terminates its processing, it enters the dead state.

Thread states

Threads can be in one of the following states:

New. After the thread is instantiated, the thread is in the New state until the start()

method is invoked. In this state, the thread is not considered alive.

Runnable. A thread comes into the Runnable state when the start() method is invoked on it.

It can also enter the Runnable state from the running state or blocked state. The thread is

considered alive when it is in this state.

Running. A thread moves from the runnable state into the running state when the thread

scheduler chooses it to be the currently running thread.

Alive, but not runnable. A thread can be alive but not in a runnable state for a variety of

reasons. It may be waiting, sleeping, or blocked.

Waiting. A thread is put into a waiting state by calling the wait() method. A call to notify() or

notifyAll() may bring the thread from the waiting state into the Runnable

Page 23: Technology Concepts

23

state. The sleep() method puts the thread into a sleeping state for a specified amount of

time in milliseconds, as follows:

try { Thread.sleep(3 * 60 * 1000); // thread sleeps for 3 minutes }

catch(InterruptedException ex){}

Blocked. A thread may enter a blocked state while waiting for a resource like I/O or the lock

of another object. In this case, the thread moves into the runnable state when the resource becomes

available.

Dead. A thread is considered dead when its run() method is completely executed. A dead

thread can never enter any other state, not even if the start() method is invoked on it.

Important thread methods

The sleep() method causes the current thread to sleep for a given time in milliseconds:

public static void sleep(long millis) throws InterruptedException

The yield() method causes the current thread to move from the running state to the runnable state,

so that other threads may get a chance to run. However, the next thread chosen for running might not

be a different thread:

public static void yield()

The isAlive() method returns true if the thread upon which it is called has been started but not moved

to the dead state:

public final boolean isAlive()

When a thread calls join() on another thread, the currently running thread will wait until the thread it

joins with has completed:

void join()

void join(long millis)

void join(long millis, int nanos)

Creating threads

A thread can be defined by extending the java.lang.Thread class or by implementing the

java.lang.Runnable interface.

When the start() method is called, the thread moves from the new state to the runnable state. When

the Thread Scheduler gives the thread a chance to execute, the run() method will be invoked.

Page 24: Technology Concepts

24

If the run() method is called directly, the code in it is executed by the current thread and not

by the new thread.

class MyThread extends Thread {

public void run() { System.out.println("Inside run()");

} }

MyThread mt = new MyThread();

mt.start();

Implementing Runnable

To implement Runnable, you need to define only the run() method:

class MyRunnable implements Runnable {

public void run() {

System.out.println("Inside run()");

}

}

MyRunnable mc = new MyRunnable();

Thread t = new Thread(mc);

To start the thread, use the start() method as shown here:

t.start();

What are the differences between ArrayList and a Vector?

1. Vector is synchronized but ArrayList is not.

2. ArrayList will grow half the size what you initialize, where as vector will grow double the

initial size.

3. One more difference apart from this is Vector also stores the objects but ArrayList doesn't.

ArrayList also stores objects

4. In vector the data is retrieve through elementAt() method while in ArrayList through get()

5. The default size of ArrayList is 0 but for vector the default size is 10

6. Vector has two advantages, first they can dynamically grow and second its method are

synchronized. so if more then one object want to access your vector, no inconsistency will

appear

Page 25: Technology Concepts

25

7. In ArrayList we can store similar data types, but in Vector we can store different types of

data.

8. The main difference is that ArrayList is object of type Collection and it is not synchronized

while Vector is legacy class and synchronized

9. ArrayList list is static where we can‟t change the size of array. but where as vector is

dynamic whose size increases or shrink dynamically as the program data storage requirement

changes

10. ArrayList can hold any primitive data as well as data elements but a Vector can hold object

only. We need to cast the primitives data types using object wrappers. Vector can increase it

size by itself public (vector (int initialcapacity, int incrementcapacity).

11. ArrayList also synchronized using collections.SyncronizedList.(new ArrayList());

What is the difference between TreeSet & HashSet?

TreeSet

TreeSet implements Cloneable, Collection, Serializable, Set and SortedSet interfaces.

1. This class maintains order of the elements in it according to the natural order of the

elements which was missing in the HashSet.

2. TreeSet is not synchronized so if a TreeSet is concurrently accessed by threads

then thread modifying the contents must be synchronized externally.

3. We cannot insert element at a particular index and also cannot fetch element from a

particular index. This is done in List.

4. Duplicates are not allowed in TreeSet. This is a property of Sets. If you try to add

duplicate value, no exception will be thrown.

5. The objects are stored in sorted order and duplicates are not allowed.

HashSet

HashSet implements Cloneable, Collection, Serializable and Set interface.

1. Since HashSet implements Cloneable interface, it means that HashSet can use clone

() method to make a copy (field to field) of its object.

2. HashSet is also Serializable, so it can be saved on disk and then retrieved later for

use.

3. HashSet does not maintain order of the elements.

Page 26: Technology Concepts

26

4. Duplicates are not allowed in HashSet. This is a property of Sets. If you try to add

duplicate value, no exception will be thrown.

5. HashSet is synchronized.

6. If you use default HashSet constructor, it will create an empty HashSet of default

initial capacity (16) and load factor (0.75).

Many developers are confused about sets and ask when to use HashSet and when to use

TreeSet. Keep following points in mind for deciding the right set.

HashSet is much faster than TreeSet.

HashSet offers no ordering guarantees.

TreeSet is preferred when performing operations in the SortedSet.

HashSet can be tuned by specifying the right initial capacity using the constructor

HashSet (int initialCapacity).

HashSet can also be tuned using load factor parameter. If you choose right value for

this, it can boost the performance a bit but there won't be a big difference.

TreeSet has no tuning parameters.

LinkedHashSet

LinkedHashSet implements Cloneable, Collection, Serializable and Set interface.

1. No duplicates are allowed as It‟s a set

2. LinkedHashSet handles collisions by using hash-bucket approach to avoid linear probing and

rehashing.

3. It uses doubly-linked list to maintain the insertion order.

4. LinkedHashSet can accept the null entry and

5. LinkedHashSet is not synchronized.

Page 27: Technology Concepts

27

Servlet

What is a Servlet?

Servlets are Java technology‟s answer to Common Gateway Interface (CGI) programming. They are

programs that run on a Web server, acting as a middle layer between a request coming from a Web

browser or other HTTP client and databases or applications on the HTTP server.

Their job is to:

1. Read any data sent by the user.

2. Look up any other information about the request that is

3. Embedded in the HTTP request.

4. Generate the results.

5. Format the results inside a document.

6. Set the appropriate HTTP response parameters.

7. Send the document back to the client.

Difference between single thread and multi thread model Servlet

Typically, a Servlet class is instantiated the first time it is invoked. The same instance will be

used over several client requests, so all members that are declared in that Servlet are shared across

clients.

That is what is meant by multi threaded model, multiple clients that access the same instance.

There are situations where you want to protect your Servlet member variables from being

modified by different clients.

In this case, you can have your Servlet implement the marker interface SingleThreadModel.

Every time a client makes a request to a Servlet that implements this interface, the engine will create

a new instance of the Servlet.

For performance reasons, the engine can also maintain a instance pool, handing out instances

as they are needed. Or it could also serialize client requests, executing one after another.

What is request dispatcher and how does it work?

Request dispatcher is used to transfer the same request to another page/Servlet without user

interaction.

Exampe:

Suppose we have 2 servlets.

Write the below code in first Servlet

RequestDispatchet rd = request.getRequestDispatcher("/secondServlet");

rd.forward(request, response);

Page 28: Technology Concepts

28

//or rd.include(request, response);

Similar thing can be done in JSPs also

Write the below code in one.jsp

<js:forward page="two.jsp"/> or

<jsp:include page="two.jsp");

If we use "forward" then request will transferred to the second page but not returned back to first

page. We can see only the second page's output.

If we use "include" then the second page itself will be included in the first page. Then the output is

the combination of both the pages.

Difference between forward and sendRedirect?

When you invoke a forward request, the request is sent to another resource on the server,

without the client being informed that a different resource is going to process the request. This

process occurs completely with in the web container.

When a sendRedirect method is invoked, it causes the web container to return to the

browser indicating that a new URL should be requested. Because the browser issues a completely new

request any object that are stored as request attributes before the redirect occurs will be lost. This

extra round trip a redirect is slower than forward.

What are Servlet Filters?

Public interface Filter

A filter is an object that performs filtering tasks on either the request to a resource

(a Servlet or static content), or on the response from a resource, or both.

Filters perform filtering in the doFilter method. Every Filter has access to a

FilterConfig object from which it can obtain its initialization parameters, a reference to the

ServletContext which it can use, for example, to load resources needed for filtering tasks.

Filters are configured in the deployment descriptor of a web application.

Examples that have been identified for this design are

1) Authentication Filters

2) Logging and Auditing Filters

3) Image conversion Filters

4) Data compression Filters

5) Encryption Filters

6) Tokenizing Filters

7) Filters that trigger resource access events

8) XSL/T filters

Page 29: Technology Concepts

29

9) Mime-type chain Filter

What’s the point of JDOM (Java Document Object Model), and why do developers need it?

JDOM is an open source library for Java-optimized XML data manipulations. Although it‟s

similar to the World Wide Web Consortium‟s (W3C) DOM, it‟s an alternative document object model

that was not built on DOM or modeled after DOM.

The main difference is that while DOM was created to be language-neutral and initially used

for JavaScript manipulation of HTML pages, JDOM was created to be Java-specific and thereby take

advantage of Java‟s features, including method overloading, collections, reflection, and familiar

programming idioms.

For Java programmers, JDOM tends to feel more natural and “right”. It‟s similar to how the

Java-optimized remote method invocation library feels more natural than the language-neutral

Common Object Request Broker Architecture.

What are the differences between GET and POST service methods?

A GET request is a request to get a resource from the server. Choosing GET as the "method"

will append all of the data to the URL and it will show up in the URL bar of your browser. The amount

of information you can send back using a GET is restricted as URLs can only be 1024 characters.

A POST request is a request to post (to send) form data to a resource on the server.

A POST on the other hand will (typically) send the information through a socket back to the

WebServer and it won't show up in the URL bar. You can send much more information to the server

this way - and it's not restricted to textual data either. It is possible to send files and even binary

data such as serialized Java objects!

What is the actual difference between MVC and MVC Model2?

MVC1 is architecture which does not include struts frame work in it, whereas in case of MVC2

it includes struts frame work.MVC1 is called model1 and MVC2 is called model2.

A Model 1 architecture consists of a Web browser directly accessing Web-tier JSP pages.

The JSP pages access Web-tier JavaBeans that represent the application model, and the next view to

display (JSP page, Servlet, HTML page, and so on) is determined either by hyperlinks selected in the

source document or by request parameters. A Model 1 application control is decentralized, because

the current page being displayed determines the nextpage to display. In addition, each JSP page

or Servlet processes its own inputs (parameters from GET or POST). In some Model 1 architectures,

choosing the next page to display occurs in Scriptlet code, but this usage is considered poor form.

A Model 2 architecture introduces a controller Servlet between the browser and the JSP

pages or Servlet content being delivered. The controller centralizes the logic for dispatching requests

to the next view based on the request URL, input parameters, and application state. The controller

also handles view selection, which decouples JSP pages and Servlets from one another. Model 2

applications are easier to maintain and extend, because views do not refer to each other directly. The

Model 2 controller Servlet provides a single point of control for security and logging, and often

encapsulates incoming data into a form usable by the back-end MVC model. For these reasons, the

Model 2 architecture is recommended for most interactive applications.

Page 30: Technology Concepts

30

Java Server Pages (JSP)

What is a output comment?

A comment that is sent to the client in the viewable page source. The JSP engine handles an output

comment as uninterrupted HTML text, returning the comment in the HTML output sent to the client.

You can see the comment by viewing the page source from your Web browser.

JSP Syntax

<!-- comment [ <%= expression %> ] -->

Example 1

<!-- This is a comment sent to client on

<%= (new java.util.Date()).toLocaleString() %>

-->

Displays in the page source:

<!-- This is a comment sent to client on January 24, 2004 -->

What is a Hidden Comment?

Comments that documents the JSP page but is not sent to the client. The JSP engine ignores a hidden

comment, and does not process any code within hidden comment tags. A hidden comment is not sent to

the client, either in the displayed JSP page or the HTML page source. The hidden comment is useful

when you want to hide or "comment out" part of your JSP page.

You can use any characters in the body of the comment except the closing --%> combination. If you

need to use --%> in your comment, you can escape it by typing --%\>.

JSP Syntax

<%-- comment --%>

Examples

<%@ page language="java" %>

<html>

<head><title>A Hidden Comment </title></head>

<body>

<%-- This comment will not be visible to the colent in the page source --%>

</body>

</html>

What is a Expression?

An expression tag contains a scripting language expression that is evaluated, converted to a String,

and inserted where the expression appears in the JSP file. Because the value of an expression is

converted to a String, you can use an expression within text in a JSP file. Like

<%= someexpression %>

<%= (new java.util.Date()).toLocaleString() %>

You cannot use a semicolon to end an expression

Page 31: Technology Concepts

31

What is a Declaration?

A declaration declares one or more variables or methods for use later in the JSP source file. A

declaration must contain at least one complete declarative statement. You can declare any number of

variables or methods within one declaration tag, as long as they are separated by semicolons. The

declaration must be valid in the scripting language used in the JSP file.

<%! somedeclarations %>

<%! int i = 0; %>

<%! int a, b, c; %>

What is a Scriptlet?

A scriptlet can contain any number of language statements, variable or method declarations, or

expressions that are valid in the page scripting language.Within scriptlet tags, you can

1. Declare variables or methods to use later in the file (see also Declaration).

2. Write expressions valid in the page scripting language (see also Expression).

3. Use any of the JSP implicit objects or any object declared with a <jsp:useBean> tag.

4. You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet.

Scriptlets are executed at request time, when the JSP engine processes the client request. If the

scriptlet produces output, the output is stored in the out object, from which you can display it.

What are implicit objects? List them?

Certain objects that are available for the use in JSP documents without being declared first. These

objects are parsed by the JSP engine and inserted into the generated Servlet. The implicit objects re

listed below

Request Response

pageContext out

application session

Config Page

Exception

What are the different scope values for the <jsp:useBean>?

The different scope values for <jsp:useBean> are

1. Page

2. Request

3. Session

Page 32: Technology Concepts

32

Explain the life-cycle methods in JSP?

JSP lifecycle is somewhat diff that servlet life cycle. It includes four steps for the same.

jspInit: The container calls the jspInit() to initialize te servlet instance. It is called before

any other method, and is called only once for a servlet instance.

jspTransleted: used to translate the JSP into Servlet and in case of Tomcat server, that

translated Servlets goes in work directory.

_jspService: The container calls the _jspservice() for each request, passing it the request

and the response objects.

jspDestory: The container calls this when it decides take the instance out of service. It is

the last method called in the Servlet instance.

How do I prevent the output of my JSP or Servlet pages from being cached by the browser?

You will need to set the appropriate HTTP header attributes to prevent the dynamic content output

by the JSP page from being cached by the browser. Just execute the following scriptlet at the

beginning of your JSP pages to prevent them from being cached at the browser. You need both the

statements to take care of some of the older browser versions.

<%

response.setHeader("Cache-Control","no-store"); //HTTP 1.1

response.setHeader("Pragma","no-cache"); //HTTP 1.0

response.setDateHeader ("Expires", 0); //prevents caching at the proxy server

%>

How can I implement a thread-safe JSP page?

You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This

is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.

How does JSP handle run-time exceptions?

You can use the errorPage attribute of the page directive to have uncaught runtime exceptions

automatically forwarded to an error processing page.

For example:

<%@ page errorPage="error.jsp" %>

redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during

request processing. Within error.jsp, if you indicate that it is an error-processing page, via the

directive:

<%@ page isErrorPage="true" %>

The Throwable object describing the exception may be accessed within theerror page via the

exception implicit object.

Note: You must always use a relative URL as the value for the errorPage attribute.

Page 33: Technology Concepts

33

How are the implicit object made available in the JSP file? Where are they defined?

There are nine implicit variables in JSP:

1. Request 2. Response

3. pageContext 4. out

5. application 6. session

7. Config 8. Page

9. exception

The objects that these variables refer created by servlet container and are call implicit Objects:

They are as follows:

i. ServletContex

ii. HttpSession

iii. HttpServletRequest

iv. HttpServetResponse

v. JspWriter

vi. ServletConfig

vii. Object

In _jspService() method of generated Servlet of JSP you can implicitly find these variables

What is the difference between JSP forward and servlet forward methods?

„JSP forward‟ forwards the control to another resource available in the same web application on the

same container.

Whereas „Servlet forward‟ forwards the control to another resource available in the same web

application or different web app on the same container.

What is the difference between PAGE, APPLICATION and SESSION implicit objects of JSP?

Page: object will be available with in page if we move another page the object will not available.

Session: object will be available with in the session (session time out will available in web.xml) after

the session time out object will not available.

Application: object will be available until we stop the server.

What is the Difference between sendRedirect() and Forward?

Forward Request - When we invoke a forward request it is sent to another resource on the server

itself, without the client being informed that a different resource is going to process the request.

The process occurs completely within the web container.

Page 34: Technology Concepts

34

Send-Redirect - When this method is invoked, it causes the web container to return to the browser

indicating that a new URL is requested. Process does not occur just within web container.

Because the browser issues completely new request any object value that are stored

as request attributes are lost in case of Send Redirect but forward retains that, and because of the

extra round trip redirect is slower than the forward.

Page 35: Technology Concepts

35

Web Service

Evolution of Web Services

Web services technology has made it easier to make applications and systems available across a

company and also to be utilized by partners outside the company‟s firewall.

The first phase of evolution of Web services was to establish the foundation for the

description,

publishing, and

Sharing of Web services.

This included the implementation of

Internet transport protocols (HTTP and SMTP for example),

Data Models (based on XML),

Messages exchanged (using SOAP),

The description of service operations and

Types (using WSDL,) and

Publishing and discovery of services (using UDDI).

None of these core Web service specifications (SOAP, WSDL, UDDI, etc) were designed to provide

mechanisms by themselves for describing how individual Web services can be connected to create

reliable and dependable business solutions with the appropriate level of complexity, this is where BPEL

came in.

IBM teamed with Microsoft, BEA and others to develop and propose a Business Process Execution

Language for Web Services, a new specification that replaced earlier approaches by IBM and

Microsoft.

Design of WS & BPEL was to

Design

Integrate

Execute

Manage

Page 36: Technology Concepts

36

What is Web Service?

A Web service is a method of communication between two electronic devices over a network.

The W3C defines a "Web service" as "a software system designed to support interoperable machine-

to-machine interaction over a network. It has an interface described in a machine-processable format

(specifically Web Services Description Language WSDL).

WSDL Abstract

WSDL stands for Web Services Description Language

WSDL is an XML based protocol for information exchange in decentralized and distributed

environments.

WSDL is the standard format for describing a web service.

WSDL definition describes how to access a web service and what operations it will perform.

WSDL is a language for describing how to interface with XML-based services.

WSDL is an integral part of UDDI, an XML-based worldwide business registry.

WSDL is the language that UDDI uses.

WSDL was developed jointly by Microsoft and IBM.

WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'

Page 37: Technology Concepts

37

Sample W-S-D-L Document

Page 38: Technology Concepts

38

WSDL Elements described

A WSDL document has various elements, but they are contained within these three main

elements, which can be developed as separate documents and then they can be combined or reused to

form complete WSDL files.

Following are the elements of WSDL document. Within these elements are further

subelements, or parts:

Element Name Description

Definition Element must be the root element of all WSDL documents. It defines the name

of the web service, declares multiple namespaces used throughout the

remainder of the document, and contains all the service elements described

here

<!-- Abstract Definitions -- ->

Data types The <types> element defines the data types that are used by the web service.

(OR)

A container for abstract type definitions defined using XML Schema

Message The <message> element defines the data elements of an operation (OR)

A definition of an abstract message that may consist of multiple parts, each

part may be of a different type

Operation The abstract definition of the operation for a message.

Such as naming a method, message queue, or business process, which will

accept and process the message.

Port Type An abstract set of operations supported by one or more endpoints (commonly

known as an interface); operations are defined by an exchange of messages (OR)

An abstract set of operations mapped to one or more end points, defining the

collection of operations for a binding; the collection of operations, because it is

abstract, can be mapped to multiple transports through various bindings

<!-- Concrete Definitions -- ->

Binding A concrete protocol and data format specification for the Operation &

messages defined for a particular portType

Page 39: Technology Concepts

39

Port A combination of a binding and a network address, providing the target address

of the service communication.

Service A collection of related endpoints, where an endpoint is defined as a combination

of a binding and an address (URI)

Patterns of Operation / Message Exchange Patterns

MEP Description (w.r.t end-point) Grammer for Operations

One-way The endpoint receives a message. <wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken">

<wsdl:input name="nmtoken"?

message="qname"/>

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Request-

response

The endpoint receives a message and sends a

response / message.

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken"

parameterOrder="nmtokens">

<wsdl:input name="nmtoken"?

message="qname"/>

<wsdl:output name="nmtoken"?

message="qname"/>

<wsdl:fault name="nmtoken"

message="qname"/>*

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Page 40: Technology Concepts

40

Solicit-

response

The endpoint sends a message and receives a

response / message.

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken"

parameterOrder="nmtokens">

<wsdl:output name="nmtoken"?

message="qname"/>

<wsdl:input name="nmtoken"?

message="qname"/>

<wsdl:fault name="nmtoken"

message="qname"/>*

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Notification The endpoint sends a message. <wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken">

<wsdl:output name="nmtoken"?

message="qname"/>

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Page 41: Technology Concepts

41

WSDL and UDDI

Universal Description, Discovery and Integration (UDDI) is a directory service where businesses can

register and search for Web services.

What is UDDI

UDDI is a platform-independent framework for describing services, discovering businesses, and

integrating business services by using the Internet.

UDDI stands for Universal Description, Discovery and Integration

UDDI is a directory for storing information about web services

UDDI is a directory of web service interfaces described by WSDL

UDDI communicates via SOAP

UDDI is built into the Microsoft .NET platform

What is UDDI Based On?

UDDI uses World Wide Web Consortium (W3C) and Internet Engineering Task Force (IETF) Internet

standards such as XML, HTTP, and DNS protocols.

UDDI uses WSDL to describe interfaces to web services

Additionally, cross platform programming features are addressed by adopting SOAP, known as XML

Protocol messaging specifications found at the W3C Web site.

UDDI Benefits

Any industry or businesses of all sizes can benefit from UDDI.

Before UDDI, there was no Internet standard for businesses to reach their customers and partners

with information about their products and services. Nor was there a method of how to integrate into

each other's systems and processes.

Problems the UDDI specification can help to solve:

Making it possible to discover the right business from the millions currently online

Defining how to enable commerce once the preferred business is discovered

Reaching new customers and increasing access to current customers

Expanding offerings and extending market reach

Solving customer-driven need to remove barriers to allow for rapid participation in the global

Internet economy

Describing services and business processes programmatically in a single, open, and secure

environment

Page 42: Technology Concepts

42

How can UDDI be used

If the industry published an UDDI standard for flight rate checking and reservation, airlines could

register their services into an UDDI directory. Travel agencies could then search the UDDI directory

to find the airline's reservation interface. When the interface is found, the travel agency can

communicate with the service immediately because it uses a well-defined reservation interface.

Who is Supporting UDDI?

UDDI is a cross-industry effort driven by all major platform and software providers like Dell, Fujitsu,

HP, Hitachi, IBM, Intel, Microsoft, Oracle, SAP, and Sun, as well as a large community of marketplace

operators, and e-business leaders.

Over 220 companies are members of the UDDI community.

Page 43: Technology Concepts

43

Business Process Execution Language (BPEL)

What is BPEL?

BPEL (Business Process Execution Language) is an orchestration language for automating

business processes. The Oracle BPEL Process Manager is an implementation of BPEL.

Definition 1

BPEL provides an orchestration engine for describing exchanges of information internally or

externally (in an enterprise).

BPEL deals explicitly with the functional aspects of business processes:

Control flow (Branch, Loop, Parallel),

Asynchronous conversations and correlation,

Long running nested units of work, and

Faults and compensation.

Definition 2

BPEL is an XML-based language for enabling task sharing across multiple enterprises using a

combination of Web services.

BPEL is based on the

- XML schema,

- Simple object access protocol (SOAP), and

- Web services description language (WSDL).

BPEL provides enterprises with an industry standard for business process orchestration and

execution.

Using BPEL, you design a business process that integrates a series of discrete services into an end-to-

end process flow.

This integration reduces process cost and complexity.

What is a Workflow?

Workflow is about the structure of interaction between various participants, with dependencies among

tasks, and the rules and the routes between them, and all the conditions for when tasks are initiated

and advanced to the next step or rolled back.

Page 44: Technology Concepts

44

What is an Oracle BPEL Process Manager (OBPM)?

Formerly known as Collaxa BPEL Server

OBPM is a run-time environment for BPEL processes.

OBPM is one of the most complete BPEL servers available.

BPEL Process Manager is developed in Java and runs on a J2EE-compliant application server,

OC4J Server.

Architecture of the BPEL Process Manager

The Oracle BPEL Process Manager has four major parts:

BPEL Designer

BPEL Console

BPEL Server

Database

Core BPEL Engine Supports

The core BPEL engine is the run-time environment where the BPEL processes are deployed and

executed.

Core BPEL Engine

Integration Services

WSDL Bindings

Page 45: Technology Concepts

45

WS-Addressing

BPEL compensating transaction model

Version control

o This enables us to develop several versions of a business process and

deploy them side by side.

o Having an effective versioning support simplifies the management

Dehydration

o While waiting for the response the Oracle engine can store the process

(and its state) in the database, thus freeing up server resources. This is

called dehydration.

Clustering

o It increases server reliability because fail-over can be configured on

the engine

o Clustering also improves scalability with load balancing.

WSDL Bindings

The WSDL binding framework is responsible for communication with the BPEL processes deployed on

the server.

Oracle BPEL Server even enables connectivity using protocols

- SOAP

- EJBs

- JMS (Java Message Service)

- JCA (Java Connector Architecture)

- WSIF

Integration Services

Business processes described in BPEL communicate with web services and exchange XML

documents.

BPEL Console

Through BPEL Console we can deploy, manage, administer, and debug BPEL processes. The most

important features of the BPEL Console include:

Visual process flows

Audit trails

Page 46: Technology Concepts

46

Debugging view of processes

Process history

What are BPEL Activities?

Assign Activity

This activity provides a method for data manipulation, such as copying the contents of one

variable to another.

Compensate Activity

This activity invokes compensation on an inner scope activity that has already successfully

completed. This activity can be invoked only from within a fault handler or another compensation

handler. Compensation occurs when a process cannot complete several operations after already

completing others. The process must return and undo the previously completed operations.

For example, assume a process is designed to book a rental car, a hotel, and a flight. The

process books the car and the hotel, but is unable to book a flight for the correct day. In this case,

the process performs compensation by un-booking the car and the hotel. The compensation handler is

invoked with the compensate activity, which names the scope on which the compensation handler is to

be invoked.

Empty Activity

This activity enables you to insert a no-operation instruction into a process.

Page 47: Technology Concepts

47

What are Structured Activities?

Structured activities are used for composing basic activities

<sequence>, <switch>, and <while> support sequential control

<flow> allows concurrency and synchronization

<pick> allows choices based on external events

Sequence, Switch, While

<sequence> packages sequential control flow activities the contained activities can be

basic or structures activities.

<switch> operates based on some condition the condition contains an expression operating

on a variable there may be any number of case branches there may be an otherwise

branch.

<while> conditionally executes activities .

Flow Activity

<flow> specifies concurrent activities.

The flow completes when all activities did complete.

Flows may contain synchronization dependencies.

This is the construct that enables BPEL processes to be graphs rather than trees.

Synchronization uses <link> elements to connect activities

Pick Activity

<pick> waits for events

o one possibility for an event is message arrival (by a partner)

o the other possibility is the expiration of a timer

Pick chooses exactly one of the specified activities.

Pick can also be used for instance creation

Page 48: Technology Concepts

48

o a business process specifies that it starts upon arrival of a set of messages.

o only one of these messages is sufficient to start the process.

o another message will then start a new instance of the business process.

PartnerLink

A partner link enables you to define the external services with which the BPEL process is to interact.

Partner Link Type: The partner link defined in the WSDL file.

Partner Type: The role performed by the partner link (in this example, the

CreditRatingService service).

In this case, CreditRatingService is the provider.

My Role: The role performed by the BPEL process.

In this case, the BPEL process does not have a role because it is a synchronous

process.

Partner link types in asynchronous services have two roles: one for the Web service

provider and one for the client requester.

Synchronous Web Service

Synchronous Web services provide an immediate response to a query.

BPEL can connect to synchronous Web services through a partner link, send data, and

then receive the reply using a synchronous callback.

For synchronous callbacks, only one port is needed for both the send and receive

functions.

Page 49: Technology Concepts

49

Asynchronous Web Service

Asynchronous messaging styles are very useful for environments in which a service,

can take a long time to process a client request. Asynchronous services also provide a more

reliable fault-tolerant and scalable architecture than synchronous services.

Partner Link Property

Transient processes:

This process type does not incur any intermediate dehydration points during process

execution. If there are unhandled faults or there is system downtime during process execution, the

instances of a transient process do not leave a trace in the system. Instances of transient processes

cannot be saved in-flight (whether they complete normally or abnormally).

Transient processes are typically short-lived, request-response style processes. The

synchronous process you design in Oracle JDeveloper is an example of a transient process.

Durable processes:

This process type incurs one or more dehydration points in the database during execution

because of the following activities:

Receive activity

OnMessage branch in a pick activity

OnAlarm branch in a pick activity

Wait activity

Instances of durable processes can be saved in-flight (whether they complete

normally or abnormally). These processes are typically long-living and initiated through a one-

way invocation. Because of out-of-memory and system downtime issues, durable processes

cannot be memory-optimized.

Page 50: Technology Concepts

50

idempotent

An idempotent activity is an activity that can be re-tried (for ex: an assign activity or an

invoke activity). Oracle BPEL Server saves the instance after a non-idempotent activity. This property

is applicable to both durable and transient processes.

A BPEL invoke activity is by default an idempotent activity, meaning that the BPEL process

does not dehydrate instances immediately after invoke activities. Therefore, if idempotent is set to

true and Oracle BPEL Server fails right after an invoke activity executes, Oracle BPEL Server

performs the invoke again after restarting. This is because no record exists that the invoke activity

has executed. This property is applicable to both durable and transient processes.

If idempotent is set to false, the invoke activity is dehydrated immediately after execution

and recorded in the dehydration store. If Oracle BPEL Server then fails and is restarted, the invoke

activity is not repeated, because Oracle BPEL Process Manager sees that the invoke already executed.

When idempotent is set to false, it provides better failover protection, but at the cost of

some performance, since the BPEL process accesses the dehydration store much more frequently.

This setting can be configured for each partner link in the bpel.xml file.

Setting this parameter to true can significantly improve throughput. However, as mentioned

previously, you must ensure that the partner's service can be safely retried in the case of a server

failure. Some examples of where this property can be set to true are read-only services (for example,

CreditRatingService) or local EJB/WSIF invocations that share the instance's transaction.

Values

False: activity is dehydrated immediately after execution and recorded in the dehydration

store.

True (default): If Oracle BPEL Server fails, it performs the activity again after restarting.

This is because the server does not dehydrate immediately after the invoke and no record

exists that the activity executed. Some examples of where this property can be set to True

are: read-only services (for example, CreditRatingService) or local EJB/WSIF invocations

that share the instance's transaction.

nonBlockingInvoke

By default, Oracle BPEL Process Manager executes in a single thread, executing the branches

sequentially instead of in parallel. When this property is set to True, the process manager creates a

new thread to perform each branch's invoke activity in parallel. This property is applicable to both

durable and transient processes.

Page 51: Technology Concepts

51

Consider setting this property to True if you have invoke activities in multiple flow or flow n

branches. This is especially effective if the parallel invoke activities are two-way, but some benefits

can be realized for parallel one-way invokes as well.

Values:

This property has the following values:

True: Oracle BPEL Server spawns a new thread to execute the invocation.

False (default): Oracle BPEL Server executes the invoke activity in the single process

thread.

completionPersistLevel (for Transient Processes)

This property controls the type (and amount) of data to save after instance completion.

When process instances complete, Oracle BPEL Server by default saves the final state (for

example, the variable values) of the process. If you do not need to save these values after completion,

you can set this property to save only instance metadata (completion state, start and end dates, and

so on). This property is applicable to transient BPEL processes.

This property is used only when the inMemoryOptimization performance property is set to

true. Use the completionPersistLevel property in conjunction with the completionPersistPolicy

property.

This property can greatly impact database growth (in particular, the cube_instance, cube_scope, and

work_item tables). It can also impact throughput (due to reduced I/O).

Values:

This property has the following values:

all (default): Oracle BPEL Server saves the complete instance, including the final

variable values, work item data, and audit data. This setting causes the database to grow in

size.

instanceHeader: The Oracle BPEL Process Manager saves only the instance

metadata.

<BPELSuitcase> <BPELProcess src="HelloWorld.bpel" id="HelloWorld"> ... <configurations> <property name="inMemoryOptimization">true</property> <property name="completionPersistPolicy">faulted</property> <property name="completionPersistLevel">All</property> </configurations> </BPELProcess> </BPELSuitcase>

Page 52: Technology Concepts

52

completionPersistPolicy (for Transient Processes)

This property controls if and when to persist instances. If an instance is not saved, it does

not appear in Oracle BPEL Control. This property is applicable to transient BPEL processes.

This property is only used when inMemoryOptimization is set to true. If you set

completionPersistPolicy to a value other then off, you can then set completionPersistLevel to more

finely tune the persistence data to save.

This parameter strongly impacts the amount of data stored in the database (in particular, the

cube_instance, cube_scope, and work_item tables). It can also impact throughput.

Values:

This property has the following values:

On (default): Completed instances are saved normally.

deffered: Completed instances are saved with a different thread and in another

transaction. If a server fails, some instances may not be saved.

faulted: Only faulted instances are saved.

off: No instances (and their data) are saved.

<BPEL Suitcase> <BPELProcess src="HelloWorld.bpel" id="HelloWorld"> . . . <configurations> <partnerLinkBinding name="PartnerService"> <property name="inMemoryOptimization">true</property> <property name="completionPersistPolicy">deferred</property> </partnerLinkBinding> </configurations> </BPELProcess> </BPEL Suitcase>

inMemoryOptimization (for Transient Processes)

This property indicates to Oracle BPEL Server that this process is a transient process and

dehydration of the instance is not required. When set to True, the completionPersistPolicy is used to

determine persistence behavior. This property can only be set to True for transient processes or

processes that do not contain any dehydration points such as receive, wait, onMessage and onAlarm

activities. The inMemoryOptimization property is set at the BPEL component level.

Values:

This property has the following values:

False (default): instances are persisted completely and recorded in the dehydration

store database.

True: The CompletionPersistPolicy is used to determine persistence behavior.

Page 53: Technology Concepts

53

Fault Handling

Fault handling allows a BPEL process to handle error messages or other exceptions returned

by outside Web services, and to generate error messages in response to business or run-time faults.

BPEL Standard Faults

The Business Process Execution Language for Web Services Specification defines the following

standard faults in the namespace of http://schemas.xmlsoap.org/ws/2003/03/business-process/:

selectionFailure

conflictingReceive

conflictingRequest

mismatchedAssignmentFailure

joinFailure

forcedTermination

correlationViolation

uninitializedVariable

repeatedCompensation

invalidReply

Standard faults are defined as follows:

Typeless, meaning they do not have associated messageTypes

Not associated with any WSDL message

Caught without a fault variable:

o <catch faultName="bpws:selectionFault">

Categories of BPEL Faults

A BPEL fault has a fault name called a Qname (name qualified with a namespace) and a possible

messageType. There are two categories of BPEL faults:

Business faults

Run-time faults

Page 54: Technology Concepts

54

Business Faults

Business faults are application-specific faults that are generated when there is a problem

with the information being processed (for example when a social security number is not found in the

database).

A business fault occurs when an application executes a throw activity or when an invoke

activity receives a fault as a response. The fault name of a business fault is specified by the BPEL

process. The messageType, if applicable, is defined in the WSDL.

A business fault can be caught with a faultHandler using the faultName and a faultVariable.

<catch faultName="ns1:faultName" faultVariable="varName">

Run-time Faults

Run-time faults are the result of problems within the running of the BPEL process or Web service (for

example, data cannot be copied properly because the variable name is incorrect).

These faults are not user-defined, and are thrown by the system.

They are generated

if the process tries to use a value incorrectly,

a logic error occurs (such as an endless loop),

a SOAP fault occurs in a SOAP call, an exception is thrown by Oracle BPEL Server, and so on.

Oracle BPEL Server includes several run-time faults. These faults are included in the

http://schemas.oracle.com/bpel/extension namespace. These faults are associated with the

messageType RuntimeFaultMessage.

The following WSDL file defines the messageType:

<?xml version="1.0" encoding="UTF-8" ?> <definitions name="RuntimeFault" targetNamespace="http://schemas.oracle.com/bpel/extension" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="RuntimeFaultMessage"> <part name="code" type="xsd:string" /> <part name="summary" type="xsd:string" /> <part name="detail" type="xsd:string" /> </message> </definitions>

If a faultVariable (of messageType RuntimeFaultMessage) is used when catching the fault, the fault

code can be queried from the faultVariable, along with the fault summary and detail.

Page 55: Technology Concepts

55

Transactions in BPEL

XA (Distributed Transaction Processing) and non-XA Transactions

An XA transaction, in the most general terms, is a "global transaction" that may span multiple

resources. A non-XA transaction always involves just one resource.

An XA transaction involves a coordinating transaction manager, with one or more databases

(or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no

transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes

called local transactions).

XA transactions come from the X/Open group specification on distributed, global

transactions. JTA includes the X/Open XA spec, in modified form.

Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application

talking to a single database. XA gets involved when you want to work with multiple resources - 2 or

more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a

single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss

acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP,

whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across

the many resources. When you say "commit", the results are commited across all of the resources.

When you say "rollback", _everything_ is rolled back across all resources.

The Transaction Manager coordinates all of this through a protocol called Two Phase Commit

(2PC). This protocol also has to be supported by the individual resources.

In terms of datasources, an XA datasource is a data source that can participate in an XA

global transaction. A non-XA datasource generally can't participate in a global transaction (sort of -

some people implement what's called a "last participant" optimization that can let you do this for

exactly one non-XA item).

For more details - see the JTA pages on java.sun.com. Look at the XAResource and Xid

interfaces in JTA. See the X/Open XA Distributed Transaction specification. Do a google source on

"Java JTA XA transaction".

Page 56: Technology Concepts

56

Oracle Service Bus (OSB) & Mediator

Oracle Service Bus (OSB)

Previously known as BEA Aqualogic Service Bus (ALSB)

Oracle‟s Primary Service Bus

The preferred platform for service virtualization and interactions external to the SOA Suite

Currently OSB is only available on Weblogic server but the intention is provide it on other

platforms as well in the future.

OSB is the foundation of service bus functionality moving forward

Can be use independently, without SOA Suite

Page 57: Technology Concepts

57

BPEL Vs. OSB / Mediator

BPEL OSB / Mediator

Primarily for Stateful and long running processes Stateless Messaging

Orchestrating Service Calls Value Mapping and Cross_Reference Tables for

supporting Canonical datamodels

Implementation of Composite Services Implementation of VETRO Pattern

Validate

Enrich

Transform

Route

Operate

Integration of Rules Engine and Human Workflow ---

Instance Monitoring

OSB Vs. Mediator

Mediator OSB

The „tiny‟, „light weight‟ service bus. The larger, powerful service bus

Limited to simple mediator functionality for the

implementation of the VETRO pattern

Validate

Enrich

Transform

Route

Operate

Extended functionality important for enterprise-

wide integration like

Message Throttling

Service Pooling

Reliable Messaging

Development through JDeveloper IDE. Development through Eclipse IDE or Web Console

Message Transform with XSLT Message Transformation over XQuery & XSLT

Can be used and deployed as a SCA Component OSB specific deployment

Value Mapping and Cross-Reference Table for ---

Page 58: Technology Concepts

58

Supporting the canonical datamodel.

Event Delivery Network for Publish-Subscribe

semantic.

---

OSB: Service Pooling

Routing to active endpoints, service load balancing

Option for the system to automatically take non-responsive URI‟s out of the pool, and put

them back in as they become responsive.

Alerts, will be generated when the status of the endpoint changes from UP - DOWN and

vice versa.

When should be use Mediator & Oralce Service Bus?

Both Mediator 11g and Oracle Service Bus implements ESB functionally well.

The decision which service to use, can be taken

o Based on the required and supported features.

o Based on the information, if the SOA Suite 11g with all the other components

like BPEL, Rules, Human Workflow, etc. is needed as well or if only a standalone

ESB is necessary.

If other components of SOA Suite 11g are needed => Mediator more likely

If standalone ESB is needed => Oracle Service Bus more likely

In a large and Complex SOA it makes sense to combine the two via the Federated Bus

pattern

o i.e., using both the Mediator and Oracle Service Bus.

Page 59: Technology Concepts

59

Service Oriented Architecture (SOA)

What is SOA?

Definition 1

SOA is a systems development and integration method for grouping functionality around business

processes packaged as interoperable services for constructing complex software-intensive systems.

Through the choice of a Service Oriented Architecture (SOA)-based approach over

traditional methods, organizations can achieve reusability, greater efficiency, responsiveness and

adaptability.

OR

Service-oriented architecture (SOA) is a flexible set of design principles used during the phases of

systems development and integration in computing. A system based on a SOA will package functionality

as a suite of interoperable services that can be used within multiple separate systems from several

business domains.

Definition 2

SOA is not about projects, not about products and not about creating webservices...

SOA is about having an architecture style in the enterprise that revolves around business services.

Implementing business processes that are nothing but a set of business services coupled loosely to

realize a business use-case.

processes that are nothing but a set of business services coupled loosely to realize a business use-

case.

Page 60: Technology Concepts

60

Service Component Architecture (SCA)

What is SCA?

Service Component Architecture is a model for building applications and systems using a Service-

Oriented Architecture.