Transcript Document

Agenda
Domino JAVA development environments – Today
– Domino and JAVA - embedded Applets
– Domino and Javascript
– Domino toolkit for JAVA/Corba
– Harmony for Domino - EJB from Sun
– JAVA and SOAP web services on Domino
JAVA in Domino 6 – Tomorrow
–
–
–
Domino and JAVA in Release 6
Domino and J2EE
Domino and Websphere integration
Examples
–
–
–
Help Desk Application
Web Services using SOAP
SPAM filters
Sites to find more information
Lotus Notes and Domino – A
Level Set
• Notes is the Client code – a groupware
product that supports email, calendaring,
document management, workflow and web
access
• Domino is the backend server that runs
services such as HTTP, POP, SMTP, LDAP,
Database, Routing, JAVA Servlets,
Replication, etc.
Domino Development – Brief Overview
• The key programming functions in Domino are:
– Formula, LotusScript, Java, and JavaScript code
– You attach code to various objects depending on need.
• You use attach formulas to fields and sections on forms and views.
• You attach JavaScript code to the onFocus event of a field which
would then execute whenever a user places focus on the field.
• Macros can be developed to perform common functions on all
objects
• There is an IDE programming interface to development
environments that support COM and OLE.
• There is a programming interface for Java applications
and applets.
– Java applications and applets can operate locally by accessing
installed Domino software or remotely by connecting to a Domino
server using CORBA with IIOP protocols.
Domino Object Model (DOM)
• What is it?
– Hierarchical organization of the Domino objects.
• It consists of back-end and front-end classes.
– 25 back-end classes (two new classes in R5).
– 7 front-end classes
• Formerly referred to as:
– Notes object model, Notes object interface or NOI
– LotusScript classes (the back-end classes were called
the Database level classes, while the front-end classes
were called the UI level classes)
Where to Use JAVA in Domino
• Embedded Applets & Servlets
• CORBA Applets/Applications
• Web Agents & Web development
– use Java applets (like eSuite DevPack) and Java Servlets.
• Connecting to Relational Databases
– use JDBC in Java Applications and Java agents.
• Integrating with Legacy Systems
– use Java Applications and Java agents.
• Reduce development time by purchasing ready to use
Java classes written specifically for Domino
developers
Java Objects in Notes R5
Server
Objects
Client
CORBA
Server API
IIOP
CORBA
Domino and JAVA - embedded Applets
• Domino ships with 4 pre-built JAVA applets
– Outline applet
• The outline applet lets Web users work with outlines
embedded in a page or form.
– View applet
• The view applet lets Web users use many of the Domino
view features, including column resizing, multiple
document selection, and section collapse/expand without
page regeneration.
– Action bar applet
• The action bar applet lets users scroll and easily view and
select sub-actions.
– Editor applet
• The editor applet lets Web users change the font, color,
size, and style for text in rich text fields.
View Applet
Outline & View Combined
Editor Applet
“Rolling Your Own” Applet
Extending Classes
CREATING AN APPLET INVOLVES
EXTENDING THE APPLET CLASS:
• Import the class files: import java.applet.Applet
– Importing the applet class file gives you a starting point
to build from, a bit like a template.
• Extend: public class Catalogue extends Applet
– Your code extends the java.applet.Applet class files.
• Void: public void init()
– In order to add your own code to the methods available
in a applet class file, you need to override the existing
methods.
Object Actions
CREATING OBJECTS INVOLVES THREE ACTIONS:
• Declaration: type name
– "Button nextProduct" is a variable declaration that declares
that the name nextProduct will be used to refer to a object
of the button type (class name).
• Instantiation: new
– the new operator (like LotusScript) is used in Java to
create a new object, in this case a new button.
• Initialization: constructor call
– "Button(“Next Product”)" calls the button class constructor
which will initialize the nextProduct object.
Referencing Variables
• All objects of the same type have the same
variables:
– These are created when the object is instantiated and
initialized.
– This is similar to LotusScript, that is all
NotesDocument objects have the same properties and
methods. (The values stored in the properties vary).
• To reference a variable:
– objectName.methodName
Handling Events
• Applets inherit a group of event handling methods
from the AWT class: java.awt.Event.
• Establishing event handling methods involves
three steps:
1. Implement the appropriate Listener interfaces:
public class X extends Applet implements ActionListener
2. Register each object with the event Listener:
objectName.addActionListener(this);
3. Implement the methods of the appropriate Listener
interface:
public void actionPerformed(ActionEvent event)
Basic Syntax
• Unlike JavaScript, which is untyped, all data
variables in Java have a type
– The type determines what values the variable can
contain and the operations that can be performed on it.
• Variable scope is similar to LotusScript:
– Variables defined in the “(declarations)” event are
available to all events in the same module. This is like
a member variable in Java.
– Variables declared in the “initialize” event are only
available for the duration of that event. This is like a
local variable in Java.
Steps to Create an Applet
• Create the Source File
– This can be done in any text editor.
– Must save the file with an *.java extension.
• Compile the Source File
– This converts the text file into ByteCode which
can be read by the JVM.
– Use the JDK (Java Developers Kit) or a Java
IDE, such as IBM’s Visual Age
• Embed the Applet into an HTML page or a
Domino Document, Form or Page.
Displaying Images in Applet
• Import the AWT Image and Graphics class files.
• Loading the Image:
– Use imagename =
getImage(getDocumentBase(),”image.gif”);
• Drawing the Image using:
–
–
–
–
Use g.drawImage(imagename, 0, 0, this);
where g represents the Java graphics object.
0,0 are the x,y co-ordinates for the image.
this indicates that this object should be notified as more
of the image becomes available.
Lotus.domino.*
• All Java programs use the Domino Java Classes to
write code that instantiates Domino Objects.
• lotus.domino.* is a Java package that gives Java
programmer’s access to the Domino Object Model.
• The package does not include the Front-end classes as a Java program cannot be attached to front-end
objects, such as form events (unlike LotusScript).
• This same package is used in Java Applets,
Applications and Agents.
Domino Java Classes
METHODS:
• Java methods are identical to LotusScript methods
except that they start with lowercase.
PROPERTIES:
• In Java, properties are also methods, so the
LotusScript properties needed to be converted into
equivalent methods:
– Boolean properties have two equivalent methods - one
to set/change it, which starts with the word “set”, and
one to read it, which starts with the word “is”.
– Other properties convert to “get” methods in Java.
Class Examples
• lotus.domino.Session
– getDatabase
• lotus.domino.Database
– getView
• lotus.domino.View
– getFirstDocument()
– getNextDocument(Object document)
Adding an Applet into your App
• Embed the applet into a Domino form, page or
document.
• Check the “Applet uses the Notes CORBA
classes” property.
• Check the “Applet uses CORBA SSL security”
property if required.
• Execution in a Browser invokes CORBA, in a
Notes Client the applet simply access the local
Domino APIs.
Lotus Domino Toolkit for Java/CORBA
• Tools, samples, and documentation to create Java programs using
Domino data and services.
• Domino Collaboration Objects for Java (DCO)
– Java beans (classes) that add Domino messaging and calendaring
services to programs.
– You provide any needed user interface; the DCO beans provide easy
Domino access to:
• User login and authentication
• Sending an email
• Working with calendar entries
• The DCO beans help Web developers tap into Domino services by
consolidating the necessary Domino back-end Java classes into a
few Java components.
• Developers not familiar with Domino can rapidly integrate Domino
services into Java applications such as servlets and JavaServer
Pages (JSPs).
• http://www.lotus.com/developers/devbase.nsf/homedata/homejava
Domino JAVA Servlets
• A Domino Java servlet is a program run by the Domino Web server
in response to a browser request.
• Domino supports both Java servlets and Java applets for Web
applications.
• The most important difference between these types of Java
programs is how they are run.
• Servlets are "server-side" programs
– a servlet's Java class is loaded and run entirely within the Domino
server and the result from the servlet, usually a page of HTML, is
returned to the browser
• Applets are "client-side" programs
– An applet's Java class is downloaded to the browser and is run by the
browser
• Applets require Java support in the browser, but servlets do not.
• Servlets for Domino must conform to the Java Servlet API
Specification, an open standard published by Sun Microsystems,
Inc.
Java Servlets – Backend
Architecture Browser Client
Web
Server
Java
Agents
Java
Adapter
LotusScript
Agents
Events
LS
Adapter
CORBA
Adapter
Applet
HTTP
Java
Servlets
HTTP
DIIOP
Client-side
objects
ORB
COM
Adapter
Domino Back-End
Classes
Domino Server
IIOP
Client ORB
Visual
Basic
Host
Application
Foreign Client
How is the Servlet Invoked?
• Triggered by HTTP request
– /servlet/<servlet name>
• Mapped to a specific file extension
• Built-in Java Servlet Engine for JSDK 2.0
• IBM WebSphere 2.0 compatible
Domino Servlet Configuration Screen
Java Servlets
Java servlet support:
Servlet URL path:
Class path:
Servlet file extensions:
Session state tracking:
Idle session time-out:
Maximum active sessions:
Session persistence:
Domino Servlet Manager
/servlet
domino/servlet
Enabled
30 minutes
1024
Disabled
How to implement in Domino
•
•
•
•
JSDK 2.0 documentation at java.sun.com
Commercial Java development packages
VisualAge for Java from IBM
Put JSDK.jar into CLASSPATH
– (packaged with R5)
– javac
Writing a Servlet - 1
• Extend javax.servlet.http.HttpServlet
– Subclass of GenericServlet
• Choose the desired method
– doGet( ), doPost( ), init( ) & destroy( )
• Place class files into servlet directory
– <Notes data dir>\domino\servlet
• Invoke by URL
– /servlet/<name>
Writing a Servlet - 2
• <data dir>\servlets.properties
• Standard Java properties file format
• Directives:
–
–
–
–
servlets.startup=<name1> <name2>
servlet.<name>.initArgs=<name>=<value>
servlet.<alias>.code=<class>
servlet.<name>.extension=<ext>
Running the Servlet
• Servlet Manager ClassLoader loads servlet
– Uses domino\servlet path
• System ClassLoader loads other classes
– From file system
– Locates using CLASSPATH
• init( ) method executes
• service( ) method executes for each request
• Servlet classes REUSED
Java User Classes
• Notes.ini variable
• Couples system classloader to a classpath
• Path separators
– Semicolon for Win32/OS2
– Colon for UNIX
• Example:
– JavaUserClasses=c:\myjars\utils.jar;
c:\more\foo.jar
Languages
• CORBA applets & applications
– Java
– JDBC and Domino Driver
• Web agents
– Java
– LotusScript
– Formula language
• Servlets
– Java
Examples of code used
in an Agent
Import lotus domino.*
public class simpleagent extends AgentBase
{
public void NotesMain( )
{
try {
Session s = getSession( );
AgentContext ac = s.getAgentContext( );
// your code goes here
Document doc = ac.getDocumentContext( );
String qs=doc.getItemValueString("Query_String"); }
catch( NotesException e)
{ e.printStackTrace( ); }
}
}
Harmony for Lotus Domino
• OEM Java API to access information from Lotus
Domino.
– Comprehensive library of Java technology-based
components
– Developers can access and store information such as
appointments, todos, mail messages and contacts
through the Harmony for Lotus Domino Java
technology API.
JAVA and Soap in Domino
•
•
•
•
Use XML to encode the data
Format the remote calls using SOAP
Use HTTP as the tranport
Use JAVA as the language to tie it
together
Domino 6 – What’s New
• Creating JSPs from the JSP tag libraries
– large set of tags for Java Server Pages (JSP)
• Enhancements to the Java APIs to make it
easier to get into and out of Domino.
• IDE enhancements for importing JAVA applets
and servlets
Domino 6 – More integration
with Websphere
• IBM has announced that Lotus Domino 6 customers will
be able to download a free version of WebSphere
Application Server (WAS) from the IBM Lotus Passport
Advantage site.
– Delivers Java 2 Platform, Enterprise Edition (J2EE) Advances
IBM's Web services strategy by delivering J2EE capabilities to
Lotus Domino customers and business partners embracing a J2EE
architecture.
– The free WAS download can only be installed on the same
machine as Domino 6, and it can only access Domino objects. In
addition, developers won't be able to use WebSphere connection
pooling or EJBs
Is Domino Worth It?
• Lotus has sold about 85 million seats, it has
about 50 thousand customers, and it
contributes about 20 percent of the total
revenue of IBM Software Group (comprised
of Lotus, WebSphere, DB2 and Tivoli
brands).
After Domino 6 - ??
• Lotus President Al Zollar says the plan is to
modularize products and exploit J2EE and Web
services.
• The product roadmap to Lotus NextGen
Contextual Collaboration has four levels, from
most to least "application richness," evolving over
time:
–
–
–
–
Lotus Domino JAVA APIs
NextGen collaborative infrastructure
NextGen collaborative components
RAD for J2EE based on Eclipse
Sites for more information
•
•
•
•
•
•
•
•
http://www.lotus.com
http://javaadvisor.com/Articles.nsf/aid/DEVEG02
http://javaadvisor.com/Articles.nsf/aid/SMITT728
http://www10.lotus.com/ldd/sandbox.nsf/e26da15be91bde91852566f0006941d9/04ba48
2a57b4131d8525673100760f75?OpenDocument
http://industry.java.sun.com/solutions/products/by_product/0,2348,all-560413,00.html
http://www.notestips.com/80256B3A007F2692/0/92D392DC6B2972898025
6BA5007FBAA3?OpenDocument
http://industry.java.sun.com/solutions/products/by_product/0,2348,all-116299,00.html
http://www.lotus.com/products/rnext.nsf/873769A79D9C5B2285256A0800
720B96/D14669BE33B75CB585256C4700659FDC?OpenDocument
Want to hear more?
• Patricia Egen
–
–
–
–
Patricia Egen Consulting, LLC
www.egenconsulting.com
423-875-2652
[email protected]