JavaBeans and InfoBus: a Tutorial

Similar documents
INTRODUCTION TO JAVA BEANS

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Mobile Application Languages XML, Java, J2ME and JavaCard Lesson 04 Java

Tutorial Reference Manual. Java WireFusion 4.1

Using the Beans Development Kit 1.0. September A Tutorial. Alden DeSoto. Sept Garcia Avenue Mountain View, CA U.S.A.

WHAT ARE PACKAGES? A package is a collection of related classes. This is similar to the notion that a class is a collection of related methods.

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Packaging and Deploying Java Projects in Forte

C# and Other Languages

Installing Java. Table of contents

CS506 Web Design and Development Solved Online Quiz No. 01

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Implementação. Interfaces Pessoa Máquina 2010/ Salvador Abreu baseado em material Alan Dix. Thursday, June 2, 2011

TIBCO Runtime Agent Authentication API User s Guide. Software Release November 2012

FileMaker 14. ODBC and JDBC Guide

An Overview of Java. overview-1

Elements of Advanced Java Programming

JiST Graphical User Interface Event Viewer. Mark Fong

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

JAVA r VOLUME II-ADVANCED FEATURES. e^i v it;

JAVA 2 Network Security

Glassfish, JAVA EE, Servlets, JSP, EJB

Web Container Components Servlet JSP Tag Libraries

Using LDAP Authentication in a PowerCenter Domain

Agent Languages. Overview. Requirements. Java. Tcl/Tk. Telescript. Evaluation. Artificial Intelligence Intelligent Agents

How To Create A C++ Web Service

Java Language Tools COPYRIGHTED MATERIAL. Part 1. In this part...

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

IBM Tivoli Workload Scheduler Integration Workbench V8.6.: How to customize your automation environment by creating a custom Job Type plug-in

Java Server Pages and Java Beans

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

bbc Developing Service Providers Adobe Flash Media Rights Management Server November 2008 Version 1.5

Integrating VoltDB with Hadoop

Dynamic Adaptability of Services in Enterprise JavaBeans Architecture

A generic framework for game development

Logi Ad Hoc Reporting System Administration Guide

MIDlet development with J2ME and MIDP

Mobile application development J2ME U N I T I I

Creating a Java application using Perfect Developer and the Java Develo...

Real-time Device Monitoring Using AWS

Database Programming with PL/SQL: Learning Objectives

JAVA WEB START OVERVIEW

Limitations of Data Encapsulation and Abstract Data Types

Rational Developer for IBM i (RDi) Introduction to RDi

17 March 2013 NIEM Web Services API Version 1.0 URI:

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

CACHÉ: FLEXIBLE, HIGH-PERFORMANCE PERSISTENCE FOR JAVA APPLICATIONS

Exam Name: IBM InfoSphere MDM Server v9.0

Computing Concepts with Java Essentials

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Software documentation systems

Web Service Caching Using Command Cache

Specialized Programme on Web Application Development using Open Source Tools

Entrust Certificate Services. Java Code Signing. User Guide. Date of Issue: December Document issue: 2.0

Abstract. Introduction. Web Technology and Thin Clients. What s New in Java Version 1.1

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

JMulTi/JStatCom - A Data Analysis Toolkit for End-users and Developers

An Overview of Oracle Forms Server Architecture. An Oracle Technical White Paper April 2000

Java (12 Weeks) Introduction to Java Programming Language

An Object Oriented Database for Network Management Data

Game Programming with Groovy. James Sr. Software Engineer, BT/Ribbit

Inheritance, overloading and overriding

SmartArrays and Java Frequently Asked Questions

What Perl Programmers Should Know About Java

BarTender s ActiveX Automation Interface. The World's Leading Software for Label, Barcode, RFID & Card Printing

Tutorial 5: Developing Java applications

SCADA Questions and Answers

Data Transfer Tips and Techniques

AP Computer Science Java Subset

Applets, RMI, JDBC Exam Review

Load Balancing IBM WebSphere Servers with F5 Networks BIG-IP System

BPM Scheduling with Job Scheduler

Syllabus for CS 134 Java Programming

IBM. Implementing SMTP and POP3 Scenarios with WebSphere Business Integration Connect. Author: Ronan Dalton

How To Use A Sas Server On A Java Computer Or A Java.Net Computer (Sas) On A Microsoft Microsoft Server (Sasa) On An Ipo (Sauge) Or A Microsas (Sask

Building Web Services with Apache Axis2

SE 450 Object-Oriented Software Development. Requirements. Topics. Textbooks. Prerequisite: CSC 416

Chain of Responsibility

SafeNet KMIP and Google Cloud Storage Integration Guide

Java applets. SwIG Jing He

Essentials of the Java Programming Language

Vaidya Guide. Table of contents

zen Platform technical white paper

Outside In Image Export Technology SDK Quick Start Guide

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

TATJA: A Test Automation Tool for Java Applets

TABLE OF CONTENTS...2 INTRODUCTION...3 APPLETS AND APPLICATIONS...3 JAVABEANS...4 EXCEPTION HANDLING...5 JAVA DATABASE CONNECTIVITY (JDBC)...

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

What Is the Java TM 2 Platform, Enterprise Edition?

Java Client Side Application Basics: Decompiling, Recompiling and Signing

Contents. 9-1 Copyright (c) N. Afshartous

The end. Carl Nettelblad

SW5706 Application deployment problems

Using EMC Documentum with Adobe LiveCycle ES

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

Transcription:

JavaBeans and InfoBus: a Tutorial Ghodrat Moghadampour ghodrat.moghadampour@puv.fi Department of Information Technology Vaasa Polytechnic Wolffintie 30 65200 Vaasa, Finland

Outline Introduction JavaBeans Bean Terminology JAR Files and Utility Manifest Files Creating a New JavaBean InfoBus 22/8/2003 2

What is a JavaBean? A reusable software component A simple piece of software for checking the spelling of a document, or a complex one for forecasting the performance of a stock portfolio. Visible to the end user, like a button on a graphical user interface or invisible to the user, like a software to decode a stream of multimedia information in real time. 22/8/2003 3

What is a JavaBean? It may work autonomously on a user s workstation or work in cooperation with a set of other distributed components. A Bean that provides real-time price information from a stock or commodities exchange would need to work in cooperation with other distributed software to obtain its data 22/8/2003 4

What is a JavaBean? A simple Java object becomes a Java bean when all of the object s data fields are private and are only accessible through methods, known as accessor methods. 22/8/2003 5

Advantages of Java Beans Mainly provides standard mechanisms to deal with software building blocks. A Bean obtains all the benefits of Java s write-once, run-anywhere paradigm. The properties, events, and methods of a Bean exposed to an application builder tool can be controlled. 22/8/2003 6

Advantages of JavaBeans cont. The configuration settings of a Bean can be saved in persistent storage and restored at a later time. A Bean may register to receive events from other objects and can generate events that are sent to other objects. 22/8/2003 7

Bean Terminology A JavaBean is defined via its interface: its properties, its events and its methods. Properties: attributes of the Bean that can be modified by anything outside the Bean, like size, color, etc. Events: used to allow one component to communicate with another component Methods: public methods that can be used to directly request some service to a Bean. 22/8/2003 8

Introspection The process of analyzing a Bean to determine its capabilities. It allows an application builder tool to present information about a component to a software designer. Without introspection, the Java Beans technology could not operate. There are two ways in which the developer of a Bean can indicate which of its properties, events, and methods should be exposed by an application builder tool: 22/8/2003 9

Introspection cont. With the first method, simple naming conversion are used. In the second way, an additional class, which inherits SimpleBeanInfo, is provided that explicitly supplies this information. 22/8/2003 10

Design Patterns for Properties A property is a subset of a Bean s state. The values assigned to the properties determine the behaviour and appearance of that component. There are three types of properties: simple, Boolean, and indexed. 22/8/2003 11

Simple Properties A simple property has a single value, like: public void setp(t arg); public T getp(); 22/8/2003 12

Simple Properties cont. Example 1: class Guest { private String name = new String(); private int roomnro; public void setname(string n){ name=name.concat(n); } 22/8/2003 13

Simple Properties cont. Example 1 cont.: public void getname(){ } return name; public void setroomnro(int n) { } roomnro=n; public int getroomnro() { } } return roomnro; 22/8/2003 14

Boolean Properties A Boolean property has a value of true or false, like: public boolean isp(); public boolean getp(); public void setp(boolean value); 22/8/2003 15

Boolean Properties cont. Example 2: public class Guest { private boolean present=true; public boolean ispresent() { return present; } public void setpresent(boolean pr) { present=pr;}} 22/8/2003 16

Indexed Properties An indexed property consists of multiple values, like: public T getp(int index); public void setp(int index, T value); public T[] getp(); public void setp(t values[]); 22/8/2003 17

Indexed Properties cont. Example 3: public class Individual { private int data []; public void setdata(int index, int value){ data[index]=value;} public int getdata(int index) { return data[index];} public int [] getdata() { return data;} 22/8/2003 18

Indexed Properties cont. Example 3 cont.: public void setdata(int [] values){ data = new int[values.length]; System.arraycopy(values, 0, data, 0, values.length); }} 22/8/2003 19

JAR Files Tools such as the BDK expect Beans to be packaged within JAR files. A JAR file allows to efficiently deploy a set of classes and their associated resources. JAR technology makes it much easier to deliver and install software. The elements in a JAR file are compressed Digital signatures may also be associated with the individual elements in a JAR file (keytool). 22/8/2003 20

JAR Files cont. This allows a consumer to be sure that these elements were produced by a specific organization or individual. 22/8/2003 21

Manifest Files A manifest file indicates which of the components in a JAR file are Java Beans, like: Name: sunw/demo/beanex/pic1.gif Name: sunw/demo/beanex/pic2.gif Name: sunw/demo/beanex/pic3.gif Name: sunw/demo/beanex/bexcls.class Java-Bean: True 22/8/2003 22

The JAR Utility JAR utility is used to generate a JAR file. Its syntax is: jar options files, where options can be one or several of the followings: Option Description c A new archive is to be created. C Change directories during command execution. 22/8/2003 23

The JAR Utility cont. f The first element in the file list is the name of the archive that is to be created or accessed. m The second element in the file list is the name of the external manifest file. M Manifest file not created. t The archive contents should be tabulated. u Update existing JAR file. 22/8/2003 24

The JAR Utilities cont. v Verbose output should be provided by the utility as it executes. X Files are to be executed from the archive. (If there is only one file, that is the name of the archive, and all files in it are extracted. 0 Do not use compression. 22/8/2003 25

Creating a JAR File To create a JAR file named myjarfile.jar that contains all of the.class and.gif files in the current directory we write: jar cf myjar.jar *.class *.gif If a manifest file such as myman.mf is available, it can be used with the following command: jar cfm myjar.jar myman.mf *.class *.gif 22/8/2003 26

Creating a New Bean Steps for creating a new Bean are: 1. Create a directory for the new Bean. 2. Create the Java source file(s). 3. Compile the source file(s). 4. Create a manifest file. 5. Generate a JAR file. 6. Start the BDK. 7. Test. 22/8/2003 27

Creating a New Bean cont. We first create a directory like: c:\bdk\demo\sunw\demo\colors and move to it. We also set the CLASSPATH to C:\bdk\demo. We then create our java source code file and compile it, for instance: javac Colors.java 22/8/2003 28

Creating a New Bean cont. The colors.mft manifest file is created under c:\bdk\demo directory, where the manifest files for the BDK demos are located. Name:sunw/demo/colors/Colors. class Java-Bean: True Beans are included in the ToolBox window of the BDK only if they are in JAR files in the directory c:\bdk\jars. jar cfm..\jars\colors.jar colors.mft sunw\demo\colors\*.class 22/8/2003 29

InfoBus Two or more JavaBeans can dynamically exchange data through the Information Bus a.k.a. InfoBus. However, communicating Beans must implement required interfaces defined by InfoBus. The InfoBus is a Java API created by Lotus Development Corporation and Sun Microsystems s JavaSoft division. 22/8/2003 30

InfoBus Structure Bean1 Bean2 Bean3 Logical View Bean4 InfoBus Bean1 Bean2 Bean3 Architectural View Bean4 22/8/2003 31

InfoBus cont. Communicating Beans can be located in a Java application or on a Web page. We can distinguish three different roles in an InfoBus: Data producers: Beans mainly responsible for accessing data from their native store, such as files, DBMS, etc. Data consumers: Beans responsible for retrieving data from the bus for analysis or visual display. 22/8/2003 32

InfoBus cont. Data controllers: an optional component that regulates or redirects the flow of events between data producers and consumers. A JavaBean can be both a consumer and producer. 22/8/2003 33

InfoBus Communication Protocol Membership: Any Java class can join the InfoBus provided that it implements the InfoBusMember interface. Rendezvous: An InfoBus application supplies an object that implements InfoBusDataProducer or InfoBusConsumer interfaces to listen for events appropriate to a component s role as a producer or consumer. 22/8/2003 34

InfoBus Communication Protocol cont. Data access: InfoBus specifies a number of standard interfaces to provide direct data transfer between a producer and consumer: ImmediateAccess: provides an InfoBus wrapper for a simple data item ArrayAccess: provides access functions for an array with arbitrary dimensions RowAccess: provides a row and column interface to support database solutions 22/8/2003 35

InfoBus Communication Protocol cont. Change notification: a consumer, which receives data from a producer, can request notifications of all changes to the data by registering a DataItemChangeListener on the data item. As the producer detects changes, it will announce the changes to all listeners. 22/8/2003 36

Implementing InfoBusMember Example 4: public class infobusdemo extends Applet implements InfoBusMember, InfoBusDataProducer, ActionListener { //IBMS holds our InfoBus private InfoBusMemberSupport IBMS; //data is a simple data item String //data is the name of the InfoBus to which we connect private SimpleDataItem data; 22/8/2003 37

Implementing InfoBusMember //The name of the InfoBus to which we connect private String bus=null; privte String guest; private Object available = new Object(); //Delegates all calls to our InfoBusMemberSupport, IBMS public InfoBus getinfobus() { return IBMS.getInfoBus(); } 22/8/2003 38

Implementing InfoBusMember //The InfoBusMemberSupport instance must be created before any class are delegated to it. This can be done in the init() method. public void init() { super.init(); IBMS=new InfoBusMemberSupport(this); 22/8/2003 39

Implementing InfoBusMember IBMS.addInfoBusPropertyListener(thi s); bus=getparameter("infobusname"); guest=getparameter("dataitemname"); if(guest==null) guest="guest"; if(bus!= null) IBMS.joinInfoBus(bus); else IBMS.joinInfoBus(this);} 22/8/2003 40

References http://java.sun.com/products/javabeans /software/bdk_download.html http://java.sun.com/products/javabeans /faq/faq.help.html#q28 http://java.sun.com/beans/infobus 22/8/2003 41