1 / 30

MIDDLE WARE TECHNOLOGIES

MIDDLE WARE TECHNOLOGIES. B.TECH III YR II SEMESTER UNIT 7 PPT SLIDES TEXT BOOKS 1.Client/Server programming with Java and CORBA Robert Orfali and Dan Harkey, John Wiley & Sons,SPD 2nd Edition

vachel
Télécharger la présentation

MIDDLE WARE TECHNOLOGIES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MIDDLE WARE TECHNOLOGIES B.TECH III YR II SEMESTER UNIT 7 PPT SLIDES TEXT BOOKS 1.Client/Server programming with Java and CORBA Robert Orfali and Dan Harkey, John Wiley & Sons,SPD 2nd Edition 2. Java programming with CORBA 3rd Edition, G.Brose, A Vogel and K.Duddy, Wiley-dreamtech, India John wiley and sons

  2. INDEX UNIT 7 PPT SLIDES S.NO. TOPIC LECTURE NO. PPTSLIDES • Events L50 L1.1 TO L1.3 L51 L1.1 TO L1.3 2. properties L52 L1.1 TO L1.3 L53 L1.1 TO L1.3 • Persistency L54 L1.1 to L1.3 L55 L1.1 to L1.3 4. Introspective of beans. L56 L1.1 TO L1.4 5. CORBA Beans L57 L1.1 TO L1.5

  3. UNIT 7 SYLLABUS • Java Bean Component Model: Events, properties, persistency , Introspective of beans, CORBA Beans Lecture 1 slide 1

  4. Bean • Java beans are the software components that has been designed to be reusable in a variety of different environments Lecture 1 slide 1

  5. Java bean is basically a java class with the following rules 1.All the instance variables must be private 2. Access to the instance variables should be provided by using setXXX() and getXXX() methods 3.There should be a zero parameter constructor in the class Lecture 1 slide 2

  6. Bean program Ex: class Mybean { private int htno; Mybean() { } void setHtno( int x ) { htno = x; } int getHtno() { return htno; } } Lecture 1 slide 3

  7. BDK • BDK stands for BEAN DEVELOPEMENT KIT Beans are two types • Executing the Existing Beans • Executing the User-Defined Beans For Executing the JavaBeans Using BDK Compulsory You Have To Install JDK Lecture 2 slide 1

  8. BDK components • BDK Contains 3 types of Components: 1) Tool Box 2) Bean Box 3) Property Sheet Lecture 2 slide 2

  9. Bean development kit Lecture 2 slide 3

  10. Executing existing beans • Position the cursor on the tool box entry labeledjuggler and click left mouse button. • Move the cursor to the bean box area and click the left mouse button. • Position the cursor on the tool box entry labeled Our Button and click left mouse button. • Move the cursor to the bean box area and click the left mouse button. • Go to the properties window and change the label Lecture 3 slide 1

  11. Executing existing beans • By selecting the button, go to the menu bar of the Bean Box and select Edit – Events – action- action Performed. • You should see a line extending from the button to the cursor • Move the cursor so that the line drop inside the display area of juggler, and click left mouse button. Now you should see the Event Target Dialog Box. • The dialog box allows you to choose a method that should be invoked when the button is clicked Lecture 3 slide 2

  12. Executing existing beans Lecture 3 slide 3

  13. Executing existing beans Lecture 4 slide 1

  14. Executing existing beans Lecture 4 slide 2

  15. Procedure to executing user defined bean • For Executing the User Defined Beans with BDK we require 2 files 1. JAR File 2. Manifest File Lecture 4 slide 3

  16. JAR • JAR File stands for JAVA ARCHIEVE FILE • JAR Files are Java’s Version of zip Files • There are Two main uses for JAR files 1) The first use is to compress (make a smaller size) a number of files into one file (archiving) 2) It makes easy to download Lecture 5 slide 1

  17. jar • JAR files can be opened with WinZip or Winrar. In terms of Java applications, the ability to archive any number of source or class files into one single archive represents the biggest advantage - distributing one file containing hundreds of files is so much easier than distributing hundreds of files separately Lecture 5 slide 2

  18. Creation of jar • Creating a Jar file: The syntax of utility used to create jar file is Jar options (list of files) • List of Options:c: Create a new archive (jar)f : The first element in the file list is the name of the jar that is to be created or accessedm: The second element in the file list is the name of the external manifest filet : Tabulate the contents of jaru: Update the jar filex: Extract the files from jar0: Do not use compression v: Generate verbose output on standard output file Lecture 5 slide 3

  19. Multiple options can be used together. They all must appear after the "jar" command with no white space separating them. • Examples: • creating a jar file with name MT.jar that contains all the • .class and .gif files of the current directory • Jar cf MT.jar *.class *.gif • And with the above if we have a manifest file that is to be added • Then the above statement will become • Jar cfm MT.jar Manf.mf *.class *.gif Lecture 6 slide 1

  20. Example • Manifest file: • A developer must provide a manifest file to indicate • What are the components of a jar file and • Which of these components in a jar file are java beans • Ex : • name: sunw\demo\slides\fig1.gif • name: sunw\demo\slides\fig2.gif • name: sunw\demo\slides\slide.class • Java-bean: true Lecture 6 slide 2

  21. Example • import java.awt.*; • import java.awt.event.*; • public class Colors extends Canvas • { • private Color color; • private boolean rectangular; • public Colors() • { • addMouseListener(new MouseAdapter() • { • public void mousePressed(MouseEvent me) • { • change(); • } • }); Lecture 6 slide 3

  22. Example rectangular=false; setSize(200, 100); change(); } public boolean getRectangular() { return rectangular; } public void setRectangular(boolean flag) { this. rectangular = flag; repaint(); } Lecture 7 slide 1

  23. Example • public void change() • { • color = randomColor(); • repaint(); • } • private Color randomColor() • { • int r = (int)(255*Math.random()); • int g = (int)(255*Math.random()); • int b = (int)(255*Math.random()); • return new Color(r,g,b); • } Lecture 7 slide 2

  24. Example • public void paint (Graphics g) • { • Dimension d = getSize(); • int h = d.height; • int w = d.width; • g.setColor(color); • if(rectangular) • { • g.fillRect(0, 0, w-1, h-1); • } • else • { • g.fillOval(0, 0, w-1, h-1); • } • } • } Lecture 7 slide 3

  25. Executing existing beans • Compile the Colors. java file using Command Prompt • Create The Manifest file • Create Jar File • Load The Jar File into Bdk Lecture 7 slide 4

  26. Creating manifest file • Name: Colors. class • Java-Bean: True Save this file in the form of “manifest.mft” Lecture 8 slide 1

  27. Creating jar file • Start Command Prompt. • Navigate to the folder that holds your class files: C:\>rams • Compile your classes: C:\rams> javac *.java • Then create Manifest file • Create a jar file: C:\rams> jar cvfm bdk.jar manifest.mft *.class Lecture 8 slide 2

  28. MVC • MVC ( Model View Controller) • The MVC design pattern is the basis for the most web-application • frameworks today • Ex: Struts, JSF, Spring are all implementations of MVC design concept • The new programming environment called Ruby on rails is entirely based • on MVC design pattern • In MVC the Controller is implemented by using a servlet • View is implemented by JSP and the Model by Java beans Lecture 8 slide 3

  29. MVC • A servletis a Java programming language class that is used to extend the capabilities of servers that host applications access via a request-response programming model • Java Server Pages (JSP) is a technology based on the Java language and enables the development of dynamic web sites. • JSP was developed by Sun Microsystems to allow server side development. • JSP files are HTML files with special Tags, containing Java source code that provide the dynamic content Lecture 8 slide 4

  30. JSP tags • There are four main tags: 1. Declaration tag ( <%! %> ) 2. Expression tag ( <%= %>) 3. Directive Tag ( <%@ directive … %>) 4. Scriptlet tag ( <% … %> ) 5. Action tag (<jsp : usebean ----%> ) Lecture 8 slide 5

More Related