Solved

JCA - Adapter pattern

Posted on 2006-11-25
7
242 Views
Last Modified: 2008-02-26
Java connector Architecture follows Adapter pattern.

Any explanation on how this occurs with sample code would be helpful

simple explanation in laymans terms plzz!

thanks
J
0
Comment
Question by:jaggernat
  • 4
  • 3
7 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 465 total points
ID: 18013587
These are 2 key features adapter provides:
    1. Allows two or more previously incompatible objects to interact.
    2. Allows reusability of existing functionality.


JCA allows you to interact with the database, other resources seamlessly. The JCA interface is defined but the actual source may not follow that. So in order to make it work, we the source defines an adapter that interacts with the source.
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18014490
I get the thoery. simple example code would help.

thanks
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18014621
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Author Comment

by:jaggernat
ID: 18014651
we have a adaptor class, a client and an adaptee.
the client is trying to call an adaptee which is modified by the adaptor. right?
not exactly sure what the role of client and the adaptee is.

0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18014873
> the client is trying to call an adaptee which is modified by the adaptor. right?
Yes

> not exactly sure what the role of client and the adaptee is.
client has an interface and adapter doesn't follow that interface. In order to interact with the client, adapter follows the client interface and modify the adpatee (calls its methods) when client wants to do something.
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18014926
In Adapter pattern , an adapter wraps a class(target class) in such a way that the client class can call the adaptor to use the target class.
Client --> Adapter/ wrapper class --> Adaptee ( target).
So the client doesnt calls the target object(adaptee) which is an direclty, but invokes the adaptee through the Adapter.


above is my description of adapter pattern. Is it right?
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18017108
yes
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Updating Java 9 87
pairstar challenge 2 42
XML Paring  Error - Premature end of file. 7 56
for i loop in grovy 1 32
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now