SlideShare a Scribd company logo
1 of 17
Download to read offline
1
Making it Happen with
J2EE
Russell Castagnaro
Chief Mentor
4Charity.com
russell@4charity.com
Introduction
zPresenter
yRussell Castagnaro
yChief Mentor
x4Charity.com
xSyncTank Solutions, Inc
yrussell@4charity.com
yExperience
Introduction
z4Charity.com
yApplication Service Provider for the Non-
Profit industry
yPure Java development
yHttp://www.4charity.com
yLocations:
x San Francisco,CA
x Honolulu, HI
yWe’re Hiring…
2
Presentation Goals
zBrief overview of the J2EE API
zDiscuss various application architectures
zExplain when each API should be used
zMost examples use BEA’s Weblogic Server
What is the J2EE?
zJava2 Enterprise Edition
zA set of Eleven Application Programming
Interfaces (API) that provide a standard
way to solve common issues.
zDelivers on the promise of Standards-
based heterogeneous applications
development.
The J2EE API’s
zDatabase Connectivity (JDBC)
zRemote Method Protocol (RMP/ RMI)
zNaming and Directory Interface (JNDI)
zServlets and Server Pages (JSP)
zMessaging (JMS)
zTransaction Services (JTS/ JTA)
3
The J2EE API’s
zCORBA Communication (IIOP/ CORBA)
zMail (Mail and JAF)
zEnterprise Beans (EJB)
zExtensible Markup Language (XML / XSL)
The J2EE API’s
Java Database
Connectivity
zThe first of the J2EE API’s.
zProvides a standard set of interfaces to
access any compliant data source.
zImproved upon ODBC standard.
zSQL 92 compliant.
4
Remote Method Protocol
Remote Method Interface
zCommunication protocol between Java
objects on separate Virtual Machines
(JVM).
zEnables distributed communications with
no knowledge of networking or sockets.
zMakes remote objects seem local.
zUses Java Serialization to send objects
across a network.
Java Naming & Directory
Interface
zSimple interface that allows for resource
discovery and binding.
zA way to ‘look up’ an object locally or
remotely.
zA way to enter objects into a directory of
objects.
zOther interfaces leverage JNDI (i.e.
LDAP).
Java Servlets
zJava access to network (HTTP) requests
and responses.
zIntegration with a Web Server via a
Servlet Engine.
zImproved performance over CGI.
z70% of successful Java projects are
Servlet-based!
5
Java Sever Pages
zBuilds on the Servlet API.
zProvides a “pure” presentation-layer
templating mechanism.
zAllows HTML coders to write HTML, not
the Java Programmers.
Java Messaging Service
zAsynchronous messaging between de-
coupled components.
zDefines the Message Oriented
Middleware interface for Java
applications.
zSupports:
yGuaranteed Message Delivery
yPoint-to-point messaging
yPublish/ Subscript messaging
Java Transaction Services
z JTS uses the Java Transaction Architecture
(JTA) to monitor and access all transactions
that take place in a given system.
z Implements the OMG Object Transaction
Service (OTS) definition.
z Defines the interfaces between :
yTransaction Manager
yApplication
yApplication Server
yResource (Database Management System)
6
CORBA / IIOP
zInternet Inter-Orb Protocol is the
standard protocol from accessing CORBA
resources.
zCORBA resources may be COBOL, C,
C++, etc.
zRMI over IIOP is supported in Java 2!
Java Mail & Activation
zProvides non-networking specific access
to internet mail services.
zIncludes implementation that can access
SMTP, POP, and IMAP servers.
zMime type support for various data-types
Enterprise Java Beans
zCross platform Java-based component
architecture
zProvides for portability across server
vendors
zWell defined interfaces between client,
server component, server and resources
zHandles data persistence and transaction
integrity
7
Extensible Markup Language
z Self-describing, pure data representation
z Compatible with heterogeneous systems
z Method of configuration of most systems
z Can be used within most of the core API
z Transformations via Extensible Stylesheet
Language Transformation (XSLT)
The J2EE
zYou may remain completely within the
realm of J2EE and provide enterprise
solutions.
zOccasionally the Java Native Interface is
needed to access other systems.
J2EE Construction
zI will use a construction metaphor for
using the J2EE
8
Enterprise Mortar:
JDBC, JNDI and RMI
zJDBC Connects your databases to Java.
yUse Connections, Statements, Result Sets,
etc..
yCall Stored Procedures, etc..
zJNDI locates distributed components.
zRMI allows distributed objects to
communicate as if they were local.
Enterprise Bricks:
EJB, JMS, JTS
zEJB encapsulates business logic, insulates
you from the persistence layer, provides
fault tolerance and fail-over
zJMS provides GMD in Queues or Topics
zJTS allows you to control transaction
isolation level for better data management
Enterprise support beams:
Servlets
zServlets
yProvide the application structure.
yDictate how to navigate inside the
application.
yAre strong, but not pretty.
9
The Enterprise Exterior: JSP
zJSP’s are responsible for the user
experience
zHides the internal structure from clients
zAllows less experienced developers or
web content producers to focus on
presentation
How do the new API’s Help?
zInterfaces* that provide maximum
flexibility.
zThey provide several contracts:
yDeveloper - Component
yContainer -Component
yServer - Container
zYou can avoid deployment specifics in
client code.
Companies Really Are Using
J2EE
zCompanies that use Java:
yMost use JDBC and Servlets
yMany use JNDI/ RMI or IIOP
yBigger players are using EJB, JMS and XML
zCompanies that do not use Java:
yMany are using XML, COM, or CORBA
10
Common Acceptance Path
zUse Servlets (performance, speed of
deployment, ease of development)
zUse JDBC (robust, simple, easy to deploy)
zUse RMI/JNDI (distributed applications)
zUse JNI (integration with other software)
zUse EJB and JMS (high availability,
performance, abstraction)
Now what?
zYou already knew all of that…
zMaybe:
yYour CTO declared that all future
development should be EJB’s!
yYour client decided to listen to some Gartner
Group/ Forrester/ Giga Group advice.
yYou want to develop distributed, scalable
applications in Java.
Avoiding Success With J2EE
zUse one API exclusively, ALL THE TIME.
zUse EJB’s, particularly Entity Beans
excessively.
zCreate ‘Monolithic’ Distributed
applications.
zIgnore other reasonable advice.
11
Heavyweight JSP’s
JSP
RDBMS
JSP
JSP
JDBC
JDBC
JDBC
<jsp:scriptlet>
id = null; SQLDataBean bean = new SQLDataBean();
bean.setSQL(stmt); bean.setDriver(driver);
bean.setURL(url); Properties p = new Properties();
p.put("user",user); p.put("password",pass);
p.put("url",bean.getURL()); bean.setProperties(p);
bean.setColumns(columns); bean.setFields(columns);
bean.setReturnClosed(false); java.sql.ResultSet rs = null;
try {
Object o = bean.execute(request); rs = (java.sql.ResultSet) o;
rs.next(); description = rs.getString(3);
position = rs.getString(2); salary = rs.getString(4);
} catch (Exception e) { e.printStackTrace(new PrintWriter(out));
} finally {
try { rs.close(); } catch (Exception er) { }
}
</jsp:scriptlet>
CMP Entitillic
Servlet
RDBMS
JSP Application
JDBC- VIA
CMP
Entity
Entity Entity
Entity
Entity
Entity
Entity
Entity
Entity
Entity
12
Expensive Relaunchitis
Servlet
RDBMS
Servlet Servlet
JDBC
Session Session
JMS
Entity Entity XMLJMS
Entity
Latentcerocis
Java App
RDBMS
JButton
ActionListener
Home
Entity
RMI
Reporting Overkill-us
RDBMS
JSP
Servlet
Home
Entity
13
Report Overkill-us
z Do not use Entity classes to access read-only
data
z Compare the number of sql statements
ySelect name,ssn,salary from emp
ySelect name,ssn,salary from emp where id=1
ySelect name,ssn,salary from emp where id=2
ySelect name,ssn,salary from emp where id=3
y…
z Consider the RMI communication time.
z Contemplate the App Server overhead.
Some Successful Strategies
z Use coarse-grained entities where possible
z Use Interfaces from the start of development
z Use JSP to encapsulate the presentation layer
z Do not put business logic in your JSP’s
z Use Bean Managed Persistence or OR Mapping
tools
z You still need code reviews!
Use coarse-grained Entities
zJDBC is your friend!
zContainer Managed Persistence is not
always appropriate.
zDo not let the Database structure dictate
your object architecture.
14
Use Remote Interfaces from
the beginning
zDefine your interfaces very early in the
construction phase
zCreate stub implementations
zThis allows the presentation layer
development to continue without waiting
for the server side components
Use Interfaces with EJB
EJB Data Access
z There are many ways that you can access your
data via EJB
yUsing a Session
x SQL in the Session or DD
x Data Access Objects
yUsing an Entity
x Container Managed Persistence
x Bean Managed Persistence
• SQL embedded in the Entity or DD
• Data Access Objects
• O/R Mapping Tool
15
EJB Data Access
zUsing a Session with SQL Embedded
yVery straightforward
yEasy to Configure
ySomewhat Flexible
yMay be difficult to maintain
yHard to reuse
Session With SQL Embedded
public AddressData getBusinessAddress() throws RemoteException {
AddressData address = new AddressData();
try {
Connection c = null; PreparedStatement s = null; ResultSet rs = null;
try {
c = getConnection(); s = c.createStatement();
String query = getEnvironmentValue("ADDRESS_SQL");
s.prepareStatement(query); s.setString(id); rs = s.executeQuery();
while (rs.next()){
address.setStreet(rs.getString("ADDRESS"));
address.setCity(rs.getString("CITY"));
address.setState(rs.getString("STATE")); address.setZip(rs.getString("ZIP"));
address.setCountryCode(rs.getString(“COUNTRY_CD");
} //while
} catch (SQLException e){ e.printStackTrace(); } finally {
if ( s != null ) s.close(); if ( rs != null ) rs.close();
if ( c != null) c.close();
} //catch
} catch (SQLException e){}
return address;
}
EJB Data Access
zUsing a Session with a Data Access Object
yModular
yReusable
yDifficult to expand to complex relationships
yTransactions, data-integrity must be
maintained manually
16
Session With DAO
public AddressData getBusinessAddress() throws RemoteException,
BeanDNEException
{
AddressDataBean address = new AddressDataBean(ein);
return address.getAddressData();
}
Other Points
zThe same follows for Entities
zUse a Cookie Cutter Approach
ySpecify your interfaces early
yWrite a tool or use an IDE that will create the
skeleton code for you
yImplement only what you need
zAssign a person to take on the role of
deployment specialist (its not fun)
Using the J2EE
zUse the appropriate technology
zDon’t throw away all of the design
principles you have learned
zJust say no to ‘distributed monolithic’
applications
17
Finally
z Thanks for attending
z Live in Hawaii or Bay Area? Do you like this
stuff? Email your resume to us!
z Source Code Available
yhttp://www.synctank.com/javacon
yrussell@4charity.com
z Check for EJBWiz to be released as open source
soon
z Aloha

More Related Content

What's hot

Portlet Programming Using Jsr 168
Portlet Programming Using Jsr 168Portlet Programming Using Jsr 168
Portlet Programming Using Jsr 168Saikrishna Basetti
 
HowTo Build an OSGI EJB3 Server
HowTo Build an OSGI EJB3 ServerHowTo Build an OSGI EJB3 Server
HowTo Build an OSGI EJB3 Serverekkehard gentz
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questionsRohit Singh
 
Extending Titanium with native iOS and Android modules
Extending Titanium with native iOS and Android modules Extending Titanium with native iOS and Android modules
Extending Titanium with native iOS and Android modules omorandi
 
Titanium Mobile: flexibility vs. performance
Titanium Mobile: flexibility vs. performanceTitanium Mobile: flexibility vs. performance
Titanium Mobile: flexibility vs. performanceomorandi
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questionsppratik86
 
Java one 2015 [con3339]
Java one 2015 [con3339]Java one 2015 [con3339]
Java one 2015 [con3339]Arshal Ameen
 
OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishOSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishArun Gupta
 
Java interview questions
Java interview questionsJava interview questions
Java interview questionsSoba Arjun
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGiIlya Rybak
 
Developing and-benchmarking-native-linux-applications-on-android
Developing and-benchmarking-native-linux-applications-on-androidDeveloping and-benchmarking-native-linux-applications-on-android
Developing and-benchmarking-native-linux-applications-on-androidElvis Jon Freddy Sitinjak
 
Modular EJBs in OSGi - Tim Ward
Modular EJBs in OSGi - Tim WardModular EJBs in OSGi - Tim Ward
Modular EJBs in OSGi - Tim Wardmfrancis
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guidePankaj Singh
 
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsOSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsArun Gupta
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questionsSynergisticMedia
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-finalRohit Kelapure
 

What's hot (19)

Portlet Programming Using Jsr 168
Portlet Programming Using Jsr 168Portlet Programming Using Jsr 168
Portlet Programming Using Jsr 168
 
HowTo Build an OSGI EJB3 Server
HowTo Build an OSGI EJB3 ServerHowTo Build an OSGI EJB3 Server
HowTo Build an OSGI EJB3 Server
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 
Extending Titanium with native iOS and Android modules
Extending Titanium with native iOS and Android modules Extending Titanium with native iOS and Android modules
Extending Titanium with native iOS and Android modules
 
Titanium Mobile: flexibility vs. performance
Titanium Mobile: flexibility vs. performanceTitanium Mobile: flexibility vs. performance
Titanium Mobile: flexibility vs. performance
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questions
 
Java J2EE Training in Chennai, Tambaram
Java J2EE  Training in Chennai, TambaramJava J2EE  Training in Chennai, Tambaram
Java J2EE Training in Chennai, Tambaram
 
Java one 2015 [con3339]
Java one 2015 [con3339]Java one 2015 [con3339]
Java one 2015 [con3339]
 
OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishOSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFish
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
 
Developing and-benchmarking-native-linux-applications-on-android
Developing and-benchmarking-native-linux-applications-on-androidDeveloping and-benchmarking-native-linux-applications-on-android
Developing and-benchmarking-native-linux-applications-on-android
 
Modular EJBs in OSGi - Tim Ward
Modular EJBs in OSGi - Tim WardModular EJBs in OSGi - Tim Ward
Modular EJBs in OSGi - Tim Ward
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
 
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsOSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worlds
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
 

Similar to 2000: Making IT Happen with J2EE

Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year projectsuneel singh
 
Java, BA,UI resumes
Java, BA,UI resumesJava, BA,UI resumes
Java, BA,UI resumesNeel A
 
Demystifying microservices for JavaEE developers by Steve Millidge.
Demystifying microservices for JavaEE developers by Steve Millidge.Demystifying microservices for JavaEE developers by Steve Millidge.
Demystifying microservices for JavaEE developers by Steve Millidge.Payara
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]Leonardo Zanivan
 
Bala Sr Java Developer
Bala  Sr Java DeveloperBala  Sr Java Developer
Bala Sr Java DeveloperJava Dev
 
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx75waytechnologies
 
5 Treding Java Frameworks Offshore Developers Should About
5 Treding Java Frameworks Offshore Developers Should About5 Treding Java Frameworks Offshore Developers Should About
5 Treding Java Frameworks Offshore Developers Should AboutBJIT Ltd
 
Java Coaching in Hyderabad introduction
Java Coaching in Hyderabad  introductionJava Coaching in Hyderabad  introduction
Java Coaching in Hyderabad introductionAzure Data Factory
 

Similar to 2000: Making IT Happen with J2EE (20)

Java_J2EE_Siddhartha_Kejriwal
Java_J2EE_Siddhartha_KejriwalJava_J2EE_Siddhartha_Kejriwal
Java_J2EE_Siddhartha_Kejriwal
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
Profile
ProfileProfile
Profile
 
Java, BA,UI resumes
Java, BA,UI resumesJava, BA,UI resumes
Java, BA,UI resumes
 
Krishnagopal Thogiti_Java
Krishnagopal Thogiti_JavaKrishnagopal Thogiti_Java
Krishnagopal Thogiti_Java
 
Devendra_SrJavaJ2eeDeveloper
Devendra_SrJavaJ2eeDeveloperDevendra_SrJavaJ2eeDeveloper
Devendra_SrJavaJ2eeDeveloper
 
Goutham_DevOps
Goutham_DevOpsGoutham_DevOps
Goutham_DevOps
 
KaranDeepSinghCV
KaranDeepSinghCVKaranDeepSinghCV
KaranDeepSinghCV
 
Venugopal Kommineni
Venugopal KommineniVenugopal Kommineni
Venugopal Kommineni
 
Demystifying microservices for JavaEE developers by Steve Millidge.
Demystifying microservices for JavaEE developers by Steve Millidge.Demystifying microservices for JavaEE developers by Steve Millidge.
Demystifying microservices for JavaEE developers by Steve Millidge.
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Bala Sr Java Developer
Bala  Sr Java DeveloperBala  Sr Java Developer
Bala Sr Java Developer
 
SAIGANESH CHINTALA_JAVA
SAIGANESH CHINTALA_JAVASAIGANESH CHINTALA_JAVA
SAIGANESH CHINTALA_JAVA
 
Rajesh Ramasamy
Rajesh RamasamyRajesh Ramasamy
Rajesh Ramasamy
 
Deepthi_KV
Deepthi_KVDeepthi_KV
Deepthi_KV
 
Sunil kumar resume
Sunil kumar resumeSunil kumar resume
Sunil kumar resume
 
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
 
5 Treding Java Frameworks Offshore Developers Should About
5 Treding Java Frameworks Offshore Developers Should About5 Treding Java Frameworks Offshore Developers Should About
5 Treding Java Frameworks Offshore Developers Should About
 
Java Coaching in Hyderabad introduction
Java Coaching in Hyderabad  introductionJava Coaching in Hyderabad  introduction
Java Coaching in Hyderabad introduction
 

More from Russell Castagnaro

The Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceThe Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceRussell Castagnaro
 
HICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileHICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileRussell Castagnaro
 
2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.govRussell Castagnaro
 
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.govRussell Castagnaro
 
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiLove, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiRussell Castagnaro
 
Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro
 
HICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeHICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeRussell Castagnaro
 
eTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedeTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedRussell Castagnaro
 
2009 eBench Warrants presentation
2009 eBench Warrants presentation2009 eBench Warrants presentation
2009 eBench Warrants presentationRussell Castagnaro
 
Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Russell Castagnaro
 
2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School StyleRussell Castagnaro
 
2001: JNDI Its all in the Context
2001:  JNDI Its all in the Context2001:  JNDI Its all in the Context
2001: JNDI Its all in the ContextRussell Castagnaro
 

More from Russell Castagnaro (15)

The Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceThe Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: Cryptocomerce
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Wampum Introduction Deck
Wampum Introduction DeckWampum Introduction Deck
Wampum Introduction Deck
 
HICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileHICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragile
 
2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov
 
2014 Access Hawaii Report
2014 Access Hawaii Report2014 Access Hawaii Report
2014 Access Hawaii Report
 
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
 
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiLove, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
 
Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013
 
HICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeHICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in Practice
 
eTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedeTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons Learned
 
2009 eBench Warrants presentation
2009 eBench Warrants presentation2009 eBench Warrants presentation
2009 eBench Warrants presentation
 
Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013
 
2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style
 
2001: JNDI Its all in the Context
2001:  JNDI Its all in the Context2001:  JNDI Its all in the Context
2001: JNDI Its all in the Context
 

Recently uploaded

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

2000: Making IT Happen with J2EE

  • 1. 1 Making it Happen with J2EE Russell Castagnaro Chief Mentor 4Charity.com russell@4charity.com Introduction zPresenter yRussell Castagnaro yChief Mentor x4Charity.com xSyncTank Solutions, Inc yrussell@4charity.com yExperience Introduction z4Charity.com yApplication Service Provider for the Non- Profit industry yPure Java development yHttp://www.4charity.com yLocations: x San Francisco,CA x Honolulu, HI yWe’re Hiring…
  • 2. 2 Presentation Goals zBrief overview of the J2EE API zDiscuss various application architectures zExplain when each API should be used zMost examples use BEA’s Weblogic Server What is the J2EE? zJava2 Enterprise Edition zA set of Eleven Application Programming Interfaces (API) that provide a standard way to solve common issues. zDelivers on the promise of Standards- based heterogeneous applications development. The J2EE API’s zDatabase Connectivity (JDBC) zRemote Method Protocol (RMP/ RMI) zNaming and Directory Interface (JNDI) zServlets and Server Pages (JSP) zMessaging (JMS) zTransaction Services (JTS/ JTA)
  • 3. 3 The J2EE API’s zCORBA Communication (IIOP/ CORBA) zMail (Mail and JAF) zEnterprise Beans (EJB) zExtensible Markup Language (XML / XSL) The J2EE API’s Java Database Connectivity zThe first of the J2EE API’s. zProvides a standard set of interfaces to access any compliant data source. zImproved upon ODBC standard. zSQL 92 compliant.
  • 4. 4 Remote Method Protocol Remote Method Interface zCommunication protocol between Java objects on separate Virtual Machines (JVM). zEnables distributed communications with no knowledge of networking or sockets. zMakes remote objects seem local. zUses Java Serialization to send objects across a network. Java Naming & Directory Interface zSimple interface that allows for resource discovery and binding. zA way to ‘look up’ an object locally or remotely. zA way to enter objects into a directory of objects. zOther interfaces leverage JNDI (i.e. LDAP). Java Servlets zJava access to network (HTTP) requests and responses. zIntegration with a Web Server via a Servlet Engine. zImproved performance over CGI. z70% of successful Java projects are Servlet-based!
  • 5. 5 Java Sever Pages zBuilds on the Servlet API. zProvides a “pure” presentation-layer templating mechanism. zAllows HTML coders to write HTML, not the Java Programmers. Java Messaging Service zAsynchronous messaging between de- coupled components. zDefines the Message Oriented Middleware interface for Java applications. zSupports: yGuaranteed Message Delivery yPoint-to-point messaging yPublish/ Subscript messaging Java Transaction Services z JTS uses the Java Transaction Architecture (JTA) to monitor and access all transactions that take place in a given system. z Implements the OMG Object Transaction Service (OTS) definition. z Defines the interfaces between : yTransaction Manager yApplication yApplication Server yResource (Database Management System)
  • 6. 6 CORBA / IIOP zInternet Inter-Orb Protocol is the standard protocol from accessing CORBA resources. zCORBA resources may be COBOL, C, C++, etc. zRMI over IIOP is supported in Java 2! Java Mail & Activation zProvides non-networking specific access to internet mail services. zIncludes implementation that can access SMTP, POP, and IMAP servers. zMime type support for various data-types Enterprise Java Beans zCross platform Java-based component architecture zProvides for portability across server vendors zWell defined interfaces between client, server component, server and resources zHandles data persistence and transaction integrity
  • 7. 7 Extensible Markup Language z Self-describing, pure data representation z Compatible with heterogeneous systems z Method of configuration of most systems z Can be used within most of the core API z Transformations via Extensible Stylesheet Language Transformation (XSLT) The J2EE zYou may remain completely within the realm of J2EE and provide enterprise solutions. zOccasionally the Java Native Interface is needed to access other systems. J2EE Construction zI will use a construction metaphor for using the J2EE
  • 8. 8 Enterprise Mortar: JDBC, JNDI and RMI zJDBC Connects your databases to Java. yUse Connections, Statements, Result Sets, etc.. yCall Stored Procedures, etc.. zJNDI locates distributed components. zRMI allows distributed objects to communicate as if they were local. Enterprise Bricks: EJB, JMS, JTS zEJB encapsulates business logic, insulates you from the persistence layer, provides fault tolerance and fail-over zJMS provides GMD in Queues or Topics zJTS allows you to control transaction isolation level for better data management Enterprise support beams: Servlets zServlets yProvide the application structure. yDictate how to navigate inside the application. yAre strong, but not pretty.
  • 9. 9 The Enterprise Exterior: JSP zJSP’s are responsible for the user experience zHides the internal structure from clients zAllows less experienced developers or web content producers to focus on presentation How do the new API’s Help? zInterfaces* that provide maximum flexibility. zThey provide several contracts: yDeveloper - Component yContainer -Component yServer - Container zYou can avoid deployment specifics in client code. Companies Really Are Using J2EE zCompanies that use Java: yMost use JDBC and Servlets yMany use JNDI/ RMI or IIOP yBigger players are using EJB, JMS and XML zCompanies that do not use Java: yMany are using XML, COM, or CORBA
  • 10. 10 Common Acceptance Path zUse Servlets (performance, speed of deployment, ease of development) zUse JDBC (robust, simple, easy to deploy) zUse RMI/JNDI (distributed applications) zUse JNI (integration with other software) zUse EJB and JMS (high availability, performance, abstraction) Now what? zYou already knew all of that… zMaybe: yYour CTO declared that all future development should be EJB’s! yYour client decided to listen to some Gartner Group/ Forrester/ Giga Group advice. yYou want to develop distributed, scalable applications in Java. Avoiding Success With J2EE zUse one API exclusively, ALL THE TIME. zUse EJB’s, particularly Entity Beans excessively. zCreate ‘Monolithic’ Distributed applications. zIgnore other reasonable advice.
  • 11. 11 Heavyweight JSP’s JSP RDBMS JSP JSP JDBC JDBC JDBC <jsp:scriptlet> id = null; SQLDataBean bean = new SQLDataBean(); bean.setSQL(stmt); bean.setDriver(driver); bean.setURL(url); Properties p = new Properties(); p.put("user",user); p.put("password",pass); p.put("url",bean.getURL()); bean.setProperties(p); bean.setColumns(columns); bean.setFields(columns); bean.setReturnClosed(false); java.sql.ResultSet rs = null; try { Object o = bean.execute(request); rs = (java.sql.ResultSet) o; rs.next(); description = rs.getString(3); position = rs.getString(2); salary = rs.getString(4); } catch (Exception e) { e.printStackTrace(new PrintWriter(out)); } finally { try { rs.close(); } catch (Exception er) { } } </jsp:scriptlet> CMP Entitillic Servlet RDBMS JSP Application JDBC- VIA CMP Entity Entity Entity Entity Entity Entity Entity Entity Entity Entity
  • 12. 12 Expensive Relaunchitis Servlet RDBMS Servlet Servlet JDBC Session Session JMS Entity Entity XMLJMS Entity Latentcerocis Java App RDBMS JButton ActionListener Home Entity RMI Reporting Overkill-us RDBMS JSP Servlet Home Entity
  • 13. 13 Report Overkill-us z Do not use Entity classes to access read-only data z Compare the number of sql statements ySelect name,ssn,salary from emp ySelect name,ssn,salary from emp where id=1 ySelect name,ssn,salary from emp where id=2 ySelect name,ssn,salary from emp where id=3 y… z Consider the RMI communication time. z Contemplate the App Server overhead. Some Successful Strategies z Use coarse-grained entities where possible z Use Interfaces from the start of development z Use JSP to encapsulate the presentation layer z Do not put business logic in your JSP’s z Use Bean Managed Persistence or OR Mapping tools z You still need code reviews! Use coarse-grained Entities zJDBC is your friend! zContainer Managed Persistence is not always appropriate. zDo not let the Database structure dictate your object architecture.
  • 14. 14 Use Remote Interfaces from the beginning zDefine your interfaces very early in the construction phase zCreate stub implementations zThis allows the presentation layer development to continue without waiting for the server side components Use Interfaces with EJB EJB Data Access z There are many ways that you can access your data via EJB yUsing a Session x SQL in the Session or DD x Data Access Objects yUsing an Entity x Container Managed Persistence x Bean Managed Persistence • SQL embedded in the Entity or DD • Data Access Objects • O/R Mapping Tool
  • 15. 15 EJB Data Access zUsing a Session with SQL Embedded yVery straightforward yEasy to Configure ySomewhat Flexible yMay be difficult to maintain yHard to reuse Session With SQL Embedded public AddressData getBusinessAddress() throws RemoteException { AddressData address = new AddressData(); try { Connection c = null; PreparedStatement s = null; ResultSet rs = null; try { c = getConnection(); s = c.createStatement(); String query = getEnvironmentValue("ADDRESS_SQL"); s.prepareStatement(query); s.setString(id); rs = s.executeQuery(); while (rs.next()){ address.setStreet(rs.getString("ADDRESS")); address.setCity(rs.getString("CITY")); address.setState(rs.getString("STATE")); address.setZip(rs.getString("ZIP")); address.setCountryCode(rs.getString(“COUNTRY_CD"); } //while } catch (SQLException e){ e.printStackTrace(); } finally { if ( s != null ) s.close(); if ( rs != null ) rs.close(); if ( c != null) c.close(); } //catch } catch (SQLException e){} return address; } EJB Data Access zUsing a Session with a Data Access Object yModular yReusable yDifficult to expand to complex relationships yTransactions, data-integrity must be maintained manually
  • 16. 16 Session With DAO public AddressData getBusinessAddress() throws RemoteException, BeanDNEException { AddressDataBean address = new AddressDataBean(ein); return address.getAddressData(); } Other Points zThe same follows for Entities zUse a Cookie Cutter Approach ySpecify your interfaces early yWrite a tool or use an IDE that will create the skeleton code for you yImplement only what you need zAssign a person to take on the role of deployment specialist (its not fun) Using the J2EE zUse the appropriate technology zDon’t throw away all of the design principles you have learned zJust say no to ‘distributed monolithic’ applications
  • 17. 17 Finally z Thanks for attending z Live in Hawaii or Bay Area? Do you like this stuff? Email your resume to us! z Source Code Available yhttp://www.synctank.com/javacon yrussell@4charity.com z Check for EJBWiz to be released as open source soon z Aloha