Java Beans & Serialization CS-328 Dick Steflik. Java Beans Java based component technology –originally developed to provide java with a component technology.

Slides:



Advertisements
Similar presentations
3 Copyright © 2005, Oracle. All rights reserved. Basic Java Syntax and Coding Conventions.
Advertisements

JSP and Servelets.
JSF Portlet Backing Beans and UI Components Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in.
Copyright © 2001 Qusay H. Mahmoud JavaBeans An introduction to component-based development in general Introduction to JavaBeans – Java components – client-side.
Slide 10.1 Advanced Programming 2004, based on LY Stefanus’s Slides Object Serialization Object serialization: the process of converting an object into.
Chapter 81 JavaBeans JavaServer Pages By Xue Bai.
JavaBeans: Introspection and Customization Umer Farooq CS6704: Design Patterns & Component FrameworksJanuary 30, 2002.
Mari Göransson - KaU - Datavetenskap - DAVD11 1 Java Beans - Events and Properties -
JavaBeans introduction Klaus-Peter Heidrich for the University of Karlstad Inst. for Information Technology Dept. of Computer Science.
Object-Oriented Enterprise Application Development Lecture 8 Advanced JavaBeans.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 15 Advanced Features of Java.
By Dr. Jiang B. Liu 12. The Java Beans. Java Beans n JavaBeans is a portable, platform-independent software component model written in Java. It enables.
JAVA BEANS By Madhuri Kakumanu. What is a Java Bean? “ A Java Bean is a reusable software component that can be visually manipulated in builder tools.”
M.Sc. Course, Dept. of Informatics and Telecommunications, University of Athens S.Hadjiefthymiades “Web Application Servers” Basics on WAS WAS are necessary.
JAVA BEANS (Unit-V) K.Phani Sirisha.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
Introducing JavaBeans Identify the features of a JavaBean Create and add a bean to an application Manipulate bean properties using accessor and mutator.
Java Beans.  Java offers software component development through java Beans  Java Beans are based on a software component model for java.  The model.
Java Beans Component Technology Integrated, Visual Development Environments Reusable Platform-Independent Modular.
Component-Based Software Engineering Introduction to Java Beans Paul Krause and Sotiris Moschoyiannis.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Java Beans.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Last update October 18, 2004 Advanced Programming 2004 Java Beans.
Introduction to Java Beans by Anders Børjesson. Introduction to JavaBeans2 JavaBeans components JavaBeans are the components in the Java environment Many.
JavaBeans Components. To understand JavaBeans…  Proficient experience with the Java language required  Knowledge of classes and interfaces  Object-Oriented.
Learning objectives By the end of this lecture you should be able to:  have a well-earned rest! Ch 24 Beyond the second semester.
TM Introduction to JavaBeans™ Dimitrios Psarros Questra Consulting (716) x225.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
1 First BlueJ Day, Houston, Texas, 1st March 2006 Writing BlueJ Extensions Ian Utting University of Kent.
Java Programming: Advanced Topics 1 JavaBeans Chapter 8.
Components Components are specialized self contained Software entities that can be replicated, Customized and inserted into applications. Components come.
Java Bean Definition “A Java Bean is a reusable software component that can be manipulated visually in a builder tool.”
Introduction to Java Beans CIS 421 Web-based Java Programming.
Introduction to Java 120 February 2004Sifei HE © 2004 Introduction to Java for CS381, EE4.Web By Sifei HE Department of Computing.
First Bean Compose SimpleBean Demo Simple Bean Discuss Manifest and Jar Add Properties to SimpleBean.
Presentation & Business Tier Design Patterns Pearce.
First Bean Compose SimpleBean Demo Simple Bean Discuss Manifest and Jar Add Properties to SimpleBean.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaBeans and.
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
CourseOutline Example & JavaBeans Lec Start with Example Displaying Course Outlines User will select either course “web design & development” or.
Intelligent Agent Framework1 From Chapter 7 of Constructing Intelligent Agents with Java.
Advanced Java Session 4 New York University School of Continuing and Professional Studies.
©SoftMoore ConsultingSlide 1 Serialization. ©SoftMoore ConsultingSlide 2 Serialization Allows objects to be written to a stream Can be used for persistence.
Introduction to Java Beans by Anders Børjesson. Introduction to JavaBeans2 JavaBeans components JavaBeans are the components in the Java environment –COM.
JavaBean Component Java bean is a reusable software component that can be manipulated visually in a builder tool Graphic bean and Non-graphic bean Javabean.
Introduction to Java Beans From Anders Børjesson.
Introduction to Software Components: the JavaBeans specs Babak Esfandiari.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 32 JavaBeans and Bean.
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
Lorenz: Visitor Beans: An Aspect-Oriented Pattern Aspect-oriented pattern: describes a solution to a tangling problem in a particular context.
Java Beans THETOPPERSWAY.COM. Contents What is a Java Bean? Advantages Properties Bean Developers Kit (BDK) What makes Bean possible? Support for Java.
Java Beans - Basics CIS 421 Web-based Java Programming.
Chapter 32 JavaBeans and Bean Events
Structure of a web application
Chapter 36 JavaBeans and Bean Events
Javabeans for dummies.
Introspection the process by which a builder tool finds out which properties, methods, and events a bean supports. searching for classes and methods that.
Google Web Toolkit Tutorial
JavaBeans* ICS 123 Richard N. Taylor & Eric M. Dashofy UC Irvine
Java Beans Sagun Dhakhwa.
JavaBeans and JSP CS-422.
Persistence & Bean Properties
Pre-assessment Questions
Knowledge Byte In this section, you will learn about:
Enterprise Java Beans.
Component-Based Software Engineering
Seminarium on Component-based Software Engineering
Java Programming: Advanced Topics
Presentation transcript:

Java Beans & Serialization CS-328 Dick Steflik

Java Beans Java based component technology –originally developed to provide java with a component technology like vbx/ocx of VB –originally used for user interface widgets –currently used for server side componets Requirements –Bean naming conventions –must be serializable, to support persistence

Bean Naming Conventions “setters” –set or modify a bean property value –must start with “set” “getters” –retrieve property values from a bean –must start with “get”

Bean Properties Simple –represents a single property and can be defined with a pair of get/set methods Indexed –represents an array of properties Bound –a bound property notifies other objects when its value changes –generates a PropertyChange event with property name, old value and new value Constrained –an object with constrained properties allows other objects to veto a constrained property value change –Constrained property listeners can veto a change by throwing a PropertyVetoException

Interaction Levels Properties Bean Methods Event

Bean Framework Network Bean Container Bean

Introspection the processby which a builder tool finds out which properties, methods, and events a bean supports. –searching for classes and methods that follow certain naming conventions –by querying the BeanInfo of a class BeanInfo is an interface whose methods allow the interrogation of a beans properties, methods and events

Introspection Introspector Methods Properties Events

Reflection The core APIs used by the JavaBeans Introspector class java.lang.reflect

a simple GasTank Bean Class Gastank implements Serializable{ private double capacity; private int percent_full; public void setCapacity(double pounds){ capacity = pounds; } public double getCapacity() { return Capacity; } public void setPercent_full( int p) { percent_full = p; } public int getPercent_full() { return percent_full; } }

Jarring the Bean Beans are packaged in a java archive (jar) file the jar utility comes with the JDK the jar file must be explicitly in your class path in JDK 1.2.x all AWT and Swing classes are beans

GUI Builders Because of a bean’s naming convention the GUIs introspector can build a property sheet for each bean automatically The GUI builder allows you to configure the bean as your app. Needs Because the bean is serializable the configured properties can be saves by the GUI Builder

Beans Development Kit Download the latest BDK from SUN Comes with the Beanbox –allows building of bean applications –provides the jar utility –allows saving of configured beans

Persistance for persistance a bean must implement the Serializable interface java.io.Serializable saving of the bean’s fields is automatic, you need do nothing, everything is done by the JavaBean API the same applies to retrieving the bean’s persistent values

Loading and Saving an Object

Saving an Object

Restoring an Object

For more on JavaBeans JavaBeans Home Page -