Common Interfaces but... (Graphical) Component Assembly versus Usage Persistence Compon

  • 格式:pdf
  • 大小:650.53 KB
  • 文档页数:24

Examples of JavaBeans
USC - Center for Software Engineering
• GUI Items (e.g. Buttons, Listboxes) • (proprietary) Algorithms (e.g. Sorting) • (proprietary) Applications (e.g. DBs) => Service provider => Reusable components => Domain components
USC
CSE
USC - Center for Software Engineering
Java Beans
the only component architecture for Java?
Based in parts on “Java Beans API” from SUN
Alexander Egyed
• Beans support two mechanisms:
– use Java Serialization Mechanism which provides an automatic way of storing and restoring the internal state of Java objects – use Java Externalization Mechanism (extension of above) which gives a class complete control over the writing of its state
USC - Center for Software Engineering
Alexander Egyed, 4/15/99, 4
2
USC
CSE
JDK 1.1 (slide from Eric Chu, Sun)
USC - Center for Software Engineering
Alexander Egyed, 4/15/99, 5
Alexander Egyed, 4/15/99, 11
USC
CSE
Characteristics of JavaBeans?
USC - Center for Software Engineering
• Introspection: Ability of seeing inside a bean and analyzing how it works • Customization: Ability of manipulating the appearance or behavior of a bean while using the application • Event-Handling: Ability for beans to communicate with themselves and with their outside world • Properties: Both for customization and programmatic use • Persistence: Capturing the customized state of a bean for later (re) use • Security: just like regular Java security (applet vs. application)
USC - Center for Software Engineering
• • • • •
also • ease of use (design/runtime) • simple interface/complex behavior
Alexander Egyed, 4/15/99, 8
4
USC
CSE
Alexander Egyed, 4/15/99, 6
3
USC
CSE
What is JavaBeans?
USC - Center for Software Engineering
A Java Bean is a reusable software component that can be manipulated visually in a builder tool. • Beans frequently have strong visual aspects • Primarily targeted at builder tools: Web page builders, visual application builders, GUI layout builders, server application builders • May also be used ‘manually’ by programmers • Beans have capabilities for design time (e.g. customization features) and run time (e.g. actual functionality) - to separate them, beans support separate deign and run-time interfaces => download on demand)
• Besides properties (run-time state), beans also need to store customized information (e.g. how to deal with pointers to other beans).
Alexander Egyed, 4/15/99, 13
Class Libraries versus Beans • Not all modules should turn into beans • Beans are good for components that can be visually manipulated or customized • Class libraries are for everything else
CS612
April, 1999
Alexander Egyed, 4/15/99, 1
USC
CSE
Outline
USC - Center for Software Engineering
• • • • •
Java JavaBeans and their Characteristics JavaBeans Builder Tool Beans and Applications RMI, ActiveX, and CORBA
Alexander Egyed, 4/15/99, 9
USC
CSE
Other JavaBeans Issues

USC - Center for Software Engineering
Granularity • composite components as building blocks for (customizable) applications (e.g. button as component) • compound components (documents) as applications (e.g. spreadsheet into web page) • most components small to medium size Portability • provides implementation independent API • may still be implemented into platform specific containers Uniform API
USC
CSE
Java
USC - Center for Software Engineering
Java
• • • • Object-Oriented Portable Network Aware Common Interfaces
but ...
• (Graphical) Component Assembly versus Usage • Persistence • Component Interaction (e.g. two applets/applications)
Alexander Egyed, 4/15/99, 7
USC
CSE
Why JavaBeans?
software component model component architecture of choice for Java platform-neutral architecture developing or assembling network-aware solutions heterogeneous hardware and operating system (independent software vendors ISV)
Alexander Egyed, 4/15/99, 10
5
USC
CSE
JavaBeans
USC - Center for Software Engineering
Created by Sun; supported by Partners?
• Apple, Borland, IBM, Netscape, Oracle, Symantec, Sybase, and others
USC
CSE
Events
USC - Center for Software Engineering
• Are the core feature of Java Beans architectures • They allow components to be plugged together in application builders • Some components act as sources and others as targets (listeners) for events • Usually, events propagate state changes from the source object to all its listeners • Examples for events are mouse actions and widget updates • Listener components need to register to receive events • Event notifications are propagated by the event source via method invocation